specpilot 2.12.0 → 2.13.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 +39 -5
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/serve.d.ts +5 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +19 -2
- package/dist/commands/serve.js.map +1 -1
- package/dist/core/ideConfig.d.ts.map +1 -1
- package/dist/core/ideConfig.js +2 -1
- package/dist/core/ideConfig.js.map +1 -1
- package/dist/utils/gitClone.d.ts +4 -1
- package/dist/utils/gitClone.d.ts.map +1 -1
- package/dist/utils/gitClone.js +35 -4
- package/dist/utils/gitClone.js.map +1 -1
- package/dist/utils/mcpLocal.d.ts +46 -0
- package/dist/utils/mcpLocal.d.ts.map +1 -0
- package/dist/utils/mcpLocal.js +220 -0
- package/dist/utils/mcpLocal.js.map +1 -0
- package/dist/utils/projectDetector.d.ts +4 -0
- package/dist/utils/projectDetector.d.ts.map +1 -1
- package/dist/utils/projectDetector.js +19 -4
- package/dist/utils/projectDetector.js.map +1 -1
- package/dist/utils/specPaths.d.ts +3 -2
- package/dist/utils/specPaths.d.ts.map +1 -1
- package/dist/utils/specPaths.js +6 -4
- package/dist/utils/specPaths.js.map +1 -1
- package/dist/utils/specServer.d.ts +7 -0
- package/dist/utils/specServer.d.ts.map +1 -1
- package/dist/utils/specServer.js +144 -12
- package/dist/utils/specServer.js.map +1 -1
- package/dist/utils/specSetup.d.ts +11 -0
- package/dist/utils/specSetup.d.ts.map +1 -1
- package/dist/utils/specSetup.js +9 -1
- package/dist/utils/specSetup.js.map +1 -1
- package/package.json +5 -2
- package/ui/app.css +19 -17
- package/ui/app.js +114 -65
- package/ui/index.html +6 -6
- package/ui/route.js +56 -31
package/ui/index.html
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<title>SpecPilot Local</title>
|
|
7
7
|
<meta name="theme-color" content="#0f172a">
|
|
8
8
|
<!-- specpilot-token -->
|
|
9
|
+
<!-- specpilot-mcp -->
|
|
9
10
|
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml">
|
|
10
11
|
<link rel="stylesheet" href="/assets/app.css">
|
|
11
12
|
<script src="/assets/md.js" defer></script>
|
|
@@ -116,8 +117,9 @@
|
|
|
116
117
|
<div class="right">
|
|
117
118
|
<div class="seg" id="modeSeg"><button class="on" data-m="list">List</button><button data-m="board">Board</button></div>
|
|
118
119
|
<a class="ib" id="editorBtn" hidden aria-label="Open in VS Code" title="Open in VS Code"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-ext"/></svg></a>
|
|
120
|
+
<div class="idewrap" id="ideWrap" hidden><button type="button" class="ib" id="ideBtn" aria-haspopup="menu" aria-expanded="false" aria-controls="ideMenu" aria-label="Open in AI IDE" title="Open in AI IDE"><svg class="ico" aria-hidden="true" focusable="false"><use href="#i-spark"/></svg></button><div class="idemenu" id="ideMenu" role="menu" aria-label="Open in AI IDE" hidden></div></div>
|
|
119
121
|
<button type="button" class="btn line sm" id="newTask" hidden><svg class="ico ico-13" aria-hidden="true" focusable="false"><use href="#i-plus"/></svg>New Task</button>
|
|
120
|
-
<button type="button" class="btn" id="
|
|
122
|
+
<button type="button" class="btn" id="chatRestart" hidden>Start over</button><button type="button" class="btn" id="chatClose" hidden>Close</button>
|
|
121
123
|
</div>
|
|
122
124
|
</div>
|
|
123
125
|
<div class="content" id="content" tabindex="-1">
|
|
@@ -136,6 +138,8 @@
|
|
|
136
138
|
<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>
|
|
137
139
|
</div></div>
|
|
138
140
|
<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>
|
|
141
|
+
<!-- BL-PM-007: only with specpilot serve --mcp -->
|
|
142
|
+
<div class="gl" id="homeMcp" hidden><div class="gh">Connect Your AI IDE <span class="cnt">optional, one line</span></div><div class="box"><div class="mcp"><code class="v" id="mcpLine" translate="no"></code><button type="button" class="btn sm" id="mcpCopy">Copy</button></div></div><p class="note" id="mcpNote"></p></div>
|
|
139
143
|
<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>
|
|
140
144
|
</section>
|
|
141
145
|
|
|
@@ -168,15 +172,11 @@
|
|
|
168
172
|
<div class="bar" role="progressbar" aria-label="Setup progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i id="barI"></i></div>
|
|
169
173
|
<p class="note" id="chatNote" hidden></p>
|
|
170
174
|
<div class="cbody" id="cbody" hidden>
|
|
171
|
-
<aside class="setups" id="setups" aria-label="Saved setups">
|
|
172
|
-
<div class="sh"><span>Setups</span><button type="button" class="btn sm" id="setupNew">New setup</button></div>
|
|
173
|
-
<div id="setupList"></div>
|
|
174
|
-
</aside>
|
|
175
175
|
<div class="cmain">
|
|
176
176
|
<section class="intro" id="intro" hidden>
|
|
177
177
|
<svg class="big" aria-hidden="true" focusable="false"><use href="#logo"/></svg>
|
|
178
178
|
<div><h2 id="introH">Hey, I'm SpecPilot</h2><p id="introText"></p><p id="introText2" hidden></p><p class="note" id="introDetected" hidden translate="no"></p></div>
|
|
179
|
-
<div class="fine">Runs on this machine. Nothing leaves it.</div>
|
|
179
|
+
<div class="fine" id="introFine">Runs on this machine. Nothing leaves it.</div>
|
|
180
180
|
<form class="start" id="introForm" autocomplete="off">
|
|
181
181
|
<div class="lbl" id="nameLbl">Name your project to start</div>
|
|
182
182
|
<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>
|
package/ui/route.js
CHANGED
|
@@ -43,10 +43,26 @@ function when(iso){
|
|
|
43
43
|
|
|
44
44
|
/* The vscode://file/ link for an absolute folder path (BL-PM-008): `\` as `/`, each segment
|
|
45
45
|
percent-encoded, but a drive's `:` (`C:`) kept, so `C:\a b` gives `vscode://file/C:/a%20b`.
|
|
46
|
-
With a `line`, `:<line>` is appended as is, so VS Code opens the file at that line.
|
|
47
|
-
|
|
46
|
+
With a `line`, `:<line>` is appended as is, so VS Code opens the file at that line. `scheme` is
|
|
47
|
+
another VS Code fork's (`cursor`, BL-PM-010), whose handler takes the same `<scheme>://file/` path. */
|
|
48
|
+
function editorUrl(path,line,scheme){
|
|
48
49
|
const segs=String(path).replace(/\\/g,'/').split('/').map((s,i)=>i===0&&/^[A-Za-z]:$/.test(s)?s:encodeURIComponent(s));
|
|
49
|
-
return 'vscode://file'+(segs[0]===''?'':'/')+segs.join('/')+(line?':'+line:'');
|
|
50
|
+
return (scheme||'vscode')+'://file'+(segs[0]===''?'':'/')+segs.join('/')+(line?':'+line:'');
|
|
51
|
+
}
|
|
52
|
+
/* Cursor's prompt deep link (BL-PM-010): the app scheme only, never cursor.com/link/, which would send
|
|
53
|
+
the text over the network. Null when the link would pass Cursor's 10,000 characters. */
|
|
54
|
+
const CURSOR_LINK_MAX=10000;
|
|
55
|
+
function cursorPromptUrl(text){
|
|
56
|
+
const u='cursor://anysphere.cursor-deeplink/prompt?text='+encodeURIComponent(text);
|
|
57
|
+
return u.length>CURSOR_LINK_MAX?null:u;
|
|
58
|
+
}
|
|
59
|
+
/* The prompt in development/onboarding.md: after its front matter and the first line that is only
|
|
60
|
+
`---` (the line init writes above the prompt), else the whole body. */
|
|
61
|
+
function onboardingPrompt(src){
|
|
62
|
+
const t=String(src).replace(/\r/g,'');
|
|
63
|
+
const body=t.startsWith('---\n')&&t.indexOf('\n---\n',3)>=0?t.slice(t.indexOf('\n---\n',3)+5):t;
|
|
64
|
+
const m=/^---[ \t]*$/m.exec(body);
|
|
65
|
+
return (m?body.slice(m.index+m[0].length):body).trim();
|
|
50
66
|
}
|
|
51
67
|
const EDITOR_ICON='<svg class="ico" aria-hidden="true" focusable="false"><use href="#i-ext"/></svg>';
|
|
52
68
|
const REMOVE_ICON='<svg class="ico" aria-hidden="true" focusable="false"><use href="#i-x"/></svg>';
|
|
@@ -95,6 +111,18 @@ function reloadView(curView,hadSpecs,hasSpecs){
|
|
|
95
111
|
of the rule: the Clone tab fills Folder name with it and the server uses it for an empty name (BL-PM-002). */
|
|
96
112
|
function repoNameFromUrl(url){return String(url).replace(/\/+$/,'').replace(/\.git$/,'').split(/[/:]/).pop()||'';}
|
|
97
113
|
|
|
114
|
+
/* The Clone sheet's status (BL-PM-009): `Cloning… 0:42` until git gives a percentage, then git's stage and it. */
|
|
115
|
+
const CLONE_STAGES={receiving:'Receiving objects',resolving:'Resolving deltas',updating:'Updating files'};
|
|
116
|
+
function cloneStatus(seconds,progress){
|
|
117
|
+
const t=`${Math.floor(seconds/60)}:${String(seconds%60).padStart(2,'0')}`;
|
|
118
|
+
return progress?`${CLONE_STAGES[progress.stage]} ${progress.percent}% · ${t}`:`Cloning… ${t}`;
|
|
119
|
+
}
|
|
120
|
+
/* A `clone` event's data as {stage, percent}, or null for anything else. */
|
|
121
|
+
function cloneProgress(data){
|
|
122
|
+
let p;try{p=JSON.parse(data);}catch(_){return null;}
|
|
123
|
+
return p&&typeof p==='object'&&Object.prototype.hasOwnProperty.call(CLONE_STAGES,p.stage)&&Number.isInteger(p.percent)&&p.percent>=0&&p.percent<=100?{stage:p.stage,percent:p.percent}:null;
|
|
124
|
+
}
|
|
125
|
+
|
|
98
126
|
/* The name a project is shown under: the one in its project.yaml, else its folder's own name (the last
|
|
99
127
|
segment of its root), never the whole path, which stays in the tooltip and the sub-line. */
|
|
100
128
|
function projectLabel(p){return p.name!==null&&p.name!==undefined?p.name:String(p.root).split(/[/\\]/).filter(Boolean).pop()||p.root;}
|
|
@@ -185,18 +213,23 @@ function answerText(qu,answers){
|
|
|
185
213
|
/* The thread up to the current question: the name bubble (a new project only: `named`), a divider per step,
|
|
186
214
|
the skip notes before a question (BL-PM-004b), a bot row per asked question (with its file caption) and an
|
|
187
215
|
answer row per answered one, then the note after it; after the last answer a Review divider. */
|
|
188
|
-
function threadRows(q,list,answers,cur,ctx,named){
|
|
216
|
+
function threadRows(q,list,answers,cur,ctx,named,det){
|
|
217
|
+
const facts=step=>det&&det.rows?det.rows.filter(f=>f.step===step):[],marked=k=>!!det&&(det.keys||[]).includes(k);
|
|
189
218
|
const steps=[...new Set(list.map(x=>x.step))],rows=[];
|
|
190
219
|
if(named)rows.push({kind:'user',key:'name',text:ctx.name,mono:true,skipped:false});
|
|
191
220
|
let last=null;
|
|
192
221
|
for(const qu of list){
|
|
193
|
-
if(qu.step!==last){
|
|
222
|
+
if(qu.step!==last){
|
|
223
|
+
rows.push({kind:'divider',text:`Step ${steps.indexOf(qu.step)+1} · ${qu.step}`});last=qu.step;
|
|
224
|
+
// what the detector found for this step: answered, never asked, not editable (BL-PM-016)
|
|
225
|
+
for(const f of facts(qu.step))rows.push({kind:'user',key:null,text:`${f.label}: ${f.value}`,mono:false,skipped:false,detected:true});
|
|
226
|
+
}
|
|
194
227
|
for(const n of qu.notesBefore||[])rows.push({kind:'note',text:n});
|
|
195
228
|
rows.push({kind:'bot',key:qu.key,text:chatText(qu,ctx),cli:qu.message,caption:qu.caption||''});
|
|
196
229
|
if(cur&&qu.key===cur.key)break;
|
|
197
230
|
if(answered(qu,answers)){
|
|
198
231
|
const text=answerText(qu,answers);
|
|
199
|
-
rows.push({kind:'user',key:qu.key,text,mono:qu.key==='parent'||qu.key==='handle',skipped:text==='Skipped'||text==='None'&&!qu.choices});
|
|
232
|
+
rows.push({kind:'user',key:qu.key,text,mono:qu.key==='parent'||qu.key==='handle',skipped:text==='Skipped'||text==='None'&&!qu.choices,...(marked(qu.key)?{detected:true}:{})});
|
|
200
233
|
if(qu.noteAfter)rows.push({kind:'note',text:qu.noteAfter});
|
|
201
234
|
}
|
|
202
235
|
}
|
|
@@ -204,10 +237,12 @@ function threadRows(q,list,answers,cur,ctx,named){
|
|
|
204
237
|
return rows;
|
|
205
238
|
}
|
|
206
239
|
|
|
207
|
-
/* The recap: one card per step in use, one row per asked question. */
|
|
208
|
-
function recapCards(list,answers){
|
|
209
|
-
const steps=[...new Set(list.map(x=>x.step))];
|
|
210
|
-
return steps.map(step=>({title:step,rows:
|
|
240
|
+
/* The recap: one card per step in use, the detector's rows first (no key: not editable), then one row per asked question. */
|
|
241
|
+
function recapCards(list,answers,det){
|
|
242
|
+
const steps=[...new Set(list.map(x=>x.step))],keys=det&&det.keys||[];
|
|
243
|
+
return steps.map(step=>({title:step,rows:[
|
|
244
|
+
...(det&&det.rows||[]).filter(f=>f.step===step).map(f=>({key:null,label:f.label,value:f.value,detected:true})),
|
|
245
|
+
...list.filter(x=>x.step===step).map(qu=>({key:qu.key,label:qu.label,value:answerText(qu,answers),...(keys.includes(qu.key)?{detected:true}:{})}))]}));
|
|
211
246
|
}
|
|
212
247
|
|
|
213
248
|
/* The POST body: the answer of every question asked, text trimmed. */
|
|
@@ -225,7 +260,7 @@ function previewFiles(q,answers){
|
|
|
225
260
|
return [...(q.files.specs[pick('apiParadigm')]||[]),...(q.files.outside[ide]||[])].map(path=>({path,kept:keep.includes(path)}));
|
|
226
261
|
}
|
|
227
262
|
|
|
228
|
-
/* ---- the full chat (BL-PM-004b): one renderer for every option,
|
|
263
|
+
/* ---- the full chat (BL-PM-004b): one renderer for every option, and tabs ---- */
|
|
229
264
|
|
|
230
265
|
/* One option as a chip, or a card when it has a description: emoji, label, a Recommended or Check this badge,
|
|
231
266
|
the description and a warning line. `pressed` is its state; `data-v` its value. */
|
|
@@ -245,28 +280,18 @@ function choiceOptions(qu){
|
|
|
245
280
|
return (qu.choices||[]).map(c=>{const [label,description]=c.name.split(' — ');return {id:c.value,label,description,badge:qu.badges&&qu.badges[c.value]};});
|
|
246
281
|
}
|
|
247
282
|
|
|
248
|
-
/*
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
/* The list with `entry` saved (replaced by id, else added), newest first, at most 50. */
|
|
257
|
-
function setupsPut(list,entry){return [entry,...list.filter(e=>e.id!==entry.id)].sort((a,b)=>(b.updatedAt||0)-(a.updatedAt||0)).slice(0,MAX_SETUPS);}
|
|
258
|
-
function setupsRemove(list,id){return list.filter(e=>e.id!==id);}
|
|
259
|
-
/* What is stored for a setup: never the token, only what the chat needs to resume. */
|
|
260
|
-
function setupRecord(st){
|
|
261
|
-
return {id:st.id,kind:st.kind,root:st.root,name:st.kind==='new'?String(st.answers.name||''):st.name||'',answers:st.answers,editing:null,started:!!st.started,
|
|
262
|
-
seeded:st.seeded||{},updatedAt:st.updatedAt||0,finished:!!st.finished,preview:st.preview||{done:false,changed:false}};
|
|
283
|
+
/* Guided setup's answers the detector fills in (REQ-002.H.35): the platforms, from direct evidence only. */
|
|
284
|
+
function seededAnswers(detected){return detected&&detected.platform?{platforms:[detected.platform]}:{};}
|
|
285
|
+
/* The keys whose answer is still the one the detector filled in: they show `detected`. */
|
|
286
|
+
function detectedKeys(seed,answers){return Object.keys(seed||{}).filter(k=>JSON.stringify(answers[k])===JSON.stringify(seed[k]));}
|
|
287
|
+
|
|
288
|
+
/* The one line an IDE's MCP settings take (BL-PM-007); serve.ts prints the same line. */
|
|
289
|
+
function mcpConfigLine(host,token){
|
|
290
|
+
return JSON.stringify({mcpServers:{'specpilot-local':{type:'http',url:`http://${host}/mcp`,headers:{'X-SpecPilot-Token':token}}}});
|
|
263
291
|
}
|
|
264
|
-
/* A row of the list: its title, `In progress` or `Ready to create`. */
|
|
265
|
-
function setupTitle(e){return e.kind==='setup'?(e.name||String(e.root||'').split(/[/\\]/).filter(Boolean).pop()||'Untitled setup'):(e.name||'Untitled setup');}
|
|
266
|
-
function setupStatus(e){return e.finished?'Ready to create':'In progress';}
|
|
267
292
|
|
|
268
|
-
const api={resolveRoute,goneHtml,when,editorUrl,recentHtml,openOutcome,reloadView,repoNameFromUrl,projectLabel,
|
|
293
|
+
const api={mcpConfigLine,resolveRoute,goneHtml,when,editorUrl,cursorPromptUrl,onboardingPrompt,recentHtml,openOutcome,reloadView,repoNameFromUrl,CLONE_STAGES,cloneStatus,cloneProgress,projectLabel,
|
|
269
294
|
projectNameError,handleError,HANDLE_PATTERN,flowValue,answered,flowQuestions,nextQuestion,answerError,chatText,answerText,threadRows,recapCards,flowBody,previewFiles,
|
|
270
|
-
optionHtml,tabsHtml,choiceOptions,
|
|
295
|
+
optionHtml,tabsHtml,choiceOptions,seededAnswers,detectedKeys};
|
|
271
296
|
if(typeof module==='object'&&module.exports)module.exports=api;else Object.assign(root,api);
|
|
272
297
|
})(this);
|