Skip to content

/wbRefactor — Live Demo () ​

What /wbRefactor would actually do on wb-labs right now. The candidate target files and their tests are real.


1. Live target ​

FieldLive value
Most-refactor-worthy file in the active plancore2/packages/wb-core/src/WBC.js (row 3, deferred)
Refactor-worthy despite being deferredYes — the plan defers row 3 because the architectural shape needs discussion, not because the surgery is unsafe
Test coverage on WBC.jsExisting — core2/packages/wb-core/tests/WBC.spec.js (per typical layout)
Memory note flagging cautionwbc-ui2-tech-debt.md records the parked nature of certain restructure work
Other refactor candidatestierEnforcement.js (security finding mixed with structural concern); various sibling-package files in core2/packages/wbc-ui2-cdn/ (parked, do not refactor)

The first row is the most useful — there's a real candidate (WBC.js) where the refactor is deferred, so /wbRefactor would correctly refuse pre-conversation.


2. What each input form would resolve to today ​

InputLive resolution
/wbRefactor core2/packages/wb-core/src/WBC.jsWould propose decomposition shape; ask for confirmation. Memory-aware caveat: the row is deferred — agent surfaces this and asks if the architectural conversation has happened.
/wbRefactor core2/packages/wb-core/src/tierEnforcement.jsWould propose strategy-table refactor; flag (but not fix) the security and cleanup findings.
/wbRefactor core2/packages/wbc-ui2-cdn/src/index.jsRefuse — memory says this package is parked tech debt. Refactoring would re-trigger the dist-folder mismatch conversation.
/wbRefactor "extract the parser"Halt — file-required.
/wbRefactor core2/packages/wb-core/Halt — directory targets refused.
/wbRefactor src/index.js,src/types.ts (atomic)Permitted if both files exist; atomic transformation.

3. Per-input behavior, applied live ​

/wbRefactor has no flags. The behavior matrix is by input shape:

Input shapeLive behavior
Single file with passing testsStandard refactor flow: propose → confirm → edit → test → report.
Single file with no test coverageWarns prominently; asks to confirm. Suggests adding a test first.
File where memory says "parked"Refuse. Explains why; suggests the architectural conversation as the actual blocker.
Two-file atomic targetBoth must exist; both succeed or both revert.
Directory targetHalt.
Free-text onlyHalt.

4. Pipelines ​

📋/wbRefactor Live Execution Simulator
The right refusal for WBC.js right now/wbRefactor core2/packages/wb-core/src/WBC.js
> /wbRefactor core2/packages/wb-core/src/WBC.js
[SYSTEM] Target: core2/packages/wb-core/src/WBC.js
[CONTEXT] Reading active plan: plan_wb-core_20260504.md...
Row 3 (WBC.js decomposition) is currently ⏸️ Deferred.
[CONTEXT] Reading memory wbc-ui2-tech-debt.md and feedback rules...
[REFUSE] The refactor target corresponds to a deferred plan row.
[REASON] Row 3's deferral isn't about *whether* WBC.js should be
decomposed — it's about *what shape* the decomposition
should take. Running /wbRefactor before that conversation
locks in a shape unilaterally.
[SUGGEST] Two paths:
1. Have the architectural conversation; capture the agreed shape
in a plan row's task description; reactivate row 3 with
/wbPlan --id="3" -o; then /wbRefactor.
2. If you genuinely just want to explore decomposition shapes,
use /wbExplain WBC.js --as="senior architect, 3 candidate
decompositions" to draft options without editing.
[NO MUTATION] Refactor not started.
⚠️ Note: Running `/wbRefactor` on the deferred row's target file:

💠 Pipeline The right refusal for WBC.js right now ​

Running /wbRefactor on the deferred row's target file:

💠 Pipeline The "surface findings, refactor only" pipeline on tierEnforcement.js ​

Assuming the architectural conversation happened and tierEnforcement.js is on the table for a strategy-table refactor:

💠 Pipeline The atomic two-file move ​

Hypothetical but realistic: escape.js is a one-function utility and renderString.js is its only consumer. Time to inline:


5. What would refuse today ​

TriggerLive response
/wbRefactor (no target)Halt. Refactor is target-required.
/wbRefactor core2/packages/wb-core/Halt. Directory targets refused.
/wbRefactor "extract the parser"Halt. File required.
/wbRefactor core2/packages/wbc-ui2-cdn/src/index.jsRefuse + memory citation (parked tech debt).
/wbRefactor core2/packages/wb-core/src/WBC.jsMemory-aware refuse: row 3 deferred pending architectural conversation.
/wbRefactor on a file with no test coverageWarn prominently; asks to confirm. Suggests /wbTest first if helpers exist.
/wbRefactor proposal that changes external APIHalt — external API change is a /wbWork job (corresponds to a plan row), not a refactor.
Tests fail post-refactorAuto-revert. Edit-set rolled back atomically.

The pattern: /wbRefactor is behavior-preserving, target-required, memory-aware, and atomic. No flags, no scope creep, no silent feature additions. It refuses targets that memory marks as parked, and refuses scope shapes (directories, free-text) that would dilute the surgical premise. When unrelated findings surface during scan, they're logged as follow-ups with the right next command — never auto-actioned.