feat: add cost/token tracking, monthly budget system, and dry-run mode
- Create PSA_Cost_Tracker class with database table for API call logging - Log prompt/completion tokens and estimated cost for every OpenRouter API call - Implement monthly budget system with hard stop (budget of 0 = unlimited) - Add budget checks in validate_peptide_name() and generate_peptide_content() - Add dry_run() method to estimate costs before making API calls - Display monthly usage summary and recent API logs in admin settings - Add monthly_budget setting to admin interface with number input field - Update uninstall.php to drop psa_api_logs table on plugin removal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
.phpcs.xml.dist
Executable file
28
.phpcs.xml.dist
Executable file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Peptide Search AI">
|
||||
<description>PHP CodeSniffer configuration for Peptide Search AI WordPress plugin</description>
|
||||
|
||||
<!-- Set baseline standard to WordPress-Core -->
|
||||
<rule ref="WordPress-Core">
|
||||
<!-- Allow direct database queries with prepare() statements -->
|
||||
<exclude name="WordPress.DB.DirectDatabaseQuery" />
|
||||
</rule>
|
||||
|
||||
<!-- Files and directories to check -->
|
||||
<file>peptide-search-ai.php</file>
|
||||
<file>includes/</file>
|
||||
|
||||
<!-- Exclude vendor and node_modules -->
|
||||
<exclude-pattern>/vendor/*</exclude-pattern>
|
||||
<exclude-pattern>/node_modules/*</exclude-pattern>
|
||||
<exclude-pattern>/.git/*</exclude-pattern>
|
||||
<exclude-pattern>/.github/*</exclude-pattern>
|
||||
|
||||
<!-- Report settings -->
|
||||
<arg name="colors" />
|
||||
<arg value="sp" />
|
||||
<arg name="report-width" value="120" />
|
||||
|
||||
<!-- Do not fail CI on warnings (only errors should block) -->
|
||||
<config name="ignore_warnings_on_exit" value="1" />
|
||||
</ruleset>
|
||||
Reference in New Issue
Block a user