@letterstory/cli 0.177.114 → 0.177.116

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/lib/cli.mjs CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
92
92
 
93
93
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
94
- export const VERSION = "0.177.114";
94
+ export const VERSION = "0.177.116";
95
95
 
96
96
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
97
97
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -159,6 +159,7 @@ export const BOOLEAN_FLAGS = new Set([
159
159
  "failing",
160
160
  // replicate forms: read the site's forms key (admins) instead of its submissions.
161
161
  "show-key",
162
+ "searched",
162
163
  // sim create / resample / sample-key: keep the customer's sample key, or delete it now.
163
164
  "keep-key",
164
165
  "delete-key",
@@ -38,6 +38,9 @@ export const ARGS = {
38
38
  describe_org_config_fields: {},
39
39
  get_org_config_source: {},
40
40
  get_billing_payments: {},
41
+ list_trusted_issuers: {},
42
+ approve_trusted_issuer: { issuer: { positional: 0, label: "issuer", required: true } },
43
+ revoke_trusted_issuer: { issuer: { positional: 0, label: "issuer", required: true } },
41
44
  get_billing: {},
42
45
  get_billing_invoices: {},
43
46
  list_token_rewards: {},
@@ -119,9 +122,11 @@ export async function cmdOrg(ctx) {
119
122
  return orgMcp(rest);
120
123
  case "billing":
121
124
  return orgBilling(rest);
125
+ case "auto-connect":
126
+ return orgAutoConnect(rest);
122
127
  default:
123
128
  throw new CliError(
124
- `Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, overview, linear, mcp, fields, billing`
129
+ `Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, overview, linear, mcp, fields, billing, auto-connect`
125
130
  );
126
131
  }
127
132
  }
@@ -508,6 +513,49 @@ async function orgLinear(ctx) {
508
513
  }
509
514
  }
510
515
 
516
+ /**
517
+ * `org auto-connect` — the issuers whose Claude auto-connect sign-ins the org accepts:
518
+ * org auto-connect the issuers, live and revoked (list_trusted_issuers)
519
+ * org auto-connect approve <issuer> trust an issuer for this org (approve_trusted_issuer)
520
+ * org auto-connect revoke <issuer> --yes stop trusting it (revoke_trusted_issuer)
521
+ */
522
+ async function orgAutoConnect(ctx) {
523
+ const { client, flags, io } = ctx;
524
+ const sub = ctx.positionals[0] ?? "list";
525
+ const rest = ctx.positionals.slice(1);
526
+ const line = (i) =>
527
+ `${i.revoked_at ? "○" : "●"} ${i.issuer} added by ${i.added_by}${i.revoked_at ? ` (revoked ${i.revoked_at})` : ""}`;
528
+ const call = async (tool, allowed) => {
529
+ refuseUnknownFlags(ctx, {}, allowed);
530
+ return client.callTool(tool, argsFromFlags(ARGS[tool], flags, rest));
531
+ };
532
+ switch (sub) {
533
+ case "list": {
534
+ const result = await call("list_trusted_issuers", []);
535
+ printResult(io, flags, result, (r) => r.issuers.map(line).join("\n") || "No trusted issuers.");
536
+ return 0;
537
+ }
538
+ case "approve": {
539
+ const result = await call("approve_trusted_issuer", []);
540
+ printResult(io, flags, result, (r) => line(r.issuer));
541
+ return 0;
542
+ }
543
+ case "revoke": {
544
+ if (!flagBool(flags.yes)) {
545
+ io.error(
546
+ `Revoking stops Claude auto-connect sign-ins from this issuer. Re-run with --yes to confirm: ${ctx.bin} org auto-connect revoke <issuer> --yes`
547
+ );
548
+ return 1;
549
+ }
550
+ const result = await call("revoke_trusted_issuer", ["yes"]);
551
+ printResult(io, flags, result, (r) => line(r.issuer));
552
+ return 0;
553
+ }
554
+ default:
555
+ throw new CliError(`Unknown org auto-connect subcommand: ${sub}. Try: list, approve, revoke`);
556
+ }
557
+ }
558
+
511
559
  /**
512
560
  * `org mcp` — other products' MCP servers Letter's agent can call (docs/architecture/mcp-connections.md):
513
561
  * org mcp the connections (list_mcp_connections)
@@ -8,7 +8,7 @@
8
8
  // routes and staff Fleet do.
9
9
 
10
10
  import { CliError } from "../client.mjs";
11
- import { flagStr, flagNum, flagList, printResult, argsFromFlags, refuseUnknownFlags, ok } from "./shared.mjs";
11
+ import { flagStr, flagNum, flagBool, flagList, printResult, argsFromFlags, refuseUnknownFlags, ok } from "./shared.mjs";
12
12
 
13
13
  const STATUSES = ["active", "inactive", "achieved", "retired"];
14
14
  const PRIORITIES = ["high", "normal", "low"];
@@ -97,7 +97,10 @@ export const ARGS = {
97
97
  },
98
98
  },
99
99
  },
100
- suggest_ranking_targets: { offering_id: offering },
100
+ suggest_ranking_targets: {
101
+ offering_id: offering,
102
+ searched: { value: (flags) => (flags.searched === undefined ? undefined : flagBool(flags.searched)) },
103
+ },
101
104
  list_question_candidates: { limit: { flag: "limit", type: "num" } },
102
105
  list_ranking_subqueries: {
103
106
  target_id: { positional: 0, label: "target-id" },
@@ -137,7 +140,7 @@ const USAGE = `Usage: targets <list|add|update|activate|deactivate|cap|suggest|c
137
140
  targets activate <target-id>
138
141
  targets deactivate <target-id>
139
142
  targets cap <offering-id|company> <n|default>
140
- targets suggest [--offering <offering-id|company>]
143
+ targets suggest [--offering <offering-id|company>] [--searched]
141
144
  targets candidates [--limit <n>] new questions the market asks, checked and deduped
142
145
  targets subqueries [<target-id>] [--retired] the phrasings asked under each target
143
146
  targets subquery add <target-id> <phrasing>
@@ -332,7 +335,7 @@ async function targetsSuggest(ctx) {
332
335
  const scope = r.offering_id ? ` --offering ${r.offering_id}` : "";
333
336
  const lines = all.map(
334
337
  (s) =>
335
- ` ${s.phrase} [${s.basis}]${s.suggestedFraming ? ` — as ${s.suggestedFraming}` : ""}\n ${s.rationale}`
338
+ ` ${s.phrase} [${s.basis}]${s.monthlySearches != null ? ` ${s.monthlySearches}/mo` : ""}${s.suggestedFraming ? ` — as ${s.suggestedFraming}` : ""}\n ${s.rationale}`
336
339
  );
337
340
  lines.push(`Nothing saved. Keep one with: ${ctx.bin} targets add <phrase>${scope}`);
338
341
  return lines.join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.114",
3
+ "version": "0.177.116",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",