specpilot 2.8.0 → 2.10.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 +4 -2
- package/dist/commands/add-specs.d.ts.map +1 -1
- package/dist/commands/add-specs.js +1 -3
- package/dist/commands/add-specs.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +32 -95
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/refine.d.ts.map +1 -1
- package/dist/commands/refine.js +1 -3
- package/dist/commands/refine.js.map +1 -1
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +29 -3
- package/dist/commands/serve.js.map +1 -1
- package/dist/core/agentConfig.d.ts +9 -0
- package/dist/core/agentConfig.d.ts.map +1 -0
- package/dist/{utils/agentConfigGenerator.js → core/agentConfig.js} +29 -44
- package/dist/core/agentConfig.js.map +1 -0
- package/dist/core/ideConfig.d.ts +35 -0
- package/dist/core/ideConfig.d.ts.map +1 -0
- package/dist/core/ideConfig.js +287 -0
- package/dist/core/ideConfig.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/render.d.ts +73 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +99 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/slashCommands.d.ts +23 -0
- package/dist/core/slashCommands.d.ts.map +1 -0
- package/dist/core/slashCommands.js +524 -0
- package/dist/core/slashCommands.js.map +1 -0
- package/dist/core/specFiles.d.ts +18 -0
- package/dist/core/specFiles.d.ts.map +1 -0
- package/dist/{utils/specFileGenerator.js → core/specFiles.js} +223 -127
- package/dist/core/specFiles.js.map +1 -0
- package/dist/core/templateEngine.d.ts +69 -0
- package/dist/core/templateEngine.d.ts.map +1 -0
- package/dist/{utils → core}/templateEngine.js +108 -6
- package/dist/core/templateEngine.js.map +1 -0
- 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/ideConfigGenerator.d.ts +5 -29
- package/dist/utils/ideConfigGenerator.d.ts.map +1 -1
- package/dist/utils/ideConfigGenerator.js +9 -282
- package/dist/utils/ideConfigGenerator.js.map +1 -1
- 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 +2 -0
- package/dist/utils/projectRegistry.d.ts.map +1 -1
- package/dist/utils/projectRegistry.js +4 -2
- package/dist/utils/projectRegistry.js.map +1 -1
- package/dist/utils/slashCommandGenerator.d.ts +3 -17
- package/dist/utils/slashCommandGenerator.d.ts.map +1 -1
- package/dist/utils/slashCommandGenerator.js +8 -514
- package/dist/utils/slashCommandGenerator.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +16 -46
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +36 -62
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specServer.d.ts +5 -1
- package/dist/utils/specServer.d.ts.map +1 -1
- package/dist/utils/specServer.js +179 -27
- 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 +228 -21
- package/dist/utils/specSetup.js.map +1 -1
- package/package.json +1 -1
- package/ui/app.css +94 -11
- package/ui/app.js +232 -74
- package/ui/index.html +39 -12
- package/ui/route.js +144 -11
- package/dist/utils/agentConfigGenerator.d.ts +0 -17
- package/dist/utils/agentConfigGenerator.d.ts.map +0 -1
- package/dist/utils/agentConfigGenerator.js.map +0 -1
- package/dist/utils/specFileGenerator.d.ts +0 -29
- package/dist/utils/specFileGenerator.d.ts.map +0 -1
- package/dist/utils/specFileGenerator.js.map +0 -1
- package/dist/utils/templateEngine.d.ts +0 -35
- package/dist/utils/templateEngine.d.ts.map +0 -1
- package/dist/utils/templateEngine.js.map +0 -1
package/ui/app.js
CHANGED
|
@@ -42,8 +42,8 @@ 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||'';
|
|
@@ -54,7 +54,8 @@ function renderProject(){
|
|
|
54
54
|
|
|
55
55
|
/* ---------------- views ---------------- */
|
|
56
56
|
const homeBtn=$('#homeBtn');
|
|
57
|
-
const VIEWS={board:'Tasks',explorer:'Explorer',security:'Security',instructions:'Instructions',commands:'Commands',skills:'Skills',setup:'',home:''};
|
|
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)
|
|
58
59
|
const TITLES={'planning/roadmap.md':'Roadmap','project/requirements.md':'Requirements','architecture/architecture.md':'Architecture','quality/tests.md':'Tests'};
|
|
59
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']];
|
|
60
61
|
let curView='board',curFile='';
|
|
@@ -63,25 +64,27 @@ function syncNav(){
|
|
|
63
64
|
const on=b.dataset.v==='file'?(curView==='file'&&b.dataset.f===curFile):(b.dataset.v===curView);
|
|
64
65
|
b.classList.toggle('on',on);b.setAttribute('aria-current',on?'page':'false');});
|
|
65
66
|
/* the rail: on Home (BL-PM-001) the Home tile is the current one and no project tile is */
|
|
66
|
-
const home=curView==='home';
|
|
67
|
-
[homeBtn,...$$('#projList .tile')].forEach(t=>{const cur=t===homeBtn?home:!
|
|
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;
|
|
68
69
|
t.classList.toggle('cur',cur);if(cur)t.setAttribute('aria-current','true');else t.removeAttribute('aria-current');});
|
|
69
70
|
}
|
|
70
71
|
function go(v,keep,sub){
|
|
71
72
|
if(v==='file'){if(!DATA||!sub)v='board';else curFile=sub;}
|
|
72
|
-
else if(v
|
|
73
|
+
else if(NOPROJ.includes(v)){if(!TOKEN)v='board';} // no Home and no new-project chat with --read-only
|
|
73
74
|
else if(!VIEWS[v]||v==='setup')v='board';
|
|
74
|
-
if(v
|
|
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)
|
|
75
76
|
curView=v;
|
|
76
|
-
$('#win').classList.toggle('home',v==='home');
|
|
77
|
-
$$('.content>.view').forEach(e=>e.classList.toggle('on',e.id==='v-'+v));
|
|
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)
|
|
78
79
|
syncNav();
|
|
79
|
-
$('#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;}
|
|
80
82
|
$('#modeSeg').hidden=v!=='board';
|
|
81
83
|
setNav(false);closeInsp();
|
|
82
84
|
if(v!=='file'||sub!==fileNoteFor)clearFileNote();
|
|
83
85
|
if(v==='home')loadRecent();
|
|
84
|
-
if(v==='setup')
|
|
86
|
+
if(v==='setup')renderChat(false);
|
|
87
|
+
if(v==='new')renderChat(true);
|
|
85
88
|
if(v==='file')renderFile(sub);
|
|
86
89
|
if(v==='explorer')renderExplorer();
|
|
87
90
|
if(v==='security')renderSecurity();
|
|
@@ -94,12 +97,12 @@ let urlOk=true,memHash='';
|
|
|
94
97
|
try{history.replaceState(null,'',location.href);}catch(e){urlOk=false;}
|
|
95
98
|
try{memHash=location.hash;}catch(e){memHash='';}
|
|
96
99
|
function curHash(){if(!urlOk)return memHash;try{return location.hash;}catch(e){return memHash;}}
|
|
97
|
-
function setHash(v,sub){const h='#'+(PROJECT
|
|
100
|
+
function setHash(v,sub){const h='#'+(PROJECT&&!NOPROJ.includes(v)?PROJECT+'/':'')+v+(sub?'/'+sub:'');if(curHash()===h)return;memHash=h;
|
|
98
101
|
if(!urlOk)return;
|
|
99
102
|
try{history.replaceState(null,'',h);}catch(e){urlOk=false;}}
|
|
100
103
|
function route(){
|
|
101
104
|
const r=resolveRoute(curHash(),DATA?DATA.files:{},DATA?DATA.projects.length:1,!!TOKEN);
|
|
102
|
-
if(r.view
|
|
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
|
|
103
106
|
if(r.project!==PROJECT){switchProject(r.project,true);return;}
|
|
104
107
|
if(r.view==='board'&&r.sub==='board'){mode='board';$$('#modeSeg button').forEach(x=>x.classList.toggle('on',x.dataset.m==='board'));renderTasks();}
|
|
105
108
|
go(r.view,true,r.sub);
|
|
@@ -297,7 +300,7 @@ document.addEventListener('keydown',e=>{
|
|
|
297
300
|
const mod=e.metaKey||e.ctrlKey;const inField=/INPUT|SELECT|TEXTAREA/.test(e.target.tagName);
|
|
298
301
|
if(mod&&e.key.toLowerCase()==='k'){e.preventDefault();palVeil.classList.contains('open')?closePal():openPal();return}
|
|
299
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}
|
|
300
|
-
if(e.key==='Escape'){hideTip();closeInsp();closePal();closeSheet();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}
|
|
301
304
|
if(inField||mod||e.altKey)return;
|
|
302
305
|
if(e.key==='h'&&TOKEN&&!openVeil.classList.contains('open')){go('home');return;}
|
|
303
306
|
if(/^[1-9]$/.test(e.key)){const n=NAV[+e.key-1];if(n)go(n[0],false,n[1]);}
|
|
@@ -359,66 +362,167 @@ async function move(col,i,toSection,toIndex,isUndo){
|
|
|
359
362
|
}else toast(body.error||`The move was not made (HTTP ${r.status}).`);
|
|
360
363
|
}
|
|
361
364
|
|
|
362
|
-
/* ----------------
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
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;
|
|
366
371
|
function clearFileNote(){const n=$('#fileNote');n.hidden=true;n.innerHTML='';fileNoteFor=null;}
|
|
367
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;}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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;
|
|
371
394
|
if(!TOKEN){note.textContent='Started with --read-only, so nothing can be set up here.';note.hidden=false;return;}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if(PROJECT!==pj||curView!=='setup')return;
|
|
376
|
-
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
|
|
377
398
|
if(q.error){note.textContent=q.error;note.hidden=false;return;}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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;
|
|
402
468
|
let r,res={};
|
|
403
469
|
try{
|
|
404
|
-
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)});
|
|
405
471
|
res=await r.json().catch(()=>({}));
|
|
406
|
-
}catch(e){
|
|
407
|
-
|
|
408
|
-
if(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
if(
|
|
415
|
-
|
|
416
|
-
if(
|
|
417
|
-
|
|
418
|
-
if(r.status===409&&res.specs)await apply(res.specs,null);
|
|
419
|
-
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;
|
|
420
484
|
}
|
|
421
|
-
}
|
|
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();
|
|
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');};
|
|
422
526
|
|
|
423
527
|
/* ---------------- live reload (BL-052) ----------------
|
|
424
528
|
On a change event: re-fetch, redraw in place. Route, scroll, open inspector, selected row
|
|
@@ -505,17 +609,32 @@ function showProject(d,keepRoute){
|
|
|
505
609
|
if(keepRoute)route();else go('board');
|
|
506
610
|
}
|
|
507
611
|
$('#projList').addEventListener('click',e=>{const b=e.target.closest('[data-project]');if(!b)return;
|
|
508
|
-
if(+b.dataset.project!==PROJECT)switchProject(+b.dataset.project);else if(curView
|
|
612
|
+
if(+b.dataset.project!==PROJECT)switchProject(+b.dataset.project);else if(NOPROJ.includes(curView))go('board');});
|
|
509
613
|
|
|
510
614
|
/* ---------------- open a project (BL-067) ----------------
|
|
511
|
-
The + tile opens the mockup's sheet
|
|
615
|
+
The + tile opens the mockup's sheet on its Folder tab. The list is GET /api/projects; opening is
|
|
512
616
|
POST /api/projects, which serves one more folder and remembers it; Remove from list edits the
|
|
513
|
-
registry only.
|
|
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. */
|
|
514
621
|
const openVeil=$('#openVeil'),addBtn=$('#addBtn'),pathIn=$('#pathIn');
|
|
515
|
-
|
|
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;
|
|
516
624
|
if(TOKEN){addBtn.hidden=false;homeBtn.hidden=false;$('#rail>.logo').remove();} // the Home tile takes the logo's place (BL-PM-001)
|
|
517
|
-
function openSheet(from){
|
|
518
|
-
|
|
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();}
|
|
519
638
|
/* The registry as GET /api/projects sends it: in the sheet, or on Home (BL-PM-001), where a row opens
|
|
520
639
|
its folder at once, has no Remove, and a served project also shows the branch the rail tooltip shows. */
|
|
521
640
|
function drawRecent(reg,home){
|
|
@@ -541,7 +660,11 @@ async function openPath(path){
|
|
|
541
660
|
try{out=await postPath(path,'/api/projects');}
|
|
542
661
|
catch(e){openBusy=false;$('#openGo').disabled=false;toast('The server did not answer.');return;}
|
|
543
662
|
openBusy=false;$('#openGo').disabled=false;
|
|
544
|
-
|
|
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);
|
|
545
668
|
if(o.project===null){toast(o.toast);return;} // refused: the page stays where it is
|
|
546
669
|
closeSheet();
|
|
547
670
|
if(o.specs){PROJECT=o.project;showProject(o.specs,false);}
|
|
@@ -550,6 +673,30 @@ async function openPath(path){
|
|
|
550
673
|
toast(o.toast);
|
|
551
674
|
if(wasHome)$('#content').focus(); // Home is gone from the screen: focus goes to the project's view, not to a hidden control
|
|
552
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
|
+
}
|
|
553
700
|
async function removeRecent(path){
|
|
554
701
|
let out;
|
|
555
702
|
try{out=await postPath(path,'/api/projects/remove');}catch(e){toast('The server did not answer.');return;}
|
|
@@ -558,10 +705,21 @@ async function removeRecent(path){
|
|
|
558
705
|
addBtn.onclick=()=>openSheet(addBtn);
|
|
559
706
|
homeBtn.onclick=()=>go('home');
|
|
560
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
|
+
});
|
|
561
719
|
$('#homeBox').addEventListener('click',e=>{const row=e.target.closest('[data-path]');if(row)openPath(row.dataset.path);});
|
|
562
720
|
$('#openCancel').onclick=closeSheet;
|
|
563
721
|
openVeil.onclick=e=>{if(e.target===openVeil)closeSheet();};
|
|
564
|
-
$('#openForm').onsubmit=e=>{e.preventDefault();openPath(pathIn.value.trim());};
|
|
722
|
+
$('#openForm').onsubmit=e=>{e.preventDefault();if(sheetTab==='clone')cloneRepo();else openPath(pathIn.value.trim());};
|
|
565
723
|
$('#recentBox').addEventListener('click',e=>{
|
|
566
724
|
const rm=e.target.closest('[data-remove]');if(rm){removeRecent(rm.dataset.remove);return;}
|
|
567
725
|
const row=e.target.closest('[data-path]');if(row){pathIn.value=row.dataset.path;pathIn.focus();}
|
package/ui/index.html
CHANGED
|
@@ -108,9 +108,10 @@
|
|
|
108
108
|
<main class="pane">
|
|
109
109
|
<div class="tb">
|
|
110
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>
|
|
111
|
-
<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>
|
|
112
112
|
<div class="right">
|
|
113
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>
|
|
114
115
|
</div>
|
|
115
116
|
</div>
|
|
116
117
|
<div class="content" id="content" tabindex="-1">
|
|
@@ -120,7 +121,10 @@
|
|
|
120
121
|
<section class="view welcome" id="v-home" aria-labelledby="wTitle">
|
|
121
122
|
<svg class="logo" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
|
|
122
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>
|
|
123
|
-
<
|
|
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>
|
|
124
128
|
<div class="gl benefits"><div class="box">
|
|
125
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>
|
|
126
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>
|
|
@@ -152,12 +156,24 @@
|
|
|
152
156
|
<div id="secBody"></div>
|
|
153
157
|
</section>
|
|
154
158
|
|
|
155
|
-
<!-- SETUP (BL-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
<
|
|
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>
|
|
161
177
|
</section>
|
|
162
178
|
|
|
163
179
|
<!-- FILE: any .specs/ file, rendered as written -->
|
|
@@ -189,14 +205,25 @@
|
|
|
189
205
|
</main>
|
|
190
206
|
</div>
|
|
191
207
|
|
|
192
|
-
<!-- OPEN A PROJECT (BL-067): the mockup's sheet
|
|
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 -->
|
|
193
209
|
<div class="veil" id="openVeil"><div class="sheet" role="dialog" aria-modal="true" aria-labelledby="openTitle" tabindex="-1">
|
|
194
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>
|
|
195
211
|
<form class="sb" id="openForm" autocomplete="off">
|
|
196
|
-
<div class="
|
|
197
|
-
<div class="
|
|
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>
|
|
198
225
|
</form>
|
|
199
|
-
<div class="sf"><button type="button" class="btn" id="openCancel">Cancel</button><button type="submit" class="btn pri" id="openGo" form="openForm">Open</button></div>
|
|
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>
|
|
200
227
|
</div></div>
|
|
201
228
|
|
|
202
229
|
<!-- PALETTE -->
|