wiq-cli 0.6.1 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec283a11b87c6ba8e2f8db5bf5a56f5e02fbf092aa3fb93fab54d08660553aa3
4
- data.tar.gz: 1afd0ade5f5de6770c74acdd5d3fb0f2c68721f1537b0344a2ab6a401f32a400
3
+ metadata.gz: 18eebeef5ce1abc1388cf5b0be6eb69ac26ab58db4aab9de9178b471708b53fc
4
+ data.tar.gz: '08fa0a771eba45188f5252b7de68324700bb23cf9742ef3fc68041a51b8b6a27'
5
5
  SHA512:
6
- metadata.gz: 93172776f6f73aac7093aa64b04bade0de00cc633f6b8e17b6a4c3a7898c3b8148fc98b9ccb108ab22df639b2e56c26b167e6f85ed22013cadd444f4d1fac574
7
- data.tar.gz: 075e0ab62fb1098c04a0a7714825eef7ea0b8ad450e1d21703cbf2fe6c60b8d58f8ca2d2616ba6b8ead65ec9237db681737408476692aab9b0443847637d2ebc
6
+ metadata.gz: fed8131658508c2930c7bfe3592b2ad92e88b71fd17eeadf8db185e83825875e2959dc27c451ca0b3738615ae9e8871536f2e86e7afdcf68ac818bd21ed5e9cd
7
+ data.tar.gz: fe755bee984e4da76299aab9e02817c205c0259963678db67d39ade6ddd24a8726a6b7866a2aa5739cbcb424b2a8619c57891bbb53cbc7a8e1d60e44a30abd3c
data/README.md CHANGED
@@ -41,8 +41,9 @@ won't. Either way, the token can be revoked anytime from the same
41
41
  page.
42
42
 
43
43
  Tokens are read-only unless you tick a write permission when minting
44
- one. Today that's **Create and edit leads** (`prospects:write`) and
45
- **Create reports** (`reports:write`). A team admin has to enable each
44
+ one. Today that's **Create and edit leads** (`prospects:write`),
45
+ **Add and edit wrestler notes** (`notes:write`), and **Create reports**
46
+ (`reports:write`). A team admin has to enable each
46
47
  capability for the club first under **Settings → API Access**; the
47
48
  token picker only offers what the team allows. Scopes are fixed for the
48
49
  life of a token — to change them, revoke it and mint a new one.
@@ -90,6 +91,7 @@ Now you can ask Claude things like:
90
91
  wiq rosters list # Browse rosters
91
92
  wiq prospects summary # Pipeline dashboard
92
93
  wiq prospects advance 123 trial_scheduled # Move a lead forward (needs prospects:write)
94
+ wiq wrestlers note 456 --content "Finishing shots better" # Add a coach note (needs notes:write)
93
95
  wiq events list --start 2026-05-01 --end 2026-05-31 # Calendar
94
96
  wiq workflows list # Curated multi-step recipes
95
97
  wiq reports types # 36 report types w/ recommendations
@@ -144,10 +146,11 @@ output (the CLI never logs your token — paste the full JSON safely).
144
146
 
145
147
  ## Status
146
148
 
147
- v0.6.1 — reads across every group, plus report submission and a
148
- scoped write surface for the prospects pipeline (`prospect_families
149
- create/update/note`, `prospects create/update/advance`) gated by the
150
- `prospects:write` token scope. Other write commands deferred — see
149
+ v0.7.0 — reads across every group, plus report submission and scoped
150
+ write surfaces for the prospects pipeline (`prospect_families
151
+ create/update/note`, `prospects create/update/advance`, gated by the
152
+ `prospects:write` token scope) and coach notes on wrestlers (`wrestlers
153
+ note/update_note`, gated by `notes:write`). Other write commands deferred — see
151
154
  `docs/deferred.md`.
152
155
 
153
156
  ## License
@@ -300,6 +300,7 @@ Registry today:
300
300
  | Capability | Actions |
301
301
  | --- | --- |
302
302
  | `prospects:write` | `prospect_families#create/#update`, `prospects#create/#update`, `prospect_family_notes#create` |
303
+ | `notes:write` | `wrestler_notes#create`, `notes#update` (wrestler notes only — a token updating a match note gets a 422) |
303
304
  | `reports:write` | `reports#create` |
304
305
 
305
306
  Unregistered writes (every `destroy`, everything else) fail closed with
data/lib/wiq/cli.rb CHANGED
@@ -80,7 +80,7 @@ module Wiq
80
80
  desc "setup SUBCOMMAND", "Install integration files (Claude Code skill, future: Cursor, etc.)"
81
81
  subcommand "setup", Wiq::Commands::Setup
82
82
 
83
- desc "wrestlers SUBCOMMAND", "Search wrestlers — narrow ID-discovery surface (list, show)"
83
+ desc "wrestlers SUBCOMMAND", "Search wrestlers — narrow ID-discovery surface (list, show, notes; note, update_note need notes:write)"
84
84
  subcommand "wrestlers", Wiq::Commands::Wrestlers
85
85
 
86
86
  desc "parents SUBCOMMAND", "Search parents — narrow ID-discovery surface (list, show)"
@@ -25,7 +25,7 @@ module Wiq
25
25
  That metadata is shown after login and stored alongside the token.
26
26
 
27
27
  Scopes: every PAT can read. Writes need a capability (currently
28
- prospects:write, reports:write) that the team admin has enabled
28
+ prospects:write, notes:write, reports:write) that the team admin has enabled
29
29
  under Settings → API Access AND that the token was minted with.
30
30
  Scopes are immutable — to change them, revoke and mint a new
31
31
  token, then re-run this command with --force.
@@ -116,7 +116,63 @@ module Wiq
116
116
  ])
117
117
  end
118
118
 
119
+ desc "notes ID", "List coach notes on a wrestler, newest first"
120
+ long_desc <<~DESC
121
+ GET /api/v1/wrestlers/:id/notes. Coach notes are visible to every
122
+ coach on the team and never to wrestlers or parents. Each row:
123
+ id, created_at, author (display_name + author_type), and the body
124
+ as rich `content` (HTML) and `plain_content`.
125
+ DESC
126
+ method_option :all, type: :boolean, default: false
127
+ def notes(id)
128
+ records, total = fetch_index("/api/v1/wrestlers/#{id}/notes", { "per_page" => 50 }, key: "notes")
129
+ render_index(
130
+ records, total: total,
131
+ summary: "Listed #{records.size} notes for wrestler #{id}.",
132
+ breadcrumbs: [
133
+ { "cmd" => "wiq wrestlers note #{id} --content \"...\"", "description" => "Add a note [notes:write]" },
134
+ { "cmd" => "wiq wrestlers show #{id}", "description" => "Back to the wrestler" }
135
+ ]
136
+ )
137
+ end
138
+
139
+ desc "note ID", "Add a coach note to a wrestler [notes:write]"
140
+ long_desc <<~DESC
141
+ POSTs to /api/v1/wrestlers/:id/notes. Requires the notes:write
142
+ scope (team-enabled + on the token). The note is authored by the
143
+ coach who minted the token and is visible only to the team's
144
+ coaches. Content is sent as plain text; @mentions of other coaches
145
+ notify them by email.
146
+ DESC
147
+ method_option :content, type: :string, required: true, desc: "Note body (plain text)"
148
+ def note(id)
149
+ note = client.post("/api/v1/wrestlers/#{id}/notes", note_body)
150
+ render(note,
151
+ summary: "Added note ##{note["id"]} on wrestler #{id}.",
152
+ breadcrumbs: [
153
+ { "cmd" => "wiq wrestlers notes #{id}", "description" => "All notes on this wrestler" }
154
+ ])
155
+ end
156
+
157
+ desc "update_note NOTE_ID", "Replace the body of a wrestler note you wrote [notes:write]"
158
+ long_desc <<~DESC
159
+ PUTs to /api/v1/notes/:note_id. Requires the notes:write scope.
160
+ Only the coach who wrote the note can edit it, and only notes on a
161
+ wrestler — match notes return a 422 for tokens. Notes can't be
162
+ deleted through the API. Find note ids with `wiq wrestlers notes <id>`.
163
+ DESC
164
+ method_option :content, type: :string, required: true, desc: "New note body (plain text)"
165
+ def update_note(note_id)
166
+ client.put("/api/v1/notes/#{note_id}", note_body)
167
+ render({ "id" => note_id.to_i, "updated" => true },
168
+ summary: "Updated note ##{note_id}.")
169
+ end
170
+
119
171
  no_commands do
172
+ def note_body
173
+ { "note" => { "content" => options[:content], "plain_content" => options[:content] } }
174
+ end
175
+
120
176
  # Extracted so the spec can verify the option → query-param mapping
121
177
  # without round-tripping a real Faraday connection.
122
178
  def build_list_params
data/lib/wiq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wiq
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -1,6 +1,6 @@
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, 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.
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; with notes:write it can add and edit coach notes on wrestlers. 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
@@ -56,7 +56,7 @@ per situation.
56
56
  - **Writes need a capability on BOTH the team and the token.** Reads are
57
57
  implicit for every token. A write (`POST`/`PATCH`) succeeds only when it
58
58
  maps to a capability in the server's registry (`prospects:write`,
59
- `reports:write`) that a team admin has enabled under Settings → API
59
+ `notes:write`, `reports:write`) that a team admin has enabled under Settings → API
60
60
  Access AND that the token was minted with. Token scopes are immutable:
61
61
  to add one, revoke + mint a new token, then `wiq auth login --force`.
62
62
  `wiq auth status` / `wiq doctor` show the live scopes — check them
@@ -450,8 +450,8 @@ Three gotchas an agent must know:
450
450
 
451
451
  ## Writes — the prospects pipeline (`prospects:write`)
452
452
 
453
- The only writable surface besides report submission is the leads
454
- pipeline. Six commands, all requiring the `prospects:write` scope:
453
+ Besides report submission and wrestler notes (next section), the
454
+ writable surface is the leads pipeline. Six commands, all requiring the `prospects:write` scope:
455
455
 
456
456
  ```bash
457
457
  wiq prospect_families create --first-name Dana --last-name Lee --email dana@x.com --phone 5551234
@@ -494,12 +494,34 @@ front rather than discover via errors):
494
494
  prospect_families linked_answers <family_id>` returns them; copy a
495
495
  phone back with `wiq prospect_families update --phone`.
496
496
 
497
+ ## Writes — coach notes on wrestlers (`notes:write`)
498
+
499
+ ```bash
500
+ wiq wrestlers notes <wrestler_id> # read: list notes, newest first
501
+ wiq wrestlers note <wrestler_id> --content "Hand fighting much better"
502
+ wiq wrestlers update_note <note_id> --content "Corrected text"
503
+ ```
504
+
505
+ 1. **Check scopes first.** `wiq auth status` → `live_scopes` must include
506
+ `notes:write`; if not, the team admin enables it under Settings → API
507
+ Access or the user mints a new token with it.
508
+ 2. **Coach-only audience.** Notes are visible to every coach on the team
509
+ and never to the wrestler or parents. @mentioning another coach emails
510
+ them, so don't @mention unless the user asked to notify someone.
511
+ 3. **Edit only your own wrestler notes.** `update_note` works only on
512
+ notes the token's coach wrote, and only on wrestler notes (match notes
513
+ return 422). Nothing can be deleted through the API.
514
+ 4. **Find the wrestler first.** `wiq wrestlers list --query <name>` gives
515
+ the id; a wrestler the coach can't see (another team, or outside a
516
+ roster-restricted coach's rosters) returns 403.
517
+
497
518
  ## What's NOT available
498
519
 
499
520
  You cannot via this CLI:
500
521
 
501
522
  - Create/edit check-ins, events, paid sessions, rosters, locations, or
502
- any resource other than prospects/families/notes and reports
523
+ any resource other than prospects/families/notes, wrestler notes,
524
+ and reports
503
525
  - Delete anything (destroy actions are outside every capability)
504
526
  - Mint, list, or revoke PATs (use the web UI at
505
527
  `<host>/settings/personal_access_tokens`)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WrestlingIQ