@purveyors/cli 0.30.0 → 0.32.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 +12 -12
- package/dist/commands/auth.d.ts +23 -19
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +234 -355
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/inventory.js +4 -4
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/roast.d.ts +4 -4
- package/dist/commands/roast.d.ts.map +1 -1
- package/dist/commands/roast.js +30 -30
- package/dist/commands/roast.js.map +1 -1
- package/dist/commands/sales.d.ts +8 -10
- package/dist/commands/sales.d.ts.map +1 -1
- package/dist/commands/sales.js +9 -9
- package/dist/commands/sales.js.map +1 -1
- package/dist/commands/tasting.js +10 -10
- package/dist/commands/tasting.js.map +1 -1
- package/dist/lib/ai.d.ts +18 -9
- package/dist/lib/ai.d.ts.map +1 -1
- package/dist/lib/ai.js +20 -31
- package/dist/lib/ai.js.map +1 -1
- package/dist/lib/auth-client.d.ts +16 -18
- package/dist/lib/auth-client.d.ts.map +1 -1
- package/dist/lib/auth-client.js +4 -6
- package/dist/lib/auth-client.js.map +1 -1
- package/dist/lib/auth-guard.d.ts +3 -3
- package/dist/lib/auth-guard.d.ts.map +1 -1
- package/dist/lib/auth-guard.js +9 -9
- package/dist/lib/auth-guard.js.map +1 -1
- package/dist/lib/catalog.js +2 -2
- package/dist/lib/catalog.js.map +1 -1
- package/dist/lib/interactive/watch.d.ts +3 -3
- package/dist/lib/interactive/watch.d.ts.map +1 -1
- package/dist/lib/interactive/watch.js +11 -8
- package/dist/lib/interactive/watch.js.map +1 -1
- package/dist/lib/manifest.d.ts.map +1 -1
- package/dist/lib/manifest.js +6 -5
- package/dist/lib/manifest.js.map +1 -1
- package/dist/lib/market.d.ts.map +1 -1
- package/dist/lib/parchment-base.d.ts.map +1 -1
- package/dist/lib/parchment-base.js +1 -3
- package/dist/lib/parchment-base.js.map +1 -1
- package/dist/lib/parchment.d.ts +2 -2
- package/dist/lib/parchment.js +9 -9
- package/dist/lib/parchment.js.map +1 -1
- package/dist/lib/roast.js +1 -1
- package/dist/lib/roast.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ purvey auth login
|
|
|
69
69
|
# For agents, CI, or remote machines, use headless flow:
|
|
70
70
|
# purvey auth login --headless
|
|
71
71
|
|
|
72
|
-
#
|
|
72
|
+
# Headless login prints an approval URL. Approve it in any browser; the CLI completes automatically.
|
|
73
73
|
|
|
74
74
|
# 2. Confirm the stored API key and role
|
|
75
75
|
purvey auth status
|
|
@@ -158,12 +158,12 @@ Headless login for agents, CI, and remote machines:
|
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
160
|
purvey auth login --headless
|
|
161
|
-
# CLI prints a
|
|
162
|
-
# Open it in any browser and
|
|
163
|
-
#
|
|
161
|
+
# CLI prints a purveyors.io approval URL
|
|
162
|
+
# Open it in any browser, sign in, and approve access
|
|
163
|
+
# The CLI completes automatically
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
Both modes use Parchment's short-lived device authorization flow. The CLI keeps its PKCE verifier in memory, receives a scoped Parchment API key after browser approval, and never runs a localhost callback server or asks you to paste a callback URL. If browser launch fails, the interactive command prints the approval URL and keeps waiting.
|
|
167
167
|
|
|
168
168
|
Status:
|
|
169
169
|
|
|
@@ -293,8 +293,8 @@ purvey auth logout
|
|
|
293
293
|
|
|
294
294
|
Notes:
|
|
295
295
|
|
|
296
|
-
- `auth login`
|
|
297
|
-
- `auth login --headless` prints
|
|
296
|
+
- `auth login` opens a short-lived purveyors.io approval request and completes automatically after approval. If browser launch fails, it prints the same URL and keeps polling.
|
|
297
|
+
- `auth login --headless` prints the approval URL without trying to open a local browser. Approve it from any browser; nothing is pasted back.
|
|
298
298
|
- `auth status --json` is the safest mode for scripts.
|
|
299
299
|
- `auth status --csv` is supported for spreadsheet-style checks, but JSON remains the better integration format.
|
|
300
300
|
|
|
@@ -449,7 +449,7 @@ Notes:
|
|
|
449
449
|
|
|
450
450
|
- `price-index` is backed by the canonical Parchment API `GET /v1/price-index` through `@purveyors/sdk`.
|
|
451
451
|
- 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.
|
|
452
|
-
- `PARCHMENT_API_BASE_URL` overrides the canonical API base for this SDK-backed command.
|
|
452
|
+
- `PARCHMENT_API_BASE_URL` overrides the canonical API base for this SDK-backed command.
|
|
453
453
|
|
|
454
454
|
### market
|
|
455
455
|
|
|
@@ -668,6 +668,7 @@ Notes:
|
|
|
668
668
|
- `--coffee-id` uses inventory IDs.
|
|
669
669
|
- `roast import` and `roast watch` normalize pasted paths by trimming whitespace, removing one layer of matching quotes, and accepting common shell-escaped characters.
|
|
670
670
|
- `roast watch --auto-match` is mutually exclusive with `--coffee-id`.
|
|
671
|
+
- `roast watch --auto-match` sends roast metadata and the current stocked-inventory candidates to the canonical Parchment `POST /v1/roasts/classify` endpoint via `@purveyors/sdk`; it never calls an AI provider directly.
|
|
671
672
|
- `roast watch --commit-mode` defaults to `batch`.
|
|
672
673
|
|
|
673
674
|
### sales
|
|
@@ -882,11 +883,10 @@ Use the right ID for the right command.
|
|
|
882
883
|
|
|
883
884
|
## Environment variables
|
|
884
885
|
|
|
885
|
-
- `PURVEYORS_SUPABASE_URL`: override the Supabase Auth issuer used only for OAuth bootstrap
|
|
886
886
|
- `PURVEYORS_BASE_URL`: override the Purveyors web base URL
|
|
887
887
|
- `PURVEYORS_API_KEY`: explicit API-key override for canonical Parchment commands
|
|
888
888
|
- `PARCHMENT_API_KEY`: preferred API-key variable for SDK-backed Parchment commands; also accepted for API-backed proof and paid-tier similarity paths
|
|
889
|
-
- `PARCHMENT_API_BASE_URL`: override the SDK-backed Parchment API base URL
|
|
889
|
+
- `PARCHMENT_API_BASE_URL`: override the SDK-backed Parchment API base URL, including `market`, `price-index`, `procurement`, and roast auto-classification requests
|
|
890
890
|
- `PURVEY_DEBUG`: enable verbose error output
|
|
891
891
|
|
|
892
892
|
## For AI agents
|
|
@@ -905,7 +905,7 @@ Why this CLI works well for agents:
|
|
|
905
905
|
|
|
906
906
|
- stable command names
|
|
907
907
|
- structured stdout by default
|
|
908
|
-
- browser
|
|
908
|
+
- browser approval with automatic polling and a first-class headless mode
|
|
909
909
|
- documented exit codes and role boundaries
|
|
910
910
|
- dedicated machine-readable manifest command
|
|
911
911
|
- dedicated dense human-readable reference command
|
|
@@ -919,7 +919,7 @@ Agent integration rules of thumb:
|
|
|
919
919
|
|
|
920
920
|
- Discover first with `purvey manifest`, then call the narrowest command or package subpath that fits the job.
|
|
921
921
|
- Use `purvey context` when a human-readable operator summary is useful before tool selection.
|
|
922
|
-
- Use `purvey auth login` for normal user workflows.
|
|
922
|
+
- Use `purvey auth login` for normal user workflows. Parchment coordinates browser approval and returns a machine-scoped API key; the CLI stores no web session, request token, or PKCE verifier. Environment `PURVEYORS_API_KEY` or `PARCHMENT_API_KEY` values remain available for explicit automation overrides.
|
|
923
923
|
- 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.
|
|
924
924
|
- 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.
|
|
925
925
|
- 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.
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import type { StoredCredentials } from '../types/index.js';
|
|
3
2
|
import { type ParchmentClient } from '@purveyors/sdk';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import type { StoredCredentials } from '../types/index.js';
|
|
4
|
+
type CliAuthClient = Pick<ParchmentClient, 'cliAuth'>;
|
|
5
|
+
interface DeviceLoginOptions {
|
|
6
|
+
headless: boolean;
|
|
7
|
+
client?: CliAuthClient;
|
|
8
|
+
machineName?: string;
|
|
9
|
+
openBrowser?: (url: string) => Promise<boolean>;
|
|
10
|
+
sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
exchangeCancellationTimeoutMs?: number;
|
|
13
|
+
onExchangeCancellationWait?: () => void;
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
export declare function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare function
|
|
15
|
+
/** Generate an RFC 7636 verifier and its S256 challenge. */
|
|
16
|
+
export declare function createPkcePair(): {
|
|
17
|
+
verifier: string;
|
|
18
|
+
challenge: string;
|
|
19
|
+
};
|
|
20
|
+
/** Normalize hostnames to Parchment's stable, human-readable machine-name contract. */
|
|
21
|
+
export declare function normalizeMachineName(value: string): string;
|
|
22
|
+
/** Open the verification page, returning false when no browser command is available. */
|
|
23
|
+
export declare function openVerificationPage(url: string): Promise<boolean>;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* Run the Parchment-owned browser/device authorization protocol.
|
|
26
|
+
* The verifier and signed request token remain memory-only and are discarded on exit.
|
|
24
27
|
*/
|
|
28
|
+
export declare function performDeviceLogin(options: DeviceLoginOptions): Promise<StoredCredentials>;
|
|
25
29
|
export declare function buildAuthCommand(): Command;
|
|
26
30
|
export {};
|
|
27
31
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,M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