--- description: Adds comments and JSDoc to a single file or set of files following ReloPortal standards --- ## Add Docs This workflow adds comments and JSDoc to a single file or set of files following ReloPortal coding standards defined in `.devin/rules/rules.md`. ### Steps 1. **Read the file(s)** - Use `read_file` to read the target file(s) - Identify the file type (component, service, hook, utility, etc.) 2. **Check for existing JSDoc/comments** - Identify exported components - check for JSDoc comment above component - Identify props interfaces - check for inline JSDoc on non-obvious props - Identify functions - check for JSDoc if function is non-obvious or complex - Identify service functions - check for error logging pattern 3. **Add missing JSDoc/comments following standards** **For React Components:** - Add JSDoc above every exported component: ```typescript /** * ComponentName — Brief description of what it renders * Used in: List of parent components/pages where this is used */ ``` **For Props Interfaces:** - Name interface `{ComponentName}Props` - Add inline JSDoc for non-obvious props: ```typescript interface ComponentNameProps { /** Description of what this prop does and expected values */ propName: string; } ``` **For Functions:** - Add JSDoc for non-obvious or complex functions: ```typescript /** * Brief description of what the function does * @param paramName - Description of parameter * @returns Description of return value */ ``` **For Service Functions:** - Ensure error logging follows pattern: ```typescript console.error("[functionName] message:", error); ``` **For Utility Functions:** - Add JSDoc explaining purpose and usage: ```typescript /** * Brief description of what the utility does * @param input - Description of input parameter * @returns Description of return value */ ``` 4. **Follow ReloPortal Standards** - No `any` types - define actual interfaces/types - Use `interface` for object shapes; `type` for unions - Use optional chaining `?.` and nullish coalescing `??` - Props interface named `{ComponentName}Props` - Destructure props in function signature - Imports order: React → AntD → internal components → utils/hooks/services → styles 5. **Run lint check** - Run `npm run lint` after adding comments - Fix any lint issues ### Alert Rules **STOP and tell the user** if you need to: - Add JSDoc to a shared component in `src/components/` that changes its public API - Modify a service function's error handling pattern Wait for explicit approval before proceeding. ### Checklist - [ ] Read the target file(s) - [ ] Identified file type and purpose - [ ] Checked for existing JSDoc/comments - [ ] Added JSDoc to exported components (if missing) - [ ] Added inline JSDoc to non-obvious props (if missing) - [ ] Added JSDoc to non-obvious functions (if missing) - [ ] Verified service error logging follows pattern - [ ] Followed ReloPortal naming conventions - [ ] Ran `npm run lint` and fixed issues