{"id":30208996,"url":"https://github.com/skierkowski/req","last_synced_at":"2025-08-13T18:28:25.939Z","repository":{"id":303315028,"uuid":"1014013886","full_name":"skierkowski/req","owner":"skierkowski","description":"A lightweight CLI HTTP Client with variables, stages, and saved requests","archived":false,"fork":false,"pushed_at":"2025-07-10T00:15:08.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T10:45:06.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skierkowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-04T21:59:45.000Z","updated_at":"2025-07-10T00:15:12.000Z","dependencies_parsed_at":"2025-07-07T01:08:02.886Z","dependency_job_id":"d1d01a6a-61cc-4d8a-be5e-e07a0d407a0f","html_url":"https://github.com/skierkowski/req","commit_stats":null,"previous_names":["skierkowski/reqed","skierkowski/req"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skierkowski/req","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skierkowski%2Freq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skierkowski%2Freq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skierkowski%2Freq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skierkowski%2Freq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skierkowski","download_url":"https://codeload.github.com/skierkowski/req/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skierkowski%2Freq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270287659,"owners_count":24558630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-13T18:28:17.503Z","updated_at":"2025-08-13T18:28:25.875Z","avatar_url":"https://github.com/skierkowski.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# req - Configuration-Driven HTTP CLI Tool\n\nA powerful command-line tool that dynamically creates commands based on YAML configuration files to make HTTP requests. Perfect for API testing, automation, and development workflows.\n\n## ✨ Features\n\n- 🚀 **Dynamic Commands**: Generate CLI commands from YAML configuration\n- 🔧 **Multi-Stage Support**: Different configurations for dev, staging, prod, etc.\n- 📝 **Variable Substitution**: Use Mustache templates with environment variables, stage variables, and CLI parameters\n- 🎯 **JSONPath Extraction**: Extract specific values from API responses\n- 📊 **Verbose Mode**: Detailed request/response debugging\n- 🔐 **Environment Integration**: Seamlessly work with `.env` files\n\n## 🚀 Installation\n\n```bash\n# Install globally\nnpm install -g @skierkowski/req\n\n# Or use with npx (no installation required)\nnpx @skierkowski/req --help\n```\n\n## 📋 Quick Start\n\n1. **Create a `req.yaml` configuration file:**\n\n```yaml\n# Example API calls\nusers:\n  url: https://jsonplaceholder.typicode.com/users\n  method: GET\n  value: '$[0].name' # Extract first user's name\n\ncreate-user:\n  url: https://jsonplaceholder.typicode.com/users\n  method: POST\n  params:\n    - name\n    - email\n  body:\n    name: '{{name}}'\n    email: '{{email}}'\n    website: '{{name}}.dev'\n  value: '$.id' # Extract the created user's ID\n\n# Multi-stage configuration\nstages:\n  dev:\n    base_url: https://api-dev.example.com\n    api_key: dev-key-123\n  prod:\n    base_url: https://api.example.com\n    api_key: prod-key-456\n\napi-status:\n  url: '{{base_url}}/status'\n  headers:\n    Authorization: 'Bearer {{api_key}}'\n```\n\n2. **Run your commands:**\n\n```bash\n# Basic usage\nreq users\n\n# With parameters\nreq create-user --name \"John Doe\" --email \"john@example.com\"\n\n# Using different stages\nreq api-status --stage prod\n\n# Verbose mode for debugging\nreq users --verbose\n```\n\n## 📖 Usage\n\n### Command Syntax\n\n```bash\nreq [options] \u003ccommand\u003e [command-options]\n```\n\n### Global Options\n\n- `-c, --config \u003cfile\u003e`: Config file path (default: `req.yaml`)\n- `-v, --verbose`: Show detailed request/response information\n- `-s, --stage \u003cname\u003e`: Stage to use for variables (default: `default`)\n- `--help`: Show help information\n\n### Configuration File Structure\n\n```yaml\n# Command definitions\ncommand-name:\n  url: 'https://api.example.com/endpoint'\n  method: GET | POST | PUT | DELETE | PATCH # Default: GET\n  headers:\n    Content-Type: 'application/json'\n    Authorization: 'Bearer {{token}}'\n  body:\n    key: '{{value}}'\n  params: # CLI parameters this command accepts\n    - param1\n    - param2\n  value: '$.path.to.extract' # JSONPath for response extraction\n\n# Stage-specific variables\nstages:\n  stage-name:\n    variable1: 'value1'\n    variable2: 'value2'\n```\n\n## 🎯 Examples\n\n### 1. Simple API Call\n\n```yaml\n# req.yaml\nweather:\n  url: \"https://api.openweathermap.org/data/2.5/weather\"\n  params:\n    - city\n    - units\n  url: \"https://api.openweathermap.org/data/2.5/weather?q={{city}}\u0026appid={{API_KEY}}\u0026units={{units}}\"\n  value: \"$.weather[0].description\"\n```\n\n```bash\n# Set API key in environment\nexport API_KEY=your-api-key\n\n# Get weather\nreq weather --city \"London\" --units \"metric\"\n# Output: \"scattered clouds\"\n```\n\n### 2. Multi-Stage API Testing\n\n```yaml\n# req.yaml\nstages:\n  dev:\n    base_url: https://api-dev.company.com\n    auth_token: dev-token-123\n  staging:\n    base_url: https://api-staging.company.com\n    auth_token: staging-token-456\n  prod:\n    base_url: https://api.company.com\n    auth_token: prod-token-789\n\nhealth-check:\n  url: '{{base_url}}/health'\n  headers:\n    Authorization: 'Bearer {{auth_token}}'\n  value: '$.status'\n\ncreate-resource:\n  url: '{{base_url}}/resources'\n  method: POST\n  params:\n    - name\n    - type\n  headers:\n    Authorization: 'Bearer {{auth_token}}'\n  body:\n    name: '{{name}}'\n    type: '{{type}}'\n    timestamp: '{{timestamp}}'\n  value: '$.id'\n```\n\n```bash\n# Test different environments\nreq health-check --stage dev\nreq health-check --stage prod\n\n# Create resources in different stages\nreq create-resource --stage dev --name \"test-resource\" --type \"widget\"\n```\n\n### 3. Complex API Workflow\n\n```yaml\n# req.yaml\nstages:\n  default:\n    github_token: '{{GITHUB_TOKEN}}'\n    repo_owner: 'octocat'\n    repo_name: 'Hello-World'\n\nlist-issues:\n  url: 'https://api.github.com/repos/{{repo_owner}}/{{repo_name}}/issues'\n  headers:\n    Authorization: 'token {{github_token}}'\n    Accept: 'application/vnd.github.v3+json'\n  value: '$[*].title'\n\ncreate-issue:\n  url: 'https://api.github.com/repos/{{repo_owner}}/{{repo_name}}/issues'\n  method: POST\n  params:\n    - title\n    - body\n  headers:\n    Authorization: 'token {{github_token}}'\n    Accept: 'application/vnd.github.v3+json'\n  body:\n    title: '{{title}}'\n    body: '{{body}}'\n  value: '$.number'\n\nget-issue:\n  url: 'https://api.github.com/repos/{{repo_owner}}/{{repo_name}}/issues/{{issue_number}}'\n  params:\n    - issue_number\n  headers:\n    Authorization: 'token {{github_token}}'\n  value: '$.state'\n```\n\n```bash\n# Set GitHub token\nexport GITHUB_TOKEN=your-github-token\n\n# List all issue titles\nreq list-issues\n\n# Create a new issue\nreq create-issue --title \"Bug Report\" --body \"Description of the bug\"\n\n# Check issue status\nreq get-issue --issue_number 42\n```\n\n## 🔧 Advanced Features\n\n### Variable Precedence\n\nVariables are resolved in the following order (highest to lowest priority):\n\n1. **CLI Parameters**: `--param value`\n2. **Stage Variables**: Defined in `stages` section\n3. **Environment Variables**: From `.env` file or system environment\n\n### JSONPath Extraction\n\nUse JSONPath expressions to extract specific values from API responses:\n\n```yaml\n# Extract single value\nvalue: \"$.user.name\"\n\n# Extract from array\nvalue: \"$[0].id\"\n\n# Extract all items\nvalue: \"$[*].title\"\n\n# Complex path\nvalue: \"$.data.users[?(@.active)].email\"\n```\n\n### Error Handling\n\nThe tool automatically:\n\n- Exits with error code 1 on HTTP errors\n- Shows detailed error messages in verbose mode\n- Validates required configuration fields\n\n### Custom Configuration Files\n\n```bash\n# Use custom config file\nreq --config api-config.yaml command-name\n\n# Use different config for different projects\nreq --config ./configs/dev.yaml users --verbose\n```\n\n## 📝 License\n\nMIT License - see LICENSE file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📞 Support\n\n- 🐛 **Issues**: [GitHub Issues](https://github.com/skierkowski/req/issues)\n- 🐦 **Twitter**: [@skierkowski](https://twitter.com/skierkowski)\n\n---\n\nMade with ❤️ by [skierkowski](https://github.com/skierkowski)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskierkowski%2Freq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskierkowski%2Freq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskierkowski%2Freq/lists"}