diff --git a/rh-basic/skills/red-hat-product-lifecycle/SKILL.md b/rh-basic/skills/red-hat-product-lifecycle/SKILL.md index c90052eb..3490d777 100644 --- a/rh-basic/skills/red-hat-product-lifecycle/SKILL.md +++ b/rh-basic/skills/red-hat-product-lifecycle/SKILL.md @@ -14,6 +14,13 @@ Identify product and version from user message. If unclear, ask. Look up lifecyc ## Prerequisites +**Step 0 — Resolve scripts directory.** Before anything else, locate the helper scripts. They are inside the skill's `scripts/` subfolder. Run: +```bash +SCRIPTS_DIR="scripts" +test -f "$SCRIPTS_DIR/rh_lifecycle.py" || { echo "Error: Scripts directory not found at $SCRIPTS_DIR"; exit 1; } +``` +Use `$SCRIPTS_DIR` in all subsequent script calls. + Python 3 — the script uses only the stdlib. ## When to Use This Skill @@ -25,7 +32,7 @@ When the user asks about lifecycle status, support phases, or EOL dates for any 1. Identify product and version from the user message. 2. Run the lifecycle script via Bash: ``` - python rh-basic/skills/red-hat-product-lifecycle/scripts/rh_lifecycle.py "Product Name Version" + python scripts/rh_lifecycle.py "Product Name Version" ``` The script queries `https://access.redhat.com/product-life-cycles/api/v1/products` and returns JSON to stdout. Errors are on stderr (JSON with `"error"` key); exit code 1 on failure. @@ -48,7 +55,7 @@ Dates are `YYYY-MM-DD`; `"N/A"` means no date; `"Ongoing"` means open-ended. ## Dependencies -Script: `rh-basic/skills/red-hat-product-lifecycle/scripts/rh_lifecycle.py` +Script: `scripts/rh_lifecycle.py` ## Lifecycle Phase Reference diff --git a/rh-sre/skills/cve-impact/SKILL.md b/rh-sre/skills/cve-impact/SKILL.md index a037b135..a9ee4ce4 100644 --- a/rh-sre/skills/cve-impact/SKILL.md +++ b/rh-sre/skills/cve-impact/SKILL.md @@ -7,7 +7,7 @@ description: | NOT for remediation (use `/remediation`). - System-level: FIRST reply = pagination prompt (Step -1). Parsing: references/01-cve-response-parser.py. + System-level: FIRST reply = pagination prompt (Step -1). Parsing: scripts/01-cve-response-parser.py. model: inherit color: blue license: Apache-2.0 @@ -28,6 +28,13 @@ When invoked by another skill (e.g. remediation), use the Skill tool—do NOT us ## Prerequisites +**Step 0 — Resolve scripts directory.** Before anything else, locate the helper scripts. They are inside the skill's `scripts/` subfolder. Run: +```bash +SCRIPTS_DIR="scripts" +test -f "$SCRIPTS_DIR/01-cve-response-parser.py" || { echo "Error: Scripts directory not found at $SCRIPTS_DIR"; exit 1; } +``` +Use `$SCRIPTS_DIR` in all subsequent script calls. + **Required MCP Servers**: `lightspeed-mcp` ([setup guide](https://console.redhat.com/)) **Required MCP Tools**: @@ -322,7 +329,7 @@ Check if automated playbook or manual steps are available. | File | Use When | |------|----------| -| [01-cve-response-parser.py](references/01-cve-response-parser.py) | Parse/filter MCP vulnerability responses | +| [01-cve-response-parser.py](scripts/01-cve-response-parser.py) | Parse/filter MCP vulnerability responses | | [02-cve-parsing-guide.md](references/02-cve-parsing-guide.md) | Parser invocation, filter options | | [03-output-templates.md](references/03-output-templates.md) | Report format | | [04-examples.md](references/04-examples.md) | Query-type examples | @@ -336,9 +343,9 @@ Check if automated playbook or manual steps are available. **Do NOT generate inline Python** to aggregate multiple page files—the parser accepts multiple file paths and produces aggregated reports. **Read** [references/02-cve-parsing-guide.md](references/02-cve-parsing-guide.md) for: -- Parser location: `references/01-cve-response-parser.py` -- Single page: `python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py ` -- Multiple pages: `python3 .../01-cve-response-parser.py page1.json page2.json page3.json ...` (merges, dedupes, aggregated report) +- Parser location: `scripts/01-cve-response-parser.py` +- Single page: `python3 scripts/01-cve-response-parser.py ` +- Multiple pages: `python3 scripts/01-cve-response-parser.py page1.json page2.json page3.json ...` (merges, dedupes, aggregated report) - Filter options: `FILTER_REMEDIATABLE=1`, `FILTER_IMPACT=Critical,Important` - Report format: `OUTPUT=report`, `SYSTEM_NAME=hostname` for aggregated multi-page reports diff --git a/rh-sre/skills/cve-impact/references/02-cve-parsing-guide.md b/rh-sre/skills/cve-impact/references/02-cve-parsing-guide.md index f4608f3b..89248d55 100644 --- a/rh-sre/skills/cve-impact/references/02-cve-parsing-guide.md +++ b/rh-sre/skills/cve-impact/references/02-cve-parsing-guide.md @@ -20,10 +20,10 @@ ## Parser Location ``` -rh-sre/skills/cve-impact/references/01-cve-response-parser.py +scripts/01-cve-response-parser.py ``` -From workspace root: `rh-sre/skills/cve-impact/references/01-cve-response-parser.py` +Skill-relative path: `scripts/01-cve-response-parser.py` ## How to Invoke @@ -32,13 +32,13 @@ From workspace root: `rh-sre/skills/cve-impact/references/01-cve-response-parser Save the MCP tool result to a file, then run: ```bash -python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py /path/to/response.json +python3 scripts/01-cve-response-parser.py /path/to/response.json ``` ### Option 2: stdin ```bash -python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py < /path/to/response.json +python3 scripts/01-cve-response-parser.py < /path/to/response.json ``` ### Option 3: From MCP tool result file @@ -46,7 +46,7 @@ python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py < /path/to When the MCP tool writes to a file (e.g. `tool-results/toolu_xxx.txt`): ```bash -python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py /path/to/tool-results/toolu_xxx.txt +python3 scripts/01-cve-response-parser.py /path/to/tool-results/toolu_xxx.txt ``` ### Option 4: Multiple page files (aggregated report) @@ -55,7 +55,7 @@ When you have multiple paginated responses (e.g. pages 1–5 from `vulnerability ```bash FILTER_REMEDIATABLE=1 FILTER_IMPACT=Critical,Important OUTPUT=report SYSTEM_NAME=ip-172-31-32-201.eu-west-3.compute.internal \ - python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py page1.json page2.json page3.json page4.json page5.json + python3 scripts/01-cve-response-parser.py page1.json page2.json page3.json page4.json page5.json ``` **Do NOT generate inline Python** to loop over page files—use the parser with multiple paths. @@ -75,28 +75,28 @@ FILTER_REMEDIATABLE=1 FILTER_IMPACT=Critical,Important OUTPUT=report SYSTEM_NAME **Remediatable CVEs only:** ```bash -FILTER_REMEDIATABLE=1 python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py response.json +FILTER_REMEDIATABLE=1 python3 scripts/01-cve-response-parser.py response.json ``` **Critical/Important only:** ```bash -FILTER_IMPACT=Critical,Important python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py response.json +FILTER_IMPACT=Critical,Important python3 scripts/01-cve-response-parser.py response.json ``` **Remediatable + Critical/Important:** ```bash -FILTER_REMEDIATABLE=1 FILTER_IMPACT=Critical,Important python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py response.json +FILTER_REMEDIATABLE=1 FILTER_IMPACT=Critical,Important python3 scripts/01-cve-response-parser.py response.json ``` **Aggregated report from multiple pages:** ```bash FILTER_REMEDIATABLE=1 FILTER_IMPACT=Critical,Important OUTPUT=report SYSTEM_NAME=ip-172-31-32-201.eu-west-3.compute.internal \ - python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py page1.json page2.json page3.json page4.json page5.json + python3 scripts/01-cve-response-parser.py page1.json page2.json page3.json page4.json page5.json ``` **JSON output (for further processing):** ```bash -OUTPUT=json python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py response.json +OUTPUT=json python3 scripts/01-cve-response-parser.py response.json ``` ## Response Structure (Lightspeed MCP) @@ -142,6 +142,6 @@ Key fields: 1. Call MCP tool (`vulnerability__get_system_cves` or `vulnerability__get_cves`) — one or more times (paginated) 2. Save each response to file (MCP may write to `tool-results/` or you save from result) 3. **Run parser** (required—do not use jq or inline Python): - - Single page: `python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py ` - - Multiple pages: `python3 rh-sre/skills/cve-impact/references/01-cve-response-parser.py page1.json page2.json ...` + - Single page: `python3 scripts/01-cve-response-parser.py ` + - Multiple pages: `python3 scripts/01-cve-response-parser.py page1.json page2.json ...` 4. Use parser output for summary tables and user-facing reports diff --git a/rh-sre/skills/cve-impact/references/flows/01-account-cves.md b/rh-sre/skills/cve-impact/references/flows/01-account-cves.md index 658b3e2b..a5057ec0 100644 --- a/rh-sre/skills/cve-impact/references/flows/01-account-cves.md +++ b/rh-sre/skills/cve-impact/references/flows/01-account-cves.md @@ -102,7 +102,7 @@ vulnerability__get_cves( **If the dashboard was successful**, DO NOT PRINT the CVE table, as it's covered in the dashboard. SKIP to the follow-ups. **ONLY If the dashboard was NOT successful**: -- **Parse response** (if needed): Use [references/01-cve-response-parser.py](../references/01-cve-response-parser.py). Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../references/02-cve-parsing-guide.md). +- **Parse response** (if needed): Use [scripts/01-cve-response-parser.py](../../scripts/01-cve-response-parser.py). Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../02-cve-parsing-guide.md). - Sort by CVSS score (highest first) or by affected system count - Provide summary table: CVE ID, severity, affected systems count, remediation availability diff --git a/rh-sre/skills/cve-impact/references/flows/02-system-all-cves.md b/rh-sre/skills/cve-impact/references/flows/02-system-all-cves.md index f5708e46..3ba6228c 100644 --- a/rh-sre/skills/cve-impact/references/flows/02-system-all-cves.md +++ b/rh-sre/skills/cve-impact/references/flows/02-system-all-cves.md @@ -92,7 +92,7 @@ while (strategy allows): **If the dashboard was successful**, DO NOT PRINT the CVE table, as it's covered in the dashboard. SKIP to the follow-ups. **ONLY If the dashboard was NOT successful**: -- **Parse response**: Use [references/01-cve-response-parser.py](../references/01-cve-response-parser.py). Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../references/02-cve-parsing-guide.md). +- **Parse response**: Use [scripts/01-cve-response-parser.py](../../scripts/01-cve-response-parser.py). Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../02-cve-parsing-guide.md). - Sort by CVSS score (highest first) - Provide summary table diff --git a/rh-sre/skills/cve-impact/references/flows/03-system-remediatable-cves.md b/rh-sre/skills/cve-impact/references/flows/03-system-remediatable-cves.md index 1ca7d4f8..410c59df 100644 --- a/rh-sre/skills/cve-impact/references/flows/03-system-remediatable-cves.md +++ b/rh-sre/skills/cve-impact/references/flows/03-system-remediatable-cves.md @@ -100,7 +100,7 @@ After filtering for remediatable, optionally filter by severity: **If the dashboard was successful**, DO NOT PRINT the CVE table, as it's covered in the dashboard. SKIP to the follow-ups. **ONLY If the dashboard was NOT successful**: -- **Parse response**: Use [references/01-cve-response-parser.py](../references/01-cve-response-parser.py) with `FILTER_REMEDIATABLE=1`. Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../references/02-cve-parsing-guide.md). +- **Parse response**: Use [scripts/01-cve-response-parser.py](../../scripts/01-cve-response-parser.py) with `FILTER_REMEDIATABLE=1`. Do NOT use jq or inline Python. See [02-cve-parsing-guide.md](../02-cve-parsing-guide.md). - Sort by CVSS score (highest first) ## Step 7: Follow-up diff --git a/rh-sre/skills/cve-impact/references/01-cve-response-parser.py b/rh-sre/skills/cve-impact/scripts/01-cve-response-parser.py similarity index 100% rename from rh-sre/skills/cve-impact/references/01-cve-response-parser.py rename to rh-sre/skills/cve-impact/scripts/01-cve-response-parser.py