Personal Telegram developer console for GitHub
main
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 | # CP2 Multi-file Repository Workspace Implementation Plan |
| 2 | |
| 3 | > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 4 | |
| 5 | **Goal:** Extend the existing branch-only Workspace to atomically edit a bounded set of text files. |
| 6 | |
| 7 | **Architecture:** Version the durable Workspace schema, represent files as an ordered bounded collection, seal immutable multi-file Ready intents, and reuse the existing Git Data commit path to create one tree/commit on `nexa/edit-*`. Preserve single-file compatibility and fail closed on stale base/material. |
| 8 | |
| 9 | **Tech Stack:** Node.js ESM, Cloudflare Workers/Durable Objects, Telegram Bot API, GitHub Git Data API, node:test. |
| 10 | |
| 11 | **Spec:** docs/superpowers/specs/2026-10-05-control-plane-completion-design.md |
| 12 | |
| 13 | ## Global Constraints |
| 14 | - Never mutate `main` directly. |
| 15 | - Owner-only; WRITE requires Safe Approval and durable replay protection. |
| 16 | - Per-file existing text/binary/sensitive/LFS policy remains authoritative. |
| 17 | - Callback data <=64 UTF-8 bytes; Telegram text <=4096 chars. |
| 18 | - No draft/source content in audit metadata. |
| 19 | |
| 20 | ## Review Focus |
| 21 | - Existing single-file records migrate/read without corruption. |
| 22 | - Duplicate/renamed paths cannot create ambiguous tree entries. |
| 23 | - Aggregate payload limit fails explicitly before persistence. |
| 24 | - Base SHA changes invalidate sealed intent. |
| 25 | - Retry after provider partial failure is idempotent. |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ### Task 1: Versioned multi-file Workspace model |
| 30 | **Files:** |
| 31 | - Modify: `src/durable/workspace-store.js` |
| 32 | - Modify: `src/core/workspace-store.js` |
| 33 | - Test: `test/workspace-store.test.js` |
| 34 | - Test: `test/workspace-store-file-input.test.js` |
| 35 | |
| 36 | **Interfaces:** |
| 37 | - Consumes: existing owner-scoped workspace ID and single-file records. |
| 38 | - Produces: `files[]` records with path/baseSha/baseText/draftText and schemaVersion. |
| 39 | |
| 40 | - [ ] Write failing tests for legacy-read migration, add/update/remove file, duplicate path rejection and aggregate bound. |
| 41 | - [ ] Run targeted tests and confirm RED. |
| 42 | - [ ] Implement minimal versioned storage and migration. |
| 43 | - [ ] Run targeted tests and confirm GREEN. |
| 44 | - [ ] Commit. |
| 45 | |
| 46 | ### Task 2: Multi-file policy, diff and immutable Ready intent |
| 47 | **Files:** |
| 48 | - Modify: `src/core/workspace-policy.js` |
| 49 | - Modify: `src/plugins/github/workspace.js` |
| 50 | - Test: `test/workspace-policy.test.js` |
| 51 | - Test: `test/workspace-editor-v2.test.js` |
| 52 | |
| 53 | **Interfaces:** |
| 54 | - Consumes: versioned workspace files. |
| 55 | - Produces: aggregate diff summary and immutable intent containing ordered file descriptors. |
| 56 | |
| 57 | - [ ] Add RED tests for per-file policy, aggregate diff, unchanged workspace, stale material/base and intent reuse. |
| 58 | - [ ] Implement bounded aggregate validation/diff and intent sealing. |
| 59 | - [ ] Run targeted tests GREEN and commit. |
| 60 | |
| 61 | ### Task 3: Atomic multi-file Git tree commit |
| 62 | **Files:** |
| 63 | - Modify: `src/plugins/github/workspace-commit.js` |
| 64 | - Modify: `src/github.js` |
| 65 | - Test: `test/workspace-approved-recovery.test.js` |
| 66 | - Test: `test/workspace-recovery-validation.test.js` |
| 67 | |
| 68 | **Interfaces:** |
| 69 | - Consumes: approved immutable multi-file intent. |
| 70 | - Produces: exactly one branch commit/tree on `nexa/edit-<workspaceId>`. |
| 71 | |
| 72 | - [ ] Add RED tests for one atomic tree, stale base rejection, partial-failure retry and reconciliation. |
| 73 | - [ ] Implement minimal multi-blob/tree orchestration reusing current Git Data primitives. |
| 74 | - [ ] Run targeted tests GREEN and commit. |
| 75 | |
| 76 | ### Task 4: Telegram/Mini App multi-file UX and recovery |
| 77 | **Files:** |
| 78 | - Modify: `src/workspace-editor.js` |
| 79 | - Modify: `src/plugins/github/plugin.js` |
| 80 | - Modify: `src/bot.js` |
| 81 | - Test: `test/telegram-menu-e2e.test.js` |
| 82 | - Test: `test/workspace-editor-worker.test.js` |
| 83 | |
| 84 | **Interfaces:** |
| 85 | - Consumes: workspace file collection and aggregate diff. |
| 86 | - Produces: bounded add/select/remove/diff/ready/recovery views. |
| 87 | |
| 88 | - [ ] Add RED navigation/callback-limit/recovery tests. |
| 89 | - [ ] Implement views without embedding raw long paths in callback data. |
| 90 | - [ ] Run targeted tests GREEN and commit. |
| 91 | |
| 92 | ### Task 5: CP2 release gate |
| 93 | - [ ] Run full `npm test`; expect zero failures/skips caused by CP2. |
| 94 | - [ ] Review diff for direct-main mutation, sensitive logging and callback overflow. |
| 95 | - [ ] Update README/Guide/PROJECT_MEMORY for multi-file behavior. |
| 96 | - [ ] PR, CI, Preview, locked-head merge, post-merge CI, exact-SHA deploy and production smoke. |