Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(cli): add --verbose/-v to workspace add and workspace scan (#944)

Loi Nguyen69f14a891de4
diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md
index e3a420662..8cdfe7c9f 100644
--- a/docs/CLI_REFERENCE.md
+++ b/docs/CLI_REFERENCE.md
@@ -702,6 +702,7 @@ This defaults to `--index --docs` when a provider is configured, the added repo
| `--provider` / `--model` | Override the inherited provider/model |
| `--concurrency` | Max concurrent LLM calls for this repo's generation |
| `--primary` | Mark this repo as the workspace default |
+| `--verbose`, `-v` | Show debug logs from indexing and doc generation |
```bash
repowise workspace add ../new-service --alias api-gateway
@@ -720,6 +721,7 @@ Re-scan the workspace directory for new repos not yet added.
| Flag | Description |
|------|-------------|
| `--yes` / `-y` | Auto-add all discovered repos without prompting |
+| `--verbose`, `-v` | Show debug logs while scanning for repositories |
```bash
repowise workspace scan
diff --git a/packages/cli/src/repowise/cli/commands/workspace_cmd.py b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
index 49318281b..ff387d571 100644
--- a/packages/cli/src/repowise/cli/commands/workspace_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
import click
from rich.table import Table
+from repowise.cli._setup import configure_cli_logging
from repowise.cli.helpers import (
console,
find_workspace_root,
@@ -242,6 +243,13 @@ def _format_relative_time(iso_timestamp: str | None) -> str:
@click.option(
"--concurrency", type=int, default=10, help="Max concurrent LLM calls during doc generation."
)
+ "--verbose",
+ "-v",
+ is_flag=True,
+ default=False,
+ help="Show debug logs from the pipeline.",
+)
def workspace_add(
path: str,
alias: str | None,
@@ -250,6 +258,7 @@ def workspace_add(
provider_name: str | None,
model: str | None,
concurrency: int,
+ verbose: bool,
) -> None:
"""Add a repo to the workspace and (by default) index + generate docs for it.
@@ -263,6 +272,8 @@ def workspace_add(
Use ``--no-index`` to only register the entry without indexing, or
``--no-docs`` to index without LLM generation.
"""
+ configure_cli_logging(verbose=verbose)
+
from repowise.core.workspace.config import RepoEntry
repo_path = Path(path).resolve()
@@ -766,8 +777,17 @@ def workspace_remove(alias: str) -> None:
default=False,
help="Auto-add all discovered repos without prompting.",
)
-def workspace_scan(path: str | None, yes: bool) -> None:
+ "--verbose",
+ "-v",
+ is_flag=True,
+ default=False,
+ help="Show debug logs from the pipeline.",
+)
+def workspace_scan(path: str | None, yes: bool, verbose: bool) -> None:
"""Scan the workspace root for new repos not yet in the config."""
+ configure_cli_logging(verbose=verbose)
+
from repowise.core.workspace.config import RepoEntry
from repowise.core.workspace.scanner import scan_for_repos
diff --git a/tests/unit/cli/test_workspace_logging.py b/tests/unit/cli/test_workspace_logging.py
new file mode 100644
index 000000000..2f9a5227b
--- /dev/null
+++ b/tests/unit/cli/test_workspace_logging.py
@@ -0,0 +1,66 @@
+"""Tests for logging setup at workspace command boundaries."""
+
+from __future__ import annotations
+
+import click
+import pytest
+from click.testing import CliRunner
+
+from repowise.cli.commands import workspace_cmd
+from repowise.cli.main import cli
+
+
+ ("extra_args", "expected_verbose"),
+ [([], False), (["--verbose"], True)],
+)
+def test_workspace_add_configures_logging_before_workspace_resolution(
+ monkeypatch: pytest.MonkeyPatch,
+ extra_args: list[str],
+ expected_verbose: bool,
+) -> None:
+ events: list[tuple[str, bool | None]] = []
+
+ def fake_configure_cli_logging(*, verbose: bool = False) -> None:
+ events.append(("logging", verbose))
+
+ def fake_require_workspace(*_args: object, **_kwargs: object) -> None:
+ events.append(("workspace", None))
+ raise click.ClickException("stop after workspace resolution")
+
+ monkeypatch.setattr(workspace_cmd, "configure_cli_logging", fake_configure_cli_logging)
+ monkeypatch.setattr(workspace_cmd, "_require_workspace", fake_require_workspace)
+
+ result = CliRunner().invoke(cli, ["workspace", "add", ".", *extra_args])
+
+ assert result.exit_code == 1
+ assert "stop after workspace resolution" in result.output
+ assert events == [("logging", expected_verbose), ("workspace", None)]
+
+
+ ("extra_args", "expected_verbose"),
+ [([], False), (["--verbose"], True)],
+)
+def test_workspace_scan_configures_logging_before_path_resolution(
+ monkeypatch: pytest.MonkeyPatch,
+ extra_args: list[str],
+ expected_verbose: bool,
+) -> None:
+ events: list[tuple[str, bool | None]] = []
+
+ def fake_configure_cli_logging(*, verbose: bool = False) -> None:
+ events.append(("logging", verbose))
+
+ def fake_resolve_repo_path(_path: str | None) -> None:
+ events.append(("path", None))
+ raise click.ClickException("stop after path resolution")
+
+ monkeypatch.setattr(workspace_cmd, "configure_cli_logging", fake_configure_cli_logging)
+ monkeypatch.setattr(workspace_cmd, "resolve_repo_path", fake_resolve_repo_path)
+
+ result = CliRunner().invoke(cli, ["workspace", "scan", *extra_args])
+
+ assert result.exit_code == 1
+ assert "stop after path resolution" in result.output
+ assert events == [("logging", expected_verbose), ("path", None)]