@letterstory/cli 0.177.113 → 0.177.115
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 +2 -1
- package/lib/commands/org.mjs +80 -1
- package/package.json +1 -1
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.
|
|
94
|
+
export const VERSION = "0.177.115";
|
|
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;
|
|
@@ -1589,6 +1589,7 @@ Org (the account as one file, its integrations and billing):
|
|
|
1589
1589
|
org export --split <dir> …as one file per record (for keeping config in git)
|
|
1590
1590
|
org join <dir> [--file <path>] Rebuild the bundle from a --split directory
|
|
1591
1591
|
org integrations Every integration and whether it's connected
|
|
1592
|
+
org overview What needs you, what the org holds, and recent sequences
|
|
1592
1593
|
org billing [cap <dollars|off> [--why "…"] | card | request [--note "…"] | cancel [--why "…"] --yes | keep]
|
|
1593
1594
|
Usage billing: plan, this period against the
|
|
1594
1595
|
allowance and spend cap, failed payments; set
|
package/lib/commands/org.mjs
CHANGED
|
@@ -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: {},
|
|
@@ -51,6 +54,7 @@ export const ARGS = {
|
|
|
51
54
|
undo_billing_plan_cancel: {},
|
|
52
55
|
update_billing_card: {},
|
|
53
56
|
list_integrations: {},
|
|
57
|
+
get_workspace_overview: {},
|
|
54
58
|
get_linear_connection: {},
|
|
55
59
|
list_linear_targets: { team_id: { flag: "team" } },
|
|
56
60
|
set_linear_target: {
|
|
@@ -108,6 +112,8 @@ export async function cmdOrg(ctx) {
|
|
|
108
112
|
return orgGit(rest);
|
|
109
113
|
case "integrations":
|
|
110
114
|
return orgIntegrations(rest);
|
|
115
|
+
case "overview":
|
|
116
|
+
return orgOverview(rest);
|
|
111
117
|
case "fields":
|
|
112
118
|
return orgFields(rest);
|
|
113
119
|
case "linear":
|
|
@@ -116,9 +122,11 @@ export async function cmdOrg(ctx) {
|
|
|
116
122
|
return orgMcp(rest);
|
|
117
123
|
case "billing":
|
|
118
124
|
return orgBilling(rest);
|
|
125
|
+
case "auto-connect":
|
|
126
|
+
return orgAutoConnect(rest);
|
|
119
127
|
default:
|
|
120
128
|
throw new CliError(
|
|
121
|
-
`Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, linear, mcp, fields, billing`
|
|
129
|
+
`Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, overview, linear, mcp, fields, billing, auto-connect`
|
|
122
130
|
);
|
|
123
131
|
}
|
|
124
132
|
}
|
|
@@ -135,6 +143,34 @@ async function orgIntegrations(ctx) {
|
|
|
135
143
|
return 0;
|
|
136
144
|
}
|
|
137
145
|
|
|
146
|
+
const NEED_WORDS = {
|
|
147
|
+
approve: (n) => `${n} ${n === 1 ? "email" : "emails"} to approve`,
|
|
148
|
+
replies: (n) => `${n} ${n === 1 ? "reply" : "replies"} to answer`,
|
|
149
|
+
paused: (n) => `${n} ${n === 1 ? "sequence" : "sequences"} paused`,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* `org overview`: what the org holds and what waits on a person (get_workspace_overview), the read behind the
|
|
154
|
+
* app's More menu: what needs you, a count per feature, and the sequences and lists changed lately.
|
|
155
|
+
*/
|
|
156
|
+
async function orgOverview(ctx) {
|
|
157
|
+
const { client, flags, io } = ctx;
|
|
158
|
+
refuseUnknownFlags(ctx, {}, []);
|
|
159
|
+
const result = await client.callTool("get_workspace_overview", {});
|
|
160
|
+
ok(ctx, result.message);
|
|
161
|
+
printResult(io, flags, result, (r) => {
|
|
162
|
+
const needs = r.needs.length
|
|
163
|
+
? r.needs.map((n) => `! ${NEED_WORDS[n.key]?.(n.count) ?? `${n.count} ${n.key}`}`)
|
|
164
|
+
: ["Nothing waits on you."];
|
|
165
|
+
const counts = Object.entries(r.counts)
|
|
166
|
+
.filter(([, n]) => n > 0)
|
|
167
|
+
.map(([key, n]) => ` ${key.replace(/^\//, "")}: ${formatCount(n)}`);
|
|
168
|
+
const recent = r.recent.map((x) => ` ${x.name} (${x.kind === "sequence" ? "sequence" : "list"})`);
|
|
169
|
+
return [...needs, "", "Holds:", ...counts, ...(recent.length ? ["", "Recent:", ...recent] : [])].join("\n");
|
|
170
|
+
});
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
138
174
|
/** A cap from the command line: dollars, or `off` (no cap). */
|
|
139
175
|
function capFrom(value) {
|
|
140
176
|
if (["off", "none", "null"].includes(String(value).toLowerCase())) return null;
|
|
@@ -477,6 +513,49 @@ async function orgLinear(ctx) {
|
|
|
477
513
|
}
|
|
478
514
|
}
|
|
479
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
|
+
|
|
480
559
|
/**
|
|
481
560
|
* `org mcp` — other products' MCP servers Letter's agent can call (docs/architecture/mcp-connections.md):
|
|
482
561
|
* org mcp the connections (list_mcp_connections)
|