Skip to content

fix(init): record the distill rewrite-hook verdict in every flow#382

Merged
RaghavChamadiya merged 1 commit into
mainfrom
fix/distill-workspace-optin
Jun 5, 2026
Merged

fix(init): record the distill rewrite-hook verdict in every flow#382
RaghavChamadiya merged 1 commit into
mainfrom
fix/distill-workspace-optin

Conversation

@RaghavChamadiya
Copy link
Copy Markdown
Member

Problem

The distill command-rewrite hook treats any repo with .repowise/ and no recorded distill.commands.enabled as enabled with the ask posture. Workspace-mode repowise init never offered the distill opt-in and never recorded a verdict in the repos it indexed — so a user who had the hook installed (opted in from some other repo) got every noisy command rewritten with a confirmation prompt in workspace-indexed repos they were never asked about. With agents/subagents running many commands, that means a flood of permission prompts.

--distill-hook/--no-distill-hook was also silently ignored in workspace mode, and workspace add / first-time indexing via repowise update reopened the same gap for repos added later.

Fix

  • Workspace init now runs the distill opt-in once (after the post-commit hook offer) and records the verdict in every selected repo — index-only, full, and advanced modes alike, and even when indexing failed (.repowise/ was already created, so a decline must gate those repos off too). --distill-hook / --no-distill-hook are honored and applied workspace-wide.
  • offer_distill_rewrite_hook takes a list of repos: the user-level hook installs once, verdicts are written per repo, and a failed config write on one repo cannot abort init for the rest.
  • workspace add inherits the primary repo's explicit verdict for newly indexed repos.
  • repowise update backfills the verdict for workspace members indexed for the first time outside init (both the single-repo path and the workspace path) — covers workspace add --no-index followed by a later update.
  • hook rewrite install gains PATH / --workspace / -w / --no-workspace (same targeting as hook install), so a workspace-wide decline can be reversed in one command — keeping the "run repowise hook rewrite install later" promise printed on decline.

Single-repo semantics are unchanged: interactive runs prompt (default No), decline writes enabled: false, non-interactive runs without a flag record nothing (strictly opt-in).

Tests

  • 16 new/updated unit tests: opt-in matrix (flags × interactivity × env guard), workspace verdict fan-out, per-repo write isolation, workspace add inheritance, update backfill (incl. no-op outside a workspace / for the primary / when a verdict exists), workspace-mode hook rewrite install.
  • Full unit suite: 3778 passed, 2 xfailed. Ruff clean (no new findings vs main baseline).

Docs updated: DISTILL.md, CLI_REFERENCE.md.

The distill command-rewrite hook treats any repo with .repowise/ and no
recorded distill.commands.enabled as enabled-with-ask. Workspace-mode
init never offered the opt-in nor recorded a verdict, so users with the
hook installed from another repo got prompt floods in workspace-indexed
repos they were never asked about (--distill-hook/--no-distill-hook was
silently ignored there too).

- workspace init now runs the opt-in once and records the verdict in
  every selected repo (interactive prompt or explicit flag; index-only,
  full, and advanced modes alike; even when indexing failed, since
  .repowise/ was already created)
- offer_distill_rewrite_hook takes a list of repos; the user-level hook
  installs once, per-repo writes are isolated so one failure cannot
  abort init
- workspace add inherits the primary repo's explicit verdict for newly
  indexed repos
- repowise update backfills the verdict for workspace members indexed
  for the first time outside init (single-repo and workspace paths)
- hook rewrite install gains PATH / --workspace / --no-workspace so a
  workspace-wide decline can be reversed in one command
@RaghavChamadiya RaghavChamadiya requested a review from swati510 as a code owner June 5, 2026 10:57
@repowise-bot
Copy link
Copy Markdown

repowise-bot Bot commented Jun 5, 2026

✅ Health: 7.0 (unchanged)
2 files moved · 5 hotspots · 5 hidden couplings · 3 with fix history

⚠️ Change risk: moderate (riskier than 59% of this repo's commits · raw 9.1/10)
This change's risk is driven by:

  • large diff (many lines added)
  • scattered, high-entropy change

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../init_cmd/_interactive.py 7.6 → 7.4 ▼ -0.2 🔻 introduced complex method, bumpy road
.../distill/test_init_optin.py 10.0 → 9.8 ▼ -0.2 🔻 introduced dry violation

💡 .../init_cmd/_interactive.py: Reduce cyclomatic complexity. Decompose the function along its conditional axes; if it dispatches on a type tag, replace the if/elif ladder with polymorphism or a lookup table.

🔥 Hotspots touched (5)
  • .../init_cmd/workspace.py — 3 commits/90d, 2 dependents · primary owner: Raghav Chamadiya (99%)
  • .../commands/workspace_cmd.py — 4 commits/90d, 3 dependents · primary owner: Raghav Chamadiya (98%)
  • .../commands/update_cmd.py — 37 commits/90d, 12 dependents · primary owner: Raghav Chamadiya (67%)
2 more
  • .../cli/test_workspace_add_defaults.py — 1 commits/90d, 0 dependents · primary owner: Raghav Chamadiya (100%)
  • .../init_cmd/command.py — 5 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (98%)
🔗 Hidden coupling (1 file)
  • .../commands/update_cmd.py co-changes with these files (not in this PR):
    • .../pipeline/orchestrator.py (8× — 🟢 routine)
    • .../cli/helpers.py (8× — 🟢 routine)
    • .../persistence/models.py (6× — 🟢 routine)
    • .../cli/test_commands.py (6× — 🟢 routine)
    • .../cli/test_helpers.py (5× — 🟢 routine)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-05 10:57 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya merged commit b104e4e into main Jun 5, 2026
5 checks passed
@RaghavChamadiya RaghavChamadiya deleted the fix/distill-workspace-optin branch June 5, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants