gigstack 0.1.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.
- package/LICENSE +21 -0
- package/README.md +444 -0
- package/dist/cli.mjs +3068 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 gigstack
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
# gigstack CLI
|
|
2
|
+
|
|
3
|
+
gigstack automates invoicing and revenue management for Mexican businesses. This CLI lets you create CFDI invoices, manage payments, clients, and receipts directly from your terminal or CI/CD pipeline.
|
|
4
|
+
|
|
5
|
+
Built on the [gigstack API](https://docs.gigstack.io).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g gigstack
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After installing, the `gigstack` command is available globally.
|
|
14
|
+
|
|
15
|
+
### Development setup
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/disruptive-learning/gigstack-cli.git
|
|
19
|
+
cd gigstack-cli
|
|
20
|
+
npm install
|
|
21
|
+
npm run build
|
|
22
|
+
npm link
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Authenticate with your API key (get it at app.gigstack.pro/settings > API)
|
|
29
|
+
gigstack login
|
|
30
|
+
|
|
31
|
+
# Verify your account and connection
|
|
32
|
+
gigstack whoami
|
|
33
|
+
gigstack doctor
|
|
34
|
+
|
|
35
|
+
# See a financial summary of your team
|
|
36
|
+
gigstack status
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Authentication
|
|
40
|
+
|
|
41
|
+
The CLI resolves credentials in this order:
|
|
42
|
+
|
|
43
|
+
1. Environment variable `GIGSTACK_API_KEY`
|
|
44
|
+
2. Active profile saved in `~/.config/gigstack/credentials.json`
|
|
45
|
+
|
|
46
|
+
Credentials are stored with `0600` permissions (owner-only read/write).
|
|
47
|
+
|
|
48
|
+
### Commands
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gigstack login # Interactive login
|
|
52
|
+
gigstack login -k <api-key> # Login with key inline
|
|
53
|
+
gigstack login -k <key> -p prod # Save as named profile
|
|
54
|
+
gigstack logout # Remove credentials
|
|
55
|
+
gigstack whoami # Show current account
|
|
56
|
+
gigstack profiles # List saved profiles
|
|
57
|
+
gigstack switch <profile> # Switch active profile
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Multiple profiles
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
gigstack login -k <key-production> -p production
|
|
64
|
+
gigstack login -k <key-staging> -p staging
|
|
65
|
+
gigstack switch production
|
|
66
|
+
gigstack profiles
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## For AI agents
|
|
70
|
+
|
|
71
|
+
The `context` command provides structured domain knowledge that helps agents understand gigstack concepts, statuses, relationships, and available actions.
|
|
72
|
+
|
|
73
|
+
### Topics
|
|
74
|
+
|
|
75
|
+
| Topic | What it covers |
|
|
76
|
+
|-------|---------------|
|
|
77
|
+
| `payments` | Payment lifecycle, statuses, automation types, payment forms |
|
|
78
|
+
| `invoices` | CFDI types (I/E/P/T), PUE vs PPD, folios, cancellation motives |
|
|
79
|
+
| `receipts` | Sales receipts, self-invoice portal, global invoicing (EOM) |
|
|
80
|
+
| `clients` | Fiscal data (RFC, tax system), validation, auto-creation |
|
|
81
|
+
| `cobranza` | Collections/accounts receivable, PPD aging, partial payments |
|
|
82
|
+
| `automations` | Event-driven actions triggered by payments |
|
|
83
|
+
| `services` | Product/service catalog, SAT keys |
|
|
84
|
+
| `webhooks` | Real-time event notifications |
|
|
85
|
+
|
|
86
|
+
### Usage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gigstack context # List all topics
|
|
90
|
+
gigstack context payments # Full knowledge on payments
|
|
91
|
+
gigstack context payments --short # Summary only
|
|
92
|
+
gigstack context payments --json # Machine-readable output
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### JSON mode for agents
|
|
96
|
+
|
|
97
|
+
Every command supports `--json` for structured output that agents can parse:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
gigstack status --json
|
|
101
|
+
gigstack clients list --json
|
|
102
|
+
gigstack invoices list --json --from 2026-01 --to 2026-03
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Commands reference
|
|
106
|
+
|
|
107
|
+
### Status and diagnostics
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gigstack status # Financial dashboard
|
|
111
|
+
gigstack status --from 2026-01 # Filter by date range
|
|
112
|
+
gigstack status --from 30d --to today # Last 30 days
|
|
113
|
+
gigstack doctor # Full system diagnostics
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The `status` command shows:
|
|
117
|
+
- Invoices: valid/cancelled, PUE/PPD breakdown with totals
|
|
118
|
+
- Payments: succeeded/pending/failed with amounts
|
|
119
|
+
- Receipts: pending self-invoicing vs invoiced
|
|
120
|
+
- Cobranza: PPD invoices with outstanding balance, aging buckets (0-15, 16-30, 31-60, 61-90, 90+ days)
|
|
121
|
+
- Conciliation: invoiced vs collected amounts and the difference
|
|
122
|
+
|
|
123
|
+
### Quick pay
|
|
124
|
+
|
|
125
|
+
Register a payment, auto-create the client if needed, and send the self-invoice portal.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
gigstack pay # Interactive mode
|
|
129
|
+
|
|
130
|
+
gigstack pay \
|
|
131
|
+
--email client@company.com \
|
|
132
|
+
--name "Juan Perez" \
|
|
133
|
+
--description "Professional services" \
|
|
134
|
+
--amount 5000 \
|
|
135
|
+
--iva \
|
|
136
|
+
--payment-form 03
|
|
137
|
+
|
|
138
|
+
# From stdin (for agents)
|
|
139
|
+
echo '{"email":"client@co.com","description":"Consulting","amount":5000}' | gigstack pay --stdin --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Automation options (`--automation`):
|
|
143
|
+
|
|
144
|
+
| Value | Description |
|
|
145
|
+
|-------|-------------|
|
|
146
|
+
| `pue_invoice` | PUE invoice stamped immediately (default) |
|
|
147
|
+
| `ppd_invoice_and_complement` | PPD invoice + payment complement |
|
|
148
|
+
| `none` | Record payment only, no invoice |
|
|
149
|
+
|
|
150
|
+
### Clients
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
gigstack clients list # List clients
|
|
154
|
+
gigstack clients get <id> # View details
|
|
155
|
+
gigstack clients create # Create (interactive)
|
|
156
|
+
gigstack clients update <id> # Update (interactive or flags)
|
|
157
|
+
gigstack clients search "ACME" # Search by name, RFC, or email
|
|
158
|
+
gigstack clients validate <id> # Validate fiscal data against SAT
|
|
159
|
+
gigstack clients portal # Generate customer portal link (interactive)
|
|
160
|
+
gigstack clients portal --email cli@co.com # By email
|
|
161
|
+
gigstack clients portal --id client_abc # By client ID
|
|
162
|
+
gigstack clients delete <id> # Delete
|
|
163
|
+
|
|
164
|
+
# Create with flags
|
|
165
|
+
gigstack clients create \
|
|
166
|
+
--name "Mi Empresa SA de CV" \
|
|
167
|
+
--rfc MEMP850101AAA \
|
|
168
|
+
--email billing@company.com \
|
|
169
|
+
--tax-system 601 \
|
|
170
|
+
--zip 06600
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Invoices
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
gigstack invoices list # List income invoices
|
|
177
|
+
gigstack invoices get <uuid> # View details
|
|
178
|
+
gigstack invoices create # Create (interactive or flags)
|
|
179
|
+
gigstack invoices cancel <uuid> --motive 02 # Cancel with SAT
|
|
180
|
+
gigstack invoices search "ACME" # Search by client name, RFC, or UUID
|
|
181
|
+
gigstack invoices files <uuid> # Get PDF/XML download URLs
|
|
182
|
+
gigstack invoices download <uuid> # Download PDF/XML to disk
|
|
183
|
+
gigstack invoices send <uuid> # Send invoice by email
|
|
184
|
+
gigstack invoices drafts list # List draft pre-invoices
|
|
185
|
+
gigstack invoices drafts stamp <uuid> # Stamp a draft into a real CFDI
|
|
186
|
+
gigstack invoices credit-notes # List credit notes (egress invoices)
|
|
187
|
+
gigstack invoices complements # List payment complements
|
|
188
|
+
gigstack invoices complements --invoice <uuid> # Filter by parent PPD invoice
|
|
189
|
+
|
|
190
|
+
# Create with flags
|
|
191
|
+
gigstack invoices create \
|
|
192
|
+
--client client_abc123 \
|
|
193
|
+
--items '[{"description":"Consulting","quantity":1,"unit_price":5000,"product_key":"84111506","unit_key":"E48","taxes":[{"type":"IVA","rate":0.16,"factor":"Tasa","withholding":false}]}]' \
|
|
194
|
+
--payment-form 03 \
|
|
195
|
+
--payment-method PUE
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Cancellation motives: `01` = replacement, `02` = no commercial activity, `03` = wrong operation, `04` = related to global invoice.
|
|
199
|
+
|
|
200
|
+
### Payments
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
gigstack payments list # List payments
|
|
204
|
+
gigstack payments get <id> # View details
|
|
205
|
+
gigstack payments request # Create a payment link
|
|
206
|
+
gigstack payments register # Record a payment already received
|
|
207
|
+
gigstack payments refund <id> # Refund a payment
|
|
208
|
+
|
|
209
|
+
# Request payment (generates a payment link)
|
|
210
|
+
gigstack payments request \
|
|
211
|
+
--client client_abc123 \
|
|
212
|
+
--items '[{"description":"Service","quantity":1,"unit_price":3000}]' \
|
|
213
|
+
--methods card,bank,oxxo \
|
|
214
|
+
--send-email
|
|
215
|
+
|
|
216
|
+
# Register payment received
|
|
217
|
+
gigstack payments register \
|
|
218
|
+
--client client_abc123 \
|
|
219
|
+
--items '[{"description":"Service","quantity":1,"unit_price":3000}]' \
|
|
220
|
+
--payment-form 03
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Services
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
gigstack services list # List product/service catalog
|
|
227
|
+
gigstack services get <id> # View details
|
|
228
|
+
gigstack services create # Create a service
|
|
229
|
+
gigstack services update <id> # Update (interactive or flags)
|
|
230
|
+
gigstack services delete <id> # Delete
|
|
231
|
+
|
|
232
|
+
# Create with flags
|
|
233
|
+
gigstack services create \
|
|
234
|
+
--description "Monthly consulting" \
|
|
235
|
+
--price 10000 \
|
|
236
|
+
--product-key 84111506 \
|
|
237
|
+
--unit-key E48 \
|
|
238
|
+
--iva
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Receipts
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
gigstack receipts list # List sales receipts
|
|
245
|
+
gigstack receipts stamp <id> # Stamp a receipt (generate invoice)
|
|
246
|
+
gigstack receipts cancel <id> # Cancel a receipt
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Webhooks
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
gigstack webhooks list # List configured webhooks
|
|
253
|
+
gigstack webhooks create \
|
|
254
|
+
--url https://example.com/webhook \
|
|
255
|
+
--events invoice.created,payment.succeeded
|
|
256
|
+
gigstack webhooks delete <id> # Delete a webhook
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Teams
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
gigstack teams list # List teams
|
|
263
|
+
gigstack teams get <id> # View team details
|
|
264
|
+
gigstack teams integrations # View active integrations
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Export
|
|
268
|
+
|
|
269
|
+
Export data to CSV (default) or JSON with automatic pagination. Output goes to stdout so you can pipe or redirect it.
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
gigstack export invoices # Export all invoices as CSV
|
|
273
|
+
gigstack export payments --format json # Export payments as JSON
|
|
274
|
+
gigstack export receipts --from 2026-01 --to 2026-03
|
|
275
|
+
gigstack export clients > clients.csv
|
|
276
|
+
|
|
277
|
+
# With filters
|
|
278
|
+
gigstack export invoices --status valid --from 2026-01
|
|
279
|
+
gigstack export payments --status succeeded --currency MXN
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Supported entities: `invoices`, `payments`, `receipts`, `clients`.
|
|
283
|
+
|
|
284
|
+
### Forecast
|
|
285
|
+
|
|
286
|
+
Project revenue, collections risk, EOM receipts, and cash flow based on historical data.
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
gigstack forecast # This month projection (3 months ahead)
|
|
290
|
+
gigstack forecast --months 6 # Project 6 months ahead
|
|
291
|
+
gigstack forecast --json # Structured output for agents
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Shows:
|
|
295
|
+
- Revenue trend (avg monthly, growth %, projection)
|
|
296
|
+
- Cobranza risk (PPD aging probability, expected recovery vs likely loss)
|
|
297
|
+
- EOM global invoice estimate (pending receipts x historical self-invoice rate)
|
|
298
|
+
- Cash flow projection (pending links x conversion rate + expected PPD collections)
|
|
299
|
+
|
|
300
|
+
### Shell completions
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# Bash — add to ~/.bashrc
|
|
304
|
+
eval "$(gigstack completions bash)"
|
|
305
|
+
|
|
306
|
+
# Zsh — add to ~/.zshrc
|
|
307
|
+
eval "$(gigstack completions zsh)"
|
|
308
|
+
|
|
309
|
+
# Fish — save to completions directory
|
|
310
|
+
gigstack completions fish > ~/.config/fish/completions/gigstack.fish
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Filtering and pagination
|
|
314
|
+
|
|
315
|
+
All `list` commands share these options:
|
|
316
|
+
|
|
317
|
+
| Flag | Description | Default |
|
|
318
|
+
|------|-------------|---------|
|
|
319
|
+
| `-l, --limit <n>` | Results per page (1-100) | `20` |
|
|
320
|
+
| `--next <token>` | Pagination cursor from previous response | — |
|
|
321
|
+
| `--from <date>` | Start date | — |
|
|
322
|
+
| `--to <date>` | End date | — |
|
|
323
|
+
| `--sort <dir>` | Sort direction: `asc` or `desc` | `desc` |
|
|
324
|
+
| `--order-by <field>` | Sort field: `timestamp` or `name` | `timestamp` |
|
|
325
|
+
|
|
326
|
+
Date formats accepted: `YYYY-MM-DD`, `YYYY-MM` (expands to full month), `30d` / `7d` (relative days), `today`.
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
gigstack invoices list --from 2026-01 --to 2026-03
|
|
330
|
+
gigstack payments list --from 30d --limit 50
|
|
331
|
+
gigstack receipts list --sort asc --limit 100
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
When there are more results, the CLI prints a `--next` token. Pass it to get the next page:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
gigstack invoices list --limit 20
|
|
338
|
+
# ... shows --next abc123
|
|
339
|
+
gigstack invoices list --limit 20 --next abc123
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Global options
|
|
343
|
+
|
|
344
|
+
| Flag | Description |
|
|
345
|
+
|------|-------------|
|
|
346
|
+
| `--json` | JSON output (for scripts and agents) |
|
|
347
|
+
| `--team <id>` | Operate on a specific team (gigstack Connect) |
|
|
348
|
+
| `-h, --help` | Show help |
|
|
349
|
+
| `-V, --version` | Show version |
|
|
350
|
+
|
|
351
|
+
## Examples
|
|
352
|
+
|
|
353
|
+
### Check collections (cobranza)
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
# Quick summary with aging breakdown
|
|
357
|
+
gigstack status
|
|
358
|
+
|
|
359
|
+
# JSON output for processing
|
|
360
|
+
gigstack status --json | jq '.cobranza'
|
|
361
|
+
|
|
362
|
+
# List PPD invoices with outstanding balance
|
|
363
|
+
gigstack invoices list --json | jq '[.[] | select(.payment_method == "PPD" and .last_balance > 0)]'
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Create and send an invoice
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# Interactive — walks you through client search, items, and payment method
|
|
370
|
+
gigstack invoices create
|
|
371
|
+
|
|
372
|
+
# Scripted — everything via flags
|
|
373
|
+
gigstack invoices create \
|
|
374
|
+
--client client_abc123 \
|
|
375
|
+
--items '[{"description":"Web development","quantity":40,"unit_price":500,"product_key":"84111506","unit_key":"HUR","taxes":[{"type":"IVA","rate":0.16,"factor":"Tasa","withholding":false}]}]' \
|
|
376
|
+
--payment-form 03 \
|
|
377
|
+
--payment-method PUE \
|
|
378
|
+
--send-email
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Export a monthly report
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Invoices for March 2026
|
|
385
|
+
gigstack export invoices --from 2026-03 --to 2026-03 > invoices-march.csv
|
|
386
|
+
|
|
387
|
+
# All succeeded payments this year as JSON
|
|
388
|
+
gigstack export payments --from 2026-01 --status succeeded --format json > payments-2026.json
|
|
389
|
+
|
|
390
|
+
# Client directory
|
|
391
|
+
gigstack export clients > clients.csv
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Charge and invoice in one step
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
gigstack pay \
|
|
398
|
+
--email client@company.com \
|
|
399
|
+
--name "Client Name" \
|
|
400
|
+
--description "March consulting" \
|
|
401
|
+
--amount 15000 \
|
|
402
|
+
--iva \
|
|
403
|
+
--payment-form 03
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Use in CI/CD
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
export GIGSTACK_API_KEY=your_api_key
|
|
410
|
+
gigstack invoices list --json | jq '.[] | {uuid, total, status}'
|
|
411
|
+
gigstack status --json
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Agent workflow
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# 1. Understand the domain
|
|
418
|
+
gigstack context payments --json
|
|
419
|
+
|
|
420
|
+
# 2. Get current financial state
|
|
421
|
+
gigstack status --json
|
|
422
|
+
|
|
423
|
+
# 3. Find a client
|
|
424
|
+
gigstack clients search "ACME" --json
|
|
425
|
+
|
|
426
|
+
# 4. Create an invoice
|
|
427
|
+
gigstack invoices create --client client_abc --items '[...]' --payment-form 03 --json
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## Development
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
git clone https://github.com/disruptive-learning/gigstack-cli.git
|
|
434
|
+
cd gigstack-cli
|
|
435
|
+
npm install
|
|
436
|
+
npm run dev -- --help # Run in development mode
|
|
437
|
+
npm run build # Compile to dist/
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Links
|
|
441
|
+
|
|
442
|
+
- [API Docs](https://docs.gigstack.io)
|
|
443
|
+
- [App](https://app.gigstack.pro)
|
|
444
|
+
- [Help Center](https://helpcenter.gigstack.pro)
|