@letterstory/cli 0.177.113 → 0.177.114

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.113";
94
+ export const VERSION = "0.177.114";
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
@@ -51,6 +51,7 @@ export const ARGS = {
51
51
  undo_billing_plan_cancel: {},
52
52
  update_billing_card: {},
53
53
  list_integrations: {},
54
+ get_workspace_overview: {},
54
55
  get_linear_connection: {},
55
56
  list_linear_targets: { team_id: { flag: "team" } },
56
57
  set_linear_target: {
@@ -108,6 +109,8 @@ export async function cmdOrg(ctx) {
108
109
  return orgGit(rest);
109
110
  case "integrations":
110
111
  return orgIntegrations(rest);
112
+ case "overview":
113
+ return orgOverview(rest);
111
114
  case "fields":
112
115
  return orgFields(rest);
113
116
  case "linear":
@@ -118,7 +121,7 @@ export async function cmdOrg(ctx) {
118
121
  return orgBilling(rest);
119
122
  default:
120
123
  throw new CliError(
121
- `Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, linear, mcp, fields, billing`
124
+ `Unknown org subcommand: ${sub ?? "(none)"}. Try: export, join, diff, apply, git, integrations, overview, linear, mcp, fields, billing`
122
125
  );
123
126
  }
124
127
  }
@@ -135,6 +138,34 @@ async function orgIntegrations(ctx) {
135
138
  return 0;
136
139
  }
137
140
 
141
+ const NEED_WORDS = {
142
+ approve: (n) => `${n} ${n === 1 ? "email" : "emails"} to approve`,
143
+ replies: (n) => `${n} ${n === 1 ? "reply" : "replies"} to answer`,
144
+ paused: (n) => `${n} ${n === 1 ? "sequence" : "sequences"} paused`,
145
+ };
146
+
147
+ /**
148
+ * `org overview`: what the org holds and what waits on a person (get_workspace_overview), the read behind the
149
+ * app's More menu: what needs you, a count per feature, and the sequences and lists changed lately.
150
+ */
151
+ async function orgOverview(ctx) {
152
+ const { client, flags, io } = ctx;
153
+ refuseUnknownFlags(ctx, {}, []);
154
+ const result = await client.callTool("get_workspace_overview", {});
155
+ ok(ctx, result.message);
156
+ printResult(io, flags, result, (r) => {
157
+ const needs = r.needs.length
158
+ ? r.needs.map((n) => `! ${NEED_WORDS[n.key]?.(n.count) ?? `${n.count} ${n.key}`}`)
159
+ : ["Nothing waits on you."];
160
+ const counts = Object.entries(r.counts)
161
+ .filter(([, n]) => n > 0)
162
+ .map(([key, n]) => ` ${key.replace(/^\//, "")}: ${formatCount(n)}`);
163
+ const recent = r.recent.map((x) => ` ${x.name} (${x.kind === "sequence" ? "sequence" : "list"})`);
164
+ return [...needs, "", "Holds:", ...counts, ...(recent.length ? ["", "Recent:", ...recent] : [])].join("\n");
165
+ });
166
+ return 0;
167
+ }
168
+
138
169
  /** A cap from the command line: dollars, or `off` (no cap). */
139
170
  function capFrom(value) {
140
171
  if (["off", "none", "null"].includes(String(value).toLowerCase())) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.113",
3
+ "version": "0.177.114",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",