Skip to content

add CI workflow and AI instructions#197

Closed
bmfmancini wants to merge 1 commit intoCacti:developfrom
bmfmancini:develop
Closed

add CI workflow and AI instructions#197
bmfmancini wants to merge 1 commit intoCacti:developfrom
bmfmancini:develop

Conversation

@bmfmancini
Copy link
Member

This pull request introduces four new custom agent configuration files to the .github/agents directory. 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

  • Added Code Quality Specialist agent to focus on code review, refactoring, testing, documentation, performance optimization, security, CI/CD, and code metrics for LAMP stack and JavaScript projects.
  • Added PHP Developer agent to assist with PHP code development, debugging, optimization, testing, documentation, and security, emphasizing PSR-12 standards and modern PHP versions.
  • Added MySQL/MariaDB Database Administrator agent 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

  • Added Triage Agent configuration 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.

@bmfmancini
Copy link
Member Author

Adding cs fixes in another PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,132 @@
---
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
- 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."
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
## 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."

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,156 @@
# GitHub Copilot Instructions
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +57
- `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.
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- `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.

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +198
# - 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
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# - 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

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,132 @@
---
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"'.

Suggested change
---
---
name: "Triage Agent"

Copilot uses AI. Check for mistakes.
Comment on lines +189 to +193
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
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,65 @@
---
description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases."
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "assits" should be "assists".

Suggested change
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."

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,132 @@
---
description: 'This Agent will Receiving the initial task and call on other agents based on the task'
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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"

Copilot uses AI. Check for mistakes.
@bmfmancini bmfmancini closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant