Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(update): repowise update --full takes a fast index to full without a key, and every surface names it (#4244)
Raghav Chamadiyabdc180e439bc
diff --git a/docs/reference/CLI_REFERENCE.md b/docs/reference/CLI_REFERENCE.mdindex 81ff2c684..c64dad933 100644--- a/docs/reference/CLI_REFERENCE.md+++ b/docs/reference/CLI_REFERENCE.md@@ -292,7 +292,7 @@ See [WORKTREES.md](../scale/WORKTREES.md).**First-time indexing:** `update --workspace` runs full first-time indexing for workspace entries that have no `.repowise/` dir yet (previously skipped with `"not_indexed"`). The pipeline runs index-only, no LLM cost, and writes a state.json marker. Doc generation then follows on the next update once the repo has an index: pass `--docs` (or set its `docs_enabled`) and it regenerates pages like any other member.-**Upgrading a fast index to full (`--full`):** a repo first indexed with `repowise init --mode fast` has the full dependency graph + metrics persisted, but only the *essential* git tier (last commits, no per-file blame or co-change) and no model-written docs. `repowise update --full` upgrades it **incrementally**: it backfills the git tier to FULL using a resumable checkpoint, reuses the persisted graph, generates the missing prose, rebuilds full-text search, embeds pages when the resolved embedder is available, and recomputes health against FULL history. The command records the transition before work and checkpoints each completed stage; failure or cancellation leaves the prior scope truthful and a retryable upgrade instead of stamping the repository full early. Persisted provider/model/embedder choices are reused when valid, overrides remain explicit, and estimated model cost is shown before paid generation. If embedding is unavailable the completed scope says so and gives the exact recovery command, `repowise reindex`; it never implies semantic search was built. Single-repo only; it errors in workspace mode.+**Upgrading a fast index to full (`--full`):** a repo first indexed with `repowise init --mode fast` has the full dependency graph + metrics persisted, but only the *essential* git tier (last commits, no per-file blame or co-change) and no model-written docs. `repowise update --full` upgrades it **incrementally**: it backfills the git tier to FULL using a resumable checkpoint, reuses the persisted graph, builds the missing documentation, rebuilds full-text search, embeds pages when the resolved embedder is available, and recomputes health against FULL history. The command records the transition before work and checkpoints each completed stage; failure or cancellation leaves the prior scope truthful and a retryable upgrade instead of stamping the repository full early. Persisted provider/model/embedder choices are reused when valid, overrides remain explicit, and estimated model cost is shown before paid generation. If embedding is unavailable the completed scope says so and gives the exact recovery command, `repowise reindex`; it never implies semantic search was built. It needs no key: with no model configured the documentation is built from code, with no model calls and no spend, and the embedder stays the free one unless you chose another. With a model configured, the model writes it. One repo at a time; in a workspace, pass `--repo <alias>`.`state.json:index_scope` is the canonical machine-readable description used by `status --format json`, `/api/repos`, generated agent guidance, and MCP `_meta.index_scope`. It separately records run mode, content provenance (`none`, `template`, or `model`), Git tier, configured commit cap, achieved Git-history coverage, configured/effective file-page caps, eligible/generated/omitted file-page counts, unavailable/skipped analysis, search availability, provider choices, and upgrade state. Older indexes project missing facts as `unknown`/`null`; a configured cap is never reported as achieved coverage and a missing analysis result is never reported as a clean result.diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py b/packages/cli/src/repowise/cli/commands/init_cmd/_generate.pyindex 51e4dddaa..7d624d3ac 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/_generate.py@@ -434,11 +434,12 @@ def _generate(run: InitRun) -> bool:# Fast mode is a graph-and-git index only.if opts.index_only and opts.run_mode == "fast":+ from repowise.core.index_scope import FAST_TO_FULL_COMMAND+console.print(f" [dim]{INDEX_ONLY}: fast mode skips documentation. Run "- "[bold]repowise init[/bold] without [bold]--mode fast[/bold] to "- "build it from code, or [bold]repowise update --full[/bold] "- "to write it with a model.[/dim]"+ f"[bold]{FAST_TO_FULL_COMMAND}[/bold] to build it from code (no key "+ "needed), or have a model write it when one is configured.[/dim]")return Falseif opts.index_only or run.no_provider:diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.pyindex 3b6078f15..cf3462ed5 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/reporting.py@@ -23,7 +23,14 @@ from repowise.cli.ui import (keyless_upgrade_note,print_files_written,)-from repowise.cli.ui.mode_names import TITLE_WORKSPACE, completion_title, pages, scope_line+from repowise.cli.ui.mode_names import (+ INDEX_ONLY,+ TITLE_WORKSPACE,+ completion_title,+ pages,+ scope_line,+)+from repowise.core.index_scope import FAST_TO_FULL_COMMAND, fast_to_full_commanddef _render_defect_accuracy(result: Any) -> None:@@ -235,11 +242,7 @@ def show_completion(console.print(f" [dim]{_note}[/dim]")_print_embed_failure(_embed_failed)else:- console.print(- " [dim]Index only: the graph and git history, no documentation.\n"- " Re-run without [bold]--mode fast[/bold] to build documentation from "- "code.[/dim]"- )+ console.print(_fast_to_full_note())for _line in build_status_notes(setup):console.print(_line)console.print()@@ -352,6 +355,42 @@ def _show_generation_checks(result: Any) -> None:console.print(f"[{ERR}]Generation checks did not run:[/] {type(exc).__name__}: {exc}")+def _fast_to_full_note() -> str:+ """The closing note of an Index only run, naming the one fast-to-full command."""+ return (+ f" [dim]{INDEX_ONLY}: fast mode indexes the graph and git history, no "+ f"documentation.\n Run [bold]{FAST_TO_FULL_COMMAND}[/bold] to build it from "+ "code (no key needed).[/dim]"+ )+++def _workspace_next_steps(run_mode: str, keyless: bool) -> list[tuple[str, str]]:+ """Dashboard and status, then the one upgrade that fits how the repos were indexed."""+ if run_mode == "fast":+ upgrade = (+ fast_to_full_command("<repo>"),+ "build a repo's documentation from code and its full git history (no key)",+ )+ elif keyless:+ upgrade = ("repowise generate <repo>", "write a repo's documentation with a model")+ else:+ upgrade = ("repowise search <query>", "search across all indexed repos")+ return [+ ("repowise serve", "open the workspace dashboard at http://localhost:3000"),+ ("repowise status --workspace", "show workspace status"),+ upgrade,+ ]+++def _upgradable_skips(docs_outcomes: dict[str, tuple[int, str | None]]) -> list[tuple[str, str]]:+ """Repos that skipped documentation; a dry run wrote nothing, so it has nothing to upgrade."""+ return [+ (alias, reason)+ for alias, (_count, reason) in docs_outcomes.items()+ if reason and reason != "dry run"+ ]++def show_workspace_completion(*,selected: list[Any],@@ -364,6 +403,7 @@ def show_workspace_completion(index_only: bool,provider: Any,docs_outcomes: dict[str, tuple[int, str | None]],+ run_mode: str = "standard",) -> None:"""Render the workspace completion panel + per-repo docs status."""metrics: list[tuple[str, str]] = [@@ -379,18 +419,7 @@ def show_workspace_completion(if errors:metrics.append(("Errors", f"{len(errors)} repos failed"))- if index_only or provider is None:- next_steps = [- ("repowise serve", "open the workspace dashboard at http://localhost:3000"),- ("repowise status --workspace", "show workspace status"),- ("repowise generate <repo>", "write a repo's documentation with a model"),- ]- else:- next_steps = [- ("repowise serve", "open the workspace dashboard at http://localhost:3000"),- ("repowise status --workspace", "show workspace status"),- ("repowise search <query>", "search across all indexed repos"),- ]+ next_steps = _workspace_next_steps(run_mode, index_only or provider is None)console.print()console.print(@@ -401,7 +430,7 @@ def show_workspace_completion(# Honest docs status — print a per-repo summary listing exactly which# repos generated pages and which were skipped, so the user never has# to discover empty Docs/Overview in the web UI on their own.- docs_skipped = [(alias, reason) for alias, (count, reason) in docs_outcomes.items() if reason]+ docs_skipped = _upgradable_skips(docs_outcomes)if docs_outcomes:console.print("[bold]Documentation[/bold]")for alias, (count, reason) in docs_outcomes.items():@@ -415,7 +444,7 @@ def show_workspace_completion(first = docs_skipped[0][0]console.print()console.print(- f" Run [bold]repowise update --repo {first} --docs[/bold] "+ f" Run [bold]{fast_to_full_command(first)}[/bold] ""to build documentation for a skipped repo.")console.print()diff --git a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.pyindex 9d0c0b1f8..186146969 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py@@ -71,6 +71,7 @@ from repowise.core.ci.markdown import pluralfrom repowise.core.decision_lanes import record_decision_lanesfrom repowise.core.docs_mode import docs_mode_state_fieldsfrom repowise.core.generation.styles import DEFAULT_STYLE+from repowise.core.index_scope import fast_to_full_commandfrom ._exit import COST_UNCONFIRMED_BUILT, exit_on_gapsfrom ._ingest import structural_generation_config@@ -517,8 +518,8 @@ def _generate_repo_with_model(ctx.gaps.append(f"{repo.alias}: {COST_UNCONFIRMED_BUILT}")console.print(" [dim]Building this repo's documentation from code instead. Run "- "[bold]repowise update --repo "- f"{repo.alias} --full[/bold] to write it with a model later.[/dim]"+ f"[bold]{fast_to_full_command(repo.alias)}[/bold] to write it with a model "+ "later.[/dim]")_render_repo_from_templates(repo, ctx, index, docs)except Exception as gen_exc:@@ -912,6 +913,7 @@ def _workspace_init(index_only=answers.index_only,provider=provider,docs_outcomes=totals.docs_outcomes,+ run_mode=run_mode,)if not dry_run:_offer_workspace_hooks(diff --git a/packages/cli/src/repowise/cli/commands/reindex_cmd.py b/packages/cli/src/repowise/cli/commands/reindex_cmd.pyindex 8de7c7d65..19a63e7aa 100644--- a/packages/cli/src/repowise/cli/commands/reindex_cmd.py+++ b/packages/cli/src/repowise/cli/commands/reindex_cmd.py@@ -48,9 +48,29 @@ def reindex_command(path: str | None, embedder: str, batch_size: int) -> None:load_dotenv(repo_path)+ index_only = _index_only_message(repo_path)+ if index_only:+ console.print(index_only)+ returnrun_async(_reindex(repo_path, embedder, batch_size))+def _index_only_message(repo_path) -> str | None:+ """What to run first on an Index only repo, which has no documentation to embed."""+ from repowise.cli.helpers import load_state+ from repowise.core.docs_mode import resolve_docs_mode+ from repowise.core.index_scope import FAST_TO_FULL_COMMAND++ state = load_state(repo_path)+ if not state or resolve_docs_mode(state) != "none":+ return None+ return (+ "[yellow]This repo is Index only: it has no documentation to embed yet.[/yellow] "+ f"Run [bold]{FAST_TO_FULL_COMMAND}[/bold] to build it from code (no key needed), "+ "then [bold]repowise reindex[/bold]."+ )++async def _reindex(repo_path, embedder_name: str, batch_size: int) -> None:from pathlib import Pathdiff --git a/packages/cli/src/repowise/cli/commands/status_cmd.py b/packages/cli/src/repowise/cli/commands/status_cmd.pyindex b3bec043d..242182d1a 100644--- a/packages/cli/src/repowise/cli/commands/status_cmd.py+++ b/packages/cli/src/repowise/cli/commands/status_cmd.py@@ -33,7 +33,7 @@ from repowise.cli.ui.mode_names import (from repowise.cli.ui.result_panels import keyless_upgrade_notefrom repowise.core.decision_lanes import lanes_label, pending_decision_lanesfrom repowise.core.docs_mode import resolve_docs_mode-from repowise.core.index_scope import resolve_index_scope+from repowise.core.index_scope import fast_to_full_command, resolve_index_scope, upgrade_command# ---------------------------------------------------------------------------# Workspace status@@ -629,8 +629,8 @@ def _workspace_status(target: CommandTarget, fmt: str = "table") -> None:)first = no_docs[0]console.print(- f" Run [bold]repowise update --repo {first} --docs[/bold] "- "to have a model write it (requires an LLM provider)."+ f" Run [bold]{fast_to_full_command(first)}[/bold] "+ "to build them (no key needed; a configured model writes them).")@@ -718,6 +718,7 @@ def status_command(path: str | None, workspace: bool, no_workspace: bool, fmt: s"health": _query_health(repo_path),"next_actions": _next_actions_summary(_load_actions(repo_path) if has_db else None),"index_scope": scope,+ "upgrade_command": upgrade_command(scope),"decision_lanes_pending": list(pending_lanes),})@@ -798,6 +799,11 @@ def status_command(path: str | None, workspace: bool, no_workspace: bool, fmt: sscope["search"]["semantic"] == "available", scope["search"]["next_command"])console.print(f"[dim]{note}[/dim]")+ elif upgrade_command(scope):+ console.print(+ f"[dim]Index only: no documentation yet. {upgrade_command(scope)} builds it from "+ "code and fills in the full git history (no key needed).[/dim]"+ )if not has_db:console.print(f"[yellow]Database not found at {db_path}.[/yellow]")diff --git a/packages/cli/src/repowise/cli/commands/update_cmd/command.py b/packages/cli/src/repowise/cli/commands/update_cmd/command.pyindex b195d69cf..73f36dc7c 100644--- a/packages/cli/src/repowise/cli/commands/update_cmd/command.py+++ b/packages/cli/src/repowise/cli/commands/update_cmd/command.py@@ -358,12 +358,12 @@ def _surface_reindex_recommendation(repo_path, verdict, *, emitter: Any, dry_runis_flag=True,default=False,help=(- "Upgrade an index with a model: backfill the git tier ESSENTIAL -> "- "FULL if it was built with `--mode fast`, and write the subsystem pages "- "with a provider on a wiki that has none yet. Incremental: reuses the "- "persisted graph, records resumable stage progress, reuses persisted "- "provider/embedder choices, and previews model cost before generation. "- "Single-repo only."+ "Take an Index only (`--mode fast`) repo to a full index: backfill the "+ "full git history and build the documentation. Works without a key: with "+ "no model configured the documentation is built from code (no model calls, "+ "no spend); with one, the model writes it after a cost preview. Reuses the "+ "persisted graph and resumes from the last completed stage. One repo at a "+ "time (in a workspace, pass --repo <alias>)."),)@click.option(@@ -506,8 +506,9 @@ def _render_full_upgrade_dry_run(f" Persisted scope: [cyan]{scope_line(scope)}[/cyan]")console.print(- " The whole-repository documentation would be written after an explicit cost preview; "- "completed stages are resumable. No changes made."+ " Documentation for the whole repository: written by the model after a cost "+ "preview, or built from code when no model is configured. Completed stages "+ "are resumable. No changes made.")@@ -691,10 +692,14 @@ def _resolve_target(opts: UpdateOptions):def _update_workspace_target(opts: UpdateOptions, run: UpdateRun, target) -> UpdateOutcome:+ if opts.full and opts.repo_alias:+ entry = target.ws_config.get_repo(opts.repo_alias)+ run.repo_path = (target.ws_root / entry.path).resolve()+ return _full_upgrade(opts, run)if opts.full:raise click.ClickException(- "--full is single-repo only. Run it inside a specific repo "- "(or pass --no-workspace / --repo <alias>)."+ "--full upgrades one repo at a time. Run it inside that repo, or pass "+ "--repo <alias>.")with _errors_reported(run):_workspace_update(diff --git a/packages/cli/src/repowise/cli/commands/update_cmd/persistence.py b/packages/cli/src/repowise/cli/commands/update_cmd/persistence.pyindex 645011f25..6e6fa0412 100644--- a/packages/cli/src/repowise/cli/commands/update_cmd/persistence.py+++ b/packages/cli/src/repowise/cli/commands/update_cmd/persistence.py@@ -731,6 +731,8 @@ def _persist_index_only_update(stamp_file_page_scope(repo_path, new_state, parsed_files, graph_builder, git_meta_map)save_state(repo_path, new_state)elapsed = time.monotonic() - start+ from repowise.core.index_scope import upgrade_command+from .reporting import show_index_only_completionshow_index_only_completion(@@ -743,6 +745,7 @@ def _persist_index_only_update(pages_rendered=pages_rendered,template_wiki=template_wiki,changed_paths=changed_paths,+ upgrade_command=upgrade_command(new_state.get("index_scope")),)diff --git a/packages/cli/src/repowise/cli/commands/update_cmd/reporting.py b/packages/cli/src/repowise/cli/commands/update_cmd/reporting.pyindex 23ca19279..e5304db00 100644--- a/packages/cli/src/repowise/cli/commands/update_cmd/reporting.py+++ b/packages/cli/src/repowise/cli/commands/update_cmd/reporting.py@@ -327,6 +327,7 @@ def show_index_only_completion(pages_rendered: int = 0,template_wiki: bool = False,changed_paths: list[str] | None = None,+ upgrade_command: str | None = None,) -> None:"""Render the completion panel for an index-only update (no LLM regen).@@ -358,6 +359,11 @@ def show_index_only_completion(next_steps.append(("repowise generate", "write the documentation with a model (needs a key)"))+ elif upgrade_command:+ # Index only: there are no docs to regenerate.+ next_steps.append(+ (upgrade_command, "build documentation from code and the full git history (no key)")+ )else:next_steps.append(("repowise update --docs", "regenerate docs for the changed files"))console.print()diff --git a/packages/cli/src/repowise/cli/commands/upgrade_flow.py b/packages/cli/src/repowise/cli/commands/upgrade_flow.pyindex 58b579e4d..1e025a9b5 100644--- a/packages/cli/src/repowise/cli/commands/upgrade_flow.py+++ b/packages/cli/src/repowise/cli/commands/upgrade_flow.py@@ -39,6 +39,13 @@ from repowise.cli.commands.decision_lanes import (still_pending_after,with_lane_plan,)+from repowise.cli.commands.upgrade_state import (+ _finish_upgrade_state,+ _mark_transition,+ _start_transition,+ _unpack_upgrade_result,+ _upgrade_checkpoint,+)from repowise.cli.helpers import (console,get_head_commit,@@ -49,14 +56,9 @@ from repowise.cli.helpers import (resolve_reasoning,run_async,save_state,- stamp_offered_slots,)-from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION-from repowise.core.decision_lanes import plan_decision_lanes, set_pending_decision_lanes-from repowise.core.docs_mode import docs_mode_state_fields-from repowise.core.index_scope import file_page_scope, stamp_index_scope-from repowise.core.ingestion.git_indexer import GIT_HISTORY_VERSION, GIT_HISTORY_VERSION_KEY-from repowise.core.ingestion.git_indexer._constants import _DEFAULT_COMMIT_LIMIT+from repowise.core.decision_lanes import plan_decision_lanes+from repowise.core.index_scope import FAST_TO_FULL_COMMAND, file_page_scopefrom repowise.core.update_lock import release_update_lock, try_acquire_update_lock@@ -68,8 +70,8 @@ def _gate_cost(repo_path: Path,*,yes: bool,- decisions: Any = None,embedder: str = "mock",+ decisions: Any = None,) -> None:"""Print the estimated spend, embedding included, and confirm past the gate.@@ -327,20 +329,31 @@ async def _run_upgrade(parsed_files=parsed_files,source_map=source_map,)- lane_plan = plan_decision_lanes(load_state(repo_path), repo_path, lane_inputs)+ # A keyless upgrade has no model for them, so they stay pending.+ lane_plan = (+ None+ if getattr(config, "deterministic", False)+ else plan_decision_lanes(load_state(repo_path), repo_path, lane_inputs)+ )# Show the bill before running it, as init does: the user reaching for- # `--full` has never been shown a cost for this repo.- _gate_cost(- parsed_files,- graph_builder,- config,- provider,- repo_path,- yes=yes,- decisions=lane_plan,- embedder=embedder_name or "mock",+ # `--full` has never been shown a cost for this repo. Documentation built+ # from code with a free embedder has no bill to show.+ free_run = getattr(config, "deterministic", False) and (embedder_name or "mock") in (+ "mock",+ "ollama",)+ if not free_run:+ _gate_cost(+ parsed_files,+ graph_builder,+ config,+ provider,+ repo_path,+ yes=yes,+ embedder=embedder_name or "mock",+ decisions=lane_plan,+ )# 5. Generate the docs the fast index skipped, embedding as we go.cost_tracker = _upgrade_cost_tracker(sf, repo_id)@@ -717,22 +730,6 @@ def _report_placeholders(count: int, reasons: list[str]) -> None:)-#: The resumable stages of a full upgrade, in run order.-_UPGRADE_STAGES = ["git_backfill", "generation", "search", "health"]---def _completed_stages(state: dict[str, Any]) -> list[str]:- return list(- state.get("full_upgrade", {}).get("completed_stages", [])- if isinstance(state.get("full_upgrade"), dict)- else []- )---def _next_stage(stages: list[str]) -> str:- return next((item for item in _UPGRADE_STAGES if item not in stages), "finalize")--def upgrade_to_full(repo_path: Path,*,@@ -742,12 +739,13 @@ def upgrade_to_full(concurrency: int,yes: bool = False,) -> None:- """Write the repo's wiki with a model, reusing the persisted graph.+ """Take the repo to a full index, reusing the persisted graph.- Two repos arrive here. A ``--mode fast`` index has no pages and an- ESSENTIAL git tier, both of which this fills in. An ``--index-only`` repo- has a full git tier and a wiki rendered from templates, and this replaces- those pages with written ones.+ A ``--mode fast`` index has no pages and an ESSENTIAL git tier, both of+ which this fills in. An index-only repo has a full git tier and+ documentation built from code, which a model run replaces with written+ pages. With no model configured the documentation is built from code: no+ model calls and no spend."""from repowise.cli.ui import load_dotenvfrom repowise.core.generation import GenerationConfig@@ -763,20 +761,12 @@ def upgrade_to_full(head = get_head_commit(repo_path)start = time.monotonic()- # Provider is required — the fast index made no LLM calls, so the repo may- # not have one configured yet. resolve_provider surfaces a clear error.- provider = resolve_provider(provider_name, model, repo_path=repo_path)- persisted_provider = state.get("provider") or cfg.get("provider")- persisted_model = state.get("model") or cfg.get("model")- provider_reused = (- provider_name is None- and model is None- and persisted_provider == provider.provider_name- and persisted_model == provider.model_name- )+ provider = _resolve_upgrade_provider(provider_name, model, repo_path, state)+ keyless = provider is Noneconfig = GenerationConfig.from_repo_config(cfg,+ deterministic=keyless,max_concurrency=concurrency,language=cfg.get("language", "en"),reasoning=resolve_reasoning(reasoning, cfg),@@ -790,12 +780,8 @@ def upgrade_to_full(commit_limit = cfg.get("commit_limit")follow_renames = bool(cfg.get("follow_renames", False))- console.print(f"[bold]repowise update --full[/bold] — upgrading {repo_path}")- console.print(- f"Provider: [cyan]{provider.provider_name}[/cyan] / "- f"[cyan]{provider.model_name}[/cyan]. This generates docs for the whole repo."- )- embedder_name = _upgrade_embedder_name(cfg)+ _announce_upgrade(repo_path, provider)+ embedder_name = _keyless_embedder_name(cfg) if keyless else _upgrade_embedder_name(cfg)# The same single-flight lock as an incremental update: a concurrent# `repowise update` must not race this run's save_state. If another update@@ -813,26 +799,24 @@ def upgrade_to_full(# Released when this function returns (success, cost-gate Abort or failure),# not at process exit.try:- provider_block = {- "name": provider.provider_name,- "model": provider.model_name,- "embedder": embedder_name,- "reused": provider_reused,- "model_cost_possible": True,- }- _start_transition(repo_path, state, cfg, provider, embedder_name, provider_block)+ provider_block = _provider_block(+ provider,+ embedder_name,+ reused=provider_name is None and model is None and _persisted(provider, state, cfg),+ )+ _start_transition(repo_path, state, cfg, provider_block)try:upgrade_result = run_async(_run_upgrade(repo_path,- provider,+ _template_provider() if keyless else provider,config,exclude_patterns=exclude_patterns,commit_limit=commit_limit,follow_renames=follow_renames,embedder_name=embedder_name,yes=yes,- checkpoint=_upgrade_checkpoint(repo_path, cfg, provider, embedder_name),+ checkpoint=_upgrade_checkpoint(repo_path, cfg, provider_block),))generated_pages, total_pages, outcome = _unpack_upgrade_result(upgrade_result, cfg)@@ -859,7 +843,6 @@ def upgrade_to_full(state,cfg,head=head,- provider=provider,config=config,commit_limit=commit_limit,total_pages=total_pages,@@ -874,11 +857,76 @@ def upgrade_to_full(# passing `embedder` alone does not.save_config_partial(repo_path, embedder=embedder_name, embedding_model=None)- _report_upgrade(time.monotonic() - start, generated_pages, outcome)+ _report_upgrade(time.monotonic() - start, generated_pages, outcome, keyless=keyless)finally:release_update_lock(repo_path)+def _resolve_upgrade_provider(+ provider_name: str | None, model: str | None, repo_path: Path, state: dict[str, Any]+) -> Any | None:+ """The model to write with, or None to build the documentation from code.++ None only when nothing names a model and none is configured anywhere. A repo+ whose documentation a model wrote keeps the error instead: building from+ code would replace that writing.+ """+ from repowise.core.docs_mode import resolve_docs_mode++ try:+ return resolve_provider(provider_name, model, repo_path=repo_path)+ except click.ClickException as exc:+ unconfigured = getattr(exc, "reason", None) == "no_provider_configured"+ if provider_name is not None or model is not None or not unconfigured:+ raise+ if resolve_docs_mode(state) == "llm":+ exc.message = (+ "This repo's documentation was written by a model, and no model is "+ f"configured to rewrite it. {exc.message}"+ )+ raise+ return None+++def _announce_upgrade(repo_path: Path, provider: Any | None) -> None:+ console.print(f"[bold]{FAST_TO_FULL_COMMAND}[/bold]: upgrading {repo_path}")+ if provider is None:+ console.print(+ "No model configured: documentation is built from code "+ "[dim](no model calls, no spend)[/dim]."+ )+ return+ console.print(+ f"Provider: [cyan]{provider.provider_name}[/cyan] / "+ f"[cyan]{provider.model_name}[/cyan]. This writes documentation for the whole repo."+ )+++def _persisted(provider: Any | None, state: dict[str, Any], cfg: dict[str, Any]) -> bool:+ """Whether *provider* is the one this repo already recorded."""+ return provider is not None and (+ (state.get("provider") or cfg.get("provider")) == provider.provider_name+ and (state.get("model") or cfg.get("model")) == provider.model_name+ )+++def _provider_block(provider: Any | None, embedder_name: str | None, *, reused: bool) -> dict:+ """The scope's provider record; a keyless run names no provider and no cost."""+ return {+ "name": provider.provider_name if provider is not None else None,+ "model": provider.model_name if provider is not None else None,+ "embedder": embedder_name,+ "reused": reused,+ "model_cost_possible": provider is not None,+ }+++def _template_provider() -> Any:+ from repowise.core.providers.llm.template import TemplateProvider++ return TemplateProvider()++def _upgrade_embedder_name(cfg: dict[str, Any]) -> str | None:"""The embedder to write with: re-resolved when the index recorded the mock.@@ -893,156 +941,22 @@ def _upgrade_embedder_name(cfg: dict[str, Any]) -> str | None:return embedder_name-def _start_transition(- repo_path: Path,- state: dict[str, Any],- cfg: dict[str, Any],- provider: Any,- embedder_name: str | None,- provider_block: dict[str, Any],-) -> None:- """Record the running transition before any backfill or model work.+def _keyless_embedder_name(cfg: dict[str, Any]) -> str:+ """The embedder a keyless upgrade uses: the one the user chose, else the free mock."""+ from repowise.cli.providers import keyless_run_embedder- A killed process then leaves an honest resumable transition while the prior- index_scope keeps describing the usable index.- """- completed_stages = _completed_stages(state)- state["full_upgrade"] = {- "status": "running",- "retryable": True,- "completed_stages": completed_stages,- "next_stage": _next_stage(completed_stages),- "provider": provider.provider_name,- "model": provider.model_name,- "embedder": embedder_name,- }- stamp_index_scope(state, cfg, upgrade=state["full_upgrade"], provider=dict(provider_block))- save_state(repo_path, state)---def _upgrade_checkpoint(- repo_path: Path, cfg: dict[str, Any], provider: Any, embedder_name: str | None-) -> Any:- """A callback that records each completed stage in state.json."""-- def _checkpoint(stage: str, **fields: Any) -> None:- current = load_state(repo_path)- stages = _completed_stages(current)- if stage not in stages:- stages.append(stage)- current["full_upgrade"] = {- "status": "running",- "retryable": True,- "completed_stages": stages,- "next_stage": _next_stage(stages),- "provider": provider.provider_name,- "model": provider.model_name,- "embedder": embedder_name,- }- if fields.get("git_history_coverage") is not None:- current["git_history_coverage"] = fields["git_history_coverage"]- stamp_index_scope(current, cfg, upgrade=current["full_upgrade"])- save_state(repo_path, current)-- return _checkpoint---def _mark_transition(repo_path: Path, cfg: dict[str, Any], **updates: Any) -> None:- """Update the recorded transition after the upgrade stopped early."""- current = load_state(repo_path)- transition = current.get("full_upgrade", {})- transition.update(**updates)- current["full_upgrade"] = transition- stamp_index_scope(current, cfg, upgrade=transition)- save_state(repo_path, current)---def _unpack_upgrade_result(- upgrade_result: tuple[Any, ...], cfg: dict[str, Any]-) -> tuple[list[Any], int, dict[str, Any]]:- """Pages, page count and outcome; a 2-tuple from a wrapper gets an unknown outcome."""- if len(upgrade_result) != 2:- generated_pages, total_pages, outcome = upgrade_result- return generated_pages, total_pages, outcome- generated_pages, total_pages = upgrade_result- outcome = {- "git_history_coverage": None,- "file_pages": {- "configured_cap": resolve_max_file_pages(config=cfg),- "effective_cap": None,- "eligible": None,- "generated": None,- "omitted": None,- },- "search": {- "full_text": "unknown",- "semantic": "unknown",- "next_command": None,- },- "embedding_error": None,- }- return generated_pages, total_pages, outcome+ embedder_name, stated = keyless_run_embedder(cfg.get("embedder"))+ console.print(f"Embedder: [cyan]{stated}[/cyan].")+ return embedder_name-def _finish_upgrade_state(- state: dict[str, Any],- cfg: dict[str, Any],- *,- head: str | None,- provider: Any,- config: Any,- commit_limit: Any,- total_pages: int,- outcome: dict[str, Any],- provider_block: dict[str, Any],+def _report_upgrade(+ elapsed: float, generated_pages: list[Any], outcome: dict[str, Any], *, keyless: bool = False) -> None:- """Flip the persisted state to full, so later updates take the normal LLM path."""- state["last_sync_commit"] = head- state.update(docs_mode_state_fields("llm"))- state["git_tier"] = "full"- state["run_mode"] = "standard"- if outcome["git_history_coverage"] is not None:- state["git_history_coverage"] = outcome["git_history_coverage"]- state["total_pages"] = total_pages- # Record who wrote the pages, or `status` reports them as unknown.- state["provider"] = provider.provider_name- state["model"] = provider.model_name- # Every onboarding slot was evaluated against whole-repo signals, so the- # missing-slot notice has nothing left to report.- stamp_offered_slots(state, enabled=config.enable_onboarding)- if outcome.get("decision_lanes_pending") is not None:- set_pending_decision_lanes(state, outcome["decision_lanes_pending"])- # Health and the git backfill ran over the whole repo under the current- # analyzer and history rules, so the next update need not redo them.- state["health_analyzer_version"] = HEALTH_ANALYZER_VERSION- state[GIT_HISTORY_VERSION_KEY] = GIT_HISTORY_VERSION- state["full_upgrade"] = {- "status": "complete",- "retryable": False,- "completed_stages": [*_UPGRADE_STAGES, "finalize"],- "next_stage": None,- }- stamp_index_scope(- state,- cfg,- run_mode="standard",- content_provenance="model",- git_tier="full",- git_commit_cap=(commit_limit if isinstance(commit_limit, int) else _DEFAULT_COMMIT_LIMIT),- git_history_coverage=outcome["git_history_coverage"],- file_pages=outcome["file_pages"],- test_run=False,- analysis={"unavailable": [], "skipped": []},- upgrade=state["full_upgrade"],- provider=dict(provider_block),- search=outcome["search"],- )---def _report_upgrade(elapsed: float, generated_pages: list[Any], outcome: dict[str, Any]) -> None:+ how = "built from code" if keyless else "written"console.print(- f"[bold green]Upgrade complete[/bold green] in {elapsed:.1f}s — "- f"{len(generated_pages)} pages generated, git tier now FULL."+ f"[bold green]Upgrade complete[/bold green] in {elapsed:.1f} s: "+ f"{len(generated_pages)} documentation pages {how}, full git history.")_report_placeholders(outcome.get("stub_fallbacks", 0), outcome.get("stub_reasons", []))if outcome["search"]["semantic"] != "available":diff --git a/packages/cli/src/repowise/cli/commands/upgrade_state.py b/packages/cli/src/repowise/cli/commands/upgrade_state.pynew file mode 100644index 000000000..6d86de82c--- /dev/null+++ b/packages/cli/src/repowise/cli/commands/upgrade_state.py@@ -0,0 +1,186 @@+"""state.json bookkeeping for ``repowise update --full``.++The resumable transition (which stages finished, what runs next) and the final+flip to a full index. Kept apart from :mod:`upgrade_flow`, which does the work.+"""++from __future__ import annotations++from pathlib import Path+from typing import Any++from repowise.cli.helpers import (+ load_state,+ resolve_max_file_pages,+ save_state,+ stamp_offered_slots,+)+from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION+from repowise.core.decision_lanes import set_pending_decision_lanes+from repowise.core.docs_mode import docs_mode_state_fields+from repowise.core.index_scope import stamp_index_scope+from repowise.core.ingestion.git_indexer import GIT_HISTORY_VERSION, GIT_HISTORY_VERSION_KEY+from repowise.core.ingestion.git_indexer._constants import _DEFAULT_COMMIT_LIMIT++#: The resumable stages of a full upgrade, in run order.+_UPGRADE_STAGES = ["git_backfill", "generation", "search", "health"]+++def _completed_stages(state: dict[str, Any]) -> list[str]:+ return list(+ state.get("full_upgrade", {}).get("completed_stages", [])+ if isinstance(state.get("full_upgrade"), dict)+ else []+ )+++def _next_stage(stages: list[str]) -> str:+ return next((item for item in _UPGRADE_STAGES if item not in stages), "finalize")+++def _running(stages: list[str], provider_block: dict[str, Any]) -> dict[str, Any]:+ """The transition record while the upgrade runs."""+ return {+ "status": "running",+ "retryable": True,+ "completed_stages": stages,+ "next_stage": _next_stage(stages),+ "provider": provider_block.get("name"),+ "model": provider_block.get("model"),+ "embedder": provider_block.get("embedder"),+ }+++def _start_transition(+ repo_path: Path,+ state: dict[str, Any],+ cfg: dict[str, Any],+ provider_block: dict[str, Any],+) -> None:+ """Record the running transition before any backfill or model work.++ A killed process then leaves an honest resumable transition while the prior+ index_scope keeps describing the usable index.+ """+ state["full_upgrade"] = _running(_completed_stages(state), provider_block)+ stamp_index_scope(state, cfg, upgrade=state["full_upgrade"], provider=dict(provider_block))+ save_state(repo_path, state)+++def _upgrade_checkpoint(repo_path: Path, cfg: dict[str, Any], provider_block: dict[str, Any]) -> Any:+ """A callback that records each completed stage in state.json."""++ def _checkpoint(stage: str, **fields: Any) -> None:+ current = load_state(repo_path)+ stages = _completed_stages(current)+ if stage not in stages:+ stages.append(stage)+ current["full_upgrade"] = _running(stages, provider_block)+ if fields.get("git_history_coverage") is not None:+ current["git_history_coverage"] = fields["git_history_coverage"]+ stamp_index_scope(current, cfg, upgrade=current["full_upgrade"])+ save_state(repo_path, current)++ return _checkpoint+++def _mark_transition(repo_path: Path, cfg: dict[str, Any], **updates: Any) -> None:+ """Update the recorded transition after the upgrade stopped early."""+ current = load_state(repo_path)+ transition = current.get("full_upgrade", {})+ transition.update(**updates)+ current["full_upgrade"] = transition+ stamp_index_scope(current, cfg, upgrade=transition)+ save_state(repo_path, current)+++def _unpack_upgrade_result(+ upgrade_result: tuple[Any, ...], cfg: dict[str, Any]+) -> tuple[list[Any], int, dict[str, Any]]:+ """Pages, page count and outcome; a 2-tuple from a wrapper gets an unknown outcome."""+ if len(upgrade_result) != 2:+ generated_pages, total_pages, outcome = upgrade_result+ return generated_pages, total_pages, outcome+ generated_pages, total_pages = upgrade_result+ outcome = {+ "git_history_coverage": None,+ "file_pages": {+ "configured_cap": resolve_max_file_pages(config=cfg),+ "effective_cap": None,+ "eligible": None,+ "generated": None,+ "omitted": None,+ },+ "search": {+ "full_text": "unknown",+ "semantic": "unknown",+ "next_command": None,+ },+ "embedding_error": None,+ }+ return generated_pages, total_pages, outcome+++def _finish_upgrade_state(+ state: dict[str, Any],+ cfg: dict[str, Any],+ *,+ head: str | None,+ config: Any,+ commit_limit: Any,+ total_pages: int,+ outcome: dict[str, Any],+ provider_block: dict[str, Any],+) -> None:+ """Flip the persisted state to full.++ A model run records ``llm`` so later updates take the model path. A keyless+ run records documentation built from code and no provider, as a keyless+ ``init`` does.+ """+ written = bool(provider_block.get("name"))+ state["last_sync_commit"] = head+ state.update(docs_mode_state_fields("llm" if written else "deterministic"))+ state["git_tier"] = "full"+ state["run_mode"] = "standard"+ if outcome["git_history_coverage"] is not None:+ state["git_history_coverage"] = outcome["git_history_coverage"]+ state["total_pages"] = total_pages+ if written:+ # Record who wrote the pages, or `status` reports them as unknown.+ state["provider"] = provider_block["name"]+ state["model"] = provider_block["model"]+ else:+ # No model wrote these pages, whatever an earlier run recorded.+ state.pop("provider", None)+ state.pop("model", None)+ # Every onboarding slot was evaluated against whole-repo signals, so the+ # missing-slot notice has nothing left to report.+ stamp_offered_slots(state, enabled=config.enable_onboarding)+ if outcome.get("decision_lanes_pending") is not None:+ set_pending_decision_lanes(state, outcome["decision_lanes_pending"])+ # Health and the git backfill ran over the whole repo under the current+ # analyzer and history rules, so the next update need not redo them.+ state["health_analyzer_version"] = HEALTH_ANALYZER_VERSION+ state[GIT_HISTORY_VERSION_KEY] = GIT_HISTORY_VERSION+ state["full_upgrade"] = {+ "status": "complete",+ "retryable": False,+ "completed_stages": [*_UPGRADE_STAGES, "finalize"],+ "next_stage": None,+ }+ stamp_index_scope(+ state,+ cfg,+ run_mode="standard",+ content_provenance="model" if written else "template",+ git_tier="full",+ git_commit_cap=(commit_limit if isinstance(commit_limit, int) else _DEFAULT_COMMIT_LIMIT),+ git_history_coverage=outcome["git_history_coverage"],+ file_pages=outcome["file_pages"],+ test_run=False,+ analysis={"unavailable": [], "skipped": []},+ upgrade=state["full_upgrade"],+ provider=dict(provider_block),+ search=outcome["search"],+ )diff --git a/packages/cli/src/repowise/cli/commands/workspace_cmd/_index.py b/packages/cli/src/repowise/cli/commands/workspace_cmd/_index.pyindex 6b83ce3dc..1af8a98a3 100644--- a/packages/cli/src/repowise/cli/commands/workspace_cmd/_index.py+++ b/packages/cli/src/repowise/cli/commands/workspace_cmd/_index.py@@ -15,6 +15,7 @@ from repowise.cli.helpers import (warn,)from repowise.core.docs_mode import docs_mode_state_fields, resolve_docs_mode+from repowise.core.index_scope import fast_to_full_commandif TYPE_CHECKING:from repowise.core.workspace.config import WorkspaceConfig@@ -212,7 +213,7 @@ def _run_index_for_repo(reason = docs_skip_reason or "docs disabled"console.print(f"\n[yellow]Note:[/yellow] '{alias}' indexed without docs ({reason}).")console.print(- f" Run [bold]repowise update --repo {alias} --docs[/bold] to generate documentation."+ f" Run [bold]{fast_to_full_command(alias)}[/bold] to build its documentation.")diff --git a/packages/cli/src/repowise/cli/providers/__init__.py b/packages/cli/src/repowise/cli/providers/__init__.pyindex 8f0fa69a5..2ad0be11d 100644--- a/packages/cli/src/repowise/cli/providers/__init__.py+++ b/packages/cli/src/repowise/cli/providers/__init__.py@@ -16,6 +16,7 @@ from repowise.cli.providers.cost_tracking import (from repowise.cli.providers.embedders import (build_embedder,embedder_was_requested,+ keyless_run_embedder,model_run_embedder,pin_names_an_embedder,resolve_embedder,@@ -41,6 +42,7 @@ __all__ = ["embedder_was_requested","existing_vector_dim","flush_cost_tracker",+ "keyless_run_embedder","make_cost_tracker","model_run_embedder","pin_names_an_embedder",diff --git a/packages/cli/src/repowise/cli/providers/embedders.py b/packages/cli/src/repowise/cli/providers/embedders.pyindex 9939db6f1..fcb8eeb72 100644--- a/packages/cli/src/repowise/cli/providers/embedders.py+++ b/packages/cli/src/repowise/cli/providers/embedders.py@@ -78,6 +78,24 @@ def model_run_embedder(pinned: str | None) -> tuple[str | None, str, bool]:return name, f"{stated} ({reason})", upgraded+def keyless_run_embedder(pinned: str | None) -> tuple[str, str]:+ """``(name, stated)`` for a run with no model, which promises no spend.++ An embedder the user chose (a real pin, ``REPOWISE_EMBEDDER``) is kept and+ named as such; one only inferred from a key falls back to the mock.+ """+ if pin_names_an_embedder(pinned):+ name, reason = str(pinned).strip(), "pinned in .repowise/config.yaml"+ else:+ name, reason = resolve_embedder_choice(None)+ kept = template_run_embedder(name, embedder_was_requested(None, pinned))+ if kept != name:+ name, reason = kept, "keyless run"+ if name == "mock":+ reason += ", semantic search off"+ return name, f"{name} ({reason})"++def semantic_search_command(repo_path: Any = None, used: str | None = None) -> str:"""The one command that turns semantic search on for *repo_path* here.diff --git a/packages/cli/src/repowise/cli/ui/result_panels.py b/packages/cli/src/repowise/cli/ui/result_panels.pyindex b0deabed0..5985a2b32 100644--- a/packages/cli/src/repowise/cli/ui/result_panels.py+++ b/packages/cli/src/repowise/cli/ui/result_panels.py@@ -116,7 +116,11 @@ def build_contextual_next_steps(steps.append(("repowise mcp .", "connect an MCP client (Cursor, Codex, Claude Code)"))elif fast_mode:# Fast index: graph + essential git, no docs. Point at the full result.- steps.append(("repowise init", "add full git history and documentation"))+ from repowise.core.index_scope import FAST_TO_FULL_COMMAND++ steps.append(+ (FAST_TO_FULL_COMMAND, "build documentation from code and the full git history (no key)")+ )elif index_only:# `generate` is the scoped, cost-gated upgrade path — a coverage, a# directory or one page at a time, each behind an estimate — not thediff --git a/packages/core/src/repowise/core/index_scope.py b/packages/core/src/repowise/core/index_scope.pyindex 9f160966f..af88fbc80 100644--- a/packages/core/src/repowise/core/index_scope.py+++ b/packages/core/src/repowise/core/index_scope.py@@ -18,6 +18,23 @@ from typing import AnyINDEX_SCOPE_VERSION = 1+#: The one command that takes an Index only repo to full git history and+#: documentation. It needs no key: without a model the documentation is built+#: from code.+FAST_TO_FULL_COMMAND = "repowise update --full"+++def fast_to_full_command(repo_alias: str | None = None) -> str:+ """:data:`FAST_TO_FULL_COMMAND`, aimed at one workspace repo when *repo_alias* is set."""+ return f"repowise update --repo {repo_alias} --full" if repo_alias else FAST_TO_FULL_COMMAND+++def upgrade_command(scope: Mapping[str, Any] | None) -> str | None:+ """The fast-to-full command when *scope* is Index only (no documentation), else None."""+ if isinstance(scope, Mapping) and scope.get("content_provenance") == "none":+ return FAST_TO_FULL_COMMAND+ return None+# repo dir -> (identity of the files it was built from, scope). Every MCP# response embeds this, so without a cache each one re-reads state.json and# re-parses config.yaml. Keyed on mtime+size so an index rebuild invalidates it.@@ -409,6 +426,10 @@ def compact_index_scope(compact["degraded_analyses_total"] = len(unavailable)compact["degraded_analyses_emitted"] = len(shown)compact["degraded_analyses_reduced_reason"] = "compact_projection"+ # Only an Index only repo carries it, so no other response grows.+ command = upgrade_command(scope)+ if command:+ compact["upgrade_command"] = commandreturn compactdiff --git a/packages/server/src/repowise/server/mcp_server/_meta.py b/packages/server/src/repowise/server/mcp_server/_meta.pyindex d6570bcbd..cae392fa6 100644--- a/packages/server/src/repowise/server/mcp_server/_meta.py+++ b/packages/server/src/repowise/server/mcp_server/_meta.py@@ -854,8 +854,8 @@ def keyless_note_meta() -> dict[str, Any]:_state._keyless_note_announced = Truereturn {"keyless_note": (- "repowise generate writes synthesized answers with a model "- "(needs a key, or --provider ollama for a local model)"+ "no model is configured, so answers are not synthesized; set a provider "+ "key (or a provider in .repowise/config.yaml) and restart the MCP server")}diff --git a/tests/unit/cli/test_fast_mode_offer.py b/tests/unit/cli/test_fast_mode_offer.pyindex f437090ba..f7ac50e39 100644--- a/tests/unit/cli/test_fast_mode_offer.py+++ b/tests/unit/cli/test_fast_mode_offer.py@@ -46,9 +46,9 @@ def test_next_steps_fast_mode_second_row_is_full_upgrade():steps = build_contextual_next_steps(index_only=True, fast_mode=True)cmds = [c for c, _ in steps]descs = " ".join(d for _, d in steps).lower()- # After serve, fast mode points at the full result.- assert cmds[1] == "repowise init"- assert "full" in descs and "documentation" in descs+ # After serve, fast mode points at the one fast-to-full command, keyless.+ assert cmds[1] == "repowise update --full"+ assert "documentation" in descs and "no key" in descsdef test_next_steps_index_only_upgrades_via_generate_not_update_full():diff --git a/tests/unit/cli/test_update_full_keyless.py b/tests/unit/cli/test_update_full_keyless.pynew file mode 100644index 000000000..6bda23183--- /dev/null+++ b/tests/unit/cli/test_update_full_keyless.py@@ -0,0 +1,248 @@+"""``repowise update --full`` works without a key, and every surface names it."""++from __future__ import annotations++import io+import json+import subprocess+from pathlib import Path+from types import SimpleNamespace++import click+import pytest+from click.testing import CliRunner+from rich.console import Console++from repowise.cli.commands import upgrade_flow+from repowise.cli.errors import reasoned_error+from repowise.cli.helpers import load_state, save_state++_KEYS = (+ "GEMINI_API_KEY",+ "GOOGLE_API_KEY",+ "OPENAI_API_KEY",+ "ANTHROPIC_API_KEY",+ "OPENROUTER_API_KEY",+ "REPOWISE_EMBEDDER",+)+++def _repo(tmp_path: Path, docs_mode: str = "none") -> Path:+ repo = tmp_path / "repo"+ repo.mkdir()+ subprocess.run(["git", "init"], cwd=repo, capture_output=True, check=True)+ (repo / ".repowise").mkdir()+ save_state(+ repo,+ {+ "last_sync_commit": "old",+ "run_mode": "fast",+ "git_tier": "essential",+ "docs_mode": docs_mode,+ },+ )+ return repo+++def keyless(monkeypatch: pytest.MonkeyPatch) -> dict:+ """No key anywhere; records what the upgrade was handed."""+ for key in _KEYS:+ monkeypatch.delenv(key, raising=False)++ def no_provider(*_a, **_k):+ raise reasoned_error("No provider configured.", reason="no_provider_configured")++ seen: dict = {}++ async def run(repo_path, provider, config, **kwargs):+ seen.update(provider=provider, config=config, **kwargs)+ for stage in ("git_backfill", "generation", "search", "health"):+ kwargs["checkpoint"](stage)+ return (+ [object()] * 3,+ 3,+ {+ "git_history_coverage": None,+ "file_pages": {"configured_cap": None, "eligible": 2, "generated": 2},+ "search": {"full_text": "available", "semantic": "unavailable",+ "next_command": "repowise reindex --embedder ollama"},+ "embedding_error": None,+ },+ )++ monkeypatch.setattr(upgrade_flow, "resolve_provider", no_provider)+ monkeypatch.setattr(upgrade_flow, "_run_upgrade", run)+ monkeypatch.setattr(upgrade_flow, "try_acquire_update_lock", lambda *a, **k: None)+ monkeypatch.setattr(upgrade_flow, "release_update_lock", lambda *a, **k: None)+ out = io.StringIO()+ monkeypatch.setattr(upgrade_flow, "console", Console(file=out, width=200))+ seen["out"] = out+ return seen+++def _upgrade(repo: Path, **kwargs) -> None:+ upgrade_flow.upgrade_to_full(+ repo,+ provider_name=kwargs.get("provider_name"),+ model=kwargs.get("model"),+ reasoning=None,+ concurrency=1,+ yes=True,+ )+++def test_keyless_upgrade_builds_documentation_from_code(tmp_path: Path, keyless: dict) -> None:+ repo = _repo(tmp_path)+ stale = load_state(repo)+ stale.update(provider="gemini", model="old")+ save_state(repo, stale)+ _upgrade(repo)++ assert keyless["provider"].provider_name == "template"+ assert keyless["config"].deterministic is True+ assert keyless["embedder_name"] == "mock"++ state = load_state(repo)+ assert state["docs_mode"] == "deterministic"+ assert state["git_tier"] == "full"+ assert state["run_mode"] == "standard"+ assert "provider" not in state and "model" not in state+ scope = state["index_scope"]+ assert scope["content_provenance"] == "template"+ assert scope["upgrade"]["status"] == "complete"+ assert scope["provider"]["name"] is None+ assert scope["provider"]["model_cost_possible"] is False++ printed = keyless["out"].getvalue()+ assert "no model calls, no spend" in printed+ assert "built from code" in printed+++def test_keyless_upgrade_keeps_an_embedder_the_user_chose(+ tmp_path: Path, keyless: dict+) -> None:+ repo = _repo(tmp_path)+ (repo / ".repowise" / "config.yaml").write_text("embedder: ollama\n", encoding="utf-8")+ _upgrade(repo)++ assert keyless["embedder_name"] == "ollama"+ assert "pinned in .repowise/config.yaml" in keyless["out"].getvalue()+++def test_keyless_upgrade_does_not_overwrite_documentation_a_model_wrote(+ tmp_path: Path, keyless: dict+) -> None:+ repo = _repo(tmp_path, docs_mode="llm")+ with pytest.raises(click.ClickException, match="written by a model"):+ _upgrade(repo)+ assert "provider" not in keyless+++def test_a_named_provider_that_fails_is_still_the_answer(+ tmp_path: Path, keyless: dict+) -> None:+ repo = _repo(tmp_path)+ with pytest.raises(click.ClickException, match="No provider configured"):+ _upgrade(repo, provider_name="gemini")+++def test_keyless_embedder_ignores_an_inferred_hosted_key(monkeypatch) -> None:+ from repowise.cli.providers import keyless_run_embedder++ for key in _KEYS:+ monkeypatch.delenv(key, raising=False)+ monkeypatch.setenv("GEMINI_API_KEY", "x")+ name, stated = keyless_run_embedder("mock")+ assert name == "mock"+ assert "keyless run" in stated++ monkeypatch.setenv("REPOWISE_EMBEDDER", "gemini")+ assert keyless_run_embedder("mock")[0] == "gemini"+++def test_workspace_full_with_repo_alias_upgrades_that_repo(monkeypatch, tmp_path) -> None:+ from repowise.cli.commands.update_cmd import command++ upgraded: list = []+ monkeypatch.setattr(command, "_full_upgrade", lambda opts, run: upgraded.append(run.repo_path))+ target = SimpleNamespace(+ ws_root=tmp_path,+ ws_config=SimpleNamespace(get_repo=lambda alias: SimpleNamespace(path="api")),+ )+ run = SimpleNamespace(repo_path=None)+ command._update_workspace_target(SimpleNamespace(full=True, repo_alias="api"), run, target)+ assert upgraded == [(tmp_path / "api").resolve()]++ with pytest.raises(click.ClickException, match="--repo <alias>"):+ command._update_workspace_target(SimpleNamespace(full=True, repo_alias=None), run, target)+++def test_reindex_on_an_index_only_repo_names_the_fast_to_full_command(tmp_path) -> None:+ from repowise.cli.commands.reindex_cmd import _index_only_message++ message = _index_only_message(_repo(tmp_path))+ assert "Index only" in message and "repowise update --full" in message++ save_state(tmp_path / "repo", {"docs_mode": "deterministic"})+ assert _index_only_message(tmp_path / "repo") is None+++def _plain(monkeypatch, module) -> io.StringIO:+ out = io.StringIO()+ monkeypatch.setattr(module, "console", Console(file=out, width=200))+ return out+++def test_update_panel_on_an_index_only_repo_names_update_full(monkeypatch) -> None:+ from repowise.cli.commands.update_cmd import reporting++ out = _plain(monkeypatch, reporting)+ graph = SimpleNamespace(number_of_nodes=lambda: 1, number_of_edges=lambda: 1)+ reporting.show_index_only_completion(+ graph_builder=SimpleNamespace(graph=lambda: graph),+ dead_code_report=SimpleNamespace(findings=[]),+ changed_count=1,+ git_files=0,+ elapsed=1.0,+ upgrade_command="repowise update --full",+ )+ printed = out.getvalue()+ assert "repowise update --full" in printed+ assert "update --docs" not in printed+++def test_workspace_init_on_fast_repos_names_update_full(monkeypatch) -> None:+ from repowise.cli.commands.init_cmd import reporting++ out = _plain(monkeypatch, reporting)+ reporting.show_workspace_completion(+ selected=[object(), object()],+ errors=[],+ total_files=2,+ total_symbols=2,+ total_pages=0,+ primary_alias="api",+ elapsed=1.0,+ index_only=True,+ provider=None,+ docs_outcomes={"api": (0, "fast mode"), "web": (0, "fast mode")},+ run_mode="fast",+ )+ printed = out.getvalue()+ assert "repowise update --repo api --full" in printed+ assert "repowise generate" not in printed+ assert "--docs" not in printed+++def test_status_names_the_fast_to_full_command(tmp_path) -> None:+ from repowise.cli.commands.status_cmd import status_command++ repo = _repo(tmp_path)+ result = CliRunner().invoke(status_command, [str(repo), "--no-workspace", "--format", "json"])+ assert result.exit_code == 0, result.output+ assert json.loads(result.output)["upgrade_command"] == "repowise update --full"++ result = CliRunner().invoke(status_command, [str(repo), "--no-workspace"])+ assert "Index only" in result.output+ assert "repowise update --full" in result.outputdiff --git a/tests/unit/core/test_fast_to_full_command.py b/tests/unit/core/test_fast_to_full_command.pynew file mode 100644index 000000000..312f0e240--- /dev/null+++ b/tests/unit/core/test_fast_to_full_command.py@@ -0,0 +1,34 @@+"""The one fast-to-full command, and the scope surfaces that carry it."""++from __future__ import annotations++from repowise.core.index_scope import (+ FAST_TO_FULL_COMMAND,+ compact_index_scope,+ fast_to_full_command,+ resolve_index_scope,+ upgrade_command,+)+++def _scope(docs_mode: str) -> dict:+ return resolve_index_scope({"docs_mode": docs_mode, "run_mode": "fast"})+++def test_command_is_update_full_and_targets_a_workspace_repo() -> None:+ assert FAST_TO_FULL_COMMAND == "repowise update --full"+ assert fast_to_full_command() == FAST_TO_FULL_COMMAND+ assert fast_to_full_command("api") == "repowise update --repo api --full"+++def test_only_an_index_only_scope_has_an_upgrade_command() -> None:+ assert upgrade_command(_scope("none")) == FAST_TO_FULL_COMMAND+ assert upgrade_command(_scope("deterministic")) is None+ assert upgrade_command(_scope("llm")) is None+ assert upgrade_command(None) is None+++def test_compact_scope_carries_the_command_only_when_index_only() -> None:+ assert compact_index_scope(_scope("none"))["upgrade_command"] == FAST_TO_FULL_COMMAND+ assert "upgrade_command" not in compact_index_scope(_scope("deterministic"))+ assert "upgrade_command" not in compact_index_scope(_scope("llm"))diff --git a/tests/unit/server/mcp/test_meta_keyless_note.py b/tests/unit/server/mcp/test_meta_keyless_note.pyindex a20b8e58b..65d090c0b 100644--- a/tests/unit/server/mcp/test_meta_keyless_note.py+++ b/tests/unit/server/mcp/test_meta_keyless_note.py@@ -31,8 +31,9 @@ async def _payload(reason: str) -> dict:def test_first_no_llm_provider_response_carries_the_note() -> None:first = _meta.keyless_note_meta()- assert "repowise generate" in first["keyless_note"]- assert "--provider ollama" in first["keyless_note"]+ # Synthesis comes from a provider the server can build, not from generate.+ assert "repowise generate" not in first["keyless_note"]+ assert "restart the MCP server" in first["keyless_note"]def test_second_response_in_the_same_process_says_nothing() -> None:@@ -42,7 +43,7 @@ def test_second_response_in_the_same_process_says_nothing() -> None:async def test_degraded_payload_carries_the_note_for_no_llm_provider() -> None:payload = await _payload("no-llm-provider")- assert "repowise generate" in payload["_meta"]["keyless_note"]+ assert "provider" in payload["_meta"]["keyless_note"]assert _state._keyless_note_announced is True