add CI workflow and AI instructions#197
Conversation
|
Adding cs fixes in another PR |
There was a problem hiding this comment.
Pull request overview
This pull request adds CI/CD infrastructure and AI assistant configuration to the Cacti Monitor plugin. It introduces a comprehensive GitHub Actions workflow for automated testing across multiple PHP versions, along with GitHub Copilot instructions and four specialized agent configurations to support AI-assisted development and maintenance.
Changes:
- Added CI workflow with PHP 8.1-8.4 testing matrix, MariaDB 10.6 integration tests, and code quality checks (syntax, linting, CS fixing)
- Added GitHub Copilot instructions documenting plugin architecture, coding standards, and Cacti framework patterns
- Introduced four specialized agent configurations for code quality, PHP development, database administration, and task triage/routing
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/plugin-ci-workflow.yml |
Comprehensive CI workflow for testing plugin across PHP 8.1-8.4 with MariaDB, including Cacti installation, plugin integration tests, syntax checks, linting, and code style validation |
.github/copilot-instructions.md |
Documentation of repository conventions, Cacti plugin architecture patterns, security practices, and technology stack for AI-assisted development |
.github/agents/triage_agent.md.agent.md |
Triage agent configuration with routing rules and delegation logic for distributing tasks to specialized agents |
.github/agents/php-developer.agent.md |
PHP Developer agent configuration focused on PSR-12 standards, debugging, optimization, and Cacti framework integration |
.github/agents/mysql-mariadb.agent.md |
Database administrator agent configuration for MySQL/MariaDB management, query optimization, and Cacti database functions |
.github/agents/code-quality.agent.md |
Code quality specialist agent configuration covering code review, refactoring, testing, and LAMP stack best practices |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| --- | ||
|
|
||
| # Code Quality Specialist | ||
| You are a Code Quality Specialist agent. Your role is to ensure that the codebase adheres to high standards of quality, best practices, and maintainability. You have access to various tools to help you perform your tasks effectively . |
There was a problem hiding this comment.
Missing space in the sentence. Should read: "You have access to various tools to help you perform your tasks effectively." (note the period at the end).
| You are a Code Quality Specialist agent. Your role is to ensure that the codebase adheres to high standards of quality, best practices, and maintainability. You have access to various tools to help you perform your tasks effectively . | |
| You are a Code Quality Specialist agent. Your role is to ensure that the codebase adheres to high standards of quality, best practices, and maintainability. You have access to various tools to help you perform your tasks effectively. |
| @@ -0,0 +1,132 @@ | |||
| --- | |||
There was a problem hiding this comment.
The filename has a redundant double extension .md.agent.md while the other agent files use .agent.md. This inconsistency should be corrected to match the naming pattern of the other agent files (php-developer.agent.md, mysql-mariadb.agent.md, code-quality.agent.md).
| - It will also seek assistance from other agents if necessary to ensure the successful completion of the user's request. | ||
|
|
||
|
|
||
| ## Example Workflow1. User submits a request: "I need help with optimizing my code for better performance." |
There was a problem hiding this comment.
Missing line break after "## Example Workflow". The text should be formatted as "## Example Workflow\n\n1. User submits a request..." with proper line breaks for readability.
| ## Example Workflow1. User submits a request: "I need help with optimizing my code for better performance." | |
| ## Example Workflow | |
| 1. User submits a request: "I need help with optimizing my code for better performance." |
| @@ -0,0 +1,156 @@ | |||
| # GitHub Copilot Instructions | |||
There was a problem hiding this comment.
The PR description states "This pull request introduces four new custom agent configuration files to the .github/agents directory" but the PR also adds a CI workflow file and Copilot instructions file. The description should be updated to mention all changes: the CI workflow, Copilot instructions, and the four agent configuration files.
| - `db_fetch_row($result)`: Fetches a single row from the result set as an associative array. | ||
| - `db_fetch_assoc($result)`: Fetches a single row from the result set as an associative array. | ||
| - `db_query($query)`: Executes a SQL query and returns the result set. | ||
| - `db_insert($table, $data)`: Inserts a new record into the specified table. | ||
| - `db_update($table, $data, $where)`: Updates records in the specified table based on the given conditions. | ||
| - `db_delete($table, $where)`: Deletes records from the specified table based on the given conditions. | ||
| - `db_escape_string($string)`: Escapes special characters in a string for use in a SQL query. | ||
| - `db_num_rows($result)`: Returns the number of rows in the result set. | ||
| - `db_last_insert_id()`: Retrieves the ID of the last inserted record. |
There was a problem hiding this comment.
The function signature documentation appears inconsistent with typical Cacti database function patterns. For example, db_query($query) should likely be db_execute($query) or db_fetch_* functions based on the link to Cacti's database.php. Similarly, db_insert($table, $data), db_update($table, $data, $where), and db_delete($table, $where) don't match the typical Cacti database API which uses functions like db_execute() with SQL strings. These should be verified against the actual Cacti database.php file and corrected to reflect the actual API.
| - `db_fetch_row($result)`: Fetches a single row from the result set as an associative array. | |
| - `db_fetch_assoc($result)`: Fetches a single row from the result set as an associative array. | |
| - `db_query($query)`: Executes a SQL query and returns the result set. | |
| - `db_insert($table, $data)`: Inserts a new record into the specified table. | |
| - `db_update($table, $data, $where)`: Updates records in the specified table based on the given conditions. | |
| - `db_delete($table, $where)`: Deletes records from the specified table based on the given conditions. | |
| - `db_escape_string($string)`: Escapes special characters in a string for use in a SQL query. | |
| - `db_num_rows($result)`: Returns the number of rows in the result set. | |
| - `db_last_insert_id()`: Retrieves the ID of the last inserted record. | |
| - `db_fetch_row($sql)`: Executes the given SQL query and returns the first row as a numeric array. | |
| - `db_fetch_assoc($sql)`: Executes the given SQL query and returns the first row as an associative array. | |
| - `db_fetch_cell($sql)`: Executes the given SQL query and returns the value of the first column of the first row. | |
| - `db_execute($sql)`: Executes a SQL statement (e.g., INSERT, UPDATE, DELETE) and returns the number of affected rows or a boolean status. | |
| - `db_execute_prepared($sql, $params)`: Executes a prepared SQL statement with bound parameters. | |
| - `db_qstr($string)`: Quotes and escapes a string for safe use in a SQL query. | |
| - `db_num_rows($result)`: Returns the number of rows in a result set. | |
| - `db_insert_id()`: Retrieves the ID of the last inserted row for the current connection. | |
| - `db_affected_rows()`: Returns the number of rows affected by the last write operation. |
| # - name: Run PHPStan at Level 6 on base code outside of Composer due to technical issues | ||
| # run: ./include/vendor/bin/phpstan analyze --level 6 ${{ github.workspace }}/cacti/plugins/monitor | ||
| # working-directory: ${{ github.workspace }}/cacti |
There was a problem hiding this comment.
The commented PHPStan step mentions "technical issues" but provides no details about what those issues are or when they might be resolved. Consider adding a comment explaining the specific technical issue and creating a tracking issue, or remove these commented lines if they're not needed.
| # - name: Run PHPStan at Level 6 on base code outside of Composer due to technical issues | |
| # run: ./include/vendor/bin/phpstan analyze --level 6 ${{ github.workspace }}/cacti/plugins/monitor | |
| # working-directory: ${{ github.workspace }}/cacti |
| @@ -0,0 +1,132 @@ | |||
| --- | |||
There was a problem hiding this comment.
The triage agent configuration is missing the "name" field in the YAML front matter, while the other three agent files all specify a name (e.g., 'name: "PHP Developer"'). For consistency and to properly identify the agent, add a "name" field such as 'name: "Triage Agent"'.
| --- | |
| --- | |
| name: "Triage Agent" |
| run: composer run-script lint ${{ github.workspace }}/cacti/plugins/monitor | ||
| working-directory: ${{ github.workspace }}/cacti | ||
|
|
||
| - name: Checking coding standards on base code | ||
| run: composer run-script phpcsfixer ${{ github.workspace }}/cacti/plugins/monitor |
There was a problem hiding this comment.
The workflow assumes that Cacti has composer scripts named "lint" and "phpcsfixer" but doesn't verify they exist before running them. Consider adding a check or using conditional execution (e.g., composer run-script lint ... || echo "Lint script not found") to handle cases where these scripts might not be present in the Cacti composer.json.
| run: composer run-script lint ${{ github.workspace }}/cacti/plugins/monitor | |
| working-directory: ${{ github.workspace }}/cacti | |
| - name: Checking coding standards on base code | |
| run: composer run-script phpcsfixer ${{ github.workspace }}/cacti/plugins/monitor | |
| run: | | |
| if composer run-script --list | grep -qE '^[[:space:]]*lint[[:space:]]'; then | |
| composer run-script lint ${{ github.workspace }}/cacti/plugins/monitor | |
| else | |
| echo "Composer script 'lint' not found; skipping lint step." | |
| fi | |
| working-directory: ${{ github.workspace }}/cacti | |
| - name: Checking coding standards on base code | |
| run: | | |
| if composer run-script --list | grep -qE '^[[:space:]]*phpcsfixer[[:space:]]'; then | |
| composer run-script phpcsfixer ${{ github.workspace }}/cacti/plugins/monitor | |
| else | |
| echo "Composer script 'phpcsfixer' not found; skipping coding standards step." | |
| fi |
| @@ -0,0 +1,65 @@ | |||
| --- | |||
| description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases." | |||
There was a problem hiding this comment.
Typo: "assits" should be "assists".
| description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases." | |
| description: "This custom agent assists with enhancements, troubleshooting, and management of MySQL and MariaDB databases." |
| @@ -0,0 +1,132 @@ | |||
| --- | |||
| description: 'This Agent will Receiving the initial task and call on other agents based on the task' | |||
There was a problem hiding this comment.
The triage agent configuration is missing the "model" field in the YAML front matter, while the other three agent files (php-developer, mysql-mariadb, code-quality) all specify 'model: "Claude Sonnet 4.5"'. For consistency, consider adding a model specification to this agent configuration as well.
| description: 'This Agent will Receiving the initial task and call on other agents based on the task' | |
| description: 'This Agent will Receiving the initial task and call on other agents based on the task' | |
| model: "Claude Sonnet 4.5" |
This pull request introduces four new custom agent configuration files to the
.github/agentsdirectory. Each file defines a specialized agent, outlining its capabilities, tools, and operational guidelines to support a modular, agent-based workflow for code and database management tasks. The agents cover code quality, PHP development, MySQL/MariaDB administration, and triage/routing of user requests.The most important changes are:
Agent Definitions and Capabilities
Code Quality Specialistagent to focus on code review, refactoring, testing, documentation, performance optimization, security, CI/CD, and code metrics for LAMP stack and JavaScript projects.PHP Developeragent to assist with PHP code development, debugging, optimization, testing, documentation, and security, emphasizing PSR-12 standards and modern PHP versions.MySQL/MariaDB Database Administratoragent to support database management, query optimization, troubleshooting, backup/recovery, security, upgrades, monitoring, and scripting, with references to built-in Cacti DB functions and best practices.Triage and Routing
Triage Agentconfiguration to receive initial user requests, analyze and delegate tasks to specialized agents using explicit routing rules, monitor progress, and compile results. Includes detailed routing logic, sample rule sets, and delegation payload templates for deterministic agent selection and workflow orchestration.