specpilot 2.12.0 → 2.14.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.
Files changed (77) hide show
  1. package/README.md +48 -9
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/backfill.d.ts.map +1 -1
  5. package/dist/commands/backfill.js +24 -13
  6. package/dist/commands/backfill.js.map +1 -1
  7. package/dist/commands/serve.d.ts +8 -1
  8. package/dist/commands/serve.d.ts.map +1 -1
  9. package/dist/commands/serve.js +89 -3
  10. package/dist/commands/serve.js.map +1 -1
  11. package/dist/core/agentConfig.d.ts +10 -0
  12. package/dist/core/agentConfig.d.ts.map +1 -1
  13. package/dist/core/agentConfig.js +47 -3
  14. package/dist/core/agentConfig.js.map +1 -1
  15. package/dist/core/ideConfig.d.ts.map +1 -1
  16. package/dist/core/ideConfig.js +2 -1
  17. package/dist/core/ideConfig.js.map +1 -1
  18. package/dist/core/slashCommands.d.ts.map +1 -1
  19. package/dist/core/slashCommands.js +25 -16
  20. package/dist/core/slashCommands.js.map +1 -1
  21. package/dist/core/specFiles.js +3 -0
  22. package/dist/core/specFiles.js.map +1 -1
  23. package/dist/core/templateEngine.d.ts +5 -0
  24. package/dist/core/templateEngine.d.ts.map +1 -1
  25. package/dist/core/templateEngine.js +13 -1
  26. package/dist/core/templateEngine.js.map +1 -1
  27. package/dist/utils/addSpecsQuestions.d.ts.map +1 -1
  28. package/dist/utils/addSpecsQuestions.js +2 -0
  29. package/dist/utils/addSpecsQuestions.js.map +1 -1
  30. package/dist/utils/folderPicker.d.ts +28 -0
  31. package/dist/utils/folderPicker.d.ts.map +1 -0
  32. package/dist/utils/folderPicker.js +96 -0
  33. package/dist/utils/folderPicker.js.map +1 -0
  34. package/dist/utils/gitClone.d.ts +4 -1
  35. package/dist/utils/gitClone.d.ts.map +1 -1
  36. package/dist/utils/gitClone.js +35 -4
  37. package/dist/utils/gitClone.js.map +1 -1
  38. package/dist/utils/mcpLocal.d.ts +46 -0
  39. package/dist/utils/mcpLocal.d.ts.map +1 -0
  40. package/dist/utils/mcpLocal.js +220 -0
  41. package/dist/utils/mcpLocal.js.map +1 -0
  42. package/dist/utils/projectDetector.d.ts +15 -0
  43. package/dist/utils/projectDetector.d.ts.map +1 -1
  44. package/dist/utils/projectDetector.js +105 -4
  45. package/dist/utils/projectDetector.js.map +1 -1
  46. package/dist/utils/slashCommandGenerator.d.ts +21 -0
  47. package/dist/utils/slashCommandGenerator.d.ts.map +1 -1
  48. package/dist/utils/slashCommandGenerator.js +166 -0
  49. package/dist/utils/slashCommandGenerator.js.map +1 -1
  50. package/dist/utils/specArchiver.d.ts.map +1 -1
  51. package/dist/utils/specArchiver.js +2 -1
  52. package/dist/utils/specArchiver.js.map +1 -1
  53. package/dist/utils/specBackfiller.d.ts +9 -3
  54. package/dist/utils/specBackfiller.d.ts.map +1 -1
  55. package/dist/utils/specBackfiller.js +52 -48
  56. package/dist/utils/specBackfiller.js.map +1 -1
  57. package/dist/utils/specPaths.d.ts +3 -2
  58. package/dist/utils/specPaths.d.ts.map +1 -1
  59. package/dist/utils/specPaths.js +6 -4
  60. package/dist/utils/specPaths.js.map +1 -1
  61. package/dist/utils/specServer.d.ts +15 -3
  62. package/dist/utils/specServer.d.ts.map +1 -1
  63. package/dist/utils/specServer.js +220 -20
  64. package/dist/utils/specServer.js.map +1 -1
  65. package/dist/utils/specSetup.d.ts +11 -0
  66. package/dist/utils/specSetup.d.ts.map +1 -1
  67. package/dist/utils/specSetup.js +14 -1
  68. package/dist/utils/specSetup.js.map +1 -1
  69. package/package.json +5 -2
  70. package/ui/app.css +23 -17
  71. package/ui/app.js +159 -69
  72. package/ui/index.html +10 -8
  73. package/ui/route.js +56 -31
  74. package/dist/__tests__/fixtures/allFields.d.ts +0 -3
  75. package/dist/__tests__/fixtures/allFields.d.ts.map +0 -1
  76. package/dist/__tests__/fixtures/allFields.js +0 -31
  77. package/dist/__tests__/fixtures/allFields.js.map +0 -1
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
- function editorUrl(path,line){
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){rows.push({kind:'divider',text:`Step ${steps.indexOf(qu.step)+1} · ${qu.step}`});last=qu.step;}
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:list.filter(x=>x.step===step).map(qu=>({key:qu.key,label:qu.label,value:answerText(qu,answers)}))}));
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, tabs, and the saved setups ---- */
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
- /* Saved setups (REQ-002.H.28), kept by the page in localStorage under sp-setups: the list as stored, newest first. */
249
- const SETUPS_KEY='sp-setups',MAX_SETUPS=50;
250
- function setupsLoad(raw){
251
- let v;try{v=JSON.parse(raw||'[]');}catch(e){return [];}
252
- if(!Array.isArray(v))return [];
253
- return v.filter(e=>e&&typeof e==='object'&&typeof e.id==='string'&&(e.kind==='new'||e.kind==='setup')&&e.answers&&typeof e.answers==='object')
254
- .sort((a,b)=>(b.updatedAt||0)-(a.updatedAt||0));
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,SETUPS_KEY,setupsLoad,setupsPut,setupsRemove,setupRecord,setupTitle,setupStatus};
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);
@@ -1,3 +0,0 @@
1
- import { OptionalFields } from '../../core/templateEngine';
2
- export declare const ALL_FIELDS: Required<OptionalFields>;
3
- //# sourceMappingURL=allFields.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"allFields.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/allFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,cAAc,CAwB/C,CAAC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_FIELDS = void 0;
4
- // Every optional template field set (REQ-002.I.4): the input of BL-032's phase 2 recording (specCore.test.ts),
5
- // and of the route test that pins a setup with these answers to it (BL-PM-004b).
6
- exports.ALL_FIELDS = {
7
- platforms: ['iOS Native', 'Node.js / Express'],
8
- accessControl: 'Role-based (admin, agent, customer)',
9
- specialConsiderations: ['Accessibility (WCAG)', 'i18n'],
10
- accessibilityNotes: 'Screen reader support and right-to-left layout.',
11
- systemPattern: 'Modular monolith',
12
- activeUsers: '1,000 - 10,000',
13
- teamSize: '2-5 devs',
14
- deploymentTargets: ['AWS', 'Vercel'],
15
- localDatabases: ['SQLite'],
16
- dataSyncStrategy: 'Last write wins',
17
- integrations: { payments: ['Stripe'], ai: ['OpenAI', 'Anthropic'] },
18
- otherApis: 'Twilio for SMS',
19
- apiResponseTime: '< 200 ms (p95)',
20
- availability: '99.9%',
21
- databases: ['PostgreSQL', 'Redis'],
22
- authStrategy: 'Clerk',
23
- realtimeTypes: ['WebSockets'],
24
- compliance: ['GDPR', 'SOC 2'],
25
- cicd: ['GitHub Actions'],
26
- securityConcerns: ['Rate limiting', 'Audit logging'],
27
- buildTimeline: '3 months',
28
- constraintDescription: 'Must run on the existing Postgres cluster.',
29
- testingStrategy: ['Unit', 'E2E'],
30
- };
31
- //# sourceMappingURL=allFields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"allFields.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/allFields.ts"],"names":[],"mappings":";;;AAEA,+GAA+G;AAC/G,iFAAiF;AACpE,QAAA,UAAU,GAA6B;IAClD,SAAS,EAAE,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC9C,aAAa,EAAE,qCAAqC;IACpD,qBAAqB,EAAE,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACvD,kBAAkB,EAAE,iDAAiD;IACrE,aAAa,EAAE,kBAAkB;IACjC,WAAW,EAAE,gBAAgB;IAC7B,QAAQ,EAAE,UAAU;IACpB,iBAAiB,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;IACpC,cAAc,EAAE,CAAC,QAAQ,CAAC;IAC1B,gBAAgB,EAAE,iBAAiB;IACnC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE;IACnE,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,gBAAgB;IACjC,YAAY,EAAE,OAAO;IACrB,SAAS,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC;IAClC,YAAY,EAAE,OAAO;IACrB,aAAa,EAAE,CAAC,YAAY,CAAC;IAC7B,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7B,IAAI,EAAE,CAAC,gBAAgB,CAAC;IACxB,gBAAgB,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IACpD,aAAa,EAAE,UAAU;IACzB,qBAAqB,EAAE,4CAA4C;IACnE,eAAe,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;CACjC,CAAC"}