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.

fix(init): health progress-bar UX, cost-gate default yes, concurrency 10, resume hint (#412)

Raghav Chamadiya1c67e0a9903a
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/command.py b/packages/cli/src/repowise/cli/commands/init_cmd/command.py
index 404c8e2ea..5f25547cd 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/command.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/command.py
@@ -228,7 +228,7 @@ def _run_generation_phase(
@click.option(
"--force", is_flag=True, default=False, help="Regenerate all pages, ignoring existing."
)
[email protected]("--concurrency", type=int, default=5, help="Max concurrent LLM calls.")
[email protected]("--concurrency", type=int, default=10, help="Max concurrent LLM calls.")
@click.option(
"--reasoning",
type=click.Choice(REASONING_MODES),
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py b/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
index 5ec914b91..44757d30b 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/generation.py
@@ -46,18 +46,23 @@ class CostGateDeclined(Exception): # noqa: N818 — a control-flow signal, not
def confirm_cost_gate(message: str) -> bool:
- """Render the cost-gate ``[y/N]`` prompt with visual padding.
+ """Render the cost-gate ``[Y/n]`` prompt with visual padding.
Click's plain ``confirm`` interleaves with the trailing line of any
prior Rich output (progress-bar frames, status spinners), making the
- ``[y/N]`` glyphs hard to spot — users have walked past it and approved
+ confirm glyphs hard to spot — users have walked past it and approved
a $14 bill thinking they were still in cost-estimate territory. A
blank line + horizontal rule cleanly separates the prompt from
whatever was printed above it.
+
+ Default is Yes: the user just picked a coverage tier with the cost
+ range printed next to it, so Enter-through should continue the run
+ they configured — the gate exists to make the spend visible, not to
+ interrupt it.
"""
console.line()
console.rule(style="yellow")
- return click.confirm(message, default=False)
+ return click.confirm(message, default=True)
def cost_gate_declined(est: Any, *, yes: bool, message: str) -> bool:
@@ -245,6 +250,12 @@ def run_repo_generation(
cost_tracker = build_cost_tracker(repo_path, result.repo_name)
provider._cost_tracker = cost_tracker
+ if verbose:
+ console.print(
+ " [dim](each generated page is saved as it completes — safe to Ctrl-C, "
+ "then run 'repowise init --resume' to pick up where it stopped)[/dim]"
+ )
+
with Progress(
SpinnerColumn(spinner_name=OWL_SPINNER, style=BRAND_STYLE),
TextColumn("[progress.description]{task.description}"),
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
index 89c488e69..151b42be3 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
@@ -400,7 +400,7 @@ def _workspace_init(
index_only: bool = False,
skip_tests: bool = False,
skip_infra: bool = False,
- concurrency: int = 5,
+ concurrency: int = 10,
test_run: bool = False,
reasoning: str | None = None,
yes: bool = False,
diff --git a/packages/cli/src/repowise/cli/commands/update_cmd.py b/packages/cli/src/repowise/cli/commands/update_cmd.py
index 359842439..9aa01b9a4 100644
--- a/packages/cli/src/repowise/cli/commands/update_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/update_cmd.py
@@ -634,7 +634,7 @@ def _run_full_health_rescore(
@click.option("--provider", "provider_name", default=None, help="LLM provider name.")
@click.option("--model", default=None, help="Model identifier override.")
@click.option("--since", default=None, help="Base git ref to diff from (overrides state).")
[email protected]("--concurrency", type=int, default=5, help="Max concurrent LLM calls.")
[email protected]("--concurrency", type=int, default=10, help="Max concurrent LLM calls.")
@click.option(
"--reasoning",
type=click.Choice(REASONING_MODES),
@@ -739,7 +739,7 @@ def update_command(
docs_flag: bool | None = None,
full: bool = False,
agents_md: bool | None = None,
- concurrency: int = 5,
+ concurrency: int = 10,
no_cost_tracking: bool = False,
) -> None:
"""Incrementally update wiki pages for files changed since last sync.
diff --git a/packages/cli/src/repowise/cli/commands/workspace_cmd.py b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
index 98b2b7941..183dc5fcd 100644
--- a/packages/cli/src/repowise/cli/commands/workspace_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
@@ -236,7 +236,7 @@ def _format_relative_time(iso_timestamp: str | None) -> str:
)
@click.option("--provider", "provider_name", default=None, help="LLM provider name (overrides primary's).")
@click.option("--model", default=None, help="Model identifier (overrides primary's).")
[email protected]("--concurrency", type=int, default=5, help="Max concurrent LLM calls during doc generation.")
[email protected]("--concurrency", type=int, default=10, help="Max concurrent LLM calls during doc generation.")
def workspace_add(
path: str,
alias: str | None,
@@ -453,7 +453,7 @@ def _run_index_for_repo(
generate_docs: bool = False,
provider_name: str | None = None,
model: str | None = None,
- concurrency: int = 5,
+ concurrency: int = 10,
docs_skip_reason: str | None = None,
) -> None:
"""Run the ingestion pipeline on a single repo, optionally with LLM docs.
diff --git a/packages/cli/src/repowise/cli/ui/mode_selection.py b/packages/cli/src/repowise/cli/ui/mode_selection.py
index baab7b01c..ea4ae10a9 100644
--- a/packages/cli/src/repowise/cli/ui/mode_selection.py
+++ b/packages/cli/src/repowise/cli/ui/mode_selection.py
@@ -241,11 +241,11 @@ def _prompt_generation(
console.print()
# Smart concurrency default
- default_concurrency = 5
+ default_concurrency = 10
if scan and scan.total_files < 200:
- default_concurrency = 8
+ default_concurrency = 12
elif scan and scan.total_files > 5000:
- default_concurrency = 3
+ default_concurrency = 5
result["concurrency"] = click.prompt(
" Max concurrent LLM calls",
diff --git a/packages/core/src/repowise/core/analysis/health/engine.py b/packages/core/src/repowise/core/analysis/health/engine.py
index 0734806fd..1caaeef64 100644
--- a/packages/core/src/repowise/core/analysis/health/engine.py
+++ b/packages/core/src/repowise/core/analysis/health/engine.py
@@ -340,6 +340,10 @@ class HealthAnalyzer:
log.debug("health_walk_failed", path=pf.file_info.path, error=str(exc))
fcx = FileComplexity(functions=[], classes=[])
walked.append((pf, fcx))
+ # Walk tick — the phase total counts each file twice (walk +
+ # evaluate); see analyze_async.
+ if on_step:
+ on_step(pf.file_info.path)
repo_fn_mod_p80 = _compute_repo_function_mod_p80(walked, self.git_meta_map)
repo_dependents_p80 = _compute_repo_dependents_p80(self.parsed_files, self.graph)
@@ -422,20 +426,20 @@ class HealthAnalyzer:
repo_commit_counts = _build_repo_commit_counts(self.git_meta_map)
graph_view: HasEdge | None = _ImportEdgeView(self.graph) if self.graph is not None else None
- if "dry_violation" in disabled:
- dup_report = DuplicationReport()
- else:
- try:
- dup_report = await asyncio.to_thread(
+ # Duplication is only consumed by the biomarker stage, so it can
+ # overlap with the pre-walk instead of blocking it — on large
+ # repos the scan takes seconds during which the progress bar
+ # would otherwise sit at zero.
+ dup_task: asyncio.Task | None = None
+ if "dry_violation" not in disabled:
+ dup_task = asyncio.ensure_future(
+ asyncio.to_thread(
detect_clones,
self.parsed_files,
self.git_meta_map,
cache_dir=self.duplication_cache_dir,
)
- _log_duplication_diagnostics(dup_report)
- except Exception as exc:
- log.debug("health_duplication_failed", error=str(exc))
- dup_report = DuplicationReport()
+ )
target_files = [
pf
@@ -443,6 +447,8 @@ class HealthAnalyzer:
if changed_set is None or pf.file_info.path in changed_set
]
if not target_files:
+ if dup_task is not None:
+ dup_task.cancel()
return HealthReport(
repo_id="",
analyzed_at=datetime.now(UTC),
@@ -464,9 +470,23 @@ class HealthAnalyzer:
except Exception as exc:
log.debug("health_walk_failed", path=pf.file_info.path, error=str(exc))
fcx = FileComplexity(functions=[], classes=[])
+ # Walk tick — the phase total counts each file twice (walk +
+ # evaluate) so the bar moves from the very first completed walk.
+ if on_step:
+ on_step(pf.file_info.path)
return pf, fcx
walked = await asyncio.gather(*[_one(pf) for pf in target_files])
+
+ if dup_task is None:
+ dup_report = DuplicationReport()
+ else:
+ try:
+ dup_report = await dup_task
+ _log_duplication_diagnostics(dup_report)
+ except Exception as exc:
+ log.debug("health_duplication_failed", error=str(exc))
+ dup_report = DuplicationReport()
repo_fn_mod_p80 = _compute_repo_function_mod_p80(list(walked), self.git_meta_map)
repo_dependents_p80 = _compute_repo_dependents_p80(self.parsed_files, self.graph)
repo_active_contributors = _compute_repo_active_contributors(self.git_meta_map)
diff --git a/packages/core/src/repowise/core/pipeline/phases/analysis.py b/packages/core/src/repowise/core/pipeline/phases/analysis.py
index 5e07fcaa3..1fcbfa4d2 100644
--- a/packages/core/src/repowise/core/pipeline/phases/analysis.py
+++ b/packages/core/src/repowise/core/pipeline/phases/analysis.py
@@ -82,8 +82,11 @@ async def _run_health_analysis(
from repowise.core.analysis.health.config import HealthConfig
if progress:
- # Per-file determinate progress: one tick per parsed file.
- progress.on_phase_start("health", len(parsed_files))
+ # Two ticks per parsed file: one when its AST walk completes,
+ # one when its biomarker evaluation completes. Without the
+ # walk tick the bar sits at 0 through the duplication scan and
+ # the entire pre-walk — most of the phase's wall-clock.
+ progress.on_phase_start("health", 2 * len(parsed_files))
# Build a {file_path → community label} map so per-file metrics
# carry a real module name, not None. Community detection is