Skip to content

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

feat(generation): first-class output-language support (#756)

Raghav Chamadiyaa020233bc5dd
diff --git a/README.md b/README.md
index a17a74e50..41956f75a 100644
--- a/README.md
+++ b/README.md
@@ -87,7 +87,7 @@ Each layer is queryable from the CLI, the MCP tools, and the local dashboard.
|---|---|---|
| **◈ Graph** | tree-sitter dependency graph across 15 languages · two-tier file + symbol nodes · 3-tier call resolution · Leiden communities · PageRank / centrality / execution flows · framework-aware route→handler edges | A real graph most tools never build |
| **◈ Git** | hotspots (churn × complexity) · ownership % · co-change pairs (hidden coupling) · bus factor · contributor profiles · module health · reviewer suggestions | Behavioral signals static analysis can't see |
-| **◈ Docs** | LLM-generated wiki per module/file · incremental on every commit · freshness + confidence scoring · hybrid RAG search (FTS + vector via RRF) · selectable wiki styles (comprehensive / reference / tutorial / caveman) | Stays current, rebuilt every commit |
+| **◈ Docs** | LLM-generated wiki per module/file · incremental on every commit · freshness + confidence scoring · hybrid RAG search (FTS + vector via RRF) · selectable wiki styles (comprehensive / reference / tutorial / caveman) · 15 output languages (`init --language zh`) | Stays current, rebuilt every commit |
| **◈ Decisions** | architectural decisions mined from **8 sources**, evidence-backed (verified / fuzzy / unverified), linked to graph nodes, connected by `supersedes`/`refines`/`conflicts_with` edges, tracked for staleness | **★ Captured nowhere else** |
| **★ Code Health** | **25 deterministic markers**, 1–10 per file · **three signals: defect risk · maintainability · performance** · coverage ingestion · trend alerts · **concrete graph-aware refactoring plans** (Extract Class / Helper / Move Method / Break Cycle / Split File / Extract Method) · **zero LLM, <30s** | **★ Defect-validated, with the fix attached. Our edge** |
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 0f7b58ba5..335803d03 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **One dataflow parse per file.** The health pass's dataflow consumers (the Extract Method detector and the perf advisory-to-asserted promotion) now share a single lazily parsed per-file analysis instead of each re-reading and re-parsing the file, making the health pass measurably faster on large repos with identical output. The new per-function dataflow summary and point-lookup APIs this introduces are the foundation for upcoming dataflow-backed surfaces.
### Added
+- **First-class output-language support.** `repowise init --language <code>` (15 languages: en, ru, es, fr, de, zh, ja, ko, it, pt, nl, pl, tr, ar, hi) sets the natural language for generated wiki pages; advanced interactive mode now asks for it too (English default). The choice persists to `.repowise/config.yaml` so `update` regenerates changed pages in the same language, and the workspace init, workspace generate, and server regenerate paths now honor it instead of silently defaulting to English. Code, file paths, and symbol names stay untranslated. Previously this was config-file-only (#99).
- **Worktrees just work.** `repowise init` and `repowise update` inside a linked git worktree now auto-detect the base checkout and seed the worktree's index from it, then catch up incrementally; no flags needed. `--seed-from <base>` remains as an explicit override and `--no-seed` forces a cold init. See [WORKTREES.md](WORKTREES.md). (#655 introduced the manual flag; this release makes it automatic.)
### Fixed
diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md
index 2a9d68bed..3a77b121d 100644
--- a/docs/CLI_REFERENCE.md
+++ b/docs/CLI_REFERENCE.md
@@ -78,6 +78,7 @@ All three reach the indexing knobs; the LLM-only knobs appear only when docs are
| `--onboarding` / `--no-onboarding` | Generate the curated Onboarding collection (up to 8 overview pages). Default: on; slots without enough signal are skipped. |
| `--harvest-decisions` / `--no-harvest-decisions` | Harvest architectural decisions during page generation (verified against source before storage). Default: on. |
| `--wiki-style` | Documentation voice/density: `comprehensive` (default), `caveman` (token-condensed, AI-first), `reference` (API-manual), `tutorial` (beginner-friendly). Interactive full runs prompt when omitted. Saved to config so `update` keeps the style. See [WIKI_STYLES.md](WIKI_STYLES.md). |
+| `--language` | Output language for generated wiki pages: `en` (default), `ar`, `de`, `es`, `fr`, `hi`, `it`, `ja`, `ko`, `nl`, `pl`, `pt`, `ru`, `tr`, `zh`. Code, file paths, and symbol names stay untranslated. Saved to config so `update` keeps the language. Also asked in advanced interactive mode. To switch an existing wiki's language, set the flag and re-run `init --force`. |
| `--resume` | Resume from the last checkpoint if interrupted |
| `--force` | Regenerate all pages even if they exist |
| `--commit-limit` | Max commits to analyze per file (default: 500, capped at 10000) |
@@ -106,6 +107,7 @@ repowise init --dry-run # preview cost
repowise init --test-run # quick test (10 files)
repowise init --provider openai --model qwen3 --reasoning off
repowise init --provider openrouter --model openai/gpt-5 --reasoning minimal
+repowise init --language zh # wiki docs in Chinese
repowise init -x vendor/ -x "*.gen.go" # exclude patterns
repowise init --include-submodules # include submodules
repowise init --no-codex --no-agents # skip Codex project files
diff --git a/docs/CONFIG.md b/docs/CONFIG.md
index f61c9a26c..2abae9065 100644
--- a/docs/CONFIG.md
+++ b/docs/CONFIG.md
@@ -46,6 +46,7 @@ reasoning: auto # auto | off | none | minimal | low | mediu
commit_limit: 500 # Max commits per file for git analysis (clamped 1-10000)
follow_renames: false # Track file renames in git history
wiki_style: comprehensive # comprehensive | caveman | reference | tutorial | custom
+language: en # Output language for generated pages (en, zh, ru, hi, ...)
enable_onboarding: true # Show first-run onboarding prompts
exclude_patterns: # Gitignore-style patterns
- vendor/
@@ -76,6 +77,7 @@ You can edit this file directly. Changes take effect on the next `init`,
| `follow_renames` | `false` | Track file renames through git history |
| `exclude_patterns` | `[]` | Extra gitignore-style patterns, on top of `.gitignore` |
| `wiki_style` | `comprehensive` | `comprehensive`, `caveman`, `reference`, `tutorial`, `custom` |
+| `language` | `en` | Output language for generated wiki pages: `en`, `ar`, `de`, `es`, `fr`, `hi`, `it`, `ja`, `ko`, `nl`, `pl`, `pt`, `ru`, `tr`, `zh` |
| `enable_onboarding` | `true` | Show first-run onboarding prompts (CLI and web) |
| `distill` | see below | Output distillation config |
| `mcp` | see below | MCP tool surface config |
@@ -99,6 +101,14 @@ regenerates the wiki). Power users can define their own style under
Note: hand-editing `wiki_style` here and running `update` does not regenerate
existing pages, use `restyle`.
+`language` controls the natural language of generated wiki content (prose only;
+code, file paths, and symbol names stay untranslated). Set it with
+`init --language <code>` or pick it in advanced interactive mode; it persists
+here so `update` regenerates changed pages in the same language. Unknown codes
+fall back to English with a warning. As with `wiki_style`, changing it later
+does not retranslate existing pages, re-run `init --force --language <code>`
+to rebuild the wiki in the new language.
+
> **Code-health rules** are configured separately in
> `.repowise/health-rules.json` (per-file marker overrides); see
> [The `health-rules.json` file](#the-health-rulesjson-file) below.
diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md
index 7b062f24e..df6f5d2ac 100644
--- a/docs/USER_GUIDE.md
+++ b/docs/USER_GUIDE.md
@@ -184,6 +184,7 @@ repowise init [PATH]
| `--embedder` | Embedder for semantic search: `gemini`, `openai`, `mock`. Auto-detected from env vars. |
| `--index-only` | Skip LLM generation entirely. Only parse, build graph, and index git. Free. |
| `--wiki-style` | Documentation voice: `comprehensive` (default), `caveman` (token-condensed), `reference` (API-manual), `tutorial`. Saved to config; switch later with `repowise restyle`. See [WIKI_STYLES.md](WIKI_STYLES.md). |
+| `--language` | Output language for generated wiki pages (`en` default; also `zh`, `ru`, `hi`, `es`, `fr`, `de`, `ja`, `ko`, `it`, `pt`, `nl`, `pl`, `tr`, `ar`). Prose is translated; code, file paths, and symbol names are not. Saved to config so `update` keeps the language. |
| `--dry-run` | Show generation plan and cost estimate without running anything. |
| `--test-run` | Generate docs for only the top 10 files (by PageRank), quick validation. |
| `--skip-tests` | Exclude test files from documentation generation. |
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 4e4c431ee..1ccde4186 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/command.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/command.py
@@ -66,6 +66,7 @@ from repowise.cli.ui import (
quick_repo_scan,
should_offer_fast_mode,
)
+from repowise.core.generation.languages import SUPPORTED_LANGUAGES
from repowise.core.generation.styles import DEFAULT_STYLE, list_styles, resolve_style
from repowise.core.reasoning import REASONING_MODES
@@ -398,6 +399,18 @@ def _run_generation_phase(
"an interactive full run you'll be prompted; otherwise comprehensive."
),
)
+ "--language",
+ "language_opt",
+ type=click.Choice(sorted(SUPPORTED_LANGUAGES)),
+ default=None,
+ metavar="CODE",
+ help=(
+ "Output language for generated wiki pages (e.g. en, zh, ru, hi). "
+ "Code, file paths, and symbol names stay untranslated. Saved to "
+ "config so `update` keeps the language. Default: en."
+ ),
+)
@click.option(
"--seed-from",
type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=str),
@@ -465,6 +478,7 @@ def init_command(
coverage_report: tuple[str, ...],
harvest_decisions: bool,
wiki_style: str | None,
+ language_opt: str | None,
no_cost_tracking: bool,
verbose: bool,
progress: str,
@@ -588,6 +602,7 @@ def init_command(
# Apply the chosen style uniformly across the workspace's repos
# (no per-repo interactive prompt in the multi-repo flow).
wiki_style=resolve_style(wiki_style).name,
+ language=language_opt,
run_mode=run_mode,
)
return
@@ -619,6 +634,10 @@ def init_command(
# file page is a full-LLM tier-1 page (unchanged behaviour).
tier1_top_n: int | None = None
+ # Output language picked in the advanced-mode generation section; None
+ # until chosen. Resolved below: flag > this > config.yaml > English.
+ language_choice: str | None = None
+
# The two orthogonal axes the interactive menu resolves: whether docs are
# generated and whether we entered the advanced-config prompts. Initialized
# for the non-interactive path (where the menu never runs); the menu
@@ -671,6 +690,7 @@ def init_command(
prompt_reasoning=False,
generate_docs=generate_docs,
wiki_style=wiki_style,
+ language=language_opt,
)
# Indexing knobs (always present).
commit_limit = adv["commit_limit"]
@@ -691,6 +711,8 @@ def init_command(
harvest_decisions = adv.get("harvest_decisions", harvest_decisions)
if adv.get("wiki_style"):
wiki_style = adv["wiki_style"]
+ if adv.get("language"):
+ language_choice = adv["language"]
# Fast mode (picked in the indexing section) is a no-LLM index, so it
# forces index-only even if the user had asked for docs.
if run_mode == "fast":
@@ -738,7 +760,8 @@ def init_command(
# Merge exclude_patterns from config.yaml and --exclude/-x flags
config = load_config(repo_path)
- language = config.get("language", "en")
+ # Output language: CLI flag > advanced-mode choice > config.yaml > English.
+ language = language_opt or language_choice or config.get("language", "en")
resolved_reasoning = resolve_reasoning(reasoning, config)
exclude_patterns: list[str] = list(config.get("exclude_patterns") or []) + list(exclude)
@@ -981,6 +1004,12 @@ def init_command(
if wiki_style != DEFAULT_STYLE:
save_config_partial(repo_path, wiki_style=wiki_style)
+ # Persist the output language so `repowise update` regenerates changed
+ # pages in the same language. Written only when the run's language differs
+ # from what config.yaml already holds; the default stays unrecorded.
+ if language != config.get("language", "en"):
+ save_config_partial(repo_path, language=language)
+
# ---- Post-run: config, state, MCP, editor project files ----
if commit_limit is not None:
save_config_partial(repo_path, commit_limit=resolved_commit_limit)
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 b6331e8ae..2c00b281f 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/workspace.py
@@ -89,6 +89,7 @@ def _run_workspace_generation(
coverage_pct: float | None = None,
harvest_decisions: bool = True,
wiki_style: str = DEFAULT_STYLE,
+ language: str = "en",
) -> list[Any]:
"""Run LLM generation for a single repo in the workspace init flow.
@@ -105,6 +106,7 @@ def _run_workspace_generation(
enable_onboarding=onboarding,
harvest_decisions=harvest_decisions,
wiki_style=wiki_style,
+ language=language,
)
chosen_pct, _plans, est, gen_config = select_coverage(
result=result,
@@ -184,6 +186,7 @@ class _WorkspaceCtx:
coverage_pct: float | None
harvest_decisions: bool
wiki_style: str
+ language: str
resolved_reasoning: str
embedder_name_resolved: str
resolved_commit_limit: int
@@ -294,6 +297,7 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCt
coverage_pct=ctx.coverage_pct,
harvest_decisions=ctx.harvest_decisions,
wiki_style=ctx.wiki_style,
+ language=ctx.language,
)
result.generated_pages = generated_pages
# (result.vector_store is set inside _run_workspace_generation
@@ -371,6 +375,9 @@ def _ingest_and_generate_repo(repo: Any, idx: int, total: int, ctx: _WorkspaceCt
# omitted to keep config tidy — only an override is recorded.
if ctx.wiki_style != DEFAULT_STYLE:
save_config_partial(repo.path, wiki_style=ctx.wiki_style)
+ # Same for the output language, so update regenerates in it.
+ if ctx.language != "en":
+ save_config_partial(repo.path, language=ctx.language)
return _RepoOutcome(
file_count=result.file_count,
@@ -424,6 +431,7 @@ def _workspace_init(
coverage_pct: float | None = None,
harvest_decisions: bool = True,
wiki_style: str = DEFAULT_STYLE,
+ language: str | None = None,
run_mode: str = "standard",
) -> None:
"""Multi-repo workspace initialization.
@@ -484,7 +492,7 @@ def _workspace_init(
# add a per-workspace wiki-style prompt (the workspace flow applies
# one style uniformly); onboarding / decision harvesting still apply.
adv = interactive_advanced_config(
- console, prompt_reasoning=False, wiki_style=wiki_style
+ console, prompt_reasoning=False, wiki_style=wiki_style, language=language
)
commit_limit = adv.get("commit_limit") or commit_limit
follow_renames = adv.get("follow_renames", follow_renames)
@@ -500,6 +508,8 @@ def _workspace_init(
harvest_decisions = adv.get("harvest_decisions", harvest_decisions)
if adv.get("wiki_style"):
wiki_style = adv["wiki_style"]
+ if adv.get("language"):
+ language = adv["language"]
elif not index_only:
# "full" mode
selection = interactive_provider_config_select(
@@ -596,6 +606,7 @@ def _workspace_init(
coverage_pct=coverage_pct,
harvest_decisions=harvest_decisions,
wiki_style=wiki_style,
+ language=language or "en",
resolved_reasoning=resolved_reasoning,
embedder_name_resolved=embedder_name_resolved,
resolved_commit_limit=resolved_commit_limit,
diff --git a/packages/cli/src/repowise/cli/commands/workspace_cmd.py b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
index fcff72b90..79a470470 100644
--- a/packages/cli/src/repowise/cli/commands/workspace_cmd.py
+++ b/packages/cli/src/repowise/cli/commands/workspace_cmd.py
@@ -663,10 +663,12 @@ def _generate_docs_for_added_repo(
from repowise.core.repo_config import load_repo_config
+ repo_cfg = load_repo_config(repo_path)
config = GenerationConfig(
max_concurrency=concurrency,
reasoning=reasoning,
- wiki_style=load_repo_config(repo_path).get("wiki_style", "comprehensive"),
+ wiki_style=repo_cfg.get("wiki_style", "comprehensive"),
+ language=repo_cfg.get("language", "en"),
)
assembler = ContextAssembler(config)
generator = PageGenerator(
diff --git a/packages/cli/src/repowise/cli/ui/mode_selection.py b/packages/cli/src/repowise/cli/ui/mode_selection.py
index 5adbdaf33..e8c4d6719 100644
--- a/packages/cli/src/repowise/cli/ui/mode_selection.py
+++ b/packages/cli/src/repowise/cli/ui/mode_selection.py
@@ -15,6 +15,7 @@ from rich.text import Text
from repowise.cli.ui.brand import BRAND, BRAND_STYLE, DIM
from repowise.cli.ui.repo_scanner import RepoScanInfo
+from repowise.core.generation.languages import SUPPORTED_LANGUAGES
from repowise.core.generation.styles import DEFAULT_STYLE, list_styles
from repowise.core.reasoning import REASONING_MODES
@@ -152,6 +153,28 @@ def prompt_wiki_style(console: Console) -> str:
return styles[choice - 1].name
+def prompt_language(console: Console) -> str:
+ """Interactive picker for the wiki output language.
+
+ Returns the chosen language code. Defaults to English so a bare Enter
+ keeps today's behaviour.
+ """
+ console.print("\n[bold]Output language[/bold]")
+ console.print(
+ " [dim]"
+ + " · ".join(f"{code} {name}" for code, name in SUPPORTED_LANGUAGES.items())
+ + "[/dim]"
+ )
+ console.print(" [dim]Code, file paths, and symbol names stay untranslated.[/dim]")
+ return click.prompt(
+ " Language code",
+ default="en",
+ show_default=True,
+ type=click.Choice(sorted(SUPPORTED_LANGUAGES)),
+ show_choices=False,
+ )
+
+
def _prompt_scope(console: Console, scan: RepoScanInfo | None, result: dict[str, Any]) -> None:
"""Scope section: which file classes to include."""
console.print()
@@ -282,12 +305,14 @@ def _prompt_generation(
is_large: bool,
prompt_reasoning: bool = True,
wiki_style: str | None = None,
+ language: str | None = None,
) -> None:
"""Generation section: concurrency, reasoning, embedder, test run, tiering,
- onboarding, decision harvesting, and wiki style.
+ onboarding, decision harvesting, wiki style, and output language.
*wiki_style* carries an explicit ``--wiki-style`` value; when set the style
- prompt is skipped so the flag wins.
+ prompt is skipped so the flag wins. *language* works the same way for the
+ ``--language`` flag.
"""
console.print()
console.print(f" [{BRAND}]Generation[/]")
@@ -369,6 +394,9 @@ def _prompt_generation(
# here so the choice lands inside the section, before the summary panel.
result["wiki_style"] = wiki_style if wiki_style is not None else prompt_wiki_style(console)
+ # Output language. An explicit --language wins; otherwise prompt (English default).
+ result["language"] = language if language is not None else prompt_language(console)
+
def _build_summary_table(
result: dict[str, Any],
@@ -411,6 +439,11 @@ def _build_summary_table(
summary.add_row("Embedder", result["embedder"])
if result.get("wiki_style"):
summary.add_row("Wiki style", result["wiki_style"])
+ if result.get("language") and result["language"] != "en":
+ summary.add_row(
+ "Language",
+ f"{result['language']} ({SUPPORTED_LANGUAGES.get(result['language'], '?')})",
+ )
if allow_fast and result.get("tier1_top_n"):
summary.add_row("Full-LLM page cap", str(result["tier1_top_n"]))
summary.add_row("Onboarding", "yes" if result.get("onboarding", True) else "no")
@@ -429,6 +462,7 @@ def interactive_advanced_config(
prompt_reasoning: bool = True,
generate_docs: bool = True,
wiki_style: str | None = None,
+ language: str | None = None,
) -> dict[str, Any]:
"""Prompt for advanced init options, grouped into logical sections.
@@ -445,8 +479,8 @@ def interactive_advanced_config(
``commit_limit``, ``follow_renames``, ``skip_tests``, ``skip_infra``,
``exclude``, ``include_submodules``, ``run_mode``, ``generate_docs`` (always),
plus ``concurrency``, ``reasoning``, ``embedder``, ``test_run``,
- ``tier1_top_n``, ``onboarding``, ``harvest_decisions``, ``wiki_style`` (docs
- only).
+ ``tier1_top_n``, ``onboarding``, ``harvest_decisions``, ``wiki_style``,
+ ``language`` (docs only).
Editor integration prompts are intentionally not asked here so that full and
advanced modes stay aligned. Editor setup owns those prompts after mode
@@ -476,6 +510,7 @@ def interactive_advanced_config(
is_large=is_large,
prompt_reasoning=prompt_reasoning,
wiki_style=wiki_style,
+ language=language,
)
result["generate_docs"] = generate_docs
diff --git a/packages/core/src/repowise/core/generation/__init__.py b/packages/core/src/repowise/core/generation/__init__.py
index 0f891ca5f..01e4e206d 100644
--- a/packages/core/src/repowise/core/generation/__init__.py
+++ b/packages/core/src/repowise/core/generation/__init__.py
@@ -56,6 +56,7 @@ _EXPORTS = {
"WikiLink": ".interlinking",
"attach_wiki_links_and_backlinks": ".interlinking",
"resolve_wiki_links": ".interlinking",
+ "SUPPORTED_LANGUAGES": ".languages",
"SYSTEM_PROMPTS": ".page_generator",
"PageGenerator": ".page_generator",
"BucketAllocation": ".selection",
diff --git a/packages/core/src/repowise/core/generation/languages.py b/packages/core/src/repowise/core/generation/languages.py
new file mode 100644
index 000000000..93e7d11f8
--- /dev/null
+++ b/packages/core/src/repowise/core/generation/languages.py
@@ -0,0 +1,28 @@
+"""Supported output languages for generated wiki content.
+
+Kept in a dependency-free leaf module so the CLI can import the map at
+startup (for ``--language`` validation and the interactive init prompt)
+without pulling the heavy page-generator stack.
+"""
+
+from __future__ import annotations
+
+# code → English name. The page generator validates the configured code
+# against this map and falls back to English on an unknown code.
+SUPPORTED_LANGUAGES = {
+ "en": "English",
+ "ru": "Russian",
+ "es": "Spanish",
+ "fr": "French",
+ "de": "German",
+ "zh": "Chinese",
+ "ja": "Japanese",
+ "ko": "Korean",
+ "it": "Italian",
+ "pt": "Portuguese",
+ "nl": "Dutch",
+ "pl": "Polish",
+ "tr": "Turkish",
+ "ar": "Arabic",
+ "hi": "Hindi",
+}
diff --git a/packages/core/src/repowise/core/generation/page_generator/__init__.py b/packages/core/src/repowise/core/generation/page_generator/__init__.py
index 7f90e6b31..64e94fac3 100644
--- a/packages/core/src/repowise/core/generation/page_generator/__init__.py
+++ b/packages/core/src/repowise/core/generation/page_generator/__init__.py
@@ -25,10 +25,11 @@ from .helpers import (
_now_iso,
_select_clone_representatives,
)
-from .prompts import SYSTEM_PROMPTS
+from .prompts import SUPPORTED_LANGUAGES, SYSTEM_PROMPTS
from .validation import _validate_symbol_references
__all__ = [
+ "SUPPORTED_LANGUAGES",
"SYSTEM_PROMPTS",
"PageGenerator",
"PriorPage",
diff --git a/packages/core/src/repowise/core/generation/page_generator/core.py b/packages/core/src/repowise/core/generation/page_generator/core.py
index 70a6b9ad4..a972d3a34 100644
--- a/packages/core/src/repowise/core/generation/page_generator/core.py
+++ b/packages/core/src/repowise/core/generation/page_generator/core.py
@@ -42,7 +42,7 @@ from .decision_harvest import (
)
from .helpers import _extract_summary, _now_iso
from .pertype import PerTypeGenerationMixin
-from .prompts import _LANGUAGE_NAMES, SYSTEM_PROMPTS
+from .prompts import SUPPORTED_LANGUAGES, SYSTEM_PROMPTS
from .validation import _validate_symbol_references
if TYPE_CHECKING:
@@ -131,7 +131,7 @@ class PageGenerator(PerTypeGenerationMixin):
config: GenerationConfig,
jinja_env: jinja2.Environment | None = None,
vector_store: Any | None = None,
- language: str = "en",
+ language: str | None = None,
prior_pages: dict[str, PriorPage] | None = None,
repo_path: Path | str | None = None,
) -> None:
@@ -139,7 +139,8 @@ class PageGenerator(PerTypeGenerationMixin):
self._assembler = assembler
self._config = config
self._vector_store = vector_store
- self._language = language
+ # Output language: explicit arg wins, else the config's, else English.
+ self._language = language if language is not None else getattr(config, "language", "en")
# Resolve the wiki style once. "comprehensive" (default) is inert, so this
# is a no-op for repos that never opt in. ``repo_path`` lets a user-defined
# ``.repowise/styles/<name>`` style resolve (Phase 5).
@@ -440,13 +441,13 @@ class PageGenerator(PerTypeGenerationMixin):
# newlines or extra instructions into the system prompt.
raw = (self._language or "en").lower().strip()
lang_code = "".join(ch for ch in raw if ch.isalnum() or ch == "_")
- if lang_code not in _LANGUAGE_NAMES:
+ if lang_code not in SUPPORTED_LANGUAGES:
if lang_code != "en":
log.warning("unknown_language_code", code=lang_code, fallback="en")
lang_code = "en"
if lang_code == "en":
return base_system
- lang_name = _LANGUAGE_NAMES[lang_code]
+ lang_name = SUPPORTED_LANGUAGES[lang_code]
instruction = (
f"Generate all documentation content in {lang_name}. "
"Keep all code, file paths, and symbol names in their original form. "
diff --git a/packages/core/src/repowise/core/generation/page_generator/prompts.py b/packages/core/src/repowise/core/generation/page_generator/prompts.py
index 058a9f5d7..69a9d3b10 100644
--- a/packages/core/src/repowise/core/generation/page_generator/prompts.py
+++ b/packages/core/src/repowise/core/generation/page_generator/prompts.py
@@ -6,23 +6,10 @@ every call. This enables Anthropic server-side prefix caching.
from __future__ import annotations
-_LANGUAGE_NAMES = {
- "en": "English",
- "ru": "Russian",
- "es": "Spanish",
- "fr": "French",
- "de": "German",
- "zh": "Chinese",
- "ja": "Japanese",
- "ko": "Korean",
- "it": "Italian",
- "pt": "Portuguese",
- "nl": "Dutch",
- "pl": "Polish",
- "tr": "Turkish",
- "ar": "Arabic",
- "hi": "Hindi",
-}
+# Re-exported here so page-generator internals keep one import site for
+# prompt-related constants; the map itself lives in the dependency-free
+# ``generation.languages`` leaf so the CLI can import it cheaply.
+from ..languages import SUPPORTED_LANGUAGES # noqa: F401
# ---------------------------------------------------------------------------
# System prompts — one per page type (constant strings for prefix caching)
diff --git a/packages/core/src/repowise/core/pipeline/orchestrator.py b/packages/core/src/repowise/core/pipeline/orchestrator.py
index 6cfb40c69..a8d858e87 100644
--- a/packages/core/src/repowise/core/pipeline/orchestrator.py
+++ b/packages/core/src/repowise/core/pipeline/orchestrator.py
@@ -612,6 +612,7 @@ async def run_pipeline(
max_concurrency=concurrency,
reasoning=resolve_reasoning(config=_cfg),
wiki_style=_style,
+ language=_cfg.get("language", "en"),
)
# Phase 2 enrichment: flag framework-defined HTTP surfaces (FastAPI,
diff --git a/packages/server/src/repowise/server/job_executor.py b/packages/server/src/repowise/server/job_executor.py
index bb048f9bd..ce38fcd4e 100644
--- a/packages/server/src/repowise/server/job_executor.py
+++ b/packages/server/src/repowise/server/job_executor.py
@@ -797,9 +797,13 @@ async def _incremental_page_regen(
effective_style = resolve_style(
job_config.get("style") or repo_wiki_style, repo_path=repo_path
).name
+ repo_cfg = load_repo_config(repo_path)
generation_config = GenerationConfig(
- reasoning=resolve_reasoning(config=load_repo_config(repo_path)),
+ reasoning=resolve_reasoning(config=repo_cfg),
wiki_style=effective_style,
+ # Regenerate in the repo's configured output language, not default
+ # English (PageGenerator picks the language up from the config).
+ language=repo_cfg.get("language", "en"),
)
assembler = ContextAssembler(generation_config)
generator = PageGenerator(
diff --git a/tests/unit/cli/test_ui_package.py b/tests/unit/cli/test_ui_package.py
index 05302b0b2..0895cde35 100644
--- a/tests/unit/cli/test_ui_package.py
+++ b/tests/unit/cli/test_ui_package.py
@@ -118,6 +118,7 @@ def test_advanced_config_default_keys_no_fast(monkeypatch: pytest.MonkeyPatch) -
"harvest_decisions": True,
"tier1_top_n": None,
"wiki_style": DEFAULT_STYLE,
+ "language": "en",
}
diff --git a/tests/unit/generation/test_page_generator.py b/tests/unit/generation/test_page_generator.py
index b1326b006..d39dd6b7e 100644
--- a/tests/unit/generation/test_page_generator.py
+++ b/tests/unit/generation/test_page_generator.py
@@ -442,6 +442,17 @@ def test_build_system_prompt_strips_control_chars_from_language():
assert prompt == SYSTEM_PROMPTS["file_page"]
+def test_language_defaults_from_config_when_arg_omitted():
+ # Callers that only build a GenerationConfig (server regenerate, pipeline
+ # fallback) must still get the configured output language.
+ config = GenerationConfig(
+ max_tokens=256, token_budget=500, max_concurrency=1, harvest_decisions=False, language="ru"
+ )
+ gen = PageGenerator(MockProvider(), ContextAssembler(config), config)
+ prompt = gen._build_system_prompt("file_page")
+ assert prompt.startswith("Generate all documentation content in Russian.")
+
+
def test_compute_cache_key_varies_by_language():
gen_en = _gen("en")
gen_ru = _gen("ru")
@@ -479,8 +490,12 @@ async def test_generate_all_uses_in_memory_kg_modules_without_artifact_file():
sym = _make_symbol(file_path=p)
parsed.append(
ParsedFile(
- file_info=fi, symbols=[sym], imports=[], exports=[],
- docstring=None, parse_errors=[],
+ file_info=fi,
+ symbols=[sym],
+ imports=[],
+ exports=[],
+ docstring=None,
+ parse_errors=[],
)
)
repo = RepoStructure(
@@ -554,8 +569,12 @@ async def test_generate_all_builds_kg_ctx_from_in_memory_kg_data():
sym = _make_symbol(file_path=p)
parsed.append(
ParsedFile(
- file_info=fi, symbols=[sym], imports=[], exports=[],
- docstring=None, parse_errors=[],
+ file_info=fi,
+ symbols=[sym],
+ imports=[],
+ exports=[],
+ docstring=None,
+ parse_errors=[],
)
)
repo = RepoStructure(
@@ -570,8 +589,7 @@ async def test_generate_all_builds_kg_ctx_from_in_memory_kg_data():
"version": "1.0.0",
"project": {"name": "test-repo", "total_files": len(paths), "entry_points": []},
"nodes": [
- {"id": f"file:{p}", "type": "file", "filePath": p, "language": "python"}
- for p in paths
+ {"id": f"file:{p}", "type": "file", "filePath": p, "language": "python"} for p in paths
],
"edges": [],
"layers": [