vellum-cli 0.3.3 → 0.3.4

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 +2 -4
  2. package/dist/index.js +18 -32
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -39,11 +39,9 @@ env vars:
39
39
  | Flag | Env var | Description |
40
40
  | ------------ | ---------------- | -------------------------------------------- |
41
41
  | `--url` | `VELLUM_URL` | Server base URL (default `https://vellumai.app`) |
42
- | `--api-key` | `VELLUM_API_KEY` | Shared owner/agent key (`X-Api-Key`) |
43
42
 
44
- Credential precedence for a write: an explicit `--api-key`/`VELLUM_API_KEY`
45
- (the shared owner key, e.g. for agents/CI) wins; otherwise the stored
46
- `vellum login` token is used.
43
+ The CLI always uses the stored `vellum login` token. Commands are scoped to
44
+ the logged-in page owner; the CLI does not accept the shared server API key.
47
45
 
48
46
  ## Commands
49
47
 
package/dist/index.js CHANGED
@@ -15,13 +15,10 @@ function resolveBaseUrl(flags) {
15
15
  return normalizeUrl(flags.url ?? process.env.VELLUM_URL ?? DEFAULT_URL);
16
16
  }
17
17
  async function resolveCredential(flags, baseUrl) {
18
- const apiKey = flags.apiKey ?? process.env.VELLUM_API_KEY;
19
- if (apiKey)
20
- return { apiKey };
21
18
  const token = await loadToken(baseUrl);
22
19
  if (token)
23
20
  return { token };
24
- throw new ConfigError(`Not logged in to ${baseUrl}. Run \`vellum login\` (or set VELLUM_API_KEY / pass --api-key).`);
21
+ throw new ConfigError(`Not logged in to ${baseUrl}. Run \`vellum login\`.`);
25
22
  }
26
23
  function storePath() {
27
24
  const xdg = process.env.XDG_CONFIG_HOME;
@@ -204,12 +201,11 @@ Usage:
204
201
  vellum ${verb} <page-id> [options]
205
202
 
206
203
  ${verb === "archive" ? `Archiving keeps the bytes, versions, comments, and URLs intact — new
207
- versions and comments are paused until you unarchive. Owner/admin only.` : `Unarchiving restores the page to the gallery and re-opens it for new
208
- versions and comments. Owner/admin only.`}
204
+ versions and comments are paused until you unarchive. Page owner only.` : `Unarchiving restores the page to the gallery and re-opens it for new
205
+ versions and comments. Page owner only.`}
209
206
 
210
207
  Options:
211
208
  --url <url> Server base URL (env: VELLUM_URL)
212
- --api-key <key> Shared API key (env: VELLUM_API_KEY)
213
209
  --json Print the raw JSON response
214
210
  -h, --help Show this help`;
215
211
  }
@@ -219,7 +215,6 @@ async function run(verb, argv) {
219
215
  allowPositionals: true,
220
216
  options: {
221
217
  url: { type: "string" },
222
- "api-key": { type: "string" },
223
218
  json: { type: "boolean", default: false },
224
219
  help: { type: "boolean", short: "h", default: false }
225
220
  }
@@ -235,7 +230,7 @@ async function run(verb, argv) {
235
230
  console.error(help(verb));
236
231
  return 1;
237
232
  }
238
- const flags = { url: values.url, apiKey: values["api-key"] };
233
+ const flags = { url: values.url };
239
234
  const baseUrl = resolveBaseUrl(flags);
240
235
  const credential = await resolveCredential(flags, baseUrl);
241
236
  const client2 = new VellumClient({ baseUrl, ...credential });
@@ -249,7 +244,11 @@ async function run(verb, argv) {
249
244
  return 0;
250
245
  } catch (err) {
251
246
  if (err instanceof VellumApiError && err.status === 401) {
252
- console.error(`Error: ${verb} requires the owner API key. Set VELLUM_API_KEY or pass --api-key.`);
247
+ console.error(`Error: not logged in. Run \`vellum login\` as the page owner.`);
248
+ return 1;
249
+ }
250
+ if (err instanceof VellumApiError && err.status === 403) {
251
+ console.error(`Error: you don't own ${pageId}, so you can't ${verb} it.`);
253
252
  return 1;
254
253
  }
255
254
  if (err instanceof VellumApiError && err.status === 404) {
@@ -273,15 +272,13 @@ var HELP = `vellum list — list your artifacts
273
272
  Usage:
274
273
  vellum list [options]
275
274
 
276
- Lists the pages you own (log in with \`vellum login\`). With the owner API key
277
- (VELLUM_API_KEY / --api-key) it lists every page. By default only live pages are
278
- shown; use --archived for archived-only, or --all for both.
275
+ Lists the pages you own (log in with \`vellum login\`). By default only live
276
+ pages are shown; use --archived for archived-only, or --all for both.
279
277
 
280
278
  Options:
281
279
  --archived Show only archived pages
282
280
  --all Show both live and archived pages
283
281
  --url <url> Server base URL (env: VELLUM_URL)
284
- --api-key <key> Shared API key (env: VELLUM_API_KEY)
285
282
  --json Print the raw JSON response
286
283
  -h, --help Show this help`;
287
284
  function cell(value, width) {
@@ -309,7 +306,6 @@ async function listCommand(argv) {
309
306
  archived: { type: "boolean", default: false },
310
307
  all: { type: "boolean", default: false },
311
308
  url: { type: "string" },
312
- "api-key": { type: "string" },
313
309
  json: { type: "boolean", default: false },
314
310
  help: { type: "boolean", short: "h", default: false }
315
311
  }
@@ -318,7 +314,7 @@ async function listCommand(argv) {
318
314
  console.log(HELP);
319
315
  return 0;
320
316
  }
321
- const flags = { url: values.url, apiKey: values["api-key"] };
317
+ const flags = { url: values.url };
322
318
  const baseUrl = resolveBaseUrl(flags);
323
319
  const credential = await resolveCredential(flags, baseUrl);
324
320
  const client2 = new VellumClient({ baseUrl, ...credential });
@@ -344,7 +340,7 @@ ${pages.length} page${pages.length === 1 ? "" : "s"}${suffix}`);
344
340
  return 0;
345
341
  } catch (err) {
346
342
  if (err instanceof VellumApiError && err.status === 401) {
347
- console.error("Error: not authenticated. Run `vellum login` (or set VELLUM_API_KEY / pass --api-key).");
343
+ console.error("Error: not authenticated. Run `vellum login` as the page owner.");
348
344
  return 1;
349
345
  }
350
346
  throw err;
@@ -485,7 +481,6 @@ Options:
485
481
  --version <n> Pin to a specific version number (default: current)
486
482
  --force Post even if the quote isn't found in the version
487
483
  --url <url> Server base URL (env: VELLUM_URL)
488
- --api-key <key> Shared API key (env: VELLUM_API_KEY)
489
484
  --json Print the raw JSON response
490
485
  -h, --help Show this help`;
491
486
  async function readStdin() {
@@ -519,7 +514,6 @@ async function markupCommand(argv) {
519
514
  version: { type: "string" },
520
515
  force: { type: "boolean", default: false },
521
516
  url: { type: "string" },
522
- "api-key": { type: "string" },
523
517
  json: { type: "boolean", default: false },
524
518
  help: { type: "boolean", short: "h", default: false }
525
519
  }
@@ -553,7 +547,7 @@ async function markupCommand(argv) {
553
547
  return 1;
554
548
  }
555
549
  }
556
- const flags = { url: values.url, apiKey: values["api-key"] };
550
+ const flags = { url: values.url };
557
551
  const baseUrl = resolveBaseUrl(flags);
558
552
  const credential = await resolveCredential(flags, baseUrl);
559
553
  const client2 = new VellumClient({ baseUrl, ...credential });
@@ -599,7 +593,6 @@ Usage:
599
593
  Options:
600
594
  --page-id <id> Append a new version to an existing page
601
595
  --url <url> Server base URL (env: VELLUM_URL)
602
- --api-key <key> Shared API key (env: VELLUM_API_KEY)
603
596
  --json Print the raw JSON response
604
597
  -h, --help Show this help`;
605
598
  async function readStdin2() {
@@ -615,7 +608,6 @@ async function pushCommand(argv) {
615
608
  options: {
616
609
  "page-id": { type: "string" },
617
610
  url: { type: "string" },
618
- "api-key": { type: "string" },
619
611
  json: { type: "boolean", default: false },
620
612
  help: { type: "boolean", short: "h", default: false }
621
613
  }
@@ -630,7 +622,7 @@ async function pushCommand(argv) {
630
622
  console.error("Error: no HTML provided (empty file or stdin).");
631
623
  return 1;
632
624
  }
633
- const flags = { url: values.url, apiKey: values["api-key"] };
625
+ const flags = { url: values.url };
634
626
  const baseUrl = resolveBaseUrl(flags);
635
627
  const credential = await resolveCredential(flags, baseUrl);
636
628
  const client2 = new VellumClient({ baseUrl, ...credential });
@@ -647,7 +639,7 @@ async function pushCommand(argv) {
647
639
  // package.json
648
640
  var package_default = {
649
641
  name: "vellum-cli",
650
- version: "0.3.3",
642
+ version: "0.3.4",
651
643
  description: "The vellum CLI — publish agent-authored HTML artifacts to a Vellum server.",
652
644
  type: "module",
653
645
  license: "MIT",
@@ -701,14 +693,12 @@ Usage:
701
693
 
702
694
  Options:
703
695
  --url <url> Server base URL (env: VELLUM_URL)
704
- --api-key <key> Shared API key (env: VELLUM_API_KEY)
705
696
  -h, --help Show this help`;
706
697
  async function whoamiCommand(argv) {
707
698
  const { values } = parseArgs7({
708
699
  args: argv,
709
700
  options: {
710
701
  url: { type: "string" },
711
- "api-key": { type: "string" },
712
702
  help: { type: "boolean", short: "h", default: false }
713
703
  }
714
704
  });
@@ -717,11 +707,7 @@ async function whoamiCommand(argv) {
717
707
  return 0;
718
708
  }
719
709
  const baseUrl = resolveBaseUrl({ url: values.url });
720
- const credential = await resolveCredential({ url: values.url, apiKey: values["api-key"] }, baseUrl);
721
- if ("apiKey" in credential) {
722
- console.log(`Authenticated to ${baseUrl} with a shared API key (owner).`);
723
- return 0;
724
- }
710
+ const credential = await resolveCredential({ url: values.url }, baseUrl);
725
711
  const client2 = new VellumClient({ baseUrl, token: credential.token });
726
712
  const { email } = await client2.whoami();
727
713
  console.log(`${email ?? "(no email on record)"} — ${baseUrl}`);
@@ -739,7 +725,7 @@ Commands:
739
725
  logout Remove this machine's stored CLI token
740
726
  whoami Show the identity the CLI is authenticated as
741
727
  push Create an artifact (page) from HTML (file or stdin)
742
- list List your artifacts (owner/admin only)
728
+ list List artifacts owned by your logged-in identity
743
729
  markup Pin a comment to a passage of a document
744
730
  archive Archive a page (read-only, hidden from the gallery)
745
731
  unarchive Restore an archived page to live
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vellum-cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "The vellum CLI — publish agent-authored HTML artifacts to a Vellum server.",
5
5
  "type": "module",
6
6
  "license": "MIT",