Skip to content

/wbMonetize — Exhaustive Simulation () ​

/wbMonetize is the commercialization agent. It wraps existing UI components or API routes with tier-based access gates (Free, Pro, Enterprise). The central design principle: fail-closed security. If the monetization check errors, access to the premium feature is denied by default. A broken paywall that lets everyone in is worse than a broken paywall that lets no one in.

Read this if you want to know how the AST wrapping works, why --remove exists as a separate destructive flag, and how the __WBC_DEV__ 3-mode gating pattern interacts with monetization.


1. Role & target ​

AspectBehavior
RoleThe Commercializer. Wraps features in subscription-based access gates.
TargetUI components (Vue/React), API routes, or specific feature branches.
Cell scopeNone. /wbMonetize doesn't interact with plans.
Side effects allowedWrapping component exports, injecting middleware, adding billing imports.
Side effects forbiddenModifying the feature's business logic, changing data flow, altering test behavior.

The key architectural detail: /wbMonetize works with wb-core's existing __WBC_DEV__ 3-mode gating system. The free/pro/enterprise tiers are already defined in tierEnforcement.js. /wbMonetize connects features to those tiers — it doesn't create a new gating system.


2. Argument resolution ​

FormExampleWhat /wbMonetize does
Specific fileCommand: /wbMonetize src/components/ExportData.vueWraps the component export with a tier-checking HOC/wrapper.
Directory pathCommand: /wbMonetize src/api/premium/Injects billing middleware into all routes.
Comma-separatedCommand: /wbMonetize src/Dashboard.vue,src/Reports.vueSame tier gate on both features.
Natural languageCommand: /wbMonetize "make dark mode a pro feature"Fuzzy-matches → finds ThemeToggle.vue, wraps the dark mode branch.

Natural language targeting is supported here (unlike /wbWork) because monetization decisions are often described in product terms ("make X a pro feature") rather than file paths. The risk of a wrong match is low — the user reviews the diff before committing.


3. Flag matrix ​

FlagShortcutPurpose
--stripe-sInjects Stripe Checkout integration instead of a generic paywall lock.
--dry-run-dSimulates the wrapping and shows a diff without modifying files.
--remove-rDestructive: un-gates the feature, making it free for all users.

--remove strips the gate entirely — no wrapper, no billing imports, no runtime check. It is the inverse of a normal /wbMonetize run, not a softer version of one: use it when the gate should never have existed.

--stripe vs generic paywall. The generic paywall shows a "locked" UI with no payment flow. --stripe adds Stripe Elements, Payment Intent hooks, and a checkout modal. Use generic during development; switch to --stripe before production launch.


4. Pipelines (the agent-native scenarios) ​

📋/wbMonetize Exhaustive Simulation
Gate the WBDataViewer export feature to Enterprise/wbMonetize core2/packages/wb-dataviewer/src/components/ExportPanel.vue -t="enterprise" -s
> /wbMonetize core2/packages/wb-dataviewer/src/components/ExportPanel.vue -t="enterprise" -s
[SYSTEM] Targeting ExportPanel.vue for Enterprise tier gating.
[AST] Parsed component: 1 default export, 3 methods.
[GATE] Wrapping export with tier check:
import { withTierGate } from '@wbc-ui2/wb-core/tierEnforcement'
import { useStripeCheckout } from '@wbc-ui2/wb-core/billing'
// Original: export default ExportPanel
export default withTierGate(ExportPanel, {
tier: 'enterprise',
fallback: () => StripeUpgradeModal({ feature: 'Export to PDF' })
})
[INJECT] Added Stripe Checkout modal as fallback UI.
[OK] ExportPanel is now Enterprise-gated with Stripe integration.
⚠️ Note: The export-to-PDF feature in WBDataViewer should be Enterprise-only. It uses the `apiResponse_` cached data, so the gate needs to wrap the export action, not the data display:

💠 Pipeline Gate the WBDataViewer export feature to Enterprise ​

The export-to-PDF feature in WBDataViewer should be Enterprise-only. It uses the apiResponse_ cached data, so the gate needs to wrap the export action, not the data display:

💠 Pipeline Democratize a formerly paid feature ​

The basic data view in WBDataViewer was Pro-only but is being moved to Free for engagement:

💠 Pipeline Dry-run before a mass monetization change ​

Before gating an entire directory, preview the impact:


5. Edge cases & refusals ​

TriggerWhat /wbMonetize does
Missing BillingProvider at root⚠️ BillingProvider not found in root App. Gated features will crash at runtime. Add <BillingProvider> first.
File exports multiple functions (ambiguous)❌ Ambiguous export. ExportPanel.vue exports 3 named functions — specify which to gate, or use a default export.
-r on a file that isn't gatedℹ️ BasicView.vue has no tier gate. No changes needed.
-t="premium" (nonexistent tier)❌ Tier 'premium' not found. Available tiers: free, pro, enterprise.
Gating a file that's already gated at a different tierProceeds: updates the tier. [UPGRADE] ExportPanel: pro → enterprise.
--stripe without a configured Stripe key⚠️ No Stripe publishable key found in .env. Stripe checkout will fail at runtime. Configure STRIPE_KEY.

The unifying principle: /wbMonetize connects features to the existing tier system — it doesn't create one. The __WBC_DEV__ 3-mode gating and tierEnforcement.js are the infrastructure; /wbMonetize is the per-feature application layer. It wraps the AST, injects the right imports, and lets the existing enforcement logic do the runtime work.