primcli 3.0.0-preview.15 → 3.0.0-preview.17

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.
@@ -1,12 +1,12 @@
1
1
  import { B as parseOwnerMemberAddress, F as agentProfilesDirectory, I as connectedAgentIdentity, L as connectedApiBaseUrl, M as AgentConnectionSetupError, N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, U as saveConnectedAgentProfile, V as profileAlreadyConnectedMessage, W as PrimitiveApiClient, b as loadCliCredentials, j as AGENT_PROFILE_ENV, z as parseConnectedAgentProfile } from "./cli-config-Ms_0vNjq.js";
2
- import { Bt as getContact, Dt as deleteContact, Et as deleteAgentContact, Fn as putAgentContact, In as putAgentContactPolicy, Ln as putContact, Wt as getEmail, Xn as sendEmail, _r as __exportAll, an as inviteAgentConnection, cn as listAgentConnections, dn as listContacts, kn as listSentEmails, ln as listAgentContacts, mn as listDomains, qn as searchEmails, zt as getAgentContactPolicy } from "./repeats-Dj_o6c-X-C1y88ZwJ.js";
3
- import { Nt as defaultConnectionName, Rt as detectAgentRuntime, in as refuseOrgSelectionForProfile, jt as cliInvocation, rn as refreshStoredCliCredentials } from "./api-command-D5Nbd6Pq.js";
2
+ import { An as listSentEmails, Bt as getContact, Dt as deleteContact, Et as deleteAgentContact, In as putAgentContact, Jn as searchEmails, Ln as putAgentContactPolicy, Rn as putContact, Wt as getEmail, Zn as sendEmail, an as inviteAgentConnection, cn as listAgentConnections, dn as listContacts, ln as listAgentContacts, mn as listDomains, vr as __exportAll, zt as getAgentContactPolicy } from "./repeats-Dj_o6c-X-DlfpQiUq.js";
3
+ import { Bt as detectAgentRuntime, Ft as defaultConnectionName, Nt as cliInvocation, an as refreshStoredCliCredentials, on as refuseOrgSelectionForProfile } from "./api-command-CgBNtNyD.js";
4
4
  import { _ as acquireListenLock, b as listenLockHeld, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString } from "./shared-mail-files-BAQSGxxz.js";
5
- import { S as readBundledConnectSkill, a as NotificationRetryError, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope, y as installConnectSkill } from "./notify-session-B64Lgv6Z.js";
5
+ import { S as readBundledConnectSkill, a as NotificationRetryError, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope, y as installConnectSkill } from "./notify-session-Pt4oRh0I.js";
6
6
  import { a as backgroundListenStatus, d as stopBackgroundListen } from "./listen-background-DyBYca28.js";
7
7
  import { t as readSharedMailOwner } from "./shared-mail-watch-BAPMsFNv.js";
8
8
  import { withoutOrgSelection } from "./oclif/global-org-flag.js";
9
- import { o as scopedChatSenderTrust } from "./scoped-chat-CocomDwR.js";
9
+ import { o as scopedChatSenderTrust } from "./scoped-chat-Du-Bi0tC.js";
10
10
  import { accessSync, chmodSync, closeSync, constants, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { basename, delimiter, dirname, isAbsolute, join, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { $ as isTrustedSender, Pt as downloadEmailAttachmentPart, Q as isEmailReceivedEvent, c as classifySignalContent, et as parseWebhookEvent } from "./repeats-Dj_o6c-X-C1y88ZwJ.js";
2
- import { H as wakeReadCommand, V as skillFirstLine, rt as wakeInteractionSentence } from "./api-command-D5Nbd6Pq.js";
1
+ import { $ as isTrustedSender, Pt as downloadEmailAttachmentPart, Q as isEmailReceivedEvent, c as classifySignalContent, et as parseWebhookEvent } from "./repeats-Dj_o6c-X-DlfpQiUq.js";
2
+ import { H as skillFirstLine, U as wakeReadCommand, it as wakeInteractionSentence } from "./api-command-CgBNtNyD.js";
3
3
  import { _ as acquireListenLock, g as ListenStateError, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
4
4
  import { closeSync, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, opendirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { createHash, randomUUID, scryptSync } from "node:crypto";
@@ -1,8 +1,8 @@
1
- import { nn as getSentEmail } from "../repeats-Dj_o6c-X-C1y88ZwJ.js";
2
- import { L as readThreadContext, tn as createAuthenticatedCliApiClient } from "../api-command-D5Nbd6Pq.js";
1
+ import { nn as getSentEmail } from "../repeats-Dj_o6c-X-DlfpQiUq.js";
2
+ import { R as readThreadContext, rn as createAuthenticatedCliApiClient } from "../api-command-CgBNtNyD.js";
3
3
  import { AUTO_SIGNAL_KIND_ENV, AUTO_WORKING_RENEW_MS, autoSignalsDisabled, clearWorkingSending, markWorkingSending, readAutoClaim, readWorkingLease, recordRenewer, stopWorkingLease, writeWorkingLease } from "./auto-signals.js";
4
4
  import { _ as acquireListenLock } from "../shared-mail-files-BAQSGxxz.js";
5
- import { t as sendSignal } from "../signal-command-lJM0763f.js";
5
+ import { t as sendSignal } from "../signal-command-DZuZbt-_.js";
6
6
  import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  // src/oclif/auto-signal-worker.ts
@@ -1,4 +1,4 @@
1
- import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-CocomDwR.js";
1
+ import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-Du-Bi0tC.js";
2
2
  import { d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, r as mailAddress } from "../shared-mail-files-BAQSGxxz.js";
3
3
  import { existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { randomUUID } from "node:crypto";
@@ -1,5 +1,23 @@
1
1
  import { r as jsonOutputRequested } from "../json-output-ch756TXV.js";
2
2
  // src/oclif/command-not-found.ts
3
+ /** At most this many commands are suggested for one word. */
4
+ const MOST_SUGGESTED = 3;
5
+ /**
6
+ * The commands in another group named by the word typed where a subcommand
7
+ * was expected, said as a question (`email-rules list-email-rule-objections`
8
+ * is `email-rule-oversight list-email-rule-objections`), or "" when there are
9
+ * none or too many to be a likely meaning. Only those words are looked up,
10
+ * never a value typed after them, which can be any word at all.
11
+ */
12
+ function elsewhere(words, lookup) {
13
+ for (const word of words) {
14
+ const ids = lookup.named?.(word) ?? [];
15
+ if (ids.length === 0) continue;
16
+ if (ids.length > MOST_SUGGESTED) return "";
17
+ return ` Did you mean ${ids.map((id) => `"primitive ${id.split(":").join(" ")}"`).join(" or ")}?`;
18
+ }
19
+ return "";
20
+ }
3
21
  /**
4
22
  * What to say for an id no command has. oclif joins every word before the
5
23
  * first flag into the id while no command along the way takes arguments, so
@@ -18,7 +36,7 @@ function commandNotFoundMessage(id, lookup) {
18
36
  const rest = parts.slice(end).join(" ");
19
37
  if (topic || !command) return {
20
38
  code: "command_not_found",
21
- message: `Unknown command "${typed}". Run "${shown} --help" to see the commands under it.`
39
+ message: `Unknown command "${typed}".${elsewhere(parts.slice(end, end + 1), lookup)} Run "${shown} --help" to see the commands under it.`
22
40
  };
23
41
  if (command.takesArguments) return {
24
42
  code: "command_not_found",
@@ -31,7 +49,7 @@ function commandNotFoundMessage(id, lookup) {
31
49
  }
32
50
  return {
33
51
  code: "command_not_found",
34
- message: `Unknown command "${typed}". Run "primitive --help" to see the commands.`
52
+ message: `Unknown command "${typed}".${elsewhere(parts.slice(0, 2), lookup)} Run "primitive --help" to see the commands.`
35
53
  };
36
54
  }
37
55
  /**
@@ -46,7 +64,8 @@ const hook = async (options) => {
46
64
  const command = config.findCommand(id);
47
65
  return command ? { takesArguments: Object.keys(command.args ?? {}).length > 0 } : void 0;
48
66
  },
49
- hasSubcommands: (id) => config.commandIDs.some((other) => other.startsWith(`${id}:`))
67
+ hasSubcommands: (id) => config.commandIDs.some((other) => other.startsWith(`${id}:`)),
68
+ named: (word) => config.commands.filter((command) => !command.hidden && command.id.split(":").at(-1) === word).map((command) => command.id).sort()
50
69
  });
51
70
  if (jsonOutputRequested([...process.argv.slice(2), ...options.argv ?? []])) process.stdout.write(`${JSON.stringify({
52
71
  error: {
@@ -75,14 +75,17 @@ function formatShortHelp(command, { bin, subcommands = [], width }) {
75
75
  const nameWidth = Math.min(MAX_FLAG_NAME_WIDTH, Math.max(0, ...flags.map(({ name }) => name.length)));
76
76
  const listLine = (name, text) => clip(text ? ` ${name.padEnd(nameWidth)} ${text}` : ` ${name}`, width).slice(2);
77
77
  const examples = (command.examples ?? []).flatMap((example) => exampleCommands(example, bin)).slice(0, EXAMPLE_LIMIT);
78
+ const described = (command.description ?? "").replaceAll(/\s+/g, " ").trim();
79
+ const more = summary !== "" && described.length > firstSentence(command.description ?? "").length;
80
+ const fullHelp = `${bin} ${command.id} ${FULL_HELP_FLAG}`;
78
81
  return [
79
82
  ...summary ? [summary] : [],
83
+ ...more ? [`Summary only. Full description: \`${fullHelp}\`.`] : [],
80
84
  ...section("USAGE", [usageLine(command, bin)]),
81
85
  ...section("FLAGS", flags.map(({ name, text }) => listLine(name, text))),
82
86
  ...section("COMMANDS", subcommands.map(({ id, summary: text }) => listLine(id, render(firstSentence(text ?? ""))))),
83
87
  ...section("EXAMPLES", examples),
84
- "",
85
- `Full help: ${bin} ${command.id} ${FULL_HELP_FLAG}`
88
+ ...more ? [] : ["", `Full help: ${fullHelp}`]
86
89
  ].join("\n");
87
90
  }
88
91
  function terminalWidth() {