diff --git a/CHANGELOG.md b/CHANGELOG.md index 2040171..0a8e3b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,36 +11,75 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Renamed the package from `veeqtoh/prompt-deck` to `promptphp/deck`. +- Renamed the PHP namespace from `Veeqtoh\PromptDeck` to `PromptPHP\Deck`. +- Renamed the public package identity from Prompt Deck to Deck by PromptPHP. +- Updated installation, usage, README, badges, documentation links, and package metadata to reflect the new PromptPHP organisation. + ### Removed +- Removed the old `Veeqtoh\PromptDeck` public namespace. +- Removed old Prompt Deck naming from the main public API. + +## [0.3.1] - 2026-05-17 + +### Added + +- Mintlify documentation structure under the `docs` directory. [#5](https://github.com/promptphp/deck/pull/5) +- Documentation configuration, navigation, logo assets, favicon, and landing page content for the docs site. +- Dedicated documentation pages for installation, configuration, commands, prompt management, Laravel AI SDK integration, tracking, testing, and API reference. + +### Changed + +- Reworked the documentation from flat markdown files into organised Mintlify MDX pages. +- Updated documentation navigation and internal links for the new docs structure. +- Updated README logo/banner display and package badges. [#6](https://github.com/promptphp/deck/pull/6) +- Updated documentation copy and spelling consistency. + +### Fixed + +- Fixed stale documentation links and docs navigation paths. +- Fixed README badge markup and logo references. + ## [0.2.1] - 2026-03-28 ### Added -- This CHANGELOG file to hopefully serve as an evolving CHANGELOG. +- This CHANGELOG file to document project updates. - GitHub Actions workflow for automated testing. - `.gitattributes` file to manage text file handling and export-ignore rules. +- Laravel News feature badge in the README. + +### Changed + +- Refined Composer package keywords for better clarity and discoverability. ### Fixed -- README and documentation. +- README and documentation updates. ## [0.2.0] - 2026-03-27 ### Added -- Support for Laravel 13. [#3](https://github.com/veeqtoh/prompt-deck/pull/3) -- Configuration option to toggle auto-scaffolding of prompts on agent creation -- This CHANGELOG file to hopefully serve as an evolving CHANGELOG. +- Support for Laravel 13. [#3](https://github.com/promptphp/deck/pull/3) +- Configuration option to toggle auto-scaffolding of prompts on agent creation. ### Fixed -- README and documentation. +- README and documentation updates. ## [0.1.0] - 2026-03-04 ### Added -- First version. [#1](https://github.com/veeqtoh/prompt-deck/pull/1) +- First version. [#1](https://github.com/promptphp/deck/pull/1) +- Core versioned prompt management. +- File-based prompt storage using structured prompt directories. +- Variable interpolation for prompt templates. +- Artisan commands for creating, listing, testing, diffing, and activating prompts. +- Prompt execution tracking support. +- A/B testing support through versioned prompt activation and tracking. +- Optional Laravel AI SDK integration. - README documenting the package. -- Link to package's full documentation: [full documentation](https://vu-ddaf4ff3.mintlify.app/). +- Link to the package's full documentation. \ No newline at end of file diff --git a/README.md b/README.md index 8d0e3ad..8844866 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,53 @@

Prompt Deck Logo

-Latest Version on Packagist -PHP from Packagist -GitHub license - - Total Downloads on Packagist - - - Featured in Laravel News - + + Latest Version on Packagist + + + PHP from Packagist + + + GitHub license + + + Total Downloads on Packagist + + + Featured in Laravel News +

## Introduction -Prompt Deck helps you organise your AI Agents instructions as structured, version-controlled files, making it easy to iterate, compare, and activate prompt versions across your Laravel / PHP application. It provides variable interpolation, performance tracking, A/B testing, and optional seamless integration with the Laravel AI SDK. +Deck, formerly Prompt Deck, provides AI prompt management for Laravel and PHP. + +Organise your AI agent instructions as versioned files, compare prompt performance, and activate the right version across your app with variable interpolation, tracking, A/B testing, and Laravel AI SDK integration. + +> [!IMPORTANT] +> Prompt Deck is now **Deck by PromptPHP**. +> +> From `v0.4.0`, the package moved from `veeqtoh/prompt-deck` to `promptphp/deck`, and the namespace changed from `Veeqtoh\PromptDeck` to `PromptPHP\Deck`. +> +> Upgrading from `v0.3.x`? See the [upgrade guide](UPGRADE.md). ## Quick Start ### Installation ```bash -composer require veeqtoh/prompt-deck +composer require promptphp/deck ``` Publish the config and migrations ```bash -php artisan vendor:publish --provider="Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider" +php artisan vendor:publish --provider="PromptPHP\Deck\Providers\DeckServiceProvider" # Run migrations. php artisan migrate ``` + ### Creating a Prompt Use the Artisan command to create a versioned prompt @@ -42,7 +58,7 @@ php artisan make:prompt order-summary This creates the following structure -``` +```txt resources/prompts/ └── order-summary/ ├── v1/ @@ -59,19 +75,19 @@ Summarise the following order for the customer: {{ $order }}. ### Using a Prompt -Load and render prompts with the `PromptDeck` facade +Load and render prompts with the `Deck` facade ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; -// Load the active version of a prompt -$prompt = PromptDeck::get('order-summary'); +// Load the active version of a prompt. +$prompt = Deck::get('order-summary'); -// Render a role with variables +// Render a role with variables. $prompt->system(['tone' => 'friendly', 'order' => $orderDetails]); // "You are a friendly customer service agent. Summarise the following order..." -// Build a messages array ready for any chat-completion API +// Build a messages array ready for any chat-completion API. $messages = $prompt->toMessages(['tone' => 'friendly', 'order' => $orderDetails]); // [['role' => 'system', 'content' => '...']] ``` @@ -94,7 +110,7 @@ php artisan prompt:activate order-summary v2 Or load a specific version programmatically ```php -$prompt = PromptDeck::get('order-summary', 'v2'); +$prompt = Deck::get('order-summary', 'v2'); ``` ### Laravel AI SDK Integration @@ -102,7 +118,7 @@ $prompt = PromptDeck::get('order-summary', 'v2'); If you use the [Laravel AI SDK](https://laravel.com/docs/ai-sdk), add the `HasPromptTemplate` trait to your agents. This way, you do not need to define the `instructions()` method as it is provided automatically. ```php -use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; +use PromptPHP\Deck\Concerns\HasPromptTemplate; class OrderAgent extends Agent { @@ -120,24 +136,24 @@ For the complete guide, see the [full documentation](#documentation) below. ## Documentation -Full documentation can be found on the [Prompt Deck website](https://vu-ddaf4ff3.mintlify.app/) or the [docs](docs/) directory on GitHub. +Full documentation can be found at [https://deck.promptphp.com/](https://deck.promptphp.com/) or the [docs](docs/) directory on GitHub. ## Contributing -Thank you for considering contributing to Prompt Deck! Please open an issue or submit a pull request on [GitHub](https://github.com/veeqtoh/prompt-deck). +Thank you for considering contributing to Deck by PromptPHP. Please open an issue or submit a pull request on [GitHub](https://github.com/promptphp/deck). ## Code of Conduct -While we aren't affiliated with Laravel, we follow the Laravel [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). We expect you to abide by these guidelines as well. +We follow the Laravel [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). We expect you to abide by these guidelines as well. ## Security Vulnerabilities -If you discover a security vulnerability within Prompt Deck, please email Victor Ukam at [victorjohnukam@gmail.com](victorjohnukam@gmail.com). All security vulnerabilities will be addressed promptly. +If you discover a security vulnerability within Deck by PromptPHP, please email Victor Ukam at [victorjohnukam@gmail.com](victorjohnukam@gmail.com). All security vulnerabilities will be addressed promptly. ## License -Prompt Deck is open-sourced software licensed under the [MIT license](LICENSE). +Deck by PromptPHP is open-sourced software licensed under the [MIT license](LICENSE). ## Support -This library is created by [Victor Ukam](https://victorukam.com) with contributions from the [Open Source Community](https://github.com/veeqtoh/prompt-deck/graphs/contributors). If you've found this package useful, please consider [sponsoring this project](https://github.com/sponsors/veeqtoh). It will go a long way to help with maintenance. +This library is created by [Victor Ukam](https://victorukam.com) with contributions from the [Open Source Community](https://github.com/promptphp/deck/graphs/contributors). If you've found this package useful, please consider [sponsoring this project](https://github.com/sponsors/veeqtoh). It will go a long way to help with maintenance. diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..e25a65a --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,162 @@ +# Upgrade Guide + +- [Update Composer](#update-composer) +- [Update namespaces](#update-namespaces) +- [Update Laravel AI SDK trait imports](#update-laravel-ai-sdk-trait-imports) +- [Update config publishing](#update-config-publishing) +- [Update environment variables](#update-environment-variables) +- [Clear Laravel caches](#clear-laravel-caches) +- [Database notes](#database-notes) + +## Upgrading from Prompt Deck `v0.3.x` to Deck `v0.4.0` + +Deck `v0.4.0` is a breaking release. + +The package has moved from `veeqtoh/prompt-deck` to `promptphp/deck`, and the PHP namespace has changed from `Veeqtoh\PromptDeck` to `PromptPHP\Deck`. + +## 1. Update Composer + +Remove the old package: + +```bash +composer remove veeqtoh/prompt-deck +``` + +Install the new package: + +```bash +composer require promptphp/deck:^0.4 +``` + +## 2. Update namespaces + +Replace: + +```php +Veeqtoh\PromptDeck +``` + +with: + +```php +PromptPHP\Deck +``` + +Common replacements: + +```php +use Veeqtoh\PromptDeck\Facades\PromptDeck; +``` + +becomes: + +```php +use PromptPHP\Deck\Facades\Deck; +``` + +And usage changes from: + +```php +$prompt = PromptDeck::get('order-summary'); +``` + +to: + +```php +$prompt = Deck::get('order-summary'); +``` + +## 3. Update Laravel AI SDK trait imports + +Replace: + +```php +use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; +``` + +with: + +```php +use PromptPHP\Deck\Concerns\HasPromptTemplate; +``` + +## 4. Update config publishing + +>> [!IMPORTANT] +> The config file is now changed from **prompt-deck.php** to **deck.php**. + +If you previously published the config file, simply republish the config: + +```bash +php artisan vendor:publish --tag=deck-config +``` + +or rename from + +```bash +config/prompt-deck.php +``` + +to: + +```bash +config/deck.php +``` + +## 5. Update environment variables + +Replace old `PROMPTDECK_*` variables with `DECK_*`. + +```txt +PROMPTDECK_CACHE_ENABLED=true +PROMPTDECK_CACHE_STORE=file +PROMPTDECK_CACHE_TTL=3600 +PROMPTDECK_CACHE_PREFIX=prompt-deck: +PROMPTDECK_TRACKING_ENABLED=true +PROMPTDECK_DB_CONNECTION=null +PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=true +``` + +becomes: + +```txt +DECK_CACHE_ENABLED=true +DECK_CACHE_STORE=file +DECK_CACHE_TTL=3600 +DECK_CACHE_PREFIX=deck: +DECK_TRACKING_ENABLED=true +DECK_DB_CONNECTION=null +DECK_SCAFFOLD_ON_MAKE_AGENT=true +``` + +## 6. Clear Laravel caches + +```bash +php artisan optimize:clear +composer dump-autoload +``` + +## 7. Database notes + +No database table migration is required for the rename. + +The existing tracking tables remain: + +```txt +prompt_versions +prompt_executions +``` + +These table names describe the domain concept, not the old package name, so they are intentionally unchanged. + +### Summary of changes + +| Old | New | +| --------------------------- | --------------------- | +| `veeqtoh/prompt-deck` | `promptphp/deck` | +| `Veeqtoh\PromptDeck` | `PromptPHP\Deck` | +| `PromptDeck` facade | `Deck` facade | +| `PromptDeckServiceProvider` | `DeckServiceProvider` | +| `config/prompt-deck.php` | `config/deck.php` | +| `config('prompt-deck.*')` | `config('deck.*')` | +| `PROMPTDECK_*` env vars | `DECK_*` env vars | diff --git a/composer.json b/composer.json index 40e3bba..719f239 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { - "name": "veeqtoh/prompt-deck", - "description": "A Laravel package that adds versioned, file-based prompt management with variable interpolation, performance tracking, A/B testing, and optional seamless integration with the Laravel AI SDK.", + "name": "promptphp/deck", + "description": "Deck is a Laravel and PHP package for versioned, file-based AI prompt management with variable interpolation, performance tracking, A/B testing, and optional Laravel AI SDK integration.", "type": "library", - "homepage": "https://github.com/veeqtoh/prompt-deck", + "homepage": "https://github.com/promptphp/deck", "license": "MIT", "support": { - "issues": "https://github.com/veeqtoh/prompt-deck/issues", - "source": "https://github.com/veeqtoh/prompt-deck" + "issues": "https://github.com/promptphp/deck/issues", + "source": "https://github.com/promptphp/deck" }, "authors": [ { @@ -15,20 +15,20 @@ } ], "keywords": [ + "promptphp", + "deck", + "prompt-deck", "ai", - "laravel", - "laravel-package", - "laravel-ai", - "laravel-ai-sdk", - "agentic-prompting", - "agentic-ai", + "prompts", "prompt-management", "versioned-prompts", "file-based-prompts", "variable-interpolation", "performance-tracking", "ab-testing", - "victor-ukam" + "laravel", + "laravel-ai", + "laravel-package" ], "require": { "php": "^8.2", @@ -50,23 +50,23 @@ }, "autoload": { "psr-4": { - "Veeqtoh\\PromptDeck\\": "src/", - "Veeqtoh\\PromptDeck\\Database\\Factories\\": "src/database/factories/", - "Veeqtoh\\PromptDeck\\Database\\Seeders\\": "src/database/seeders/" + "PromptPHP\\Deck\\": "src/", + "PromptPHP\\Deck\\Database\\Factories\\": "src/database/factories/", + "PromptPHP\\Deck\\Database\\Seeders\\": "src/database/seeders/" } }, "autoload-dev": { "psr-4": { - "Veeqtoh\\PromptDeck\\Tests\\": "tests/" + "PromptPHP\\Deck\\Tests\\": "tests/" } }, "extra": { "laravel": { "providers": [ - "Veeqtoh\\PromptDeck\\Providers\\PromptDeckServiceProvider" + "PromptPHP\\Deck\\Providers\\DeckServiceProvider" ], "aliases": { - "PromptDeck": "Veeqtoh\\PromptDeck\\Facades\\PromptDeck" + "PromptDeck": "PromptPHP\\Deck\\Facades\\Deck" } } }, diff --git a/config/prompt-deck.php b/config/deck.php similarity index 77% rename from config/prompt-deck.php rename to config/deck.php index 6c82ed0..40a7d54 100644 --- a/config/prompt-deck.php +++ b/config/deck.php @@ -43,10 +43,10 @@ | */ 'cache' => [ - 'enabled' => env('PROMPTDECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), - 'store' => env('PROMPTDECK_CACHE_STORE', 'file'), // null to use default cache - 'ttl' => env('PROMPTDECK_CACHE_TTL', 3600), // seconds - 'prefix' => env('CACHE_PREFIX', env('PROMPTDECK_CACHE_PREFIX', 'prompt-deck:')), + 'enabled' => env('DECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), + 'store' => env('DECK_CACHE_STORE', 'file'), // null to use default cache + 'ttl' => env('DECK_CACHE_TTL', 3600), // seconds + 'prefix' => env('CACHE_PREFIX', env('DECK_CACHE_PREFIX', 'deck:')), ], /* @@ -59,8 +59,8 @@ | */ 'tracking' => [ - 'enabled' => env('PROMPTDECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), - 'connection' => env('PROMPTDECK_DB_CONNECTION'), // null for default + 'enabled' => env('DECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), + 'connection' => env('DECK_DB_CONNECTION'), // null for default ], /* @@ -69,9 +69,9 @@ |-------------------------------------------------------------------------- | | When the Laravel AI SDK is installed and this option is enabled, - | PromptDeck will automatically create a matching prompt directory + | Deck will automatically create a matching prompt directory | whenever you run `php artisan make:agent`. Set to false to disable. | */ - 'scaffold_on_make_agent' => env('PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT', true), + 'scaffold_on_make_agent' => env('DECK_SCAFFOLD_ON_MAKE_AGENT', true), ]; diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e0be1d4..fd2e6ef 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contribute to the documentation -Thank you for your interest in contributing to Prompt Deck's documentation! This guide will help you get started. +Thank you for your interest in contributing to the documentation. This guide will help you get started. ## How to contribute diff --git a/docs/LICENSE b/docs/LICENSE deleted file mode 100644 index 5411374..0000000 --- a/docs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Mintlify - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/docs/advanced/api-reference.mdx b/docs/advanced/api-reference.mdx index 87560fe..eb884dd 100644 --- a/docs/advanced/api-reference.mdx +++ b/docs/advanced/api-reference.mdx @@ -1,11 +1,11 @@ --- title: "API reference" -description: "Complete class and method reference for Prompt Deck." +description: "Complete class and method reference for Deck by PromptPHP." --- ## PromptManager -`Veeqtoh\PromptDeck\PromptManager` +`PromptPHP\Deck\PromptManager` The core service class responsible for loading, caching, versioning, and tracking prompts. Registered as a singleton in the service container. @@ -96,7 +96,7 @@ $manager->track('order-summary', 2, [ ## PromptTemplate -`Veeqtoh\PromptDeck\PromptTemplate` +`PromptPHP\Deck\PromptTemplate` Represents a loaded prompt with its roles, metadata, and interpolation capabilities. Implements `Illuminate\Contracts\Support\Arrayable`. @@ -212,9 +212,9 @@ $prompt->custom_role(); // renders 'custom_role' role --- -## PromptDeck facade +## Deck facade -`Veeqtoh\PromptDeck\Facades\PromptDeck` +`PromptPHP\Deck\Facades\Deck` Static proxy to the `PromptManager` singleton. @@ -222,19 +222,19 @@ Static proxy to the `PromptManager` singleton. | Method | Returns | Description | | ------------------------------------------------------------ | ---------------- | ------------------------------------------- | -| `PromptDeck::get(string $name, ?int $version = null)` | `PromptTemplate` | Load a prompt by name and optional version. | -| `PromptDeck::active(string $name)` | `PromptTemplate` | Load the active version of a prompt. | -| `PromptDeck::versions(string $name)` | `array` | List all versions for a prompt. | -| `PromptDeck::activate(string $name, int $version)` | `bool` | Activate a specific version. | -| `PromptDeck::track(string $name, int $version, array $data)` | `void` | Record a prompt execution. | +| `Deck::get(string $name, ?int $version = null)` | `PromptTemplate` | Load a prompt by name and optional version. | +| `Deck::active(string $name)` | `PromptTemplate` | Load the active version of a prompt. | +| `Deck::versions(string $name)` | `array` | List all versions for a prompt. | +| `Deck::activate(string $name, int $version)` | `bool` | Activate a specific version. | +| `Deck::track(string $name, int $version, array $data)` | `void` | Record a prompt execution. | --- ## HasPromptTemplate trait -`Veeqtoh\PromptDeck\Concerns\HasPromptTemplate` +`PromptPHP\Deck\Concerns\HasPromptTemplate` -Trait for integrating Prompt Deck templates with Laravel AI SDK agents. +Trait for integrating Deck templates with Laravel AI SDK agents. ### Methods @@ -274,7 +274,7 @@ Clear the cached `PromptTemplate`, forcing a fresh load on next access. Returns ## TrackPromptMiddleware -`Veeqtoh\PromptDeck\Ai\TrackPromptMiddleware` +`PromptPHP\Deck\Ai\TrackPromptMiddleware` Laravel AI SDK agent middleware that automatically tracks prompt executions. @@ -290,9 +290,9 @@ Only tracks agents that use the `HasPromptTemplate` trait (i.e. agents with a `p ## AfterMakeAgent listener -`Veeqtoh\PromptDeck\Listeners\AfterMakeAgent` +`PromptPHP\Deck\Listeners\AfterMakeAgent` -Listens for the Laravel AI SDK's `make:agent` command and automatically scaffolds a corresponding Prompt Deck prompt. +Listens for the Laravel AI SDK's `make:agent` command and automatically scaffolds a corresponding Deck prompt. ### Methods @@ -306,7 +306,7 @@ Handle the `CommandFinished` event. Only acts on successful `make:agent` command ### PromptVersion -`Veeqtoh\PromptDeck\Models\PromptVersion` +`PromptPHP\Deck\Models\PromptVersion` | Attribute | Type | Cast | Description | | --------------- | -------------- | --------- | ----------------------------------- | @@ -319,7 +319,7 @@ Handle the `CommandFinished` event. Only acts on successful `make:agent` command ### PromptExecution -`Veeqtoh\PromptDeck\Models\PromptExecution` +`PromptPHP\Deck\Models\PromptExecution` | Attribute | Type | Cast | Description | | ---------------- | -------------- | ----------- | ------------------------ | @@ -338,17 +338,17 @@ Handle the `CommandFinished` event. Only acts on successful `make:agent` command ## Exceptions -All Prompt Deck exceptions extend the base `PromptDeckException` class. +All Deck exceptions extend the base `DeckException` class. -### PromptDeckException +### DeckException -`Veeqtoh\PromptDeck\Exceptions\PromptDeckException` +`PromptPHP\Deck\Exceptions\DeckException` -Abstract base exception for all Prompt Deck errors. Extends PHP's `Exception` class. +Abstract base exception for all Deck errors. Extends PHP's `Exception` class. ### PromptNotFoundException -`Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException` +`PromptPHP\Deck\Exceptions\PromptNotFoundException` Thrown when a prompt directory does not exist. @@ -358,7 +358,7 @@ Thrown when a prompt directory does not exist. ### InvalidVersionException -`Veeqtoh\PromptDeck\Exceptions\InvalidVersionException` +`PromptPHP\Deck\Exceptions\InvalidVersionException` Thrown when a requested version does not exist or no versions are found. @@ -369,9 +369,9 @@ Thrown when a requested version does not exist or no versions are found. ### ConfigurationException -`Veeqtoh\PromptDeck\Exceptions\ConfigurationException` +`PromptPHP\Deck\Exceptions\ConfigurationException` -Thrown when Prompt Deck configuration is invalid. +Thrown when Deck configuration is invalid. | Factory Method | Description | | --------------------------------- | ------------------------------------------------------------------------------------------------ | @@ -379,7 +379,7 @@ Thrown when Prompt Deck configuration is invalid. ### PromptRenderingException -`Veeqtoh\PromptDeck\Exceptions\PromptRenderingException` +`PromptPHP\Deck\Exceptions\PromptRenderingException` Thrown when prompt rendering fails. diff --git a/docs/advanced/testing.mdx b/docs/advanced/testing.mdx index 4c56e3d..132e386 100644 --- a/docs/advanced/testing.mdx +++ b/docs/advanced/testing.mdx @@ -1,11 +1,11 @@ --- -title: "Testing" +title: "Testing"php description: "Testing strategies and examples for prompts, commands, tracking, and AI SDK integration." --- ## Introduction -Prompt Deck is designed to be easily testable. This guide covers strategies for testing prompts, commands, tracking, and AI SDK integration in your Laravel application. +Deck by PromptPHP is designed to be easily testable. This guide covers strategies for testing prompts, commands, tracking, and AI SDK integration in your Laravel application. ## Setting up tests @@ -19,21 +19,21 @@ If you're using Orchestra Testbench (recommended for package testing), register namespace Tests; use Orchestra\Testbench\TestCase as BaseTestCase; -use Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider; +use PromptPHP\Deck\Providers\DeckServiceProvider; abstract class TestCase extends BaseTestCase { protected function getPackageProviders($app): array { return [ - PromptDeckServiceProvider::class, + DeckServiceProvider::class, ]; } protected function getPackageAliases($app): array { return [ - 'PromptDeck' => \Veeqtoh\PromptDeck\Facades\PromptDeck::class, + 'Deck' => \PromptPHP\Deck\Facades\Deck::class, ]; } } @@ -46,9 +46,9 @@ For most tests, disable caching and tracking to avoid side effects: ```php protected function defineEnvironment($app): void { - $app['config']->set('prompt-deck.cache.enabled', false); - $app['config']->set('prompt-deck.tracking.enabled', false); - $app['config']->set('prompt-deck.path', $this->getFixturePath('prompts')); + $app['config']->set('deck.cache.enabled', false); + $app['config']->set('deck.tracking.enabled', false); + $app['config']->set('deck.path', $this->getFixturePath('prompts')); } protected function getFixturePath(string $path = ''): string @@ -90,29 +90,29 @@ Summarise this order: {{ $input }} ### Testing prompt loading ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; it('loads a prompt by name', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); expect($prompt->name())->toBe('order-summary'); expect($prompt->version())->toBe(1); }); it('throws when prompt does not exist', function () { - PromptDeck::get('non-existent'); -})->throws(\Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException::class); + Deck::get('non-existent'); +})->throws(\PromptPHP\Deck\Exceptions\PromptNotFoundException::class); it('throws when version does not exist', function () { - PromptDeck::get('order-summary', 999); -})->throws(\Veeqtoh\PromptDeck\Exceptions\InvalidVersionException::class); + Deck::get('order-summary', 999); +})->throws(\PromptPHP\Deck\Exceptions\InvalidVersionException::class); ``` ### Testing variable interpolation ```php it('interpolates variables in prompt content', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); $content = $prompt->system(['tone' => 'friendly']); @@ -121,7 +121,7 @@ it('interpolates variables in prompt content', function () { }); it('leaves unmatched placeholders intact', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); $content = $prompt->system([]); @@ -133,26 +133,26 @@ it('leaves unmatched placeholders intact', function () { ```php it('lists available roles', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); expect($prompt->roles())->toContain('system', 'user'); }); it('checks if a role exists', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); expect($prompt->has('system'))->toBeTrue(); expect($prompt->has('nonexistent'))->toBeFalse(); }); it('returns empty string for missing roles', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); expect($prompt->role('nonexistent'))->toBe(''); }); it('gets raw content without interpolation', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); $raw = $prompt->raw('system'); @@ -164,7 +164,7 @@ it('gets raw content without interpolation', function () { ```php it('builds messages array for AI APIs', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); $messages = $prompt->toMessages(['tone' => 'friendly', 'input' => 'Order #123']); @@ -174,7 +174,7 @@ it('builds messages array for AI APIs', function () { }); it('filters messages to specific roles', function () { - $prompt = PromptDeck::get('order-summary', 1); + $prompt = Deck::get('order-summary', 1); $messages = $prompt->toMessages([], ['system']); @@ -188,11 +188,11 @@ it('filters messages to specific roles', function () { You can mock the facade in tests where you don't want filesystem access: ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\Facades\Deck; +use PromptPHP\Deck\PromptTemplate; it('uses a mocked prompt', function () { - PromptDeck::shouldReceive('get') + Deck::shouldReceive('get') ->with('order-summary', null) ->andReturn(new PromptTemplate( 'order-summary', @@ -201,7 +201,7 @@ it('uses a mocked prompt', function () { ['description' => 'Test prompt'] )); - $prompt = PromptDeck::get('order-summary'); + $prompt = Deck::get('order-summary'); expect($prompt->system())->toBe('You are a helpful assistant.'); }); @@ -211,7 +211,7 @@ it('uses a mocked prompt', function () { ```php it('lists all versions for a prompt', function () { - $versions = PromptDeck::versions('order-summary'); + $versions = Deck::versions('order-summary'); expect($versions)->toBeArray(); expect($versions[0])->toHaveKey('version'); @@ -219,7 +219,7 @@ it('lists all versions for a prompt', function () { it('activates a specific version', function () { // With tracking disabled, this writes to metadata.json - $result = PromptDeck::activate('order-summary', 1); + $result = Deck::activate('order-summary', 1); expect($result)->toBeTrue(); }); @@ -232,7 +232,7 @@ When testing tracking, enable it and run the migrations in your test setup: ```php protected function defineEnvironment($app): void { - $app['config']->set('prompt-deck.tracking.enabled', true); + $app['config']->set('deck.tracking.enabled', true); $app['config']->set('database.default', 'testing'); } @@ -243,10 +243,10 @@ protected function defineDatabaseMigrations(): void ``` ```php -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptExecution; it('tracks prompt executions', function () { - PromptDeck::track('order-summary', 1, [ + Deck::track('order-summary', 1, [ 'input' => ['message' => 'test'], 'output' => 'response', 'tokens' => 100, @@ -258,9 +258,9 @@ it('tracks prompt executions', function () { }); it('does not track when disabled', function () { - config(['prompt-deck.tracking.enabled' => false]); + config(['deck.tracking.enabled' => false]); - PromptDeck::track('order-summary', 1, ['tokens' => 50]); + Deck::track('order-summary', 1, ['tokens' => 50]); expect(PromptExecution::count())->toBe(0); }); @@ -271,8 +271,8 @@ it('does not track when disabled', function () { Use the included factories to seed test data: ```php -use Veeqtoh\PromptDeck\Models\PromptVersion; -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptVersion; +use PromptPHP\Deck\Models\PromptExecution; it('queries execution data', function () { PromptExecution::factory() @@ -307,7 +307,7 @@ it('creates a prompt via make:prompt', function () { $this->artisan('make:prompt', ['name' => 'test-prompt']) ->assertSuccessful(); - $promptPath = config('prompt-deck.path') . '/test-prompt/v1'; + $promptPath = config('deck.path') . '/test-prompt/v1'; expect(File::isDirectory($promptPath))->toBeTrue(); expect(File::exists($promptPath . '/system.md'))->toBeTrue(); }); @@ -355,7 +355,7 @@ it('shows diff between versions', function () { Create a test agent class that uses the trait: ```php -use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; +use PromptPHP\Deck\Concerns\HasPromptTemplate; class TestAgent { diff --git a/docs/advanced/tracking.mdx b/docs/advanced/tracking.mdx index 9b3d3ae..6b50aba 100644 --- a/docs/advanced/tracking.mdx +++ b/docs/advanced/tracking.mdx @@ -6,7 +6,7 @@ sidebarTitle: "Tracking" ## Introduction -Prompt Deck includes an optional database tracking system that logs prompt versions and execution data. This enables: +Deck by PromptPHP includes an optional database tracking system that logs prompt versions and execution data. This enables: - **Performance monitoring** — Track token usage, latency, and cost per prompt version. - **A/B testing** — Compare performance metrics across different prompt versions. @@ -14,25 +14,25 @@ Prompt Deck includes an optional database tracking system that logs prompt versi - **Cost analysis** — Monitor API spending per prompt, model, and provider. - **User feedback** — Attach ratings and comments to individual executions. -Tracking is entirely optional. Prompt Deck works fully without it. +Tracking is entirely optional. Deck works fully without it. ## Setup ### Enable tracking -Set the tracking configuration in `config/prompt-deck.php`: +Set the tracking configuration in `config/deck.php`: ```php 'tracking' => [ - 'enabled' => env('PROMPTDECK_TRACKING_ENABLED', true), - 'connection' => env('PROMPTDECK_DB_CONNECTION'), + 'enabled' => env('DECK_TRACKING_ENABLED', true), + 'connection' => env('DECK_DB_CONNECTION'), ], ``` Or via environment variable: ```dotenv -PROMPTDECK_TRACKING_ENABLED=true +DECK_TRACKING_ENABLED=true ``` By default, tracking is **disabled** when `APP_DEBUG=true` and **enabled** in production. @@ -42,7 +42,7 @@ By default, tracking is **disabled** when `APP_DEBUG=true` and **enabled** in pr Publish and run the migrations to create the required tables: ```bash -php artisan vendor:publish --tag=prompt-deck-migrations +php artisan vendor:publish --tag=deck-migrations php artisan migrate ``` @@ -51,7 +51,7 @@ php artisan migrate By default, tracking uses your application's default database connection. To store tracking data on a separate database: ```dotenv -PROMPTDECK_DB_CONNECTION=analytics +DECK_DB_CONNECTION=analytics ``` The connection name must match a connection defined in `config/database.php`. @@ -111,12 +111,12 @@ Logs individual prompt executions with performance data. ### Manual tracking -Use the `PromptDeck::track()` method to record an execution manually: +Use the `Deck::track()` method to record an execution manually: ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; -PromptDeck::track('order-summary', 2, [ +Deck::track('order-summary', 2, [ 'input' => ['message' => 'Summarise order #1234'], 'output' => 'Your order contains 3 items totalling $150.00...', 'tokens' => 150, @@ -132,10 +132,10 @@ All fields in the data array are optional. You can track as little or as much as ```php // Minimal tracking — just record that the prompt was used -PromptDeck::track('order-summary', 2, []); +Deck::track('order-summary', 2, []); // Track only tokens and cost -PromptDeck::track('order-summary', 2, [ +Deck::track('order-summary', 2, [ 'tokens' => 150, 'cost' => 0.002, ]); @@ -162,16 +162,16 @@ When using the [Laravel AI SDK integration](/integrations/ai-sdk), the `TrackPro ## Eloquent models -Prompt Deck provides two Eloquent models for interacting with tracking data. +Deck provides two Eloquent models for interacting with tracking data. ### PromptVersion -`Veeqtoh\PromptDeck\Models\PromptVersion` +`PromptPHP\Deck\Models\PromptVersion` Represents a prompt version record in the `prompt_versions` table. ```php -use Veeqtoh\PromptDeck\Models\PromptVersion; +use PromptPHP\Deck\Models\PromptVersion; // Find the active version $active = PromptVersion::where('name', 'order-summary') @@ -196,12 +196,12 @@ $versions = PromptVersion::where('name', 'order-summary') ### PromptExecution -`Veeqtoh\PromptDeck\Models\PromptExecution` +`PromptPHP\Deck\Models\PromptExecution` Represents an execution record in the `prompt_executions` table. ```php -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptExecution; // Get recent executions $recent = PromptExecution::where('prompt_name', 'order-summary') @@ -240,7 +240,7 @@ Both models include factories for testing. ### PromptVersionFactory ```php -use Veeqtoh\PromptDeck\Models\PromptVersion; +use PromptPHP\Deck\Models\PromptVersion; // Create a basic version $version = PromptVersion::factory()->create(); @@ -267,7 +267,7 @@ $version = PromptVersion::factory() ### PromptExecutionFactory ```php -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptExecution; // Create a basic execution $execution = PromptExecution::factory()->create(); @@ -299,7 +299,7 @@ $execution = PromptExecution::factory() ### Basic queries ```php -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptExecution; // Total executions for a prompt $count = PromptExecution::where('prompt_name', 'order-summary')->count(); @@ -383,11 +383,11 @@ $dailyCost = PromptExecution::where('prompt_name', 'order-summary') When tracking is enabled, version activation is managed through the `prompt_versions` table instead of `metadata.json` files. This provides a centralised, queryable record of version history. -The `PromptDeck::activate()` method and `prompt:activate` command automatically use the appropriate storage (database or file) based on your tracking configuration. +The `Deck::activate()` method and `prompt:activate` command automatically use the appropriate storage (database or file) based on your tracking configuration. ```php // Activate programmatically -PromptDeck::activate('order-summary', 2); +Deck::activate('order-summary', 2); // Query active versions $activeVersions = PromptVersion::where('is_active', true)->get(); diff --git a/docs/core/commands.mdx b/docs/core/commands.mdx index f1b26ff..f647116 100644 --- a/docs/core/commands.mdx +++ b/docs/core/commands.mdx @@ -5,7 +5,7 @@ description: "All available Artisan commands for managing prompts from the comma ## Introduction -Prompt Deck registers five Artisan commands for managing your prompts from the command line. All commands are available when running in the console. +Deck by PromptPHP registers five Artisan commands for managing your prompts from the command line. All commands are available when running in the console. | Command | Description | | ----------------- | ------------------------------------------------------------ | diff --git a/docs/core/make-prompt.mdx b/docs/core/make-prompt.mdx index 00bc559..d5d77db 100644 --- a/docs/core/make-prompt.mdx +++ b/docs/core/make-prompt.mdx @@ -1,11 +1,11 @@ --- title: "Creating prompts" -description: "Generate versioned, role-based prompt structures with the make:prompt Artisan command." +description: "Generate versioned, role-based prompt structures with the `make:prompt` Artisan command." --- ## Introduction -Prompt Deck provides an Artisan generator command that scaffolds versioned, role-based prompt structures for your AI agents. The command follows Laravel conventions and supports interactive workflows, automatic versioning, customisable stubs, and rich metadata — everything you need to manage prompts as first-class project assets. +Deck by PromptPHP provides an Artisan generator command that scaffolds versioned, role-based prompt structures for your AI agents. The command follows Laravel conventions and supports interactive workflows, automatic versioning, customisable stubs, and rich metadata. ## Generating prompts @@ -92,7 +92,7 @@ resources/prompts/ └── metadata.json ``` -The file extension is controlled by the `prompt-deck.extension` configuration value (default: `md`). For example, setting it to `txt` produces `system.txt`, `user.txt`, etc. +The file extension is controlled by the `deck.extension` configuration value (default: `md`). For example, setting it to `txt` produces `system.txt`, `user.txt`, etc. ### Metadata @@ -197,7 +197,7 @@ All scaffolded roles (including `system` and optionally `user`) are recorded in ## Versioning -Prompt Deck uses directory-based versioning. Each version lives in its own sub-directory (`v1/`, `v2/`, etc.) inside the prompt folder. +Deck uses directory-based versioning. Each version lives in its own sub-directory (`v1/`, `v2/`, etc.) inside the prompt folder. ### Auto-increment @@ -253,7 +253,7 @@ To customise the stubs for your project, create a `stubs/prompt-deck/` directory ``` your-app/ └── stubs/ - └── prompt-deck/ + └── deck/ ├── system-prompt.stub ├── user-prompt.stub └── role-prompt.stub @@ -288,12 +288,12 @@ This normalisation applies to both the prompt name and any extra role names prov ## Configuration -The command respects the following values from `config/prompt-deck.php`: +The command respects the following values from `config/deck.php`: | Key | Default | Description | | ----------------------- | -------------------------- | --------------------------------------------------- | -| `prompt-deck.path` | `resource_path('prompts')` | Base directory where prompt structures are created. | -| `prompt-deck.extension` | `md` | File extension for generated prompt files. | +| `deck.path` | `resource_path('prompts')` | Base directory where prompt structures are created. | +| `deck.extension` | `md` | File extension for generated prompt files. | See the full [Configuration](/getting-started/configuration) reference for all options. diff --git a/docs/core/prompts.mdx b/docs/core/prompts.mdx index 2bc77fe..d4c1699 100644 --- a/docs/core/prompts.mdx +++ b/docs/core/prompts.mdx @@ -5,14 +5,14 @@ description: "Load, render, version, cache, and track AI prompts in your Laravel ## Introduction -Prompt Deck provides a clean, expressive API for loading, rendering, and managing versioned AI prompts in your Laravel application. Prompts are stored as plain files on disk and organised by name, version, and role. They are accessed through the `PromptDeck` facade, which feels like any other first-party Laravel service. +Deck by PromptPHP provides a clean, expressive API for loading, rendering, and managing versioned AI prompts in your Laravel application. Prompts are stored as plain files on disk and organised by name, version, and role. They are accessed through the `Deck` facade. A prompt can contain multiple **roles** (system, user, assistant, developer, tool, or any custom role you define). Each role's content supports `{{ $variable }}` interpolation, and the entire prompt can be converted into a messages array ready to send to OpenAI, Anthropic, or any chat-completion API. ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; -$prompt = PromptDeck::get('order-summary'); +$prompt = Deck::get('order-summary'); $prompt->system(['tone' => 'friendly']); // "You are a friendly AI assistant..." @@ -23,18 +23,18 @@ $prompt->user(['input' => $request->message]); ## Retrieving prompts -### The PromptDeck facade +### The Deck facade -The `PromptDeck` facade is the primary entry point for loading prompts. It delegates to the `PromptManager` singleton registered by the service provider: +The `Deck` facade is the primary entry point for loading prompts. It delegates to the `PromptManager` singleton registered by the service provider: ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; -// Load the active version -$prompt = PromptDeck::get('order-summary'); +// Load the active version. +$prompt = Deck::get('order-summary'); -// Load a specific version -$prompt = PromptDeck::get('order-summary', 2); +// Load a specific version. +$prompt = Deck::get('order-summary', 2); ``` The `get` method returns a `PromptTemplate` instance. If no version is specified, the [active version](#version-resolution-order) is resolved automatically. @@ -44,7 +44,7 @@ The `get` method returns a `PromptTemplate` instance. If no version is specified You can also inject the `PromptManager` directly via Laravel's service container: ```php -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; class OrderController extends Controller { @@ -65,7 +65,7 @@ The `PromptManager` is registered as a singleton, so the same instance is reused Use the `active` method to explicitly load the active version: ```php -$prompt = PromptDeck::active('order-summary'); +$prompt = Deck::active('order-summary'); $prompt->version(); // e.g. 3 ``` @@ -77,7 +77,7 @@ This is equivalent to calling `get()` without a version number. Pass a version number as the second argument to `get` to load a specific version, regardless of which version is currently active: ```php -$prompt = PromptDeck::get('order-summary', 1); +$prompt = Deck::get('order-summary', 1); $prompt->version(); // 1 ``` @@ -93,15 +93,15 @@ Once you have a `PromptTemplate` instance, you can render any role's content wit The most expressive way to render a role is to call it as a method directly on the prompt instance. This uses PHP's `__call` magic method and works for **any** role — not just `system` and `user`: ```php -$prompt = PromptDeck::get('code-reviewer'); +$prompt = Deck::get('code-reviewer'); -// Render the system role +// Render the system role. $prompt->system(['tone' => 'professional']); -// Render the user role +// Render the user role. $prompt->user(['input' => $code]); -// Render custom roles +// Render custom roles. $prompt->assistant(['context' => $history]); $prompt->developer(['task' => 'review']); $prompt->tool(['name' => 'search']); @@ -184,7 +184,7 @@ $prompt->version(); // 2 The `toMessages` method builds a messages array compatible with OpenAI, Anthropic, and other chat-completion APIs. It renders every role with the given variables and returns them in definition order: ```php -$messages = PromptDeck::get('chat-agent')->toMessages([ +$messages = Deck::get('chat-agent')->toMessages([ 'tone' => 'helpful', 'input' => $userMessage, ]); @@ -229,7 +229,7 @@ Roles specified in the filter that don't exist in the prompt are silently skippe ### Syntax -Prompt Deck supports two placeholder syntaxes within prompt files: +Deck by PromptPHP supports two placeholder syntaxes within prompt files: | Syntax | Example | | -------------------- | ------------- | @@ -301,7 +301,7 @@ Each version directory can contain: Retrieve all versions for a prompt programmatically: ```php -$versions = PromptDeck::versions('order-summary'); +$versions = Deck::versions('order-summary'); // [ // ['version' => 1, 'path' => '...', 'metadata' => [...]], @@ -324,7 +324,7 @@ See [Artisan Commands — prompt:list](/core/commands#promptlist) for details. Set a specific version as the active version: ```php -PromptDeck::activate('order-summary', 2); +Deck::activate('order-summary', 2); ``` **When database tracking is enabled**, this updates the `prompt_versions` table — setting `is_active = false` on all versions of that prompt, then `is_active = true` on the specified version. @@ -341,7 +341,7 @@ See [Artisan Commands — prompt:activate](/core/commands#promptactivate) for de ### Version resolution order -When you call `PromptDeck::get('name')` without a version, the active version is resolved in this priority order: +When you call `Deck::get('name')` without a version, the active version is resolved in this priority order: 1. **Database** — If tracking is enabled, looks for a version marked `is_active = true` in the `prompt_versions` table for that prompt name. 2. **metadata.json** — Reads the `active_version` key from the prompt's root `metadata.json` file. @@ -354,12 +354,12 @@ If no versions exist at all, an `InvalidVersionException` is thrown. When caching is enabled, loaded prompts are stored in your configured cache store to avoid repeated filesystem reads: ```php -// config/prompt-deck.php +// config/deck.php 'cache' => [ - 'enabled' => env('PROMPTDECK_CACHE_ENABLED', true), - 'store' => env('PROMPTDECK_CACHE_STORE', 'file'), + 'enabled' => env('DECK_CACHE_ENABLED', true), + 'store' => env('DECK_CACHE_STORE', 'file'), 'ttl' => 3600, // seconds - 'prefix' => 'prompt-deck:', + 'prefix' => 'deck:', ], ``` @@ -374,7 +374,7 @@ See [Configuration — Cache](/getting-started/configuration#cache) for the full When database tracking is enabled, you can log prompt executions for performance monitoring, A/B testing, and audit trails: ```php -PromptDeck::track('order-summary', 2, [ +Deck::track('order-summary', 2, [ 'input' => ['message' => 'Summarise order #1234'], 'output' => 'Your order contains...', 'tokens' => 150, diff --git a/docs/docs.json b/docs/docs.json index 2c804b8..99ebaf5 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -45,12 +45,12 @@ "anchors": [ { "anchor": "GitHub", - "href": "https://github.com/promptphp/prompt-deck", + "href": "https://github.com/promptphp/deck", "icon": "github" }, { "anchor": "Packagist", - "href": "https://packagist.org/packages/veeqtoh/prompt-deck", + "href": "https://packagist.org/packages/promptphp/deck", "icon": "box" } ] @@ -64,7 +64,7 @@ "links": [ { "label": "GitHub", - "href": "https://github.com/promptphp/prompt-deck" + "href": "https://github.com/promptphp/deck" }, { "label": "Sponsor", @@ -86,7 +86,7 @@ }, "footer": { "socials": { - "github": "https://github.com/promptphp/prompt-deck" + "github": "https://github.com/promptphp/deck" } } } diff --git a/docs/favicon.svg b/docs/favicon.svg index b785c73..2f1a293 100644 --- a/docs/favicon.svg +++ b/docs/favicon.svg @@ -1,19 +1,6 @@ - - - - - - - - - - - - - - - - - - + + + + + diff --git a/docs/getting-started/configuration.mdx b/docs/getting-started/configuration.mdx index 6f64b67..9720ed4 100644 --- a/docs/getting-started/configuration.mdx +++ b/docs/getting-started/configuration.mdx @@ -1,21 +1,21 @@ --- title: "Configuration" -description: "All available configuration options for Prompt Deck." +description: "All available configuration options for Deck by PromptPHP." --- ## Introduction -Prompt Deck ships with sensible defaults that work out of the box. Like most Laravel packages, all configuration lives in `config/prompt-deck.php` and every option can be overridden via environment variables for deployment flexibility. +Deck by PromptPHP ships with sensible defaults that work out of the box. Like most Laravel packages, all configuration lives in `config/deck.php` and every option can be overridden via environment variables for deployment flexibility. ## Publishing the configuration Publish the configuration file using the Artisan command: ```bash -php artisan vendor:publish --tag=prompt-deck-config +php artisan vendor:publish --tag=deck-config ``` -This copies the package's default configuration to `config/prompt-deck.php` in your application. Once published, you can modify it freely. +This copies the package's default configuration to `config/deck.php` in your application. Once published, you can modify it freely. ## Prompts path @@ -81,17 +81,17 @@ The `cache` section controls prompt caching behaviour. Caching avoids repeated f ```php 'cache' => [ - 'enabled' => env('PROMPTDECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), - 'store' => env('PROMPTDECK_CACHE_STORE', 'file'), - 'ttl' => env('PROMPTDECK_CACHE_TTL', 3600), - 'prefix' => env('CACHE_PREFIX', env('PROMPTDECK_CACHE_PREFIX', 'prompt-deck:')), + 'enabled' => env('DECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), + 'store' => env('DECK_CACHE_STORE', 'file'), + 'ttl' => env('DECK_CACHE_TTL', 3600), + 'prefix' => env('CACHE_PREFIX', env('DECK_CACHE_PREFIX', 'deck:')), ], ``` ### Enabling / disabling ```php -'enabled' => env('PROMPTDECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), +'enabled' => env('DECK_CACHE_ENABLED', env('APP_DEBUG', false) ? false : true), ``` By default, caching is **disabled** when `APP_DEBUG=true` (local development) and **enabled** in production. This ensures that file changes are picked up immediately during development. @@ -99,14 +99,14 @@ By default, caching is **disabled** when `APP_DEBUG=true` (local development) an Override via your `.env`: ```dotenv -PROMPTDECK_CACHE_ENABLED=false # Always disable caching -PROMPTDECK_CACHE_ENABLED=true # Always enable caching +DECK_CACHE_ENABLED=false # Always disable caching +DECK_CACHE_ENABLED=true # Always enable caching ``` ### Cache store ```php -'store' => env('PROMPTDECK_CACHE_STORE', 'file'), +'store' => env('DECK_CACHE_STORE', 'file'), ``` The cache store to use. Must match a store name defined in your `config/cache.php`. Common values: @@ -121,7 +121,7 @@ The cache store to use. Must match a store name defined in your `config/cache.ph ### TTL ```php -'ttl' => env('PROMPTDECK_CACHE_TTL', 3600), +'ttl' => env('DECK_CACHE_TTL', 3600), ``` Cache time-to-live in **seconds**. After this duration, the prompt is re-read from disk on the next access. Default is 3600 seconds (1 hour). @@ -129,15 +129,15 @@ Cache time-to-live in **seconds**. After this duration, the prompt is re-read fr ### Cache key prefix ```php -'prefix' => env('CACHE_PREFIX', env('PROMPTDECK_CACHE_PREFIX', 'prompt-deck:')), +'prefix' => env('CACHE_PREFIX', env('DECK_CACHE_PREFIX', 'deck:')), ``` -The prefix prepended to all cache keys. The final cache key follows the pattern: `{prefix}{prompt-name}.v{version}`. +The prefix prepended to all cache keys. The final cache key follows the pattern: `{prefix}{name}.v{version}`. For example, with the default prefix: ``` -prompt-deck:order-summary.v2 +deck:order-summary.v2 ``` ## Database tracking @@ -146,21 +146,21 @@ The `tracking` section controls whether prompt versions and executions are logge ```php 'tracking' => [ - 'enabled' => env('PROMPTDECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), - 'connection' => env('PROMPTDECK_DB_CONNECTION'), + 'enabled' => env('DECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), + 'connection' => env('DECK_DB_CONNECTION'), ], ``` ### Enabling / disabling ```php -'enabled' => env('PROMPTDECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), +'enabled' => env('DECK_TRACKING_ENABLED', env('APP_DEBUG', false) ? false : true), ``` Like caching, tracking is **disabled** in debug mode and **enabled** in production by default. When enabled: - **Version activation** is stored in the `prompt_versions` database table (instead of `metadata.json`). -- **Execution tracking** via `PromptDeck::track()` inserts records into the `prompt_executions` table. +- **Execution tracking** via `Deck::track()` inserts records into the `prompt_executions` table. You must publish and run the migrations before enabling tracking. See @@ -171,27 +171,27 @@ Like caching, tracking is **disabled** in debug mode and **enabled** in producti ### Database connection ```php -'connection' => env('PROMPTDECK_DB_CONNECTION'), +'connection' => env('DECK_DB_CONNECTION'), ``` The database connection to use for tracking tables. Set to `null` (the default) to use your application's default connection. Set to a named connection from `config/database.php` if you want tracking data stored on a separate database: ```dotenv -PROMPTDECK_DB_CONNECTION=analytics +DECK_DB_CONNECTION=analytics ``` ## AI SDK integration ```php -'scaffold_on_make_agent' => env('PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT', true), +'scaffold_on_make_agent' => env('DECK_SCAFFOLD_ON_MAKE_AGENT', true), ``` -When the [Laravel AI SDK](https://laravel.com/docs/ai-sdk) is installed and this option is `true`, Prompt Deck automatically creates a matching prompt directory whenever you run `php artisan make:agent`. See the [AI SDK Integration](/integrations/ai-sdk) documentation for details. +When the [Laravel AI SDK](https://laravel.com/docs/ai-sdk) is installed and this option is `true`, Deck automatically creates a matching prompt directory whenever you run `php artisan make:agent`. See the [AI SDK Integration](/integrations/ai-sdk) documentation for details. Set to `false` to disable automatic scaffolding: ```dotenv -PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=false +DECK_SCAFFOLD_ON_MAKE_AGENT=false ``` ## Full configuration reference @@ -204,7 +204,7 @@ PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=false | `cache.enabled` | `bool` | `true` (prod) / `false` (debug) | Enable prompt caching. | | `cache.store` | `string` | `file` | Cache store name. | | `cache.ttl` | `int` | `3600` | Cache TTL in seconds. | -| `cache.prefix` | `string` | `prompt-deck:` | Cache key prefix. | +| `cache.prefix` | `string` | `deck:` | Cache key prefix. | | `tracking.enabled` | `bool` | `true` (prod) / `false` (debug) | Enable database tracking. | | `tracking.connection` | `string\|null` | `null` | Database connection name. | | `scaffold_on_make_agent` | `bool` | `true` | Auto-scaffold prompts on `make:agent`. | @@ -213,10 +213,10 @@ PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=false | Variable | Default | Description | | ----------------------------------- | -------------- | --------------------------------- | -| `PROMPTDECK_CACHE_ENABLED` | Dynamic | Enable/disable caching. | -| `PROMPTDECK_CACHE_STORE` | `file` | Cache store to use. | -| `PROMPTDECK_CACHE_TTL` | `3600` | Cache TTL in seconds. | -| `PROMPTDECK_CACHE_PREFIX` | `prompt-deck:` | Cache key prefix. | -| `PROMPTDECK_TRACKING_ENABLED` | Dynamic | Enable/disable database tracking. | -| `PROMPTDECK_DB_CONNECTION` | `null` | Database connection for tracking. | -| `PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT` | `true` | Auto-scaffold on `make:agent`. | +| `DECK_CACHE_ENABLED` | Dynamic | Enable/disable caching. | +| `DECK_CACHE_STORE` | `file` | Cache store to use. | +| `DECK_CACHE_TTL` | `3600` | Cache TTL in seconds. | +| `DECK_CACHE_PREFIX` | `deck:` | Cache key prefix. | +| `DECK_TRACKING_ENABLED` | Dynamic | Enable/disable database tracking. | +| `DECK_DB_CONNECTION` | `null` | Database connection for tracking. | +| `DECK_SCAFFOLD_ON_MAKE_AGENT` | `true` | Auto-scaffold on `make:agent`. | diff --git a/docs/getting-started/installation.mdx b/docs/getting-started/installation.mdx index 7116c9d..c23b2b1 100644 --- a/docs/getting-started/installation.mdx +++ b/docs/getting-started/installation.mdx @@ -1,11 +1,11 @@ --- title: "Installation" -description: "Requirements, setup, and environment configuration for Prompt Deck." +description: "Requirements, setup, and environment configuration for Deck by PromptPHP." --- ## Requirements -Prompt Deck has the following requirements: +Deck by PromptPHP has the following requirements: | Dependency | Version | | ---------- | ---------- | @@ -24,12 +24,12 @@ Prompt Deck has the following requirements: | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `laravel/ai` | Enables deep integration with Laravel AI SDK agents to support automatic instructions loading, prompt version tracking in conversations, and auto-scaffolding prompts when creating agents. | -## Installing Prompt Deck +## Installing Deck by PromptPHP Install the package via Composer: ```bash -composer require veeqtoh/prompt-deck +composer require promptphp/deck ``` @@ -43,17 +43,17 @@ composer require veeqtoh/prompt-deck Publish the configuration file to customise Prompt Deck's behaviour: ```bash -php artisan vendor:publish --tag=prompt-deck-config +php artisan vendor:publish --tag=deck-config ``` -This creates `config/prompt-deck.php` in your application. See the [Configuration](/getting-started/configuration) documentation for a full reference of all available options. +This creates `config/deck.php` in your application. See the [Configuration](/getting-started/configuration) documentation for a full reference of all available options. ## Publishing migrations If you plan to use database tracking for prompt versions and execution logging, publish and run the migrations: ```bash -php artisan vendor:publish --tag=prompt-deck-migrations +php artisan vendor:publish --tag=deck-migrations php artisan migrate ``` @@ -65,7 +65,7 @@ This creates two tables: | `prompt_executions` | Logs individual prompt executions with tokens, latency, cost, and feedback data. | - Database tracking is optional. Prompt Deck works fully without it as version + Database tracking is optional. Deck works fully without it as version activation falls back to `metadata.json` files, and execution tracking is simply disabled. @@ -73,26 +73,26 @@ This creates two tables: If you prefer, you may publish both the configuration and migration files by running a single command: ```bash -php artisan vendor:publish --provider="Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider" +php artisan vendor:publish --provider="PromptPHP\Deck\Providers\DeckServiceProvider" ``` ## Environment variables -Add the following to your `.env` file to configure Prompt Deck's runtime behaviour: +Add the following to your `.env` file to configure Deck's runtime behaviour: ```dotenv # Cache -PROMPTDECK_CACHE_ENABLED=true # Enable/disable prompt caching (default: true in production, false when APP_DEBUG=true) -PROMPTDECK_CACHE_STORE=file # Cache store to use (file, redis, memcached, etc.) -PROMPTDECK_CACHE_TTL=3600 # Cache time-to-live in seconds -PROMPTDECK_CACHE_PREFIX=prompt-deck: # Cache key prefix +DECK_CACHE_ENABLED=true # Enable/disable prompt caching (default: true in production, false when APP_DEBUG=true) +DECK_CACHE_STORE=file # Cache store to use (file, redis, memcached, etc.) +DECK_CACHE_TTL=3600 # Cache time-to-live in seconds +DECK_CACHE_PREFIX=prompt-deck: # Cache key prefix # Database Tracking -PROMPTDECK_TRACKING_ENABLED=true # Enable/disable database tracking (default: true in production, false when APP_DEBUG=true) -PROMPTDECK_DB_CONNECTION= # Database connection name (null for default) +DECK_TRACKING_ENABLED=true # Enable/disable database tracking (default: true in production, false when APP_DEBUG=true) +DECK_DB_CONNECTION= # Database connection name (null for default) # AI SDK Integration -PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=true # Auto-create prompt when running make:agent +DECK_SCAFFOLD_ON_MAKE_AGENT=true # Auto-create prompt when running `make:agent` ``` All environment variables are optional as sensible defaults are provided. @@ -102,13 +102,13 @@ All environment variables are optional as sensible defaults are provided. After installation, verify everything is working: ```bash -# Create your first prompt +# Create your first prompt. php artisan make:prompt hello-world -# List all prompts +# List all prompts. php artisan prompt:list -# Test the prompt +# Test the prompt. php artisan prompt:test hello-world ``` @@ -124,7 +124,7 @@ If you have disabled auto-discovery, add the provider and facade to your `bootst // bootstrap/providers.php (Laravel 11+) return [ // ... - Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider::class, + PromptPHP\Deck\Providers\DeckServiceProvider::class, ]; ``` @@ -133,12 +133,12 @@ Or for `config/app.php`: ```php 'providers' => [ // ... - Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider::class, + PromptPHP\Deck\Providers\DeckServiceProvider::class, ], 'aliases' => [ // ... - 'PromptDeck' => Veeqtoh\PromptDeck\Facades\PromptDeck::class, + 'PromptDeck' => PromptPHP\Deck\Facades\Deck::class, ], ``` @@ -150,7 +150,7 @@ Or for `config/app.php`: icon="gear" href="/getting-started/configuration" > - Customise Prompt Deck's behaviour. + Customise Deck's behaviour. - Install, configure, and verify Prompt Deck in your Laravel project. + Install, configure, and verify Deck in your Laravel project. ## Quick usage @@ -47,19 +47,19 @@ Summarise the following order for the customer: {{ $order }}. ### Using a prompt -Load and render prompts with the `PromptDeck` facade: +Load and render prompts with the `Deck` facade: ```php -use Veeqtoh\PromptDeck\Facades\PromptDeck; +use PromptPHP\Deck\Facades\Deck; -// Load the active version of a prompt -$prompt = PromptDeck::get('order-summary'); +// Load the active version of a prompt. +$prompt = Deck::get('order-summary'); -// Render a role with variables +// Render a role with variables. $prompt->system(['tone' => 'friendly', 'order' => $orderDetails]); // "You are a friendly customer service agent. Summarise the following order..." -// Build a messages array ready for any chat-completion API +// Build a messages array ready for any chat-completion API. $messages = $prompt->toMessages(['tone' => 'friendly', 'order' => $orderDetails]); // [['role' => 'system', 'content' => '...']] ``` @@ -82,7 +82,7 @@ php artisan prompt:activate order-summary v2 Or load a specific version programmatically: ```php -$prompt = PromptDeck::get('order-summary', 'v2'); +$prompt = Deck::get('order-summary', 'v2'); ``` ### Laravel AI SDK integration @@ -90,13 +90,13 @@ $prompt = PromptDeck::get('order-summary', 'v2'); If you use the [Laravel AI SDK](https://laravel.com/docs/ai-sdk), add the `HasPromptTemplate` trait to your agents. This way, you do not need to define the `instructions()` method as it is provided automatically. ```php -use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; +use PromptPHP\Deck\Concerns\HasPromptTemplate; class OrderAgent extends Agent { use HasPromptTemplate; - // instructions() and promptMessages() are provided automatically + // instructions() and promptMessages() are provided automatically. } ``` diff --git a/docs/index.mdx b/docs/index.mdx index 3e4befd..b3cadaa 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -1,6 +1,6 @@ --- title: "Welcome" -description: Organise, version, and test your AI agent instructions with Prompt Deck, a powerful Laravel package for seamless AI integration. +description: Organise, version, and test your AI agent instructions with Deck by PromptPHP, a powerful Laravel & PHP package for seamless AI integration. mode: "custom" --- @@ -10,16 +10,16 @@ mode: "custom"
{/* Hero Section */}
- {/*
- ✨ Now available for Laravel 11+ -
*/} +
+ ✨ Formerly Prompt Deck - Now Deck by PromptPHP +

- Prompt Deck + Deck by PromptPHP

- Organise your AI Agent instructions as structured, version-controlled files in your Laravel application. + Organise agent instructions as versioned files, test prompt changes, track performance, and ship better AI workflows with confidence.

@@ -70,7 +70,7 @@ mode: "custom" {/* Interactive Code Preview Block */}
- +

A workflow natural to you.

Run one artisan command, version your prompts.

@@ -78,7 +78,7 @@ mode: "custom" ```bash Artisan Command - # Generate a versioned system prompt template + # Generate a versioned system prompt template. php artisan make:prompt order-summary ``` @@ -88,10 +88,10 @@ mode: "custom" ``` ```php Implementation (Controller) - use Veeqtoh\PromptDeck\Facades\PromptDeck; + use PromptPHP\Deck\Facades\Deck; // Loads active markdown context and returns compiled payload arrays - $messages = PromptDeck::get('order-summary') + $messages = Deck::get('order-summary') ->toMessages([ 'tone' => 'friendly', 'order' => $orderDetails diff --git a/docs/integrations/ai-sdk.mdx b/docs/integrations/ai-sdk.mdx index d170ac5..f1de018 100644 --- a/docs/integrations/ai-sdk.mdx +++ b/docs/integrations/ai-sdk.mdx @@ -1,38 +1,38 @@ --- title: "Laravel AI SDK integration" -description: "Use Prompt Deck with Laravel AI SDK agents for automatic prompt loading, version tracking, and performance monitoring." +description: "Use Deck by PromptPHP with Laravel AI SDK agents for automatic prompt loading, version tracking, and performance monitoring." sidebarTitle: "Laravel AI SDK" --- ## Introduction -Prompt Deck provides first-class, optional integration with the [Laravel AI SDK](https://laravel.com/docs/ai-sdk). When the AI SDK is installed, you get: +Deck by PromptPHP provides first-class, optional integration with the [Laravel AI SDK](https://laravel.com/docs/ai-sdk). When the AI SDK is installed, you get: - **Automatic prompt scaffolding** — Running `make:agent` automatically creates a matching prompt directory. - **The `HasPromptTemplate` trait** — Provides `instructions()` and `promptMessages()` methods that load versioned prompts directly into your AI agents. -- **The `TrackPromptMiddleware`** — Automatically records prompt executions (tokens, latency, model, etc.) using Prompt Deck's tracking system. +- **The `TrackPromptMiddleware`** — Automatically records prompt executions (tokens, latency, model, etc.) using Deck's tracking system. -All of this is entirely optional. Prompt Deck works perfectly without the AI SDK. +All of this is entirely optional. Deck works perfectly without the AI SDK. ## Installation -Prompt Deck does **not** require the AI SDK — it's listed as a `suggest` dependency. Install it when you're ready: +Deck does **not** require the AI SDK — it's listed as a `suggest` dependency. Install it when you're ready: ```bash composer require laravel/ai ``` -Once `laravel/ai` is installed, Prompt Deck's AI SDK features activate automatically. No additional configuration is needed. +Once `laravel/ai` is installed, Deck's AI SDK features activate automatically. No additional configuration is needed. ## Automatic prompt scaffolding -When the Laravel AI SDK is installed, Prompt Deck automatically hooks into the `make:agent` command. Whenever you create a new agent: +When the Laravel AI SDK is installed, Deck automatically hooks into the `make:agent` command. Whenever you create a new agent: ```bash php artisan make:agent SalesCoach ``` -Prompt Deck detects the successful command and automatically runs: +Deck detects the successful command and automatically runs: ```bash php artisan make:prompt sales-coach @@ -42,7 +42,7 @@ This creates a versioned prompt directory ready for the agent to use via the `Ha ### How it works -Prompt Deck registers a listener (`AfterMakeAgent`) on Laravel's `CommandFinished` event. When `make:agent` completes successfully, the listener: +Deck registers a listener (`AfterMakeAgent`) on Laravel's `CommandFinished` event. When `make:agent` completes successfully, the listener: 1. Extracts the agent name from the command input. 2. Converts it to kebab-case (`SalesCoach` → `sales-coach`). @@ -59,7 +59,7 @@ $ php artisan make:agent SalesCoach INFO Agent [app/Ai/Agents/SalesCoach.php] created successfully. -PromptDeck: Created prompt sales-coach for SalesCoach. +Deck: Created prompt sales-coach for SalesCoach. ``` ### Disabling auto-scaffolding @@ -67,14 +67,14 @@ PromptDeck: Created prompt sales-coach for SalesCoach. To disable automatic prompt scaffolding, set the configuration option: ```php -// config/prompt-deck.php +// config/deck.php 'scaffold_on_make_agent' => false, ``` Or via environment variable: ```dotenv -PROMPTDECK_SCAFFOLD_ON_MAKE_AGENT=false +DECK_SCAFFOLD_ON_MAKE_AGENT=false ``` ## Quick start @@ -88,7 +88,7 @@ namespace App\Ai\Agents; use Laravel\Ai\Contracts\Agent; use Laravel\Ai\Promptable; -use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; +use PromptPHP\Deck\Concerns\HasPromptTemplate; class SalesCoach implements Agent { @@ -99,15 +99,15 @@ class SalesCoach implements Agent } ``` -That's it. The `HasPromptTemplate` trait provides the `instructions()` method required by the `Agent` contract, loading the system prompt from your Prompt Deck files. +That's it. The `HasPromptTemplate` trait provides the `instructions()` method required by the `Agent` contract, loading the system prompt from your Deck files. ## The HasPromptTemplate trait -The `HasPromptTemplate` trait bridges Prompt Deck's file-based templates with the Laravel AI SDK's agent contracts. +The `HasPromptTemplate` trait bridges Deck's file-based templates with the Laravel AI SDK's agent contracts. ### How it maps to AI SDK contracts -| Prompt Deck | AI SDK | Description | +| Deck | AI SDK | Description | | ------------------------------- | ----------------------------------- | ----------------------------------------------- | | `system.md` role file | `instructions()` | Agent's system prompt. | | `user.md`, `assistant.md`, etc. | `messages()` via `promptMessages()` | Conversation context. | @@ -197,7 +197,7 @@ Variables are interpolated into **all** roles (system, user, assistant, etc.) wh ## Full agent example -Here's a complete agent using all Prompt Deck features with the AI SDK: +Here's a complete agent using all Deck features with the AI SDK: ```php - Set the tracking configuration in `config/prompt-deck.php`: + Set the tracking configuration in `config/deck.php`: ```php 'tracking' => [ @@ -366,14 +366,14 @@ The `TrackPromptMiddleware` automatically records prompt executions via Prompt D ```bash - php artisan vendor:publish --tag=prompt-deck-migrations + php artisan vendor:publish --tag=deck-migrations php artisan migrate ``` ```php use Laravel\Ai\Contracts\HasMiddleware; - use Veeqtoh\PromptDeck\Ai\TrackPromptMiddleware; + use PromptPHP\Deck\Ai\TrackPromptMiddleware; class SalesCoach implements Agent, HasMiddleware { @@ -474,4 +474,4 @@ $messages = $agent->promptMessages(); // [Message('user', '...'), ...] ``` -This allows you to use Prompt Deck's template loading in any context, not just with the AI SDK. +This allows you to use Deck's template loading in any context, not just with the AI SDK. diff --git a/phpunit.xml b/phpunit.xml index 349296d..142e5d4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -26,7 +26,7 @@ - - + + diff --git a/src/Ai/TrackPromptMiddleware.php b/src/Ai/TrackPromptMiddleware.php index 7b482bb..fd1a37a 100644 --- a/src/Ai/TrackPromptMiddleware.php +++ b/src/Ai/TrackPromptMiddleware.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Ai; +namespace PromptPHP\Deck\Ai; use Closure; -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; /** * Laravel AI SDK agent middleware that automatically tracks - * prompt executions through PromptDeck's tracking system. + * prompt executions through Deck's tracking system. * * Add this middleware to any agent that uses HasPromptTemplate * to enable automatic performance tracking (tokens, latency, model, etc.). @@ -27,7 +27,7 @@ * * Requires: * - laravel/ai package - * - PromptDeck tracking enabled in config + * - Deck tracking enabled in config * - The agent to use the HasPromptTemplate trait * * @see https://laravel.com/docs/ai-sdk#middleware @@ -56,7 +56,7 @@ public function handle(mixed $prompt, Closure $next): mixed } /** - * Record the prompt execution via PromptDeck's tracking system. + * Record the prompt execution via Deck's tracking system. */ protected function trackExecution(mixed $prompt, mixed $response, int $startTime): void { diff --git a/src/Concerns/HasPromptTemplate.php b/src/Concerns/HasPromptTemplate.php index 7e17401..9347100 100644 --- a/src/Concerns/HasPromptTemplate.php +++ b/src/Concerns/HasPromptTemplate.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Concerns; +namespace PromptPHP\Deck\Concerns; use Stringable; -use Veeqtoh\PromptDeck\PromptManager; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\PromptManager; +use PromptPHP\Deck\PromptTemplate; /** - * Trait for integrating PromptDeck templates with Laravel AI SDK agents. + * Trait for integrating Deck templates with Laravel AI SDK agents. * * Provides automatic loading of system instructions and conversation messages - * from versioned prompt files managed by PromptDeck. Use this trait alongside + * from versioned prompt files managed by Deck. Use this trait alongside * the Promptable trait in your Agent classes: * * class SalesCoach implements Agent, Conversational @@ -34,7 +34,7 @@ trait HasPromptTemplate protected ?PromptTemplate $cachedPromptTemplate = null; /** - * Get the prompt name to load from PromptDeck. + * Get the prompt name to load from Deck. * * Defaults to the kebab-cased class name (e.g. SalesCoach → sales-coach). * Override this method to use a custom prompt name. @@ -95,7 +95,7 @@ public function promptTemplate(): PromptTemplate /** * Get the agent's system instructions from the prompt template. * - * Loads the 'system' role content from the PromptDeck template + * Loads the 'system' role content from the Deck template * and interpolates variables from promptVariables(). * * This satisfies the Laravel AI SDK Agent contract's instructions() method. @@ -110,7 +110,7 @@ public function instructions(): Stringable|string /** * Get prompt roles converted to Laravel AI SDK Message objects. * - * Converts PromptDeck template roles into Message instances + * Converts Deck template roles into Message instances * suitable for the Conversational contract's messages() method. * By default excludes the 'system' role (which goes through instructions()). * diff --git a/src/Console/Commands/ActivatePromptCommand.php b/src/Console/Commands/ActivatePromptCommand.php index 26ff8fc..d0cedce 100644 --- a/src/Console/Commands/ActivatePromptCommand.php +++ b/src/Console/Commands/ActivatePromptCommand.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Console\Commands; +namespace PromptPHP\Deck\Console\Commands; use Illuminate\Console\Command; -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; class ActivatePromptCommand extends Command { diff --git a/src/Console/Commands/ListPromptsCommand.php b/src/Console/Commands/ListPromptsCommand.php index 7185bd8..5f6f4ce 100644 --- a/src/Console/Commands/ListPromptsCommand.php +++ b/src/Console/Commands/ListPromptsCommand.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Console\Commands; +namespace PromptPHP\Deck\Console\Commands; use Illuminate\Console\Command; -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; class ListPromptsCommand extends Command { @@ -23,7 +23,7 @@ public function __construct(PromptManager $manager) public function handle(): int { - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); if (! is_dir($basePath)) { $this->warn('Prompts directory not found.'); diff --git a/src/Console/Commands/MakePromptCommand.php b/src/Console/Commands/MakePromptCommand.php index 444b2f0..a2da658 100644 --- a/src/Console/Commands/MakePromptCommand.php +++ b/src/Console/Commands/MakePromptCommand.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Console\Commands; +namespace PromptPHP\Deck\Console\Commands; use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; @@ -39,7 +39,7 @@ public function handle(): int } $name = $this->toKebabCase($rawName); - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); // Resolve description. $description = $this->option('desc') @@ -64,7 +64,7 @@ public function handle(): int } // Determine file extension - $extension = config('prompt-deck.extension', 'md'); + $extension = config('deck.extension', 'md'); // Create system prompt file (always created by default). $systemFile = "{$versionPath}/system.{$extension}"; @@ -250,7 +250,7 @@ protected function resolveExtraRoles(bool $autoInteractive = false): array */ protected function resolveStubPath(string $stub): string { - $publishedPath = $this->laravel->basePath("stubs/prompt-deck/{$stub}"); + $publishedPath = $this->laravel->basePath("stubs/deck/{$stub}"); if ($this->files->exists($publishedPath)) { return $publishedPath; diff --git a/src/Console/Commands/PromptDiffCommand.php b/src/Console/Commands/PromptDiffCommand.php index 8d75ce0..86f76c3 100644 --- a/src/Console/Commands/PromptDiffCommand.php +++ b/src/Console/Commands/PromptDiffCommand.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Console\Commands; +namespace PromptPHP\Deck\Console\Commands; use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; use SebastianBergmann\Diff\Differ; use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; -use Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException; +use PromptPHP\Deck\Exceptions\PromptNotFoundException; class PromptDiffCommand extends Command { @@ -40,13 +40,13 @@ public function handle(): int return Command::FAILURE; } - $basePath = config('prompt-deck.path').'/'.$name; + $basePath = config('deck.path').'/'.$name; if (! $this->files->isDirectory($basePath)) { throw PromptNotFoundException::named($name); } - $ext = config('prompt-deck.extension', 'md'); + $ext = config('deck.extension', 'md'); $filesToCompare = []; if ($type === 'system' || $type === 'all') { diff --git a/src/Console/Commands/TestPromptCommand.php b/src/Console/Commands/TestPromptCommand.php index a1532f7..23476fa 100644 --- a/src/Console/Commands/TestPromptCommand.php +++ b/src/Console/Commands/TestPromptCommand.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Console\Commands; +namespace PromptPHP\Deck\Console\Commands; use Illuminate\Console\Command; -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; class TestPromptCommand extends Command { diff --git a/src/Database/Factories/PromptExecutionFactory.php b/src/Database/Factories/PromptExecutionFactory.php index 9dd2568..7ae030b 100644 --- a/src/Database/Factories/PromptExecutionFactory.php +++ b/src/Database/Factories/PromptExecutionFactory.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Database\Factories; +namespace PromptPHP\Deck\Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Veeqtoh\PromptDeck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptExecution; class PromptExecutionFactory extends Factory { diff --git a/src/Database/Factories/PromptVersionFactory.php b/src/Database/Factories/PromptVersionFactory.php index 4814b8f..c70be73 100644 --- a/src/Database/Factories/PromptVersionFactory.php +++ b/src/Database/Factories/PromptVersionFactory.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Database\Factories; +namespace PromptPHP\Deck\Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Veeqtoh\PromptDeck\Models\PromptVersion; +use PromptPHP\Deck\Models\PromptVersion; class PromptVersionFactory extends Factory { diff --git a/src/Exceptions/ConfigurationException.php b/src/Exceptions/ConfigurationException.php index e86ece3..43853fc 100644 --- a/src/Exceptions/ConfigurationException.php +++ b/src/Exceptions/ConfigurationException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Exceptions; +namespace PromptPHP\Deck\Exceptions; -class ConfigurationException extends PromptDeckException +class ConfigurationException extends DeckException { /** * Create a new exception for an invalid prompts path configuration. diff --git a/src/Exceptions/DeckException.php b/src/Exceptions/DeckException.php new file mode 100644 index 0000000..ea19c9c --- /dev/null +++ b/src/Exceptions/DeckException.php @@ -0,0 +1,12 @@ +output->writeln( - "PromptDeck: Created prompt {$promptName} for agent {$agentName}." + "Deck: Created prompt {$promptName} for agent {$agentName}." ); } } catch (\Throwable) { // Swallow errors — the agent was already created successfully. - // We don't want PromptDeck to break the make:agent workflow. + // We don't want Deck to break the make:agent workflow. } } diff --git a/src/Models/PromptExecution.php b/src/Models/PromptExecution.php index 4e3d450..7b727d5 100644 --- a/src/Models/PromptExecution.php +++ b/src/Models/PromptExecution.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Models; +namespace PromptPHP\Deck\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Veeqtoh\PromptDeck\Database\Factories\PromptExecutionFactory; +use PromptPHP\Deck\Database\Factories\PromptExecutionFactory; class PromptExecution extends Model { diff --git a/src/Models/PromptVersion.php b/src/Models/PromptVersion.php index 6570dd9..cc4e975 100644 --- a/src/Models/PromptVersion.php +++ b/src/Models/PromptVersion.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Models; +namespace PromptPHP\Deck\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Veeqtoh\PromptDeck\Database\Factories\PromptVersionFactory; +use PromptPHP\Deck\Database\Factories\PromptVersionFactory; class PromptVersion extends Model { diff --git a/src/PromptManager.php b/src/PromptManager.php index cd48ae7..65dabd1 100644 --- a/src/PromptManager.php +++ b/src/PromptManager.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck; +namespace PromptPHP\Deck; use Illuminate\Contracts\Cache\Repository as Cache; use Illuminate\Contracts\Config\Repository as Config; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\DB; -use Veeqtoh\PromptDeck\Exceptions\InvalidVersionException; -use Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException; +use PromptPHP\Deck\Exceptions\InvalidVersionException; +use PromptPHP\Deck\Exceptions\PromptNotFoundException; class PromptManager { @@ -32,23 +32,23 @@ public function __construct(string $basePath, string $extension, Cache $cache, C $this->extension = ltrim($extension, '.'); $this->cache = $cache; $this->config = $config; - $this->trackingConfig = $config->get('prompt-deck.tracking'); + $this->trackingConfig = $config->get('deck.tracking'); } /** * Get a prompt instance by name and optional version. * If version is not provided, the active version will be used. * - * PromptDeck::get('order-summary') // active version. - * PromptDeck::get('order-summary', 2) // specific version. + * Deck::get('order-summary') // active version. + * Deck::get('order-summary', 2) // specific version. */ public function get(string $name, ?int $version = null): PromptTemplate { $version ??= $this->getActiveVersion($name); - $cacheKey = $this->config->get('prompt-deck.cache.prefix', 'prompt-deck:')."{$name}.v{$version}"; + $cacheKey = $this->config->get('deck.cache.prefix', 'deck:')."{$name}.v{$version}"; // Attempt to load from cache. - if ($this->config->get('prompt-deck.cache.enabled')) { + if ($this->config->get('deck.cache.enabled')) { $cached = $this->cache->get($cacheKey); if ($cached) { @@ -65,8 +65,8 @@ public function get(string $name, ?int $version = null): PromptTemplate $promptData = $this->loadFromFiles($name, $version); // Cache if enabled. - if ($this->config->get('prompt-deck.cache.enabled')) { - $this->cache->put($cacheKey, $promptData, now()->addSeconds($this->config->get('prompt-deck.cache.ttl'))); + if ($this->config->get('deck.cache.enabled')) { + $this->cache->put($cacheKey, $promptData, now()->addSeconds($this->config->get('deck.cache.ttl'))); } return new PromptTemplate( diff --git a/src/PromptTemplate.php b/src/PromptTemplate.php index 3618fa0..2c8e5ef 100644 --- a/src/PromptTemplate.php +++ b/src/PromptTemplate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck; +namespace PromptPHP\Deck; use Illuminate\Contracts\Support\Arrayable; diff --git a/src/Providers/PromptDeckServiceProvider.php b/src/Providers/DeckServiceProvider.php similarity index 63% rename from src/Providers/PromptDeckServiceProvider.php rename to src/Providers/DeckServiceProvider.php index 6ed0fe1..30ffe7b 100644 --- a/src/Providers/PromptDeckServiceProvider.php +++ b/src/Providers/DeckServiceProvider.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Providers; +namespace PromptPHP\Deck\Providers; use Illuminate\Console\Events\CommandFinished; use Illuminate\Support\Facades\Event; use Illuminate\Support\ServiceProvider; -use Veeqtoh\PromptDeck\Console\Commands\ActivatePromptCommand; -use Veeqtoh\PromptDeck\Console\Commands\ListPromptsCommand; -use Veeqtoh\PromptDeck\Console\Commands\MakePromptCommand; -use Veeqtoh\PromptDeck\Console\Commands\PromptDiffCommand; -use Veeqtoh\PromptDeck\Console\Commands\TestPromptCommand; -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\Console\Commands\ActivatePromptCommand; +use PromptPHP\Deck\Console\Commands\ListPromptsCommand; +use PromptPHP\Deck\Console\Commands\MakePromptCommand; +use PromptPHP\Deck\Console\Commands\PromptDiffCommand; +use PromptPHP\Deck\Console\Commands\TestPromptCommand; +use PromptPHP\Deck\PromptManager; -class PromptDeckServiceProvider extends ServiceProvider +class DeckServiceProvider extends ServiceProvider { /** * Bootstrap the application services. @@ -35,27 +35,27 @@ public function register(): void } /** - * Setup the configuration for PromptDeck. + * Setup the configuration for Deck. */ protected function configure(): void { // Merge config. $this->mergeConfigFrom( - __DIR__.'/../../config/prompt-deck.php', 'prompt-deck' + __DIR__.'/../../config/deck.php', 'deck' ); // Register the main manager as a singleton. $this->app->singleton(PromptManager::class, function ($app) { return new PromptManager( - config('prompt-deck.path'), - config('prompt-deck.extension'), - $app['cache']->store(config('prompt-deck.cache.store')), + config('deck.path'), + config('deck.extension'), + $app['cache']->store(config('deck.cache.store')), $app['config'] ); }); // Register a facade alias. - $this->app->alias(PromptManager::class, 'prompt-deck'); + $this->app->alias(PromptManager::class, 'deck'); } /** @@ -67,17 +67,17 @@ protected function registerPublishing(): void if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/../database/migrations/' => database_path('migrations'), - ], 'prompt-deck-migrations'); + ], 'deck-migrations'); // Publish config. $this->publishes([ - __DIR__.'/../../config/prompt-deck.php' => config_path('prompt-deck.php'), - ], 'prompt-deck-config'); + __DIR__.'/../../config/deck.php' => config_path('deck.php'), + ], 'deck-config'); } } /** - * Register Artisan commands for PromptDeck. + * Register Artisan commands for Deck. */ protected function registerArtisanCommands(): void { @@ -98,13 +98,13 @@ protected function registerArtisanCommands(): void protected function registerAiSdkIntegration(): void { if (class_exists(\Laravel\Ai\AiServiceProvider::class)) { - $this->app->singleton(\Veeqtoh\PromptDeck\Ai\TrackPromptMiddleware::class); + $this->app->singleton(\PromptPHP\Deck\Ai\TrackPromptMiddleware::class); // Auto-scaffold a prompt when `make:agent` finishes successfully. - if (config('prompt-deck.scaffold_on_make_agent', true)) { + if (config('deck.scaffold_on_make_agent', true)) { Event::listen( CommandFinished::class, - \Veeqtoh\PromptDeck\Listeners\AfterMakeAgent::class + \PromptPHP\Deck\Listeners\AfterMakeAgent::class ); } } diff --git a/tests/Architecture/ClassesTest.php b/tests/Architecture/ClassesTest.php index d6c6d69..62ad72d 100644 --- a/tests/Architecture/ClassesTest.php +++ b/tests/Architecture/ClassesTest.php @@ -3,12 +3,12 @@ use Illuminate\Support\Facades\Facade; use Illuminate\Support\ServiceProvider; -test('PromptDeck provider class extends base Laravel service provider class') - ->expect('Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider') +test('Deck provider class extends base Laravel service provider class') + ->expect('PromptPHP\Deck\Providers\DeckServiceProvider') ->classes() ->toExtend(ServiceProvider::class); -test('PromptDeck facade class extends base Laravel facade class') - ->expect('Veeqtoh\PromptDeck\Facades\PromptDeck') +test('Deck facade class extends base Laravel facade class') + ->expect('PromptPHP\Deck\Facades\Deck') ->classes() ->toExtend(Facade::class); diff --git a/tests/Architecture/GlobalsTest.php b/tests/Architecture/GlobalsTest.php index 3439225..077c929 100644 --- a/tests/Architecture/GlobalsTest.php +++ b/tests/Architecture/GlobalsTest.php @@ -5,11 +5,11 @@ ->toBeUsedInNothing(); test('all classes use strict types') - ->expect('Veeqtoh\PromptDeck') + ->expect('PromptPHP\Deck') ->toUseStrictTypes(); test('strict equality is enforced in all classes') - ->expect('Veeqtoh\PromptDeck') + ->expect('PromptPHP\Deck') ->toUseStrictEquality(); arch('PHP best practices are adhered to')->preset()->php(); diff --git a/tests/Architecture/ModelsTest.php b/tests/Architecture/ModelsTest.php index 58c96a3..e889d56 100644 --- a/tests/Architecture/ModelsTest.php +++ b/tests/Architecture/ModelsTest.php @@ -3,6 +3,6 @@ use Illuminate\Database\Eloquent\Model; test('models extends base model') - ->expect('Veeqtoh\PromptDeck\Models') + ->expect('PromptPHP\Deck\Models') ->classes() ->toExtend(Model::class); diff --git a/tests/Architecture/ProvidersTest.php b/tests/Architecture/ProvidersTest.php index 280f470..8f8d52b 100644 --- a/tests/Architecture/ProvidersTest.php +++ b/tests/Architecture/ProvidersTest.php @@ -1,6 +1,6 @@ expect('Veeqtoh\PromptDeck\Providers') + ->expect('PromptPHP\Deck\Providers') ->classes() ->toExtend(\Illuminate\Support\ServiceProvider::class); diff --git a/tests/Feature/AfterMakeAgentTest.php b/tests/Feature/AfterMakeAgentTest.php index 13f31dc..56a6f45 100644 --- a/tests/Feature/AfterMakeAgentTest.php +++ b/tests/Feature/AfterMakeAgentTest.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Artisan; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\BufferedOutput; -use Veeqtoh\PromptDeck\Listeners\AfterMakeAgent; +use PromptPHP\Deck\Listeners\AfterMakeAgent; // ===================================================================== // Listener instantiation @@ -30,7 +30,7 @@ // Should not call make:prompt — no error, just a no-op. $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); test('handle() ignores make:agent when exit code is non-zero', function () { @@ -42,7 +42,7 @@ $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); // ===================================================================== @@ -50,7 +50,7 @@ // ===================================================================== test('handle() extracts agent name from input and calls make:prompt', function () { - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); // Ensure clean state. $promptDir = "{$basePath}/sales-coach"; @@ -76,9 +76,9 @@ // Verify the prompt directory was created. expect(is_dir("{$basePath}/sales-coach"))->toBeTrue(); - // Verify output contains PromptDeck confirmation. + // Verify output contains Deck confirmation. $text = $output->fetch(); - expect($text)->toContain('PromptDeck'); + expect($text)->toContain('Deck'); expect($text)->toContain('sales-coach'); expect($text)->toContain('SalesCoach'); @@ -87,7 +87,7 @@ }); test('handle() converts PascalCase agent names to kebab-case prompts', function () { - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); $input = Mockery::mock(\Symfony\Component\Console\Input\InputInterface::class); $input->shouldReceive('getArgument')->with('name')->andReturn('DocumentAnalyzer'); @@ -113,7 +113,7 @@ // ===================================================================== test('handle() skips when scaffold_on_make_agent config is false', function () { - config()->set('prompt-deck.scaffold_on_make_agent', false); + config()->set('deck.scaffold_on_make_agent', false); $input = Mockery::mock(\Symfony\Component\Console\Input\InputInterface::class); $input->shouldNotReceive('getArgument'); @@ -125,7 +125,7 @@ $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); test('handle() skips when input returns null for name argument', function () { @@ -139,7 +139,7 @@ $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); test('handle() skips when agent name argument is empty', function () { @@ -153,7 +153,7 @@ $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); test('handle() skips when getArgument throws', function () { @@ -167,11 +167,11 @@ $listener->handle($event); - expect($output->fetch())->not->toContain('PromptDeck'); + expect($output->fetch())->not->toContain('Deck'); }); test('handle() does not fail when prompt directory already exists', function () { - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); // Pre-create the prompt via make:prompt. Artisan::call('make:prompt', ['name' => 'existing-agent']); @@ -187,15 +187,15 @@ // Should not throw — silently skips when prompt already exists. $listener->handle($event); - // Should NOT contain PromptDeck message since the prompt was skipped. - expect($output->fetch())->not->toContain('PromptDeck'); + // Should NOT contain Deck message since the prompt was skipped. + expect($output->fetch())->not->toContain('Deck'); // Cleanup. (new \Illuminate\Filesystem\Filesystem)->deleteDirectory("{$basePath}/existing-agent"); }); test('handle() strips namespace prefix from agent name', function () { - $basePath = config('prompt-deck.path'); + $basePath = config('deck.path'); $input = Mockery::mock(\Symfony\Component\Console\Input\InputInterface::class); $input->shouldReceive('getArgument')->with('name')->andReturn('App\\Ai\\Agents\\SupportBot'); diff --git a/tests/Feature/Commands/ActivatePromptCommandTest.php b/tests/Feature/Commands/ActivatePromptCommandTest.php index baed55a..c45345d 100644 --- a/tests/Feature/Commands/ActivatePromptCommandTest.php +++ b/tests/Feature/Commands/ActivatePromptCommandTest.php @@ -16,12 +16,12 @@ test('prompt:activate returns failure when exception is thrown', function () { // We mock the PromptManager to throw an exception. - $mock = \Mockery::mock(\Veeqtoh\PromptDeck\PromptManager::class); + $mock = \Mockery::mock(\PromptPHP\Deck\PromptManager::class); $mock->shouldReceive('activate') ->with('bad-prompt', 1) ->andThrow(new \Exception('Something went wrong')); - $this->app->instance(\Veeqtoh\PromptDeck\PromptManager::class, $mock); + $this->app->instance(\PromptPHP\Deck\PromptManager::class, $mock); $this->artisan('prompt:activate', ['name' => 'bad-prompt', 'version' => 1]) ->expectsOutput('Something went wrong') diff --git a/tests/Feature/Commands/ListPromptsCommandTest.php b/tests/Feature/Commands/ListPromptsCommandTest.php index d7ced6d..6691ea3 100644 --- a/tests/Feature/Commands/ListPromptsCommandTest.php +++ b/tests/Feature/Commands/ListPromptsCommandTest.php @@ -8,7 +8,7 @@ test('prompt:list warns when prompts directory does not exist', function () { // Point config at a non-existent path. - $this->app['config']->set('prompt-deck.path', $this->tempDir.'/nonexistent'); + $this->app['config']->set('deck.path', $this->tempDir.'/nonexistent'); $this->artisan('prompt:list') ->expectsOutput('Prompts directory not found.') diff --git a/tests/Feature/Commands/MakePromptCommandTest.php b/tests/Feature/Commands/MakePromptCommandTest.php index 04c893d..9dd4f8d 100644 --- a/tests/Feature/Commands/MakePromptCommandTest.php +++ b/tests/Feature/Commands/MakePromptCommandTest.php @@ -232,10 +232,10 @@ test('make:prompt creates base directory if it does not exist', function () { $newPath = "{$this->tempDir}/nested/prompts"; - $this->app['config']->set('prompt-deck.path', $newPath); + $this->app['config']->set('deck.path', $newPath); // Re-register the singleton with the new path. - $this->app->forgetInstance(\Veeqtoh\PromptDeck\PromptManager::class); + $this->app->forgetInstance(\PromptPHP\Deck\PromptManager::class); $this->artisan('make:prompt', ['name' => 'nested-prompt']) ->assertSuccessful(); @@ -244,7 +244,7 @@ }); test('make:prompt respects config extension', function () { - $this->app['config']->set('prompt-deck.extension', 'txt'); + $this->app['config']->set('deck.extension', 'txt'); $this->artisan('make:prompt', ['name' => 'txt-prompt']) ->assertSuccessful(); @@ -349,8 +349,8 @@ }); test('make:prompt prefers published stubs over package defaults', function () { - // Simulate a published stub in the app's stubs/prompt-deck/ directory. - $publishedDir = $this->app->basePath('stubs/prompt-deck'); + // Simulate a published stub in the app's stubs/deck/ directory. + $publishedDir = $this->app->basePath('stubs/deck'); @mkdir($publishedDir, 0755, true); file_put_contents("{$publishedDir}/system-prompt.stub", 'Published system stub for {{ $name }}'); @@ -452,7 +452,7 @@ }); test('make:prompt --role respects config extension for role files', function () { - $this->app['config']->set('prompt-deck.extension', 'txt'); + $this->app['config']->set('deck.extension', 'txt'); $this->artisan('make:prompt', [ 'name' => 'ext-role', @@ -490,7 +490,7 @@ }); test('make:prompt prefers published role stub over package default', function () { - $publishedDir = $this->app->basePath('stubs/prompt-deck'); + $publishedDir = $this->app->basePath('stubs/deck'); @mkdir($publishedDir, 0755, true); file_put_contents("{$publishedDir}/role-prompt.stub", 'Custom {{ $role }} stub'); diff --git a/tests/Feature/Commands/PromptDiffCommandTest.php b/tests/Feature/Commands/PromptDiffCommandTest.php index be7fd8f..24b06cf 100644 --- a/tests/Feature/Commands/PromptDiffCommandTest.php +++ b/tests/Feature/Commands/PromptDiffCommandTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException; +use PromptPHP\Deck\Exceptions\PromptNotFoundException; // ────────────────────────────────────────────────────────────── // Validation: missing version options @@ -186,7 +186,7 @@ // ────────────────────────────────────────────────────────────── test('prompt:diff respects configured file extension', function () { - $this->app['config']->set('prompt-deck.extension', 'txt'); + $this->app['config']->set('deck.extension', 'txt'); // Create fixtures with .txt extension $this->createPromptFixture('diff-ext', 1, null, null, null, null, 'txt'); diff --git a/tests/Feature/PromptDeckFacadeTest.php b/tests/Feature/DeckFacadeTest.php similarity index 65% rename from tests/Feature/PromptDeckFacadeTest.php rename to tests/Feature/DeckFacadeTest.php index d3d3a9d..a5f10f0 100644 --- a/tests/Feature/PromptDeckFacadeTest.php +++ b/tests/Feature/DeckFacadeTest.php @@ -2,21 +2,21 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Facades\PromptDeck; -use Veeqtoh\PromptDeck\PromptManager; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\Facades\Deck; +use PromptPHP\Deck\PromptManager; +use PromptPHP\Deck\PromptTemplate; -test('facade accessor returns prompt-deck', function () { +test('facade accessor returns deck', function () { // Resolve via facade accessor. - $resolved = PromptDeck::getFacadeRoot(); + $resolved = Deck::getFacadeRoot(); expect($resolved)->toBeInstanceOf(PromptManager::class); }); -test('PromptDeck::get() loads a prompt by name and version', function () { +test('Deck::get() loads a prompt by name and version', function () { $this->createPromptFixture('facade-test', 1, 'system content', 'user content'); - $prompt = PromptDeck::get('facade-test', 1); + $prompt = Deck::get('facade-test', 1); expect($prompt)->toBeInstanceOf(PromptTemplate::class) ->and($prompt->name())->toBe('facade-test') @@ -25,42 +25,42 @@ ->and($prompt->user())->toBe('user content'); }); -test('PromptDeck::get() without version returns the active version', function () { +test('Deck::get() without version returns the active version', function () { $this->createPromptFixture('facade-active', 1, 'sys', 'usr'); $this->createPromptFixture('facade-active', 2, 'sys v2', 'usr v2', null, ['active_version' => 2]); - $prompt = PromptDeck::get('facade-active'); + $prompt = Deck::get('facade-active'); expect($prompt)->toBeInstanceOf(PromptTemplate::class) ->and($prompt->version())->toBe(2); }); -test('PromptDeck::active() proxies to PromptManager::active()', function () { +test('Deck::active() proxies to PromptManager::active()', function () { $this->createPromptFixture('facade-active-method', 1, 'sys', 'usr'); $this->createPromptFixture('facade-active-method', 2, 'sys v2', 'usr v2', null, ['active_version' => 2]); - $prompt = PromptDeck::active('facade-active-method'); + $prompt = Deck::active('facade-active-method'); expect($prompt)->toBeInstanceOf(PromptTemplate::class) ->and($prompt->version())->toBe(2); }); -test('PromptDeck::versions() proxies to PromptManager::versions()', function () { +test('Deck::versions() proxies to PromptManager::versions()', function () { $this->createPromptFixture('facade-versions', 1, 'sys', 'usr'); $this->createPromptFixture('facade-versions', 2, 'sys', 'usr'); - $versions = PromptDeck::versions('facade-versions'); + $versions = Deck::versions('facade-versions'); expect($versions)->toHaveCount(2) ->and($versions[0]['version'])->toBe(1) ->and($versions[1]['version'])->toBe(2); }); -test('PromptDeck::activate() proxies to PromptManager::activate()', function () { +test('Deck::activate() proxies to PromptManager::activate()', function () { $this->createPromptFixture('facade-activate', 1, 'sys', 'usr'); $this->createPromptFixture('facade-activate', 2, 'sys', 'usr'); - $result = PromptDeck::activate('facade-activate', 2); + $result = Deck::activate('facade-activate', 2); expect($result)->toBeTrue(); diff --git a/tests/Feature/PromptDeckServiceProviderTest.php b/tests/Feature/DeckServiceProviderTest.php similarity index 74% rename from tests/Feature/PromptDeckServiceProviderTest.php rename to tests/Feature/DeckServiceProviderTest.php index a93f924..7509a64 100644 --- a/tests/Feature/PromptDeckServiceProviderTest.php +++ b/tests/Feature/DeckServiceProviderTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\PromptManager; +use PromptPHP\Deck\PromptManager; test('PromptManager is registered as a singleton', function () { $instance1 = $this->app->make(PromptManager::class); @@ -11,24 +11,24 @@ expect($instance1)->toBe($instance2); }); -test('PromptManager is resolvable via prompt-deck alias', function () { - $instance = $this->app->make('prompt-deck'); +test('PromptManager is resolvable via deck alias', function () { + $instance = $this->app->make('deck'); expect($instance)->toBeInstanceOf(PromptManager::class); }); test('alias resolves to same singleton as class binding', function () { - $byAlias = $this->app->make('prompt-deck'); + $byAlias = $this->app->make('deck'); $byClass = $this->app->make(PromptManager::class); expect($byAlias)->toBe($byClass); }); test('config is merged from package config file', function () { - // The provider merges config/prompt-deck.php. + // The provider merges config/deck.php. // Our TestCase overrides some values but the merge should have happened. - expect(config('prompt-deck.versioning'))->toBe('directory') - ->and(config('prompt-deck.cache.ttl'))->toBe(3600); + expect(config('deck.versioning'))->toBe('directory') + ->and(config('deck.cache.ttl'))->toBe(3600); }); test('Artisan commands are registered', function () { @@ -44,8 +44,8 @@ test('publishable config is registered', function () { // Verify the provider has registered publishable resources. $publishes = \Illuminate\Support\ServiceProvider::pathsToPublish( - \Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider::class, - 'prompt-deck-config' + \PromptPHP\Deck\Providers\DeckServiceProvider::class, + 'deck-config' ); expect($publishes)->not->toBeEmpty(); @@ -54,7 +54,7 @@ test('stubs are not included in default provider publishing', function () { // When publishing via --provider, stubs should not be included. $allPublishes = \Illuminate\Support\ServiceProvider::pathsToPublish( - \Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider::class + \PromptPHP\Deck\Providers\DeckServiceProvider::class ); $stubPaths = array_filter($allPublishes, fn ($path) => str_contains($path, '.stub')); diff --git a/tests/Feature/MigrationTest.php b/tests/Feature/MigrationTest.php index 34f8c3b..5a89546 100644 --- a/tests/Feature/MigrationTest.php +++ b/tests/Feature/MigrationTest.php @@ -4,8 +4,8 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -use Veeqtoh\PromptDeck\Models\PromptExecution; -use Veeqtoh\PromptDeck\Models\PromptVersion; +use PromptPHP\Deck\Models\PromptExecution; +use PromptPHP\Deck\Models\PromptVersion; /* |-------------------------------------------------------------------------- diff --git a/tests/Pest.php b/tests/Pest.php index b14fd67..88387aa 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,6 +2,6 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Tests\TestCase; +use PromptPHP\Deck\Tests\TestCase; uses(TestCase::class)->in('Feature', 'Unit'); diff --git a/tests/TestCase.php b/tests/TestCase.php index 99001cc..ef51504 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Veeqtoh\PromptDeck\Tests; +namespace PromptPHP\Deck\Tests; use Orchestra\Testbench\TestCase as BaseTestCase; -use Veeqtoh\PromptDeck\Providers\PromptDeckServiceProvider; +use PromptPHP\Deck\Providers\DeckServiceProvider; abstract class TestCase extends BaseTestCase { @@ -15,13 +15,13 @@ protected function setUp(): void { parent::setUp(); - $this->tempDir = sys_get_temp_dir().'/prompt-deck-tests-'.uniqid(); + $this->tempDir = sys_get_temp_dir().'/deck-tests-'.uniqid(); mkdir($this->tempDir, 0755, true); - $this->app['config']->set('prompt-deck.path', $this->tempDir); - $this->app['config']->set('prompt-deck.extension', 'md'); - $this->app['config']->set('prompt-deck.cache.enabled', false); - $this->app['config']->set('prompt-deck.tracking.enabled', false); + $this->app['config']->set('deck.path', $this->tempDir); + $this->app['config']->set('deck.extension', 'md'); + $this->app['config']->set('deck.cache.enabled', false); + $this->app['config']->set('deck.tracking.enabled', false); } protected function tearDown(): void @@ -34,7 +34,7 @@ protected function tearDown(): void protected function getPackageProviders($app): array { return [ - PromptDeckServiceProvider::class, + DeckServiceProvider::class, ]; } diff --git a/tests/Unit/ExceptionsTest.php b/tests/Unit/ExceptionsTest.php index 2446bed..18561da 100644 --- a/tests/Unit/ExceptionsTest.php +++ b/tests/Unit/ExceptionsTest.php @@ -2,42 +2,42 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Exceptions\ConfigurationException; -use Veeqtoh\PromptDeck\Exceptions\InvalidVersionException; -use Veeqtoh\PromptDeck\Exceptions\PromptDeckException; -use Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException; -use Veeqtoh\PromptDeck\Exceptions\PromptRenderingException; +use PromptPHP\Deck\Exceptions\ConfigurationException; +use PromptPHP\Deck\Exceptions\InvalidVersionException; +use PromptPHP\Deck\Exceptions\DeckException; +use PromptPHP\Deck\Exceptions\PromptNotFoundException; +use PromptPHP\Deck\Exceptions\PromptRenderingException; // --- Hierarchy --- -test('PromptDeckException extends base Exception', function () { - expect(PromptDeckException::class) +test('DeckException extends base Exception', function () { + expect(DeckException::class) ->toExtend(\Exception::class); }); -test('ConfigurationException extends PromptDeckException', function () { +test('ConfigurationException extends DeckException', function () { $e = ConfigurationException::invalidPath('/some/path'); - expect($e)->toBeInstanceOf(PromptDeckException::class) + expect($e)->toBeInstanceOf(DeckException::class) ->and($e)->toBeInstanceOf(\Exception::class); }); -test('InvalidVersionException extends PromptDeckException', function () { +test('InvalidVersionException extends DeckException', function () { $e = InvalidVersionException::forPrompt('test', 1); - expect($e)->toBeInstanceOf(PromptDeckException::class); + expect($e)->toBeInstanceOf(DeckException::class); }); -test('PromptNotFoundException extends PromptDeckException', function () { +test('PromptNotFoundException extends DeckException', function () { $e = PromptNotFoundException::named('test'); - expect($e)->toBeInstanceOf(PromptDeckException::class); + expect($e)->toBeInstanceOf(DeckException::class); }); -test('PromptRenderingException extends PromptDeckException', function () { +test('PromptRenderingException extends DeckException', function () { $e = PromptRenderingException::dueToMissingVariable('name', 'greeting'); - expect($e)->toBeInstanceOf(PromptDeckException::class); + expect($e)->toBeInstanceOf(DeckException::class); }); // --- Message format --- diff --git a/tests/Unit/HasPromptTemplateTest.php b/tests/Unit/HasPromptTemplateTest.php index 95d2537..8176866 100644 --- a/tests/Unit/HasPromptTemplateTest.php +++ b/tests/Unit/HasPromptTemplateTest.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Concerns\HasPromptTemplate; -use Veeqtoh\PromptDeck\PromptManager; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\Concerns\HasPromptTemplate; +use PromptPHP\Deck\PromptManager; +use PromptPHP\Deck\PromptTemplate; // ===================================================================== // Helper: anonymous agent class using the trait diff --git a/tests/Unit/PromptManagerTest.php b/tests/Unit/PromptManagerTest.php index 95a69a3..7a40104 100644 --- a/tests/Unit/PromptManagerTest.php +++ b/tests/Unit/PromptManagerTest.php @@ -3,10 +3,10 @@ declare(strict_types=1); use Illuminate\Support\Facades\DB; -use Veeqtoh\PromptDeck\Exceptions\InvalidVersionException; -use Veeqtoh\PromptDeck\Exceptions\PromptNotFoundException; -use Veeqtoh\PromptDeck\PromptManager; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\Exceptions\InvalidVersionException; +use PromptPHP\Deck\Exceptions\PromptNotFoundException; +use PromptPHP\Deck\PromptManager; +use PromptPHP\Deck\PromptTemplate; // ===================================================================== // Helper to get a fresh PromptManager bound to the test's temp directory @@ -22,8 +22,8 @@ function freshManager(?array $configOverrides = []): PromptManager } return new PromptManager( - $app['config']->get('prompt-deck.path'), - $app['config']->get('prompt-deck.extension', 'md'), + $app['config']->get('deck.path'), + $app['config']->get('deck.extension', 'md'), $app['cache']->store('array'), $app['config'], ); @@ -106,7 +106,7 @@ function freshManager(?array $configOverrides = []): PromptManager file_put_contents("{$versionPath}/system.txt", 'txt system'); file_put_contents("{$versionPath}/user.txt", 'txt user'); - $this->app['config']->set('prompt-deck.extension', 'txt'); + $this->app['config']->set('deck.extension', 'txt'); $prompt = freshManager()->get('custom-ext', 1); expect($prompt->system())->toBe('txt system') @@ -120,8 +120,8 @@ function freshManager(?array $configOverrides = []): PromptManager test('get() returns from cache when cache is enabled and warm', function () { $this->createPromptFixture('cached', 1, 'original system', 'original user'); - $this->app['config']->set('prompt-deck.cache.enabled', true); - $this->app['config']->set('prompt-deck.cache.ttl', 3600); + $this->app['config']->set('deck.cache.enabled', true); + $this->app['config']->set('deck.cache.ttl', 3600); $manager = freshManager(); @@ -140,7 +140,7 @@ function freshManager(?array $configOverrides = []): PromptManager test('get() skips cache when cache.enabled is false', function () { $this->createPromptFixture('uncached', 1, 'first', 'user'); - $this->app['config']->set('prompt-deck.cache.enabled', false); + $this->app['config']->set('deck.cache.enabled', false); $manager = freshManager(); @@ -307,8 +307,8 @@ function freshManager(?array $configOverrides = []): PromptManager $this->createPromptFixture('db-activate', 1, 'sys', 'usr'); $this->createPromptFixture('db-activate', 2, 'sys', 'usr'); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); DB::connection('testing')->table('prompt_versions')->insert([ ['name' => 'db-activate', 'version' => 1, 'is_active' => true], @@ -331,8 +331,8 @@ function freshManager(?array $configOverrides = []): PromptManager test('activate() with tracking enabled returns false when version not in DB', function () { $this->setUpTrackingTables(); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); $result = freshManager()->activate('nonexistent', 99); @@ -348,8 +348,8 @@ function freshManager(?array $configOverrides = []): PromptManager $this->createPromptFixture('db-active', 1, 'sys v1', 'usr v1'); $this->createPromptFixture('db-active', 2, 'sys v2', 'usr v2'); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); DB::connection('testing')->table('prompt_versions')->insert([ ['name' => 'db-active', 'version' => 1, 'is_active' => false], @@ -366,8 +366,8 @@ function freshManager(?array $configOverrides = []): PromptManager $this->createPromptFixture('db-fallback', 1, 'sys v1', 'usr v1'); $this->createPromptFixture('db-fallback', 2, 'sys v2', 'usr v2', null, ['active_version' => 1]); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); // No active record in DB. DB::connection('testing')->table('prompt_versions')->insert([ @@ -387,8 +387,8 @@ function freshManager(?array $configOverrides = []): PromptManager test('track() inserts execution record with all fields when tracking enabled', function () { $this->setUpTrackingTables(); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); $manager = freshManager(); $manager->track('greeting', 1, [ @@ -416,8 +416,8 @@ function freshManager(?array $configOverrides = []): PromptManager test('track() handles partial data with null fields', function () { $this->setUpTrackingTables(); - $this->app['config']->set('prompt-deck.tracking.enabled', true); - $this->app['config']->set('prompt-deck.tracking.connection', 'testing'); + $this->app['config']->set('deck.tracking.enabled', true); + $this->app['config']->set('deck.tracking.connection', 'testing'); $manager = freshManager(); $manager->track('minimal', 2, [ @@ -437,7 +437,7 @@ function freshManager(?array $configOverrides = []): PromptManager test('track() does nothing when tracking is disabled', function () { $this->setUpTrackingTables(); - $this->app['config']->set('prompt-deck.tracking.enabled', false); + $this->app['config']->set('deck.tracking.enabled', false); $manager = freshManager(); $manager->track('ignored', 1, ['input' => 'test', 'output' => 'response']); diff --git a/tests/Unit/PromptTest.php b/tests/Unit/PromptTest.php index 1473547..ba68e0c 100644 --- a/tests/Unit/PromptTest.php +++ b/tests/Unit/PromptTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\PromptTemplate; // ===================================================================== // Accessor methods diff --git a/tests/Unit/TrackPromptMiddlewareTest.php b/tests/Unit/TrackPromptMiddlewareTest.php index 0cf389d..2b27ae5 100644 --- a/tests/Unit/TrackPromptMiddlewareTest.php +++ b/tests/Unit/TrackPromptMiddlewareTest.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Veeqtoh\PromptDeck\Ai\TrackPromptMiddleware; -use Veeqtoh\PromptDeck\PromptManager; -use Veeqtoh\PromptDeck\PromptTemplate; +use PromptPHP\Deck\Ai\TrackPromptMiddleware; +use PromptPHP\Deck\PromptManager; +use PromptPHP\Deck\PromptTemplate; // ===================================================================== // Middleware instantiation