tiime-cli 1.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 +427 -0
- package/dist/cli.js +2639 -0
- package/dist/index.d.ts +554 -0
- package/dist/index.js +694 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Youness Abbal
|
|
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,427 @@
|
|
|
1
|
+
# Tiime CLI
|
|
2
|
+
|
|
3
|
+
CLI et SDK TypeScript pour la comptabilite [Tiime](https://www.tiime.fr) — pilotez votre compta depuis le terminal.
|
|
4
|
+
|
|
5
|
+
Sortie JSON par defaut, ideal pour les agents IA et l'automatisation.
|
|
6
|
+
|
|
7
|
+
## Fonctionnalites
|
|
8
|
+
|
|
9
|
+
- **Factures** — lister, creer, dupliquer, modifier, envoyer, telecharger le PDF, supprimer
|
|
10
|
+
- **Devis** — lister, creer, envoyer, telecharger le PDF
|
|
11
|
+
- **Clients** — consulter, creer, rechercher
|
|
12
|
+
- **Banque** — soldes, comptes, transactions (filtres date/recherche), operations non imputees
|
|
13
|
+
- **Notes de frais** — lister, creer, consulter
|
|
14
|
+
- **Documents** — parcourir, uploader, telecharger, categories
|
|
15
|
+
- **Labels & Tags** — labels personnalises, labels standards, tags
|
|
16
|
+
- **Multi-format** — sortie JSON (defaut), table ou CSV via `--format`
|
|
17
|
+
- **Bilingue** — aide en francais ou anglais (detection automatique de la langue systeme)
|
|
18
|
+
- **SDK programmatique** — utilisable comme librairie TypeScript
|
|
19
|
+
- **Retry automatique** — retry avec backoff sur erreurs 429/5xx
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### Via npm
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g tiime-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Via Homebrew
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
brew tap yabbal/tap
|
|
33
|
+
brew install tiime
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Depuis les sources
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/yabbal/tiime-cli.git
|
|
40
|
+
cd tiime-cli
|
|
41
|
+
pnpm install
|
|
42
|
+
pnpm build
|
|
43
|
+
pnpm link --global
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Verifiez que l'installation fonctionne :
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
tiime --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Autocompletion shell
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# zsh (ajoutez a ~/.zshrc)
|
|
56
|
+
eval "$(tiime completion --shell zsh)"
|
|
57
|
+
|
|
58
|
+
# bash (ajoutez a ~/.bashrc)
|
|
59
|
+
eval "$(tiime completion --shell bash)"
|
|
60
|
+
|
|
61
|
+
# fish
|
|
62
|
+
tiime completion --shell fish | source
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
### 1. Authentification
|
|
68
|
+
|
|
69
|
+
Mode interactif :
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
tiime auth login
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Mode script / CI :
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
tiime auth login --email vous@example.com --password votre-mot-de-passe
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Verifier le statut :
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
tiime auth status
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2. Selection de l'entreprise
|
|
88
|
+
|
|
89
|
+
Listez vos entreprises puis selectionnez-en une :
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
tiime company list
|
|
93
|
+
tiime company use --id 12345
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Verifiez l'entreprise active :
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
tiime company get
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. Langue
|
|
103
|
+
|
|
104
|
+
L'aide s'affiche automatiquement dans la langue de votre systeme (francais ou anglais).
|
|
105
|
+
|
|
106
|
+
Pour forcer une langue :
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Forcer le francais
|
|
110
|
+
TIIME_LANG=fr tiime --help
|
|
111
|
+
|
|
112
|
+
# Forcer l'anglais
|
|
113
|
+
TIIME_LANG=en tiime --help
|
|
114
|
+
|
|
115
|
+
# Ou exporter la variable
|
|
116
|
+
export TIIME_LANG=en
|
|
117
|
+
tiime invoices --help
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Utilisation
|
|
121
|
+
|
|
122
|
+
### Resume rapide
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
tiime status # Resume avec soldes, factures, devis, transactions
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Authentification
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
tiime auth login # Connexion interactive
|
|
132
|
+
tiime auth logout # Deconnexion
|
|
133
|
+
tiime auth status # Statut du token
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Entreprise
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
tiime company list # Lister les entreprises
|
|
140
|
+
tiime company get # Details de l'entreprise active
|
|
141
|
+
tiime company use --id ID # Definir l'entreprise active
|
|
142
|
+
tiime company me # Info utilisateur courant
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Factures
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Lister
|
|
149
|
+
tiime invoices list
|
|
150
|
+
tiime invoices list --status paid
|
|
151
|
+
tiime invoices list --sort invoice_number:asc
|
|
152
|
+
tiime invoices list --all # Toutes les pages
|
|
153
|
+
tiime invoices list --format table # Affichage tableau
|
|
154
|
+
|
|
155
|
+
# Details
|
|
156
|
+
tiime invoices get --id 42
|
|
157
|
+
|
|
158
|
+
# Creer une facture simple
|
|
159
|
+
tiime invoices create \
|
|
160
|
+
--client-id 100 \
|
|
161
|
+
--description "Prestation de conseil" \
|
|
162
|
+
--unit-price 800 \
|
|
163
|
+
--quantity 5 \
|
|
164
|
+
--unit day \
|
|
165
|
+
--vat normal
|
|
166
|
+
|
|
167
|
+
# Creer une facture multi-lignes
|
|
168
|
+
tiime invoices create \
|
|
169
|
+
--client-id 100 \
|
|
170
|
+
--lines '[{"description":"Dev","quantity":20,"unit_price":540,"unit":"day"},{"description":"Design","quantity":5,"unit_price":450,"unit":"day"}]'
|
|
171
|
+
|
|
172
|
+
# Previsualiser sans creer
|
|
173
|
+
tiime invoices create --client-id 100 --description "Test" --unit-price 500 --dry-run
|
|
174
|
+
|
|
175
|
+
# Modifier
|
|
176
|
+
tiime invoices update --id 42 --title "Nouveau titre"
|
|
177
|
+
|
|
178
|
+
# Dupliquer
|
|
179
|
+
tiime invoices duplicate --id 42
|
|
180
|
+
tiime invoices duplicate --id 42 --date 2026-03-01 --quantity 18
|
|
181
|
+
|
|
182
|
+
# Envoyer par email
|
|
183
|
+
tiime invoices send --id 42 --email client@example.com
|
|
184
|
+
|
|
185
|
+
# Telecharger le PDF
|
|
186
|
+
tiime invoices pdf --id 42
|
|
187
|
+
tiime invoices pdf --id 42 --output ma-facture.pdf
|
|
188
|
+
|
|
189
|
+
# Supprimer un brouillon
|
|
190
|
+
tiime invoices delete --id 42
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Devis
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
tiime quotations list # Lister les devis
|
|
197
|
+
tiime quotations get --id 10 # Details d'un devis
|
|
198
|
+
tiime quotations create \ # Creer un devis
|
|
199
|
+
--client-id 100 \
|
|
200
|
+
--description "Mission conseil" \
|
|
201
|
+
--unit-price 600 \
|
|
202
|
+
--quantity 10
|
|
203
|
+
tiime quotations pdf --id 10 # Telecharger le PDF
|
|
204
|
+
tiime quotations send --id 10 --email client@example.com # Envoyer
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Clients
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
tiime clients list # Lister les clients actifs
|
|
211
|
+
tiime clients list --archived # Inclure les archives
|
|
212
|
+
tiime clients get --id 100 # Details d'un client
|
|
213
|
+
tiime clients create --name "ACME" --email contact@acme.com
|
|
214
|
+
tiime clients search --query "acme"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Banque
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
tiime bank accounts # Lister les comptes bancaires
|
|
221
|
+
tiime bank balance # Soldes de tous les comptes
|
|
222
|
+
tiime bank transactions # Dernieres transactions
|
|
223
|
+
tiime bank transactions --from 2026-01-01 --to 2026-01-31
|
|
224
|
+
tiime bank transactions --search "loyer" --all
|
|
225
|
+
tiime bank unimputed # Transactions non imputees
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Notes de frais
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
tiime expenses list # Lister les notes de frais
|
|
232
|
+
tiime expenses get --id 5 # Details d'une note
|
|
233
|
+
tiime expenses create --name "Deplacement client" # Creer
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Documents
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
tiime documents list # Lister les documents
|
|
240
|
+
tiime documents list --type receipt # Filtrer par type
|
|
241
|
+
tiime documents categories # Categories disponibles
|
|
242
|
+
tiime documents upload --file facture.pdf
|
|
243
|
+
tiime documents download --id 123 --output doc.pdf
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Labels & Tags
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
tiime labels list # Labels personnalises
|
|
250
|
+
tiime labels standard # Labels standards (plan comptable)
|
|
251
|
+
tiime labels tags # Tags
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Outils
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
tiime open # Ouvrir Tiime dans le navigateur
|
|
258
|
+
tiime open invoices # Ouvrir la section factures
|
|
259
|
+
tiime version # Afficher la version
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Formats de sortie
|
|
263
|
+
|
|
264
|
+
Toutes les commandes de listing supportent `--format` :
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
tiime invoices list --format json # JSON (defaut)
|
|
268
|
+
tiime invoices list --format table # Tableau ASCII
|
|
269
|
+
tiime invoices list --format csv # CSV
|
|
270
|
+
tiime bank balance --format table
|
|
271
|
+
tiime clients list --format csv > clients.csv
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Pipe avec jq
|
|
275
|
+
|
|
276
|
+
La sortie JSON se combine naturellement avec `jq` :
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Noms des clients
|
|
280
|
+
tiime clients list | jq '.[].name'
|
|
281
|
+
|
|
282
|
+
# Total des factures payees
|
|
283
|
+
tiime invoices list --status paid --all | jq '[.[].total_including_taxes] | add'
|
|
284
|
+
|
|
285
|
+
# Transactions > 1000 EUR
|
|
286
|
+
tiime bank transactions --all | jq '[.[] | select(.amount > 1000)]'
|
|
287
|
+
|
|
288
|
+
# Solde du premier compte
|
|
289
|
+
tiime bank balance | jq '.[0].balance_amount'
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Workflows
|
|
293
|
+
|
|
294
|
+
### Creer et dupliquer une facture mensuelle
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Premier mois : creer la facture de reference
|
|
298
|
+
tiime invoices create \
|
|
299
|
+
--client-id 100 \
|
|
300
|
+
--description "Prestation mensuelle - Janvier 2026" \
|
|
301
|
+
--unit-price 540 \
|
|
302
|
+
--quantity 20 \
|
|
303
|
+
--unit day
|
|
304
|
+
|
|
305
|
+
# Mois suivants : dupliquer en ajustant la date et la quantite
|
|
306
|
+
tiime invoices duplicate --id 42 --date 2026-02-01 --quantity 18
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Voir un resume financier
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Resume complet (soldes, factures, devis, clients)
|
|
313
|
+
tiime status
|
|
314
|
+
|
|
315
|
+
# Ou manuellement avec jq
|
|
316
|
+
tiime bank balance | jq '.[] | {name, balance_amount}'
|
|
317
|
+
tiime invoices list --status sent --all | jq 'length'
|
|
318
|
+
tiime bank unimputed | jq 'length'
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Explorer les transactions du mois
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Transactions de janvier
|
|
325
|
+
tiime bank transactions --from 2026-01-01 --to 2026-01-31 --all \
|
|
326
|
+
| jq 'group_by(.amount > 0) | {depenses: .[0] | length, revenus: .[1] | length}'
|
|
327
|
+
|
|
328
|
+
# Chercher une transaction specifique
|
|
329
|
+
tiime bank transactions --search "adobe" --all
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Exporter des donnees en CSV
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
# Via --format csv
|
|
336
|
+
tiime invoices list --all --format csv > factures.csv
|
|
337
|
+
|
|
338
|
+
# Ou avec jq pour un CSV personnalise
|
|
339
|
+
tiime clients list \
|
|
340
|
+
| jq -r '["id","nom","ville"], (.[] | [.id, .name, .city]) | @csv' \
|
|
341
|
+
> clients.csv
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## SDK
|
|
345
|
+
|
|
346
|
+
Tiime CLI exporte un SDK TypeScript utilisable comme librairie :
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { TiimeClient } from "tiime-cli";
|
|
350
|
+
|
|
351
|
+
const client = new TiimeClient({ companyId: 12345 });
|
|
352
|
+
|
|
353
|
+
// Factures
|
|
354
|
+
const invoices = await client.invoices.list({ status: "paid" });
|
|
355
|
+
const invoice = await client.invoices.get(42);
|
|
356
|
+
const created = await client.invoices.create({
|
|
357
|
+
emission_date: "2026-03-01",
|
|
358
|
+
client: { id: 100 },
|
|
359
|
+
lines: [
|
|
360
|
+
{
|
|
361
|
+
description: "Prestation de conseil",
|
|
362
|
+
quantity: 5,
|
|
363
|
+
unit_amount: 800,
|
|
364
|
+
vat_type: { code: "normal" },
|
|
365
|
+
invoicing_unit: { id: 3, code: "day" },
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
status: "draft",
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// Envoyer une facture
|
|
372
|
+
await client.invoices.send(42, {
|
|
373
|
+
recipients: [{ email: "client@example.com" }],
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// Telecharger un PDF
|
|
377
|
+
const pdf = await client.invoices.downloadPdf(42);
|
|
378
|
+
|
|
379
|
+
// Banque
|
|
380
|
+
const balances = await client.bankAccounts.balance();
|
|
381
|
+
const transactions = await client.bankTransactions.listAll({
|
|
382
|
+
from: "2026-01-01",
|
|
383
|
+
to: "2026-01-31",
|
|
384
|
+
search: "loyer",
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Clients & Fournisseurs
|
|
388
|
+
const clients = await client.clients.list({ archived: false });
|
|
389
|
+
// Devis
|
|
390
|
+
const quotations = await client.quotations.list();
|
|
391
|
+
|
|
392
|
+
// Utilisateur
|
|
393
|
+
const me = await client.users.me();
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Variables d'environnement
|
|
397
|
+
|
|
398
|
+
| Variable | Description | Defaut |
|
|
399
|
+
|----------|-------------|--------|
|
|
400
|
+
| `TIIME_LANG` | Langue de l'aide (`fr` ou `en`) | Detection automatique |
|
|
401
|
+
|
|
402
|
+
## Claude Code Skill
|
|
403
|
+
|
|
404
|
+
Ce CLI est concu pour etre utilise comme skill Claude Code. L'agent peut piloter votre comptabilite Tiime directement depuis une conversation :
|
|
405
|
+
|
|
406
|
+
- Sortie JSON structuree, facilement parseable par l'IA
|
|
407
|
+
- Toutes les commandes sont non-interactives (sauf `auth login` sans arguments)
|
|
408
|
+
- Combinable avec `jq` pour des analyses complexes
|
|
409
|
+
|
|
410
|
+
Pour l'activer, ajoutez le skill dans votre configuration Claude Code (`.claude/skills/`).
|
|
411
|
+
|
|
412
|
+
## Stack technique
|
|
413
|
+
|
|
414
|
+
| Outil | Role |
|
|
415
|
+
|-------|------|
|
|
416
|
+
| [TypeScript](https://www.typescriptlang.org/) | Langage |
|
|
417
|
+
| [citty](https://github.com/unjs/citty) | Framework CLI |
|
|
418
|
+
| [ofetch](https://github.com/unjs/ofetch) | Client HTTP |
|
|
419
|
+
| [@clack/prompts](https://github.com/bombshell-dev/clack) | Prompts interactifs |
|
|
420
|
+
| [cli-table3](https://github.com/cli-table/cli-table3) | Rendu tableau |
|
|
421
|
+
| [tsup](https://github.com/egoist/tsup) | Build |
|
|
422
|
+
| [Biome](https://biomejs.dev/) | Linter & formatter |
|
|
423
|
+
| [Vitest](https://vitest.dev/) | Tests |
|
|
424
|
+
|
|
425
|
+
## Licence
|
|
426
|
+
|
|
427
|
+
MIT — Youness Abbal
|