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.

refactor(pipeline): generation phase and result assembly out of run_pipeline (#4080)

Raghav Chamadiyade5f01a7fde9
diff --git a/packages/core/src/repowise/core/pipeline/_run/generation.py b/packages/core/src/repowise/core/pipeline/_run/generation.py
new file mode 100644
index 000000000..61d6ff31a
--- /dev/null
+++ b/packages/core/src/repowise/core/pipeline/_run/generation.py
@@ -0,0 +1,223 @@
+"""Generation phase: wiki pages with concurrent KG enrichment, then execution flows."""
+
+from __future__ import annotations
+
+import asyncio
+import contextlib
+from typing import Any
+
+import structlog
+
+# Phase functions are looked up on the orchestrator at call time, so a patch on
+# ``repowise.core.pipeline.orchestrator`` reaches this module too.
+from repowise.core.pipeline import orchestrator as _orch
+from repowise.core.pipeline.phases._common import _phase_done
+from repowise.core.pipeline.progress import emit_warning
+
+from .state import PipelineRun
+
+logger = structlog.get_logger("repowise.core.pipeline.orchestrator")
+
+
+async def run_generation_phase(run: PipelineRun) -> None:
+ """Generate pages when the run asks for docs and has a provider; else a no-op."""
+ generation_client = _generation_client(run)
+ if not (run.generate_docs and generation_client is not None):
+ return
+ progress = run.progress
+ if progress:
+ progress.on_message("info", "Phase 3: Generation")
+ config = _resolve_generation_config(run)
+ _detect_api_contracts(run)
+ kg_structural_task = _start_kg_enrichment(run, config)
+ try:
+ run.generated_pages = await _orch.run_generation(
+ repo_path=run.repo_path,
+ parsed_files=run.parsed_files,
+ source_map=run.source_map,
+ graph_builder=run.graph_builder,
+ repo_structure=run.repo_structure,
+ git_meta_map=run.git_meta_map,
+ llm_client=generation_client,
+ embedder=run.embedder,
+ vector_store=run.vector_store,
+ concurrency=run.concurrency,
+ progress=progress,
+ resume=run.resume,
+ generation_config=config,
+ dead_code_report=run.gen_dead_code_report,
+ decision_report=run.gen_decision_report,
+ external_systems=run.external_systems,
+ on_page_ready=run.on_page_ready,
+ preserved_page_ids=run.preserved_page_ids,
+ **_kg_snapshot(run),
+ )
+ except BaseException:
+ # Stop the concurrent enrichment's LLM calls and keep its failure from
+ # surfacing as "Task exception was never retrieved" at teardown.
+ if kg_structural_task is not None:
+ kg_structural_task.cancel()
+ with contextlib.suppress(BaseException):
+ await kg_structural_task
+ raise
+ _claim_authoritative_page_types(run)
+ if kg_structural_task is not None:
+ await _finalize_kg_enrichment(run, kg_structural_task)
+
+
+def _kg_snapshot(run: PipelineRun) -> dict[str, Any]:
+ """The in-memory KG for generation: the artifact file is written after it."""
+ kg = run.knowledge_graph_result
+ if kg is None:
+ return {"kg_modules": None, "kg_data": None}
+ return {"kg_modules": kg.modules or None, "kg_data": kg.to_dict()}
+
+
+def _generation_client(run: PipelineRun) -> Any:
+ """The caller's provider, or a template provider for a keyless DETERMINISTIC run.
+
+ Scoped to generation, not assigned over ``llm_client``: decision extraction
+ branches on that client's truthiness and would lose its heuristic fallbacks.
+ """
+ if run.generate_docs and run.mode.deterministic_docs and run.llm_client is None:
+ from repowise.core.providers.llm.template import TemplateProvider
+
+ return TemplateProvider()
+ return run.llm_client
+
+
+def _resolve_generation_config(run: PipelineRun) -> Any:
+ config = run.generation_config
+ if config is None:
+ from repowise.core.generation import GenerationConfig
+ from repowise.core.reasoning import resolve_reasoning
+ from repowise.core.repo_config import load_repo_config
+
+ _cfg = load_repo_config(run.repo_path)
+ # Wiki style precedence: explicit param > repo config.yaml > default.
+ _style = run.wiki_style or _cfg.get("wiki_style", "comprehensive")
+ config = GenerationConfig.from_repo_config(
+ _cfg,
+ max_concurrency=run.concurrency,
+ reasoning=resolve_reasoning(config=_cfg),
+ wiki_style=_style,
+ language=_cfg.get("language", "en"),
+ )
+ # The mode decides how pages render: a DETERMINISTIC run with an
+ # LLM-shaped config would still prompt.
+ if run.mode.deterministic_docs and not config.deterministic:
+ from dataclasses import replace as _dc_replace
+
+ config = _dc_replace(config, deterministic=True)
+ return config
+
+
+def _detect_api_contracts(run: PipelineRun) -> None:
+ """Flag framework-defined HTTP surfaces so they render as api_contract pages."""
+ from repowise.core.generation import detect_code_api_contracts as _detect_apis
+
+ progress = run.progress
+ try:
+ flipped = _detect_apis(run.parsed_files)
+ if flipped and progress:
+ progress.on_message("info", f"→ Detected {flipped} additional API contract file(s)")
+ except Exception as _api_err:
+ logger.warning("api_contract_detection_failed", error=str(_api_err))
+ emit_warning(
+ progress,
+ f"API contract detection skipped ({_api_err}); endpoint pages may be missing.",
+ )
+
+
+def _start_kg_enrichment(run: PipelineRun, config: Any) -> asyncio.Task | None:
+ """Launch LLM layer naming + tour to overlap page generation; None when not run.
+
+ Generation holds a ``to_dict()`` snapshot of the skeleton and enrichment reads
+ only skeleton layers and warmed graph metrics, so neither sees the other's live
+ output; results apply in ``finalize_knowledge_graph`` after generation.
+ Skipped in DETERMINISTIC mode, whose null provider raises on any prompt.
+ """
+ if run.knowledge_graph_result is None or run.mode.deterministic_docs:
+ return None
+ from repowise.core.generation.knowledge_graph import enrich_knowledge_graph_structural
+
+ _kg_reasoning = getattr(config, "reasoning", "auto") if config else "auto"
+ # Warm the pagerank cache on this thread so both concurrent readers only read it.
+ run.graph_builder.pagerank()
+ return asyncio.create_task(
+ enrich_knowledge_graph_structural(
+ kg_skeleton=run.knowledge_graph_result,
+ llm_client=run.llm_client,
+ graph_builder=run.graph_builder,
+ repo_structure=run.repo_structure,
+ tech_stack=run.tech_stack_dicts,
+ reasoning=_kg_reasoning,
+ )
+ )
+
+
+def _claim_authoritative_page_types(run: PipelineRun) -> None:
+ """Record the structural page types this run fully decided, for the stale-page sweep.
+
+ ``module_page`` is claimed on evidence (a concept page was produced) or for a
+ repo with no production code: ``file_pages_only`` and per-page provider errors
+ also emit zero, and claiming then would delete every concept page. No run emits
+ layer pages (their ids resolve through the redirect table) and SCC pages carry
+ no budget, so a full run always decides both.
+ """
+ produced_module_page = any(
+ getattr(page, "page_type", "") == "module_page" for page in (run.generated_pages or [])
+ )
+ has_code_to_group = any(
+ not getattr(p.file_info, "is_test", False) for p in (run.parsed_files or [])
+ )
+ if produced_module_page or not has_code_to_group:
+ run.authoritative_page_types.add("module_page")
+ run.authoritative_page_types.add("layer_page")
+ run.authoritative_page_types.add("scc_page")
+
+
+async def _finalize_kg_enrichment(run: PipelineRun, kg_structural_task: asyncio.Task) -> None:
+ """Join the structural enrichment and apply the page-derived summary backfill.
+
+ A KG failure logs and leaves the skeleton in place; it never aborts the run.
+ """
+ from repowise.core.generation.knowledge_graph import finalize_knowledge_graph
+
+ progress = run.progress
+ if progress:
+ progress.on_phase_start("knowledge_graph.enrich", None)
+ try:
+ enriched_layers, tour = await kg_structural_task
+ run.knowledge_graph_result = finalize_knowledge_graph(
+ kg_skeleton=run.knowledge_graph_result,
+ enriched_layers=enriched_layers,
+ tour=tour,
+ generated_pages=run.generated_pages,
+ )
+ if progress:
+ progress.on_message(
+ "info",
+ f" ↳ KG enriched: {len(run.knowledge_graph_result.layers)} layers, "
+ f"{len(run.knowledge_graph_result.tour)} tour steps",
+ )
+ _phase_done(progress, "knowledge_graph.enrich")
+ except (ValueError, KeyError, OSError, RuntimeError) as exc:
+ logger.error("knowledge_graph_enrichment_failed", error=str(exc), exc_info=True)
+
+
+async def trace_execution_flows(run: PipelineRun) -> None:
+ """Trace execution flows from entry points; failure only warns."""
+ progress = run.progress
+ if progress:
+ progress.on_phase_start("graph.flows", None)
+ try:
+ run.execution_flow_report = await asyncio.to_thread(run.graph_builder.execution_flows)
+ except Exception as _flow_err:
+ logger.warning("execution_flow_tracing_skipped", error=str(_flow_err))
+ emit_warning(
+ progress,
+ f"Execution flow tracing skipped ({_flow_err}); "
+ "entry-point scores and flow-based pages will be absent.",
+ )
+ _phase_done(progress, "graph.flows")
diff --git a/packages/core/src/repowise/core/pipeline/_run/state.py b/packages/core/src/repowise/core/pipeline/_run/state.py
index 50bd4eca0..a9cc5c9f2 100644
--- a/packages/core/src/repowise/core/pipeline/_run/state.py
+++ b/packages/core/src/repowise/core/pipeline/_run/state.py
@@ -69,6 +69,12 @@ class PipelineRun:
tech_stack_dicts: list[dict] = field(default_factory=list)
knowledge_graph_result: Any = None
+ # Generation phase outputs; see ``PipelineResult`` for the two page-id sets.
+ generated_pages: list[Any] | None = None
+ authoritative_page_types: set[str] = field(default_factory=set)
+ preserved_page_ids: set[str] = field(default_factory=set)
+ execution_flow_report: Any = None
+
def hooked_progress(progress: Any) -> HookProgressCallback:
"""Wrap *progress* so registered pipeline hooks fire around each phase.
diff --git a/packages/core/src/repowise/core/pipeline/orchestrator.py b/packages/core/src/repowise/core/pipeline/orchestrator.py
index 1925b99af..25cdd4ff2 100644
--- a/packages/core/src/repowise/core/pipeline/orchestrator.py
+++ b/packages/core/src/repowise/core/pipeline/orchestrator.py
@@ -14,8 +14,6 @@ Callers:
from __future__ import annotations
-import asyncio
-import contextlib
import time
from dataclasses import dataclass, field
from pathlib import Path
@@ -25,12 +23,12 @@ import structlog
from repowise.core.ingestion.git_indexer._constants import _DEFAULT_COMMIT_LIMIT
from repowise.core.pipeline.modes import OrchestratorMode
-from repowise.core.pipeline.progress import ProgressCallback, emit_warning
+from repowise.core.pipeline.progress import ProgressCallback
from ._run.analysis import run_analysis_phase
+from ._run.generation import run_generation_phase, trace_execution_flows
from ._run.index import run_index_phase
from ._run.state import PipelineRun, attach_cost_tracker, hooked_progress, start_checkpointer
-from .phases._common import _phase_done
# The ``_run`` stage modules call these phase functions through this module
# (``_orch.<name>``), so imports and patches on the orchestrator keep reaching them.
@@ -171,11 +169,11 @@ class PipelineResult:
sweep would read them as gone and delete the very pages the resume existed
to keep (issue #1089). Empty on every non-resume run.
- Filled here for symmetry, but the live route is the other one: ``--resume``
+ Filled by the generation stage for symmetry, but the live route is the other one: ``--resume``
only exists on ``init``, which calls ``run_pipeline(generate_docs=False)``
and generates separately, so the init flows set this on the result
themselves the same way they set ``generated_pages``. No caller currently
- reaches the assignment below (it needs ``resume`` and ``generate_docs``
+ reaches that assignment (it needs ``resume`` and ``generate_docs``
together), so treat this field's value on a ``run_pipeline`` result as
untested until one does."""
@@ -302,316 +300,58 @@ async def run_pipeline(
resume_controller=resume_controller,
coverage_report_paths=coverage_report_paths,
)
- generate_docs = run.generate_docs
await run_index_phase(run)
- parsed_files = run.parsed_files
- file_infos = run.file_infos
- repo_structure = run.repo_structure
- source_map = run.source_map
- graph_builder = run.graph_builder
- traversal_stats = run.traversal_stats
- tech_items = run.tech_items
- git_summary = run.git_summary
- git_metadata_list = run.git_metadata_list
- git_meta_map = run.git_meta_map
- external_systems = run.external_systems
-
await run_analysis_phase(run)
- parsed_files = run.parsed_files
- dead_code_report = run.dead_code_report
- health_report = run.health_report
- decision_report = run.decision_report
- doc_drift_report = run.doc_drift_report
- gen_dead_code_report = run.gen_dead_code_report
- gen_decision_report = run.gen_decision_report
- tech_stack_dicts = run.tech_stack_dicts
- knowledge_graph_result = run.knowledge_graph_result
-
- # ---- Phase 3: Generation (optional) ------------------------------------
- generated_pages: list[Any] | None = None
- # Structural page types this run was authoritative for (see
- # PipelineResult.authoritative_page_types). Stays empty unless generation
- # runs below, because a run that generated nothing decided nothing.
- authoritative_page_types: set[str] = set()
- # Filled by generation when resuming; see PipelineResult.preserved_page_ids.
- preserved_page_ids: set[str] = set()
- # DETERMINISTIC supplies its own null provider so a caller with no key can
- # still get a wiki. Scoped to this phase rather than assigned over
- # ``llm_client``: the analysis phase above shares that client, and its
- # decision extractor branches on truthiness, so a non-None provider that
- # raises on every call would cost it the heuristic fallbacks it would
- # otherwise have taken with no provider at all.
- generation_client = llm_client
- if generate_docs and mode.deterministic_docs and generation_client is None:
- from repowise.core.providers.llm.template import TemplateProvider
-
- generation_client = TemplateProvider()
-
- if generate_docs and generation_client is not None:
- if progress:
- progress.on_message("info", "Phase 3: Generation")
-
- resolved_generation_config = generation_config
- if resolved_generation_config is None:
- from repowise.core.generation import GenerationConfig
- from repowise.core.reasoning import resolve_reasoning
- from repowise.core.repo_config import load_repo_config
-
- _cfg = load_repo_config(repo_path)
- # Wiki style precedence: explicit param (server passes the DB-settings
- # value) > repo-local config.yaml (CLI/init) > default.
- _style = wiki_style or _cfg.get("wiki_style", "comprehensive")
- resolved_generation_config = GenerationConfig.from_repo_config(
- _cfg,
- max_concurrency=concurrency,
- reasoning=resolve_reasoning(config=_cfg),
- wiki_style=_style,
- language=_cfg.get("language", "en"),
- )
-
- # The mode decides how pages are rendered, not the caller's config.
- # A DETERMINISTIC run with an LLM-shaped config would still prompt.
- if mode.deterministic_docs and not resolved_generation_config.deterministic:
- from dataclasses import replace as _dc_replace
-
- resolved_generation_config = _dc_replace(resolved_generation_config, deterministic=True)
-
- # Phase 2 enrichment: flag framework-defined HTTP surfaces (FastAPI,
- # ASP.NET controllers, …) as api_contract so they route through the
- # api_contract template instead of generic file_page. Lives in the
- # generation package so language-specific heuristics stay co-located
- # with the templates that consume them.
- from repowise.core.generation import detect_code_api_contracts as _detect_apis
-
- try:
- flipped = _detect_apis(parsed_files)
- if flipped and progress:
- progress.on_message("info", f"→ Detected {flipped} additional API contract file(s)")
- except Exception as _api_err:
- logger.warning("api_contract_detection_failed", error=str(_api_err))
- emit_warning(
- progress,
- f"API contract detection skipped ({_api_err}); endpoint pages may be missing.",
- )
-
- # Launch the page-independent half of KG enrichment (LLM layer naming +
- # tour) so it overlaps page generation instead of running strictly
- # after it. The two do not read each other's live output: run_generation
- # receives a to_dict() snapshot of the skeleton (kg_data/kg_modules
- # below), and structural enrichment reads only the skeleton layers plus
- # the warmed graph metrics. Layer/tour results are applied to the
- # skeleton only in finalize_knowledge_graph (after generation), so the
- # in-place layer-name mutation inside enrichment can never reach the
- # snapshot generation is already holding. The page-dependent finalize
- # (summary backfill) runs after both complete.
- kg_structural_task = None
- # Skipped in DETERMINISTIC mode: layer naming and the tour are pure
- # prompting, and the null provider raises rather than stubbing. The
- # skeleton's structural layers stand on their own.
- if knowledge_graph_result is not None and not mode.deterministic_docs:
- from repowise.core.generation.knowledge_graph import (
- enrich_knowledge_graph_structural,
- )
-
- _kg_reasoning = (
- getattr(resolved_generation_config, "reasoning", "auto")
- if resolved_generation_config
- else "auto"
- )
- # Warm the pagerank cache on this thread before the concurrent
- # launch so both the structural task and generation only ever read
- # it. It is already populated during ingestion; this makes the
- # no-race invariant explicit rather than incidental.
- graph_builder.pagerank()
- kg_structural_task = asyncio.create_task(
- enrich_knowledge_graph_structural(
- kg_skeleton=knowledge_graph_result,
- llm_client=llm_client,
- graph_builder=graph_builder,
- repo_structure=repo_structure,
- tech_stack=tech_stack_dicts,
- reasoning=_kg_reasoning,
- )
- )
-
- try:
- generated_pages = await run_generation(
- repo_path=repo_path,
- parsed_files=parsed_files,
- source_map=source_map,
- graph_builder=graph_builder,
- repo_structure=repo_structure,
- git_meta_map=git_meta_map,
- llm_client=generation_client,
- embedder=embedder,
- vector_store=vector_store,
- concurrency=concurrency,
- progress=progress,
- resume=resume,
- generation_config=resolved_generation_config,
- dead_code_report=gen_dead_code_report,
- decision_report=gen_decision_report,
- external_systems=external_systems,
- on_page_ready=on_page_ready,
- preserved_page_ids=preserved_page_ids,
- # In-memory KG — the artifact file is written after generation,
- # so it cannot carry layers/tour/modules on a fresh init.
- kg_modules=(
- knowledge_graph_result.modules or None
- if knowledge_graph_result is not None
- else None
- ),
- kg_data=(
- knowledge_graph_result.to_dict() if knowledge_graph_result is not None else None
- ),
- )
- except BaseException:
- # Generation aborted the run: cancel the concurrent enrichment task
- # so it stops issuing LLM calls and never surfaces as a stray
- # "Task exception was never retrieved" during teardown.
- if kg_structural_task is not None:
- kg_structural_task.cancel()
- with contextlib.suppress(BaseException):
- await kg_structural_task
- raise
-
- # Record which structural page types this run authoritatively decided,
- # so the sweep can retire prior rows of a type even when this run
- # legitimately emitted zero pages of it.
- #
- # ``module_page`` needs no KG and no budget: the concept grouping
- # partitions every production file, so a run that produced any concept
- # page produced all of them and prior rows should go. The condition
- # that used to stand here tested whether a curated KG artifact had
- # engaged a grouping mode that no longer exists, which stranded the
- # superseded pages on exactly the repositories the KG failed on.
- #
- # It is still not unconditional, because "emitted zero" has causes
- # other than "there is nothing to document": ``file_pages_only``
- # returns before the concept level runs at all, and a provider error
- # on that level is logged per page rather than raised. Claiming
- # authority there would delete every concept page over a 429. So the
- # claim is made on evidence — at least one page produced — with the
- # genuinely empty repository as the one exception, since it has no
- # page to show and its stale rows are exactly what wants sweeping.
- produced_module_page = any(
- getattr(page, "page_type", "") == "module_page" for page in (generated_pages or [])
- )
- has_code_to_group = any(
- not getattr(p.file_info, "is_test", False) for p in (parsed_files or [])
- )
- if produced_module_page or not has_code_to_group:
- authoritative_page_types.add("module_page")
- # Layer pages are retired: no run emits one and no failure mode can
- # make a run emit one, so every completed run is authoritative for the
- # type and the sweep retires the rows a pre-retirement index left
- # behind. Unconditional, unlike the types above, because "emitted
- # zero" here has exactly one cause. Their ids keep resolving through
- # the redirect table, so retiring the rows breaks no inbound link.
- authoritative_page_types.add("layer_page")
- # An SCC page missing from a full run's output means the cycle is gone,
- # so the run is authoritative for the type and the sweep may clear the
- # pages of cycles that no longer exist. This used to be claimed only for
- # a deterministic run, on the premise that a budgeted run's zero might
- # mean "the allocation was zero" rather than "there are no cycles" —
- # but selection applies no budget to scc_groups (selection/selector.py
- # _build_scc_candidates, unlike the file-page path), so zero produced
- # really does mean zero cycles on every full run. Holding the narrower
- # rule left a keyed index of a repo whose cycles all disappeared unable
- # to ever retire them.
- authoritative_page_types.add("scc_page")
-
- # ---- Knowledge Graph enrichment: join + finalize ----------------------
- # The structural half (layer naming + tour) ran concurrently with
- # generation above; join it now and apply the page-derived summary
- # backfill. Same try/except envelope as before: a KG failure logs and
- # leaves the skeleton in place, never aborting the run.
- if kg_structural_task is not None:
- from repowise.core.generation.knowledge_graph import finalize_knowledge_graph
-
- if progress:
- progress.on_phase_start("knowledge_graph.enrich", None)
- try:
- enriched_layers, tour = await kg_structural_task
- knowledge_graph_result = finalize_knowledge_graph(
- kg_skeleton=knowledge_graph_result,
- enriched_layers=enriched_layers,
- tour=tour,
- generated_pages=generated_pages,
- )
- if progress:
- progress.on_message(
- "info",
- f" ↳ KG enriched: {len(knowledge_graph_result.layers)} layers, "
- f"{len(knowledge_graph_result.tour)} tour steps",
- )
- _phase_done(progress, "knowledge_graph.enrich")
- except (ValueError, KeyError, OSError, RuntimeError) as exc:
- logger.error("knowledge_graph_enrichment_failed", error=str(exc), exc_info=True)
-
- # ---- Execution flow tracing -----------------------------------------------
- execution_flow_report = None
- if progress:
- progress.on_phase_start("graph.flows", None)
- try:
- execution_flow_report = await asyncio.to_thread(graph_builder.execution_flows)
- except Exception as _flow_err:
- logger.warning("execution_flow_tracing_skipped", error=str(_flow_err))
- emit_warning(
- progress,
- f"Execution flow tracing skipped ({_flow_err}); "
- "entry-point scores and flow-based pages will be absent.",
- )
- _phase_done(progress, "graph.flows")
-
- # ---- Build result -------------------------------------------------------
- # Flush checkpoints on the success path; on an exception above this point
- # the checkpointer is intentionally not closed so interrupted phases stay
- # RUNNING for a resumable re-run.
+ await run_generation_phase(run)
+ await trace_execution_flows(run)
+ # Close only on success: after an exception the checkpointer stays open so
+ # interrupted phases stay RUNNING for a resumable re-run.
if checkpointer is not None:
await checkpointer.aclose()
+ return _build_result(run)
+
- elapsed = time.monotonic() - start
+def _build_result(run: PipelineRun) -> PipelineResult:
+ elapsed = time.monotonic() - run.start
+ file_infos = run.file_infos
+ parsed_files = run.parsed_files
languages = {fi.language for fi in file_infos if hasattr(fi, "language") and fi.language}
symbol_count = sum(len(pf.symbols) for pf in parsed_files)
+ resume_controller = run.resume_controller
return PipelineResult(
- repo_path=str(repo_path),
+ repo_path=str(run.repo_path),
parsed_files=parsed_files,
file_infos=file_infos,
- repo_structure=repo_structure,
- source_map=source_map,
- graph_builder=graph_builder,
- git_metadata_list=git_metadata_list,
- git_meta_map=git_meta_map,
- git_summary=git_summary,
- dead_code_report=dead_code_report,
- decision_report=decision_report,
- health_report=health_report,
- doc_drift_report=doc_drift_report,
- execution_flow_report=execution_flow_report,
- knowledge_graph_result=knowledge_graph_result,
- generated_pages=generated_pages,
- traversal_stats=traversal_stats,
- repo_name=repo_path.name,
+ repo_structure=run.repo_structure,
+ source_map=run.source_map,
+ graph_builder=run.graph_builder,
+ git_metadata_list=run.git_metadata_list,
+ git_meta_map=run.git_meta_map,
+ git_summary=run.git_summary,
+ dead_code_report=run.dead_code_report,
+ decision_report=run.decision_report,
+ health_report=run.health_report,
+ doc_drift_report=run.doc_drift_report,
+ execution_flow_report=run.execution_flow_report,
+ knowledge_graph_result=run.knowledge_graph_result,
+ generated_pages=run.generated_pages,
+ traversal_stats=run.traversal_stats,
+ repo_name=run.repo_path.name,
file_count=len(parsed_files),
symbol_count=symbol_count,
languages=languages,
elapsed_seconds=elapsed,
tech_stack=[
- {"name": t.name, "version": t.version, "category": t.category} for t in tech_items
+ {"name": t.name, "version": t.version, "category": t.category} for t in run.tech_items
],
- external_systems=external_systems,
- vector_store=vector_store,
+ external_systems=run.external_systems,
+ vector_store=run.vector_store,
index_persisted_incrementally=(
resume_controller.index_persisted if resume_controller is not None else False
),
- authoritative_page_types=authoritative_page_types,
- preserved_page_ids=preserved_page_ids,
+ authoritative_page_types=run.authoritative_page_types,
+ preserved_page_ids=run.preserved_page_ids,
)
-
-# ---------------------------------------------------------------------------
-# Phase helpers (private)
-# ---------------------------------------------------------------------------