wiq-cli 0.4.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,16 @@
1
1
  ---
2
2
  name: wiq
3
- description: Use this skill when the user asks about their WrestlingIQ data — rosters, attendance, check-ins, paid sessions and registrations, the prospects/leads pipeline, financial metrics, reports, USAW/AAU memberships, fundraising, online store orders, or per-location/site breakdowns for multi-gym clubs. The `wiq` CLI provides read-only access to /api/v1 via personal access tokens. Recognize phrasings like "how is our pipeline?", "who came to practice this week?", "show me the roster", "what's our MRR?", "which kids need USAW renewal?", "how is the Eastside gym doing?", or anything that maps to a wrestling club's admin workflows.
3
+ description: Use this skill when the user asks about their WrestlingIQ data — rosters, attendance, check-ins, paid sessions and registrations, the prospects/leads pipeline, financial metrics, payouts/bank deposits, reports, USAW/AAU memberships, fundraising, online store orders, or per-location/site breakdowns for multi-gym clubs. The `wiq` CLI reads /api/v1 via personal access tokens and, when the token carries the prospects:write scope, can also create/edit leads, log contact notes, and advance prospects through the pipeline. Recognize phrasings like "how is our pipeline?", "who came to practice this week?", "show me the roster", "what's our MRR?", "which kids need USAW renewal?", "how is the Eastside gym doing?", or anything that maps to a wrestling club's admin workflows.
4
4
  ---
5
5
 
6
6
  # WrestlingIQ CLI Skill
7
7
 
8
- `wiq` is a read-only Ruby CLI for WrestlingIQ data, designed to be driven
9
- by both humans and AI agents. It hits `/api/v1` using per-user personal
10
- access tokens (PATs). This skill orients you to its shape; the CLI itself
11
- is the source of truth for what's available right now.
8
+ `wiq` is a Ruby CLI for WrestlingIQ data, designed to be driven by both
9
+ humans and AI agents. It hits `/api/v1` using per-user personal access
10
+ tokens (PATs). Every token can read; a token additionally minted with a
11
+ write scope (see "Writes" below) can create and edit leads. This skill
12
+ orients you to its shape; the CLI itself is the source of truth for
13
+ what's available right now.
12
14
 
13
15
  ## Bootstrap (always do this first)
14
16
 
@@ -49,9 +51,17 @@ per situation.
49
51
  CoachProfile + ParentProfile on different teams mints a separate token
50
52
  per role. The CLI does not switch profiles at runtime.
51
53
  - **Everything is gated by the bound profile's permissions.** Parent or
52
- wrestler PATs cannot run reports (`enforce_pat_restrictions` returns 403
53
- with body `"Personal access tokens are read-only..."` — reports is the
54
- one write currently on the PAT allowlist).
54
+ wrestler PATs cannot run reports or touch prospects (Pundit requires a
55
+ CoachProfile on the team).
56
+ - **Writes need a capability on BOTH the team and the token.** Reads are
57
+ implicit for every token. A write (`POST`/`PATCH`) succeeds only when it
58
+ maps to a capability in the server's registry (`prospects:write`,
59
+ `reports:write`) that a team admin has enabled under Settings → API
60
+ Access AND that the token was minted with. Token scopes are immutable:
61
+ to add one, revoke + mint a new token, then `wiq auth login --force`.
62
+ `wiq auth status` / `wiq doctor` show the live scopes — check them
63
+ before attempting a write. `reports:write` was backfilled onto every
64
+ existing team and token, so report submission keeps working.
55
65
  - **The 9 finance reports require `admin?`.** They're flagged
56
66
  `admin_only: true` in `wiq reports types`. Workflows that submit them
57
67
  carry the same flag. Non-admin coach PATs 403 on these.
@@ -106,8 +116,12 @@ Common codes and the right response:
106
116
  | `alias_not_found` | `--as` named a slot that doesn't exist | Check `wiq auth list` |
107
117
  | `unauthorized` (401) | Token rejected by server | Re-login; could be revoked |
108
118
  | `forbidden` (403) | Pundit denial (often admin gate on a finance report) | Check the report's `admin_only:` flag in `wiq reports types` |
119
+ | `capability_disabled_for_team` (403) | Team hasn't enabled the write capability named in the message | Ask a team admin to enable it at `<host>/settings/team/api_access`; nothing to change on the token |
120
+ | `token_missing_scope` (403) | Team allows the write, but this token was minted without the scope | Mint a new token WITH the scope, `wiq auth login --force`; scopes can't be edited in place |
121
+ | `pat_write_unsupported` (403) | Endpoint has no API write capability at all | Use the WIQ web app; not a permissions problem |
109
122
  | `not_found` (404) | Resource doesn't exist for this profile | Confirm the id; cross-team enumeration returns 404 to avoid leaking existence |
110
123
  | `validation_failed` (422) | Server-side input rejection | Read `details` for per-field messages |
124
+ | `stage_transition_refused` (422) | PAT tried to move a prospect backwards or out of a terminal stage | Don't retry; tell the user a coach must make that move in the web app |
111
125
  | `rate_limited` (429) | 100 req / 3 sec per IP exceeded | Back off |
112
126
  | `season_not_found` | `--season <year>` matched zero paid sessions | `wiq paid_sessions list` to see configured periods |
113
127
  | `report_failed` | The report ran but errored server-side | Inspect `details` (the report's result jsonb) |
@@ -181,6 +195,14 @@ Key reports an agent should know by heart:
181
195
  while?"
182
196
  - **`PaidSessionAccountingReport`** (admin_only) — Line-item charges for
183
197
  a paid session.
198
+ - **`SessionRegistrationAnswerReport`** — Signup Q&A for one
199
+ `--paid-session <id>`, one row per wrestler. Rows lead with **"WIQ ID
200
+ #"** (wrestler_profile id, identical to RosterReport's first column, so
201
+ the two join on it), **"Registration ID"** (the stable key to hand an
202
+ external sync), "Registration status", "Good standing", "Registered
203
+ at", "Registration updated at", "Registration canceled at" — then the
204
+ name/DOB/USAW/AAU columns and every registration question. Use this,
205
+ not name+DOB matching, when a customer syncs registrations elsewhere.
184
206
 
185
207
  For anything else, `wiq reports types` is faster than guessing.
186
208
 
@@ -284,6 +306,25 @@ charge for the same `(billing_profile_id, chargeable_id,
284
306
  chargeable_type)` tuple exists AFTER the failure's `created_at`. The
285
307
  canonical pattern is in `wiq workflows show failed-payments-recent`.
286
308
 
309
+ ### Payouts (bank deposits)
310
+
311
+ For "when does our money hit the bank?" / "what deposited last week?" /
312
+ bank-statement reconciliation — use the payouts surface (admin PAT only):
313
+
314
+ ```bash
315
+ wiq payouts list --since 2026-08-01 --until 2026-08-18 # deposits in a window
316
+ wiq payouts list --status in_transit # money on the way
317
+ wiq payouts show <id> # one deposit's detail
318
+ ```
319
+
320
+ `--since/--until` filter on `deposits_at` (bank arrival date), not
321
+ `created_at`. `Payout.status` is a plain string column (paid,
322
+ in_transit, scheduled, ...) — no integer-enum translation, unlike
323
+ charges. All
324
+ money fields are integer cents. To see which charges make up a payout,
325
+ go through charges: each `wiq charges list` row embeds its `payout`,
326
+ so pull charges for the date window and group by `payout.id`.
327
+
287
328
  To go from a wrestler name to a billing_profile_id:
288
329
 
289
330
  ```bash
@@ -407,20 +448,66 @@ Three gotchas an agent must know:
407
448
  activity. Rosters/events/paid_sessions embed their `location` object
408
449
  (or null) in list payloads, so you can check coverage cheaply.
409
450
 
410
- ## What's NOT available (yet)
451
+ ## Writes the prospects pipeline (`prospects:write`)
452
+
453
+ The only writable surface besides report submission is the leads
454
+ pipeline. Six commands, all requiring the `prospects:write` scope:
411
455
 
412
- The CLI is read-only by design except for report submission. You
413
- cannot via this CLI:
456
+ ```bash
457
+ wiq prospect_families create --first-name Dana --last-name Lee --email dana@x.com --phone 5551234
458
+ wiq prospect_families update <family_id> --phone 5551234 --assigned-coach <coach_id>
459
+ wiq prospect_families note <family_id> --activity-type phone_call --content "Left voicemail" \
460
+ [--clear-follow-up <prospect_ids>] [--add-follow-up <prospect_ids>]
461
+ wiq prospects create <family_id> --first-name Sam --dob 2016-03-04 --academic-class 4th
462
+ wiq prospects update <prospect_id> --stage trial_scheduled --trial-event <event_id>
463
+ wiq prospects advance <prospect_id> trialing
464
+ ```
414
465
 
415
- - Create/edit prospects, families, notes, check-ins, events, paid
416
- sessions, rosters, locations, or any other resource
466
+ Rules the server enforces on PAT callers (and you should respect up
467
+ front rather than discover via errors):
468
+
469
+ 1. **Check scopes first.** `wiq auth status` → `live_scopes` must include
470
+ `prospects:write`. If it doesn't, stop and tell the user: either the
471
+ team admin needs to enable it (Settings → API Access) or they need a
472
+ new token minted with it. Don't loop on 403s.
473
+ 2. **Stage moves are forward-only and never leave a terminal stage.**
474
+ Order: inquiry → trial_scheduled → trialing → trial_complete →
475
+ converted | didnt_join | archived. Skipping ahead is fine; going back
476
+ or moving a converted/archived lead returns `stage_transition_refused`
477
+ (422). A coach can force it in the web app. Deletes are never allowed
478
+ through the API.
479
+ 3. **Search before you create.** `wiq prospect_families list --query
480
+ <name|email|phone>` finds existing households so you don't duplicate
481
+ a family that came in through the web interest form.
482
+ 4. **Log contact when you act.** A note WITH `--activity-type` counts as
483
+ contact: it stamps `last_contacted_at` on every active prospect in
484
+ the family and is what clears stale-contact follow-up flags. A note
485
+ without it is an internal comment only.
486
+ 5. **Attribution.** Every write is audited against the token; stage
487
+ changes and notes are attributed to the coach who minted it.
488
+ `wiq prospect_families stage_changes <family_id>` is the audit log
489
+ (from/to stage, changed_at, changed_via, changed_by) — use it to
490
+ answer "who moved this lead?" and to check history before advancing.
491
+ 6. **Trial-purchase leads have thin family records.** They skipped the
492
+ interest form, so contact details often live only as registration
493
+ answers on the linked wrestler/guardian profiles. `wiq
494
+ prospect_families linked_answers <family_id>` returns them; copy a
495
+ phone back with `wiq prospect_families update --phone`.
496
+
497
+ ## What's NOT available
498
+
499
+ You cannot via this CLI:
500
+
501
+ - Create/edit check-ins, events, paid sessions, rosters, locations, or
502
+ any resource other than prospects/families/notes and reports
503
+ - Delete anything (destroy actions are outside every capability)
417
504
  - Mint, list, or revoke PATs (use the web UI at
418
505
  `<host>/settings/personal_access_tokens`)
419
- - Mark attendance, advance prospect stages, log contact notes
420
- - Trigger event-change notifications or roster re-sync jobs
506
+ - Mark attendance or trigger event-change notifications / roster
507
+ re-sync jobs
421
508
 
422
- If the user asks for a write operation, tell them it's not yet exposed
423
- and point them at the WIQ web UI for now.
509
+ If the user asks for one of these, say it's not exposed and point them
510
+ at the WIQ web UI.
424
511
 
425
512
  ## When to compose vs run a workflow
426
513
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WrestlingIQ
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-08-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: thor
@@ -94,6 +93,7 @@ files:
94
93
  - lib/wiq/commands/metrics.rb
95
94
  - lib/wiq/commands/paid_sessions.rb
96
95
  - lib/wiq/commands/parents.rb
96
+ - lib/wiq/commands/payouts.rb
97
97
  - lib/wiq/commands/prospect_families.rb
98
98
  - lib/wiq/commands/prospects.rb
99
99
  - lib/wiq/commands/registrations.rb
@@ -121,7 +121,6 @@ metadata:
121
121
  bug_tracker_uri: https://github.com/wrestlingiq/wiq-cli/issues
122
122
  documentation_uri: https://github.com/wrestlingiq/wiq-cli#readme
123
123
  rubygems_mfa_required: 'true'
124
- post_install_message:
125
124
  rdoc_options: []
126
125
  require_paths:
127
126
  - lib
@@ -136,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
135
  - !ruby/object:Gem::Version
137
136
  version: '0'
138
137
  requirements: []
139
- rubygems_version: 3.3.27
140
- signing_key:
138
+ rubygems_version: 4.0.16
141
139
  specification_version: 4
142
140
  summary: Command-line interface for the WrestlingIQ API
143
141
  test_files: []