Create new documentation for an object-oriented component or update an existing component documentation file by analyzing the current implementation.
Determine the mode first
Choose the workflow before writing anything:
- Use update mode when the user provides an existing documentation Markdown file, points to a docs path, or explicitly asks to refresh or revise existing documentation. Follow references/update-mode.md.
- Use create mode when the user provides a source file or folder, points to a component path, or asks to generate documentation from code. Follow references/create-mode.md.
- If both code and an existing documentation file are provided, treat the existing documentation file as the output target and use the current source code as the source of truth.
- If the request is ambiguous, infer the mode from the path type whenever possible: existing Markdown documentation file means update mode; source/component path means create mode.