|
| 1 | +--- |
| 2 | +name: remote-cli |
| 3 | +description: Use when the user asks you to perform any Remote.com HR action — create or list time off, manage expenses (approve/decline/download receipts), list or create employments, download payslips, submit terminations — via the ./remote CLI tool in this project. Also triggers when asked to look up leave balance, employment status, or company info through the CLI. |
| 4 | +--- |
| 5 | + |
| 6 | +# Using the Remote CLI |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +`./remote` is the built binary for this project. Build it with `go build -o remote .` if the binary is missing or stale after code changes. |
| 11 | + |
| 12 | +Requires three environment variables: |
| 13 | +```bash |
| 14 | +export REMOTE_BASE_URL=https://gateway.remote.com/api/eor |
| 15 | +export REMOTE_CLIENT_ID=<your_client_id> |
| 16 | +export REMOTE_CLIENT_SECRET=<your_client_secret> |
| 17 | +``` |
| 18 | + |
| 19 | +An **active company** must be selected before most commands: |
| 20 | +```bash |
| 21 | +./remote companies list # see what's saved |
| 22 | +./remote use # interactively pick the active one |
| 23 | +``` |
| 24 | + |
| 25 | +## Non-Interactive Usage |
| 26 | + |
| 27 | +Every command that normally prompts can be driven entirely with flags — always prefer flags when acting autonomously. See `references/commands.md` for every flag per command. |
| 28 | + |
| 29 | +## Quick Command Reference |
| 30 | + |
| 31 | +| Command | What it does | Key flags | |
| 32 | +|---------|-------------|-----------| |
| 33 | +| `login` | Authenticate via browser (PKCE) | — | |
| 34 | +| `use` | Pick active company (interactive) | — | |
| 35 | +| `me` | Show current identity | — | |
| 36 | +| `companies list` | List saved companies | `--pretty` | |
| 37 | +| `companies create` | Create a company | — | |
| 38 | +| `employments list` | List employments | `--status`, `--email`, `--all` | |
| 39 | +| `employments create` | Onboard a new employee | `--country` | |
| 40 | +| `employments show <id>` | Get a single employment | — | |
| 41 | +| `expenses list` | List expenses | `--employment-id`, `--pretty` | |
| 42 | +| `expenses create` | Submit an expense | `--employment-id`, `--amount`, `--currency`, `--expense-date` | |
| 43 | +| `expenses approve` | Approve a pending expense | `--expense-id` | |
| 44 | +| `expenses decline` | Decline a pending expense | `--expense-id`, `--reason` | |
| 45 | +| `expenses download-receipt` | Download a receipt file | `--expense-id`, `--out-file` | |
| 46 | +| `payslips list` | List payslips | `--employment-id`, `--start-date`, `--end-date` | |
| 47 | +| `payslips download` | Download a payslip PDF | `--payslip-id`, `--out-file` | |
| 48 | +| `time-off policies` | List leave policies | `--employment-id` | |
| 49 | +| `time-off balance` | Show leave balance | `--employment-id` | |
| 50 | +| `time-off create` | Create approved time off | `--employment-id`, `--timeoff-type`, `--start-date`, `--end-date` | |
| 51 | +| `time-off list` | List time off records | `--employment-id`, `--status` | |
| 52 | +| `time-off approve` | Approve a requested time off | `--timeoff-id` | |
| 53 | +| `time-off cancel` | Cancel approved time off | `--timeoff-id`, `--reason` | |
| 54 | +| `time-off decline` | Decline a requested time off | `--timeoff-id`, `--reason` | |
| 55 | +| `terminations list` | List terminations | `--employment-id`, `--type` | |
| 56 | +| `terminations create` | Submit a termination request | `--employment-id` | |
| 57 | + |
| 58 | +## Common Workflows |
| 59 | + |
| 60 | +**Create time off for an employee:** |
| 61 | +```bash |
| 62 | +./remote time-off create \ |
| 63 | + --employment-id emp_abc123 \ |
| 64 | + --timeoff-type time_off \ |
| 65 | + --start-date 2026-05-09 \ |
| 66 | + --end-date 2026-05-09 |
| 67 | +``` |
| 68 | +Common types: `time_off`, `sick_leave`, `paid_time_off`, `public_holiday`, `unpaid_leave`, `maternity_leave`, `paternity_leave`, `bereavement`. Full list in `references/commands.md`. |
| 69 | + |
| 70 | +**List active employments:** |
| 71 | +```bash |
| 72 | +./remote employments list --status active --pretty |
| 73 | +``` |
| 74 | + |
| 75 | +**Approve a pending expense:** |
| 76 | +```bash |
| 77 | +./remote expenses approve --expense-id exp_xyz789 |
| 78 | +``` |
| 79 | + |
| 80 | +**Download the latest payslip for an employment:** |
| 81 | +```bash |
| 82 | +./remote payslips list --employment-id emp_abc123 --pretty |
| 83 | +./remote payslips download --payslip-id <id> --out-file ./payslip.pdf |
| 84 | +``` |
| 85 | + |
| 86 | +**Check an employee's leave balance:** |
| 87 | +```bash |
| 88 | +./remote time-off balance --employment-id emp_abc123 --pretty |
| 89 | +``` |
| 90 | + |
| 91 | +## Output Control |
| 92 | + |
| 93 | +```bash |
| 94 | +./remote <cmd> # JSON output (default) |
| 95 | +./remote <cmd> --pretty # human-readable table |
| 96 | +./remote <cmd> --all # fetch all pages (list commands; default page-size: 100) |
| 97 | +``` |
| 98 | + |
| 99 | +## Role Restrictions |
| 100 | + |
| 101 | +These operations require a **company manager token** and fail with employee tokens: |
| 102 | +- `expenses create / approve / decline` |
| 103 | +- `time-off create / approve / decline` |
| 104 | +- `terminations create` |
| 105 | + |
| 106 | +Employee tokens use different endpoints (`/v1/employee/...`) and expose a read-only subset. |
| 107 | + |
| 108 | +## Constraints to Know |
| 109 | + |
| 110 | +- `expenses create --expense-date` must be **today or in the past** — future dates are rejected by the API. |
| 111 | +- File uploads (receipts, termination docs): PDF/DOC/DOCX only, max 10 MB each, max 5 files. |
| 112 | + |
| 113 | +## Full Reference |
| 114 | + |
| 115 | +See `references/commands.md` for every flag, valid enum values, and pagination options for each command. |
0 commit comments