Personal Telegram developer console for GitHub

docs: reconcile project memory with uploaded menu redesign

davoodmehraban89 committed Oct 2, 2026 at 22:05 UTC 9edf2bea491c7d3064641528331c50e43e14a582
1 file changed +177 -89
PROJECT_MEMORY.md
+177 -89
@@ -2,148 +2,236 @@
2
3 ## Project Identity
4 - Name: Nexa Dev Bot
5 -- Repository: davoodmehraban89/nexa-dev-bot
6 -- Purpose: Telegram-based development assistant for GitHub repository management.
7 -- Memory status: Created as Single Source of Truth for future AI handoff.
5 +- Repository: `davoodmehraban89/nexa-dev-bot`
6 +- Canonical branch: `main`
7 +- Visibility: private
8 +- Purpose: personal Telegram developer console for GitHub repository visibility and operations.
9 +- This file is the Single Source of Truth for AI continuity. Repository/runtime evidence overrides stale text here.
10
11 ## AI HANDOFF PROTOCOL
12 1. Read this file completely before making changes.
11 -2. Verify the real repository state, runtime evidence, integrations and deployments.
12 -3. Prefer repository evidence over stale memory or previous claims.
13 -4. Update this file when memory becomes stale.
14 -5. Continue from Last Checkpoint only after verification.
15 -6. After every checkpoint, update this file with real evidence.
13 +2. Verify the real repository head, recent commits, CI, source and runtime evidence.
14 +3. Prefer repository/runtime evidence over previous chat claims or stale memory.
15 +4. If this file is stale, repair it before implementation.
16 +5. Continue from `Current Work / Last Checkpoint`.
17 +6. After each durable checkpoint, update this file with evidence and remaining work.
18 +7. Never store passwords, tokens, API secrets, webhook secrets or private keys here.
19
20 ## Product Vision
18 -Create a professional Telegram interface for secure development operations, GitHub visibility and future automation workflows.
21 +Build a secure, professional, mobile-first Telegram control surface for GitHub projects with clean hierarchical navigation, minimal chat clutter, trustworthy live data, auditability and later developer automation.
22
23 ## Repository / Workspace
21 -- Repository: davoodmehraban89/nexa-dev-bot
22 -- Default branch: main
23 -- Visibility: private
24 -- Current verified access: repository read/write available through GitHub integration.
24 +- Repository: `davoodmehraban89/nexa-dev-bot`
25 +- Default branch: `main`
26 +- Verified GitHub integration permissions available to the connected tool: admin/read/write.
27 +- Verified main head at reconciliation: `2f55a22d9ca8c9dfec42ce7021ccc355bad49b92` (`Add files via upload`, 2026-10-02).
28 +- Existing feature branch `feat/telegram-main-inline-menu` is behind main by 6 commits and no longer represents the newest implementation baseline.
29
30 ## Architecture
27 -Verified current architecture:
28 -- Telegram Bot API webhook
29 -- Cloudflare Worker style runtime (source indicates Worker fetch handler)
30 -- GitHub API integration
31 -- Environment secrets/configuration outside this file
31 +Verified current source layout on `main`:
32 +- `src/index.js` — Cloudflare Worker entrypoint / HTTP handler.
33 +- `src/bot.js` — Telegram update router and callback handling.
34 +- `src/telegram.js` — Telegram Bot API client.
35 +- `src/github.js` — GitHub API reader with fallback data.
36 +- `src/menu.js` — hierarchical inline-menu renderer and callback router.
37 +- `src/config.js` — static default repositories/service/security display configuration.
38 +- `.github/workflows/ci.yml` — Node CI.
39 +- `test/` — test files, including security and navigation regression tests.
40
41 ## Technology Stack
34 -- JavaScript
42 +- JavaScript ES modules
43 +- Node.js test runner
44 - Telegram Bot API
45 - GitHub REST API
37 -- Cloudflare Worker runtime pattern
46 +- Cloudflare Workers / Wrangler
47 +- GitHub Actions
48
49 ## Environments & Integrations
40 -Verified:
41 -- GitHub repository connection: available
42 -- Telegram integration code exists
43 -Not verified in this memory creation:
44 -- Production deployment state
45 -- Cloudflare deployment state
46 -- Runtime monitoring
47 -- External secret values
50 +Verified in repository:
51 +- Cloudflare Worker configuration exists in `wrangler.jsonc`, main entry `src/index.js`, `workers_dev: true`, observability enabled.
52 +- Telegram Bot API integration exists.
53 +- GitHub API integration exists.
54 +- CI workflow exists.
55 +Not verified in this reconciliation:
56 +- Current live Cloudflare deployment contents.
57 +- Current live Telegram webhook configuration.
58 +- Current production secret values.
59
60 ## Current Production State
50 -Unknown. Must be verified from deployment/runtime evidence before claiming production readiness.
51 -
52 -## Completed Work (Verified)
53 -- Repository inspection completed.
54 -- Existing Telegram webhook architecture identified.
55 -- Existing GitHub repository browsing, commits and pull request reading flows were previously tested through Telegram according to conversation evidence.
56 -- Continuity memory file created.
57 -
58 -## Unverified / Planned
59 -- New persistent Telegram menu implementation.
60 -- editMessageText navigation architecture.
61 -- PR creation for menu redesign.
62 -- Automated tests.
61 +**NOT VERIFIED.** Do not infer live deployment correctness from repository contents or CI alone.
62 +
63 +## Completed Work (Repository-Verified)
64 +- Continuity system exists.
65 +- Current `main` contains a modular redesign (`bot.js`, `menu.js`, `telegram.js`, `github.js`, `config.js`).
66 +- Inline hierarchical menu views exist for main menu, repositories, repo detail, files, commits, pull requests, service status, tools, settings and security.
67 +- Callback handling uses Telegram `editMessageText` for in-place menu navigation.
68 +- Main menu includes Repositories, Status, Tools, Settings and Security.
69 +- Breadcrumb-style path text and explicit back buttons are present.
70 +- Latest GitHub Actions run inspected: run `37047035443` for head `2f55a22...` concluded `success`.
71 +
72 +## Critical Verification Finding
73 +The latest CI success is **not a valid test pass**. `package.json` runs:
74 +`node --test tests/*.test.js`
75 +while the repository test directory is `test/` (singular). GitHub Actions run `37047035443` therefore executed **0 tests** (`# tests 0`, `# pass 0`, `# fail 0`) and still exited successfully.
76 +
77 +## Security Regression — VERIFIED BY SOURCE INSPECTION
78 +The modular uploaded implementation on current `main` removed security boundaries present in the older worker implementation/tests:
79 +- `src/index.js` currently accepts POST requests without validating `X-Telegram-Bot-Api-Secret-Token`.
80 +- `src/index.js` does not restrict POST handling to `/telegram/webhook`.
81 +- `src/bot.js` currently does not enforce `OWNER_TELEGRAM_ID` before handling messages/callbacks.
82 +- Existing `test/security.test.js` explicitly expects fail-closed webhook secret validation and owner-only behavior, but those tests are currently not executed because of the CI path bug.
83 +
84 +Status: **BLOCKING — NOT SAFE TO CALL PRODUCTION-READY.**
85 +
86 +## Data-Trust / Correctness Findings
87 +Current `src/github.js` silently falls back to static/default data when GitHub calls fail. This can make unavailable or failed integrations look successful and conflicts with the project requirement to never present fabricated/demo data as live operational truth.
88 +Current `src/config.js` contains static status claims such as `100% SLA`, connected/operational services and security state; these are display defaults, not verified runtime telemetry.
89 +The Tools view includes hard-coded success outputs (for example a fixed ping latency) rather than measured operations.
90 +Status: **IMPLEMENTED UI, NOT TRUSTWORTHY RUNTIME TELEMETRY YET.**
91 +
92 +## UX/UI State
93 +Implemented direction on current main:
94 +- hierarchical inline keyboards;
95 +- one-message in-place callback navigation after the initial message;
96 +- parent back buttons;
97 +- breadcrumbs.
98 +Important gap relative to owner preference:
99 +- this is an Inline Keyboard design attached to messages, not a persistent Telegram Reply Keyboard replacing the phone keyboard.
100 +- `/start`, `/repos`, `/status` still create a new message because they are command entry points; navigation after callback uses message editing.
101 +
102 +## GitHub Reader State
103 +Repository code includes views/services for:
104 +- repositories;
105 +- files;
106 +- commits;
107 +- pull requests;
108 +- workflow/status.
109 +Previously observed Telegram tests from the owner confirmed repository/files/commits/PR/status reading before the uploaded redesign.
110 +**Regression of those live flows after the new uploaded architecture is NOT VERIFIED.**
111
112 ## Current Work / Last Checkpoint
65 -Checkpoint: Telegram UX redesign.
66 -
113 WHERE WE WERE:
68 -Existing implementation uses multiple sendMessage calls for navigation.
114 +- Owner requested Nexa Dev UX redesign to hierarchical menus, back navigation and reduced message spam.
115
116 WHAT CHANGED:
71 -Continuity system added.
117 +- Three `Add files via upload` commits (`65a8fbec...`, `453c0ddf...`, `2f55a22d...`) placed a modular menu redesign directly on `main`.
118 +- `src/index.js` is now only the Worker entrypoint and imports `NexaDevBot`; the old monolithic implementation is no longer the main source shape.
119
120 WHERE WE ARE NOW:
74 -Memory baseline created. Menu redesign not implemented.
121 +- Menu redesign is materially present in source.
122 +- CI is false-green because zero tests run.
123 +- Critical webhook/owner security checks are missing from current main implementation.
124 +- Runtime/mobile behavior after this redesign is NOT VERIFIED.
125
126 WHAT REMAINS:
77 -Refactor navigation to one-message inline menu flow.
127 +1. Restore fail-closed Telegram webhook secret validation and owner-only authorization without breaking modular navigation.
128 +2. Restrict webhook processing to the intended endpoint.
129 +3. Fix `package.json` test glob from `tests/*.test.js` to `test/*.test.js` (or equivalent reliable test discovery).
130 +4. Run the real security/navigation/bot/menu/index tests; fix failures and re-run.
131 +5. Remove or clearly label mock/static fallback data; failures must not masquerade as verified live GitHub/service state.
132 +6. Re-verify `/start → Repos → Repo → Files/Commits/PR/Status → Back` on the real Telegram bot/mobile runtime.
133 +7. Decide whether the final main menu should remain Inline Keyboard or move to the owner's preferred persistent Reply Keyboard shell.
134
135 ## Master Roadmap
80 -Phase 1: Stable Telegram navigation core.
81 -Phase 2: Repository submenu and state management.
82 -Phase 3: Development tools and operations.
83 -Phase 4: Security hardening and auditability.
84 -Phase 5: QA, release validation and documentation.
136 +Phase 1 — Secure Telegram navigation core.
137 +Phase 2 — Trustworthy GitHub repository browsing and status telemetry.
138 +Phase 3 — Developer tools and controlled operations.
139 +Phase 4 — Security hardening, auditability and observability.
140 +Phase 5 — Mobile QA, release validation and documentation.
141
142 ## Requirements
87 -- Avoid message spam during navigation.
88 -- Prefer single editable menu messages.
89 -- Maintain secure secret handling.
90 -- Preserve auditability.
143 +- Owner-only personal bot.
144 +- Fail closed if webhook authentication configuration is missing or wrong.
145 +- No secret values committed to repository.
146 +- No fabricated operational success/status.
147 +- Minimal chat spam.
148 +- Hierarchical navigation with reliable Back behavior.
149 +- Preserve working GitHub Reader flows.
150 +- Mobile-first Telegram usability.
151 +- Completion claims require implemented + tested + re-verified evidence.
152
153 ## User Decisions
93 -- Prefer professional multi-level Telegram menus.
94 -- Prefer execution based workflow over conversational explanations.
95 -- Require verification before claiming completion.
154 +- Nexa Dev Bot is independent from Finora / Factor-easy application development; do not mix project state or Supabase requirements from those projects into this repository.
155 +- GitHub repository: `davoodmehraban89/nexa-dev-bot`.
156 +- Professional layered menus are desired.
157 +- User strongly prefers execution over explanatory chat.
158 +- User requires verification from execution, architecture/quality and QA/user perspectives before saying work is complete.
159
160 ## Architecture Decisions
98 -- PROJECT_MEMORY.md is the primary continuity document.
99 -- Credentials must never be stored here.
100 -
101 -## UX/UI Decisions
102 -Approved direction:
103 -- Hierarchical Telegram navigation.
104 -- Main menu concepts: Repos, Status, Tools, Settings.
105 -- Use editable menu messages where technically appropriate.
161 +- `PROJECT_MEMORY.md` is the canonical continuity file for this project.
162 +- Modular source files are now the current main architecture; do not revert to the old monolithic file merely because an older branch contains it.
163 +- Security enforcement belongs at the Worker/update boundary and must not rely on display-only configuration.
164 +- Runtime failures must be explicit rather than silently replaced with plausible mock data.
165
166 ## Data Model
108 -No persistent application database model verified yet.
167 +No persistent application database is verified or required for the current menu/read-only GitHub scope.
168
169 ## Security Rules
111 -- Never store tokens, passwords or secrets in repository memory files.
112 -- Verify permissions before sensitive operations.
170 +- Never store Telegram bot token, GitHub token, webhook secret or credentials in committed files.
171 +- Validate Telegram webhook secret before parsing/processing privileged updates.
172 +- Enforce `OWNER_TELEGRAM_ID` for both message and callback flows.
173 +- Unauthorized callers must not receive private repository data.
174 +- Temporary diagnostic/setup endpoints must remain disabled unless explicitly reintroduced for a bounded setup operation and removed afterward.
175
176 ## Testing & Acceptance Criteria
177 Completed means:
116 -IMPLEMENTED → VERIFIED → FIXED IF NEEDED → RE-VERIFIED
117 -
118 -Required future verification:
119 -- Telegram user flow test.
120 -- Runtime test.
121 -- Regression test for existing GitHub operations.
178 +`IMPLEMENTED → VERIFIED → FIXED IF NEEDED → RE-VERIFIED`
179 +Required minimum gates for the navigation/security slice:
180 +- CI must execute a non-zero test count.
181 +- Security tests pass.
182 +- Navigation tests pass.
183 +- Bot/menu/index tests pass.
184 +- Live Telegram mobile smoke confirms one-message callback navigation and working Back path.
185 +- GitHub read paths return real data or explicit errors; no silent fake success.
186
187 ## Known Issues
124 -- Current navigation sends separate messages instead of editing one menu message.
125 -- State management for nested menus is not implemented.
188 +- CI run `37047035443` is false-green with 0 tests because of the wrong test directory glob.
189 +- Current main lacks webhook-secret validation.
190 +- Current main lacks owner authorization enforcement.
191 +- Static/mock fallback data can be presented as if live.
192 +- Several service/security/ping status strings are hard-coded and not runtime measurements.
193 +- Live Cloudflare/Telegram state after the uploaded redesign is not verified.
194 +
195 +## Risks
196 +- Unauthorized Telegram user could exercise bot flows if current main is deployed as-is.
197 +- A forged POST to the Worker could be processed because the webhook secret is not checked.
198 +- False-green CI can allow regressions to reach main.
199 +- Mock fallback data can mislead operational decisions.
200
201 ## Technical Debt
128 -- Add automated tests.
129 -- Add structured state handling.
130 -- Improve deployment documentation.
202 +- Correct test discovery and add a non-zero-test assertion/gate.
203 +- Make Telegram API client throw/propagate API `ok:false` failures instead of treating JSON responses as success by default.
204 +- Replace hard-coded service telemetry with measured/unknown states.
205 +- Add robust HTML escaping for GitHub-derived titles/names displayed with Telegram HTML parse mode.
206 +- Add folder/file navigation buttons if full tree browsing is required; current files view primarily renders a textual listing with refresh/back controls.
207
208 ## Deployment / Release State
133 -Not verified.
209 +- GitHub Actions CI exists and latest inspected run is green but invalid as a quality gate due to 0 executed tests.
210 +- Cloudflare live deployment: NOT VERIFIED in this reconciliation.
211
212 ## Important File Paths
136 -- Source entry: src/index.js
137 -- Main memory: PROJECT_MEMORY.md
138 -- Future documentation: docs/project-memory/
139 -- Future assets: docs/project-memory/assets/
213 +- `PROJECT_MEMORY.md`
214 +- `src/index.js`
215 +- `src/bot.js`
216 +- `src/menu.js`
217 +- `src/telegram.js`
218 +- `src/github.js`
219 +- `src/config.js`
220 +- `test/security.test.js`
221 +- `test/navigation.test.js`
222 +- `test/bot.test.js`
223 +- `test/menu.test.js`
224 +- `test/index.test.js`
225 +- `.github/workflows/ci.yml`
226 +- `wrangler.jsonc`
227
228 ## Reference Assets
142 -No project design assets were available for repository storage at memory creation time.
229 +No canonical UI image asset for Nexa Dev Bot is currently verified in `docs/project-memory/assets/`.
230 Status: Missing Asset.
231
232 ## Change Log
146 -- Initial PROJECT_MEMORY.md created.
233 +- 2026-10-02: Initial continuity memory created.
234 +- 2026-10-02: Reconciled memory after modular menu redesign uploads. Recorded current architecture, false-green zero-test CI, verified source-level security regressions, data-trust issues and exact repair sequence.
235
236 ## Next Executable Action
149 -Inspect current source files and implement Telegram menu refactor only after confirming full code context.
237 +Create a bounded security/CI repair slice from current `main`: restore webhook secret + owner authorization, fix test discovery, run the real test suite, fix regressions, re-run, then verify the live Telegram mobile menu flow before declaring the redesign complete.