MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / index

Function index

src/codegraphcontext/cli/main.py:1049–1068  ·  view source on GitHub ↗

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)"),
)

Source from the content-addressed store, hash-verified

1047
1048@app.command()
1049def 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()
1071def clean(

Callers 1

index_abbrevFunction · 0.85

Calls 3

_load_credentialsFunction · 0.85
reindex_helperFunction · 0.85
index_helperFunction · 0.85

Tested by

no test coverage detected