Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@
"source": "./plugins/marketplace-ops",
"description": "Maintenance commands for Claude Code plugin marketplaces",
"version": "0.1.2"
},
{
"name": "patternfly",
"source": "./plugins/patternfly",
"description": "PatternFly React component migration and development tools",
"version": "1.2.0"
}
]
}
10 changes: 10 additions & 0 deletions PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This document lists all available Claude Code plugins and their commands in the
- [Openshift Tls Profile](#openshift-tls-profile-plugin)
- [Origin](#origin-plugin)
- [Ote Migration](#ote-migration-plugin)
- [Patternfly](#patternfly-plugin)
- [Rds Analyzer](#rds-analyzer-plugin)
- [Session](#session-plugin)
- [Snowflake](#snowflake-plugin)
Expand Down Expand Up @@ -350,6 +351,15 @@ Automate OpenShift Tests Extension (OTE) migration for component repositories

See [plugins/ote-migration/README.md](plugins/ote-migration/README.md) for detailed documentation.

### Patternfly Plugin

PatternFly v5 to v6 migration and glass theme implementation

**Commands:**
- **`/patternfly:migrate` `[file-path]`** - Migrate PatternFly v5 to v6 (React components, CSS classes, tokens)

See [plugins/patternfly/README.md](plugins/patternfly/README.md) for detailed documentation.

### Rds Analyzer Plugin

Reference Design Specification (RDS) Analyzer workflow: cluster-compare JSON to deviation reports (text/HTML/reporting) and Jira follow-up
Expand Down
27 changes: 27 additions & 0 deletions docs/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,33 @@
"name": "marketplace-ops",
"skills": [],
"version": "0.1.2"
},
{
"commands": [
{
"argument_hint": "[file-path]",
"description": "Migrate PatternFly v5 to v6 (React components, CSS classes, tokens)",
"name": "migrate",
"synopsis": "/patternfly:migrate [file-path]"
}
],
"description": "PatternFly React component migration and development tools",
"has_readme": true,
"hooks": [],
"name": "patternfly",
"skills": [
{
"description": "Migrate PatternFly React components from v5 to v6. Scans for component renames, prop updates, and import changes.",
"id": "patternfly-migration",
"name": "pf-react-migration"
},
{
"description": "Enable PatternFly 6 glass theme (glassmorphism with backdrop blur and transparency)",
"id": "pf-glass-theme",
"name": "pf-glass-theme"
}
],
"version": "1.2.0"
}
]
}
8 changes: 8 additions & 0 deletions plugins/patternfly/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "patternfly",
"description": "PatternFly v5 to v6 migration and glass theme implementation",
"version": "1.2.0",
"author": {
"name": "github.com/openshift-eng"
}
}
4 changes: 4 additions & 0 deletions plugins/patternfly/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- anandkuma77
reviewers:
- anandkuma77
98 changes: 98 additions & 0 deletions plugins/patternfly/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# PatternFly Plugin

A Claude Code plugin for migrating and working with PatternFly React components.

## Overview

PatternFly is Red Hat's open source design system for enterprise product experiences. This plugin helps developers migrate from PatternFly v5 to v6 and implement modern glass theme (glassmorphism) effects in React applications.

## Commands

### `/patternfly:migrate`

Migrate React components from PatternFly 5 to PatternFly 6.

**Usage:**
```bash
/patternfly:migrate [file-path]
```

**Examples:**
```bash
# Migrate a specific file
/patternfly:migrate src/components/Dashboard.tsx

# Migrate current working directory
/patternfly:migrate
```

**What it does:**
- Analyzes code for PatternFly v5 patterns
- Applies automated migrations for component renames, prop updates, and import changes
- Identifies manual updates needed for structural changes
- Provides testing recommendations

## Skills

### `pf-react-migration`

Migrate PatternFly React components, CSS classes, and tokens from v5 to v6.

**Coverage includes:**
- React component and prop migrations (Text → Content, Chip → Label, prop renames)
- CSS class migrations (pf-v5-* → pf-v6-*, legacy classes)
- Token migrations (--pf-global-* → --pf-t--*)
- Import path updates and deprecated component guidance
- Automated codemod integration
- Actionable scan commands for finding migration issues

### `pf-glass-theme`

Enable PatternFly 6 glass theme (glassmorphism) for React applications.

**Features:**
- Add `.pf-v6-theme-glass` class to enable glass effects
- Global or component-level glass theme support
- Optional runtime theme toggle component
- Dark mode compatibility (`.pf-v6-theme-glass.pf-v6-theme-dark`)
- Glass token usage examples (backdrop blur, transparency)
- Template components for glass UI patterns

## Installation

This plugin is part of the `ai-helpers` repository and is automatically available when the repository is loaded.

## Related Tools

The plugin complements these official PatternFly migration tools:

- **[@patternfly/pf-codemods](https://github.com/patternfly/pf-codemods)** - Automated code transformations
- **@patternfly/class-name-updater** - CSS class name updates
- **@patternfly/css-vars-updater** - CSS variable migrations

Use this plugin for:
- AI-assisted analysis of complex migration scenarios
- One-off component migrations
- Understanding breaking changes
- Migration planning and strategy

Use official codemods for:
- Comprehensive codebase-wide migrations
- Batch processing of many files
- Standardized transformations

## Resources

- [PatternFly v6 Documentation](https://www.patternfly.org/)
- [Migration Guide](https://www.patternfly.org/get-started/upgrade/)
- [Token Reference](https://www.patternfly.org/tokens/all-patternfly-tokens)
- [Component Examples](https://www.patternfly.org/components/all-components)

## Contributing

See the main [CLAUDE.md](../../CLAUDE.md) for contribution guidelines.

When adding new commands or skills:
1. Bump version in `.claude-plugin/plugin.json`
2. Run `make lint` to validate
3. Run `make update` to sync marketplace.json
94 changes: 94 additions & 0 deletions plugins/patternfly/commands/migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
description: Migrate PatternFly v5 to v6 (React components, CSS classes, tokens)
argument-hint: "[file-path]"
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.

⚠️ Potential issue | 🟡 Minor

Keep --dry-run discoverable or remove the example.

Line 75 advertises --dry-run, but the command hint, synopsis, generated registries, and Arguments section only document [file-path]. If dry-run is supported, include it consistently and define that no edits are applied; otherwise remove the example. While touching this block, add fence languages to satisfy MD040.

📝 Proposed docs update if dry-run is supported
-description: Migrate React components from PatternFly 5 to PatternFly 6
-argument-hint: "[file-path]"
+description: Migrate React components from PatternFly 5 to PatternFly 6
+argument-hint: "[file-path] [--dry-run]"
 skill: patternfly-migration
 ---
@@
-```
-/patternfly:migrate [file-path]
+```bash
+/patternfly:migrate [file-path] [--dry-run]

@@

  • /patternfly:migrate src/components/Dashboard.tsx

@@

  • /patternfly:migrate

@@

  • /patternfly:migrate src/components --dry-run
    Shows migration plan without applying changes (if user wants to review first)
    @@
    -- $1: (Optional) File path or directory to migrate. If not provided, analyzes the current context or prompts for clarification.
    +- $1: (Optional) File path or directory to migrate. If not provided, analyzes the current context or prompts for clarification.
    +- --dry-run: (Optional) Analyze and report the migration plan without applying edits.

Also regenerate/update `docs/data.json`, `PLUGINS.md`, and `plugins/patternfly/README.md` so their synopsis and argument hints stay aligned.
</details>


Also applies to: 10-13, 59-80

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @plugins/patternfly/commands/migrate.md at line 3, Update the
/patternfly:migrate command docs to consistently document the --dry-run flag:
add [--dry-run] to the command hint/synopsis and examples shown (the usages
around /patternfly:migrate [file-path], /patternfly:migrate
src/components/Dashboard.tsx, and /patternfly:migrate src/components --dry-run),
add a bullet for --dry-run in the Arguments section explaining it analyzes and
reports the migration plan without applying edits, and add bash fence languages
to the code blocks to satisfy MD040; then regenerate/update the related
registries/docs (docs/data.json, PLUGINS.md, plugins/patternfly/README.md) so
the synopsis and argument hints for /patternfly:migrate remain aligned.


</details>

<!-- fingerprinting:phantom:poseidon:ibis -->

<!-- This is an auto-generated comment by CodeRabbit -->

skill: pf-react-migration
---

## Name
patternfly:migrate

## Synopsis
```
/patternfly:migrate [file-path]
```
Comment on lines +11 to +13
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add language specifiers to code blocks.

The code blocks in Synopsis and Examples sections should specify bash as the language for proper syntax highlighting and to satisfy the markdownlint MD040 rule.

📝 Proposed fix
 ## Synopsis
-```
+```bash
 /patternfly:migrate [file-path]

```diff
 1. **Migrate a single component file**:
-   ```
+   ```bash
    /patternfly:migrate src/components/Dashboard.tsx
    ```
 2. **Migrate current working directory**:
-   ```
+   ```bash
    /patternfly:migrate
    ```
 3. **Analyze before migrating**:
-   ```
+   ```bash
    /patternfly:migrate src/components --dry-run
    ```

Also applies to: 62-64, 68-70, 74-77

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 11-11: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/patternfly/commands/migrate.md` around lines 11 - 13, Add the bash
language specifier to all fenced code blocks in the Synopsis and Examples for
the /patternfly:migrate command so they become ```bash fences; specifically
update the block containing "/patternfly:migrate [file-path]" and the example
blocks (e.g., "/patternfly:migrate src/components/Dashboard.tsx",
"/patternfly:migrate", "/patternfly:migrate src/components --dry-run") to use
```bash at the opening fence so markdownlint MD040 is satisfied.


## Description
The `patternfly:migrate` command migrates PatternFly v5 to v6 across React components, CSS classes, and design tokens. It scans for legacy patterns, applies fixes, and identifies items requiring manual updates.

This command provides:
- Automated detection of v5 patterns (components, CSS classes, tokens)
- Actionable scan commands using ripgrep for remaining issues
- Integration guidance for official @patternfly codemods
- Clear output with file:line references and confidence levels

## Implementation
The command uses the `pf-react-migration` skill to:

1. **Scan** for PatternFly v5 patterns using ripgrep commands
2. **Categorize** findings: React code, CSS classes, tokens, deprecated components
3. **Guide** codemod usage: pf-codemods, class-name-updater, css-vars-updater
4. **Apply** manual fixes for non-automatable changes
5. **Report** with confidence levels and testing recommendations

Follows the concise, actionable pattern of the pf-class-migration-scanner skill.

## Migration Scope

### React Components & Props
- Component replacements: Text/TextContent → Content, Chip → Label, KebabToggle → MenuToggle
- Prop updates: isActive → isClicked, labelIcon → labelHelp
- Import paths: Charts /victory, deprecated → /deprecated
- Toolbar chip → label prop renames

### CSS Classes & Tokens
- Legacy classes: pf-v5-*, pf-v4-*, pf-c-*, pf-u-*, pf-l-*
- Legacy tokens: --pf-v6-*, --pf-global-* → --pf-t--* (semantic)
- Color tokens requiring manual updates

### Manual Verification Required
- Markup changes (EmptyState, Masthead, Button icons)
- Deprecated components (ApplicationLauncher, old Dropdown/Select, PageHeader, Tile)
- UI testing and accessibility

## Return Value
- **Scan results**: File paths, current patterns, PF6 replacements
- **Confidence levels**: high/medium/low for each finding
- **Code changes**: Applied fixes with explanations (Why + How to apply)
- **Manual updates**: Items requiring manual verification with testing guidance

## Examples

1. **Migrate a single component file**:
```
/patternfly:migrate src/components/Dashboard.tsx
```
Analyzes and migrates PatternFly components in Dashboard.tsx

2. **Migrate current working directory**:
```
/patternfly:migrate
```
Scans and migrates PatternFly v5 patterns in all files from the current directory

3. **Analyze before migrating**:
```
/patternfly:migrate src/components --dry-run
```
Shows migration plan without applying changes (if user wants to review first)

## Arguments
- `$1`: (Optional) File path or directory to migrate. If not provided, analyzes the current context or prompts for clarification.

## Related Commands
After running migrations, consider:
- Running the official codemods: `npx @patternfly/pf-codemods --v6 --fix ./src`
- Updating CSS class names: `npx @patternfly/class-name-updater --v6 --fix ./src`
- Updating CSS variables: `npx @patternfly/css-vars-updater --fix ./src`
- Running tests to verify functionality

## Notes
- This command complements but does not replace the official `@patternfly/pf-codemods` tool
- Use AI analysis for complex cases and one-off migrations
- Use official codemods for comprehensive codebase-wide migrations
- Always test migrated components, especially for markup changes
- Review color token replacements (watch for `t_temp_dev_tbd` placeholders)
85 changes: 85 additions & 0 deletions plugins/patternfly/skills/patternfly-migration/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: pf-react-migration
description: Migrate PatternFly React components from v5 to v6. Scans for component renames, prop updates, and import changes.
---

# PatternFly React Migration

Migrate PatternFly React components from version 5 to version 6.

Query the PatternFly MCP server when migration recommendations are ambiguous to verify the latest supported component patterns and tokens.

## Migration scope

### React Components and Props
- Component renames: `Text`/`TextContent`/`TextList` → `Content`, `Chip` → `Label`, `KebabToggle` → `MenuToggle`
- Prop updates: `isActive` → `isClicked`, `labelIcon` → `labelHelp`, `isOverflowLabel` → `variant="overflow"`
- Import paths: Charts `/victory`, deprecated → `/deprecated`, promoted "next" components to base
- Toolbar: Chip props → Label props (`deleteChip` → `deleteLabel`)
- Color props: `cyan` → `teal`, `gold` → `yellow`

### CSS Classes and Tokens
- Legacy versioned classes: `pf-v5-*`, `pf-v4-*`
- Unversioned legacy classes: `pf-c-*`, `pf-u-*`, `pf-l-*`
- Legacy token patterns: `--pf-v6-*`, `--pf-global-*` → `--pf-t--*` (semantic tokens)

### Deprecated Components
- ApplicationLauncher, ContextSelector, old Dropdown/Select, OptionsMenu, PageHeader, Tile, DragDrop

## Scan commands

```bash
# Find v5 imports and component usage
rg "@patternfly/react-core(?!/deprecated)" --type tsx --type jsx

# Find legacy CSS classes
rg "pf-v5-|pf-v4-|pf-c-|pf-u-|pf-l-" src

# Find legacy CSS tokens
rg "--pf-v6-|--pf-global-" src

# Find deprecated component imports
rg "from.*@patternfly/react-core/deprecated" --type tsx --type jsx

# Find specific component patterns to migrate
rg "<(Text|TextContent|TextList|Chip|KebabToggle)\b" --type tsx --type jsx
```

## Migration workflow

1. **Run automated codemods first**:
```bash
npx @patternfly/pf-codemods --v6 --fix ./src
npx @patternfly/class-name-updater --v6 --fix ./src
npx @patternfly/css-vars-updater --fix ./src
```

2. **Scan for remaining issues** using commands above

3. **Apply manual fixes** for:
- Markup changes (EmptyState, Masthead, Button icons)
- Deprecated components requiring custom replacements
- Color tokens (`t_temp_dev_tbd` → semantic tokens)

4. **Test** UI behavior, accessibility, and responsive design

## Replacement guidance

- **Prefer** PatternFly React component props over CSS classes
- **Use** semantic tokens (`--pf-t--*`) over legacy tokens
- **Consult** [v6 token docs](https://www.patternfly.org/tokens/all-patternfly-tokens) for color replacements
- **Run** official codemods for comprehensive coverage before manual updates

## Output format

For each finding include:

- file path and line number
- current component/class/token
- recommended PF6 replacement
- confidence (`high`, `medium`, `low`)
- whether manual testing required

**Why:** Explain breaking change or deprecation reason

**How to apply:** Provide code example if replacement is non-obvious
Loading
Loading