Getting Started

RepoTrim requires a valid license key to run its concurrent scanning and ast parsing routines. You can acquire a license key directly from our website checkout flow. Once purchased, a license key prefixed with rt_live_ will be emailed to you immediately.

This key must be configured in your environment to authenticate the CLI binary during local execution or automated runs inside your build pipelines.

Environment Configuration

To run RepoTrim in your local terminal, set the environment variable REPOTRIM_LICENSE_KEY before running the executable.

macOS and Linux (Bash/Zsh)

Run the following commands in your shell:

export REPOTRIM_LICENSE_KEY="rt_live_your_actual_key"
./repotrim -dir .

To persist this variable so you don't need to type it in every new session, write it directly to your shell profile configuration:

For Zsh (Default macOS shell):

echo 'export REPOTRIM_LICENSE_KEY="rt_live_your_actual_key"' >> ~/.zshrc
source ~/.zshrc

For Bash (Common Linux shell):

echo 'export REPOTRIM_LICENSE_KEY="rt_live_your_actual_key"' >> ~/.bashrc
source ~/.bashrc

Windows (Command Prompt)

Temporary session setup:

set REPOTRIM_LICENSE_KEY=rt_live_your_actual_key
repotrim.exe -dir .

Windows (PowerShell)

Temporary session setup:

$env:REPOTRIM_LICENSE_KEY="rt_live_your_actual_key"
.\repotrim.exe -dir .

To persist this variable permanently on Windows, execute this command in PowerShell:

[Environment]::SetEnvironmentVariable("REPOTRIM_LICENSE_KEY", "rt_live_your_actual_key", "User")

Pruning & Maintenance

RepoTrim includes advanced execution flags to safely prune unused assets, resolve duplicate files, untrack gitignored files, and remove empty directories.

Dry-Run Mode (Simulation)

Simulate all optimization actions without writing any changes to your files. This is recommended before executing any active pruning operations:

repotrim -dir . -dry-run

Interactive Fix Mode

Run RepoTrim in interactive pruning mode. You will be prompted to confirm each delete or reference replacement individually:

repotrim -dir . -fix

To skip confirmations (e.g. inside automated headless shell scripts), append the -force flag:

repotrim -dir . -fix -force

Auto-Rollback on Verification Failure

To prevent pruning from breaking your project compilation or tests, use the -verify-cmd flag. RepoTrim will execute the verification command after completing fixes. If it fails, all deleted files and reference modifications are automatically restored:

repotrim -dir . -fix -verify-cmd "go test ./..."

Saving Execution Reports

Export the findings and details of the execution (including the exact actions taken during pruning) to a structured JSON file:

repotrim -dir . -report-file report.json

CI/CD Pipeline Integration

Authenticate your build agents automatically by linking your RepoTrim license key into your integration workflows.

GitHub Actions

1. Go to your repository settings -> **Secrets and variables** -> **Actions** -> click **New repository secret**.
2. Set the name to REPOTRIM_LICENSE_KEY and paste your key as the value.
3. Reference the secret in your workflow YAML file:

name: Repository Optimization Check
on: [push]
jobs:
  optimize:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run RepoTrim
        run: repotrim -dir .
        env:
          REPOTRIM_LICENSE_KEY: ${{ secrets.REPOTRIM_LICENSE_KEY }}

GitLab CI/CD

1. Navigate to **Settings** -> **CI/CD** -> **Variables**.
2. Add a new variable named REPOTRIM_LICENSE_KEY with your key.
3. Update your .gitlab-ci.yml file:

repotrim_scan:
  stage: test
  script:
    - repotrim -dir .
  variables:
    REPOTRIM_LICENSE_KEY: $REPOTRIM_LICENSE_KEY

License Key Status Checker

Use the status checker below to test if your license key is currently active and authenticated in our licensing database.

Contacting licensing gateway...
Success: Your license key is valid and active.
Failure: License key not found, expired, or suspended.

Troubleshooting

Error: REPOTRIM_LICENSE_KEY environment variable is not set

The CLI engine could not locate the key in your terminal context. Ensure you have run the export or set commands in the same terminal window where you are executing the binary.

Error: command not found: repotrim (or similar shell errors)

This occurs when the compiled binary is not located in any of the directories defined in your system's $PATH environment variable. You can resolve this by:
• Running the binary locally from its directory using ./repotrim instead of repotrim.
• Placing or compiling the binary directly into a folder in your search path (such as /usr/local/bin or ~/.local/bin on macOS/Linux).

Error: The provided REPOTRIM_LICENSE_KEY is invalid, forbidden, or expired

This message occurs if the key is unrecognized in the verification server, has been suspended, or its subscription term has expired. Use the License Key Status Checker above to check its status, or contact us at contact@innsoftlabs.com if you believe this is in error.

Error: Licensing server unreachable

RepoTrim attempts to connect to the authentication endpoint on startup. Ensure your system has an active internet connection and that outbound traffic to api.repotrim.innsoftlabs.com on port 443 is not blocked by your firewall or VPN.