-
Notifications
You must be signed in to change notification settings - Fork 27
feat: added design comments skill #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dlabaj
wants to merge
1
commit into
patternfly:main
Choose a base branch
from
dlabaj:design-comments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+142
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| --- | ||
| name: pf-design-comments | ||
| description: Integrate @patternfly/design-comments into React apps for on-page design feedback, pinned comment threads, GitHub Issues sync, and Jira linking. Use when adding design comments, review overlays, or removing the commenting system from a PatternFly React project. | ||
| --- | ||
|
|
||
| # PF Design Comments | ||
|
|
||
| Add the [@patternfly/design-comments](https://github.com/patternfly/design-comments) floating comment overlay to the user's React app. The package pins feedback to UI elements, detects React components, and optionally syncs with GitHub Issues and Jira. | ||
|
|
||
| ## When to use | ||
|
|
||
| - User asks to add design comments, a comment overlay, or in-app design review | ||
| - User wants GitHub Issues or Jira linked to specific pages or components | ||
| - User wants to remove or uninstall design comments | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Confirm before installing: | ||
|
|
||
| - React 18+ and Node.js 18+ | ||
| - Webpack-based dev setup with `webpack.dev.js` (required for OAuth/Jira/summarize proxy middleware) | ||
| - `src/app/` layout similar to [PatternFly React Seed](https://github.com/patternfly/patternfly-react-seed) | ||
| - Peer deps present or installable: `@patternfly/react-core`, `@patternfly/react-icons`, `react-router-dom` v7 | ||
|
|
||
| If the project uses Vite, Create React App, or a different folder layout, warn the user that `npx design-comments init` may fail or need manual integration. Offer to scaffold with `pf-project-scaffolder` first when starting from scratch. | ||
|
|
||
| ## Install workflow | ||
|
|
||
| ### Step 1: Inspect the project | ||
|
|
||
| 1. Read `package.json` for React, PatternFly, and router versions. | ||
| 2. Confirm `src/app/index.tsx`, `src/app/routes.tsx`, and `src/app/AppLayout/AppLayout.tsx` exist (or note gaps). | ||
| 3. Confirm `webpack.dev.js` exists at the project root or under a config folder the dev script uses. | ||
|
|
||
| ### Step 2: Install the package | ||
|
|
||
| Use the scoped npm package name: | ||
|
|
||
| ```bash | ||
| npm install @patternfly/design-comments | ||
| ``` | ||
|
|
||
| Use `yarn add @patternfly/design-comments` if the project uses Yarn. | ||
|
|
||
| ### Step 3: Run the integration CLI | ||
|
|
||
| ```bash | ||
| npx design-comments init | ||
| ``` | ||
|
|
||
| The CLI is interactive. It will: | ||
|
|
||
| - Wrap the app with `CommentProvider` and `GitHubAuthProvider` in `src/app/index.tsx` | ||
| - Add a Comments route in `src/app/routes.tsx` | ||
| - Add `CommentPanel` and `CommentOverlay` in `src/app/AppLayout/AppLayout.tsx` | ||
| - Patch `webpack.dev.js` with proxy middleware for GitHub OAuth, Jira, and optional AI summaries | ||
| - Create `src/app/Comments/Comments.tsx` and env templates | ||
|
|
||
| Let the user answer prompts for GitHub OAuth and Jira. Both are optional — the overlay works without them. | ||
|
|
||
| ### Step 4: Configure environment files | ||
|
|
||
| After `init`, guide the user through env setup: | ||
|
|
||
| **`.env`** (client-safe values, may be committed) | ||
|
|
||
| - GitHub OAuth client ID | ||
| - Jira base URL | ||
|
|
||
| **`.env.server`** (secrets — should stay in `.gitignore`) | ||
|
|
||
| - GitHub OAuth client secret | ||
| - Jira API tokens | ||
| - Optional AI summary keys: `MAAS_API_KEY`, `MAAS_ENDPOINT_URL`, `MAAS_MODEL` (default `gpt-4o-mini`) | ||
|
|
||
| See `GITHUB_OAUTH_ENV_TEMPLATE.md` in the package for OAuth setup details. | ||
|
|
||
| For production builds, set `SUMMARIZE_API_URL` when building so the client calls a hosted summarization endpoint. Do not put private API keys in client-bundled `.env` values. | ||
|
|
||
| ### Step 5: Verify | ||
|
|
||
| 1. Run the project's dev command (usually `npm run start:dev`). | ||
| 2. Confirm the floating comment widget appears. | ||
| 3. Test hover preview, pin creation, and the Comments sidebar. | ||
|
|
||
| Report what changed: | ||
|
|
||
| - Package added to `package.json` | ||
| - Files modified by `init` (index, routes, AppLayout, webpack) | ||
| - New Comments page and env files created | ||
|
|
||
| ## Uninstall workflow | ||
|
|
||
| **Always run remove before uninstalling.** The package modifies project files. | ||
|
|
||
| ```bash | ||
| npx design-comments remove | ||
| npm uninstall @patternfly/design-comments | ||
| ``` | ||
|
|
||
| Then restart the dev server. | ||
|
|
||
| If the user already uninstalled without running `remove` and the app is broken: | ||
|
|
||
| ```bash | ||
| npm install @patternfly/design-comments | ||
| npx design-comments remove | ||
| npm uninstall @patternfly/design-comments | ||
| ``` | ||
|
|
||
| The remove script reverses integration in `src/app/index.tsx` and `src/app/AppLayout/AppLayout.tsx`. Webpack middleware changes may need manual cleanup. `.env` and `.env.server` are kept intentionally. | ||
|
|
||
| ## Usage reference (for the user) | ||
|
|
||
| After integration: | ||
|
|
||
| 1. Hover a component to preview with a dashed border and label | ||
| 2. Click to pin a comment — React component name, type, tree path, and props are captured | ||
| 3. Use the widget to toggle visibility, resize the panel, reply in threads, and sync with GitHub/Jira when configured | ||
|
|
||
| Optional AI summaries (Summarize all threads / this page / this thread) need the local webpack proxy or a production `SUMMARIZE_API_URL` backend. | ||
|
|
||
| ## Manual integration fallback | ||
|
|
||
| If `init` cannot run, read the package README and `scripts/README.md` from `node_modules/@patternfly/design-comments/` and apply the same changes by hand: | ||
|
|
||
| - Providers in the app entry | ||
| - Comments route | ||
| - `CommentPanel` + `CommentOverlay` in the main layout | ||
| - Webpack dev middleware for integrations | ||
|
|
||
| Import components from `@patternfly/design-comments` (package main: `src/commenting-system/index.ts`). | ||
|
|
||
| ## Notes | ||
|
|
||
| - Run `init` only once per project unless the user asks to re-run after a failed partial install (the script is idempotent) | ||
| - Use git so the user can review integration diffs before committing | ||
| - For issues with the package itself, point to https://github.com/patternfly/design-comments/issues | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
disable-model-invocation: trueto frontmatter — this skill has side effects.The skill executes
npx design-comments init, which modifies multiple project files (src/app/index.tsx,src/app/routes.tsx,src/app/AppLayout/AppLayout.tsx,webpack.dev.js), creates new files (src/app/Comments/Comments.tsx, env templates), and adds webpack middleware. These are file-system mutations and therefore side effects that require thedisable-model-invocation: trueflag per PatternFly ai-helpers conventions (CONTRIBUTING-SKILLS.md and retrieved learnings on PR 77). This ensures only the user can invoke the skill, not the AI model programmatically.🔧 Proposed frontmatter fix
--- name: pf-design-comments description: Integrate `@patternfly/design-comments` into React apps for on-page design feedback, pinned comment threads, GitHub Issues sync, and Jira linking. Use when adding design comments, review overlays, or removing the commenting system from a PatternFly React project. +disable-model-invocation: true ---📝 Committable suggestion
🤖 Prompt for AI Agents
Sources: Coding guidelines, Learnings