|
| 1 | +--- |
| 2 | +name: flare |
| 3 | +description: >- |
| 4 | + Manage Flare error tracking using the flare CLI. Use when the user wants to |
| 5 | + list, triage, resolve, snooze, or debug errors; manage projects; check error |
| 6 | + counts; set up Flare in a PHP/Laravel project; or interact with flareapp.io |
| 7 | + from the command line. |
| 8 | +license: MIT |
| 9 | +metadata: |
| 10 | + author: spatie |
| 11 | + version: "0.0.1" |
| 12 | +--- |
| 13 | + |
| 14 | +# Flare CLI |
| 15 | + |
| 16 | +The `flare` CLI lets you manage [Flare](https://flareapp.io) error tracking from the terminal. Every Flare API endpoint has a corresponding command. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +Check that the CLI is installed: |
| 21 | + |
| 22 | +```bash |
| 23 | +flare --version |
| 24 | +``` |
| 25 | + |
| 26 | +If not installed: |
| 27 | + |
| 28 | +```bash |
| 29 | +composer global require spatie/flare-cli |
| 30 | +``` |
| 31 | + |
| 32 | +Ensure Composer's global bin directory is in `PATH`: |
| 33 | + |
| 34 | +```bash |
| 35 | +composer global config bin-dir --absolute |
| 36 | +``` |
| 37 | + |
| 38 | +## Authentication |
| 39 | + |
| 40 | +```bash |
| 41 | +# Log in — you'll be prompted for your API token |
| 42 | +flare login |
| 43 | + |
| 44 | +# Log out |
| 45 | +flare logout |
| 46 | +``` |
| 47 | + |
| 48 | +Get your API token at https://flareapp.io/settings/api-tokens. |
| 49 | + |
| 50 | +If any command returns a 401 error, the token is invalid or expired. Run `flare login` again. |
| 51 | + |
| 52 | +## Quick command reference |
| 53 | + |
| 54 | +All commands output JSON. See [references/commands.md](references/commands.md) for full parameter details. |
| 55 | + |
| 56 | +### User & team |
| 57 | + |
| 58 | +```bash |
| 59 | +# Who am I? |
| 60 | +flare get-authenticated-user |
| 61 | + |
| 62 | +# Get team details (includes members and roles) |
| 63 | +flare get-team --team-id=1 |
| 64 | + |
| 65 | +# Remove a user from a team |
| 66 | +flare remove-team-user --team-id=1 --user-id=42 |
| 67 | +``` |
| 68 | + |
| 69 | +### Projects |
| 70 | + |
| 71 | +```bash |
| 72 | +# List all projects (paginated) |
| 73 | +flare list-projects |
| 74 | + |
| 75 | +# Filter by name or team |
| 76 | +flare list-projects --filter-name="My App" --filter-team-id=1 |
| 77 | + |
| 78 | +# Include team info |
| 79 | +flare list-projects --include=team |
| 80 | + |
| 81 | +# Create a project |
| 82 | +flare create-project --field name="My App" --field team_id=1 --field stage=production --field technology=Laravel |
| 83 | + |
| 84 | +# Delete a project |
| 85 | +flare delete-project --project-id=123 |
| 86 | +``` |
| 87 | + |
| 88 | +### Errors |
| 89 | + |
| 90 | +```bash |
| 91 | +# List errors for a project |
| 92 | +flare list-project-errors --project-id=123 |
| 93 | + |
| 94 | +# Filter by status, class, file, stage, or level |
| 95 | +flare list-project-errors --project-id=123 --filter-status=open --filter-exception-class=RuntimeException |
| 96 | + |
| 97 | +# Sort by most recent |
| 98 | +flare list-project-errors --project-id=123 --sort=-last_seen_at |
| 99 | + |
| 100 | +# Get error counts for a date range |
| 101 | +flare get-project-error-count --project-id=123 --start-date=2025-01-01T00:00:00Z --end-date=2025-01-31T23:59:59Z |
| 102 | + |
| 103 | +# Get occurrence counts for a date range |
| 104 | +flare get-project-error-occurrence-count --project-id=123 --start-date=2025-01-01T00:00:00Z --end-date=2025-01-31T23:59:59Z |
| 105 | +``` |
| 106 | + |
| 107 | +### Error actions |
| 108 | + |
| 109 | +```bash |
| 110 | +# Resolve an error |
| 111 | +flare resolve-error --error-id=456 |
| 112 | + |
| 113 | +# Reopen a resolved error |
| 114 | +flare unresolve-error --error-id=456 |
| 115 | + |
| 116 | +# Snooze forever |
| 117 | +flare snooze-error --error-id=456 --field snooze_type=snooze_forever |
| 118 | + |
| 119 | +# Snooze until a date |
| 120 | +flare snooze-error --error-id=456 --field snooze_type=snooze_until --field snooze_until=2025-06-01T00:00:00Z |
| 121 | + |
| 122 | +# Snooze for N more occurrences |
| 123 | +flare snooze-error --error-id=456 --field snooze_type=snooze_number_of_occurrences --field snooze_number_of_occurrences=50 |
| 124 | + |
| 125 | +# Unsnooze |
| 126 | +flare unsnooze-error --error-id=456 |
| 127 | +``` |
| 128 | + |
| 129 | +### Occurrences |
| 130 | + |
| 131 | +```bash |
| 132 | +# List occurrences for an error (includes frames, attributes, events, solutions) |
| 133 | +flare list-error-occurrences --error-id=456 |
| 134 | + |
| 135 | +# Sort oldest first |
| 136 | +flare list-error-occurrences --error-id=456 --sort=received_at |
| 137 | + |
| 138 | +# Get a single occurrence by ID |
| 139 | +flare get-error-occurrence --occurrence-id=789 |
| 140 | +``` |
| 141 | + |
| 142 | +### Pagination |
| 143 | + |
| 144 | +All list commands support pagination: |
| 145 | + |
| 146 | +```bash |
| 147 | +flare list-project-errors --project-id=123 --page-number=2 --page-size=20 |
| 148 | +``` |
| 149 | + |
| 150 | +Response includes `meta` (current_page, total, last_page) and `links` (next/prev URLs). |
| 151 | + |
| 152 | +## Common workflows |
| 153 | + |
| 154 | +### Error triage |
| 155 | + |
| 156 | +List open errors, categorize by exception class, resolve or snooze in batches. See [references/workflows.md](references/workflows.md) for the full triage workflow. |
| 157 | + |
| 158 | +Quick version: |
| 159 | + |
| 160 | +```bash |
| 161 | +# 1. List open errors sorted by most recent |
| 162 | +flare list-project-errors --project-id=123 --filter-status=open --sort=-last_seen_at |
| 163 | + |
| 164 | +# 2. Review each error, resolve fixed ones |
| 165 | +flare resolve-error --error-id=456 |
| 166 | + |
| 167 | +# 3. Snooze noisy but non-critical errors |
| 168 | +flare snooze-error --error-id=789 --field snooze_type=snooze_forever |
| 169 | +``` |
| 170 | + |
| 171 | +### Debug an error with local code |
| 172 | + |
| 173 | +Fetch an occurrence, find application frames, then read the corresponding local files. See [references/workflows.md](references/workflows.md) for detailed steps. |
| 174 | + |
| 175 | +Quick version: |
| 176 | + |
| 177 | +```bash |
| 178 | +# 1. Get the latest occurrence |
| 179 | +flare list-error-occurrences --error-id=456 --sort=-received_at --page-size=1 |
| 180 | + |
| 181 | +# 2. Look at the frames where application_frame=true |
| 182 | +# 3. Read the local file at the reported line number |
| 183 | +# 4. Check attributes for request context, events for log trail, solutions for fixes |
| 184 | +``` |
| 185 | + |
| 186 | +### Set up Flare in a project |
| 187 | + |
| 188 | +Install `spatie/laravel-flare`, configure the API key, and verify via CLI. See [references/workflows.md](references/workflows.md) for the full setup guide. |
| 189 | + |
| 190 | +## Output format |
| 191 | + |
| 192 | +All commands return JSON. When presenting results to the user: |
| 193 | + |
| 194 | +- **Errors**: Show as a table with columns: ID, exception class, message (truncated), status, occurrence count, last seen. Always include the `latest_occurrence_url_on_flare` link. |
| 195 | +- **Occurrences**: Highlight application frames (where `application_frame` is `true`) — these are the user's code, not vendor code. Show the `relative_file` and `line_number`. |
| 196 | +- **Solutions**: If `solutions` is non-empty, always present them prominently — they contain actionable fix suggestions. |
| 197 | +- **Attributes**: Group by the `group` field (e.g., request, user, environment) when displaying context. |
| 198 | +- **Events**: Show chronologically — they represent the execution trail leading to the error (queries, logs, jobs, etc.). |
| 199 | +- **Flare URLs**: Include `latest_occurrence_url_on_flare` so the user can view the full error in the Flare dashboard. |
0 commit comments