refactor(setup): own pair-telegram.ts in this branch with clean output

Previously setup:auto parsed pair-telegram's machine-readable status
blocks and rendered a banner on top. Fork the script instead: check
in setup/pair-telegram.ts with a focused 4-digit banner, a short
wrong-attempt line, and a single final PAIR_TELEGRAM status block
(kept so the parent driver still picks up PLATFORM_ID and
PAIRED_USER_ID via parseStatus).

Drop pair-telegram.ts from add-telegram.sh's copy list so the local
version isn't overwritten on re-runs. The other adapter files
(telegram.ts, telegram-pairing.ts, etc.) still come from the channels
branch.

Also fix a latent bug: auto.ts was reading ADMIN_USER_ID from the
success block, but the actual field name is PAIRED_USER_ID —
init-first-agent would have been called with --user-id "".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-22 00:27:43 +03:00
parent 356a4d0a9f
commit e24ecbf8b0
3 changed files with 133 additions and 122 deletions

View File

@@ -17,7 +17,6 @@ CHANNELS_BRANCH="origin/channels"
need_install() {
[[ ! -f src/channels/telegram.ts ]] && return 0
[[ ! -f setup/pair-telegram.ts ]] && return 0
! grep -q "^import './telegram.js';" src/channels/index.ts 2>/dev/null && return 0
return 1
}
@@ -26,14 +25,15 @@ if need_install; then
echo "[add-telegram] Fetching channels branch…"
git fetch origin channels >/dev/null 2>&1
# pair-telegram.ts is maintained in this branch (setup-auto), so it's NOT
# in this list — do not overwrite the local version with the channels copy.
echo "[add-telegram] Copying adapter files from $CHANNELS_BRANCH"
for f in \
src/channels/telegram.ts \
src/channels/telegram-pairing.ts \
src/channels/telegram-pairing.test.ts \
src/channels/telegram-markdown-sanitize.ts \
src/channels/telegram-markdown-sanitize.test.ts \
setup/pair-telegram.ts
src/channels/telegram-markdown-sanitize.test.ts
do
git show "$CHANNELS_BRANCH:$f" > "$f"
done