Skip to content

Commit 98c0e4a

Browse files
committed
shorted prompt cuz otherwise it keeps on hallucinating
1 parent 2b3e169 commit 98c0e4a

1 file changed

Lines changed: 4 additions & 44 deletions

File tree

workflow.yaml

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ nodes:
1313
type: automatic
1414
steps:
1515
- name: "Transform React class components to function components"
16-
run: "npx -y @codemod/cli@3.3.0 --plugin ../../../react-declassify/cjs/dist/index.js src/"
16+
run: "npx -y @codemod/cli@3.3.0 --plugin ../../../react-declassify/cjs/dist/index.js ${TARGET:-src/} || true"
1717
- id: ai-review
1818
name: "AI Review"
1919
type: automatic
@@ -26,47 +26,7 @@ nodes:
2626
model: "gpt-4o-mini"
2727
max_tokens: 8000
2828
prompt: |
29-
IMPORTANT: A codemod (`react-declassify`) has ALREADY attempted to transform React class components to function components in this repository.
30-
Most files are COMPLETE, but `react-declassify` has known limitations and leaves markers where it fails. Your job is to REVIEW, FIX, and FINISH the transformations.
29+
You are reviewing React component migrations.
30+
Only if you see `react-declassify-disable` or `TODO_this` in the provided files, fix the component to use Hooks.
31+
If the file looks fine and does not have these markers, return immediately with no changes. Do not output any verbose explanations.
3132
32-
CRITICAL: You MUST provide verbose output explaining what you're doing at each step!
33-
Output your progress as you work so users can see what's happening.
34-
35-
Step 1: Search for Hard Errors and Soft Errors
36-
- Search the project for `react-declassify-disable Cannot perform transformation`. This indicates a HARD ERROR where the tool gave up. You MUST manually convert this entire class to a function component with Hooks yourself!
37-
- Search the project for `TODO_this`. This indicates a SOFT ERROR where the tool didn't know how to bind or resolve `this`. Fix the scoping and state/prop references.
38-
39-
Step 2: Address react-declassify's Known Limitations
40-
- Class Refs: If the old class was receiving refs or being instantiated via `useRef`, the new functional component will break. You MUST wrap the component in `React.forwardRef` and use `useImperativeHandle` to expose the necessary methods/properties!
41-
- Stricter Render Types: If the component returns a bare string/number and TypeScript complains about `FC<Props>`, wrap the return statement in a fragment `<> ... </>`.
42-
43-
Step 3: Review common transformation issues
44-
- Fix missing or incorrect dependency arrays in useEffect hooks
45-
- Ensure all setState calls use the functional updater when depending on previous state
46-
- Add missing cleanup functions in useEffect where needed
47-
48-
Step 4: ALWAYS output a clear summary
49-
You MUST provide a detailed summary at the end including:
50-
- Total files reviewed
51-
- List of ACTUAL files you modified (use real file paths)
52-
- Specific changes made to each file (e.g., "Resolved TODO_this", "Added forwardRef")
53-
54-
try `npm run build`-ing to validate.
55-
56-
57-
Output format:
58-
```
59-
📊 AI Review Summary
60-
==================
61-
Files reviewed: [actual number]
62-
Files modified: [actual number]
63-
64-
Changes made:
65-
1. [ACTUAL FILE PATH]
66-
- [specific change]
67-
```
68-
69-
**Efficient Review Strategy:**
70-
- Run: grep -r "TODO_this" --include="*.js" --include="*.jsx" --include="*.tsx" --include="*.ts" .
71-
- Run: grep -r "react-declassify-disable" --include="*.js" --include="*.jsx" --include="*.tsx" --include="*.ts" .
72-
- Only modify files that have actual problems. If the transformation is already correct, don't modify the files.

0 commit comments

Comments
 (0)