|
| 1 | +--- |
| 2 | +description: Generate implementation plan from Jira issue using inst-ai |
| 3 | +--- |
| 4 | + |
| 5 | +Generate a comprehensive implementation plan by analyzing Jira issues and codebase using inst-ai tool with InstUI conventions. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +- Optional Jira issue key (e.g., INST-1234) or description |
| 10 | +- inst-ai tool must be installed globally (`npm install -g github:instructure/inst-ai-tool`) |
| 11 | +- Configuration must be set up (see inst-ai documentation) |
| 12 | + |
| 13 | +## Process |
| 14 | + |
| 15 | +1. **Get issue context**: |
| 16 | + |
| 17 | + **If Jira issue key provided**: |
| 18 | + - Run `inst-ai jira read <issue-key> --format xml --include-comments` |
| 19 | + - Parse the issue details: |
| 20 | + - Summary and description |
| 21 | + - Acceptance criteria |
| 22 | + - Comments and discussion |
| 23 | + - **Look for entry point file paths** in description/comments (likely included by user) |
| 24 | + |
| 25 | + **If plain text description provided**: |
| 26 | + - Use the description as issue context |
| 27 | + - Will need to identify entry point files manually |
| 28 | + |
| 29 | +2. **Identify entry point files**: |
| 30 | + |
| 31 | + **First, check if entry point is in Jira ticket**: |
| 32 | + - Look for file paths in ticket description |
| 33 | + - Check comments for mentioned components/files |
| 34 | + - Common patterns: `packages/ui-*/src/*/index.tsx` |
| 35 | + |
| 36 | + **If entry point NOT found in ticket**: |
| 37 | + - **Claude Code aids file selection** (inst-ai's interactive selector doesn't work in Claude CLI) |
| 38 | + - Analyze issue context to identify relevant components |
| 39 | + - Use `Glob` tool to search for potential files: |
| 40 | + - Search component packages: `packages/ui-{component}/src/*/index.tsx` |
| 41 | + - Search by feature area based on issue description |
| 42 | + - Present 3-5 most relevant options to user |
| 43 | + - Ask user to select or provide custom path |
| 44 | + - **Pass selected file path explicitly to inst-ai**: `inst-ai plan <issue-key> -e <file-path>` |
| 45 | + |
| 46 | + **Example searches**: |
| 47 | + ``` |
| 48 | + # For Button-related issues |
| 49 | + Glob: packages/ui-button/**/index.tsx |
| 50 | +
|
| 51 | + # For Select component |
| 52 | + Glob: packages/ui-select/**/index.tsx |
| 53 | +
|
| 54 | + # For broad changes |
| 55 | + Glob: packages/*/src/*/index.tsx |
| 56 | + ``` |
| 57 | + |
| 58 | +3. **Scan codebase**: |
| 59 | + - Use `inst-ai scan -e <file-path> --format xml --include-docs` |
| 60 | + - Can specify multiple entry points: `-e file1.tsx file2.tsx` |
| 61 | + - Include docs to understand context: `--include-docs` |
| 62 | + - Analyze: |
| 63 | + - Component structure and dependencies |
| 64 | + - Related files and imports |
| 65 | + - Testing files |
| 66 | + - Theme files |
| 67 | + - Documentation |
| 68 | + |
| 69 | +4. **Generate implementation plan**: |
| 70 | + - Combine Jira issue context with code analysis |
| 71 | + - Create structured plan with: |
| 72 | + - **Issue Summary**: What needs to be done |
| 73 | + - **Affected Components**: List of files/components to modify |
| 74 | + - **Dependencies**: Related code that may be impacted |
| 75 | + - **Implementation Steps**: Detailed, actionable tasks: |
| 76 | + 1. Update component props/logic |
| 77 | + 2. Update theme variables (if needed) |
| 78 | + 3. Update tests |
| 79 | + 4. Update documentation |
| 80 | + - **Testing Strategy**: |
| 81 | + - Unit tests (Vitest) |
| 82 | + - Component tests (Cypress) |
| 83 | + - Visual regression tests (if UI changes) |
| 84 | + - Accessibility verification |
| 85 | + - **Breaking Change Assessment**: |
| 86 | + - Evaluate if changes are breaking (see CLAUDE.md) |
| 87 | + - If breaking: document clearly with `BREAKING CHANGE:` in commit |
| 88 | + - Prefer non-breaking alternatives when possible |
| 89 | + - **Documentation Updates**: |
| 90 | + - Component README updates |
| 91 | + - API documentation |
| 92 | + - Migration guide (if breaking) |
| 93 | + |
| 94 | +5. **Save session**: |
| 95 | + - Plan is automatically saved to `.inst-ai/sessions` (configured in inst-ai.config.mjs) |
| 96 | + - Session includes: |
| 97 | + - Issue context |
| 98 | + - Scanned files |
| 99 | + - Generated plan |
| 100 | + - Timestamp and metadata |
| 101 | + |
| 102 | +6. **Present plan to user**: |
| 103 | + - Show complete implementation plan |
| 104 | + - Highlight breaking changes if any |
| 105 | + - List all affected files |
| 106 | + - Ask for user review and approval |
| 107 | + - **DO NOT start implementation without explicit user confirmation** |
| 108 | + |
| 109 | +7. **Ready to implement**: |
| 110 | + - Once approved, work through plan step-by-step |
| 111 | + - Mark tasks as completed using TodoWrite tool |
| 112 | + - Create commits following InstUI conventions (use `/commit`) |
| 113 | + - Create PR when done (use `/pr`) |
| 114 | + |
| 115 | +## Important Notes |
| 116 | + |
| 117 | +- **Entry point files are critical** - they determine what code gets analyzed |
| 118 | +- **Multiple entry points are supported** - use when changes span multiple components |
| 119 | +- **inst-ai interactive mode won't work** - Claude Code must handle all file selection |
| 120 | +- **Always pass file paths explicitly** to inst-ai CLI (don't rely on interactive selector) |
| 121 | +- **Parse Jira tickets carefully** - entry points are often mentioned in descriptions/comments |
| 122 | +- **Consider dependencies** - changes may affect multiple components |
| 123 | +- **Breaking changes require extra care** - see CLAUDE.md for breaking change guidelines |
| 124 | +- **Plans are saved** - can reference later from `.inst-ai/sessions` |
| 125 | + |
| 126 | +## Example Workflows |
| 127 | + |
| 128 | +### With Jira issue (entry point in ticket) |
| 129 | + |
| 130 | +```bash |
| 131 | +# 1. Fetch Jira issue |
| 132 | +inst-ai jira read INST-1234 --format xml --include-comments |
| 133 | + |
| 134 | +# 2. Entry point found in ticket: packages/ui-button/src/Button/index.tsx |
| 135 | +# 3. Generate plan |
| 136 | +inst-ai plan INST-1234 -e packages/ui-button/src/Button/index.tsx --include-docs |
| 137 | + |
| 138 | +# 4. Review plan, then implement |
| 139 | +``` |
| 140 | + |
| 141 | +### With Jira issue (entry point NOT in ticket) |
| 142 | + |
| 143 | +```bash |
| 144 | +# 1. Fetch Jira issue |
| 145 | +inst-ai jira read INST-1234 --format xml |
| 146 | + |
| 147 | +# 2. Issue is about "Button component accessibility" |
| 148 | +# 3. Claude Code searches for relevant files |
| 149 | +# Glob: packages/ui-button/**/index.tsx |
| 150 | + |
| 151 | +# 4. Present options to user: |
| 152 | +# - packages/ui-button/src/Button/index.tsx |
| 153 | +# - packages/ui-button/src/Button/README.md |
| 154 | + |
| 155 | +# 5. User selects: packages/ui-button/src/Button/index.tsx |
| 156 | +# 6. Generate plan |
| 157 | +inst-ai plan INST-1234 -e packages/ui-button/src/Button/index.tsx --include-docs |
| 158 | +``` |
| 159 | + |
| 160 | +### With plain description |
| 161 | + |
| 162 | +```bash |
| 163 | +# 1. User provides: "Add dark mode support to Select component" |
| 164 | +# 2. Claude Code identifies component: ui-select |
| 165 | +# 3. Search for entry points |
| 166 | +# Glob: packages/ui-select/**/index.tsx |
| 167 | + |
| 168 | +# 4. Generate plan |
| 169 | +inst-ai plan "Add dark mode support to Select component" -e packages/ui-select/src/Select/index.tsx --include-docs |
| 170 | +``` |
| 171 | + |
| 172 | +### Multiple entry points |
| 173 | + |
| 174 | +```bash |
| 175 | +# Changes span Button and ButtonGroup |
| 176 | +inst-ai plan INST-1234 -e packages/ui-button/src/Button/index.tsx packages/ui-button/src/ButtonGroup/index.tsx --include-docs |
| 177 | +``` |
| 178 | + |
| 179 | +## Error Handling |
| 180 | + |
| 181 | +- If Jira issue not found, verify issue key and permissions |
| 182 | +- If entry point file doesn't exist, re-search and confirm path with user |
| 183 | +- If inst-ai is not installed, provide installation instructions |
| 184 | +- If configuration is missing, direct user to run `inst-ai config validate` |
| 185 | +- If plan generation fails, check: |
| 186 | + - Entry point file is valid TypeScript/TSX |
| 187 | + - File is not too large (check token warning threshold in config) |
| 188 | + - Dependencies can be resolved |
| 189 | + |
| 190 | +## InstUI-Specific Considerations |
| 191 | + |
| 192 | +- **Component structure**: `/packages/ui-[name]/src/[Component]/` |
| 193 | +- **Co-located tests**: `Component.test.tsx` next to component |
| 194 | +- **Theme files**: `theme.ts` defines theme variables |
| 195 | +- **Props files**: `props.ts` defines component API |
| 196 | +- **README files**: Component documentation in component directory |
| 197 | +- **Visual regression tests**: Must add test page in `/regression-test` |
| 198 | +- **Functional components**: All new code uses hooks, never class components |
| 199 | +- **No hardcoded text**: All user-facing text from props (i18n support) |
0 commit comments