Personal Telegram developer console for GitHub

feat/persistent-menu-code-input
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 120 lines 5.76 KB
Rendered Raw
1 # Nexa Dev Bot Plugin Foundation v1 Implementation Plan
2
3 > **Execution method:** superpowers `executing-plans` + TDD, on branch `feat/plugin-foundation-v1` and PR #14.
4
5 **Goal:** Introduce a small plugin kernel with explicit action risk policy and redacted auditing, then route existing GitHub behavior through a GitHub plugin without changing Telegram UX.
6
7 **Architecture:** Focused core modules provide registry, policy, audit, and routing. The existing `GitHubService` and `MenuManager` remain the provider/data/view implementation; the GitHub plugin is an adapter around those existing capabilities.
8
9 **Spec:** `docs/superpowers/specs/2026-10-03-nexa-plugin-foundation-design.md`
10
11 ## Global Constraints
12
13 - Bot remains owner-only.
14 - No secret, token, authorization header, or private key may appear in audit output, repository files, or Telegram output.
15 - Existing callback navigation continues to edit the same Telegram message.
16 - Missing credentials fail closed.
17 - Every declared plugin action must pass central policy evaluation before provider/view execution.
18 - `WRITE` and `DESTRUCTIVE` actions are never auto-executed in Foundation v1.
19 - Worker remains stateless.
20 - AI, Browser QA, Supabase, Sentry, Linear, Notion, Mini App, and full Cloudflare operator integrations are out of scope.
21
22 ## Implemented Structure
23
24 New core:
25 - `src/core/plugin-registry.js`
26 - `src/core/action-policy.js`
27 - `src/core/audit.js`
28 - `src/core/router.js`
29
30 GitHub plugin:
31 - `src/plugins/github/manifest.js`
32 - `src/plugins/github/plugin.js`
33
34 New tests:
35 - `test/plugin-registry.test.js`
36 - `test/action-policy.test.js`
37 - `test/audit.test.js`
38 - `test/plugin-router.test.js`
39 - `test/github-plugin.test.js`
40
41 Modified:
42 - `src/bot.js`
43 - `test/bot.test.js`
44 - `PROJECT_MEMORY.md`
45
46 ## Security-Critical Router Contract
47
48 The implemented contract is deliberately stricter than the initial draft:
49
50 ```text
51 resolve route -> identify declared action -> evaluate policy -> audit decision -> execute provider/view code
52 ```
53
54 A plugin resolver returns either `null` or:
55
56 ```js
57 {
58 actionId: 'github.repos.list',
59 execute: async () => view
60 }
61 ```
62
63 `resolveCommand()` and `resolveCallback()` must be side-effect-free. Network/provider/menu work belongs inside the deferred `execute()` function. This guarantees `WRITE`, `DESTRUCTIVE`, undeclared, and denied actions cannot run before policy evaluation.
64
65 ## Task 1 — Plugin Registry
66
67 - [x] RED test added: valid registration, duplicate plugin ID, duplicate action ID, invalid risk, lookup behavior.
68 - [x] RED CI confirmed: commit `2460b0854f6dbd99a80cfb9561850fdd23f1ac0e`, run `37069219176` failed for the missing module.
69 - [x] `PluginRegistry` implemented: commit `3f644caef41a9136cb5f0a78b0c66798238a257d`.
70 - [x] GREEN CI: `37069339637`.
71
72 ## Task 2 — Action Policy + Redacted Audit
73
74 - [x] Policy RED commit `77efe66f008fcb417b0b66f22b186885d3fecdd3`; run `37069430240` failed as expected.
75 - [x] `ActionPolicy` implementation commit `cbdba6b1b70342d6325d229cec1725c05862a537`; GREEN run `37069629741`.
76 - [x] Audit RED commit `a6f9735185f7a0ce45fe744b9a13b1fa3d885681`; run `37069736330` failed as expected.
77 - [x] `AuditLogger` implementation commit `92dfcba318f5199e6c9e54da5fbba91a15122ca3`; GREEN run `37069824796`.
78 - [x] Recursive redaction covers nested strings, arrays, and objects; sink failures cannot break user actions.
79
80 ## Task 3 — Policy-Enforcing Plugin Router
81
82 - [x] RED commit `4e3fca87139310c24c3c83a5181fc638f887882d`; run `37069955642` failed as expected.
83 - [x] Router implementation commit `00fcd1041e2f8074dc34727635395896eace0cba`.
84 - [x] GREEN CI `37070015843`.
85 - [x] Tests prove undeclared actions never execute.
86 - [x] Tests prove `WRITE` and `DESTRUCTIVE` actions return approval-required results and never invoke `execute()`.
87 - [x] Audit attempt/result events are emitted around allowed READ execution.
88
89 ## Task 4 — GitHub Plugin Adapter
90
91 - [x] RED commit `ae6829729779c2f656e99958a379c805eb1bebc4`; run `37070181121` failed as expected.
92 - [x] Manifest + adapter implementation completed; final adapter commit `c9aed93bc1a3bd8ac047a3639722633bcd9c624e`.
93 - [x] GREEN CI `37070481981`.
94 - [x] `/repos`, `menu:repos`, `repo:`, `files:`, `tree:`, `blob:`, `pr:`, `commits:`, `status:` map to declared GitHub READ actions.
95 - [x] Non-GitHub commands/callbacks are not consumed by the plugin.
96
97 ## Task 5 — NexaDevBot Integration Without UX Regression
98
99 - [x] Migration RED tests added in commit `f1ee926320dc918d0d0c8b21d60710077a9d119b`; run `37070633843` failed as expected before integration.
100 - [x] `src/bot.js` integration commit `d628a4ed0b07dfa4c748b6161515565b1eef3073`.
101 - [x] `/repos` and GitHub callbacks route through the plugin kernel.
102 - [x] `/start`, `/status`, and non-GitHub menu routes keep compatibility behavior.
103 - [x] Callback acknowledgement remains best-effort and cannot block rendering.
104 - [x] Same-message callback editing remains covered.
105 - [x] PR CI run `37070778956` passed the merge result with **12 test files, 52 tests, 52 pass, 0 fail, 0 skip**.
106
107 ## Task 6 — Final Review, Merge, Deploy, Runtime Verification
108
109 - [x] Full PR diff reviewed for Foundation v1 scope; no provider expansion or secret value added.
110 - [x] Fresh PR CI evidence inspected, including test discovery and full `npm test` output.
111 - [ ] Final documentation commit PR CI green.
112 - [ ] PR #14 marked ready and merged to `main`.
113 - [ ] Post-merge `main` CI green.
114 - [ ] Cloudflare deploy workflow green and latest Worker deployment verified at 100% traffic.
115 - [ ] Production Telegram webhook telemetry on the new Worker version returns HTTP 200 / outcome `ok` with no new plugin-kernel error.
116 - [ ] Owner-device post-Foundation smoke recorded as VERIFIED or NOT VERIFIED.
117
118 ## Definition of Done
119
120 Foundation v1 is complete only when all Task 6 runtime/deploy gates above are satisfied. Until then, implementation may be code-complete but is not marked production-complete.