slack-term 1.49.0 → 1.49.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.
Files changed (3) hide show
  1. package/dist/cli.js +158 -158
  2. package/package.json +1 -1
  3. package/ts/cli.ts +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slack-term",
3
- "version": "1.49.0",
3
+ "version": "1.49.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snomiao/slack-term.git"
package/ts/cli.ts CHANGED
@@ -477,7 +477,13 @@ async function cmdThread(token: string, target: string, ts: string, limit: numbe
477
477
  let msgs = all
478
478
  ? await wholeThread(token, channelId, parseInputTs(ts), cookie)
479
479
  : asArray(((await replies(token, channelId, parseInputTs(ts), limit, cookie)) as Record<string, Json>).messages).map(asRecord);
480
- if (since !== undefined) msgs = msgs.filter((m) => Number(m.ts) > Number(since));
480
+ if (since !== undefined) {
481
+ // The same ts forms the thread argument takes (Slack ts or the ISO stamp
482
+ // `read` prints); anything else would compare as NaN and drop every reply.
483
+ const after = Number(parseInputTs(since));
484
+ if (!Number.isFinite(after)) throw new Error(`--since needs a message ts (1700000000.000100) or ISO stamp (got ${stripTerminalControls(since)})`);
485
+ msgs = msgs.filter((m) => Number(m.ts) > after);
486
+ }
481
487
  if (format === "tsv") {
482
488
  for (const m of msgs) console.log(tsvLine(m));
483
489
  return;
@@ -2156,6 +2162,7 @@ async function cmdPinlogUpdate(token: string, args: PinlogUpdateArgs): Promise<v
2156
2162
  try {
2157
2163
  const back = asArray(asRecord((await replies(token, channel, ts, 1, args.cookie)) as Json).messages).map(asRecord);
2158
2164
  stored = back.find((m) => m.ts === ts);
2165
+ if (!stored) console.error(`⚠ HEAD updated, but the read-back did not return it, so it was not checked`);
2159
2166
  } catch (e: unknown) {
2160
2167
  console.error(`⚠ HEAD updated, but it could not be read back to check: ${friendlySlackError(e)}`);
2161
2168
  }
@@ -6667,6 +6674,9 @@ async function main(): Promise<void> {
6667
6674
  if ("error" in r) { refused.push(`${item.file}: ${r.error}`); continue; }
6668
6675
  const text = applyPrefix(item.entry.text, settings.prefix);
6669
6676
  if (!text.trim()) { refused.push(`${item.file}: empty`); continue; }
6677
+ // send/reply's URL-boundary refusal: a glued URL stays queued, the
6678
+ // reason in `refused`, for the author to fix the file.
6679
+ guardUrlBoundaries(text);
6670
6680
  plan.push({ item, ...r, text });
6671
6681
  } catch (e: unknown) {
6672
6682
  refused.push(`${item.file}: ${friendlySlackError(e)}`);
@@ -6675,7 +6685,7 @@ async function main(): Promise<void> {
6675
6685
  for (const r of refused) console.error(`refused (stays queued): ${r}`);
6676
6686
  if (!plan.length) process.exit(2);
6677
6687
  const lines = [`OUTBOX — ${plan.length} repl${plan.length === 1 ? "y" : "ies"}${asBot ? " as the bot" : ""}:`];
6678
- for (const p of plan) lines.push(` → ${p.channel} thread ${p.threadTs}: ${stripTerminalControls(p.text).replace(/\n/g, "⏎").slice(0, 120)}`);
6688
+ for (const p of plan) lines.push(` → ${p.channel} thread ${p.threadTs}: ${stripTerminalControls(p.text).replace(/\n/g, "⏎").slice(0, 120)}${p.text.includes("[redacted:") ? " (secrets were masked when queued: this is what posts)" : ""}`);
6679
6689
  const expected = safetyCode("outbox", asBot ? "bot" : "user", ...plan.map((p) => `${p.channel}:${p.threadTs}:${p.text}`));
6680
6690
  if (argv.code !== expected) requireCode(argv.code, expected, lines);
6681
6691
  let failed = 0;