@purveyors/cli 0.23.0 → 0.25.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 +68 -9
- package/dist/commands/market.d.ts +8 -0
- package/dist/commands/market.d.ts.map +1 -0
- package/dist/commands/market.js +188 -0
- package/dist/commands/market.js.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/manifest.d.ts.map +1 -1
- package/dist/lib/manifest.js +84 -1
- package/dist/lib/manifest.js.map +1 -1
- package/dist/lib/market.d.ts +239 -0
- package/dist/lib/market.d.ts.map +1 -0
- package/dist/lib/market.js +29 -0
- package/dist/lib/market.js.map +1 -0
- package/dist/lib/parchment.d.ts +9 -0
- package/dist/lib/parchment.d.ts.map +1 -1
- package/dist/lib/parchment.js +13 -0
- package/dist/lib/parchment.js.map +1 -1
- package/dist/lib/roast.d.ts +10 -2
- package/dist/lib/roast.d.ts.map +1 -1
- package/dist/lib/roast.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +6 -1
- package/dist/program.js.map +1 -1
- package/package.json +3 -3
- package/dist/lib/artisan/db.d.ts +0 -37
- package/dist/lib/artisan/db.d.ts.map +0 -1
- package/dist/lib/artisan/db.js +0 -51
- package/dist/lib/artisan/db.js.map +0 -1
- package/dist/lib/artisan/import.d.ts +0 -16
- package/dist/lib/artisan/import.d.ts.map +0 -1
- package/dist/lib/artisan/import.js +0 -447
- package/dist/lib/artisan/import.js.map +0 -1
- package/dist/lib/artisan/index.d.ts +0 -9
- package/dist/lib/artisan/index.d.ts.map +0 -1
- package/dist/lib/artisan/index.js +0 -7
- package/dist/lib/artisan/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Coffee intelligence from your terminal.
|
|
4
4
|
|
|
5
|
-
`purvey` is the official CLI for [purveyors.io](https://purveyors.io). It gives coffee professionals, developers, and AI agents direct access to the Purveyors platform from the terminal: catalog search, price-index snapshots, procurement brief reads, inventory tracking, roast logging, sales records, tasting notes, and Artisan `.alog` import.
|
|
5
|
+
`purvey` is the official CLI for [purveyors.io](https://purveyors.io). It gives coffee professionals, developers, and AI agents direct access to the Purveyors platform from the terminal: catalog search, Market Index intelligence, price-index snapshots, procurement brief reads, inventory tracking, roast logging, sales records, tasting notes, and Artisan `.alog` import.
|
|
6
6
|
|
|
7
7
|
Use `purvey --help` for quick command discovery, `purvey context` for the dense human-readable operator reference, `purvey manifest` for the preferred machine-readable contract, or `@purveyors/cli/manifest` in-process.
|
|
8
8
|
|
|
@@ -14,6 +14,7 @@ Use `purvey --help` for quick command discovery, `purvey context` for the dense
|
|
|
14
14
|
- No pre-existing session required: `auth`, `config`, `context`, `manifest`
|
|
15
15
|
- Viewer role required: `catalog` (excluding structured process filters on `catalog search`)
|
|
16
16
|
- Member role required: `price-index`, `procurement`, `inventory`, `roast`, `sales`, `tasting`
|
|
17
|
+
- Mixed public and entitled access: `market` public teaser slices are unauthenticated; filtered slices require Parchment Intelligence access
|
|
17
18
|
- Preferred machine-readable contract: `purvey manifest`
|
|
18
19
|
- Dense human-readable reference: `purvey context`
|
|
19
20
|
- Compatibility JSON alias: `purvey context --json`
|
|
@@ -79,16 +80,19 @@ purvey catalog search --origin "Ethiopia" --stocked --pretty
|
|
|
79
80
|
# Example with structured process filters and proof output
|
|
80
81
|
purvey catalog search --origin "Ethiopia" --processing-base-method "Washed" --include-proof --pretty
|
|
81
82
|
|
|
82
|
-
# 4.
|
|
83
|
+
# 4. Read a public Market Index teaser slice
|
|
84
|
+
purvey market signals --summary --pretty
|
|
85
|
+
|
|
86
|
+
# 5. Check inventory (requires member role)
|
|
83
87
|
purvey inventory list --stocked --pretty
|
|
84
88
|
|
|
85
|
-
#
|
|
89
|
+
# 6. Import a roast from Artisan
|
|
86
90
|
purvey roast import ~/artisan/my-roast.alog --coffee-id 7 --pretty
|
|
87
91
|
|
|
88
|
-
#
|
|
92
|
+
# 7. Get the machine-readable CLI contract
|
|
89
93
|
purvey manifest
|
|
90
94
|
|
|
91
|
-
#
|
|
95
|
+
# 8. Get the dense readable CLI reference
|
|
92
96
|
purvey context
|
|
93
97
|
```
|
|
94
98
|
|
|
@@ -109,13 +113,13 @@ The npm package is both a binary and a shared TypeScript product surface. `coffe
|
|
|
109
113
|
| -------------------------- | ------------------------------------------------------------------------------------ |
|
|
110
114
|
| `@purveyors/cli` | CLI entrypoint package root |
|
|
111
115
|
| `@purveyors/cli/catalog` | Catalog search, lookup, stats, premium ranking, supplier aggregates, similar coffees |
|
|
116
|
+
| `@purveyors/cli/market` | Market Index value signals, movement stats, and metadata trends |
|
|
112
117
|
| `@purveyors/cli/inventory` | Green coffee inventory operations |
|
|
113
118
|
| `@purveyors/cli/roast` | Roast profile operations |
|
|
114
119
|
| `@purveyors/cli/sales` | Sales record operations |
|
|
115
120
|
| `@purveyors/cli/tasting` | Tasting note and rating operations |
|
|
116
121
|
| `@purveyors/cli/lib` | Shared library helpers |
|
|
117
122
|
| `@purveyors/cli/manifest` | Stable machine-readable CLI manifest |
|
|
118
|
-
| `@purveyors/cli/artisan` | Artisan `.alog` parsing and import utilities |
|
|
119
123
|
| `@purveyors/cli/ai` | AI helper surface used by CLI workflows |
|
|
120
124
|
|
|
121
125
|
Shell integrations should usually start with `purvey manifest`. In-process agent and website integrations should import the smallest relevant subpath instead of shelling out when they are already running in Node.js.
|
|
@@ -135,6 +139,7 @@ All remote data commands require a valid authenticated session:
|
|
|
135
139
|
|
|
136
140
|
- `catalog` requires the `viewer` role by default
|
|
137
141
|
- `catalog search` structured process filters require the `member` role under the current session-authenticated CLI path
|
|
142
|
+
- `market` has public teaser slices for `signals --summary`, unfiltered retail `stats`, and process/retail/month `metadata`; all filtered or non-public slices require Parchment Intelligence access enforced server-side
|
|
138
143
|
- `price-index`, `procurement`, `inventory`, `roast`, `sales`, and `tasting` require the `member` role under the session-authenticated CLI path
|
|
139
144
|
|
|
140
145
|
`purvey` uses Google OAuth through purveyors.io.
|
|
@@ -179,6 +184,8 @@ Credentials are stored at `~/.config/purvey/credentials.json`.
|
|
|
179
184
|
| `viewer` | `catalog search`, `catalog get`, `catalog stats`, excluding structured process filters |
|
|
180
185
|
| `member` | All viewer commands, `catalog similar`, structured process filters on `catalog search`, plus `price-index`, `procurement`, `inventory`, `roast`, `sales`, `tasting` under the session-authenticated CLI path |
|
|
181
186
|
|
|
187
|
+
Market Index teaser slices are public. Filtered `market signals`, origin/process/wholesale `market stats`, and non-public `market metadata` slices require Parchment Intelligence access; API-key and session-token denial is enforced by the canonical API.
|
|
188
|
+
|
|
182
189
|
`auth`, `config`, `context`, and `manifest` remain available without a pre-existing session.
|
|
183
190
|
|
|
184
191
|
Commands that require a higher role exit with code `3` on auth failure. That includes not being signed in, an expired session, or an insufficient role.
|
|
@@ -441,6 +448,58 @@ Notes:
|
|
|
441
448
|
- Session-token use requires the local `member` role; API-key use is accepted via `PARCHMENT_API_KEY` or `PURVEYORS_API_KEY` and PPI entitlement is enforced server-side.
|
|
442
449
|
- `PARCHMENT_API_BASE_URL` overrides the canonical API base for this SDK-backed command. `PURVEYORS_BASE_URL` is also accepted for shared environment compatibility.
|
|
443
450
|
|
|
451
|
+
### market
|
|
452
|
+
|
|
453
|
+
- `purvey market signals`
|
|
454
|
+
- `purvey market stats`
|
|
455
|
+
- `purvey market metadata`
|
|
456
|
+
|
|
457
|
+
`market signals` filters:
|
|
458
|
+
|
|
459
|
+
- `--summary`; public counts-only teaser slice
|
|
460
|
+
- `--type <price_drop|below_market|value_quality>`; repeatable or comma-separated
|
|
461
|
+
- `--origin <origin>`
|
|
462
|
+
- `--process <method>`
|
|
463
|
+
- `--market <retail|wholesale|all>`
|
|
464
|
+
- `--min-discount <n>`
|
|
465
|
+
- `--min-score <n>`
|
|
466
|
+
- `--window <7d|30d>`
|
|
467
|
+
- `--limit <n>`
|
|
468
|
+
|
|
469
|
+
`market stats` filters:
|
|
470
|
+
|
|
471
|
+
- `--origin <origin>`
|
|
472
|
+
- `--process <method>`
|
|
473
|
+
- `--market <retail|wholesale|all>`
|
|
474
|
+
- `--window <7d|30d>`
|
|
475
|
+
- `--baseline-weeks <n>`; 8-52
|
|
476
|
+
|
|
477
|
+
`market metadata` filters:
|
|
478
|
+
|
|
479
|
+
- `--dimension <process|disclosure|score>`
|
|
480
|
+
- `--origin <origin>`
|
|
481
|
+
- `--market <retail|wholesale|all>`
|
|
482
|
+
- `--grain <week|month>`
|
|
483
|
+
- `--from <YYYY-MM-DD>`
|
|
484
|
+
- `--to <YYYY-MM-DD>`
|
|
485
|
+
|
|
486
|
+
Examples:
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
purvey market signals --summary --pretty
|
|
490
|
+
purvey market signals --type price_drop --origin "Ethiopia" --json
|
|
491
|
+
purvey market stats --pretty
|
|
492
|
+
purvey market metadata --dimension score --origin "Ethiopia" --grain month --json
|
|
493
|
+
PARCHMENT_API_KEY="$PURVEYORS_API_KEY" purvey market signals --market wholesale --json
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Notes:
|
|
497
|
+
|
|
498
|
+
- `market` commands are backed by canonical Parchment API endpoints through `@purveyors/sdk`; the CLI does not compute Market Index intelligence locally.
|
|
499
|
+
- Public teaser slices: `signals --summary`, `stats` with no origin/process and `market=retail`, and `metadata` at dimension=process/no-origin/market=retail/grain=month.
|
|
500
|
+
- Any filtered or non-public market slice requires Parchment Intelligence access, enforced server-side for both API-key and session-token calls.
|
|
501
|
+
- `--json` returns the API response verbatim.
|
|
502
|
+
|
|
444
503
|
### procurement
|
|
445
504
|
|
|
446
505
|
- `purvey procurement list`
|
|
@@ -826,7 +885,7 @@ Use the right ID for the right command.
|
|
|
826
885
|
- `PURVEYORS_BASE_URL`: override the Purveyors web base URL
|
|
827
886
|
- `PURVEYORS_API_KEY`: API-key token used by API-backed catalog proof reads, paid-tier similarity reads, and SDK-backed Parchment commands when you want to call canonical API contracts without relying on the local OAuth session
|
|
828
887
|
- `PARCHMENT_API_KEY`: preferred API-key variable for SDK-backed Parchment commands; also accepted for API-backed proof and paid-tier similarity paths
|
|
829
|
-
- `PARCHMENT_API_BASE_URL`: override the SDK-backed Parchment API base URL for `price-index
|
|
888
|
+
- `PARCHMENT_API_BASE_URL`: override the SDK-backed Parchment API base URL for `market`, `price-index`, and `procurement` commands
|
|
830
889
|
- `PURVEY_DEBUG`: enable verbose error output
|
|
831
890
|
|
|
832
891
|
## For AI agents
|
|
@@ -859,10 +918,10 @@ Agent integration rules of thumb:
|
|
|
859
918
|
|
|
860
919
|
- Discover first with `purvey manifest`, then call the narrowest command or package subpath that fits the job.
|
|
861
920
|
- Use `purvey context` when a human-readable operator summary is useful before tool selection.
|
|
862
|
-
- Prefer OAuth session tokens for normal user workflows; use `PURVEYORS_API_KEY` or `PARCHMENT_API_KEY` only when you intentionally need an API-key-backed Parchment path such as catalog proof, paid-tier similarity, price-index, or procurement reads.
|
|
921
|
+
- Prefer OAuth session tokens for normal user workflows; use `PURVEYORS_API_KEY` or `PARCHMENT_API_KEY` only when you intentionally need an API-key-backed Parchment path such as catalog proof, paid-tier similarity, market intelligence, price-index, or procurement reads.
|
|
863
922
|
- Treat `--include-proof` as API output, not a local scoring feature. If a filter cannot round-trip through `/v1/catalog?include=proof`, the CLI rejects that invocation instead of returning misleading proof data.
|
|
864
923
|
- Treat `catalog similar` as the canonical `/v1/catalog/{id}/similar` contract. Preserve the distinction between `canonical_candidates` and `similar_recommendations`; do not flatten or re-sort grouped results unless you have a specific downstream reason.
|
|
865
|
-
- Treat `price-index
|
|
924
|
+
- Treat `market`, `price-index`, and `procurement` as SDK-backed canonical API reads. Do not add procurement create/write behavior to this command group until the Phase 2 write contract ships.
|
|
866
925
|
|
|
867
926
|
## Troubleshooting
|
|
868
927
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* `purvey market` — Market Index decision surface reads over the canonical API.
|
|
4
|
+
* Public teaser slices work unauthenticated; entitled slices require a session
|
|
5
|
+
* or API key with Parchment Intelligence, enforced server-side.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildMarketCommand(): Command;
|
|
8
|
+
//# sourceMappingURL=market.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/commands/market.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgFpC;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAyJ5C"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { outputData } from '../lib/output.js';
|
|
3
|
+
import { withErrorHandling, PrvrsError } from '../lib/errors.js';
|
|
4
|
+
import { createOptionalParchmentClient, unwrapParchment } from '../lib/parchment.js';
|
|
5
|
+
const SIGNAL_TYPES = ['price_drop', 'below_market', 'value_quality'];
|
|
6
|
+
const MARKETS = ['retail', 'wholesale', 'all'];
|
|
7
|
+
const WINDOWS = ['7d', '30d'];
|
|
8
|
+
const DIMENSIONS = ['process', 'disclosure', 'score'];
|
|
9
|
+
const GRAINS = ['week', 'month'];
|
|
10
|
+
function parsePositiveInt(rawValue, flag) {
|
|
11
|
+
const parsed = Number(rawValue.trim());
|
|
12
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
13
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid ${flag}: "${rawValue}". Must be a positive integer.`);
|
|
14
|
+
}
|
|
15
|
+
return parsed;
|
|
16
|
+
}
|
|
17
|
+
function parseIntRange(rawValue, flag, min, max) {
|
|
18
|
+
const parsed = parsePositiveInt(rawValue, flag);
|
|
19
|
+
if (parsed < min || parsed > max) {
|
|
20
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid ${flag}: "${rawValue}". Must be between ${min} and ${max}.`);
|
|
21
|
+
}
|
|
22
|
+
return parsed;
|
|
23
|
+
}
|
|
24
|
+
function parseNumber(rawValue, flag) {
|
|
25
|
+
const parsed = Number(rawValue.trim());
|
|
26
|
+
if (!Number.isFinite(parsed)) {
|
|
27
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid ${flag}: "${rawValue}". Must be a number.`);
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
function parseEnum(rawValue, flag, values) {
|
|
32
|
+
const value = rawValue.trim();
|
|
33
|
+
if (values.includes(value))
|
|
34
|
+
return value;
|
|
35
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid ${flag}: "${rawValue}". Must be one of: ${values.join(', ')}.`);
|
|
36
|
+
}
|
|
37
|
+
function parseIsoDate(rawValue, flag) {
|
|
38
|
+
const value = rawValue.trim();
|
|
39
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
40
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid ${flag}: "${rawValue}". Must be an ISO date (YYYY-MM-DD).`);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
/** Repeatable/comma-separated `--type` collector preserving all requested types. */
|
|
45
|
+
function collectSignalTypes(rawValue, previous) {
|
|
46
|
+
const parts = rawValue
|
|
47
|
+
.split(',')
|
|
48
|
+
.map((part) => part.trim())
|
|
49
|
+
.filter(Boolean);
|
|
50
|
+
for (const part of parts) {
|
|
51
|
+
if (!SIGNAL_TYPES.includes(part)) {
|
|
52
|
+
throw new PrvrsError('INVALID_ARGUMENT', `Invalid --type: "${part}". Must be one of: ${SIGNAL_TYPES.join(', ')}.`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return [...previous, ...parts];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `purvey market` — Market Index decision surface reads over the canonical API.
|
|
59
|
+
* Public teaser slices work unauthenticated; entitled slices require a session
|
|
60
|
+
* or API key with Parchment Intelligence, enforced server-side.
|
|
61
|
+
*/
|
|
62
|
+
export function buildMarketCommand() {
|
|
63
|
+
const market = new Command('market').description('Market Index decision surface: value signals, movement stats, and metadata trends');
|
|
64
|
+
// market signals
|
|
65
|
+
market
|
|
66
|
+
.command('signals')
|
|
67
|
+
.description('Actionable market value signals (public summary via --summary)')
|
|
68
|
+
.option('--summary', 'Return the unfiltered public signal summary (counts only; no auth needed)')
|
|
69
|
+
.option('--type <type>', 'Signal type filter; repeatable or comma-separated (price_drop|below_market|value_quality)', collectSignalTypes, [])
|
|
70
|
+
.option('--origin <origin>', 'Filter by origin')
|
|
71
|
+
.option('--process <method>', 'Filter by process bucket')
|
|
72
|
+
.option('--market <retail|wholesale|all>', 'Market scope')
|
|
73
|
+
.option('--min-discount <n>', 'Minimum signal magnitude / discount percent')
|
|
74
|
+
.option('--min-score <n>', 'Minimum score_value')
|
|
75
|
+
.option('--window <7d|30d>', 'Trailing window')
|
|
76
|
+
.option('--limit <n>', 'Results per page')
|
|
77
|
+
.addHelpText('after', `
|
|
78
|
+
Examples:
|
|
79
|
+
purvey market signals --summary --pretty
|
|
80
|
+
purvey market signals --type price_drop --type below_market --origin "Ethiopia" --json
|
|
81
|
+
purvey market signals --market wholesale --min-discount 10 --window 7d --json
|
|
82
|
+
|
|
83
|
+
Notes:
|
|
84
|
+
--summary is the only unauthenticated slice; any filter requires Parchment Intelligence access.
|
|
85
|
+
Related: 'purvey market stats' (movement significance), 'purvey price-index' (aggregate snapshots).
|
|
86
|
+
Set PARCHMENT_API_KEY or PURVEYORS_API_KEY to use an API key instead of the logged-in session.`)
|
|
87
|
+
.action(withErrorHandling(async (opts, cmd) => {
|
|
88
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
89
|
+
const query = {};
|
|
90
|
+
if (opts.summary === true)
|
|
91
|
+
query.summary = 'true';
|
|
92
|
+
const types = opts.type;
|
|
93
|
+
if (types.length > 0)
|
|
94
|
+
query.type = types;
|
|
95
|
+
if (opts.origin !== undefined)
|
|
96
|
+
query.origin = opts.origin;
|
|
97
|
+
if (opts.process !== undefined)
|
|
98
|
+
query.process = opts.process;
|
|
99
|
+
if (opts.market !== undefined)
|
|
100
|
+
query.market = parseEnum(opts.market, '--market', MARKETS);
|
|
101
|
+
if (opts.minDiscount !== undefined)
|
|
102
|
+
query.min_discount_pct = parseNumber(opts.minDiscount, '--min-discount');
|
|
103
|
+
if (opts.minScore !== undefined)
|
|
104
|
+
query.min_score = parseNumber(opts.minScore, '--min-score');
|
|
105
|
+
if (opts.window !== undefined)
|
|
106
|
+
query.window = parseEnum(opts.window, '--window', WINDOWS);
|
|
107
|
+
if (opts.limit !== undefined)
|
|
108
|
+
query.limit = parsePositiveInt(opts.limit, '--limit');
|
|
109
|
+
const client = await createOptionalParchmentClient();
|
|
110
|
+
const data = unwrapParchment(await client.market.signals(query), 'market signals');
|
|
111
|
+
outputData(data, globalOpts);
|
|
112
|
+
}));
|
|
113
|
+
// market stats
|
|
114
|
+
market
|
|
115
|
+
.command('stats')
|
|
116
|
+
.description('Price movement-significance stats (public retail summary works unauthenticated)')
|
|
117
|
+
.option('--origin <origin>', 'Filter by origin')
|
|
118
|
+
.option('--process <method>', 'Filter by process bucket')
|
|
119
|
+
.option('--market <retail|wholesale|all>', 'Market scope')
|
|
120
|
+
.option('--window <7d|30d>', 'Move window')
|
|
121
|
+
.option('--baseline-weeks <n>', 'Baseline weeks (8-52)')
|
|
122
|
+
.addHelpText('after', `
|
|
123
|
+
Examples:
|
|
124
|
+
purvey market stats --pretty
|
|
125
|
+
purvey market stats --origin "Colombia" --window 30d --json
|
|
126
|
+
purvey market stats --market wholesale --baseline-weeks 12 --json
|
|
127
|
+
|
|
128
|
+
Notes:
|
|
129
|
+
The unfiltered retail slice is public; origin/process/wholesale filters require Intelligence access.
|
|
130
|
+
Related: 'purvey price-index' (aggregate price snapshots the moves are derived from).`)
|
|
131
|
+
.action(withErrorHandling(async (opts, cmd) => {
|
|
132
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
133
|
+
const query = {};
|
|
134
|
+
if (opts.origin !== undefined)
|
|
135
|
+
query.origin = opts.origin;
|
|
136
|
+
if (opts.process !== undefined)
|
|
137
|
+
query.process = opts.process;
|
|
138
|
+
if (opts.market !== undefined)
|
|
139
|
+
query.market = parseEnum(opts.market, '--market', MARKETS);
|
|
140
|
+
if (opts.window !== undefined)
|
|
141
|
+
query.window = parseEnum(opts.window, '--window', WINDOWS);
|
|
142
|
+
if (opts.baselineWeeks !== undefined)
|
|
143
|
+
query.baseline_weeks = parseIntRange(opts.baselineWeeks, '--baseline-weeks', 8, 52);
|
|
144
|
+
const client = await createOptionalParchmentClient();
|
|
145
|
+
const data = unwrapParchment(await client.priceIndex.stats(query), 'market stats');
|
|
146
|
+
outputData(data, globalOpts);
|
|
147
|
+
}));
|
|
148
|
+
// market metadata
|
|
149
|
+
market
|
|
150
|
+
.command('metadata')
|
|
151
|
+
.description('Metadata-trend index (public process/retail/month slice works unauthenticated)')
|
|
152
|
+
.option('--dimension <process|disclosure|score>', 'Metadata dimension (default process)')
|
|
153
|
+
.option('--origin <origin>', 'Filter by origin')
|
|
154
|
+
.option('--market <retail|wholesale|all>', 'Market scope')
|
|
155
|
+
.option('--grain <week|month>', 'Time grain')
|
|
156
|
+
.option('--from <date>', 'Include periods on/after this ISO date (YYYY-MM-DD)')
|
|
157
|
+
.option('--to <date>', 'Include periods on/before this ISO date (YYYY-MM-DD)')
|
|
158
|
+
.addHelpText('after', `
|
|
159
|
+
Examples:
|
|
160
|
+
purvey market metadata --pretty
|
|
161
|
+
purvey market metadata --dimension score --origin "Ethiopia" --grain month --json
|
|
162
|
+
purvey market metadata --dimension disclosure --from 2026-04-01 --to 2026-07-01 --json
|
|
163
|
+
|
|
164
|
+
Notes:
|
|
165
|
+
Public slice is dimension=process, no origin, market=retail, grain=month; anything else requires Intelligence access.
|
|
166
|
+
cultivar and drying dimensions are out of scope for v1 (await taxonomy normalization).`)
|
|
167
|
+
.action(withErrorHandling(async (opts, cmd) => {
|
|
168
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
169
|
+
const query = {};
|
|
170
|
+
if (opts.dimension !== undefined)
|
|
171
|
+
query.dimension = parseEnum(opts.dimension, '--dimension', DIMENSIONS);
|
|
172
|
+
if (opts.origin !== undefined)
|
|
173
|
+
query.origin = opts.origin;
|
|
174
|
+
if (opts.market !== undefined)
|
|
175
|
+
query.market = parseEnum(opts.market, '--market', MARKETS);
|
|
176
|
+
if (opts.grain !== undefined)
|
|
177
|
+
query.grain = parseEnum(opts.grain, '--grain', GRAINS);
|
|
178
|
+
if (opts.from !== undefined)
|
|
179
|
+
query.from = parseIsoDate(opts.from, '--from');
|
|
180
|
+
if (opts.to !== undefined)
|
|
181
|
+
query.to = parseIsoDate(opts.to, '--to');
|
|
182
|
+
const client = await createOptionalParchmentClient();
|
|
183
|
+
const data = unwrapParchment(await client.market.metadataIndex(query), 'market metadata');
|
|
184
|
+
outputData(data, globalOpts);
|
|
185
|
+
}));
|
|
186
|
+
return market;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=market.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../src/commands/market.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGrF,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,eAAe,CAAU,CAAC;AAC9E,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAU,CAAC;AACxD,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,KAAK,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,MAAM,6BAA6B,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAC1F,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC/B,CAAC,CAAC,CACH,CAAC;IAEJ,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAMA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAMA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/lib/index.js
CHANGED
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,2EAA2E;AAC3E,qCAAqC;AACrC,2DAA2D;AAC3D,6DAA6D;AAE7D,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,2EAA2E;AAC3E,qCAAqC;AACrC,2DAA2D;AAC3D,6DAA6D;AAE7D,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/lib/manifest.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GA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,EAAE,CAAC;IACnC,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACrC,cAAc,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,gBAAgB,EAAE,0BAA0B,CAAC;KAC9C,CAAC;IACF,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,uBAAuB,EAAE,CAAC;IACzC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,aAAa,EAAE,uBAAuB,EAAE,CAAC;CAC1C;AA0mCD,wBAAgB,cAAc,IAAI,WAAW,CA+D5C;AAmMD,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,WAA8B,GAAG,MAAM,CAmClF"}
|
package/dist/lib/manifest.js
CHANGED
|
@@ -859,6 +859,83 @@ const commandGroups = [
|
|
|
859
859
|
examples: ['purvey manifest', 'purvey manifest --pretty'],
|
|
860
860
|
},
|
|
861
861
|
},
|
|
862
|
+
{
|
|
863
|
+
name: 'market',
|
|
864
|
+
summary: 'Market Index decision surface: value signals, movement stats, and metadata trends via the canonical API',
|
|
865
|
+
auth: 'mixed',
|
|
866
|
+
subcommands: [
|
|
867
|
+
{
|
|
868
|
+
name: 'signals',
|
|
869
|
+
summary: 'Actionable market value signals; unfiltered summary is a public teaser',
|
|
870
|
+
auth: 'none',
|
|
871
|
+
options: [
|
|
872
|
+
{ flags: '--summary' },
|
|
873
|
+
{
|
|
874
|
+
flags: '--type <type>',
|
|
875
|
+
notes: ['repeatable or comma-separated: price_drop|below_market|value_quality'],
|
|
876
|
+
},
|
|
877
|
+
{ flags: '--origin <origin>' },
|
|
878
|
+
{ flags: '--process <method>' },
|
|
879
|
+
{ flags: '--market <retail|wholesale|all>' },
|
|
880
|
+
{ flags: '--min-discount <n>' },
|
|
881
|
+
{ flags: '--min-score <n>' },
|
|
882
|
+
{ flags: '--window <7d|30d>' },
|
|
883
|
+
{ flags: '--limit <n>' },
|
|
884
|
+
],
|
|
885
|
+
notes: [
|
|
886
|
+
'Backed by the canonical API GET /v1/market/signals via @purveyors/sdk against api.purveyors.io.',
|
|
887
|
+
'--summary is the only unauthenticated slice (counts only); any filter requires Parchment Intelligence access, enforced server-side (403 on denial).',
|
|
888
|
+
'--json emits the API response verbatim (§3.3 evidence object, §3.4 enums); no client-side reshaping.',
|
|
889
|
+
],
|
|
890
|
+
examples: [
|
|
891
|
+
'purvey market signals --summary --pretty',
|
|
892
|
+
'purvey market signals --type price_drop --type below_market --origin "Ethiopia" --json',
|
|
893
|
+
],
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
name: 'stats',
|
|
897
|
+
summary: 'Price movement-significance stats; unfiltered retail slice is public',
|
|
898
|
+
auth: 'none',
|
|
899
|
+
options: [
|
|
900
|
+
{ flags: '--origin <origin>' },
|
|
901
|
+
{ flags: '--process <method>' },
|
|
902
|
+
{ flags: '--market <retail|wholesale|all>' },
|
|
903
|
+
{ flags: '--window <7d|30d>' },
|
|
904
|
+
{ flags: '--baseline-weeks <n>' },
|
|
905
|
+
],
|
|
906
|
+
notes: [
|
|
907
|
+
'Backed by the canonical API GET /v1/price-index/stats via @purveyors/sdk.',
|
|
908
|
+
'The no-origin/no-process retail slice is public; origin/process/wholesale filters require Intelligence access.',
|
|
909
|
+
],
|
|
910
|
+
examples: [
|
|
911
|
+
'purvey market stats --pretty',
|
|
912
|
+
'purvey market stats --origin "Colombia" --window 30d --json',
|
|
913
|
+
],
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
name: 'metadata',
|
|
917
|
+
summary: 'Metadata-trend index; process/retail/month slice is public',
|
|
918
|
+
auth: 'none',
|
|
919
|
+
options: [
|
|
920
|
+
{ flags: '--dimension <process|disclosure|score>' },
|
|
921
|
+
{ flags: '--origin <origin>' },
|
|
922
|
+
{ flags: '--market <retail|wholesale|all>' },
|
|
923
|
+
{ flags: '--grain <week|month>' },
|
|
924
|
+
{ flags: '--from <date>' },
|
|
925
|
+
{ flags: '--to <date>' },
|
|
926
|
+
],
|
|
927
|
+
notes: [
|
|
928
|
+
'Backed by the canonical API GET /v1/market/metadata-index via @purveyors/sdk.',
|
|
929
|
+
'Public slice: dimension=process, no origin, market=retail, grain=month; anything else requires Intelligence access.',
|
|
930
|
+
'cultivar and drying dimensions are out of scope for v1 (await taxonomy normalization).',
|
|
931
|
+
],
|
|
932
|
+
examples: [
|
|
933
|
+
'purvey market metadata --pretty',
|
|
934
|
+
'purvey market metadata --dimension score --origin "Ethiopia" --grain month --json',
|
|
935
|
+
],
|
|
936
|
+
},
|
|
937
|
+
],
|
|
938
|
+
},
|
|
862
939
|
{
|
|
863
940
|
name: 'price-index',
|
|
864
941
|
summary: 'Parchment Price Index aggregate snapshots; requires price-index (PPI) access',
|
|
@@ -1106,12 +1183,18 @@ function renderRoles(roleContracts, groups) {
|
|
|
1106
1183
|
.filter((group) => group.auth === 'none' && group.name !== 'auth')
|
|
1107
1184
|
.map((group) => group.name)
|
|
1108
1185
|
.sort();
|
|
1186
|
+
const mixedAccessCommands = groups
|
|
1187
|
+
.filter((group) => group.auth === 'mixed')
|
|
1188
|
+
.map((group) => group.name)
|
|
1189
|
+
.sort();
|
|
1109
1190
|
return [
|
|
1110
1191
|
'ROLES',
|
|
1111
1192
|
'-----',
|
|
1112
1193
|
`No pre-existing session required for: ${unauthenticatedCommands.join(', ')}.`,
|
|
1113
1194
|
`Local-only commands: ${localOnlyCommands.join(', ')}.`,
|
|
1114
|
-
|
|
1195
|
+
`Mixed public and entitled access: ${mixedAccessCommands.join(', ')}.`,
|
|
1196
|
+
'Mixed-access public teaser slices can run without a session; filtered or non-public slices require server-side entitlements.',
|
|
1197
|
+
'Commands that talk to purveyors.io generally require authentication unless listed above as public, local-only, or mixed-access teaser slices.',
|
|
1115
1198
|
...roleContracts.map((role) => `${role.role.padEnd(7, ' ')} ${role.description}`),
|
|
1116
1199
|
'',
|
|
1117
1200
|
'Both roles are granted on sign-in through purveyors.io.',
|