Skip to content

/wbToWBC — Exhaustive Simulation () ​

/wbToWBC is the architectural translator. It takes generic code (standard Vue/React, raw CSS, native hooks) and converts it into wbc-ui.com compliant code — proprietary imports from @wbc-ui2/wb-core, WBC design tokens, and ecosystem-specific patterns. The central principle: framework adherence without logic alteration. The agent rewrites the how (imports, hooks, tokens) without changing the what (business logic, data flow, user-facing behavior).

Read this if you want to know what "WBC-compliant" means in practice, and where the boundary sits between translating a framework layer and rewriting business logic.


1. Role & target ​

AspectBehavior
RoleThe Pattern Enforcer. Converts generic code to WBC ecosystem patterns.
TargetComponent files (.vue, .jsx), stylesheets (.css), utility files (.js).
Cell scopeNone. /wbToWBC doesn't interact with plans.
Side effects allowedRewriting imports, swapping hooks, replacing CSS values, updating component exports.
Side effects forbiddenChanging business logic, altering data flow, modifying test assertions.

The distinction from /wbRefactor: /wbRefactor improves code quality within the same framework. /wbToWBC changes the framework while preserving behavior. You refactor after migration — never during.


2. Argument resolution ​

FormExampleWhat /wbToWBC does
Specific fileCommand: /wbToWBC src/components/Button.vueRewrites to use @wbc-ui2/wb-core base classes and design tokens.
Directory pathCommand: /wbToWBC src/legacy/Mass-migrates the entire directory.
Comma-separatedCommand: /wbToWBC src/Auth.js,src/Login.jsMigrates both to use useWbcAuth() hook.
Wildcard globCommand: /wbToWBC **/*.cssCSS-only sweep: replaces hardcoded colors with var(--wbc-*) tokens.

3. Flag matrix ​

/wbToWBC declares no flags of its own beyond the universal -h / --help. The target is positional — a file, a component, or a directory — and the migration mode is inferred from what the target contains.

Patterns with no WBC equivalent are left intact with a comment (// TODO: No WBC equivalent for indexedDB. Manual migration required.) rather than dropped, so a partial migration is always visible in the diff.


4. Pipelines (the agent-native scenarios) ​

📋/wbToWBC Exhaustive Simulation
Migrate a generic Vue dashboard to WBC/wbToWBC core2/packages/wb-dataviewer/src/legacy/GenericDashboard.vue -h -c
> /wbToWBC core2/packages/wb-dataviewer/src/legacy/GenericDashboard.vue -h -c
[SYSTEM] Full migration: hooks + CSS.
[AST] Parsed: 1 component, 4 composables, 12 CSS rules.
[CSS TRANSLATION]
#FF5722 → var(--wbc-accent)
#333333 → var(--wbc-text-primary)
16px → var(--wbc-spacing-md)
border-radius: 8px → var(--wbc-radius-lg)
12 rules translated.
[HOOK MIGRATION]
import { ref, onMounted } from 'vue'
→ import { useWbcState, useWbcLifecycle } from '@wbc-ui2/wb-core'
const data = ref(null)
→ const data = useWbcState(null)
onMounted(() => fetchData())
→ useWbcLifecycle('mount', () => fetchData())
[IMPORTS]
+ import { useWbcState, useWbcLifecycle } from '@wbc-ui2/wb-core'
- import { ref, onMounted } from 'vue'
[OK] GenericDashboard.vue is now WBC-compliant.
Business logic unchanged. 4 composables migrated, 12 CSS rules translated.
⚠️ Note: A developer copy-pasted a generic open-source dashboard. Convert it to WBC conventions:

💠 Pipeline Migrate a generic Vue dashboard to WBC ​

A developer copy-pasted a generic open-source dashboard. Convert it to WBC conventions:

💠 Pipeline CSS-only sweep across the monorepo ​

Before a theming overhaul, convert all hardcoded colors to design tokens:

💠 Pipeline Strict audit of a legacy folder ​

Can the legacy folder be fully migrated without manual intervention?


5. Edge cases & refusals ​

TriggerWhat /wbToWBC does
Code is already WBC-compliantScans silently. ℹ️ All patterns are already WBC-compliant. No changes needed.
Unrecognized third-party library⚠️ Cannot translate 'lodash.debounce'. Left intact. Consider: @wbc-ui2/wb-core/utils/debounce.
React code in a Vue monorepo⚠️ React hooks detected in a Vue ecosystem. /wbToWBC converts to WBC patterns, not between frameworks. Use /wbRefactor for framework migration.
Version mismatch (old Vue 2 syntax)❌ Component uses Vue 2 Options API. WBC requires Composition API (Vue 3+). Migrate to Vue 3 first.
CSS is minified/obfuscated⚠️ Cannot parse minified CSS. Run a CSS formatter first, then retry.

The unifying principle: /wbToWBC migrates the framework layer while preserving the business layer. It's the bridge from "generic code that works" to "WBC-compliant code that works the same way but uses ecosystem patterns." The migration is always behavior-preserving — if the component rendered a table before, it renders the same table after, just with WBC hooks and design tokens instead of generic ones.