pairit 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.
Files changed (3) hide show
  1. package/README.md +93 -0
  2. package/dist/index.js +10677 -0
  3. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # Pairit CLI
2
+
3
+ A lightweight command line utility for working with Pairit experiment configuration files and media assets. It exposes grouped commands:
4
+
5
+ - `login` — authenticate with Google OAuth (required for all hosted commands)
6
+ - `config lint` — run minimal validation (schema_version, initialPageId, pages)
7
+ - `config compile` — normalize a YAML config and emit sibling canonical JSON
8
+ - `config upload` — compile and upload a config through the manager service
9
+ - `config list` — list configs stored via the manager service
10
+ - `config delete` — delete a stored config
11
+ - `media upload` — upload a binary asset to Cloud Storage via the manager service (uploads are public unless `--private` is passed; the backend selects the bucket unless you override with `--bucket`)
12
+ - `media list` — list media objects in Cloud Storage
13
+ - `media delete` — delete a media object from Cloud Storage
14
+ - `data export` — export sessions, events, and chat messages for a config as CSV/JSON/JSONL
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ bun install
20
+ ```
21
+
22
+ You can invoke the CLI directly using Bun:
23
+
24
+ ```bash
25
+ bun run src/index.ts --help
26
+ ```
27
+
28
+ ### Link globally (optional)
29
+
30
+ ```bash
31
+ cd apps/manager/cli
32
+ bun link
33
+ ```
34
+
35
+ This makes `pairit` available globally from the `bin` field in package.json.
36
+
37
+ ## Usage
38
+
39
+ ```bash
40
+ pairit login # Authenticate (required first)
41
+
42
+ pairit config lint path/to/config.yaml
43
+ pairit config compile path/to/config.yaml
44
+ pairit config upload configs/simple-survey-basic.yaml --owner you@example.com
45
+ pairit config list --owner you@example.com
46
+ pairit config delete 2f3c4d5e...
47
+
48
+ pairit media upload assets/video.mp4 --content-type video/mp4
49
+ pairit media list --prefix onboarding/
50
+ pairit media delete onboarding/intro.mp4
51
+
52
+ pairit data export <configId> # Export as CSV to current dir
53
+ pairit data export <configId> --format json # Export as JSON
54
+ pairit data export <configId> --format jsonl # Export as JSONL
55
+ pairit data export <configId> --out ./exports # Export to specific directory
56
+ ```
57
+
58
+ Add `--private` if you need to keep an object private. Use `--bucket <name>` only when you need to override the backend default.
59
+
60
+ ### Example
61
+
62
+ ```bash
63
+ # Point to local manager server (default is http://localhost:3002)
64
+ export PAIRIT_API_URL=http://localhost:3002
65
+
66
+ bun run apps/manager/cli/src/index.ts config upload configs/simple-survey-basic.yaml --owner you@example.com
67
+ bun run apps/manager/cli/src/index.ts config list
68
+ bun run apps/manager/cli/src/index.ts config delete 2f3c4d5e... --force
69
+
70
+ bun run apps/manager/cli/src/index.ts media upload assets/logo.png
71
+ bun run apps/manager/cli/src/index.ts media list
72
+ bun run apps/manager/cli/src/index.ts media delete onboarding/logo.png --force
73
+ ```
74
+
75
+ `config compile` writes `configs/simple-survey-basic.json` next to the source YAML. `config upload` defaults the config id to a 16-character base64url string derived from the SHA-256 hash of the compiled JSON (unless `--config-id` overrides it).
76
+
77
+ `data export` creates three files in the output directory:
78
+ - `{configId}-sessions.{format}` — session ID, user_state fields (flattened), timestamps, status
79
+ - `{configId}-events.{format}` — session ID, event type, component info, payload, timestamps
80
+ - `{configId}-chat-messages.{format}` — group ID, session ID, sender, content, timestamps
81
+
82
+ All hosted commands require the manager service to be reachable (Cloud Run deployment or local server). Set `PAIRIT_API_URL` to point to the desired target. When unset, the CLI defaults to `http://localhost:3002`.
83
+
84
+ ## Development
85
+
86
+ ```bash
87
+ cd apps/manager/cli
88
+ bun run dev
89
+ bun run lint
90
+ ```
91
+
92
+ `dev` runs in watch mode. `lint` type-checks the TypeScript sources.
93
+