@tryhermes/cli 0.1.0 → 0.1.2

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 (2) hide show
  1. package/dist/index.js +129 -106
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -215,9 +215,9 @@ var require_help = __commonJS({
215
215
  * @param {Command} cmd
216
216
  * @returns {Command[]}
217
217
  */
218
- visibleCommands(cmd) {
219
- const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
220
- const helpCommand = cmd._getHelpCommand();
218
+ visibleCommands(cmd2) {
219
+ const visibleCommands = cmd2.commands.filter((cmd3) => !cmd3._hidden);
220
+ const helpCommand = cmd2._getHelpCommand();
221
221
  if (helpCommand && !helpCommand._hidden) {
222
222
  visibleCommands.push(helpCommand);
223
223
  }
@@ -247,21 +247,21 @@ var require_help = __commonJS({
247
247
  * @param {Command} cmd
248
248
  * @returns {Option[]}
249
249
  */
250
- visibleOptions(cmd) {
251
- const visibleOptions = cmd.options.filter((option) => !option.hidden);
252
- const helpOption = cmd._getHelpOption();
250
+ visibleOptions(cmd2) {
251
+ const visibleOptions = cmd2.options.filter((option) => !option.hidden);
252
+ const helpOption = cmd2._getHelpOption();
253
253
  if (helpOption && !helpOption.hidden) {
254
- const removeShort = helpOption.short && cmd._findOption(helpOption.short);
255
- const removeLong = helpOption.long && cmd._findOption(helpOption.long);
254
+ const removeShort = helpOption.short && cmd2._findOption(helpOption.short);
255
+ const removeLong = helpOption.long && cmd2._findOption(helpOption.long);
256
256
  if (!removeShort && !removeLong) {
257
257
  visibleOptions.push(helpOption);
258
258
  } else if (helpOption.long && !removeLong) {
259
259
  visibleOptions.push(
260
- cmd.createOption(helpOption.long, helpOption.description)
260
+ cmd2.createOption(helpOption.long, helpOption.description)
261
261
  );
262
262
  } else if (helpOption.short && !removeShort) {
263
263
  visibleOptions.push(
264
- cmd.createOption(helpOption.short, helpOption.description)
264
+ cmd2.createOption(helpOption.short, helpOption.description)
265
265
  );
266
266
  }
267
267
  }
@@ -276,10 +276,10 @@ var require_help = __commonJS({
276
276
  * @param {Command} cmd
277
277
  * @returns {Option[]}
278
278
  */
279
- visibleGlobalOptions(cmd) {
279
+ visibleGlobalOptions(cmd2) {
280
280
  if (!this.showGlobalOptions) return [];
281
281
  const globalOptions = [];
282
- for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
282
+ for (let ancestorCmd = cmd2.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
283
283
  const visibleOptions = ancestorCmd.options.filter(
284
284
  (option) => !option.hidden
285
285
  );
@@ -296,14 +296,14 @@ var require_help = __commonJS({
296
296
  * @param {Command} cmd
297
297
  * @returns {Argument[]}
298
298
  */
299
- visibleArguments(cmd) {
300
- if (cmd._argsDescription) {
301
- cmd.registeredArguments.forEach((argument) => {
302
- argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
299
+ visibleArguments(cmd2) {
300
+ if (cmd2._argsDescription) {
301
+ cmd2.registeredArguments.forEach((argument) => {
302
+ argument.description = argument.description || cmd2._argsDescription[argument.name()] || "";
303
303
  });
304
304
  }
305
- if (cmd.registeredArguments.find((argument) => argument.description)) {
306
- return cmd.registeredArguments;
305
+ if (cmd2.registeredArguments.find((argument) => argument.description)) {
306
+ return cmd2.registeredArguments;
307
307
  }
308
308
  return [];
309
309
  }
@@ -313,9 +313,9 @@ var require_help = __commonJS({
313
313
  * @param {Command} cmd
314
314
  * @returns {string}
315
315
  */
316
- subcommandTerm(cmd) {
317
- const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
318
- return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option
316
+ subcommandTerm(cmd2) {
317
+ const args = cmd2.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
318
+ return cmd2._name + (cmd2._aliases[0] ? "|" + cmd2._aliases[0] : "") + (cmd2.options.length ? " [options]" : "") + // simplistic check for non-help option
319
319
  (args ? " " + args : "");
320
320
  }
321
321
  /**
@@ -343,8 +343,8 @@ var require_help = __commonJS({
343
343
  * @param {Help} helper
344
344
  * @returns {number}
345
345
  */
346
- longestSubcommandTermLength(cmd, helper) {
347
- return helper.visibleCommands(cmd).reduce((max, command) => {
346
+ longestSubcommandTermLength(cmd2, helper) {
347
+ return helper.visibleCommands(cmd2).reduce((max, command) => {
348
348
  return Math.max(max, helper.subcommandTerm(command).length);
349
349
  }, 0);
350
350
  }
@@ -355,8 +355,8 @@ var require_help = __commonJS({
355
355
  * @param {Help} helper
356
356
  * @returns {number}
357
357
  */
358
- longestOptionTermLength(cmd, helper) {
359
- return helper.visibleOptions(cmd).reduce((max, option) => {
358
+ longestOptionTermLength(cmd2, helper) {
359
+ return helper.visibleOptions(cmd2).reduce((max, option) => {
360
360
  return Math.max(max, helper.optionTerm(option).length);
361
361
  }, 0);
362
362
  }
@@ -367,8 +367,8 @@ var require_help = __commonJS({
367
367
  * @param {Help} helper
368
368
  * @returns {number}
369
369
  */
370
- longestGlobalOptionTermLength(cmd, helper) {
371
- return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
370
+ longestGlobalOptionTermLength(cmd2, helper) {
371
+ return helper.visibleGlobalOptions(cmd2).reduce((max, option) => {
372
372
  return Math.max(max, helper.optionTerm(option).length);
373
373
  }, 0);
374
374
  }
@@ -379,8 +379,8 @@ var require_help = __commonJS({
379
379
  * @param {Help} helper
380
380
  * @returns {number}
381
381
  */
382
- longestArgumentTermLength(cmd, helper) {
383
- return helper.visibleArguments(cmd).reduce((max, argument) => {
382
+ longestArgumentTermLength(cmd2, helper) {
383
+ return helper.visibleArguments(cmd2).reduce((max, argument) => {
384
384
  return Math.max(max, helper.argumentTerm(argument).length);
385
385
  }, 0);
386
386
  }
@@ -390,16 +390,16 @@ var require_help = __commonJS({
390
390
  * @param {Command} cmd
391
391
  * @returns {string}
392
392
  */
393
- commandUsage(cmd) {
394
- let cmdName = cmd._name;
395
- if (cmd._aliases[0]) {
396
- cmdName = cmdName + "|" + cmd._aliases[0];
393
+ commandUsage(cmd2) {
394
+ let cmdName = cmd2._name;
395
+ if (cmd2._aliases[0]) {
396
+ cmdName = cmdName + "|" + cmd2._aliases[0];
397
397
  }
398
398
  let ancestorCmdNames = "";
399
- for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
399
+ for (let ancestorCmd = cmd2.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
400
400
  ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
401
401
  }
402
- return ancestorCmdNames + cmdName + " " + cmd.usage();
402
+ return ancestorCmdNames + cmdName + " " + cmd2.usage();
403
403
  }
404
404
  /**
405
405
  * Get the description for the command.
@@ -407,8 +407,8 @@ var require_help = __commonJS({
407
407
  * @param {Command} cmd
408
408
  * @returns {string}
409
409
  */
410
- commandDescription(cmd) {
411
- return cmd.description();
410
+ commandDescription(cmd2) {
411
+ return cmd2.description();
412
412
  }
413
413
  /**
414
414
  * Get the subcommand summary to show in the list of subcommands.
@@ -417,8 +417,8 @@ var require_help = __commonJS({
417
417
  * @param {Command} cmd
418
418
  * @returns {string}
419
419
  */
420
- subcommandDescription(cmd) {
421
- return cmd.summary() || cmd.description();
420
+ subcommandDescription(cmd2) {
421
+ return cmd2.summary() || cmd2.description();
422
422
  }
423
423
  /**
424
424
  * Get the option description to show in the list of options.
@@ -488,8 +488,8 @@ var require_help = __commonJS({
488
488
  * @param {Help} helper
489
489
  * @returns {string}
490
490
  */
491
- formatHelp(cmd, helper) {
492
- const termWidth = helper.padWidth(cmd, helper);
491
+ formatHelp(cmd2, helper) {
492
+ const termWidth = helper.padWidth(cmd2, helper);
493
493
  const helpWidth = helper.helpWidth || 80;
494
494
  const itemIndentWidth = 2;
495
495
  const itemSeparatorWidth = 2;
@@ -507,15 +507,15 @@ var require_help = __commonJS({
507
507
  function formatList(textArray) {
508
508
  return textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth));
509
509
  }
510
- let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
511
- const commandDescription = helper.commandDescription(cmd);
510
+ let output = [`Usage: ${helper.commandUsage(cmd2)}`, ""];
511
+ const commandDescription = helper.commandDescription(cmd2);
512
512
  if (commandDescription.length > 0) {
513
513
  output = output.concat([
514
514
  helper.wrap(commandDescription, helpWidth, 0),
515
515
  ""
516
516
  ]);
517
517
  }
518
- const argumentList = helper.visibleArguments(cmd).map((argument) => {
518
+ const argumentList = helper.visibleArguments(cmd2).map((argument) => {
519
519
  return formatItem(
520
520
  helper.argumentTerm(argument),
521
521
  helper.argumentDescription(argument)
@@ -524,7 +524,7 @@ var require_help = __commonJS({
524
524
  if (argumentList.length > 0) {
525
525
  output = output.concat(["Arguments:", formatList(argumentList), ""]);
526
526
  }
527
- const optionList = helper.visibleOptions(cmd).map((option) => {
527
+ const optionList = helper.visibleOptions(cmd2).map((option) => {
528
528
  return formatItem(
529
529
  helper.optionTerm(option),
530
530
  helper.optionDescription(option)
@@ -534,7 +534,7 @@ var require_help = __commonJS({
534
534
  output = output.concat(["Options:", formatList(optionList), ""]);
535
535
  }
536
536
  if (this.showGlobalOptions) {
537
- const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
537
+ const globalOptionList = helper.visibleGlobalOptions(cmd2).map((option) => {
538
538
  return formatItem(
539
539
  helper.optionTerm(option),
540
540
  helper.optionDescription(option)
@@ -548,10 +548,10 @@ var require_help = __commonJS({
548
548
  ]);
549
549
  }
550
550
  }
551
- const commandList = helper.visibleCommands(cmd).map((cmd2) => {
551
+ const commandList = helper.visibleCommands(cmd2).map((cmd3) => {
552
552
  return formatItem(
553
- helper.subcommandTerm(cmd2),
554
- helper.subcommandDescription(cmd2)
553
+ helper.subcommandTerm(cmd3),
554
+ helper.subcommandDescription(cmd3)
555
555
  );
556
556
  });
557
557
  if (commandList.length > 0) {
@@ -566,12 +566,12 @@ var require_help = __commonJS({
566
566
  * @param {Help} helper
567
567
  * @returns {number}
568
568
  */
569
- padWidth(cmd, helper) {
569
+ padWidth(cmd2, helper) {
570
570
  return Math.max(
571
- helper.longestOptionTermLength(cmd, helper),
572
- helper.longestGlobalOptionTermLength(cmd, helper),
573
- helper.longestSubcommandTermLength(cmd, helper),
574
- helper.longestArgumentTermLength(cmd, helper)
571
+ helper.longestOptionTermLength(cmd2, helper),
572
+ helper.longestGlobalOptionTermLength(cmd2, helper),
573
+ helper.longestSubcommandTermLength(cmd2, helper),
574
+ helper.longestArgumentTermLength(cmd2, helper)
575
575
  );
576
576
  }
577
577
  /**
@@ -1098,20 +1098,20 @@ var require_command = __commonJS({
1098
1098
  }
1099
1099
  opts = opts || {};
1100
1100
  const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
1101
- const cmd = this.createCommand(name);
1101
+ const cmd2 = this.createCommand(name);
1102
1102
  if (desc) {
1103
- cmd.description(desc);
1104
- cmd._executableHandler = true;
1105
- }
1106
- if (opts.isDefault) this._defaultCommandName = cmd._name;
1107
- cmd._hidden = !!(opts.noHelp || opts.hidden);
1108
- cmd._executableFile = opts.executableFile || null;
1109
- if (args) cmd.arguments(args);
1110
- this._registerCommand(cmd);
1111
- cmd.parent = this;
1112
- cmd.copyInheritedSettings(this);
1103
+ cmd2.description(desc);
1104
+ cmd2._executableHandler = true;
1105
+ }
1106
+ if (opts.isDefault) this._defaultCommandName = cmd2._name;
1107
+ cmd2._hidden = !!(opts.noHelp || opts.hidden);
1108
+ cmd2._executableFile = opts.executableFile || null;
1109
+ if (args) cmd2.arguments(args);
1110
+ this._registerCommand(cmd2);
1111
+ cmd2.parent = this;
1112
+ cmd2.copyInheritedSettings(this);
1113
1113
  if (desc) return this;
1114
- return cmd;
1114
+ return cmd2;
1115
1115
  }
1116
1116
  /**
1117
1117
  * Factory routine to create a new unattached command.
@@ -1199,17 +1199,17 @@ var require_command = __commonJS({
1199
1199
  * @param {object} [opts] - configuration options
1200
1200
  * @return {Command} `this` command for chaining
1201
1201
  */
1202
- addCommand(cmd, opts) {
1203
- if (!cmd._name) {
1202
+ addCommand(cmd2, opts) {
1203
+ if (!cmd2._name) {
1204
1204
  throw new Error(`Command passed to .addCommand() must have a name
1205
1205
  - specify the name in Command constructor or using .name()`);
1206
1206
  }
1207
1207
  opts = opts || {};
1208
- if (opts.isDefault) this._defaultCommandName = cmd._name;
1209
- if (opts.noHelp || opts.hidden) cmd._hidden = true;
1210
- this._registerCommand(cmd);
1211
- cmd.parent = this;
1212
- cmd._checkForBrokenPassThrough();
1208
+ if (opts.isDefault) this._defaultCommandName = cmd2._name;
1209
+ if (opts.noHelp || opts.hidden) cmd2._hidden = true;
1210
+ this._registerCommand(cmd2);
1211
+ cmd2.parent = this;
1212
+ cmd2._checkForBrokenPassThrough();
1213
1213
  return this;
1214
1214
  }
1215
1215
  /**
@@ -1490,8 +1490,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1490
1490
  * @private
1491
1491
  */
1492
1492
  _registerCommand(command) {
1493
- const knownBy = (cmd) => {
1494
- return [cmd.name()].concat(cmd.aliases());
1493
+ const knownBy = (cmd2) => {
1494
+ return [cmd2.name()].concat(cmd2.aliases());
1495
1495
  };
1496
1496
  const alreadyUsed = knownBy(command).find(
1497
1497
  (name) => this._findCommand(name)
@@ -1781,9 +1781,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1781
1781
  */
1782
1782
  getOptionValueSourceWithGlobals(key) {
1783
1783
  let source;
1784
- this._getCommandAndAncestors().forEach((cmd) => {
1785
- if (cmd.getOptionValueSource(key) !== void 0) {
1786
- source = cmd.getOptionValueSource(key);
1784
+ this._getCommandAndAncestors().forEach((cmd2) => {
1785
+ if (cmd2.getOptionValueSource(key) !== void 0) {
1786
+ source = cmd2.getOptionValueSource(key);
1787
1787
  }
1788
1788
  });
1789
1789
  return source;
@@ -2138,7 +2138,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2138
2138
  _chainOrCallHooks(promise, event) {
2139
2139
  let result = promise;
2140
2140
  const hooks = [];
2141
- this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
2141
+ this._getCommandAndAncestors().reverse().filter((cmd2) => cmd2._lifeCycleHooks[event] !== void 0).forEach((hookedCommand) => {
2142
2142
  hookedCommand._lifeCycleHooks[event].forEach((callback) => {
2143
2143
  hooks.push({ hookedCommand, callback });
2144
2144
  });
@@ -2261,7 +2261,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2261
2261
  _findCommand(name) {
2262
2262
  if (!name) return void 0;
2263
2263
  return this.commands.find(
2264
- (cmd) => cmd._name === name || cmd._aliases.includes(name)
2264
+ (cmd2) => cmd2._name === name || cmd2._aliases.includes(name)
2265
2265
  );
2266
2266
  }
2267
2267
  /**
@@ -2281,10 +2281,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2281
2281
  * @private
2282
2282
  */
2283
2283
  _checkForMissingMandatoryOptions() {
2284
- this._getCommandAndAncestors().forEach((cmd) => {
2285
- cmd.options.forEach((anOption) => {
2286
- if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === void 0) {
2287
- cmd.missingMandatoryOptionValue(anOption);
2284
+ this._getCommandAndAncestors().forEach((cmd2) => {
2285
+ cmd2.options.forEach((anOption) => {
2286
+ if (anOption.mandatory && cmd2.getOptionValue(anOption.attributeName()) === void 0) {
2287
+ cmd2.missingMandatoryOptionValue(anOption);
2288
2288
  }
2289
2289
  });
2290
2290
  });
@@ -2321,8 +2321,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
2321
2321
  * @private
2322
2322
  */
2323
2323
  _checkForConflictingOptions() {
2324
- this._getCommandAndAncestors().forEach((cmd) => {
2325
- cmd._checkForConflictingLocalOptions();
2324
+ this._getCommandAndAncestors().forEach((cmd2) => {
2325
+ cmd2._checkForConflictingLocalOptions();
2326
2326
  });
2327
2327
  }
2328
2328
  /**
@@ -2452,7 +2452,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2452
2452
  */
2453
2453
  optsWithGlobals() {
2454
2454
  return this._getCommandAndAncestors().reduce(
2455
- (combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()),
2455
+ (combinedOptions, cmd2) => Object.assign(combinedOptions, cmd2.opts()),
2456
2456
  {}
2457
2457
  );
2458
2458
  }
@@ -6508,6 +6508,19 @@ var init_spinner = __esm({
6508
6508
  }
6509
6509
  });
6510
6510
 
6511
+ // src/lib/invocation.ts
6512
+ function invocation() {
6513
+ return process.env.npm_config_user_agent ? "npx -y @tryhermes/cli@latest" : "hermes";
6514
+ }
6515
+ function cmd(sub) {
6516
+ return `${invocation()} ${sub}`;
6517
+ }
6518
+ var init_invocation = __esm({
6519
+ "src/lib/invocation.ts"() {
6520
+ "use strict";
6521
+ }
6522
+ });
6523
+
6511
6524
  // src/lib/api-client.ts
6512
6525
  async function apiFetch(path, opts = {}) {
6513
6526
  const cfg = await loadConfig();
@@ -6517,7 +6530,7 @@ async function apiFetch(path, opts = {}) {
6517
6530
  throw new CliApiError(401, {
6518
6531
  code: "NOT_AUTHENTICATED",
6519
6532
  message: "Not signed in.",
6520
- hint: "Run `hermes auth login` (interactive) or `hermes auth login --key hk_\u2026` (CI)."
6533
+ hint: `Run \`${cmd("auth login")}\` (interactive) or \`${cmd("auth login --key hk_\u2026")}\` (CI).`
6521
6534
  });
6522
6535
  }
6523
6536
  const url = new URL(path.startsWith("/") ? path : `/${path}`, apiUrl).toString();
@@ -6575,6 +6588,7 @@ var init_api_client = __esm({
6575
6588
  "use strict";
6576
6589
  init_config();
6577
6590
  init_spinner();
6591
+ init_invocation();
6578
6592
  CliApiError = class extends Error {
6579
6593
  status;
6580
6594
  code;
@@ -6714,11 +6728,14 @@ async function runDeviceFlow() {
6714
6728
  method: "POST",
6715
6729
  skipAuth: true
6716
6730
  });
6731
+ const { api_url } = await loadConfig();
6732
+ const completeUrl = new URL(init.verification_uri_complete, api_url).toString();
6733
+ const visitUrl = new URL(init.verification_uri, api_url).toString();
6717
6734
  console.log("");
6718
6735
  console.log("To authorize this CLI, open:");
6719
- console.log(` ${init.verification_uri_complete}`);
6736
+ console.log(` ${completeUrl}`);
6720
6737
  console.log("");
6721
- console.log(`Or visit ${init.verification_uri} and enter the code:`);
6738
+ console.log(`Or visit ${visitUrl} and enter the code:`);
6722
6739
  console.log(` ${formatUserCode(init.user_code)}`);
6723
6740
  console.log("");
6724
6741
  console.log(`Waiting for approval (expires in ${Math.floor(init.expires_in / 60)} min)...`);
@@ -6738,18 +6755,18 @@ async function runDeviceFlow() {
6738
6755
  return;
6739
6756
  }
6740
6757
  if (poll.status === "expired") {
6741
- throw new Error("Code expired before approval. Re-run `hermes auth login`.");
6758
+ throw new Error(`Code expired before approval. Re-run \`${cmd("auth login")}\`.`);
6742
6759
  }
6743
6760
  if (poll.status === "already_consumed") {
6744
6761
  throw new Error(
6745
- "This code was already used. Re-run `hermes auth login` to start fresh."
6762
+ `This code was already used. Re-run \`${cmd("auth login")}\` to start fresh.`
6746
6763
  );
6747
6764
  }
6748
6765
  if (poll.status === "unknown") {
6749
6766
  throw new Error("Server didn't recognize the device code \u2014 start a new flow.");
6750
6767
  }
6751
6768
  }
6752
- throw new Error("Approval timeout \u2014 re-run `hermes auth login` and try again.");
6769
+ throw new Error(`Approval timeout \u2014 re-run \`${cmd("auth login")}\` and try again.`);
6753
6770
  }
6754
6771
  async function maybeWhoami() {
6755
6772
  try {
@@ -6791,7 +6808,7 @@ function registerAuthCommand(program3) {
6791
6808
  console.log(`Logged in as ${me.user_email ?? me.user_id} (org "${me.org_slug}").`);
6792
6809
  } else {
6793
6810
  console.log(
6794
- "Next: `hermes orgs list` to see your orgs, then `hermes link --org <slug>`."
6811
+ `Next: \`${cmd("orgs list")}\` to see your orgs, then \`${cmd("link --org <slug>")}\`.`
6795
6812
  );
6796
6813
  }
6797
6814
  process.exit(0);
@@ -6845,6 +6862,7 @@ var init_auth = __esm({
6845
6862
  "use strict";
6846
6863
  init_api_client();
6847
6864
  init_emit_error();
6865
+ init_invocation();
6848
6866
  init_config();
6849
6867
  }
6850
6868
  });
@@ -6899,7 +6917,7 @@ function indent(text, prefix = " ") {
6899
6917
  }
6900
6918
  function renderSchema(s) {
6901
6919
  const example = typeof s.example_query === "string" ? s.example_query : JSON.stringify(s.example_query, null, 2);
6902
- const snapshot = s.snapshot ? JSON.stringify(s.snapshot, null, 2) : "(no schema sampled yet \u2014 run `hermes connections inspect-schema`)";
6920
+ const snapshot = s.snapshot ? JSON.stringify(s.snapshot, null, 2) : `(no schema sampled yet \u2014 run \`${cmd("connections inspect-schema")}\`)`;
6903
6921
  return [
6904
6922
  `Connection: ${s.connection_id}`,
6905
6923
  `Source: ${s.source_type}`,
@@ -6930,7 +6948,7 @@ async function resolveConnectionId(explicit) {
6930
6948
  throw new CliApiError(404, {
6931
6949
  code: "NOT_FOUND",
6932
6950
  message: "No connection in this org.",
6933
- hint: "Run `hermes connections add --postgres-url ...` (or another source flag) first."
6951
+ hint: `Run \`${cmd("connections add --postgres-url ...")}\` (or another source flag) first.`
6934
6952
  });
6935
6953
  }
6936
6954
  return list.connections[0].id;
@@ -7027,7 +7045,7 @@ function registerConnectionsCommand(program3) {
7027
7045
  console.log(renderConnectionDetail(conn));
7028
7046
  console.log("");
7029
7047
  console.log(
7030
- "Next: run `hermes connections schema` to see the dialect + cached schema before writing a detection_query."
7048
+ `Next: run \`${cmd("connections schema")}\` to see the dialect + cached schema before writing a detection_query.`
7031
7049
  );
7032
7050
  }
7033
7051
  process.exit(0);
@@ -7167,6 +7185,7 @@ var init_connections = __esm({
7167
7185
  init_api_client();
7168
7186
  init_api_client();
7169
7187
  init_emit_error();
7188
+ init_invocation();
7170
7189
  }
7171
7190
  });
7172
7191
 
@@ -7284,7 +7303,7 @@ function registerDomainsCommand(program3) {
7284
7303
  console.log(renderDomainDetail(result));
7285
7304
  console.log("");
7286
7305
  console.log(
7287
- "Next: set the records above at your DNS provider, then run `hermes domains verify " + result.domain + "`."
7306
+ `Next: set the records above at your DNS provider, then run \`${cmd("domains verify " + result.domain)}\`.`
7288
7307
  );
7289
7308
  }
7290
7309
  process.exit(0);
@@ -7332,6 +7351,7 @@ var init_domains = __esm({
7332
7351
  "use strict";
7333
7352
  init_api_client();
7334
7353
  init_emit_error();
7354
+ init_invocation();
7335
7355
  }
7336
7356
  });
7337
7357
 
@@ -7585,7 +7605,7 @@ function registerLinkCommand(program3) {
7585
7605
  const match = list.orgs.find((o) => o.slug === requested);
7586
7606
  if (!match) {
7587
7607
  console.error(`Error: org "${requested}" not found or not accessible.`);
7588
- console.error("Run `hermes orgs list` to see what's available.");
7608
+ console.error(`Run \`${cmd("orgs list")}\` to see what's available.`);
7589
7609
  process.exit(1);
7590
7610
  }
7591
7611
  await writeLinkedProject({ org_slug: match.slug, org_id: match.id });
@@ -7639,6 +7659,7 @@ var init_link = __esm({
7639
7659
  "use strict";
7640
7660
  init_api_client();
7641
7661
  init_emit_error();
7662
+ init_invocation();
7642
7663
  init_config();
7643
7664
  }
7644
7665
  });
@@ -7691,7 +7712,7 @@ function renderOrgDetail(o, counts) {
7691
7712
  }
7692
7713
  function formatOrgsTable(items) {
7693
7714
  if (items.length === 0) {
7694
- return 'No orgs. Run `hermes orgs create --name "My Org"` to make one.';
7715
+ return `No orgs. Run \`${cmd('orgs create --name "My Org"')}\` to make one.`;
7695
7716
  }
7696
7717
  const rows = items.map((o) => ({
7697
7718
  slug: o.slug,
@@ -7727,7 +7748,7 @@ function registerOrgsCommand(program3) {
7727
7748
  emitApiError(err, Boolean(opts.json));
7728
7749
  }
7729
7750
  });
7730
- const brandOptions = (cmd) => cmd.option("--logo-url <url>", "\u2192 logo_url").option("--description <text>", "\u2192 description").option("--from-name <name>", "\u2192 from_name (org-default From display name)").option("--reply-to <addr>", "\u2192 reply_to (org-default Reply-To)").option("--email-footer <text>", "\u2192 email_footer (org-default footer)").option("--company-md <path-or-text>", "\u2192 company_md (agent context; @file reads a file)");
7751
+ const brandOptions = (cmd2) => cmd2.option("--logo-url <url>", "\u2192 logo_url").option("--description <text>", "\u2192 description").option("--from-name <name>", "\u2192 from_name (org-default From display name)").option("--reply-to <addr>", "\u2192 reply_to (org-default Reply-To)").option("--email-footer <text>", "\u2192 email_footer (org-default footer)").option("--company-md <path-or-text>", "\u2192 company_md (agent context; @file reads a file)");
7731
7752
  brandOptions(
7732
7753
  orgs.command("create").description("Create a new org (account-level auth only \u2014 API keys are org-scoped)").requiredOption("--name <name>", "human-readable org name").option("--slug <slug>", "explicit slug (otherwise derived from --name)")
7733
7754
  ).action(async function() {
@@ -7756,7 +7777,7 @@ function registerOrgsCommand(program3) {
7756
7777
  const opts = this.optsWithGlobals();
7757
7778
  const slug = await resolveOrgSlug(opts.org);
7758
7779
  if (!slug) {
7759
- console.error("Error: no org. Run `hermes link --org <slug>` or pass `--org <slug>`.");
7780
+ console.error(`Error: no org. Run \`${cmd("link --org <slug>")}\` or pass \`--org <slug>\`.`);
7760
7781
  process.exit(1);
7761
7782
  }
7762
7783
  try {
@@ -7807,7 +7828,7 @@ function registerOrgsCommand(program3) {
7807
7828
  const opts = this.optsWithGlobals();
7808
7829
  const slug = await resolveOrgSlug(opts.org);
7809
7830
  if (!slug) {
7810
- console.error("Error: no org. Run `hermes link --org <slug>` or pass `--org <slug>`.");
7831
+ console.error(`Error: no org. Run \`${cmd("link --org <slug>")}\` or pass \`--org <slug>\`.`);
7811
7832
  process.exit(1);
7812
7833
  }
7813
7834
  try {
@@ -7818,7 +7839,7 @@ function registerOrgsCommand(program3) {
7818
7839
  if (opts.json) {
7819
7840
  console.log(JSON.stringify(result, null, 2));
7820
7841
  } else {
7821
- console.log(`Deleted org ${result.slug} (${result.id}). Run \`hermes unlink\` to clear the local link.`);
7842
+ console.log(`Deleted org ${result.slug} (${result.id}). Run \`${cmd("unlink")}\` to clear the local link.`);
7822
7843
  }
7823
7844
  process.exit(0);
7824
7845
  } catch (err) {
@@ -7833,6 +7854,7 @@ var init_orgs = __esm({
7833
7854
  import_promises2 = require("fs/promises");
7834
7855
  init_api_client();
7835
7856
  init_emit_error();
7857
+ init_invocation();
7836
7858
  init_config();
7837
7859
  }
7838
7860
  });
@@ -7939,7 +7961,7 @@ function registerSendersCommand(program3) {
7939
7961
  console.log(renderSenderDetail(sender));
7940
7962
  console.log("");
7941
7963
  console.log(
7942
- "Next: attach to a trigger with `hermes triggers update <trigger-id> --sender " + sender.id + "`."
7964
+ `Next: attach to a trigger with \`${cmd("triggers update <trigger-id> --sender " + sender.id)}\`.`
7943
7965
  );
7944
7966
  }
7945
7967
  process.exit(0);
@@ -8004,6 +8026,7 @@ var init_senders = __esm({
8004
8026
  "use strict";
8005
8027
  init_api_client();
8006
8028
  init_emit_error();
8029
+ init_invocation();
8007
8030
  }
8008
8031
  });
8009
8032
 
@@ -8405,7 +8428,7 @@ var init_program = __esm({
8405
8428
  ).version("0.0.1").option("--org <slug>", "operate on this org (overrides ./.hermes/project.json)").option("--json", "emit structured JSON instead of human-readable output").option("--no-wait", "for async ops, return job_id immediately instead of polling").showHelpAfterError("(run with --help for usage)").action(() => program2.help());
8406
8429
  program2.addHelpText(
8407
8430
  "afterAll",
8408
- "\nDocs: https://docs.tryhermes.dev\nRun: npx -y @tryhermes/cli@latest <command> (always uses the latest version)"
8431
+ "\nDocs: https://docs.tryhermes.dev\nSkill: npx skills add tryhermes/skill (teach your agent to drive this CLI)\nRun: npx -y @tryhermes/cli@latest <command> (always latest)"
8409
8432
  );
8410
8433
  program2.hook("preAction", (_thisCommand, actionCommand) => {
8411
8434
  setGlobalOrgOverride(actionCommand.optsWithGlobals().org);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryhermes/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Hermes CLI — drive the agentic email platform (connections, triggers, drafts, sends) from the terminal.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "tsup": "^8.5.1",
23
23
  "tsx": "^4.19.2",
24
24
  "typescript": "^5.6.3",
25
- "@workspace/eslint-config": "0.0.0",
26
25
  "@workspace/api-types": "0.0.1",
26
+ "@workspace/eslint-config": "0.0.0",
27
27
  "@workspace/typescript-config": "0.0.0"
28
28
  },
29
29
  "scripts": {