specpilot 2.7.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +31 -92
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/serve.d.ts +3 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +55 -6
- package/dist/commands/serve.js.map +1 -1
- package/dist/utils/addSpecsQuestions.d.ts +16 -0
- package/dist/utils/addSpecsQuestions.d.ts.map +1 -1
- package/dist/utils/addSpecsQuestions.js +28 -1
- package/dist/utils/addSpecsQuestions.js.map +1 -1
- package/dist/utils/gitClone.d.ts +62 -0
- package/dist/utils/gitClone.d.ts.map +1 -0
- package/dist/utils/gitClone.js +222 -0
- package/dist/utils/gitClone.js.map +1 -0
- package/dist/utils/initQuestions.d.ts +57 -0
- package/dist/utils/initQuestions.d.ts.map +1 -0
- package/dist/utils/initQuestions.js +49 -0
- package/dist/utils/initQuestions.js.map +1 -0
- package/dist/utils/projectRegistry.d.ts +65 -0
- package/dist/utils/projectRegistry.d.ts.map +1 -0
- package/dist/utils/projectRegistry.js +242 -0
- package/dist/utils/projectRegistry.js.map +1 -0
- package/dist/utils/specFileGenerator.d.ts +5 -4
- package/dist/utils/specFileGenerator.d.ts.map +1 -1
- package/dist/utils/specFileGenerator.js +53 -28
- package/dist/utils/specFileGenerator.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +5 -0
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +7 -0
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specServer.d.ts +8 -2
- package/dist/utils/specServer.d.ts.map +1 -1
- package/dist/utils/specServer.js +284 -19
- package/dist/utils/specServer.js.map +1 -1
- package/dist/utils/specSetup.d.ts +69 -4
- package/dist/utils/specSetup.d.ts.map +1 -1
- package/dist/utils/specSetup.js +226 -18
- package/dist/utils/specSetup.js.map +1 -1
- package/package.json +1 -1
- package/ui/app.css +135 -9
- package/ui/app.js +301 -67
- package/ui/index.html +60 -8
- package/ui/route.js +179 -3
package/ui/app.js
CHANGED
|
@@ -42,18 +42,20 @@ function initials(n){const w=String(n).split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
|
42
42
|
if(w.length>1)return (w[0][0]+w[1][0]).toUpperCase();
|
|
43
43
|
return w[0].slice(0,2).toUpperCase();}
|
|
44
44
|
function renderProject(){
|
|
45
|
-
const p=DATA.project, name=p
|
|
46
|
-
$('#projList').innerHTML=DATA.projects.map((q,i)=>{const n=q
|
|
45
|
+
const p=DATA.project, name=projectLabel(p), where=p.root+(p.branch?' · '+p.branch:'');
|
|
46
|
+
$('#projList').innerHTML=DATA.projects.map((q,i)=>{const n=projectLabel(q),cur=i===PROJECT&&!NOPROJ.includes(curView);
|
|
47
47
|
return `<button class="tile blue${cur?' cur':''}" data-project="${i}" data-tip="${esc(n)}" data-path="${esc(q.root+(q.branch?' · '+q.branch:''))}" aria-label="${esc(n)}"${cur?' aria-current="true"':''}><span aria-hidden="true">${esc(initials(n))}</span></button>`;}).join('');
|
|
48
48
|
$('#curGrp').textContent=name;$('#curGrp').title=p.root;
|
|
49
49
|
$('#curBranch').textContent=p.branch||'';
|
|
50
50
|
$('#subName').textContent=name;$('#subPath').textContent=where;
|
|
51
|
-
$('#footAddr').textContent=location.host;$('#footVer').textContent='v'+p.specpilotVersion;
|
|
51
|
+
$('#footAddr').textContent=$('#homeAddr').textContent=location.host;$('#footVer').textContent=$('#homeVer').textContent='v'+p.specpilotVersion;
|
|
52
52
|
document.title=name+' · SpecPilot Local';
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/* ---------------- views ---------------- */
|
|
56
|
-
const
|
|
56
|
+
const homeBtn=$('#homeBtn');
|
|
57
|
+
const VIEWS={board:'Tasks',explorer:'Explorer',security:'Security',instructions:'Instructions',commands:'Commands',skills:'Skills',setup:'',home:'',new:''};
|
|
58
|
+
const NOPROJ=['home','new']; // views that belong to no project (BL-PM-001, BL-PM-004)
|
|
57
59
|
const TITLES={'planning/roadmap.md':'Roadmap','project/requirements.md':'Requirements','architecture/architecture.md':'Architecture','quality/tests.md':'Tests'};
|
|
58
60
|
const NAV=[['board'],['file','planning/roadmap.md'],['file','project/requirements.md'],['explorer'],['file','architecture/architecture.md'],['file','quality/tests.md'],['security'],['instructions'],['commands'],['skills']];
|
|
59
61
|
let curView='board',curFile='';
|
|
@@ -61,19 +63,28 @@ function syncNav(){
|
|
|
61
63
|
$$('.src .srow').forEach(b=>{
|
|
62
64
|
const on=b.dataset.v==='file'?(curView==='file'&&b.dataset.f===curFile):(b.dataset.v===curView);
|
|
63
65
|
b.classList.toggle('on',on);b.setAttribute('aria-current',on?'page':'false');});
|
|
66
|
+
/* the rail: on Home (BL-PM-001) the Home tile is the current one and no project tile is */
|
|
67
|
+
const home=curView==='home',off=NOPROJ.includes(curView);
|
|
68
|
+
[homeBtn,...$$('#projList .tile')].forEach(t=>{const cur=t===homeBtn?home:!off&&+t.dataset.project===PROJECT;
|
|
69
|
+
t.classList.toggle('cur',cur);if(cur)t.setAttribute('aria-current','true');else t.removeAttribute('aria-current');});
|
|
64
70
|
}
|
|
65
71
|
function go(v,keep,sub){
|
|
66
72
|
if(v==='file'){if(!DATA||!sub)v='board';else curFile=sub;}
|
|
73
|
+
else if(NOPROJ.includes(v)){if(!TOKEN)v='board';} // no Home and no new-project chat with --read-only
|
|
67
74
|
else if(!VIEWS[v]||v==='setup')v='board';
|
|
68
|
-
if(DATA&&DATA.project.specs===false)v='setup'; // no .specs/ yet: every route shows the setup view (BL-055)
|
|
75
|
+
if(!NOPROJ.includes(v)&&DATA&&DATA.project.specs===false)v='setup'; // no .specs/ yet: every route of the project shows the setup view (BL-055)
|
|
69
76
|
curView=v;
|
|
70
|
-
|
|
77
|
+
$('#win').classList.toggle('home',v==='home');$('#win').classList.toggle('inchat',v==='new'||v==='setup'); // not `chat`: the chat's own rules are `.chat .x` and must not reach the rail
|
|
78
|
+
$$('.content>.view').forEach(e=>e.classList.toggle('on',e.id==='v-'+(v==='new'||v==='setup'?'chat':v))); // one chat section for both flows (BL-PM-004)
|
|
71
79
|
syncNav();
|
|
72
|
-
$('#title').textContent=v==='file'?(TITLES[sub]||sub):v==='setup'?
|
|
80
|
+
$('#title').textContent=v==='file'?(TITLES[sub]||sub):v==='setup'?projectLabel(DATA.projects[PROJECT]):v==='new'?'New project':VIEWS[v];
|
|
81
|
+
$('#chatSub').hidden=!(v==='new'||v==='setup');if(v!=='new'&&v!=='setup'){$('#chatRestart').hidden=$('#chatClose').hidden=true;chat=null;}
|
|
73
82
|
$('#modeSeg').hidden=v!=='board';
|
|
74
83
|
setNav(false);closeInsp();
|
|
75
84
|
if(v!=='file'||sub!==fileNoteFor)clearFileNote();
|
|
76
|
-
if(v==='
|
|
85
|
+
if(v==='home')loadRecent();
|
|
86
|
+
if(v==='setup')renderChat(false);
|
|
87
|
+
if(v==='new')renderChat(true);
|
|
77
88
|
if(v==='file')renderFile(sub);
|
|
78
89
|
if(v==='explorer')renderExplorer();
|
|
79
90
|
if(v==='security')renderSecurity();
|
|
@@ -86,11 +97,12 @@ let urlOk=true,memHash='';
|
|
|
86
97
|
try{history.replaceState(null,'',location.href);}catch(e){urlOk=false;}
|
|
87
98
|
try{memHash=location.hash;}catch(e){memHash='';}
|
|
88
99
|
function curHash(){if(!urlOk)return memHash;try{return location.hash;}catch(e){return memHash;}}
|
|
89
|
-
function setHash(v,sub){const h='#'+(PROJECT?PROJECT+'/':'')+v+(sub?'/'+sub:'');if(curHash()===h)return;memHash=h;
|
|
100
|
+
function setHash(v,sub){const h='#'+(PROJECT&&!NOPROJ.includes(v)?PROJECT+'/':'')+v+(sub?'/'+sub:'');if(curHash()===h)return;memHash=h;
|
|
90
101
|
if(!urlOk)return;
|
|
91
102
|
try{history.replaceState(null,'',h);}catch(e){urlOk=false;}}
|
|
92
103
|
function route(){
|
|
93
|
-
const r=resolveRoute(curHash(),DATA?DATA.files:{},DATA?DATA.projects.length:1);
|
|
104
|
+
const r=resolveRoute(curHash(),DATA?DATA.files:{},DATA?DATA.projects.length:1,!!TOKEN);
|
|
105
|
+
if(NOPROJ.includes(r.view)){go(r.view);return;} // Home and the new-project chat belong to no project: the shown one stays loaded behind them
|
|
94
106
|
if(r.project!==PROJECT){switchProject(r.project,true);return;}
|
|
95
107
|
if(r.view==='board'&&r.sub==='board'){mode='board';$$('#modeSeg button').forEach(x=>x.classList.toggle('on',x.dataset.m==='board'));renderTasks();}
|
|
96
108
|
go(r.view,true,r.sub);
|
|
@@ -124,7 +136,7 @@ document.addEventListener('focusout',e=>{if(e.target.closest&&e.target.closest('
|
|
|
124
136
|
window.addEventListener('scroll',hideTip,true);window.addEventListener('resize',hideTip);
|
|
125
137
|
$('#rail').addEventListener('keydown',e=>{
|
|
126
138
|
if(e.key!=='ArrowDown'&&e.key!=='ArrowUp'&&e.key!=='Home'&&e.key!=='End')return;
|
|
127
|
-
const tiles=$$('#rail .tile');const i=tiles.indexOf(document.activeElement);if(i<0)return;
|
|
139
|
+
const tiles=$$('#rail .tile').filter(t=>!t.hidden);const i=tiles.indexOf(document.activeElement);if(i<0)return;
|
|
128
140
|
e.preventDefault();
|
|
129
141
|
const n=e.key==='Home'?0:e.key==='End'?tiles.length-1:(i+(e.key==='ArrowDown'?1:-1)+tiles.length)%tiles.length;
|
|
130
142
|
tiles[n].focus();
|
|
@@ -288,8 +300,9 @@ document.addEventListener('keydown',e=>{
|
|
|
288
300
|
const mod=e.metaKey||e.ctrlKey;const inField=/INPUT|SELECT|TEXTAREA/.test(e.target.tagName);
|
|
289
301
|
if(mod&&e.key.toLowerCase()==='k'){e.preventDefault();palVeil.classList.contains('open')?closePal():openPal();return}
|
|
290
302
|
if(mod&&/^[1-9]$/.test(e.key)){e.preventDefault();const n=NAV[+e.key-1];if(n)go(n[0],false,n[1]);return}
|
|
291
|
-
if(e.key==='Escape'){hideTip();closeInsp();closePal();setNav(false);return}
|
|
303
|
+
if(e.key==='Escape'){hideTip();closeInsp();closePal();closeSheet();if(chat&&chat.st.editing&&!chatBusy){chat.st.editing=null;drawChat();}setNav(false);return}
|
|
292
304
|
if(inField||mod||e.altKey)return;
|
|
305
|
+
if(e.key==='h'&&TOKEN&&!openVeil.classList.contains('open')){go('home');return;}
|
|
293
306
|
if(/^[1-9]$/.test(e.key)){const n=NAV[+e.key-1];if(n)go(n[0],false,n[1]);}
|
|
294
307
|
if((e.key==='j'||e.key==='k')&&curView==='board'){const rows=$$((mode==='board'?'#boardMode':'#listMode')+' .row[data-col]');if(!rows.length)return;let i=rows.findIndex(r=>r.dataset.col+':'+r.dataset.i===selected);i=e.key==='j'?Math.min(rows.length-1,i+1):Math.max(0,i-1);if(i<0)i=0;openTask(rows[i].dataset.col,+rows[i].dataset.i);rows[i].scrollIntoView({block:'nearest'});rows[i].focus();}
|
|
295
308
|
});
|
|
@@ -349,66 +362,167 @@ async function move(col,i,toSection,toIndex,isUndo){
|
|
|
349
362
|
}else toast(body.error||`The move was not made (HTTP ${r.status}).`);
|
|
350
363
|
}
|
|
351
364
|
|
|
352
|
-
/* ----------------
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
365
|
+
/* ---------------- setup chat (BL-055, BL-PM-004) ----------------
|
|
366
|
+
The init.specpilot.dev chat over the CLI's own questions: for a new project (#new) and for a named
|
|
367
|
+
folder with no .specs/ yet (its setup view). The questions, their chat lines, choices, steps and file
|
|
368
|
+
lists come from GET /api/setup or GET /api/projects/new; the page adds only the strings REQ-002.H.17
|
|
369
|
+
and H.27 list, and its own parent-folder question. What can be decided without the DOM is in route.js. */
|
|
370
|
+
let fileNoteFor=null;
|
|
356
371
|
function clearFileNote(){const n=$('#fileNote');n.hidden=true;n.innerHTML='';fileNoteFor=null;}
|
|
357
372
|
function setFileNote(path,lines){const n=$('#fileNote');n.innerHTML=lines.map(l=>`<p class="note" translate="no">${esc(l)}</p>`).join('');n.hidden=false;fileNoteFor=path;}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
373
|
+
/* Above onboarding.md after a setup or a create: what was kept, and the Codex notice. */
|
|
374
|
+
function noteCreated(res){
|
|
375
|
+
go('file',false,'development/onboarding.md');
|
|
376
|
+
const lines=[];
|
|
377
|
+
if(res.kept&&res.kept.length)lines.push('Kept as they were: '+res.kept.join(', ')+'. Run specpilot backfill there to add missing SpecPilot sections to the instruction and command files.');
|
|
378
|
+
if(res.notice)lines.push(res.notice);
|
|
379
|
+
if(lines.length)setFileNote('development/onboarding.md',lines);
|
|
380
|
+
}
|
|
381
|
+
async function getQuestions(url){
|
|
382
|
+
try{const r=await fetch(url,{cache:'no-store'});if(r.ok)return await r.json();return r.status===404?null:{error:(await r.json().catch(()=>({}))).error||'HTTP '+r.status};}
|
|
383
|
+
catch(e){return {error:'The server did not answer.'};}
|
|
384
|
+
}
|
|
385
|
+
/* The page's own question of a new project; every other one is the server's. */
|
|
386
|
+
const PARENT_Q={key:'parent',message:'Parent folder',label:'Folder',required:true,chat:"Nice, {name}. Where should it live? I'll create {name}/ inside this folder.",placeholder:'~/dev'};
|
|
387
|
+
const chats={}; // the answers of each flow while the page is open: 'new', or 's<project index>'
|
|
388
|
+
let chat=null,chatBusy=false;
|
|
389
|
+
/* Shown by go(): the chat for a new project, or for the project without .specs/. */
|
|
390
|
+
async function renderChat(isNew){
|
|
391
|
+
const pj=PROJECT,id=isNew?'new':'s'+PROJECT,note=$('#chatNote');
|
|
392
|
+
$('#intro').hidden=$('#thread').hidden=$('#composer').hidden=note.hidden=true;$('#chatRestart').hidden=$('#chatClose').hidden=true;
|
|
393
|
+
chat=null;
|
|
361
394
|
if(!TOKEN){note.textContent='Started with --read-only, so nothing can be set up here.';note.hidden=false;return;}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if(PROJECT!==pj||curView!=='setup')return;
|
|
366
|
-
if(!q)return; // 404: not a folder named on the command line, so no form
|
|
395
|
+
const q=await getQuestions(isNew?'/api/projects/new':'/api/setup?project='+pj);
|
|
396
|
+
if(PROJECT!==pj||curView!==(isNew?'new':'setup'))return;
|
|
397
|
+
if(!q)return; // 404: not a folder named on the command line, so nothing to set up
|
|
367
398
|
if(q.error){note.textContent=q.error;note.hidden=false;return;}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
399
|
+
chat={id,isNew,project:pj,q,st:chats[id]||(chats[id]={answers:{},editing:null,started:false})};
|
|
400
|
+
drawChat();
|
|
401
|
+
}
|
|
402
|
+
const chatList=()=>flowQuestions(chat.q,chat.st.answers,chat.isNew?[{...PARENT_Q,step:chat.q.steps[0]}]:[]);
|
|
403
|
+
/* What fills {name} and {language} in the bot lines. */
|
|
404
|
+
function chatCtx(){
|
|
405
|
+
const a=chat.st.answers,lq=chat.q.questions.find(x=>x.key==='language'),c=lq&&lq.choices.find(x=>x.value===a.language);
|
|
406
|
+
return {name:chat.isNew?a.name:projectLabel(DATA.projects[chat.project]),language:c?c.name:(chat.q.detected?chat.q.detected.language:'')};
|
|
407
|
+
}
|
|
408
|
+
function drawChat(){
|
|
409
|
+
const st=chat.st,isNew=chat.isNew,ctx=chatCtx();
|
|
410
|
+
$('#chatRestart').hidden=!st.started;$('#chatClose').hidden=!isNew;
|
|
411
|
+
$('#title').textContent=isNew?(st.answers.name||'New project'):projectLabel(DATA.projects[chat.project]);
|
|
412
|
+
if(!st.started){ // the intro
|
|
413
|
+
$('#intro').hidden=false;$('#thread').hidden=$('#composer').hidden=true;$('#chatSub').textContent='';$('#barI').style.width='0';$('#v-chat .bar').setAttribute('aria-valuenow','0');
|
|
414
|
+
const mono=t=>`<span class="mono" translate="no">${esc(t)}</span>`;
|
|
415
|
+
$('#introText').innerHTML=isNew?`I'll ask the same questions as ${mono('specpilot init')}, one at a time, then write your ${mono('.specs/')} folder and the files for your AI IDE.`
|
|
416
|
+
:`There is no ${mono('.specs/')} folder in ${mono(DATA.projects[chat.project].root)} yet. I'll ask the same questions as ${mono('specpilot add-specs')}, one at a time, then write it and the files for your AI IDE. Existing files are never changed.`;
|
|
417
|
+
const det=$('#introDetected');det.hidden=!(chat.q.detected);det.textContent=chat.q.detected?chat.q.detected.line:'';
|
|
418
|
+
$('#nameLbl').hidden=$('#nameIn').parentElement.hidden=!isNew;$('#setupStart').hidden=isNew;$('#nameErr').textContent='';
|
|
419
|
+
if(isNew){$('#nameIn').value=st.answers.name||'';$('#nameGo').disabled=!$('#nameIn').value.trim();}
|
|
420
|
+
setTimeout(()=>{if(chat&&!chat.st.started)(isNew?$('#nameIn'):$('#setupStart')).focus();},50);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
$('#intro').hidden=true;$('#thread').hidden=$('#composer').hidden=false;
|
|
424
|
+
const list=chatList(),cur=nextQuestion(list,st.answers,st.editing),steps=[...new Set(list.map(x=>x.step))],done=list.filter(x=>answered(x,st.answers)).length;
|
|
425
|
+
const bar=$('#v-chat .bar'),pct=Math.round(done/list.length*100);$('#barI').style.width=pct+'%';bar.setAttribute('aria-valuenow',pct);
|
|
426
|
+
$('#chatSub').textContent=cur?`Step ${steps.indexOf(cur.step)+1} of ${steps.length} · ${cur.step}`:'Review';
|
|
427
|
+
let html=threadRows(chat.q,list,st.answers,cur,ctx,isNew).map(r=>
|
|
428
|
+
r.kind==='divider'?`<div class="divider"><span>${esc(r.text)}</span></div>`
|
|
429
|
+
:r.kind==='bot'?`<div class="bot"><svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg><div class="msg">${esc(r.text)}<span class="cli" translate="no">${esc(r.cli)}</span></div></div>`
|
|
430
|
+
:`<div class="me${r.skipped?' skipped':''}"><button type="button" class="b${r.mono?' mono':''}" data-k="${esc(r.key)}" aria-label="Your answer: ${esc(r.text)}. Edit">${esc(r.text)}</button><span class="ed" aria-hidden="true">✎ tap to edit</span></div>`).join('');
|
|
431
|
+
if(!cur){
|
|
432
|
+
const files=previewFiles(chat.q,st.answers);
|
|
433
|
+
html+=`<div class="recap"><svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg><div class="card">That's everything I need. Here's a quick recap:<div class="pen">✎ Click any answer to change it. You come straight back here.</div><div class="grid">${recapCards(list,st.answers).map(c=>`<div class="rc"><div class="t">${esc(c.title)}</div>${c.rows.map(r=>`<button type="button" class="l" data-k="${esc(r.key)}"><span>${esc(r.label)}</span><span translate="no">${esc(r.value)}</span></button>`).join('')}</div>`).join('')}</div><details><summary>Files that will be written (${files.length})</summary><ul translate="no">${files.map(f=>`<li>${esc(f.path)}${f.kept?' <span class="kept">Already here, will be kept</span>':''}</li>`).join('')}</ul></details><button type="button" class="btn pri" id="chatCreate">${isNew?'Create Project':'Create .specs/'}</button><p class="err" id="chatErr" role="alert"></p></div></div>`;
|
|
434
|
+
}
|
|
435
|
+
$('#msgs').innerHTML=html;
|
|
436
|
+
drawComposer(cur);
|
|
437
|
+
const th=$('#thread');th.scrollTop=th.scrollHeight;
|
|
438
|
+
}
|
|
439
|
+
function drawComposer(cur){
|
|
440
|
+
const st=chat.st,c=$('#comp'),editing=!!st.editing;
|
|
441
|
+
if(!cur){c.innerHTML=`<div class="act"><span class="hint">All answered. Review above, then ${chat.isNew?'Create Project':'Create .specs/'}.</span></div>`;return;}
|
|
442
|
+
const prev=st.answers[cur.key];
|
|
443
|
+
if(cur.choices){
|
|
444
|
+
const sel=cur.choices.some(x=>x.value===prev)?prev:null;
|
|
445
|
+
c.innerHTML=`<div class="chips" role="group" aria-label="${esc(cur.message)}">${cur.choices.map(o=>{const [b,small]=o.name.split(' — ');return `<button type="button" class="chip" aria-pressed="${o.value===sel}" data-v="${esc(o.value)}"><b>${esc(b)}</b>${small?`<small>${esc(small)}</small>`:''}</button>`;}).join('')}</div><div class="act"><span class="hint">${editing?'Changing an earlier answer':''}</span>${editing?'<button type="button" class="btn" id="chatCancel">Cancel</button>':''}<button type="submit" class="btn pri" id="chatGo"${sel?'':' disabled'}>Continue</button></div>`;
|
|
446
|
+
c.dataset.v=sel||'';
|
|
447
|
+
setTimeout(()=>{const el=$('#comp .chip[aria-pressed="true"]')||$('#comp .chip');if(chat&&el)el.focus();},50);
|
|
448
|
+
}else{
|
|
449
|
+
c.innerHTML=`<div class="crow"><input type="text" id="chatIn" class="${cur.key==='parent'||cur.key==='handle'?'mono':''}" placeholder="${esc(cur.placeholder||'')}" aria-label="${esc(cur.message)}" aria-describedby="compErr" maxlength="${cur.key==='parent'?4096:cur.key==='handle'?39:1000}"${cur.required?' aria-required="true"':''} value="${esc(prev||'')}"></div><div class="act"><span class="hint">${editing?'Changing an earlier answer':''}</span><span class="err" id="compErr" role="alert"></span>${editing?'<button type="button" class="btn" id="chatCancel">Cancel</button>':''}${cur.required?'':'<button type="button" class="btn" id="chatSkip">Skip</button>'}<button type="submit" class="btn pri" id="chatGo">Continue</button></div>`;
|
|
450
|
+
setTimeout(()=>{const el=$('#chatIn');if(chat&&el)el.focus();},50);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/* An answer: stored, and the chat moves on to the first question without one, or back to the recap. */
|
|
454
|
+
function chatAnswer(cur,value){
|
|
455
|
+
chat.st.answers[cur.key]=value;chat.st.editing=null;drawChat();
|
|
456
|
+
}
|
|
457
|
+
function chatEdit(key){
|
|
458
|
+
if(chatBusy)return;
|
|
459
|
+
if(key==='name'){chat.st.started=false;drawChat();return;}
|
|
460
|
+
chat.st.editing=key;drawChat();
|
|
461
|
+
}
|
|
462
|
+
/* The same POST the forms sent: /api/setup for a folder without .specs/, /api/projects/new for a new project. */
|
|
463
|
+
async function chatCreate(){
|
|
464
|
+
if(chatBusy)return;
|
|
465
|
+
const c=chat,st=c.st,root=DATA.projects[c.project].root,btn=$('#chatCreate'),err=$('#chatErr');
|
|
466
|
+
chatBusy=true;btn.disabled=true;err.textContent='';
|
|
467
|
+
const body=flowBody(chatList(),st.answers);if(c.isNew)body.name=st.answers.name;
|
|
392
468
|
let r,res={};
|
|
393
469
|
try{
|
|
394
|
-
r=await fetch('/api/setup?'+
|
|
470
|
+
r=await fetch(c.isNew?'/api/projects/new':'/api/setup?project='+c.project,{method:'POST',cache:'no-store',headers:{'Content-Type':'application/json','X-SpecPilot-Token':TOKEN},body:JSON.stringify(body)});
|
|
395
471
|
res=await r.json().catch(()=>({}));
|
|
396
|
-
}catch(e){
|
|
397
|
-
|
|
398
|
-
if(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if(
|
|
405
|
-
|
|
406
|
-
if(
|
|
407
|
-
|
|
408
|
-
if(r.status===409&&res.specs)await apply(res.specs,null);
|
|
409
|
-
toast(res.error||`Nothing was set up (HTTP ${r.status}).`);
|
|
472
|
+
}catch(e){r=null;}
|
|
473
|
+
chatBusy=false;
|
|
474
|
+
if(chat!==c)return; // the view changed meanwhile
|
|
475
|
+
btn.disabled=false;
|
|
476
|
+
if(!r){err.textContent=c.isNew?'The server did not answer.':'The server did not answer. Nothing was set up.';return;}
|
|
477
|
+
if(c.isNew){
|
|
478
|
+
const o=openOutcome(r.status,res,true);
|
|
479
|
+
if(o.project===null){err.textContent=o.toast;return;}
|
|
480
|
+
if(r.status===200)delete chats[c.id];
|
|
481
|
+
await showOutcome(o);
|
|
482
|
+
if(r.status===200)noteCreated(res);
|
|
483
|
+
return;
|
|
410
484
|
}
|
|
485
|
+
if(r.status!==200&&!(r.status===409&&res.specs)){err.textContent=res.error||`Nothing was set up (HTTP ${r.status}).`;return;}
|
|
486
|
+
delete chats[c.id];
|
|
487
|
+
if(PROJECT!==c.project)return;
|
|
488
|
+
await apply(res.specs,null);
|
|
489
|
+
if(r.status!==200){toast(res.error||`Nothing was set up (HTTP ${r.status}).`);return;}
|
|
490
|
+
toast('.specs/ created in '+root);
|
|
491
|
+
noteCreated(res);
|
|
492
|
+
$('#content').focus();
|
|
411
493
|
}
|
|
494
|
+
$('#introForm').onsubmit=e=>{
|
|
495
|
+
e.preventDefault();if(!chat)return;
|
|
496
|
+
if(chat.isNew){
|
|
497
|
+
const v=$('#nameIn').value.trim(),problem=answerError({key:'name',required:true},v);
|
|
498
|
+
if(problem){$('#nameErr').textContent=problem;$('#nameIn').focus();return;}
|
|
499
|
+
chat.st.answers.name=v;
|
|
500
|
+
}
|
|
501
|
+
chat.st.started=true;chat.st.editing=null;drawChat();
|
|
502
|
+
};
|
|
503
|
+
$('#nameIn').addEventListener('input',()=>{$('#nameGo').disabled=!$('#nameIn').value.trim();$('#nameErr').textContent='';});
|
|
504
|
+
$('#setupStart').onclick=()=>$('#introForm').requestSubmit();
|
|
505
|
+
$('#comp').onsubmit=e=>{
|
|
506
|
+
e.preventDefault();if(!chat||chatBusy)return;
|
|
507
|
+
const cur=nextQuestion(chatList(),chat.st.answers,chat.st.editing);if(!cur)return;
|
|
508
|
+
if(cur.choices){if($('#comp').dataset.v)chatAnswer(cur,$('#comp').dataset.v);return;}
|
|
509
|
+
const v=$('#chatIn').value,problem=answerError(cur,v);
|
|
510
|
+
if(problem){$('#compErr').textContent=problem;$('#chatIn').setAttribute('aria-invalid','true');$('#chatIn').focus();return;}
|
|
511
|
+
chatAnswer(cur,v.trim());
|
|
512
|
+
};
|
|
513
|
+
$('#comp').addEventListener('click',e=>{
|
|
514
|
+
const chip=e.target.closest('.chip');
|
|
515
|
+
if(chip){$$('#comp .chip').forEach(x=>x.setAttribute('aria-pressed',x===chip));$('#comp').dataset.v=chip.dataset.v;$('#chatGo').disabled=false;return;}
|
|
516
|
+
if(e.target.id==='chatSkip'){const cur=nextQuestion(chatList(),chat.st.answers,chat.st.editing);if(cur&&!cur.required)chatAnswer(cur,'');return;}
|
|
517
|
+
if(e.target.id==='chatCancel'){const k=chat.st.editing;chat.st.editing=null;drawChat();const b=$(`#msgs [data-k="${k}"]`);if(b)b.focus();}
|
|
518
|
+
});
|
|
519
|
+
$('#comp').addEventListener('input',e=>{if(e.target.id==='chatIn'){$('#compErr').textContent='';e.target.removeAttribute('aria-invalid');}});
|
|
520
|
+
$('#msgs').addEventListener('click',e=>{
|
|
521
|
+
if(e.target.id==='chatCreate'){chatCreate();return;}
|
|
522
|
+
const b=e.target.closest('[data-k]');if(b)chatEdit(b.dataset.k);
|
|
523
|
+
});
|
|
524
|
+
$('#chatRestart').onclick=()=>{if(!chat||chatBusy)return;chats[chat.id]=chat.st={answers:{},editing:null,started:false};drawChat();};
|
|
525
|
+
$('#chatClose').onclick=()=>{if(!chatBusy)go('home');};
|
|
412
526
|
|
|
413
527
|
/* ---------------- live reload (BL-052) ----------------
|
|
414
528
|
On a change event: re-fetch, redraw in place. Route, scroll, open inspector, selected row
|
|
@@ -450,11 +564,11 @@ async function apply(d,paths){
|
|
|
450
564
|
const key=focusKey(document.activeElement);
|
|
451
565
|
const scroll=$('#content').scrollTop,ib0=insp.querySelector('.ib2'),inspScroll=ib0?ib0.scrollTop:0;
|
|
452
566
|
const was=inspOpen;
|
|
453
|
-
const hadSpecs
|
|
567
|
+
const hadSpecs=!(DATA&&DATA.project.specs===false);
|
|
454
568
|
DATA=d;
|
|
455
569
|
renderProject();renderTasks();renderIde();renderAgentFiles();
|
|
456
|
-
|
|
457
|
-
if(
|
|
570
|
+
const to=reloadView(curView,hadSpecs,d.project.specs!==false); // .specs/ gone: offer setup; appeared another way: Tasks; Home stays
|
|
571
|
+
if(to){go(to);return;}
|
|
458
572
|
if(curView==='file')await renderFile(curFile);
|
|
459
573
|
if(curView==='explorer')renderExplorer();
|
|
460
574
|
if(curView==='security')await renderSecurity();
|
|
@@ -485,12 +599,132 @@ async function switchProject(n,keepRoute){
|
|
|
485
599
|
try{const r=await fetch('/api/specs?'+pq(),{cache:'no-store'});if(!r.ok)throw new Error('/api/specs: HTTP '+r.status);d=await r.json();}
|
|
486
600
|
catch(e){if(PROJECT===n)PROJECT=was;toast('Could not load the project: '+e.message);return;}
|
|
487
601
|
if(PROJECT!==n)return;
|
|
602
|
+
showProject(d,keepRoute);
|
|
603
|
+
}
|
|
604
|
+
/* Draw project PROJECT from payload d: the tail of a switch, also used with the payload an open returns (BL-067). */
|
|
605
|
+
function showProject(d,keepRoute){
|
|
488
606
|
Object.keys(fileCache).forEach(k=>{delete fileCache[k];});secShown.clear();
|
|
489
607
|
DATA=d;selected=null;
|
|
490
608
|
renderProject();renderTasks();renderIde();renderAgentFiles();listen();
|
|
491
609
|
if(keepRoute)route();else go('board');
|
|
492
610
|
}
|
|
493
|
-
$('#projList').addEventListener('click',e=>{const b=e.target.closest('[data-project]');if(b
|
|
611
|
+
$('#projList').addEventListener('click',e=>{const b=e.target.closest('[data-project]');if(!b)return;
|
|
612
|
+
if(+b.dataset.project!==PROJECT)switchProject(+b.dataset.project);else if(NOPROJ.includes(curView))go('board');});
|
|
613
|
+
|
|
614
|
+
/* ---------------- open a project (BL-067) ----------------
|
|
615
|
+
The + tile opens the mockup's sheet on its Folder tab. The list is GET /api/projects; opening is
|
|
616
|
+
POST /api/projects, which serves one more folder and remembers it; Remove from list edits the
|
|
617
|
+
registry only. A new project (BL-PM-003) starts in the setup chat above since BL-PM-004. The Clone tab
|
|
618
|
+
(BL-PM-002) POSTs /api/projects/clone, which runs git clone and opens the folder; closing the sheet
|
|
619
|
+
meanwhile aborts the request, and the server then removes what was downloaded. Nothing here is
|
|
620
|
+
file content; the strings are the ones REQ-002.H.21, H.24 and H.26 list. */
|
|
621
|
+
const openVeil=$('#openVeil'),addBtn=$('#addBtn'),pathIn=$('#pathIn');
|
|
622
|
+
const TABS=['folder','clone'],GO={folder:'Open',clone:'Clone Repository'};
|
|
623
|
+
let openBusy=false,sheetFrom=addBtn,sheetTab='folder',cloneCtl=null,cloneNamed=false,cloneTick=null;
|
|
624
|
+
if(TOKEN){addBtn.hidden=false;homeBtn.hidden=false;$('#rail>.logo').remove();} // the Home tile takes the logo's place (BL-PM-001)
|
|
625
|
+
function openSheet(from,tab){
|
|
626
|
+
hideTip();sheetFrom=from;openVeil.classList.add('open');
|
|
627
|
+
$$('#openForm .field input').forEach(el=>{el.value='';});cloneNamed=false;
|
|
628
|
+
setTab(tab||'folder');setTimeout(()=>(sheetTab==='clone'?$('#cloneIn'):pathIn).focus(),50);
|
|
629
|
+
}
|
|
630
|
+
function setTab(t){
|
|
631
|
+
sheetTab=t;
|
|
632
|
+
$$('#openTabs button').forEach(b=>{const on=b.dataset.t===t;b.classList.toggle('on',on);b.setAttribute('aria-selected',on);b.tabIndex=on?0:-1;});
|
|
633
|
+
$('#paneFolder').hidden=t!=='folder';$('#paneClone').hidden=t!=='clone';
|
|
634
|
+
$('#openGo').textContent=GO[t];
|
|
635
|
+
if(t==='folder')loadRecent();
|
|
636
|
+
}
|
|
637
|
+
function closeSheet(){if(!openVeil.classList.contains('open'))return;if(cloneCtl)cloneCtl.abort();openVeil.classList.remove('open');sheetFrom.focus();}
|
|
638
|
+
/* The registry as GET /api/projects sends it: in the sheet, or on Home (BL-PM-001), where a row opens
|
|
639
|
+
its folder at once, has no Remove, and a served project also shows the branch the rail tooltip shows. */
|
|
640
|
+
function drawRecent(reg,home){
|
|
641
|
+
$(home?'#homePath':'#recentPath').textContent=reg.path||'';
|
|
642
|
+
$(home?'#homeBox':'#recentBox').innerHTML=recentHtml(reg,home,DATA?DATA.projects:[],chev);
|
|
643
|
+
}
|
|
644
|
+
async function loadRecent(){
|
|
645
|
+
let reg;
|
|
646
|
+
try{const r=await fetch('/api/projects',{cache:'no-store'});reg=r.ok?await r.json():{error:'HTTP '+r.status,entries:[]};}
|
|
647
|
+
catch(e){reg={error:'The server did not answer.',entries:[]};}
|
|
648
|
+
if(openVeil.classList.contains('open'))drawRecent(reg);
|
|
649
|
+
if(curView==='home')drawRecent(reg,true);
|
|
650
|
+
}
|
|
651
|
+
async function postPath(path,url){
|
|
652
|
+
const r=await fetch(url,{method:'POST',cache:'no-store',headers:{'Content-Type':'application/json','X-SpecPilot-Token':TOKEN},body:JSON.stringify({path})});
|
|
653
|
+
return {r,res:await r.json().catch(()=>({}))};
|
|
654
|
+
}
|
|
655
|
+
/* Open a folder: the sheet's Open, and a row on Home. */
|
|
656
|
+
async function openPath(path){
|
|
657
|
+
if(!path||openBusy)return;
|
|
658
|
+
openBusy=true;$('#openGo').disabled=true;
|
|
659
|
+
let out;
|
|
660
|
+
try{out=await postPath(path,'/api/projects');}
|
|
661
|
+
catch(e){openBusy=false;$('#openGo').disabled=false;toast('The server did not answer.');return;}
|
|
662
|
+
openBusy=false;$('#openGo').disabled=false;
|
|
663
|
+
await showOutcome(openOutcome(out.r.status,out.res));
|
|
664
|
+
}
|
|
665
|
+
/* Act on an answer to an open or a create (openOutcome()): show the project, or stay and say why. */
|
|
666
|
+
async function showOutcome(o){
|
|
667
|
+
const wasHome=NOPROJ.includes(curView);
|
|
668
|
+
if(o.project===null){toast(o.toast);return;} // refused: the page stays where it is
|
|
669
|
+
closeSheet();
|
|
670
|
+
if(o.specs){PROJECT=o.project;showProject(o.specs,false);}
|
|
671
|
+
else if(o.project!==PROJECT)await switchProject(o.project);
|
|
672
|
+
else if(wasHome)go('board');
|
|
673
|
+
toast(o.toast);
|
|
674
|
+
if(wasHome)$('#content').focus(); // Home is gone from the screen: focus goes to the project's view, not to a hidden control
|
|
675
|
+
}
|
|
676
|
+
/* Clone a repository: the Clone tab's Clone Repository. Minutes can pass; only the button says so. */
|
|
677
|
+
function setCloning(ctl){
|
|
678
|
+
cloneCtl=ctl;openBusy=!!ctl;
|
|
679
|
+
$('#openGo').disabled=!!ctl;
|
|
680
|
+
$$('#paneClone input, #openTabs button').forEach(el=>{el.disabled=!!ctl;});
|
|
681
|
+
// An indeterminate bar and the time since the click: the page knows nothing else about a running clone.
|
|
682
|
+
clearInterval(cloneTick);cloneTick=null;$('#cloneStatus').hidden=!ctl;
|
|
683
|
+
if(!ctl)return;
|
|
684
|
+
const t0=Date.now(),tick=()=>{const s=Math.floor((Date.now()-t0)/1000);$('#cloneTime').textContent=`Cloning… ${Math.floor(s/60)}:${String(s%60).padStart(2,'0')}`;};
|
|
685
|
+
tick();cloneTick=setInterval(tick,1000);
|
|
686
|
+
}
|
|
687
|
+
async function cloneRepo(){
|
|
688
|
+
if(openBusy)return;
|
|
689
|
+
const body={url:$('#cloneIn').value.trim(),parent:$('#cloneParentIn').value.trim(),name:$('#cloneNameIn').value.trim()};
|
|
690
|
+
const ctl=new AbortController();setCloning(ctl);
|
|
691
|
+
let r,res={};
|
|
692
|
+
try{
|
|
693
|
+
r=await fetch('/api/projects/clone',{method:'POST',cache:'no-store',signal:ctl.signal,headers:{'Content-Type':'application/json','X-SpecPilot-Token':TOKEN},body:JSON.stringify(body)});
|
|
694
|
+
res=await r.json().catch(()=>({}));
|
|
695
|
+
}catch(e){setCloning(null);if(!ctl.signal.aborted)toast('The server did not answer.');return;}
|
|
696
|
+
setCloning(null);
|
|
697
|
+
if(ctl.signal.aborted)return; // the sheet was closed: the server removes the clone
|
|
698
|
+
await showOutcome(openOutcome(r.status,res,'cloned'));
|
|
699
|
+
}
|
|
700
|
+
async function removeRecent(path){
|
|
701
|
+
let out;
|
|
702
|
+
try{out=await postPath(path,'/api/projects/remove');}catch(e){toast('The server did not answer.');return;}
|
|
703
|
+
if(out.r.status===200){drawRecent(out.res);if(curView==='home')drawRecent(out.res,true);}else toast(out.res.error||`Nothing was removed (HTTP ${out.r.status}).`);
|
|
704
|
+
}
|
|
705
|
+
addBtn.onclick=()=>openSheet(addBtn);
|
|
706
|
+
homeBtn.onclick=()=>go('home');
|
|
707
|
+
$('#homeOpen').onclick=e=>openSheet(e.currentTarget);
|
|
708
|
+
$('#homeNew').onclick=()=>go('new');
|
|
709
|
+
$('#homeClone').onclick=e=>openSheet(e.currentTarget,'clone');
|
|
710
|
+
/* Folder name follows the URL (the server's own rule, route.js) until the user types a name. */
|
|
711
|
+
$('#cloneIn').addEventListener('input',e=>{if(!cloneNamed)$('#cloneNameIn').value=repoNameFromUrl(e.target.value.trim());});
|
|
712
|
+
$('#cloneNameIn').addEventListener('input',()=>{cloneNamed=true;});
|
|
713
|
+
$('#openTabs').addEventListener('click',e=>{const b=e.target.closest('[data-t]');if(b&&b.dataset.t!==sheetTab)setTab(b.dataset.t);});
|
|
714
|
+
$('#openTabs').addEventListener('keydown',e=>{
|
|
715
|
+
if(!['ArrowLeft','ArrowRight','Home','End'].includes(e.key))return;
|
|
716
|
+
e.preventDefault();const n=TABS.length,i=TABS.indexOf(sheetTab),t=TABS[e.key==='Home'?0:e.key==='End'?n-1:(i+(e.key==='ArrowLeft'?n-1:1))%n];
|
|
717
|
+
setTab(t);$(`#openTabs [data-t="${t}"]`).focus();
|
|
718
|
+
});
|
|
719
|
+
$('#homeBox').addEventListener('click',e=>{const row=e.target.closest('[data-path]');if(row)openPath(row.dataset.path);});
|
|
720
|
+
$('#openCancel').onclick=closeSheet;
|
|
721
|
+
openVeil.onclick=e=>{if(e.target===openVeil)closeSheet();};
|
|
722
|
+
$('#openForm').onsubmit=e=>{e.preventDefault();if(sheetTab==='clone')cloneRepo();else openPath(pathIn.value.trim());};
|
|
723
|
+
$('#recentBox').addEventListener('click',e=>{
|
|
724
|
+
const rm=e.target.closest('[data-remove]');if(rm){removeRecent(rm.dataset.remove);return;}
|
|
725
|
+
const row=e.target.closest('[data-path]');if(row){pathIn.value=row.dataset.path;pathIn.focus();}
|
|
726
|
+
});
|
|
727
|
+
$('#recentBox').addEventListener('keydown',e=>{const row=e.target.closest&&e.target.closest('[data-path]');if(row&&(e.key==='Enter'||e.key===' ')){e.preventDefault();pathIn.value=row.dataset.path;pathIn.focus();}});
|
|
494
728
|
|
|
495
729
|
/* boot: the project count is unknown until the first load, so an index past the end falls back to project 0 */
|
|
496
730
|
insp.setAttribute('aria-hidden','true');
|
package/ui/index.html
CHANGED
|
@@ -69,8 +69,10 @@
|
|
|
69
69
|
<div class="win" id="win">
|
|
70
70
|
<nav class="rail" id="rail" aria-label="Projects">
|
|
71
71
|
<svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
|
|
72
|
+
<button class="tile home" id="homeBtn" aria-label="Home" aria-keyshortcuts="h" data-tip="Home" hidden><svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg></button>
|
|
72
73
|
<div class="rsep" aria-hidden="true"></div>
|
|
73
74
|
<div class="rlist" id="projList" role="group" aria-label="Open projects"></div>
|
|
75
|
+
<button class="tile act" id="addBtn" aria-label="Add a project" data-tip="Add a project" hidden><svg aria-hidden="true" focusable="false"><use href="#i-plus"/></svg></button>
|
|
74
76
|
<div class="rfoot">
|
|
75
77
|
<button class="tile ghost" id="themeBtn" aria-label="Switch between light and dark" data-tip="Light / dark"><svg aria-hidden="true" focusable="false"><use href="#i-sun"/></svg></button>
|
|
76
78
|
</div>
|
|
@@ -106,14 +108,31 @@
|
|
|
106
108
|
<main class="pane">
|
|
107
109
|
<div class="tb">
|
|
108
110
|
<button class="ib menu" id="menuBtn" aria-label="Show sidebar"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-menu"/></svg></button>
|
|
109
|
-
<div><h1 id="title">Tasks</h1><div class="sub"><span id="subName" translate="no"></span><span class="mono" id="subPath" translate="no"></span></div></div>
|
|
111
|
+
<div><h1 id="title">Tasks</h1><div class="sub"><span id="subName" translate="no"></span><span class="mono" id="subPath" translate="no"></span><span id="chatSub" aria-live="polite" hidden></span></div></div>
|
|
110
112
|
<div class="right">
|
|
111
113
|
<div class="seg" id="modeSeg"><button class="on" data-m="list">List</button><button data-m="board">Board</button></div>
|
|
114
|
+
<button type="button" class="btn" id="chatRestart" hidden>Start over</button><button type="button" class="btn" id="chatClose" hidden>Close</button>
|
|
112
115
|
</div>
|
|
113
116
|
</div>
|
|
114
|
-
<div class="content" id="content">
|
|
117
|
+
<div class="content" id="content" tabindex="-1">
|
|
115
118
|
<p class="note" id="loadErr" hidden></p>
|
|
116
119
|
|
|
120
|
+
<!-- HOME (BL-PM-001): the mockup's #s-welcome column, cut down to what is built and true today -->
|
|
121
|
+
<section class="view welcome" id="v-home" aria-labelledby="wTitle">
|
|
122
|
+
<svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
|
|
123
|
+
<div><h1 id="wTitle">Your specs, as a board.</h1><p class="lead">SpecPilot reads the <span class="mono" translate="no">.specs/</span> folder of any project on this machine and shows its tasks and spec files as they are written. Your AI IDE keeps doing the coding.</p></div>
|
|
124
|
+
<div class="cta">
|
|
125
|
+
<button type="button" class="btn pri big" id="homeOpen">Open a Project Folder</button>
|
|
126
|
+
<div class="alt"><button type="button" class="btn line" id="homeNew">Start a New Project</button><button type="button" class="btn line" id="homeClone">Clone a Repository</button></div>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="gl benefits"><div class="box">
|
|
129
|
+
<div class="row"><span class="ic2"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-folder"/></svg></span><div class="body"><div class="ttl">Files are the truth</div><div class="det">Every view is read from <span class="mono" translate="no">.specs/</span> and git. Every action writes a file you could have edited by hand.</div></div></div>
|
|
130
|
+
<div class="row"><span class="ic2"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-shield"/></svg></span><div class="body"><div class="ttl">Nothing leaves this machine</div><div class="det">Runs on localhost, no account, no telemetry. No <span class="mono" translate="no">.specs/</span> yet? The guided setup writes one for you.</div></div></div>
|
|
131
|
+
</div></div>
|
|
132
|
+
<div class="gl recents"><div class="gh">Recent projects <span class="cnt" id="homePath" translate="no"></span></div><div class="box" id="homeBox"></div></div>
|
|
133
|
+
<div class="fine"><i aria-hidden="true"></i><span>Server running on <span class="mono" id="homeAddr" translate="no"></span> · <span id="homeVer" translate="no"></span></span></div>
|
|
134
|
+
</section>
|
|
135
|
+
|
|
117
136
|
<!-- TASKS: the rows of planning/tasks.md, from readSpecs() -->
|
|
118
137
|
<section class="view on" id="v-board">
|
|
119
138
|
<div id="listMode">
|
|
@@ -137,12 +156,24 @@
|
|
|
137
156
|
<div id="secBody"></div>
|
|
138
157
|
</section>
|
|
139
158
|
|
|
140
|
-
<!-- SETUP (BL-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
<
|
|
145
|
-
<
|
|
159
|
+
<!-- SETUP CHAT (BL-PM-004): the init.specpilot.dev chat over the CLI's own questions; shown for a new project
|
|
160
|
+
(#new) and for a named folder with no .specs/ yet (BL-055). The questions, their chat lines and choices come from the server -->
|
|
161
|
+
<section class="view chat" id="v-chat">
|
|
162
|
+
<div class="bar" role="progressbar" aria-label="Setup progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i id="barI"></i></div>
|
|
163
|
+
<p class="note" id="chatNote" hidden></p>
|
|
164
|
+
<section class="intro" id="intro" hidden>
|
|
165
|
+
<svg class="big" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
|
|
166
|
+
<div><h2>Hey, I'm SpecPilot</h2><p id="introText"></p><p class="note" id="introDetected" hidden translate="no"></p></div>
|
|
167
|
+
<div class="fine">Runs on this machine. Nothing leaves it.</div>
|
|
168
|
+
<form class="start" id="introForm" autocomplete="off">
|
|
169
|
+
<div class="lbl" id="nameLbl">Name your project to start</div>
|
|
170
|
+
<div class="row"><input class="cfield mono" id="nameIn" name="project-name" type="text" placeholder="e.g. parcel-track" spellcheck="false" maxlength="214" aria-labelledby="nameLbl" aria-describedby="nameErr"><button type="submit" class="send" id="nameGo" aria-label="Start">→</button></div>
|
|
171
|
+
<div class="err" id="nameErr" role="alert"></div>
|
|
172
|
+
<button type="button" class="btn pri" id="setupStart" hidden>Start Guided Setup</button>
|
|
173
|
+
</form>
|
|
174
|
+
</section>
|
|
175
|
+
<section class="thread" id="thread" hidden><div class="col" id="msgs"></div></section>
|
|
176
|
+
<section class="composer" id="composer" hidden><form class="col" id="comp" autocomplete="off"></form></section>
|
|
146
177
|
</section>
|
|
147
178
|
|
|
148
179
|
<!-- FILE: any .specs/ file, rendered as written -->
|
|
@@ -174,6 +205,27 @@
|
|
|
174
205
|
</main>
|
|
175
206
|
</div>
|
|
176
207
|
|
|
208
|
+
<!-- OPEN A PROJECT (BL-067): the mockup's sheet; the Folder tab lists GET /api/projects, the Clone tab (BL-PM-002) runs git clone -->
|
|
209
|
+
<div class="veil" id="openVeil"><div class="sheet" role="dialog" aria-modal="true" aria-labelledby="openTitle" tabindex="-1">
|
|
210
|
+
<div class="sh"><div><h2 id="openTitle">Open a Project</h2><p>SpecPilot reads the folder on this machine. Nothing is uploaded.</p></div></div>
|
|
211
|
+
<form class="sb" id="openForm" autocomplete="off">
|
|
212
|
+
<div class="tabs" id="openTabs" role="tablist" aria-labelledby="openTitle"><button type="button" class="on" role="tab" id="tabFolder" data-t="folder" aria-controls="paneFolder" aria-selected="true">Folder</button><button type="button" role="tab" id="tabClone" data-t="clone" aria-controls="paneClone" aria-selected="false" tabindex="-1">Clone</button></div>
|
|
213
|
+
<div class="pane" id="paneFolder" role="tabpanel" aria-labelledby="tabFolder">
|
|
214
|
+
<div class="gl"><div class="box"><div class="field"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-folder"/></svg><input id="pathIn" name="folder-path" type="text" spellcheck="false" aria-label="Folder path" placeholder="/path/to/project or ~/project"></div></div></div>
|
|
215
|
+
<div class="gl"><div class="gh">Recent projects <span class="cnt" id="recentPath" translate="no"></span></div><div class="box" id="recentBox"></div></div>
|
|
216
|
+
</div>
|
|
217
|
+
<div class="pane" id="paneClone" role="tabpanel" aria-labelledby="tabClone" hidden>
|
|
218
|
+
<p class="note">Runs git clone on this machine, then opens the folder. Submodules are not cloned.</p>
|
|
219
|
+
<div class="gl"><div class="box">
|
|
220
|
+
<div class="field"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-git"/></svg><input id="cloneIn" name="repo-url" type="text" inputmode="url" spellcheck="false" aria-label="Repository URL" placeholder="https://github.com/owner/repo.git or git@github.com:owner/repo.git" maxlength="2048"></div>
|
|
221
|
+
<div class="field"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-folder"/></svg><input id="cloneParentIn" name="clone-parent" type="text" spellcheck="false" aria-label="Parent folder" placeholder="/path/to/folder or ~/folder"></div>
|
|
222
|
+
<div class="field"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-plus"/></svg><input id="cloneNameIn" name="clone-name" type="text" spellcheck="false" aria-label="Folder name" placeholder="the repository's name" maxlength="214"></div>
|
|
223
|
+
</div></div>
|
|
224
|
+
</div>
|
|
225
|
+
</form>
|
|
226
|
+
<div class="sf"><span class="cloning" id="cloneStatus" hidden><span class="bar" role="progressbar" aria-label="Cloning"></span><span id="cloneTime">Cloning… 0:00</span></span><button type="button" class="btn" id="openCancel">Cancel</button><button type="submit" class="btn pri" id="openGo" form="openForm">Open</button></div>
|
|
227
|
+
</div></div>
|
|
228
|
+
|
|
177
229
|
<!-- PALETTE -->
|
|
178
230
|
<div class="veil pal-veil" id="palVeil"><div class="pal"><input id="palIn" type="search" name="q" aria-label="Search views, spec files and tasks" placeholder="Jump to a view, spec file or task…" autocomplete="off" spellcheck="false"><ul id="palList"></ul></div></div>
|
|
179
231
|
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|