Skip to content

Ask Cmd

CLI command for asking questions about the codebase using RAG.

logger module-attribute

logger = getLogger(__name__)

QuestionArg module-attribute

QuestionArg = Annotated[
	str | None,
	Argument(
		help="Your question about the codebase (omit for interactive mode)."
	),
]

InteractiveFlag module-attribute

InteractiveFlag = Annotated[
	bool,
	Option(
		"--interactive",
		"-i",
		help="Start an interactive chat session.",
	),
]

register_command

register_command(app: Typer) -> None

Register the ask command with the CLI app.

Source code in src/codemap/cli/ask_cmd.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def register_command(app: typer.Typer) -> None:
	"""Register the ask command with the CLI app."""

	@app.command(name="ask")
	@asyncer.runnify
	async def ask_command(
		question: QuestionArg = None,
		interactive: InteractiveFlag = False,
	) -> None:
		"""Ask questions about the codebase using Retrieval-Augmented Generation (RAG)."""
		# Defer heavy imports and logic to the implementation function
		await _ask_command_impl(
			question=question,
			interactive=interactive,
		)