Personal Telegram developer console for GitHub
feat/studio-g0-foundation
audit/commit-drilldown
audit/finalize-workspace-menu-security
audit/ops-actionability
audit/pr-menu-consolidation
audit/status-menu-consolidation
audit/telegram-menu-e2e
audit/telegram-menu-e2e-wave2
chore/actions-node24-runtime
cleanup/remove-diag
design/cloudflare-ops-read
docs/control-plane-2-7-design
docs/guide-v2-1-sync
docs/menu-audit-final-sync
docs/phase2-acceptance-closeout
docs/phase2-multifile-design
feat/bootstrap-worker
feat/cloudflare-ops-read
feat/cp2-multifile-final
feat/cp2-multifile-workspace
feat/cp3-github-write-final
feat/cp4-cloudflare-ops-final
feat/cp5-cicd-control-plane
feat/cp6-incident-manager
feat/cp7-automation-engine
feat/deep-file-browser
feat/final-delivery-16-20
feat/github-advanced-read
feat/in-app-guide-v2
feat/navigation-recovery-ux-v2
feat/ops-console-v2-1
feat/persistent-menu-code-input
feat/phase2-multifile-workspace
feat/phase2-multifile-workspace-v2
feat/plugin-foundation-v1
feat/safe-github-ops
feat/self-register-webhook
feat/studio-g0-foundation
feat/telegram-main-inline-menu
feat/telegram-pr-merge
feat/ux-platform-8-12
feat/v3a-readonly-copilot
feat/workspace-file-upload
feature/mobile-repo-browser
feature/multi-file-change-set
fix/approval-expiry-feedback
fix/callback-resilience-and-docs
fix/ci-actions-pagination
fix/cloudflare-fetch-binding
fix/editor-request-body-cap
fix/editor-safe-file-options
fix/issues-permission-release-empty-ux
fix/main-menu-callback-fallback
fix/phase2-file-editor-selection
fix/phase2-final-ux
fix/phase2-workspace-ref-persistence
fix/production-auto-deploy
fix/provider-write-error-feedback
fix/repository-id-navigation-fallback
fix/repository-pr-navigation
fix/telegram-callback-updates
fix/telegram-runtime-diagnostics
fix/workspace-editor-flow-v2
fix/workspace-recovery-validation
hardening/ci-zero-test-telegram-token
hardening/pr1-destructive-totp
hardening/pr2-kill-switch
main
multifile-workspace
nexa/edit-BwJEIIY3PW
nexa/edit-IPHT8irO7b
nexa/edit-b4Od3BIMYd
p2-multifile
phase2-20261005
phase2-20261005-a
phase2-20261005-b
phase2-20261005-c
phase2-20261005-d
phase2-20261005-e
phase2-20261005-f
phase2-20261005-g
phase2-20261005-h
phase2-20261005-i
phase2-20261005-j
phase2-20261005-k
phase2-20261005-l
phase2-20261005-m
phase2-20261005-n
phase2-20261005-o
phase2-20261005-p
phase2-20261005-q
phase2-20261005-r
phase2-20261005-s
phase2-20261005-t
phase2-20261005-u
phase2-20261005-v
phase2-20261005-w
phase2-20261005-x
phase2-20261005-y
phase2-20261005-z
phase2-acceptance-closeout
phase2-add-file-hotfix
phase2-change-set
phase2-design-20261005
phase2-design-final
phase2-implementation
phase2-multifile-implementation
phase2-multifile-spec
phase2-spec-final
phase2-workspace
phase2/multifile-workspace
plan/nexa-studio-v2-reviewed
security/remove-telegram-setup
spec/repository-workspace-editor
v3a/multifile
work/multifile
| 1 | import { describe, it } from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { readFileSync } from 'node:fs'; |
| 4 | import { GuideMenuManager } from '../src/guide-menu.js'; |
| 5 | import { GuidedNexaDevBot } from '../src/guide-bot.js'; |
| 6 | |
| 7 | const github = { |
| 8 | owner: 'davoodmehraban89', |
| 9 | async listRepositories() { |
| 10 | return []; |
| 11 | }, |
| 12 | async getRepository(repo) { |
| 13 | return { |
| 14 | id: repo, |
| 15 | name: String(repo), |
| 16 | fullName: `davoodmehraban89/${repo}`, |
| 17 | private: true, |
| 18 | defaultBranch: 'main', |
| 19 | archived: false |
| 20 | }; |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | function callbacks(view) { |
| 25 | return (view.reply_markup?.inline_keyboard || []) |
| 26 | .flat() |
| 27 | .map((button) => button.callback_data) |
| 28 | .filter(Boolean); |
| 29 | } |
| 30 | |
| 31 | describe('Nexa Dev Bot - in-app V2.1 guide', () => { |
| 32 | const menu = new GuideMenuManager(github); |
| 33 | |
| 34 | it('exposes Guide from the main inline menu', () => { |
| 35 | const view = menu.getMainMenuView(); |
| 36 | assert.ok(callbacks(view).includes('menu:help')); |
| 37 | assert.ok( |
| 38 | view.reply_markup.inline_keyboard |
| 39 | .flat() |
| 40 | .some((button) => button.text.includes('راهنما')) |
| 41 | ); |
| 42 | }); |
| 43 | |
| 44 | it('guide index and pages identify V2.1 and expose all seven navigable chapters', async () => { |
| 45 | const index = await menu.renderByCallback('menu:help'); |
| 46 | assert.match(index.text, /راهنمای Nexa Dev.*V2\.1/); |
| 47 | const indexCallbacks = callbacks(index); |
| 48 | for (const callback of [ |
| 49 | 'help:1', |
| 50 | 'help:2', |
| 51 | 'help:3', |
| 52 | 'help:4', |
| 53 | 'help:5', |
| 54 | 'help:6', |
| 55 | 'help:7' |
| 56 | ]) { |
| 57 | assert.ok(indexCallbacks.includes(callback), `missing ${callback}`); |
| 58 | } |
| 59 | |
| 60 | const menuHelp = await menu.renderByCallback('help:1'); |
| 61 | for (const label of [ |
| 62 | 'منوی اصلی', |
| 63 | 'پروژهها', |
| 64 | 'وضعیت', |
| 65 | 'ابزارها', |
| 66 | 'پیکربندی', |
| 67 | 'امنیت', |
| 68 | 'راهنما' |
| 69 | ]) { |
| 70 | assert.ok(menuHelp.text.includes(label), `menu guide missing ${label}`); |
| 71 | } |
| 72 | |
| 73 | const repoHelp = await menu.renderByCallback('help:2'); |
| 74 | for (const label of [ |
| 75 | 'فایلها', |
| 76 | 'Pull Request', |
| 77 | 'Commit', |
| 78 | 'جزئیات Commit', |
| 79 | 'CI / Actions', |
| 80 | 'Branches', |
| 81 | 'Issues', |
| 82 | 'Releases', |
| 83 | 'جزئیات Issue', |
| 84 | 'Release notes' |
| 85 | ]) { |
| 86 | assert.ok(repoHelp.text.includes(label), `repo guide missing ${label}`); |
| 87 | } |
| 88 | |
| 89 | const workspaceHelp = await menu.renderByCallback('help:3'); |
| 90 | for (const label of [ |
| 91 | 'Edit', |
| 92 | 'Editor', |
| 93 | 'Mini App', |
| 94 | 'WORKSPACE_STORE', |
| 95 | 'پیام Commit', |
| 96 | 'Diff', |
| 97 | 'آماده Commit', |
| 98 | 'لغو Draft' |
| 99 | ]) { |
| 100 | assert.ok( |
| 101 | workspaceHelp.text.includes(label), |
| 102 | `workspace guide missing ${label}` |
| 103 | ); |
| 104 | } |
| 105 | assert.doesNotMatch(workspaceHelp.text, /Paste متن|بارگذاری فایل/); |
| 106 | assert.match(workspaceHelp.text, /متن منبع.*چت.*ارسال نکنید/); |
| 107 | |
| 108 | const ciHelp = await menu.renderByCallback('help:5'); |
| 109 | for (const label of [ |
| 110 | 'Job', |
| 111 | 'Artifacts', |
| 112 | 'log', |
| 113 | 'اجرای مجدد', |
| 114 | 'لغو Workflow', |
| 115 | 'بروزرسانی', |
| 116 | 'جدیدتر', |
| 117 | 'قدیمیتر' |
| 118 | ]) { |
| 119 | assert.ok(ciHelp.text.includes(label), `CI guide missing ${label}`); |
| 120 | } |
| 121 | }); |
| 122 | |
| 123 | it('documents operational diagnostics, read-only configuration and Security Center controls', async () => { |
| 124 | const menuHelp = await menu.renderByCallback('help:1'); |
| 125 | for (const label of [ |
| 126 | 'خودآزمایی', |
| 127 | 'تست اتصال GitHub', |
| 128 | 'Runtime', |
| 129 | 'Plugin Registry', |
| 130 | 'پیکربندی', |
| 131 | 'فقطخواندنی' |
| 132 | ]) { |
| 133 | assert.ok( |
| 134 | menuHelp.text.includes(label), |
| 135 | `operational guide missing ${label}` |
| 136 | ); |
| 137 | } |
| 138 | |
| 139 | const securityHelp = await menu.renderByCallback('help:6'); |
| 140 | for (const label of [ |
| 141 | 'مرکز امنیت', |
| 142 | 'سیاست عملیات', |
| 143 | 'Safe Approval', |
| 144 | 'Replay', |
| 145 | 'Owner-only' |
| 146 | ]) { |
| 147 | assert.ok( |
| 148 | securityHelp.text.includes(label), |
| 149 | `security guide missing ${label}` |
| 150 | ); |
| 151 | } |
| 152 | }); |
| 153 | |
| 154 | it('documents the complete file-edit flow from project selection through branch-only Safe Approval commit', async () => { |
| 155 | const view = await menu.renderByCallback('help:4'); |
| 156 | const expected = [ |
| 157 | 'پروژهها', |
| 158 | 'فایلها', |
| 159 | 'Edit', |
| 160 | 'Editor', |
| 161 | 'ذخیره Draft', |
| 162 | 'Diff', |
| 163 | 'پیام Commit', |
| 164 | 'آماده Commit', |
| 165 | 'Safe Approval', |
| 166 | 'تأیید و اجرا', |
| 167 | 'nexa/edit-', |
| 168 | 'main' |
| 169 | ]; |
| 170 | for (const item of expected) |
| 171 | assert.ok(view.text.includes(item), `file-edit guide missing ${item}`); |
| 172 | assert.match(view.text, /main.*مستقیم.*تغییر|شاخه.*پیش.?فرض.*تغییر.*نمی/); |
| 173 | }); |
| 174 | |
| 175 | it('documents production, Cloudflare deployment, preview isolation and the public status boundary', async () => { |
| 176 | const view = await menu.renderByCallback('help:7'); |
| 177 | for (const label of [ |
| 178 | 'Production', |
| 179 | 'Cloudflare', |
| 180 | 'Deploy', |
| 181 | 'Preview', |
| 182 | 'Durable Object', |
| 183 | '/status', |
| 184 | 'حداقلی', |
| 185 | 'Observability' |
| 186 | ]) { |
| 187 | assert.ok(view.text.includes(label), `production guide missing ${label}`); |
| 188 | } |
| 189 | assert.match(view.text, /داخل Telegram.*جزئیات|جزئیات.*داخل Telegram/); |
| 190 | }); |
| 191 | |
| 192 | it('keeps every guide page and callback within Telegram limits', async () => { |
| 193 | const encoder = new TextEncoder(); |
| 194 | for (const callback of [ |
| 195 | 'menu:help', |
| 196 | 'help:1', |
| 197 | 'help:2', |
| 198 | 'help:3', |
| 199 | 'help:4', |
| 200 | 'help:5', |
| 201 | 'help:6', |
| 202 | 'help:7' |
| 203 | ]) { |
| 204 | const view = await menu.renderByCallback(callback); |
| 205 | assert.ok( |
| 206 | view.text.length <= 4096, |
| 207 | `${callback} exceeds Telegram message limit` |
| 208 | ); |
| 209 | for (const value of callbacks(view)) { |
| 210 | assert.ok( |
| 211 | encoder.encode(value).length <= 64, |
| 212 | `${value} exceeds Telegram callback limit` |
| 213 | ); |
| 214 | } |
| 215 | } |
| 216 | }); |
| 217 | |
| 218 | it('opens Studio from start while preserving old Guide text navigation', async () => { |
| 219 | const bot = new GuidedNexaDevBot({ OWNER_TELEGRAM_ID: '1' }); |
| 220 | const sent = []; |
| 221 | bot.telegram.sendMessage = async (chatId, text, replyMarkup) => { |
| 222 | sent.push({ chatId, text, replyMarkup }); |
| 223 | return { ok: true }; |
| 224 | }; |
| 225 | bot.telegram.setChatMenuButton = async () => ({ ok: true }); |
| 226 | |
| 227 | await bot.handleMessage({ |
| 228 | chat: { id: 1, type: 'private' }, |
| 229 | from: { id: 1 }, |
| 230 | text: '/start' |
| 231 | }); |
| 232 | assert.deepEqual(sent[0].replyMarkup, { remove_keyboard: true }); |
| 233 | assert.deepEqual(sent[1].replyMarkup, { |
| 234 | inline_keyboard: [ |
| 235 | [ |
| 236 | { |
| 237 | text: 'باز کردن Nexa Studio', |
| 238 | web_app: { |
| 239 | url: 'https://nexa-dev-bot.davoodmehraban89.workers.dev/studio/' |
| 240 | } |
| 241 | } |
| 242 | ] |
| 243 | ] |
| 244 | }); |
| 245 | |
| 246 | sent.length = 0; |
| 247 | await bot.handleMessage({ |
| 248 | chat: { id: 1 }, |
| 249 | from: { id: 1 }, |
| 250 | text: '📘 راهنما' |
| 251 | }); |
| 252 | assert.match(sent[0].text, /راهنمای Nexa Dev.*V2\.1/); |
| 253 | }); |
| 254 | |
| 255 | it('keeps README aligned with the deployed V2.1 architecture', () => { |
| 256 | const readme = readFileSync( |
| 257 | new URL('../README.md', import.meta.url), |
| 258 | 'utf8' |
| 259 | ); |
| 260 | for (const label of [ |
| 261 | 'Workspace Editor', |
| 262 | 'WORKSPACE_STORE', |
| 263 | 'APPROVAL_REPLAY_GUARD', |
| 264 | 'Ops Console', |
| 265 | 'پیکربندی', |
| 266 | 'Worker Preview', |
| 267 | 'Mini App', |
| 268 | '/status' |
| 269 | ]) { |
| 270 | assert.ok(readme.includes(label), `README missing ${label}`); |
| 271 | } |
| 272 | assert.doesNotMatch(readme, /ناوبری callback بهصورت stateless/); |
| 273 | }); |
| 274 | }); |