Skip to content

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

fix(init): avoid implicit model use in scripted no-prose runs (#3242)

abhi2699101b731c7b
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 85d06785f..554982d7d 100644
--- a/packages/cli/src/repowise/cli/commands/init_cmd/command.py
+++ b/packages/cli/src/repowise/cli/commands/init_cmd/command.py
@@ -581,7 +581,8 @@ def _interactive_gate(
"Write the subsystem (concept) pages as model prose (needs a key), or "
"render the whole wiki from structure with no model and no spend. Every "
"other page is structural either way. Default: prose when a key is "
- "available. Use --mode fast for no wiki at all."
+ "available. With --no-prose, an explicit --provider or API key still "
+ "enables model-based decision extraction. Use --mode fast for no wiki at all."
),
)
@click.option(
@@ -1340,7 +1341,6 @@ def init_command(
try:
if (
provider_name
- or (sys.stdin.isatty() is False)
or any(
os.environ.get(k)
for k in (
diff --git a/tests/unit/cli/test_init_noninteractive.py b/tests/unit/cli/test_init_noninteractive.py
index 5105c6c80..9d64534c0 100644
--- a/tests/unit/cli/test_init_noninteractive.py
+++ b/tests/unit/cli/test_init_noninteractive.py
@@ -229,6 +229,43 @@ class TestProseFlag:
result = runner.invoke(cli, ["init", str(tmp_path), "--no-prose", "--yes"])
assert result.exit_code == 0, result.output
+ @pytest.mark.parametrize(
+ "flags", [["--no-prose"], ["--index-only"], ["--docs", "deterministic"]]
+ )
+ def test_scripted_structural_init_does_not_auto_detect_a_decision_provider(
+ self, runner, tmp_path, keyless_env, monkeypatch, flags
+ ):
+ from unittest.mock import Mock
+
+ resolver = Mock(return_value=None)
+ monkeypatch.setattr(
+ "repowise.cli.commands.init_cmd.command.resolve_provider", resolver
+ )
+ result = runner.invoke(cli, ["init", str(tmp_path), *flags, "--yes"])
+ assert result.exit_code == 0, result.output
+ resolver.assert_not_called()
+
+ @pytest.mark.parametrize("opt_in", ["provider", "key"])
+ def test_structural_init_preserves_explicit_decision_provider_opt_in(
+ self, runner, tmp_path, keyless_env, monkeypatch, opt_in
+ ):
+ from unittest.mock import Mock
+
+ resolver = Mock(return_value=None)
+ monkeypatch.setattr(
+ "repowise.cli.commands.init_cmd.command.resolve_provider", resolver
+ )
+ flags = ["--provider", "openai"] if opt_in == "provider" else []
+ if opt_in == "key":
+ monkeypatch.setenv("OPENAI_API_KEY", "test-key")
+ result = runner.invoke(
+ cli, ["init", str(tmp_path), "--no-prose", "--yes", *flags]
+ )
+ assert result.exit_code == 0, result.output
+ resolver.assert_called_once_with(
+ "openai" if opt_in == "provider" else None, None, tmp_path
+ )
+
def test_index_only_prints_deprecation(self, runner, tmp_path, keyless_env):
"""The deprecated alias still works and says so."""
result = runner.invoke(cli, ["init", str(tmp_path), "--index-only", "--yes"])