pike13-cli 0.1.4

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.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +196 -0
  3. data/CONTRIBUTING.md +96 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +896 -0
  6. data/bin/pike13 +6 -0
  7. data/completions/_pike13 +229 -0
  8. data/completions/pike13.bash +112 -0
  9. data/lib/pike13/cli/commands/account/business.rb +22 -0
  10. data/lib/pike13/cli/commands/account/confirmation.rb +21 -0
  11. data/lib/pike13/cli/commands/account/password.rb +21 -0
  12. data/lib/pike13/cli/commands/account/person.rb +22 -0
  13. data/lib/pike13/cli/commands/account.rb +33 -0
  14. data/lib/pike13/cli/commands/base.rb +350 -0
  15. data/lib/pike13/cli/commands/concerns/formattable_command.rb +48 -0
  16. data/lib/pike13/cli/commands/concerns/reporting_query.rb +59 -0
  17. data/lib/pike13/cli/commands/desk/appointment.rb +58 -0
  18. data/lib/pike13/cli/commands/desk/booking.rb +56 -0
  19. data/lib/pike13/cli/commands/desk/business.rb +20 -0
  20. data/lib/pike13/cli/commands/desk/custom_field.rb +27 -0
  21. data/lib/pike13/cli/commands/desk/event.rb +32 -0
  22. data/lib/pike13/cli/commands/desk/event_occurrence.rb +64 -0
  23. data/lib/pike13/cli/commands/desk/event_occurrence_note.rb +82 -0
  24. data/lib/pike13/cli/commands/desk/event_occurrence_visit.rb +26 -0
  25. data/lib/pike13/cli/commands/desk/event_occurrence_waitlist_entry.rb +26 -0
  26. data/lib/pike13/cli/commands/desk/form_of_payment.rb +75 -0
  27. data/lib/pike13/cli/commands/desk/invoice.rb +29 -0
  28. data/lib/pike13/cli/commands/desk/location.rb +29 -0
  29. data/lib/pike13/cli/commands/desk/make_up.rb +51 -0
  30. data/lib/pike13/cli/commands/desk/note.rb +71 -0
  31. data/lib/pike13/cli/commands/desk/pack.rb +20 -0
  32. data/lib/pike13/cli/commands/desk/pack_product.rb +101 -0
  33. data/lib/pike13/cli/commands/desk/payment.rb +44 -0
  34. data/lib/pike13/cli/commands/desk/person.rb +98 -0
  35. data/lib/pike13/cli/commands/desk/person_plan.rb +27 -0
  36. data/lib/pike13/cli/commands/desk/person_visit.rb +27 -0
  37. data/lib/pike13/cli/commands/desk/person_waitlist_entry.rb +27 -0
  38. data/lib/pike13/cli/commands/desk/person_waiver.rb +27 -0
  39. data/lib/pike13/cli/commands/desk/plan.rb +29 -0
  40. data/lib/pike13/cli/commands/desk/plan_product.rb +35 -0
  41. data/lib/pike13/cli/commands/desk/punch.rb +20 -0
  42. data/lib/pike13/cli/commands/desk/refund.rb +31 -0
  43. data/lib/pike13/cli/commands/desk/revenue_category.rb +36 -0
  44. data/lib/pike13/cli/commands/desk/sales_tax.rb +36 -0
  45. data/lib/pike13/cli/commands/desk/service.rb +29 -0
  46. data/lib/pike13/cli/commands/desk/staff_member.rb +35 -0
  47. data/lib/pike13/cli/commands/desk/visit.rb +36 -0
  48. data/lib/pike13/cli/commands/desk/waitlist_entry.rb +69 -0
  49. data/lib/pike13/cli/commands/desk.rb +172 -0
  50. data/lib/pike13/cli/commands/front/appointment.rb +31 -0
  51. data/lib/pike13/cli/commands/front/booking.rb +56 -0
  52. data/lib/pike13/cli/commands/front/branding.rb +17 -0
  53. data/lib/pike13/cli/commands/front/business.rb +17 -0
  54. data/lib/pike13/cli/commands/front/event.rb +22 -0
  55. data/lib/pike13/cli/commands/front/event_occurrence.rb +35 -0
  56. data/lib/pike13/cli/commands/front/event_occurrence_note.rb +35 -0
  57. data/lib/pike13/cli/commands/front/event_occurrence_waitlist_eligibility.rb +27 -0
  58. data/lib/pike13/cli/commands/front/form_of_payment.rb +83 -0
  59. data/lib/pike13/cli/commands/front/location.rb +22 -0
  60. data/lib/pike13/cli/commands/front/person.rb +17 -0
  61. data/lib/pike13/cli/commands/front/person_plan.rb +26 -0
  62. data/lib/pike13/cli/commands/front/person_visit.rb +26 -0
  63. data/lib/pike13/cli/commands/front/person_waitlist_entry.rb +26 -0
  64. data/lib/pike13/cli/commands/front/person_waiver.rb +26 -0
  65. data/lib/pike13/cli/commands/front/plan_product.rb +31 -0
  66. data/lib/pike13/cli/commands/front/plan_terms.rb +42 -0
  67. data/lib/pike13/cli/commands/front/service.rb +22 -0
  68. data/lib/pike13/cli/commands/front.rb +113 -0
  69. data/lib/pike13/cli/commands/report/clients.rb +27 -0
  70. data/lib/pike13/cli/commands/report/enrollments.rb +27 -0
  71. data/lib/pike13/cli/commands/report/event_occurrence_staff_members.rb +31 -0
  72. data/lib/pike13/cli/commands/report/event_occurrences.rb +31 -0
  73. data/lib/pike13/cli/commands/report/invoice_item_transactions.rb +31 -0
  74. data/lib/pike13/cli/commands/report/invoice_items.rb +31 -0
  75. data/lib/pike13/cli/commands/report/invoices.rb +27 -0
  76. data/lib/pike13/cli/commands/report/monthly_business_metrics.rb +31 -0
  77. data/lib/pike13/cli/commands/report/pays.rb +27 -0
  78. data/lib/pike13/cli/commands/report/person_plans.rb +31 -0
  79. data/lib/pike13/cli/commands/report/staff_members.rb +31 -0
  80. data/lib/pike13/cli/commands/report/transactions.rb +27 -0
  81. data/lib/pike13/cli/commands/report.rb +77 -0
  82. data/lib/pike13/cli/config.rb +26 -0
  83. data/lib/pike13/cli/formatter.rb +142 -0
  84. data/lib/pike13/cli/progress.rb +85 -0
  85. data/lib/pike13/cli/thor_nested_subcommand.rb +37 -0
  86. data/lib/pike13/cli/version.rb +7 -0
  87. data/lib/pike13/cli.rb +70 -0
  88. metadata +187 -0
data/README.md ADDED
@@ -0,0 +1,896 @@
1
+ # Pike13 CLI
2
+
3
+ [![CI](https://github.com/juanhuttemann/pike13-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/juanhuttemann/pike13-cli/actions/workflows/ci.yml)
4
+
5
+ A command-line interface for interacting with the Pike13 API, supporting both:
6
+ - **[Core API](https://developer.pike13.com/docs/api/v2)** - CRUD operations for managing people, events, invoices, and more
7
+ - **[Reporting API](https://developer.pike13.com/docs/reporting/v3)** - Advanced analytics and reporting queries
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ gem install pike13-cli
13
+ ```
14
+
15
+ ## Configuration
16
+
17
+ Set the following environment variables:
18
+
19
+ ```bash
20
+ export PIKE13_ACCESS_TOKEN="your_access_token"
21
+ export PIKE13_BASE_URL="yourbusiness.pike13.com"
22
+ ```
23
+
24
+
25
+ ## Usage
26
+
27
+ ### Command Structure
28
+
29
+ ```bash
30
+ pike13 <namespace> <resource> <action> [options]
31
+ ```
32
+
33
+ **Namespaces:**
34
+ - `desk` - Staff interface (full read/write access)
35
+ - `front` - Client interface (limited access for customer-facing apps)
36
+ - `account` - Account-level operations (not scoped to business)
37
+ - `report` - Reporting API (analytics and insights)
38
+
39
+ ### Account Namespace
40
+
41
+ Account-level operations:
42
+
43
+ ```bash
44
+ # Get current account
45
+ pike13 account me
46
+
47
+ # List all businesses for the current account
48
+ pike13 account businesses list
49
+
50
+ # List all people in the account
51
+ pike13 account people list
52
+
53
+ # Request password reset
54
+ pike13 account password reset --email=user@example.com
55
+
56
+ # Create email confirmation
57
+ pike13 account confirmation create --email=user@example.com
58
+ ```
59
+
60
+ ### Desk Namespace (Staff Interface)
61
+
62
+ Full staff interface with read/write access:
63
+
64
+ #### People
65
+
66
+ ```bash
67
+ # List all people
68
+ pike13 desk people list
69
+ # or
70
+ pike13 desk people ls
71
+ ```
72
+ See [shortcuts](#command-shortcuts) for faster alternatives
73
+
74
+ ```bash
75
+ # Find a person
76
+ pike13 desk people get 123
77
+
78
+ # Search for people
79
+ pike13 desk people search "John Doe"
80
+
81
+ # Get current authenticated user
82
+ pike13 desk people me
83
+
84
+ # Create a person
85
+ pike13 desk people create --first-name "John" --last-name "Doe" --email "john@example.com"
86
+
87
+ # Update a person
88
+ pike13 desk people update 123 --first-name "Jane"
89
+
90
+ # Delete a person
91
+ pike13 desk people delete 123
92
+ ```
93
+
94
+ #### Business
95
+
96
+ ```bash
97
+ # Get business details
98
+ pike13 desk business find
99
+ ```
100
+
101
+ #### Events & Event Occurrences
102
+
103
+ ```bash
104
+ # List events
105
+ pike13 desk events list
106
+
107
+ # Get an event
108
+ pike13 desk events get 100
109
+
110
+ # List event occurrences
111
+ pike13 desk event_occurrences list --from "2025-01-01" --to "2025-01-31"
112
+
113
+ # Get event occurrence
114
+ pike13 desk event_occurrences get 789
115
+
116
+ # Get enrollment eligibilities
117
+ pike13 desk event_occurrences eligibilities 789
118
+ ```
119
+
120
+ #### Event Occurrence Notes
121
+
122
+ ```bash
123
+ # List notes for an event occurrence
124
+ pike13 desk event_occurrence_notes list --event-occurrence-id 789
125
+
126
+ # Get specific note
127
+ pike13 desk event_occurrence_notes get 1 --event-occurrence-id 789
128
+
129
+ # Create note
130
+ pike13 desk event_occurrence_notes create \
131
+ --event-occurrence-id 789 \
132
+ --subject "Note Subject" \
133
+ --note "This is a note"
134
+
135
+ # Update note
136
+ pike13 desk event_occurrence_notes update 1 \
137
+ --event-occurrence-id 789 \
138
+ --note "Updated note content"
139
+
140
+ # Delete note
141
+ pike13 desk event_occurrence_notes delete 1 --event-occurrence-id 789
142
+ ```
143
+
144
+ #### Bookings
145
+
146
+ ```bash
147
+ # Get booking
148
+ pike13 desk bookings get 123
149
+
150
+ # Create booking (requires idempotency token)
151
+ pike13 desk bookings create --event-occurrence-id 789 --person-id 123
152
+
153
+ # Update booking
154
+ pike13 desk bookings update 456 --state "completed"
155
+
156
+ # Delete booking
157
+ pike13 desk bookings delete 456
158
+ ```
159
+
160
+ #### Appointments
161
+
162
+ ```bash
163
+ # Find available slots
164
+ pike13 desk appointments available --service-id 100 --date "2025-01-15"
165
+
166
+ # Get availability summary
167
+ pike13 desk appointments summary --service-id 100 --from "2025-01-01" --to "2025-01-31"
168
+ ```
169
+
170
+ #### Invoices & Payments
171
+
172
+ ```bash
173
+ # List invoices
174
+ pike13 desk invoices list
175
+
176
+ # Get invoice
177
+ pike13 desk invoices get 700
178
+
179
+ # Get payment
180
+ pike13 desk payments get 800
181
+
182
+ # Void payment
183
+ pike13 desk payments void 800 --invoice-item-ids "1,2"
184
+ ```
185
+
186
+ #### Pack Products
187
+
188
+ ```bash
189
+ # List pack products
190
+ pike13 desk pack_products list
191
+
192
+ # Get specific pack product
193
+ pike13 desk pack_products get 123
194
+
195
+ # Create pack product
196
+ pike13 desk pack_products create \
197
+ --name "10 Class Pack" \
198
+ --price "200.00" \
199
+ --visit-count 10
200
+
201
+ # Update pack product
202
+ pike13 desk pack_products update 123 --name "Updated Pack Name"
203
+
204
+ # Delete pack product
205
+ pike13 desk pack_products delete 123
206
+
207
+ # Create pack from product
208
+ pike13 desk pack_products create_pack \
209
+ --product-id 123 \
210
+ --person-id 456 \
211
+ --quantity 5
212
+ ```
213
+
214
+ #### Other Resources
215
+
216
+ ```bash
217
+ # Locations
218
+ pike13 desk locations list
219
+ pike13 desk locations get 1
220
+
221
+ # Services
222
+ pike13 desk services list
223
+ pike13 desk services get 100
224
+
225
+ # Staff members
226
+ pike13 desk staff list
227
+ pike13 desk staff get 5
228
+ pike13 desk staff me
229
+
230
+ # Visits
231
+ pike13 desk visits list
232
+ pike13 desk visits get 456
233
+
234
+ # Plans
235
+ pike13 desk plans list
236
+ pike13 desk plans get 200
237
+
238
+ # Notes
239
+ pike13 desk notes list 123
240
+ pike13 desk notes get 123 456
241
+ pike13 desk notes create 123 --subject "Follow up" --note "Client requested callback"
242
+ pike13 desk notes update 123 456 --note "Updated note content"
243
+ pike13 desk notes delete 123 456
244
+
245
+ # Custom Fields
246
+ pike13 desk custom_fields list
247
+
248
+ # Forms of Payment
249
+ pike13 desk forms_of_payment list 123
250
+ pike13 desk forms_of_payment get 123 456
251
+ pike13 desk forms_of_payment create 123 --type "creditcard" --token "tok_xxx"
252
+ pike13 desk forms_of_payment update 123 456 --is-default
253
+ pike13 desk forms_of_payment delete 123 456
254
+
255
+ # Revenue Categories
256
+ pike13 desk revenue_categories list
257
+ pike13 desk revenue_categories get 138248
258
+
259
+ # Sales Taxes
260
+ pike13 desk sales_taxes list
261
+ pike13 desk sales_taxes get 1
262
+
263
+ # Make-Ups
264
+ pike13 desk make_ups reasons
265
+ pike13 desk make_ups generate 456 --make-up-reason-id 126989 --free-form-reason "Client was sick"
266
+
267
+ # Waitlist
268
+ pike13 desk waitlist list
269
+ pike13 desk waitlist get 789
270
+ pike13 desk waitlist create --person-id 123 --event-id 100
271
+ pike13 desk waitlist delete 789
272
+
273
+ # Person-related resources
274
+ pike13 desk person_visits list 123
275
+ pike13 desk person_plans list 123
276
+ pike13 desk person_waitlist list 123
277
+ pike13 desk person_waivers list 123
278
+ ```
279
+
280
+ ### Front Namespace (Client Interface)
281
+
282
+ Client-facing interface with limited read-only access:
283
+
284
+ ```bash
285
+ # Get authenticated client user (only)
286
+ pike13 front people me
287
+
288
+ # List events (client view)
289
+ pike13 front events list
290
+
291
+ # List locations (client view)
292
+ pike13 front locations list
293
+
294
+ # List services (client view)
295
+ pike13 front services list
296
+
297
+ # Get business info
298
+ pike13 front business show
299
+
300
+ # Get branding
301
+ pike13 front branding show
302
+
303
+ # Find available appointment slots (client view)
304
+ pike13 front appointments available \
305
+ --service-id 100 \
306
+ --date "2025-01-15"
307
+
308
+ # Bookings (client view)
309
+ pike13 front bookings get 456
310
+ pike13 front bookings create --event-occurrence-id 789 --person-id 123
311
+ pike13 front bookings update 456 --state "completed"
312
+ pike13 front bookings delete 456
313
+
314
+ # Person-related resources (client view)
315
+ pike13 front person_visits list 123
316
+ pike13 front person_plans list 123
317
+ pike13 front person_waitlist list 123
318
+ pike13 front person_waivers list 123
319
+
320
+ # Forms of payment (client view)
321
+ pike13 front forms_of_payment list 123
322
+ pike13 front forms_of_payment get 123 456
323
+ pike13 front forms_of_payment find_me 456
324
+ pike13 front forms_of_payment create 123 --type "creditcard" --token "tok_xxx"
325
+ pike13 front forms_of_payment update 123 456 --is-default
326
+ pike13 front forms_of_payment delete 123 456
327
+ ```
328
+
329
+ ### Report Namespace (Reporting API)
330
+
331
+ Advanced analytics and reporting:
332
+
333
+ ```bash
334
+ # Monthly business metrics
335
+ pike13 report monthly_metrics query \
336
+ --fields month_start_date,net_paid_amount,member_count
337
+
338
+ # Clients report
339
+ pike13 report clients query \
340
+ --fields full_name,email,completed_visits,has_membership
341
+
342
+ # Transactions
343
+ pike13 report transactions query \
344
+ --fields transaction_date,net_paid_amount,payment_method,invoice_payer_name
345
+
346
+ # Invoices
347
+ pike13 report invoices query \
348
+ --fields invoice_number,expected_amount,outstanding_amount,invoice_state
349
+
350
+ # Enrollments (visits)
351
+ pike13 report enrollments query \
352
+ --fields full_name,service_name,service_date,state
353
+
354
+ # Event occurrences
355
+ pike13 report event_occurrences query \
356
+ --fields event_name,service_date,enrollment_count,capacity
357
+
358
+ # Event occurrence staff members
359
+ pike13 report event_occurrence_staff query \
360
+ --fields full_name,event_name,service_date,enrollment_count
361
+
362
+ # Invoice items
363
+ pike13 report invoice_items query \
364
+ --fields product_name,expected_amount,net_paid_amount
365
+
366
+ # Invoice item transactions
367
+ pike13 report invoice_item_transactions query \
368
+ --fields transaction_date,payment_method,net_paid_amount
369
+
370
+ # Pays (staff compensation tracking)
371
+ pike13 report pays query \
372
+ --fields staff_name,service_name,final_pay_amount,pay_state
373
+
374
+ # Person plans
375
+ pike13 report person_plans query \
376
+ --fields full_name,plan_name,start_date,is_available
377
+
378
+ # Staff members
379
+ pike13 report staff_members query \
380
+ --fields full_name,email,role,tenure
381
+ ```
382
+
383
+ ### Report Options
384
+
385
+ ```bash
386
+ # Filtering (use hash format - note: advanced filters may require API-specific syntax)
387
+ pike13 report clients query --filter has_membership:true
388
+ pike13 report transactions query --filter payment_method:cash
389
+
390
+ # Grouping
391
+ pike13 report clients query --group tenure_group
392
+ pike13 report transactions query --group payment_method
393
+
394
+ # Sorting (comma-separated fields, append - for descending)
395
+ pike13 report clients query --sort completed_visits-
396
+ pike13 report transactions query --sort transaction_date
397
+
398
+ # Pagination (use hash format)
399
+ pike13 report clients query --page size:50 --page number:2
400
+ pike13 report clients query --page size:100
401
+
402
+ # Include total count
403
+ pike13 report clients query --total-count
404
+
405
+ # Combine multiple options
406
+ pike13 report clients query \
407
+ --fields full_name,email,completed_visits \
408
+ --filter has_membership:true \
409
+ --sort completed_visits- \
410
+ --page size:50 \
411
+ --total-count
412
+ ```
413
+
414
+ ### Output Formats
415
+
416
+ ```bash
417
+ # JSON output (default, pretty-printed)
418
+ pike13 desk people list
419
+
420
+ # Compact JSON
421
+ pike13 desk people list --compact
422
+
423
+ # Table output
424
+ pike13 desk people list --format table
425
+
426
+ # Table with color
427
+ pike13 desk people list --format table --color
428
+
429
+ # CSV output
430
+ pike13 report clients query --format csv
431
+
432
+ # Show progress indicator (useful for long-running reports)
433
+ pike13 report clients query --progress --format table
434
+ ```
435
+
436
+ ### Common Options
437
+
438
+ ```bash
439
+ # Help for any command
440
+ pike13 help
441
+ pike13 desk help
442
+ pike13 desk people help
443
+ pike13 desk event_occurrences help
444
+ pike13 desk event_occurrence_notes help
445
+ pike13 desk custom_fields help
446
+ pike13 desk forms_of_payment help
447
+ pike13 report help
448
+
449
+ # Verbose output (show HTTP requests and detailed debugging)
450
+ pike13 desk people list --verbose
451
+
452
+ # Quiet mode (suppress all output except errors)
453
+ pike13 desk people list --quiet
454
+
455
+ # Verbose mode with error details (useful for troubleshooting)
456
+ pike13 desk people get 999999 --verbose # Shows full error trace
457
+
458
+ # Show version information
459
+ pike13 version
460
+ ```
461
+
462
+ ## Examples
463
+
464
+ ### Staff Workflow Examples
465
+
466
+ ```bash
467
+ # Find a client and view their details
468
+ pike13 desk people search "John Smith"
469
+
470
+ # Check upcoming classes
471
+ pike13 desk event_occurrences list \
472
+ --from "$(date +%Y-%m-%d)" \
473
+ --to "$(date -d '+7 days' +%Y-%m-%d)"
474
+
475
+ # Create a booking for a client
476
+ pike13 desk bookings create \
477
+ --event-occurrence-id 789 \
478
+ --person-id 123
479
+
480
+ # View client's visit history
481
+ pike13 desk visits list --person-id 123
482
+ ```
483
+
484
+ ### Client-Facing Examples
485
+
486
+ ```bash
487
+ # View available classes (client view)
488
+ pike13 front events list
489
+
490
+ # Find available appointment slots
491
+ pike13 front appointments available \
492
+ --service-id 100 \
493
+ --date "2025-01-15"
494
+
495
+ # Get my profile (as client)
496
+ pike13 front people me
497
+ ```
498
+
499
+ ### Reporting Examples
500
+
501
+ ```bash
502
+ # Monthly revenue summary
503
+ pike13 report monthly_metrics query \
504
+ --fields month_start_date,net_paid_amount,member_count,new_client_count \
505
+ --format table
506
+
507
+ # Active members report
508
+ pike13 report clients query \
509
+ --fields full_name,email,tenure,completed_visits \
510
+ --filter has_membership=true \
511
+ --sort completed_visits- \
512
+ --format csv > active_members.csv
513
+
514
+ # Payment method breakdown
515
+ pike13 report transactions query \
516
+ --fields total_net_paid_amount,transaction_count \
517
+ --group payment_method
518
+
519
+ # Class attendance report
520
+ pike13 report enrollments query \
521
+ --fields service_name,completed_enrollment_count,noshowed_enrollment_count \
522
+ --group service_name
523
+ ```
524
+
525
+ ### Shell Integration
526
+
527
+ ```bash
528
+ # Chain commands
529
+ CLIENT_ID=$(pike13 desk people search "John" --compact | jq -r '.people[0].id')
530
+ pike13 desk visits list --person-id $CLIENT_ID
531
+
532
+ # Export reports
533
+ pike13 report clients query \
534
+ --fields full_name,email,phone,completed_visits \
535
+ --format csv > clients_$(date +%Y%m%d).csv
536
+
537
+ # Monitor daily signups
538
+ watch -n 300 "pike13 report clients query \
539
+ --fields full_name,email,client_since_date \
540
+ --format table"
541
+ ```
542
+
543
+ ### Shell Completion (Optional)
544
+
545
+ The CLI includes tab completion support for bash and zsh.
546
+
547
+ **Bash:**
548
+ ```bash
549
+ # Copy the completion script
550
+ sudo cp completions/pike13.bash /etc/bash_completion.d/pike13
551
+
552
+ # Or source it in your ~/.bashrc
553
+ echo 'source /path/to/pike13-cli/completions/pike13.bash' >> ~/.bashrc
554
+ source ~/.bashrc
555
+ ```
556
+
557
+ **Zsh:**
558
+ ```bash
559
+ # Create completion directory if it doesn't exist
560
+ mkdir -p ~/.zsh/completion
561
+
562
+ # Copy the completion script
563
+ cp completions/_pike13 ~/.zsh/completion/
564
+
565
+ # Add to ~/.zshrc (if not already present)
566
+ echo 'fpath=(~/.zsh/completion $fpath)' >> ~/.zshrc
567
+ echo 'autoload -U compinit && compinit' >> ~/.zshrc
568
+ source ~/.zshrc
569
+ ```
570
+
571
+ ## Tips and Tricks
572
+
573
+ ### Command Shortcuts
574
+
575
+ The CLI includes shortcuts for frequently used long commands to improve usability:
576
+
577
+ #### Desk Namespace Shortcuts
578
+
579
+ ```bash
580
+ # Event Occurrences
581
+ pike13 desk eo list # Instead of: pike13 desk event_occurrences list
582
+ pike13 desk eo get 789 # Instead of: pike13 desk event_occurrences get 789
583
+ pike13 desk eo ls # Also works with ls alias
584
+
585
+ # Event Occurrence Notes
586
+ pike13 desk eon list --event-occurrence-id 789 # Instead of: pike13 desk event_occurrence_notes list
587
+
588
+ # Forms of Payment
589
+ pike13 desk fop list 123 # Instead of: pike13 desk forms_of_payment list 123
590
+
591
+ # Person-related shortcuts
592
+ pike13 desk pv list 123 # person_visits
593
+ pike13 desk ppl list 123 # person_plans
594
+ pike13 desk pw list 123 # person_waivers
595
+ pike13 desk pwl list 123 # person_waitlist
596
+
597
+ # Management shortcuts
598
+ pike13 desk cf list # custom_fields
599
+ pike13 desk rc list # revenue_categories
600
+ pike13 desk st list # sales_taxes
601
+ pike13 desk mu reasons # make_ups
602
+ ```
603
+
604
+ #### Account Namespace Shortcuts
605
+
606
+ ```bash
607
+ # Account namespace
608
+ pike13 ac me # Instead of: pike13 account me
609
+ pike13 ac businesses list # Instead of: pike13 account businesses list
610
+ pike13 ac people list # Instead of: pike13 account people list
611
+ ```
612
+
613
+ #### Front Namespace Shortcuts
614
+
615
+ ```bash
616
+ # Event Occurrences
617
+ pike13 front eo list # Instead of: pike13 front event_occurrences list
618
+
619
+ # Event Occurrence Notes
620
+ pike13 front eon list --event-occurrence-id 789
621
+
622
+ pike13 front eowe list --event-occurrence-id 789 # event_occurrence_waitlist_eligibilities (41→4 chars = 90% reduction)
623
+
624
+ # Client-facing resources
625
+ pike13 front pp list # plan_products
626
+ pike13 front pt list # plan_terms
627
+ pike13 front fop list 123 # forms_of_payment
628
+
629
+ # Person-related shortcuts (client view)
630
+ pike13 front pv list 123 # person_visits
631
+ pike13 front ppl list 123 # person_plans
632
+ pike13 front pw list 123 # person_waivers
633
+ pike13 front pwl list 123 # person_waitlist
634
+ ```
635
+
636
+ #### Report Namespace Shortcuts
637
+
638
+
639
+ ```bash
640
+ pike13 report tx query # transactions (daily financial reporting)
641
+ pike13 report mm query # monthly_metrics (business intelligence)
642
+
643
+ pike13 report eosm query # event_occurrence_staff_members (31→4 chars = 87% reduction)
644
+ pike13 report iit query # invoice_item_transactions (25→3 chars = 88% reduction)
645
+
646
+ pike13 report eo query # event_occurrences
647
+ pike13 report eos query # event_occurrence_staff
648
+ pike13 report ii query # invoice_items
649
+ pike13 report sm query # staff_members
650
+ ```
651
+
652
+
653
+ ### Colored Output
654
+
655
+ Enable colored tables for better readability:
656
+ ```bash
657
+ pike13 desk people list --format table --color
658
+ ```
659
+
660
+ ### Date Validation
661
+
662
+ Date parameters are validated automatically:
663
+ ```bash
664
+ # ✗ Invalid - will show error
665
+ pike13 desk event_occurrences list --from "2025-11"
666
+
667
+ # ✓ Valid - YYYY-MM-DD format
668
+ pike13 desk event_occurrences list --from "2025-11-01"
669
+ ```
670
+
671
+ ### Check Configuration
672
+
673
+ Use the version command to verify your environment:
674
+ ```bash
675
+ pike13 version
676
+ # Shows: CLI version, SDK version, Ruby version, and env status
677
+ ```
678
+
679
+ ### Progress Indicators
680
+
681
+ Show a spinner for long-running report queries:
682
+ ```bash
683
+ pike13 report clients query --progress --format table
684
+ pike13 report transactions query --progress --format table
685
+ ```
686
+ Note: Progress indicators only appear in TTY mode and are automatically disabled when piping.
687
+
688
+ ### Piping and Redirection
689
+
690
+ Colors and progress indicators are automatically disabled when piping:
691
+ ```bash
692
+ # Save to file
693
+ pike13 report clients query --fields full_name,email --format csv > clients.csv
694
+
695
+ # Pipe to other commands
696
+ pike13 desk people list --format json | jq '.people[0]'
697
+ ```
698
+
699
+ ## Troubleshooting
700
+
701
+ ### Environment Variables Not Set
702
+
703
+ ```bash
704
+ # Error: PIKE13_ACCESS_TOKEN environment variable is required
705
+
706
+ # Solution: Set required environment variables
707
+ export PIKE13_ACCESS_TOKEN="your_access_token"
708
+ export PIKE13_BASE_URL="yourbusiness.pike13.com"
709
+
710
+ # Verify they're set
711
+ echo $PIKE13_ACCESS_TOKEN
712
+ echo $PIKE13_BASE_URL
713
+
714
+ # Or add to your shell profile for persistence
715
+ echo 'export PIKE13_ACCESS_TOKEN="your_token"' >> ~/.bashrc
716
+ echo 'export PIKE13_BASE_URL="yourbusiness.pike13.com"' >> ~/.bashrc
717
+ ```
718
+
719
+ ### API Errors
720
+
721
+ The CLI provides detailed error messages with helpful suggestions:
722
+
723
+ **Resource not found (404)**
724
+ ```bash
725
+ pike13 desk people get 999999
726
+ # Not Found: The requested resource does not exist
727
+ #
728
+ # Suggestions:
729
+ # 1. Verify the resource ID is correct
730
+ # 2. Check if the resource has been deleted
731
+ # 3. Ensure you have permission to access this resource
732
+
733
+ # Use --verbose for more details
734
+ pike13 desk people get 999999 --verbose
735
+ ```
736
+
737
+ **Authentication errors (401)**
738
+ ```bash
739
+ pike13 desk people list
740
+ # Authentication Error: Invalid or expired access token
741
+ #
742
+ # Suggestions:
743
+ # 1. Verify your PIKE13_ACCESS_TOKEN environment variable is set correctly
744
+ # 2. Check if your access token has expired
745
+ # 3. Generate a new access token from your Pike13 account settings
746
+ #
747
+ # Current token: eyJhbGciO...
748
+ ```
749
+
750
+ **Validation errors (422)**
751
+ ```bash
752
+ pike13 desk people create --first-name "John"
753
+ # Validation Error: The request contains invalid data
754
+ #
755
+ # Details: email is required, last_name is required
756
+ #
757
+ # Suggestions:
758
+ # 1. Check that all required fields are provided
759
+ # 2. Verify field formats (dates, emails, etc.)
760
+ # 3. Review the Pike13 API documentation for field requirements
761
+ ```
762
+
763
+ **Rate limit errors (429)**
764
+ ```bash
765
+ # Rate Limit Exceeded: Too many requests
766
+ #
767
+ # Rate limit will reset at: 2025-11-13T01:00:00Z
768
+ #
769
+ # Suggestions:
770
+ # 1. Wait a few minutes before retrying
771
+ # 2. Reduce the frequency of your requests
772
+ # 3. Consider batching operations when possible
773
+ ```
774
+
775
+ **Server errors (5xx)**
776
+ ```bash
777
+ # Server Error: Pike13 API is experiencing issues
778
+ #
779
+ # HTTP Status: 503
780
+ #
781
+ # Suggestions:
782
+ # 1. Wait a few minutes and try again
783
+ # 2. Check Pike13 status page for service updates
784
+ # 3. Contact Pike13 support if the issue persists
785
+ ```
786
+
787
+ **Connection errors**
788
+ ```bash
789
+ # Connection Error: Unable to connect to Pike13 API
790
+ #
791
+ # Error: Connection refused
792
+ #
793
+ # Suggestions:
794
+ # 1. Check your internet connection
795
+ # 2. Verify PIKE13_BASE_URL is set correctly: yourbusiness.pike13.com
796
+ # 3. Check if a firewall is blocking the connection
797
+ # 4. Verify the Pike13 service is available
798
+ ```
799
+
800
+ ### Command Not Found
801
+
802
+ ```bash
803
+ # pike13: command not found
804
+
805
+ # Solution: Ensure gem is installed and in PATH
806
+ gem install pike13-cli
807
+
808
+ # Check if gem bin directory is in PATH
809
+ gem environment
810
+
811
+ # Add to PATH if needed
812
+ export PATH="$PATH:$(gem environment gemdir)/bin"
813
+ ```
814
+
815
+ ### Date Format Errors
816
+
817
+ ```bash
818
+ # Error: Invalid date format for 'from'. Expected YYYY-MM-DD
819
+
820
+ # Solution: Use correct date format
821
+ pike13 desk event_occurrences list --from "2025-01-01" --to "2025-01-31"
822
+
823
+ # Not: --from "01/01/2025" or --from "2025-01"
824
+ ```
825
+
826
+ ### Reporting Filter Syntax
827
+
828
+ ```bash
829
+ # For hash options, use key:value format
830
+ pike13 report clients query --filter has_membership:true
831
+
832
+ # For multiple filters or complex conditions, consult Pike13 API documentation
833
+ # The CLI supports basic hash filters; advanced filters may require API-specific array syntax
834
+ ```
835
+
836
+ ### Large Result Sets
837
+
838
+ ```bash
839
+ # For large reports, use pagination
840
+ pike13 report clients query --page size:100 --page number:1
841
+
842
+ # Or save directly to file
843
+ pike13 report clients query --format csv > clients.csv
844
+ ```
845
+
846
+ ### Getting Help
847
+
848
+ ```bash
849
+ # View help for any command
850
+ pike13 help
851
+ pike13 desk help
852
+ pike13 desk people help
853
+ pike13 desk event_occurrences help
854
+ pike13 desk custom_fields help
855
+ pike13 desk forms_of_payment help
856
+
857
+ # Check your environment
858
+ pike13 version
859
+
860
+ # List all available commands
861
+ pike13 help | grep -A 100 "Commands:"
862
+ ```
863
+
864
+ ## Development
865
+
866
+ ```bash
867
+ # Clone the repository
868
+ git clone https://github.com/juanhuttemann/pike13-cli.git
869
+ cd pike13-cli
870
+
871
+ # Install dependencies
872
+ bundle install
873
+
874
+ # Build and install locally
875
+ gem build pike13-cli.gemspec
876
+ gem install pike13-cli-0.1.0.beta.gem
877
+
878
+ # Test the CLI
879
+ pike13 help
880
+
881
+ # Run tests
882
+ bundle exec rspec
883
+
884
+ # Run rake tasks
885
+ rake console # Open IRB with pike13-cli loaded
886
+ rake install_local # Build and install locally
887
+ rake clean # Remove build artifacts
888
+ ```
889
+
890
+ ## Contributing
891
+
892
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project.
893
+
894
+ ## License
895
+
896
+ [MIT License](LICENSE.txt)