@letterstory/cli 0.99.0 → 0.100.1

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
@@ -59,7 +59,7 @@ import {
59
59
  } from "./commands.mjs";
60
60
 
61
61
  // Keep in sync with cli/package.json.
62
- export const VERSION = "0.99.0";
62
+ export const VERSION = "0.100.1";
63
63
 
64
64
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
65
65
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -1118,6 +1118,7 @@ Insights:
1118
1118
 
1119
1119
  Repo changes (Claude Code edits your repo in a sandbox; the Letterstory GitHub App opens a PR):
1120
1120
  repo repos Repos the Letterstory GitHub App can reach
1121
+ repo branches --repo owner/name Branches a change can start from (default first)
1121
1122
  repo start --repo <owner/name> --instructions <text>|--instructions-file <path|->
1122
1123
  [--branch <base>] [--attach <path>]... [--attach-url <name>=<https url>]... [--wait]
1123
1124
  Start a change (attached files go to the sandbox);
@@ -2838,6 +2838,7 @@ async function cmdAdminCrmCapture(ctx, paths) {
2838
2838
  * outreach add "Jane Doe" [--company …] [--owner …] [--channel x] [--relationship …]
2839
2839
  * [--ask …] [--linkedin …] [--email …] [--lookup]
2840
2840
  * outreach lookup "Jane Doe from Acme" [shot.png …] prefilled from the web; writes nothing
2841
+ * outreach catch-up [--dry-run] handle #launch-outreach posts the bot missed
2841
2842
  * outreach set <id> [--reached|--not-reached] [--response "…" --tone positive]
2842
2843
  * [--owner-id <uuid>] [--channel …] [--ask …] [--draft "…"] [--archive|--restore]
2843
2844
  */
@@ -2952,8 +2953,36 @@ async function cmdAdminCrmOutreach(ctx, args) {
2952
2953
  const r = await staffRequest(ctx, "PATCH", `${CRM}/outreach/${id}`, body);
2953
2954
  return json ? printResult(io, flags, r) : io.log(line(r));
2954
2955
  }
2956
+ case "catch-up": {
2957
+ // admin crm outreach catch-up [--dry-run] — handle #launch-outreach posts the bot
2958
+ // missed, calling again until none remain (each call is bounded server-side).
2959
+ const dryRun = flagBool(flags["dry-run"]);
2960
+ let total = 0;
2961
+ let after;
2962
+ for (let i = 0; i < 20; i++) {
2963
+ const r = await staffPost(
2964
+ ctx,
2965
+ `${CRM}/outreach/catch-up`,
2966
+ dryRun ? { dryRun: true } : compact({ after })
2967
+ );
2968
+ after = r.nextAfter ?? after;
2969
+ if (json) printResult(io, flags, r);
2970
+ else
2971
+ for (const it of r.items)
2972
+ io.log(
2973
+ `${it.ts} ${it.outcome ?? "pending"} ${it.preview}${it.files ? ` [${it.files} file(s)]` : ""}`
2974
+ );
2975
+ total += r.processed;
2976
+ if (dryRun || r.remaining === 0 || r.items.some((it) => it.outcome?.startsWith("failed:"))) {
2977
+ if (!json)
2978
+ io.log(dryRun ? `${r.pending} post(s) the bot missed` : `caught up: ${total} post(s) handled`);
2979
+ return;
2980
+ }
2981
+ }
2982
+ return;
2983
+ }
2955
2984
  default:
2956
- throw new CliError("Usage: admin crm outreach [list|add|lookup|set] … (see --help)");
2985
+ throw new CliError("Usage: admin crm outreach [list|add|lookup|set|catch-up] … (see --help)");
2957
2986
  }
2958
2987
  }
2959
2988
 
@@ -2,7 +2,7 @@
2
2
  // pull request by the Letterstory GitHub App (src/lib/repo-changes). One subcommand per tool:
3
3
  // repo start → start_repo_change repo status → get_repo_change
4
4
  // repo list → list_repo_changes repo cancel → cancel_repo_change
5
- // repo repos → list_github_app_repos
5
+ // repo repos → list_github_app_repos repo branches → list_repo_branches
6
6
 
7
7
  import { readFileSync } from "node:fs";
8
8
  import { basename } from "node:path";
@@ -64,6 +64,10 @@ const ARGS = {
64
64
  audit_id: "audit",
65
65
  },
66
66
  list_github_app_repos: {},
67
+ list_repo_branches: {
68
+ repo_owner: { value: (flags) => splitRepo(flags).owner },
69
+ repo_name: { value: (flags) => splitRepo(flags).name },
70
+ },
67
71
  };
68
72
 
69
73
  const TERMINAL = new Set(["succeeded", "no_changes", "failed", "cancelled"]);
@@ -100,9 +104,11 @@ export async function cmdRepo(ctx) {
100
104
  return repoCancel(rest);
101
105
  case "repos":
102
106
  return repoRepos(rest);
107
+ case "branches":
108
+ return repoBranches(rest);
103
109
  default:
104
110
  throw new CliError(
105
- `Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, sites, set-site, reset-site, status, list, cancel, repos`
111
+ `Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, sites, set-site, reset-site, status, list, cancel, repos, branches`
106
112
  );
107
113
  }
108
114
  }
@@ -302,4 +308,15 @@ async function repoRepos(ctx) {
302
308
  return 0;
303
309
  }
304
310
 
311
+ /** `repo branches --repo owner/name`: the branches a run can start from, default first. */
312
+ async function repoBranches(ctx) {
313
+ const { client, flags, io } = ctx;
314
+ refuseUnknownFlags(ctx, {}, ["repo", "owner", "name"]);
315
+ const result = await client.callTool("list_repo_branches", argsFromFlags(ARGS.list_repo_branches, flags));
316
+ printResult(io, flags, result, (r) =>
317
+ r.branches.map((b) => (b === r.defaultBranch ? `${b} (default)` : b)).join("\n")
318
+ );
319
+ return 0;
320
+ }
321
+
305
322
  export { ARGS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.99.0",
3
+ "version": "0.100.1",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",