From 67b307f0e7b0fb306732b4873ddb5b1287abe1c1 Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Sun, 25 Jan 2026 23:03:23 +0000 Subject: [PATCH] Address Coderabbit items. --- .github/copilot-instructions.md | 5 +++-- .github/skills/api-development/SKILL.md | 13 ++++++++++++- .github/skills/devcontainer-setup/SKILL.md | 2 +- .github/skills/plugin-run-development/SKILL.md | 2 +- .github/skills/project-navigation/SKILL.md | 2 +- .github/skills/testing-workflow/SKILL.md | 10 ++++++++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 7a7c28f7..187da1a8 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -16,7 +16,8 @@ Network monitoring & alerting. Provides inventory, awareness, insight, categoriz ## Architecture - **Backend (Python):** `server/__main__.py`, `server/plugin.py`, `server/api_server/api_server_start.py` -- **Data (SQLite):** `db/app.db`; helpers in `server/db/*` +- **Backend Config:** `/data/config/app.conf` +- **Data (SQLite):** `/data/db/app.db`; helpers in `server/db/*` - **Frontend (Nginx + PHP + JS):** `front/` - **Plugins (Python):** `front/plugins/*` with `config.json` manifests @@ -32,7 +33,7 @@ Procedural knowledge lives in `.github/skills/`. Load the appropriate skill when | Load sample devices | `sample-data` | | Build Docker images | `docker-build` | | Reprovision devcontainer | `devcontainer-setup` | -| Create or run plugins | `plugin-development` | +| Create or run plugins | `plugin-run-development` | | Analyze PR comments | `pr-analysis` | | Clean Docker resources | `docker-prune` | | Generate devcontainer configs | `devcontainer-configs` | diff --git a/.github/skills/api-development/SKILL.md b/.github/skills/api-development/SKILL.md index d91c78c5..2133a29b 100644 --- a/.github/skills/api-development/SKILL.md +++ b/.github/skills/api-development/SKILL.md @@ -38,7 +38,15 @@ Retrieve token via `get_setting_value('API_TOKEN')`. **MANDATORY:** All responses must include `"success": true|false` -On failure, include error message: +```python +return {"success": False, "error": "Description of what went wrong"} +``` + +On success: + +```python +return {"success": True, "data": result} +``` ```python return {"success": False, "error": "Description of what went wrong"} @@ -50,6 +58,9 @@ On success: return {"success": True, "data": result} ``` + +**Exception:** The legacy `/device/` GET endpoint does not follow this contract to maintain backward compatibility with the UI. + ## Adding New Endpoints 1. Add route in `server/api_server/` directory diff --git a/.github/skills/devcontainer-setup/SKILL.md b/.github/skills/devcontainer-setup/SKILL.md index 9f337a6c..9b554d62 100644 --- a/.github/skills/devcontainer-setup/SKILL.md +++ b/.github/skills/devcontainer-setup/SKILL.md @@ -1,5 +1,5 @@ --- -name: netalertx-idempotent—setup +name: netalertx-idempotent-setup description: Reprovision and reset the devcontainer environment. Use this when asked to re-run startup, reprovision, setup devcontainer, fix permissions, or reset runtime state. --- diff --git a/.github/skills/plugin-run-development/SKILL.md b/.github/skills/plugin-run-development/SKILL.md index 9b9e10f4..b7d6799f 100644 --- a/.github/skills/plugin-run-development/SKILL.md +++ b/.github/skills/plugin-run-development/SKILL.md @@ -23,7 +23,7 @@ Ensure `sys.path` includes `/app/front/plugins` and `/app/server` (as in the tem ## Plugin Structure -``` +```text front/plugins// ├── config.json # Manifest with settings ├── script.py # Main script diff --git a/.github/skills/project-navigation/SKILL.md b/.github/skills/project-navigation/SKILL.md index 03915827..0c57a300 100644 --- a/.github/skills/project-navigation/SKILL.md +++ b/.github/skills/project-navigation/SKILL.md @@ -41,7 +41,7 @@ NetAlertX uses a frontend–backend architecture: the frontend runs on **PHP + N ## Environment Variables -Use these instead of hardcoding paths: +Use these NETALERTX_* instead of hardcoding paths. Examples: - `NETALERTX_DB` - `NETALERTX_LOG` diff --git a/.github/skills/testing-workflow/SKILL.md b/.github/skills/testing-workflow/SKILL.md index 52acadbf..d89b3be2 100644 --- a/.github/skills/testing-workflow/SKILL.md +++ b/.github/skills/testing-workflow/SKILL.md @@ -25,9 +25,15 @@ Use VS Code's testing interface or the `runTests` tool with appropriate paramete Tests live in `test/` directory. App code is under `server/`. -PYTHONPATH is preconfigured to include: +PYTHONPATH is preconfigured to include the following which should meet all needs: +- `/app` # the primary location where python runs in the production system +- `/app/server` # symbolic link to /wprkspaces/NetAlertX/server +- `/app/front/plugins` # symbolic link to /workspaces/NetAlertX/front/plugins +- `/opt/venv/lib/pythonX.Y/site-packages` +- `/workspaces/NetAlertX/test` +- `/workspaces/NetAlertX/server` - `/workspaces/NetAlertX` -- `/opt/venv/lib/python3.12/site-packages` +- `/usr/lib/pythonX.Y/site-packages` ## Authentication in Tests