Personal Telegram developer console for GitHub

fix/telegram-runtime-diagnostics
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
md 149 lines 7.95 KB
Rendered Raw
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 project test runtime, official GitHub Actions on Node-24-based v7 releases, non-zero test-discovery guard.
26 - `.github/workflows/deploy.yml` — production Cloudflare Worker deploy after successful CI on `main`; deploys the exact verified commit.
27 - `test/` — security, worker, navigation, menu, GitHub and Telegram regression coverage.
28
29 ## Runtime Configuration
30 Worker runtime names:
31 - `TELEGRAM_BOT_TOKEN`
32 - `TELEGRAM_WEBHOOK_SECRET`
33 - `OWNER_TELEGRAM_ID`
34 - `GITHUB_TOKEN`
35 - optional `GITHUB_OWNER`
36
37 GitHub Actions deployment secrets:
38 - `CLOUDFLARE_API_TOKEN`
39 - `CLOUDFLARE_ACCOUNT_ID`
40
41 ## Verified Security / Data Trust
42 - Webhook only at `POST /telegram/webhook`.
43 - Missing webhook secret, owner ID or bot token fails closed.
44 - Wrong Telegram secret returns 403.
45 - Non-owner updates are ignored before private-data access.
46 - GitHub token absence and GitHub API failures are explicit errors; no fabricated fallback data.
47 - Telegram network/API failures propagate; fake transport success is prohibited.
48 - Temporary setup/diagnostic exposure is disabled in source/tests.
49 - Operational UI does not invent SLA, latency or external health claims.
50
51 ## Telegram UX / GitHub Reader
52 - `/start` creates the initial menu message.
53 - Callback navigation uses `editMessageText` on the same Telegram message.
54 - Main sections: Repositories, Status, Tools, Settings, Security.
55 - Repository sections: Files, Pull Requests, Commits, Actions status, Back.
56 - Back navigation and breadcrumb-style text exist.
57 - Repository callbacks use numeric GitHub repository IDs.
58 - Folder navigation uses `tree:<repoId>:<sha>` and file previews use `blob:<repoId>:<sha>`.
59 - Tree/blob SHA input is validated.
60 - File previews are HTML-escaped and bounded; oversized/non-base64 blobs are not rendered directly.
61 - Directory interactive entries are capped at 30 and omitted counts are disclosed.
62
63 ## Deep File Browser — Verified/Merged 2026-10-02
64 - PR `#8` merged to `main` at commit `b2a2b61ffb92dc14508e16a19c6221a805445c76`.
65 - Regression-first RED evidence: 29 tests / 25 pass / 4 expected fail before implementation.
66 - PR green CI: run `37055283770` = 29/29 pass.
67 - Post-merge `main` CI: run `37055466988` = 29/29 pass.
68 - Deep folder/file browsing remains single-message navigation.
69
70 ## GitHub Actions Runtime Upgrade — Verified/Merged 2026-10-02
71 - PR `#9` merged to `main` at commit `7574fb1a373c3ab7b81f3f6857452059287cd44e`.
72 - `actions/checkout` upgraded from v4 to v7.
73 - `actions/setup-node` upgraded from v4 to v7.
74 - Project test runtime remains Node 22.
75 - `package-manager-cache: false` preserves prior no-cache behavior.
76 - PR code CI run `37055691513` = 29/29 pass.
77 - PR documentation-head CI run `37055861886` = 29/29 pass.
78 - Post-merge `main` CI run `37056086860` = 29/29 pass.
79 - The prior GitHub Actions Node-20-runtime deprecation warning is absent from the verified PR and post-merge runs.
80
81 ## Production Deploy Automation — Verified 2026-10-02
82 - Real Telegram screenshot first exposed a stale/unresponsive production Worker relative to current source.
83 - Root cause in repository: CI had no Cloudflare deploy step, so green/merged `main` did not guarantee Worker deployment.
84 - PR `#10` added `.github/workflows/deploy.yml` and was fast-forwarded to `main` at commit `c86b86ec8f5678b9223b7bcb6a73e0377116e670`.
85 - PR CI run `37057306685` passed.
86 - Post-merge `main` CI run `37057386587` passed.
87 - Initial deployment workflow run `37057406559` failed before deploy because GitHub Actions Cloudflare credentials were absent.
88 - Repository secrets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` were then configured by the owner.
89 - Failed jobs for workflow run `37057406559` were re-run; credential preflight passed and the Cloudflare deploy step completed successfully.
90 - Cloudflare API verification after the successful deploy shows latest deployment `b2f47b95-277f-423b-aab5-1d7020e60501`, created `2026-10-02T20:45:26.729642Z`.
91 - Latest active Worker version is `51`, version id `dc70c38f-d84e-40f5-8db1-8ae909dae6d7`, receiving 100% of traffic.
92 - Worker subdomain remains enabled. Direct public HTTP probing of the workers.dev hostname from the assistant web environment is unavailable, so Telegram/mobile smoke remains the final runtime acceptance gate.
93
94 ## Current Work / Last Checkpoint
95 WHERE WE ARE:
96 - Source, tests, security gates, one-message navigation, deep file browsing and CI are green on `main`.
97 - Production deploy automation exists and has successfully deployed through GitHub Actions using repository secrets.
98 - Cloudflare confirms Worker version 51 is active at 100% traffic.
99 - Real Telegram mobile smoke after this successful deployment is still NOT VERIFIED.
100
101 WHAT REMAINS:
102 1. Repeat owner-device Telegram smoke on the freshly deployed Worker: `/start → Repositories → repository → Files → folder → file preview → root → project → Commits/PR/Status → Back → Main`.
103 2. Confirm callbacks edit the same Telegram message and create no extra bot-message flood.
104 3. Confirm `/start` returns the new main menu instead of the stale repository-button view.
105 4. Confirm a non-owner Telegram account receives no private bot response.
106 5. If desired later, tighten the Cloudflare CI token scope from the official `Edit Cloudflare Workers` template to a least-privilege Worker-scoped token.
107
108 ## Acceptance Rules
109 A checkpoint is complete only after:
110 `IMPLEMENTED → VERIFIED → FIXED IF NEEDED → RE-VERIFIED`
111 Minimum automated gates:
112 - Non-zero discovered test files.
113 - Security tests green.
114 - Navigation/bot/menu/index tests green.
115 - GitHub fail-closed/data-trust tests green.
116 - Telegram missing-token/API-error tests green.
117 - Production deploy workflow green before live behavior is called verified.
118
119 ## Known Gaps / Technical Debt
120 - Real mobile Telegram smoke must be repeated after successful production deploy.
121 - Direct workers.dev health probing is unavailable from the current assistant web environment; Cloudflare control-plane deployment state is verified instead.
122 - Persistent navigation/session storage is not required for the current stateless callback flow.
123
124 ## Project Boundaries
125 - Nexa Dev Bot is independent from Finora / Factor-easy and has no Supabase requirement in this project.
126 - Do not mix state or migrations from other projects.
127 - Keep secrets out of code, logs and documentation.
128
129 ## Important Paths
130 - `PROJECT_MEMORY.md`
131 - `src/index.js`
132 - `src/bot.js`
133 - `src/menu.js`
134 - `src/telegram.js`
135 - `src/github.js`
136 - `src/config.js`
137 - `test/security.test.js`
138 - `test/navigation.test.js`
139 - `test/bot.test.js`
140 - `test/menu.test.js`
141 - `test/index.test.js`
142 - `test/github.test.js`
143 - `test/telegram.test.js`
144 - `.github/workflows/ci.yml`
145 - `.github/workflows/deploy.yml`
146 - `wrangler.jsonc`
147
148 ## Next Executable Action
149 Run `/start` on the owner Telegram account and complete the mobile navigation smoke against the freshly deployed Worker version 51.