@getargvio/argvio 0.1.0 → 0.5.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/README.md +32 -6
- package/dist/index.cjs +529 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +249 -48
- package/dist/index.d.ts +249 -48
- package/dist/index.js +500 -196
- package/dist/index.js.map +1 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -50,17 +50,43 @@ try {
|
|
|
50
50
|
For yargs or commander, use the dedicated integration packages instead
|
|
51
51
|
of wiring this up by hand.
|
|
52
52
|
|
|
53
|
+
## Error reasons and counters
|
|
54
|
+
|
|
55
|
+
`recordError` takes an optional third argument, a `reason` from a fixed
|
|
56
|
+
vocabulary you define (sent at `Basic`+ as `cli.error.reason`):
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
client.recordError('mycli run', 'auth', 'no-token')
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`recordCounter` counts something specific to your product. Increments are
|
|
63
|
+
summed in memory and sent as one data point per name and label:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
client.recordCounter('rules.generated', 1, { label: 'get' })
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
> **Warning: counters are accepted at the anonymous tier.** They are sent
|
|
70
|
+
> at every tier, including `Anonymous` and in CI, with no consent choice
|
|
71
|
+
> made. Names and labels must be fixed identifiers chosen in code, **never
|
|
72
|
+
> user input, file paths, host names, URLs, tokens or anything derived
|
|
73
|
+
> from them**. The SDK does not scrub them.
|
|
74
|
+
|
|
75
|
+
Reasons, counter names and counter labels must match
|
|
76
|
+
`^[a-z0-9][a-z0-9._-]*$` and be at most 64 bytes; anything else is
|
|
77
|
+
dropped, not scrubbed. A counter increment `n` must be a positive integer.
|
|
78
|
+
|
|
53
79
|
## Consent tiers
|
|
54
80
|
|
|
55
81
|
Every signal this SDK emits carries a `cli.analytics.tier` attribute
|
|
56
82
|
and is shaped by the tier the current session resolved to:
|
|
57
83
|
|
|
58
|
-
| Tier | Adds
|
|
59
|
-
| --------------------- |
|
|
60
|
-
| `Anonymous` (default) | aggregate invocation/session/exit counts only, no identifiers
|
|
61
|
-
| `Basic` | command path, flag names,
|
|
62
|
-
| `Full` |
|
|
63
|
-
| `OptIn` | raw error messages and stack traces, via `client.optIn()` only
|
|
84
|
+
| Tier | Adds |
|
|
85
|
+
| --------------------- | ------------------------------------------------------------------------------ |
|
|
86
|
+
| `Anonymous` (default) | aggregate invocation/session/exit counts only, no identifiers; vendor counters |
|
|
87
|
+
| `Basic` | command path, flag names, session and install IDs, error types and reasons |
|
|
88
|
+
| `Full` | reserved: nothing beyond `Basic` in this SDK |
|
|
89
|
+
| `OptIn` | raw error messages and stack traces, via `client.optIn()` only |
|
|
64
90
|
|
|
65
91
|
The SDK enforces this client-side — it is structurally difficult to
|
|
66
92
|
call a lower-tier method with a higher-tier field (e.g. `recordError`
|