Indexes a directory or file by adding it to the code graph. If no path is provided, it indexes the current directory. Use --force to delete the existing index and rebuild from scratch.
(
path: Optional[str] = typer.Argument(None, help="Path to the directory or file to index. Defaults to the current directory."),
force: bool = typer.Option(False, "--force", "-f", help="Force re-index (delete existing and rebuild)"),
context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use (overrides mode/default)"),
)
| 1047 | |
| 1048 | @app.command() |
| 1049 | def index( |
| 1050 | path: Optional[str] = typer.Argument(None, help="Path to the directory or file to index. Defaults to the current directory."), |
| 1051 | force: bool = typer.Option(False, "--force", "-f", help="Force re-index (delete existing and rebuild)"), |
| 1052 | context: Optional[str] = typer.Option(None, "--context", "-c", help="Specific context to use (overrides mode/default)"), |
| 1053 | ): |
| 1054 | """ |
| 1055 | Indexes a directory or file by adding it to the code graph. |
| 1056 | If no path is provided, it indexes the current directory. |
| 1057 | |
| 1058 | Use --force to delete the existing index and rebuild from scratch. |
| 1059 | """ |
| 1060 | _load_credentials() |
| 1061 | if path is None: |
| 1062 | path = str(Path.cwd()) |
| 1063 | |
| 1064 | if force: |
| 1065 | console.print("[yellow]Force re-indexing (--force flag detected)[/yellow]") |
| 1066 | reindex_helper(path, context) |
| 1067 | else: |
| 1068 | index_helper(path, context) |
| 1069 | |
| 1070 | @app.command() |
| 1071 | def clean( |
no test coverage detected