OpenParable
Skip to content
← Back to skills

List Components

Research
list-components

List Components is an Agent Skill for research published in the openshift-eng/ai-helpers repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

List all OCPBUGS components, optionally filtered by team

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/openshift-eng/ai-helpers/blob/HEAD/plugins/teams/skills/list-components/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/list-components, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

List Components

This skill provides functionality to list all OCPBUGS component names from the team component mapping, with optional filtering by team.

When to Use This Skill

Use this skill when you need to:

  • Display all OCPBUGS component names
  • Display OCPBUGS components for a specific team
  • Validate OCPBUGS component names before using them in other commands
  • Get a complete list of OCPBUGS-tracked components
  • Count how many OCPBUGS components are in the system or per team
  • Find component names for filing or querying OCPBUGS issues

Prerequisites

  1. Python 3 Installation

    • Check if installed: which python3
    • Python 3.6 or later is required
    • Comes pre-installed on most systems
  2. jq Installation

    • Check if installed: which jq
    • Required for JSON parsing
    • Usually pre-installed on most systems
    • macOS: brew install jq
    • Linux: sudo apt-get install jq or sudo yum install jq
  3. Team Component Mapping File

    • The mapping file team_component_map.json should be in the repository
    • Located at: plugins/teams/team_component_map.json
    • This file is committed to the repository - no download needed
    • To regenerate: python3 plugins/teams/generate_team_component_map.py

Implementation Steps

Step 1: Verify Repository

Ensure you are in the repository root directory:

# Verify you are in the repository root
pwd
# Expected output: /path/to/ai-helpers

Step 2: Run the list-components Script

List all OCPBUGS components:

python3 plugins/teams/skills/list-components/list_components.py

List OCPBUGS components for a specific team:

python3 plugins/teams/skills/list-components/list_components.py --team "API Server"

Note: Use the exact team name from the list-teams command output.

Step 3: Process the Output

The script outputs JSON with the following structure:

All components:

{
  "total_components": 87,
  "components": [
    "Auth",
    "apiserver-auth",
    "config-operator",
    "..."
  ]
}

Components filtered by team:

{
  "total_components": 8,
  "components": [
    "apiserver-auth",
    "config-operator",
    "kube-apiserver",
    "kube-controller-manager",
    "kube-storage-version-migrator",
    "openshift-apiserver",
    "openshift-controller-manager / controller-manager",
    "service-ca"
  ],
  "team": "API Server"
}

Field Descriptions:

  • total_components: Total number of OCPBUGS components found
  • components: Alphabetically sorted list of OCPBUGS component names
  • team: (Optional) The team name used for filtering

Error Handling

The script handles several error scenarios:

  1. Mapping file missing:

    Error: Team component mapping file not found at ...
    This file should be in the repository. Please check your installation.
    

    Solution: Verify repository checkout or regenerate with generate_team_component_map.py

  2. Invalid JSON in mapping:

    Error: Failed to parse mapping file. File may be corrupted.
    

    Solution: Regenerate the mapping file

  3. Team not found:

    Error: Team 'Invalid Team' not found in mapping.
    Use list-teams to see available teams.
    

    Solution: Run list-teams to get correct team name, ensure exact match (case-sensitive)

  4. No OCPBUGS components for team:

    Warning: No OCPBUGS components found for team 'Team Name'.
    The team may not have any OCPBUGS components assigned.
    

    Note: This is a warning, not an error. Some teams may not have OCPBUGS components.

Output Format

The script outputs JSON to stdout:

  • Success: Exit code 0, JSON with component list
  • Error: Exit code 1, error message to stderr

Examples

Example 1: List All Components

python3 plugins/teams/skills/list-components/list_components.py

Output:

{
  "total_components": 87,
  "components": [
    "Auth",
    "apiserver-auth",
    "..."
  ]
}

Example 2: List Components for a Specific Team

python3 plugins/teams/skills/list-components/list_components.py --team "API Server"

Output:

{
  "total_components": 8,
  "components": [
    "apiserver-auth",
    "config-operator",
    "kube-apiserver",
    "..."
  ],
  "team": "API Server"
}

Example 3: Count Components

python3 plugins/teams/skills/list-components/list_components.py | jq '.total_components'

Output:

87

Example 4: Search for Specific Component

python3 plugins/teams/skills/list-components/list_components.py | jq '.components[] | select(contains("apiserver"))'

Output:

"apiserver-auth"
"kube-apiserver"
"openshift-apiserver"

Notes

  • Only OCPBUGS components are included in the mapping
  • Team names must match exactly (case-sensitive) - use list-teams to get correct names
  • When filtering by team, only components owned by that team are returned
  • Component names are case-sensitive
  • Components are returned in alphabetical order
  • The script reads from the committed mapping file (no network calls)
  • Very fast execution (< 100ms typically)
  • Mapping file location: plugins/teams/team_component_map.json
  • Component names can be used directly in OCPBUGS JIRA queries and other teams commands
  • Typical count: ~87 total components across 29 teams (may vary as components are added/removed)
  • To refresh mapping: Run python3 plugins/teams/generate_team_component_map.py

Data Source

The team and component mapping data originates from:

If data looks wrong or missing:

  1. Submit a PR to https://gitlab.cee.redhat.com/hybrid-platforms/org to correct the source data
  2. After the PR merges, regenerate the mapping file in this repository:
    python3 plugins/teams/generate_team_component_map.py
    
  3. Commit the updated team_component_map.json file

See Also

  • Related Skill: plugins/teams/skills/list-teams/SKILL.md
  • Related Command: /teams:list-components
  • Mapping File: plugins/teams/team_component_map.json
  • Generator Script: plugins/teams/generate_team_component_map.py