Skip to content

docs: add Copilot instructions modeled on plugin_evidence - #387

Merged
TheWitness merged 4 commits into
developfrom
chore/copilot-instructions
Sep 16, 2026
Merged

TheWitness merged 4 commits into
developfrom
chore/copilot-instructions

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Adds/aligns .github/copilot-instructions.md to follow the structure used in Cacti/plugin_evidence, tailored to this plugin's actual hooks, database tables, naming conventions, and security-sensitive areas.

Copilot AI lite review requested due to automatic review settings September 15, 2026 13:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The guide contains unresolved omissions and inaccurate implementation guidance that should be corrected before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds repository-specific Copilot instructions for the Cacti Intropage plugin.

Changes:

  • Documents project structure, conventions, architecture, and compatibility.
  • Adds database, security, localization, hook, and panel guidance.
  • Provides common pitfalls and repository references.
File summaries
File Description
.github/copilot-instructions.md Adds tailored Copilot development instructions for the Intropage plugin.
Review details

Suppressed comments (5)

.github/copilot-instructions.md:55

  • The table inventory is incomplete. include/database.php creates plugin_intropage_panel_dashboard, plugin_intropage_trends, plugin_intropage_dashboard, and plugin_intropage_user_group_auth as well; omitting them can lead contributors to miss real dashboard, trend, and group-authorization storage.
Plugin tables are prefixed `plugin_intropage_`: `plugin_intropage_panel_definition`, `plugin_intropage_user_auth`, `plugin_intropage_panel_data`.

.github/copilot-instructions.md:92

  • This access-control guidance omits the registered administration realm. setup.php registers both intropage.php and intropage_admin.php, and administrative code checks the latter; documenting only the viewer check can cause new administration paths to use incomplete realm protection.
Realm permissions: `api_user_realm_auth('intropage.php')` gates access. Panel permissions: `is_panel_allowed()` checks user/group authorization before rendering a panel.

.github/copilot-instructions.md:120

  • This hook list is not the actual set registered by setup.php; it omits config_arrays, login_options_navigate, top_graph_header_tabs, graph_buttons_thumbnails, the user action/save hooks, the group action/save hooks, and user_admin_setup_sql_save. Contributors following this as the plugin's hook guidance could omit required integration points.
Register hooks in `setup.php`: `config_settings`, `top_header_tabs`, `console_after`, `page_head`, `graph_buttons`, `poller_bottom`, `user_admin_tab`, plus the user/group admin lifecycle hooks (`user_remove`, `user_group_admin_tab`, `user_group_remove`, `copy_user`).

.github/copilot-instructions.md:115

  • The data-flow statement says all user permissions live in plugin_intropage_user_auth, but group permissions are stored separately in plugin_intropage_user_group_auth and merged by is_panel_allowed(). This omission is especially misleading because the same guide documents group-admin hooks.
3. User permissions live in `plugin_intropage_user_auth` (JSON-encoded).

.github/copilot-instructions.md:110

  • panellib/index.php is matched by the documented glob but is an entry point rather than a panel library; initialize_panel_library() explicitly skips it (include/functions.php:1179). Qualify this requirement so contributors do not add a nonexistent register_index() function.
Every panel library file (`panellib/*.php`) MUST define a `register_<basename>()` function returning a panels array with keys like `name`, `description`, `class`, `level` (`PANEL_SYSTEM`/`PANEL_USER`), `refresh`, `width`, `height`, `priority`, `alarm`, `requires`, `update_func`, `details_func`, `trends_func`.
  • Files reviewed: 1/1 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md
xmacan
xmacan previously approved these changes Sep 15, 2026
bmfmancini
bmfmancini previously approved these changes Sep 15, 2026

@bmfmancini bmfmancini left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Clarified usage of `__()`/`__esc()` for internationalization.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TheWitness
TheWitness dismissed stale reviews from bmfmancini and xmacan via d677682 September 15, 2026 23:55
TheWitness and others added 2 commits September 15, 2026 19:55
Document the registration of hooks and update functions for data collection.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactor device scope handling for fetching hosts based on user permissions.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TheWitness
TheWitness merged commit 6f557f7 into develop Sep 16, 2026
3 checks passed
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.

4 participants