@sinoia/hubdoc-tools 1.8.3 → 1.10.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.
Files changed (3) hide show
  1. package/cli.js +1782 -854
  2. package/docs/llm-usage.md +103 -0
  3. package/package.json +1 -1
package/docs/llm-usage.md CHANGED
@@ -362,6 +362,109 @@ hubdoc permissions ls --on="$WS" --on-type=workspace --json \
362
362
  | jq '.[] | {actor: .actor.display_name, level}'
363
363
  ```
364
364
 
365
+ ### Projects / Sprints / Tickets / Tasks (corex#588)
366
+
367
+ Manage projects (attached to a workspace or standalone), their sprints,
368
+ tickets and sub-tasks — the same domain Synapse agents drive when they
369
+ consume incoming emails, produce deliverables, or hand off work between
370
+ themselves. All commands support `--json` for machine parsing.
371
+
372
+ `hubdoc projects` (top-level: attached to a workspace or standalone) —
373
+ `ls | show | create | update | delete | archive | publish`.
374
+ `--workspace null` filters the standalone (unattached) projects.
375
+
376
+ `hubdoc sprints --project=<pid>` — `ls | show | create | update | delete
377
+ | start | complete`.
378
+
379
+ `hubdoc tickets --project=<pid>` — `ls | show | create | update | delete
380
+ | assign | status | move | activities | deliverable | dispatch |
381
+ comment | comments`. Every verb requires `--project=<pid>`. `ls
382
+ --backlog` (or `ls --sprint null`) lists the backlog. `assign --to null`
383
+ unassigns. `status --to <state> [--column <col>]` uses the canonical
384
+ statuses: `open | in_progress | done | blocked | awaiting_human |
385
+ cancelled | failed` and optionally pins the kanban column at the same
386
+ time. `comment <id> --body <text>` (or `--body-file <path>`) posts a
387
+ message on the ticket's discussion thread (visible in Corex / Agoria,
388
+ attributed to the token holder); `comments <id>` reads the thread
389
+ oldest-first (paginated like `activities`).
390
+
391
+ `hubdoc tasks --project=<pid> --ticket=<tid>` — `ls | show | create |
392
+ update | delete | complete | reorder`. Sub-tasks live under a ticket;
393
+ both parents are required on every call.
394
+
395
+ **Pagination**: all `ls`-shaped verbs return `{ items, pagination:{ page,
396
+ per_page, pages, count, has_more } }` in `--json`. The transport under
397
+ the hood is a bare JSON array plus `X-Total-*` headers (Pagy), same
398
+ convention as `/api/v1/documents`; the CLI normalises so agents don't
399
+ need to touch headers.
400
+
401
+ **Idempotence caveat**: `sprints start` / `sprints complete` follow the
402
+ interactor semantics — re-triggering on a sprint already in the target
403
+ state returns **422** (`unprocessable_entity` with an
404
+ `already_active` / `already_completed` message), not 200.
405
+
406
+ **Deliverables**: `tickets deliverable <id> --deliverable <did>`
407
+ publishes an EXISTING deliverable already attached to the ticket (via
408
+ web UI or a future create endpoint). The API does not yet support
409
+ creating + publishing a deliverable in one CLI call — track corex#588
410
+ follow-ups.
411
+
412
+ **Dispatch**: `tickets dispatch <id>` fires the agent already configured
413
+ on the ticket (`agent_config` is read from the ticket's persisted
414
+ state). To change the agent config, set it on the ticket via the web UI
415
+ or a future `update` extension — the CLI cannot pass it in the request
416
+ body today.
417
+
418
+ #### End-to-end example: agent turns an incoming email into a mission
419
+
420
+ ```bash
421
+ # 0. The Synapse poller has already dropped the raw .eml + attachments
422
+ # into Hubdoc and passed us the email doc id.
423
+ EMAIL_ID="doc-42"
424
+
425
+ # 1. Detach attachments so the agent can classify them separately.
426
+ hubdoc files detach "$EMAIL_ID" --ext pdf,docx --json
427
+
428
+ # 2. Pick the standalone project used for triage (no workspace linkage).
429
+ PID=$(hubdoc projects ls --workspace null --type-id "$TRIAGE_PT_ID" --json \
430
+ | jq -r '.items[0].id')
431
+
432
+ # 3. Create a ticket in the current sprint, priority high, due next week.
433
+ SID=$(hubdoc sprints ls --project "$PID" --status active --json \
434
+ | jq -r '.items[0].id')
435
+ TID=$(hubdoc tickets create --project "$PID" \
436
+ --title "Client X – devis à produire" \
437
+ --sprint "$SID" --assignee "u-1" \
438
+ --priority high --due 2026-07-18 \
439
+ --labels "commercial,urgent" --json | jq -r '.data.id')
440
+
441
+ # 4. Break it down into tasks the agent will chew through.
442
+ hubdoc tasks create --project "$PID" --ticket "$TID" \
443
+ --title "Lire pièces jointes" --priority high --json
444
+ hubdoc tasks create --project "$PID" --ticket "$TID" \
445
+ --title "Rédiger devis" --priority high --due 2026-07-16 --json
446
+
447
+ # 5. Dispatch the agent already configured on the ticket.
448
+ hubdoc tickets dispatch "$TID" --project "$PID" --json
449
+
450
+ # 6. Later — post a follow-up on the ticket thread (visible to the human):
451
+ hubdoc tickets comment "$TID" --project "$PID" \
452
+ --body "Point d’avancement : devis en cours de rédaction, ETA demain 10h." --json
453
+
454
+ # 7. Publish an already-attached deliverable and close the ticket.
455
+ hubdoc tickets deliverable "$TID" --project "$PID" \
456
+ --deliverable "$DELIVERABLE_ID" --json
457
+ hubdoc tickets status "$TID" --project "$PID" \
458
+ --to done --column done --json
459
+ ```
460
+
461
+ Common patterns:
462
+ - **Move a ticket to the backlog**: `hubdoc tickets move <id> --project=<pid>
463
+ --backlog` (equivalent to `--sprint null`).
464
+ - **Un-assign**: `hubdoc tickets assign <id> --project=<pid> --to null`.
465
+ - **Reorder a ticket's tasks** (drag-and-drop from the UI equivalent):
466
+ `hubdoc tasks reorder --project=<pid> --ticket=<tid> --order=k3,k1,k2`.
467
+
365
468
  ## Out of scope (planned)
366
469
 
367
470
  - `hubdoc templates create|update|delete` — depends on corex#417 backend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinoia/hubdoc-tools",
3
- "version": "1.8.3",
3
+ "version": "1.10.0",
4
4
  "description": "Professional command-line tool for HubDoc document management and bulk import/export",
5
5
  "main": "cli.js",
6
6
  "bin": {