add_import_name
Add a name to an existing named import in Python or JS/TS, placing it in sorted order or at the list’s end while preserving formatting; use only when that import already exists.
Instructions
Add a name to an existing from <module> import ... (Python) or
import { ... } from "<module>" (JS/TS) statement; a name already
there is left as is. It goes at its sorted place when the names are
sorted (plainly or as isort and ruff sort them), else at the end, in the
list's layout: names one per line give it a line of its own, an inline
list stays inline. Refused when the file has no such import.
Use this when: the module is already imported with named imports. Don't use this when: there is no such import yet, or for a default or namespace import (add_import with the full line).
Example (from typing import Any, cast becomes Any, Dict, cast):
module="typing"
name="Dict"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | One imported name, e.g. 'Optional'. | |
| module | Yes | Module of the import as written, without quotes (e.g. 'typing' or './utils'). | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |