Repoburg
Login

Customization: Repoburg Variables

Repoburg Variables are a powerful feature that provides a simple key-value store for dynamic values and feature flags. These variables can be managed directly through a quick-access UI and used in any of your Eta templates to make them more powerful and reusable.

Use Cases

  • Feature Flags: Create a variable like PLAN_MODE and set its value to true or false. In your templates, you can use conditional logic to change the AI's instructions based on whether this flag is enabled.
  • Dynamic Values: Store frequently used strings, like file paths or framework names (e.g., TARGET_COMPONENT: 'src/components/MyComponent.tsx'), and reference them in your templates to avoid hardcoding.
  • Workflow Control: Define variables that alter how context is gathered or presented, giving you fine-grained control over the AI's behavior on the fly.

Managing Variables

The primary way to manage variables is through the Variables Modal, designed for quick access and modification.

Accessing the Modal

  • Shortcut: Press the Control key twice in quick succession (double-press Ctrl) anywhere in the application to open the modal.

The Interface

The modal has two modes:

  1. View Mode (Default):

    • This mode is for quick toggling. It displays a list of your variables with their corresponding number.
    • You can press a number key (1, 2, etc.) to instantly toggle the enabled state of the corresponding variable.
    • You can also click the switch next to each variable.
  2. Edit Mode:

    • Click the Edit button to enter management mode.
    • In this mode, you have full CRUD (Create, Read, Update, Delete) capabilities:
      • Create: Click the "Create New Variable" button to open a form for a new variable.
      • Edit: Click the pencil icon next to any variable to modify its key, value, or enabled state.
      • Delete: Click the trash icon to permanently remove a variable.

Using Variables in Templates

All enabled variables are injected into the template rendering context inside the it.VAR object. You can access any variable by its key.

Example: Conditional "Plan Mode"

This example demonstrates how to use a PLAN_MODE variable to instruct the AI to generate a plan without writing code.

1. Create the Variable: Use the modal to create a variable with:

  • Key: PLAN_MODE
  • Value: true
  • Enabled: On

2. Use it in a Context Template:

User Prompt: <%~ it.user_input %> <% if (it.VAR.PLAN_MODE === 'true') { %> --- **AI Directive:** You are in "Plan Mode." Your task is to create a detailed plan. Do not write or modify any code. --- <% } %>

When you use this template and the PLAN_MODE variable is enabled, the special directive will be added to the context. When it's disabled, the block is omitted entirely.

Example: Injecting a Dynamic File Path

1. Create the Variable:

  • Key: MAIN_COMPONENT
  • Value: src/app/page.tsx
  • Enabled: On

2. Use it in a Template:

Analyze the main component for this application, located at `<%~ it.VAR.MAIN_COMPONENT %>`. File Content: <%~ await it.readFile(it.VAR.MAIN_COMPONENT) %>

This makes your templates cleaner and easier to adapt to different projects or contexts.