Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lode/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""lode: local knowledge base semantic search over MCP."""

__version__ = "0.1.0"
from importlib.metadata import version as _get_version

__version__: str = _get_version("lode-cli")
10 changes: 9 additions & 1 deletion src/lode/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import typer

from lode import __version__
from lode.cli.render.assay import render_assay as render_assay # re-exported for lode.cli.render_assay
from lode.cli.render.assay import render_how as render_how # re-exported for lode.cli.render_how
from lode.cli.render.dig import render_dig as render_dig # re-exported for lode.cli.render_dig
Expand All @@ -28,7 +29,7 @@
)


@app.callback()
@app.callback(invoke_without_command=True)
def main(
ctx: typer.Context,
workspace: Annotated[
Expand All @@ -42,8 +43,15 @@ def main(
help="Workspace to operate on.",
),
] = Path("."),
version: Annotated[
bool,
typer.Option("--version", "-v", help="Show version and exit.", is_eager=True),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make --version short-circuit before workspace validation

When a script requests the version alongside a workspace that no longer exists, such as lode --version -C /missing, Click validates the workspace path and exits with an error before it invokes main, so no version is emitted. is_eager only prioritizes parameter callbacks (Click callback evaluation order); this option has no callback, while the version exit happens later in main. Handle the version exit during eager option processing, or skip workspace validation when it is set.

Useful? React with 👍 / 👎.

] = False,
) -> None:
"""Application-level options shared by every command."""
if version:
typer.echo(f"Lode {__version__}")
raise typer.Exit()
ctx.obj = workspace


Expand Down
Loading