📚 MicroRapid CLI Commands Reference

📋 Complete Command Reference

Core Commands

CommandPurposeExample
initCreate new project from OpenAPI spectiefrun init my-api --from-url https://api.example.com/openapi.yaml
validateValidate OpenAPI specificationtiefrun validate api-spec.json --strict
exploreDeep search across API spectiefrun explore payment
envManage environmentstiefrun env list
listDiscover available operationstiefrun list --filter user --method POST
authManage authenticationtiefrun auth detect --spec api.yaml
showView operation detailstiefrun show repos/get
runExecute an API operationtiefrun run GetUser --param id=123 --env prod --profile api-key
doctorDiagnose configuration issuestiefrun doctor --fix
genGenerate code/SDKs/fixturestiefrun gen sdk --language typescript
testRun API teststiefrun test api.yaml --all --env staging
diffCompare API specifications (coming soon)—

Collection Commands

CommandPurposeExample
collection runExecute collectiontiefrun collection run smoke-tests --env prod
collection listShow all collectionstiefrun collection list
collection showShow collection detailstiefrun collection show user-onboarding
collection validateValidate collection syntaxtiefrun collection validate my-tests
collection testRun collection as teststiefrun collection test smoke-tests --env staging

Authentication Commands

CommandPurposeExample
auth detectDetect required authenticationtiefrun auth detect --spec api.yaml
auth connectConfigure authenticationtiefrun auth connect api-key
auth loginLogin to OAuth providertiefrun auth login github
auth testTest authenticationtiefrun auth test --profile github-main
auth validateValidate auth configurationtiefrun auth validate --profile production
auth refreshRefresh OAuth tokenstiefrun auth refresh --profile oauth-prod

Environment Commands

CommandPurposeExample
env listList all environmentstiefrun env list
env createCreate new environmenttiefrun env create qa --base-url https://qa.api.com
env showShow environment detailstiefrun env show production

There is no env use. Select an environment per command with the global --env <name> flag (e.g. tiefrun run GetUser --env staging).


🎯 Command Options Reference

init Command Options

tiefrun init <project-name> [options]
OptionDescriptionExample
--from-url <url>Initialize from URL--from-url https://api.example.com/openapi.json
--from-file <file>Initialize from local file--from-file ./openapi.yaml
--template <type>Project template (minimal, rest, graphql)--template rest
--forceOverwrite existing directory--force
--allow-insecureAllow insecure HTTP connections--allow-insecure

list Command Options

tiefrun list [options]
OptionDescriptionExample
--filter/-f <keyword>Search operations by keyword--filter user
--method/-m <METHOD>Filter by HTTP method--method POST
--limit <n>Limit results--limit 10
--format <type>Output format (table, json, simple)--format json

run Command Options

tiefrun run <operation> [options]
OptionDescriptionExample
--param <key=value>Set parameter value--param id=123
--env <environment>Use specific environment--env production
--profile <profile>Use auth profile--profile github-main
--file <file>Request body from file--file request.json
-iInteractive mode-i
--minimalMinimal template (with -i)-i --minimal
--fullFull template (with -i)-i --full
--dry-runPreview without executing--dry-run
--as-curlShow as curl command--as-curl
--verboseDetailed output--verbose
--save-to-collectionSave successful request--save-to-collection
--save-as <name>Save with specific name--save-as user-fetch
--timeout <ms>Request timeout--timeout 5000
--retry <n>Number of retries--retry 3
--traceTrace HTTP traffic--trace
--replay-lastReplay last query--replay-last
--query-file <file>Use query file--query-file query.json
--help-queryShow query syntax help--help-query
--build-queryInteractive query builder--build-query
--json-output/-oOutput response as JSON--json-output
--auth <string>Direct auth (not recommended)--auth "Bearer token"

validate Command Options

tiefrun validate <spec-file> [options]
OptionDescriptionExample
--strictTreat warnings as errors--strict
--lintCheck for best practices--lint
--rules <file>Custom linting rules--rules api-rules.yaml
--format <type>Output format (text, json)--format json

doctor Command Options

tiefrun doctor [options]
OptionDescriptionExample
--fixAuto-fix issues--fix
--check <area>Check specific area--check auth
--env <environment>Check specific environment--env production
--quietQuiet mode--quiet
--format <type>Output format (text, json)--format json

Check areas:

  • config - Configuration files
  • auth - Authentication setup
  • spec - OpenAPI specification
  • env - Environment variables

diff Command Options — Coming Soon

diff is not yet implemented and will be available in a future release.

tiefrun diff <old-spec> <new-spec> [options]
OptionDescriptionExample
--breaking-onlyShow only breaking changes--breaking-only
--fail-on-breakingExit with error on breaking changes--fail-on-breaking
--format <type>Output format (text, json, markdown)--format markdown
--quietSuppress output--quiet

gen Command Options

tiefrun gen <type> [options]

Generation Types:

TypeDescriptionExample
sdkGenerate SDK clienttiefrun gen sdk --language typescript
snippetsGenerate code examplestiefrun gen snippets --format curl
stubsGenerate server stubstiefrun gen stubs --framework express
fixturesGenerate test datatiefrun gen fixtures --count 100

Common Options:

OptionDescriptionExample
--language <lang>Target language--language python
--output <dir>Output directory--output ./sdk
--package-name <name>Package name--package-name @company/api
--with-docsInclude documentation--with-docs
--with-testsInclude tests--with-tests
--with-examplesInclude examples--with-examples
--framework <name>Server framework--framework fastapi
--count <n>Number of fixtures--count 50
--seed <n>Random seed--seed 42
--format <type>Output format--format yaml

collection Command Options

tiefrun collection <subcommand> [options]

collection run Options:

OptionDescriptionExample
--env <environment>Use environment--env staging
--profile <profile>Use auth profile--profile api-key
--var <key=value>Set variable--var userId=123
--fail-fastStop on first failure--fail-fast
--report <format>Report format (junit, json)--report junit

collection test Options:

OptionDescriptionExample
--env <environment>Use environment--env staging
--profile <profile>Use auth profile--profile qa-creds
--fail-fastStop on first failure--fail-fast
--report <format>Test report format--report junit

📖 Complete Examples

Basic API Execution

# Simple GET request
tiefrun run GetUser --param id=123

# With environment and authentication
tiefrun run GetUser \
  --param id=123 \
  --env production \
  --profile api-key-prod

# POST with file and save to collection
tiefrun run CreateUser \
  --file user-data.json \
  --env staging \
  --profile oauth-staging \
  --save-to-collection

Working with GitHub API

# Initialize GitHub API project
tiefrun init github-api \
  --from-url https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json

# List repository operations
tiefrun list --filter repo --method POST

# Get repository details
tiefrun run repos/get \
  --param owner=microsoft \
  --param repo=vscode \
  --env production \
  --profile github-main

# Create repository with interactive mode
tiefrun run repos/create-for-user -i
# Edit the generated template, then:
tiefrun run repos/create-for-user \
  --file create_repo_request.json \
  --env production \
  --profile github-main \
  --save-to-collection

Authentication Setup

# Detect required authentication
tiefrun auth detect --spec api.yaml

# Configure API key authentication
tiefrun auth connect api-key

# Login to GitHub OAuth
tiefrun auth login github

# Test authentication profile
tiefrun auth test --profile github-main

# Validate production credentials
tiefrun auth validate --profile production

Environment Management

# List all environments
tiefrun env list

# Create QA environment
tiefrun env create qa --base-url https://qa-api.example.com

# Select an environment per command with --env (there is no `env use`)
tiefrun run GetUser --env staging

# Show environment details
tiefrun env show production

Collection Management

# Create a collection by saving a request to it (there is no `collection create`)
tiefrun run GetUser --save-to-collection --collection smoke-tests

# Validate collection syntax
tiefrun collection validate smoke-tests

# Run collection with variables
tiefrun collection run user-onboarding \
  --env staging \
  --var email="test@example.com" \
  --var username="testuser"

# Run as tests with report
tiefrun collection test regression-suite \
  --env staging \
  --report junit > test-results.xml

API Validation and Testing

# Validate OpenAPI spec
tiefrun validate api-spec.yaml --strict --lint

# Run all tests
tiefrun test api.yaml --all --env staging

# Diagnose issues
tiefrun doctor --env production --fix

Code Generation

# Generate TypeScript SDK
tiefrun gen sdk \
  --language typescript \
  --output ./sdk/typescript \
  --package-name "@company/api-client" \
  --with-docs \
  --with-tests

# Generate test fixtures
tiefrun gen fixtures \
  --count 100 \
  --seed 42 \
  --output ./test-data

# Generate curl examples
tiefrun gen snippets \
  --format curl \
  --output ./docs/examples

Advanced Query Building

# Interactive query builder
tiefrun run searchProducts --build-query

# Complex query with filters
tiefrun run searchProducts \
  --param q="category:electronics price:>100" \
  --param sort="price:asc" \
  --param page=1 \
  --param limit=20 \
  --env production \
  --profile api-key

# Use query file
cat > query.json << EOF
{
  "filter": "status = 'active' and created >= '2024-01-01'",
  "sort": "created:desc",
  "page": 1,
  "limit": 50
}
EOF

tiefrun run listItems --query-file query.json

Debugging and Development

# Preview request without sending
tiefrun run DeleteUser \
  --param id=123 \
  --dry-run

# Show as curl command
tiefrun run DeleteUser \
  --param id=123 \
  --as-curl

# Trace HTTP traffic
tiefrun run GetUser \
  --param id=123 \
  --trace \
  --verbose

# Replay last successful request
tiefrun run GetUser --replay-last

🎓 Pro Tips

1. Use Environment-Specific Configs

# Development with verbose output
tiefrun run GetUser --env dev --verbose

# Production with specific profile
tiefrun run GetUser --env prod --profile prod-readonly

2. Chain Operations with Collections

# .tiefrun/collections/user_flow.yaml
requests:
  - name: Create User
    operation: CreateUser
    save_as: user
  
  - name: Add Payment Method
    operation: AddPaymentMethod
    params:
      user_id: "{{ user.id }}"
    depends_on: ["Create User"]

3. Interactive Mode for Complex Requests

# Generate minimal template
tiefrun run ComplexOperation -i --minimal

# Generate full template with all fields
tiefrun run ComplexOperation -i --full

4. Always Validate Before Production

# Dry run first
tiefrun run DeleteUser --param id=123 --dry-run

# Check as curl
tiefrun run DeleteUser --param id=123 --as-curl

5. Set Up Proper Authentication Profiles

# Create profile for each environment
cat > .tiefrun/auth/prod.toml << EOF
[profile]
name = "production"
type = "bearer"

[auth]
token_env = "PROD_API_TOKEN"
EOF

# Use environment-specific profiles
tiefrun run GetUser --env production --profile prod

🔗 Supported Formats

Universal API Specification Support

  • ✅ Swagger 2.0 - Classic format, widely used
  • ✅ OpenAPI 3.0 - Modern standard with rich features
  • ✅ OpenAPI 3.1 - Latest version with JSON Schema compatibility
  • ✅ JSON and YAML - Both file formats supported
  • ✅ Local files and URLs - Load from disk or internet

🚀 Next Steps

Ready to start using MicroRapid?

Begin by initializing your first API project:

tiefrun init your-api --from-url https://your-api.com/openapi.json

Need help? Check our Quick Start Guide or Documentation.