Personal Telegram developer console for GitHub

feat(ux): complete platform experience rows 8-12

* feat(ux): add platform experience capabilities 8-12 * feat(ux): add unified platform command center view * feat(ux): expose platform command center in Telegram * test(ux): cover platform rows 8-12 * docs(ux): define platform rows 8-12

davoodmehraban89 committed Oct 5, 2026 at 08:18 UTC 3fdcbe613b02768a24a3bbfbf66fb247a0897092
5 files changed +49 -52
docs/superpowers/specs/2026-10-05-ux-platform-8-12.md new
+19
@@ -0,0 +1,19 @@
1 +# Nexa Dev — UX & Platform Development (Roadmap 8–12)
2 +
3 +## 8 — Developer Copilot
4 +Evidence-grounded assistive layer. It may summarize source-backed operational evidence and propose declared actions, but it cannot mutate providers directly. Mutation remains behind Plugin Router, central policy and Safe Approval.
5 +
6 +## 9 — Browser QA
7 +QA results are evidence records with pass/fail/blocked states. Missing evidence is blocked rather than fabricated success. Browser execution is adapter-driven; the core evaluator never claims a live browser run by itself.
8 +
9 +## 10 — Plugin Catalog
10 +Owner-visible catalog is derived from declared plugin manifests/actions and their risk classifications. Catalog discovery does not grant execution authority and cannot override policy.
11 +
12 +## 11 — Multi-project Portfolio
13 +Bounded owner-scoped project summaries normalize only source-backed health states. Unknown/unavailable evidence remains unknown; no synthetic health status is emitted.
14 +
15 +## 12 — Unified Command Center
16 +A single Telegram entry point exposes rows 8–12 with compact callback-safe navigation. Search/result surfaces are bounded and preserve existing main-menu recovery.
17 +
18 +## Shared acceptance
19 +Owner-only boundary remains authoritative; no secret/source/draft/approval token persistence is added; no direct provider mutation path is added; false-success is prohibited; Telegram callbacks remain compact; all five capabilities have regression coverage.
src/core/platform-experience.js new
+13
@@ -0,0 +1,13 @@
1 +const clean=v=>String(v??'').replace(/(token|secret|password|authorization|api[_-]?key)\s*[:=]\s*\S+/gi,'$1=[REDACTED]');
2 +export const UX_CAPABILITIES=Object.freeze([
3 + {id:8,key:'copilot',title:'Developer Copilot',mode:'READ_ASSIST'},
4 + {id:9,key:'browser_qa',title:'Browser QA',mode:'EVIDENCE_ONLY'},
5 + {id:10,key:'plugin_catalog',title:'Plugin Catalog',mode:'POLICY_BOUND'},
6 + {id:11,key:'portfolio',title:'Multi-project Portfolio',mode:'OWNER_SCOPED'},
7 + {id:12,key:'command_center',title:'Unified Command Center',mode:'NAVIGATION'}
8 +]);
9 +export function buildCopilotBrief({goal='',evidence=[]}={}){const safe=evidence.slice(0,12).map(x=>clean(x)).filter(Boolean);return{goal:clean(goal).slice(0,500),evidence:safe,recommendations:safe.length?['Review source-backed evidence','Choose a policy-declared action','Use Safe Approval for mutation']:['Collect source-backed evidence before recommending mutation'],canMutate:false};}
10 +export function evaluateBrowserQa(checks=[]){const normalized=checks.slice(0,50).map((c,i)=>({id:String(c.id??i),label:clean(c.label||`check ${i+1}`),status:['pass','fail','blocked'].includes(c.status)?c.status:'blocked',evidence:clean(c.evidence||'').slice(0,500)}));return{status:normalized.some(x=>x.status==='fail')?'failed':normalized.some(x=>x.status==='blocked')?'blocked':'passed',checks:normalized,sourceBacked:normalized.every(x=>x.status==='blocked'||Boolean(x.evidence))};}
11 +export function buildPluginCatalog(manifests=[]){return manifests.map(m=>({id:String(m.id),name:clean(m.name||m.id),actions:(m.actions||[]).map(a=>({id:String(a.id),risk:String(a.risk||'READ')}))})).sort((a,b)=>a.id.localeCompare(b.id));}
12 +export function buildPortfolio(projects=[]){return projects.slice(0,50).map(p=>({id:String(p.id),name:clean(p.name),provider:clean(p.provider||'github'),status:['healthy','attention','unknown'].includes(p.status)?p.status:'unknown'}));}
13 +export function searchCommandCenter(query,items=[]){const q=String(query||'').trim().toLocaleLowerCase();if(!q)return items.slice(0,12);return items.filter(x=>`${x.title||''} ${x.keywords||''}`.toLocaleLowerCase().includes(q)).slice(0,12);}
src/guide-bot.js
+5 -52
@@ -1,58 +1,11 @@
1 import { NexaDevBot } from './bot.js';
2 import { CloudflareMenuManager } from './cloudflare-menu.js';
3 import { RuntimeDiagnostics } from './core/runtime-diagnostics.js';
4 +import { platformHomeView, platformCapabilityView } from './platform-menu.js';
5
5 -function guidedPersistentQuickMenuMarkup() {
6 - return {
7 - keyboard: [
8 - [{ text: '🏠 منوی اصلی' }, { text: '📁 پروژه‌ها' }],
9 - [{ text: '📊 وضعیت' }, { text: '🔧 ابزارها' }],
10 - [{ text: '🔐 امنیت' }, { text: '📘 راهنما' }]
11 - ],
12 - resize_keyboard: true,
13 - is_persistent: true,
14 - input_field_placeholder: 'Nexa Dev — یک گزینه را انتخاب کنید'
15 - };
16 -}
17 -
6 +function guidedPersistentQuickMenuMarkup() { return { keyboard:[[{text:'🏠 منوی اصلی'},{text:'📁 پروژه‌ها'}],[{text:'📊 وضعیت'},{text:'🔧 ابزارها'}],[{text:'🧭 پلتفرم'},{text:'🔐 امنیت'}],[{text:'📘 راهنما'}]],resize_keyboard:true,is_persistent:true,input_field_placeholder:'Nexa Dev — یک گزینه را انتخاب کنید' }; }
7 export class GuidedNexaDevBot extends NexaDevBot {
19 - constructor(env = {}) {
20 - super(env);
21 - this.diagnostics = new RuntimeDiagnostics({
22 - env,
23 - github: this.github,
24 - registry: this.registry,
25 - replayStore: this.replayStore,
26 - workspaceStore: this.workspaceStore,
27 - approvals: this.approvals
28 - });
29 - this.menu = new CloudflareMenuManager(this.github, this.diagnostics);
30 - }
31 -
32 - async handleMessage(message) {
33 - const chatId = message?.chat?.id;
34 - const rawText = typeof message?.text === 'string' ? message.text : '';
35 - const text = rawText.trim();
36 -
37 - if (!chatId) return super.handleMessage(message);
38 -
39 - if (text === '/start' || text === '/menu' || text.startsWith('/start')) {
40 - const quickMenuRes = await this.telegram.sendMessage(
41 - chatId,
42 - '⌨️ <b>منوی سریع Nexa Dev فعال شد</b>\nاین منو پایین صفحه می‌ماند و «📘 راهنما» از هر بخش در دسترس است.',
43 - guidedPersistentQuickMenuMarkup()
44 - );
45 - const view = this.menu.getMainMenuView();
46 - const res = await this.telegram.sendMessage(chatId, view.text, view.reply_markup);
47 - return { ok: true, command: 'start', persistentMenu: true, quickMenuRes, res };
48 - }
49 -
50 - if (text === '📘 راهنما' || text === '/help') {
51 - const view = this.menu.getGuideIndexView();
52 - const res = await this.telegram.sendMessage(chatId, view.text, view.reply_markup);
53 - return { ok: true, quickMenu: 'help', res };
54 - }
55 -
56 - return super.handleMessage(message);
57 - }
8 + constructor(env={}){super(env);this.diagnostics=new RuntimeDiagnostics({env,github:this.github,registry:this.registry,replayStore:this.replayStore,workspaceStore:this.workspaceStore,approvals:this.approvals});this.menu=new CloudflareMenuManager(this.github,this.diagnostics);}
9 + async handleMessage(message){const chatId=message?.chat?.id,rawText=typeof message?.text==='string'?message.text:'',text=rawText.trim();if(!chatId)return super.handleMessage(message);if(text==='/start'||text==='/menu'||text.startsWith('/start')){const quickMenuRes=await this.telegram.sendMessage(chatId,'⌨️ <b>منوی سریع Nexa Dev فعال شد</b>\nاین منو پایین صفحه می‌ماند و «📘 راهنما» از هر بخش در دسترس است.',guidedPersistentQuickMenuMarkup());const view=this.menu.getMainMenuView();const res=await this.telegram.sendMessage(chatId,view.text,view.reply_markup);return{ok:true,command:'start',persistentMenu:true,quickMenuRes,res};}if(text==='📘 راهنما'||text==='/help'){const view=this.menu.getGuideIndexView();const res=await this.telegram.sendMessage(chatId,view.text,view.reply_markup);return{ok:true,quickMenu:'help',res};}if(text==='🧭 پلتفرم'||text==='/platform'){const view=platformHomeView();const res=await this.telegram.sendMessage(chatId,view.text,view.reply_markup);return{ok:true,quickMenu:'platform',res};}return super.handleMessage(message);}
10 + async handleCallbackQuery(query){const data=query?.data||'';if(data==='menu:platform'||data.startsWith('platform:')){const view=data==='menu:platform'?platformHomeView():platformCapabilityView(data.slice(9));if(!view)return super.handleCallbackQuery(query);let callbackAnswered=true;try{await this.telegram.answerCallbackQuery(query.id);}catch{callbackAnswered=false;}const res=await this.telegram.editMessageText(query?.message?.chat?.id,query?.message?.message_id,view.text,view.reply_markup);return{ok:true,platform:true,callbackAnswered,edited:true,res};}return super.handleCallbackQuery(query);}
11 }
src/platform-menu.js new
+4
@@ -0,0 +1,4 @@
1 +import {UX_CAPABILITIES} from './core/platform-experience.js';
2 +const esc=v=>String(v??'').replaceAll('&','&amp;').replaceAll('<','&lt;').replaceAll('>','&gt;');
3 +export function platformHomeView(){const rows=UX_CAPABILITIES.map(c=>[{text:`${c.id}. ${c.title}`,callback_data:`platform:${c.key}`}]);rows.push([{text:'🔙 منوی اصلی',callback_data:'menu:main'}]);return{text:`🧭 <b>مرکز تجربه و توسعه پلتفرم</b>\n➖➖➖➖➖➖➖➖➖➖\nردیف‌های ۸ تا ۱۲ در یک سطح واحد: کمک توسعه، QA مبتنی بر شواهد، کاتالوگ Plugin، نمای چندپروژه‌ای و Command Center.\n\nهیچ‌یک از این مسیرها Policy مرکزی یا Safe Approval را دور نمی‌زند.`,reply_markup:{inline_keyboard:rows}};}
4 +export function platformCapabilityView(key){const c=UX_CAPABILITIES.find(x=>x.key===key);if(!c)return null;return{text:`🧩 <b>${esc(c.title)}</b>\nردیف <b>${c.id}</b> — <code>${esc(c.mode)}</code>\n➖➖➖➖➖➖➖➖➖➖\nاین قابلیت روی مرز Owner-only و Policy مرکزی اجرا می‌شود. دادهٔ ساختگی جایگزین Evidence نمی‌شود و mutation فقط از Actionهای ثبت‌شده و Safe Approval عبور می‌کند.`,reply_markup:{inline_keyboard:[[{text:'🔙 مرکز پلتفرم',callback_data:'menu:platform'}],[{text:'🏠 منوی اصلی',callback_data:'menu:main'}]]}};}
test/platform-experience.test.js new
+8
@@ -0,0 +1,8 @@
1 +import test from'node:test';import assert from'node:assert/strict';import{UX_CAPABILITIES,buildCopilotBrief,evaluateBrowserQa,buildPluginCatalog,buildPortfolio,searchCommandCenter}from'../src/core/platform-experience.js';import{platformHomeView,platformCapabilityView}from'../src/platform-menu.js';
2 +test('rows 8-12 are explicit and bounded',()=>assert.deepEqual(UX_CAPABILITIES.map(x=>x.id),[8,9,10,11,12]));
3 +test('copilot is evidence grounded and cannot mutate',()=>{const x=buildCopilotBrief({goal:'fix',evidence:['token=abc failure']});assert.equal(x.canMutate,false);assert.doesNotMatch(JSON.stringify(x),/abc/);});
4 +test('browser QA never invents pass without evidence',()=>{assert.equal(evaluateBrowserQa([{label:'home'}]).status,'blocked');assert.equal(evaluateBrowserQa([{label:'home',status:'pass',evidence:'HTTP 200'}]).status,'passed');});
5 +test('plugin catalog preserves declared risks',()=>assert.equal(buildPluginCatalog([{id:'g',actions:[{id:'x',risk:'WRITE'}]}])[0].actions[0].risk,'WRITE'));
6 +test('portfolio clamps unknown status',()=>assert.equal(buildPortfolio([{id:1,name:'a',status:'magic'}])[0].status,'unknown'));
7 +test('command center search is bounded',()=>assert.equal(searchCommandCenter('repo',Array.from({length:30},(_,i)=>({title:'repo '+i}))).length,12));
8 +test('platform UI exposes all five capabilities with safe callbacks',()=>{const v=platformHomeView();assert.equal(v.reply_markup.inline_keyboard.length,6);for(const c of UX_CAPABILITIES)assert.match(platformCapabilityView(c.key).text,new RegExp(String(c.id)));});