Personal Telegram developer console for GitHub
feat/deep-file-browser
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 | # PROJECT_MEMORY.md |
| 2 | |
| 3 | ## Project Identity |
| 4 | - Name: Nexa Dev Bot |
| 5 | - Repository: `davoodmehraban89/nexa-dev-bot` |
| 6 | - Canonical branch: `main` |
| 7 | - Visibility: private |
| 8 | - Purpose: owner-only Telegram developer console for GitHub visibility and controlled developer operations. |
| 9 | - This file is the continuity source of truth; live repository/runtime evidence overrides stale text. |
| 10 | |
| 11 | ## AI Handoff Protocol |
| 12 | 1. Read this file before changes. |
| 13 | 2. Verify repository head, recent commits, CI and relevant runtime evidence. |
| 14 | 3. Prefer live evidence over chat memory. |
| 15 | 4. Keep durable checkpoints documented here. |
| 16 | 5. Never store secrets, tokens or private keys in the repository. |
| 17 | |
| 18 | ## Architecture |
| 19 | - `src/index.js` — Cloudflare Worker HTTP boundary; webhook secret, owner authorization and required Telegram transport checks. |
| 20 | - `src/bot.js` — Telegram update/callback router. |
| 21 | - `src/telegram.js` — Telegram Bot API client; explicit error propagation and fail-closed token handling. |
| 22 | - `src/github.js` — authenticated GitHub REST reader; explicit errors, numeric repository-id resolution, tree/blob access. |
| 23 | - `src/menu.js` — hierarchical inline menus, one-message editing, repository/file browser. |
| 24 | - `src/config.js` — non-secret static config. |
| 25 | - `.github/workflows/ci.yml` — Node 22 CI with non-zero test-discovery guard. |
| 26 | - `test/` — security, worker, navigation, menu, GitHub and Telegram regression coverage. |
| 27 | |
| 28 | ## Runtime Configuration |
| 29 | Required names: |
| 30 | - `TELEGRAM_BOT_TOKEN` |
| 31 | - `TELEGRAM_WEBHOOK_SECRET` |
| 32 | - `OWNER_TELEGRAM_ID` |
| 33 | - `GITHUB_TOKEN` |
| 34 | - optional `GITHUB_OWNER` |
| 35 | |
| 36 | ## Verified Security / Data Trust |
| 37 | - Webhook only at `POST /telegram/webhook`. |
| 38 | - Missing webhook secret, owner ID or bot token fails closed. |
| 39 | - Wrong Telegram secret returns 403. |
| 40 | - Non-owner updates are ignored before private-data access. |
| 41 | - GitHub token absence and GitHub API failures are explicit errors; no fabricated fallback data. |
| 42 | - Telegram network/API failures propagate; fake transport success is prohibited. |
| 43 | - Temporary setup/diagnostic exposure is disabled. |
| 44 | - Operational UI does not invent SLA, latency or external health claims. |
| 45 | |
| 46 | ## Telegram UX |
| 47 | - `/start` creates the initial menu message. |
| 48 | - Callback navigation uses `editMessageText` on the same Telegram message. |
| 49 | - Main sections: Repositories, Status, Tools, Settings, Security. |
| 50 | - Repository sections: Files, Pull Requests, Commits, Actions status, Back. |
| 51 | - Back navigation and breadcrumb-style text exist. |
| 52 | |
| 53 | ## Deep File Browser — 2026-10-02 |
| 54 | Branch/PR checkpoint: |
| 55 | - Branch: `feat/deep-file-browser` |
| 56 | - PR: `#8` |
| 57 | - Red test commit: `f5a1a75180344b306c000b3db580cd55c06abc67` |
| 58 | - Implementation head before this docs commit: `7a81ca8adf2594b2478b0c9d8f7d308ec6121ba8` |
| 59 | - PR CI run: `37055098355` |
| 60 | - Exact result: `29` tests, `29` passed, `0` failed, `0` skipped/cancelled. |
| 61 | |
| 62 | Implemented: |
| 63 | - Repository menu callbacks now use numeric GitHub repository IDs returned by `/user/repos`. |
| 64 | - Numeric IDs keep callback payloads short and allow repositories outside the configured default owner to resolve correctly. |
| 65 | - Legacy name-based repository references remain supported. |
| 66 | - Folder navigation uses Git tree SHA callbacks: `tree:<repoId>:<sha>`. |
| 67 | - File preview uses Git blob SHA callbacks: `blob:<repoId>:<sha>`. |
| 68 | - Tree/blob SHA input is validated as 40-char hexadecimal. |
| 69 | - File/folder navigation remains in the same Telegram message. |
| 70 | - File previews are HTML-escaped; oversized/non-base64 blobs are not rendered directly. |
| 71 | - Directory views cap interactive entries at 30 and disclose omitted counts. |
| 72 | - Root/project return buttons are always provided. |
| 73 | |
| 74 | TDD evidence: |
| 75 | - New tests were committed first and CI failed with 4 expected navigation failures (`29 total / 25 pass / 4 fail`). |
| 76 | - Implementation then changed `src/github.js` and `src/menu.js`. |
| 77 | - Re-run CI passed `29/29`. |
| 78 | |
| 79 | ## Current Work / Last Checkpoint |
| 80 | WHERE WE ARE: |
| 81 | - Deep interactive file/folder browsing is implemented and automated-test verified on PR #8. |
| 82 | - PR #8 still requires the final docs-triggered CI re-run and merge to `main`. |
| 83 | - Live Cloudflare verification remains blocked from the current execution environment by DNS resolution failure for the workers.dev hostname. |
| 84 | - Real Telegram mobile smoke is still NOT VERIFIED. |
| 85 | |
| 86 | WHAT REMAINS: |
| 87 | 1. Verify CI for this documentation commit and merge PR #8 into `main` only if green. |
| 88 | 2. Verify post-merge CI on `main`. |
| 89 | 3. Verify the live Cloudflare root/health/status endpoints from an environment that can resolve the workers.dev hostname. |
| 90 | 4. Owner-device Telegram smoke: `/start → Repositories → repository → Files → folder → file preview → root → project → Commits/PR/Status → Back → Main`. |
| 91 | 5. Confirm callbacks create no extra bot messages. |
| 92 | 6. Confirm a non-owner Telegram account receives no private bot response. |
| 93 | |
| 94 | ## Acceptance Rules |
| 95 | A checkpoint is complete only after: |
| 96 | `IMPLEMENTED → VERIFIED → FIXED IF NEEDED → RE-VERIFIED` |
| 97 | Minimum automated gates: |
| 98 | - Non-zero discovered test files. |
| 99 | - Security tests green. |
| 100 | - Navigation/bot/menu/index tests green. |
| 101 | - GitHub fail-closed/data-trust tests green. |
| 102 | - Telegram missing-token/API-error tests green. |
| 103 | |
| 104 | ## Known Gaps / Technical Debt |
| 105 | - Live Cloudflare deployment content is not verified in this environment. |
| 106 | - Real mobile Telegram smoke is not verified yet. |
| 107 | - GitHub Actions emits a Node-20-runtime deprecation warning for `actions/checkout@v4` and `actions/setup-node@v4`; current CI still passes, but action upgrades should be handled in a separate verified slice. |
| 108 | - Persistent navigation/session storage is not required for current stateless callback flow. |
| 109 | |
| 110 | ## Project Boundaries |
| 111 | - Nexa Dev Bot is independent from Finora / Factor-easy and has no Supabase requirement in this project. |
| 112 | - Do not mix state or migrations from other projects. |
| 113 | - Keep secrets out of code, logs and documentation. |
| 114 | |
| 115 | ## Important Paths |
| 116 | - `PROJECT_MEMORY.md` |
| 117 | - `src/index.js` |
| 118 | - `src/bot.js` |
| 119 | - `src/menu.js` |
| 120 | - `src/telegram.js` |
| 121 | - `src/github.js` |
| 122 | - `src/config.js` |
| 123 | - `test/security.test.js` |
| 124 | - `test/navigation.test.js` |
| 125 | - `test/bot.test.js` |
| 126 | - `test/menu.test.js` |
| 127 | - `test/index.test.js` |
| 128 | - `test/github.test.js` |
| 129 | - `test/telegram.test.js` |
| 130 | - `.github/workflows/ci.yml` |
| 131 | - `wrangler.jsonc` |
| 132 | |
| 133 | ## Next Executable Action |
| 134 | Wait for the PR #8 CI run for this docs commit; if green, merge to `main`, verify `main` CI, then continue to live/mobile validation or the next independent hardening slice. |