spectoflow 0.22.3 → 0.22.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spectoflow",
3
- "version": "0.22.3",
3
+ "version": "0.22.4",
4
4
  "description": "Agent-agnostic spec-driven development framework + real-time local control plane. Markdown artifacts, intent router, workflow-by-scope.",
5
5
  "keywords": [
6
6
  "spec-driven-development",
@@ -1321,6 +1321,7 @@ function renderDocs(){
1321
1321
  // event refreshes the TREE listing but never overwrites an open file's editor buffer, so an
1322
1322
  // unrelated agent write elsewhere can't clobber unsaved work here. ----
1323
1323
  let filesTreeData=null, filesOpenPath=null, filesOpenDirty=false;
1324
+ let filesSelectedDir=''; // '' = project root — the folder + File/+ Folder create inside
1324
1325
  const filesOpenDirs=new Set(); // persists which tree folders are expanded across a refresh
1325
1326
  async function loadFilesTree(){
1326
1327
  try{
@@ -1338,7 +1339,8 @@ function renderFiles(){
1338
1339
  loadFilesTree();
1339
1340
  }
1340
1341
  function fNode(entry){
1341
- const row=el('div','f-row'+(entry.type==='dir'&&filesOpenDirs.has(entry.path)?' is-open':'')+(entry.path===filesOpenPath?' is-active':''));
1342
+ const isTarget=entry.type==='dir'&&entry.path===filesSelectedDir;
1343
+ const row=el('div','f-row'+(entry.type==='dir'&&filesOpenDirs.has(entry.path)?' is-open':'')+(entry.path===filesOpenPath?' is-active':'')+(isTarget?' is-target':''));
1342
1344
  row.tabIndex=0;
1343
1345
  if(entry.type==='dir'){
1344
1346
  const chev=document.createElementNS('http://www.w3.org/2000/svg','svg');
@@ -1353,10 +1355,17 @@ function fNode(entry){
1353
1355
  const kids=el('div','f-children'); kids.hidden=!filesOpenDirs.has(entry.path);
1354
1356
  (entry.children||[]).forEach(c=> kids.append(fNode(c)));
1355
1357
  wrap.append(kids);
1358
+ // a click both toggles expand/collapse AND marks this folder as where +File/+Folder create —
1359
+ // the two are independent ideas but sharing the click keeps the tree from needing a second,
1360
+ // easy-to-miss gesture just to pick a target folder.
1356
1361
  row.addEventListener('click',()=>{
1357
1362
  const open=filesOpenDirs.has(entry.path);
1358
1363
  if(open) filesOpenDirs.delete(entry.path); else filesOpenDirs.add(entry.path);
1359
1364
  row.classList.toggle('is-open',!open); kids.hidden=open;
1365
+ filesSelectedDir=entry.path;
1366
+ const root=$('#filesRootRow'); if(root) root.classList.remove('is-target');
1367
+ $$('#filesTree .f-row.is-target').forEach(r=> r!==row && r.classList.remove('is-target'));
1368
+ row.classList.add('is-target');
1360
1369
  });
1361
1370
  } else {
1362
1371
  row.addEventListener('click',()=> openFilesFile(entry.path));
@@ -1366,10 +1375,104 @@ function fNode(entry){
1366
1375
  function renderFilesTree(){
1367
1376
  const box=$('#filesTree'); if(!box) return;
1368
1377
  box.innerHTML='';
1378
+ const root=$('#filesRootRow'); if(root) root.classList.toggle('is-target',filesSelectedDir==='');
1369
1379
  if(!filesTreeData || !filesTreeData.length){ box.append(el('div','empty',t('files.empty'))); return; }
1370
1380
  filesTreeData.forEach(e=> box.append(fNode(e)));
1371
1381
  }
1372
1382
  function filesExt(p){ const m=/\.([a-z0-9]+)$/i.exec(p||''); return m?m[1].toLowerCase():''; }
1383
+
1384
+ // ---- lightweight syntax highlighting — zero-dependency (no CodeMirror/Monaco, per the explicit
1385
+ // call made when this tab was designed): a single char-scanner tokenizer good enough to make code
1386
+ // readable at a glance in a file browser, not a language-correct parser. Anything not recognized
1387
+ // (or with no lang mapping) just renders as plain, unstyled text — never a rendering error. ----
1388
+ const FILES_HL_LANG = {
1389
+ js: { comments:[['//','\n'],['/*','*/']], strings:['"',"'",'`'],
1390
+ keywords:'const let var function return if else for while do switch case break continue new class extends super this typeof instanceof in of try catch finally throw async await yield import export default from as null undefined true false void delete'.split(' ') },
1391
+ json: { comments:[], strings:['"'], keywords:'true false null'.split(' ') },
1392
+ css: { comments:[['/*','*/']], strings:['"',"'"], keywords:[] },
1393
+ html: { comments:[['<!--','-->']], strings:['"',"'"], keywords:[], tags:true },
1394
+ py: { comments:[['#','\n']], strings:['"',"'"],
1395
+ keywords:'def class return if elif else for while break continue pass import from as try except finally raise with lambda yield async await None True False and or not in is del global nonlocal'.split(' ') },
1396
+ sh: { comments:[['#','\n']], strings:['"',"'"],
1397
+ keywords:'if then else elif fi for while do done case esac function return exit export local readonly'.split(' ') },
1398
+ yml: { comments:[['#','\n']], strings:['"',"'"], keywords:'true false null'.split(' ') },
1399
+ };
1400
+ function filesHlLang(ext){
1401
+ if(['js','mjs','cjs','ts','jsx','tsx'].includes(ext)) return 'js';
1402
+ if(ext==='json') return 'json';
1403
+ if(ext==='css') return 'css';
1404
+ if(['html','htm'].includes(ext)) return 'html';
1405
+ if(ext==='py') return 'py';
1406
+ if(['sh','bash'].includes(ext)) return 'sh';
1407
+ if(['yml','yaml'].includes(ext)) return 'yml';
1408
+ return null;
1409
+ }
1410
+ // Scans `src` one character at a time, classifying spans as it goes; returns an HTML string with
1411
+ // each span wrapped in a colored <span> (escaped — this is the only place raw file content becomes
1412
+ // markup, so nothing here may skip escHtml).
1413
+ function filesHighlight(src,langKey){
1414
+ const lang=FILES_HL_LANG[langKey];
1415
+ if(!lang) return escHtml(src);
1416
+ const n=src.length;
1417
+ let i=0,html='',plain='';
1418
+ const flushPlain=()=>{ if(plain){ html+=escHtml(plain); plain=''; } };
1419
+ const isWordChar=c=>/[A-Za-z0-9_$]/.test(c);
1420
+ while(i<n){
1421
+ let matched=false;
1422
+ // comments
1423
+ for(const [open,close] of lang.comments){
1424
+ if(src.startsWith(open,i)){
1425
+ const end = close==='\n' ? (src.indexOf('\n',i)===-1?n:src.indexOf('\n',i)) : (src.indexOf(close,i+open.length)===-1?n:src.indexOf(close,i+open.length)+close.length);
1426
+ flushPlain(); html+='<span class="hl-comment">'+escHtml(src.slice(i,end))+'</span>'; i=end; matched=true; break;
1427
+ }
1428
+ }
1429
+ if(matched) continue;
1430
+ // strings
1431
+ if(lang.strings.includes(src[i])){
1432
+ const q=src[i]; let j=i+1;
1433
+ while(j<n && src[j]!==q){ if(src[j]==='\\') j++; j++; }
1434
+ j=Math.min(j+1,n);
1435
+ flushPlain(); html+='<span class="hl-string">'+escHtml(src.slice(i,j))+'</span>'; i=j; continue;
1436
+ }
1437
+ // html tags (bonus: <tag ...> / </tag>) — a light touch, not full attribute-vs-value parsing
1438
+ if(lang.tags && src[i]==='<' && /[a-zA-Z/!]/.test(src[i+1]||'')){
1439
+ const end=src.indexOf('>',i); const j=end===-1?n:end+1;
1440
+ flushPlain(); html+='<span class="hl-tag">'+escHtml(src.slice(i,j))+'</span>'; i=j; continue;
1441
+ }
1442
+ // numbers
1443
+ if(/[0-9]/.test(src[i]) && !isWordChar(src[i-1]||'')){
1444
+ let j=i; while(j<n && /[0-9.]/.test(src[j])) j++;
1445
+ flushPlain(); html+='<span class="hl-number">'+escHtml(src.slice(i,j))+'</span>'; i=j; continue;
1446
+ }
1447
+ // keywords
1448
+ if(isWordChar(src[i]) && !isWordChar(src[i-1]||'')){
1449
+ let j=i; while(j<n && isWordChar(src[j])) j++;
1450
+ const word=src.slice(i,j);
1451
+ if(lang.keywords.includes(word)){ flushPlain(); html+='<span class="hl-keyword">'+escHtml(word)+'</span>'; i=j; continue; }
1452
+ plain+=word; i=j; continue;
1453
+ }
1454
+ plain+=src[i]; i++;
1455
+ }
1456
+ flushPlain();
1457
+ return html;
1458
+ }
1459
+ // A textarea can't render colored text itself, so this overlays one, transparent, on top of a
1460
+ // highlighted <pre><code> "backdrop" showing through it (the standard technique for a highlighted
1461
+ // plain-text editor without a full editor component) — same font metrics on both, scroll positions
1462
+ // kept in lockstep, backdrop re-rendered on every keystroke.
1463
+ function filesCodeEditor(content,langKey,onInput){
1464
+ const wrap=el('div','files-code-wrap');
1465
+ const pre=document.createElement('pre'); pre.className='files-code-backdrop'; pre.setAttribute('aria-hidden','true');
1466
+ const code=document.createElement('code'); pre.append(code);
1467
+ const ta=el('textarea','files-editor files-code-input'); ta.spellcheck=false; ta.value=content;
1468
+ const paint=()=>{ code.innerHTML=filesHighlight(ta.value,langKey)+'\n'; }; // trailing \n: a final blank line still gets backdrop height
1469
+ const syncScroll=()=>{ pre.scrollTop=ta.scrollTop; pre.scrollLeft=ta.scrollLeft; };
1470
+ ta.addEventListener('input',()=>{ paint(); if(onInput) onInput(ta.value); });
1471
+ ta.addEventListener('scroll',syncScroll);
1472
+ paint();
1473
+ wrap.append(pre,ta);
1474
+ return { wrap, textarea:ta };
1475
+ }
1373
1476
  async function openFilesFile(relPath){
1374
1477
  // no native confirm() dialog (it blocks the whole tab, including our own SSE/automation) — a
1375
1478
  // dirty editor just refuses to switch until the user explicitly saves or discards.
@@ -1432,15 +1535,19 @@ function renderFilesMd(box,actions,relPath,content){
1432
1535
  const showEditor=()=>{
1433
1536
  body.innerHTML='';
1434
1537
  const tb=el('div','files-md-toolbar');
1435
- const ta=el('textarea','files-editor'); ta.value=content;
1436
- const wrapSel=(before,after)=>{ const s=ta.selectionStart,e=ta.selectionEnd; const v=ta.value; ta.value=v.slice(0,s)+before+v.slice(s,e)+after+v.slice(e); ta.focus(); ta.selectionStart=s+before.length; ta.selectionEnd=e+before.length; content=ta.value; filesOpenDirty=true; };
1538
+ const {wrap,textarea:ta}=filesCodeEditor(content,null,(v)=>{ content=v; filesOpenDirty=true; });
1539
+ const wrapSel=(before,after)=>{
1540
+ const s=ta.selectionStart,e=ta.selectionEnd; const v=ta.value;
1541
+ ta.value=v.slice(0,s)+before+v.slice(s,e)+after+v.slice(e);
1542
+ ta.dispatchEvent(new Event('input')); // repaints the backdrop and marks dirty via the same path as typing
1543
+ ta.focus(); ta.selectionStart=s+before.length; ta.selectionEnd=e+before.length;
1544
+ };
1437
1545
  [['B','**','**'],['I','_','_'],['H','## ',''],['Link','[','](url)']].forEach(([label,a,b])=>{
1438
1546
  const bt=el('button',null,label); bt.type='button'; bt.addEventListener('click',()=>wrapSel(a,b)); tb.append(bt);
1439
1547
  });
1440
1548
  const saveBtn=el('button',null,t('files.save')); saveBtn.type='button'; saveBtn.addEventListener('click',()=>{ content=ta.value; filesSave(relPath,content,actions); });
1441
1549
  tb.append(saveBtn,filesDiscardBtn(relPath));
1442
- ta.addEventListener('input',()=>{ content=ta.value; filesOpenDirty=true; });
1443
- body.append(tb,ta); ta.focus(); editBtn.textContent=t('files.preview');
1550
+ body.append(tb,wrap); ta.focus(); editBtn.textContent=t('files.preview');
1444
1551
  };
1445
1552
  editBtn.addEventListener('click',()=>{ editing=!editing; if(editing) showEditor(); else showPreview(); });
1446
1553
  showPreview();
@@ -1461,23 +1568,21 @@ function renderFilesHtml(box,actions,relPath,content){
1461
1568
  };
1462
1569
  const showEditor=()=>{
1463
1570
  body.innerHTML='';
1464
- const ta=el('textarea','files-editor'); ta.value=content;
1465
- ta.addEventListener('input',()=>{ content=ta.value; filesOpenDirty=true; });
1571
+ const {wrap,textarea:ta}=filesCodeEditor(content,'html',(v)=>{ content=v; filesOpenDirty=true; });
1466
1572
  const saveBtn=el('button','btn primary',t('files.save')); saveBtn.type='button'; saveBtn.addEventListener('click',()=>filesSave(relPath,content,actions));
1467
1573
  const tb=el('div','files-md-toolbar'); tb.append(saveBtn,filesDiscardBtn(relPath));
1468
- body.append(tb,ta); ta.focus(); editBtn.textContent=t('files.preview');
1574
+ body.append(tb,wrap); ta.focus(); editBtn.textContent=t('files.preview');
1469
1575
  };
1470
1576
  editBtn.addEventListener('click',()=>{ editing=!editing; if(editing) showEditor(); else showPreview(); });
1471
1577
  showPreview();
1472
1578
  }
1473
1579
  // Anything else that reads as text: a plain monospace editor, editable straight away.
1474
1580
  function renderFilesText(box,actions,relPath,content){
1475
- const ta=el('textarea','files-editor'); ta.value=content;
1476
- ta.addEventListener('input',()=>{ filesOpenDirty=true; });
1581
+ const {wrap,textarea:ta}=filesCodeEditor(content,filesHlLang(filesExt(relPath)),()=>{ filesOpenDirty=true; });
1477
1582
  const saveBtn=el('button','btn primary',t('files.save')); saveBtn.type='button';
1478
1583
  saveBtn.addEventListener('click',()=>filesSave(relPath,ta.value,actions));
1479
1584
  actions.append(saveBtn,filesDiscardBtn(relPath));
1480
- box.append(ta); ta.focus();
1585
+ box.append(wrap); ta.focus();
1481
1586
  }
1482
1587
  // "+ File"/"+ Folder" open the same inline form (never a native prompt()/alert() — those block the
1483
1588
  // whole tab, including our own SSE connection, until dismissed).
@@ -1488,6 +1593,7 @@ function openFilesCreateForm(kind){
1488
1593
  const input=$('#filesCreateInput');
1489
1594
  input.placeholder = kind==='dir' ? t('files.newFolderPrompt') : t('files.newFilePrompt');
1490
1595
  input.value='';
1596
+ const target=$('#filesCreateTarget'); if(target) target.textContent=t('files.creatingIn',{path:filesSelectedDir||t('files.projectRoot')});
1491
1597
  const err=$('#filesCreateError'); if(err) err.hidden=true;
1492
1598
  form.hidden=false; form.classList.add('is-open');
1493
1599
  input.focus();
@@ -1500,7 +1606,7 @@ async function submitFilesCreate(){
1500
1606
  const input=$('#filesCreateInput'); const err=$('#filesCreateError');
1501
1607
  const name=(input.value||'').trim();
1502
1608
  if(!name){ if(err){ err.textContent=t('backlog.addTitleRequired'); err.hidden=false; } return; }
1503
- const rel=name.replace(/^\/+/,'');
1609
+ const rel=(filesSelectedDir?filesSelectedDir+'/':'')+name.replace(/^\/+/,'');
1504
1610
  const kind=filesCreateKind;
1505
1611
  const endpoint = kind==='dir' ? '/api/files/mkdir' : '/api/files/write';
1506
1612
  const payload = kind==='dir' ? {path:rel} : {path:rel,content:''};
@@ -1638,6 +1744,12 @@ $$('#backlogTable thead th').forEach(th=> th.addEventListener('click', ()=>{
1638
1744
  const filesNewFileBtn=$('#filesNewFile'); if(filesNewFileBtn) filesNewFileBtn.addEventListener('click',()=>openFilesCreateForm('file'));
1639
1745
  const filesNewFolderBtn=$('#filesNewFolder'); if(filesNewFolderBtn) filesNewFolderBtn.addEventListener('click',()=>openFilesCreateForm('dir'));
1640
1746
  const filesRefreshBtn=$('#filesRefresh'); if(filesRefreshBtn) filesRefreshBtn.addEventListener('click',loadFilesTree);
1747
+ const filesRootRowBtn=$('#filesRootRow');
1748
+ if(filesRootRowBtn) filesRootRowBtn.addEventListener('click',()=>{
1749
+ filesSelectedDir='';
1750
+ $$('#filesTree .f-row.is-target').forEach(r=> r.classList.remove('is-target'));
1751
+ filesRootRowBtn.classList.add('is-target');
1752
+ });
1641
1753
  const filesCreateGoBtn=$('#filesCreateGo'); if(filesCreateGoBtn) filesCreateGoBtn.addEventListener('click',submitFilesCreate);
1642
1754
  const filesCreateCancelBtn=$('#filesCreateCancel'); if(filesCreateCancelBtn) filesCreateCancelBtn.addEventListener('click',closeFilesCreateForm);
1643
1755
  const filesCreateInputEl=$('#filesCreateInput'); if(filesCreateInputEl) filesCreateInputEl.addEventListener('keydown',e=>{ if(e.key==='Enter') submitFilesCreate(); });
@@ -85,7 +85,7 @@ en: {
85
85
  'team.skillsTitle':'Skills','team.skillsSub':'Evolving procedures — the <em>how</em>.',
86
86
  'team.standardsLabel':'standards','team.usesLabel':'uses','team.standardLabel':'standard',
87
87
  'drawer.agent':'Agent','drawer.skill':'Skill','drawer.file':'File · {rel}',
88
- 'drawer.loading':'Loading…','drawer.loadError':'Could not load this file.','files.title':'Files','files.sub':'Browse the project\'s files — view Markdown & HTML, edit any text file, create new ones.','files.newFile':'+ File','files.newFolder':'+ Folder','files.pickFile':'Select a file to view it.','files.empty':'No files yet.','files.edit':'Edit','files.preview':'Preview','files.save':'Save','files.saved':'✓ saved','files.saveError':'Could not save this file.','files.loadError':'Could not load this file.','files.binary':'This file can\'t be previewed here (not text).','files.discardConfirm':'Discard unsaved changes?','files.newFilePrompt':'New file path (e.g. notes/todo.md):','files.newFolderPrompt':'New folder path:','files.refresh':'Refresh','files.discard':'Discard','files.create':'Create',
88
+ 'drawer.loading':'Loading…','drawer.loadError':'Could not load this file.','files.title':'Files','files.sub':'Browse the project\'s files — view Markdown & HTML, edit any text file, create new ones.','files.newFile':'+ File','files.newFolder':'+ Folder','files.pickFile':'Select a file to view it.','files.empty':'No files yet.','files.edit':'Edit','files.preview':'Preview','files.save':'Save','files.saved':'✓ saved','files.saveError':'Could not save this file.','files.loadError':'Could not load this file.','files.binary':'This file can\'t be previewed here (not text).','files.discardConfirm':'Discard unsaved changes?','files.newFilePrompt':'New file name (e.g. todo.md):','files.newFolderPrompt':'New folder name:','files.projectRoot':'project root','files.creatingIn':'Creating in: {path}','files.refresh':'Refresh','files.discard':'Discard','files.create':'Create',
89
89
  'chat.widgetTitle':'Run an agent','chat.widgetSub':'Quick access · full view in the Chat tab',
90
90
  'chat.tabSub':'Full conversation with the runner — the same run as the widget, more room to read it.',
91
91
  'chat.idle':'Type a request — the agent runs headless in this project with full memory (<code>CLAUDE.md → AGENTS.md</code>) and updates the board live.',
@@ -197,7 +197,7 @@ fr: {
197
197
  'team.skillsTitle':'Compétences','team.skillsSub':'Procédures évolutives — le <em>comment</em>.',
198
198
  'team.standardsLabel':'standards','team.usesLabel':'utilise','team.standardLabel':'standard',
199
199
  'drawer.agent':'Agent','drawer.skill':'Compétence','drawer.file':'Fichier · {rel}',
200
- 'drawer.loading':'Chargement…','drawer.loadError':'Impossible de charger ce fichier.','files.title':'Fichiers','files.sub':'Parcourez les fichiers du projet — visualisez Markdown et HTML, modifiez tout fichier texte, créez-en de nouveaux.','files.newFile':'+ Fichier','files.newFolder':'+ Dossier','files.pickFile':'Sélectionnez un fichier pour l’afficher.','files.empty':'Aucun fichier pour l’instant.','files.edit':'Modifier','files.preview':'Aperçu','files.save':'Enregistrer','files.saved':'✓ enregistré','files.saveError':'Impossible d’enregistrer ce fichier.','files.loadError':'Impossible de charger ce fichier.','files.binary':'Ce fichier ne peut pas être prévisualisé ici (non textuel).','files.discardConfirm':'Abandonner les modifications non enregistrées ?','files.newFilePrompt':'Chemin du nouveau fichier (ex. notes/todo.md) :','files.newFolderPrompt':'Chemin du nouveau dossier :','files.refresh':'Actualiser','files.discard':'Annuler','files.create':'Créer',
200
+ 'drawer.loading':'Chargement…','drawer.loadError':'Impossible de charger ce fichier.','files.title':'Fichiers','files.sub':'Parcourez les fichiers du projet — visualisez Markdown et HTML, modifiez tout fichier texte, créez-en de nouveaux.','files.newFile':'+ Fichier','files.newFolder':'+ Dossier','files.pickFile':'Sélectionnez un fichier pour l’afficher.','files.empty':'Aucun fichier pour l’instant.','files.edit':'Modifier','files.preview':'Aperçu','files.save':'Enregistrer','files.saved':'✓ enregistré','files.saveError':'Impossible d’enregistrer ce fichier.','files.loadError':'Impossible de charger ce fichier.','files.binary':'Ce fichier ne peut pas être prévisualisé ici (non textuel).','files.discardConfirm':'Abandonner les modifications non enregistrées ?','files.newFilePrompt':'Nom du nouveau fichier (ex. todo.md) :','files.newFolderPrompt':'Nom du nouveau dossier :','files.projectRoot':'racine du projet','files.creatingIn':'Création dans : {path}','files.refresh':'Actualiser','files.discard':'Annuler','files.create':'Créer',
201
201
  'chat.widgetTitle':'Lancer un agent','chat.widgetSub':'Accès rapide · vue complète dans l’onglet Chat',
202
202
  'chat.tabSub':'Conversation complète avec l’exécuteur — la même exécution que le widget, avec plus de place pour la lire.',
203
203
  'chat.idle':'Tapez une demande — l’agent s’exécute sans supervision dans ce projet avec toute sa mémoire (<code>CLAUDE.md → AGENTS.md</code>) et met le tableau à jour en direct.',
@@ -309,7 +309,7 @@ es: {
309
309
  'team.skillsTitle':'Habilidades','team.skillsSub':'Procedimientos en evolución — el <em>cómo</em>.',
310
310
  'team.standardsLabel':'estándares','team.usesLabel':'usa','team.standardLabel':'estándar',
311
311
  'drawer.agent':'Agente','drawer.skill':'Habilidad','drawer.file':'Archivo · {rel}',
312
- 'drawer.loading':'Cargando…','drawer.loadError':'No se pudo cargar este archivo.','files.title':'Archivos','files.sub':'Explora los archivos del proyecto — visualiza Markdown y HTML, edita cualquier archivo de texto, crea otros nuevos.','files.newFile':'+ Archivo','files.newFolder':'+ Carpeta','files.pickFile':'Selecciona un archivo para verlo.','files.empty':'Aún no hay archivos.','files.edit':'Editar','files.preview':'Vista previa','files.save':'Guardar','files.saved':'✓ guardado','files.saveError':'No se pudo guardar este archivo.','files.loadError':'No se pudo cargar este archivo.','files.binary':'Este archivo no se puede previsualizar aquí (no es texto).','files.discardConfirm':'¿Descartar los cambios sin guardar?','files.newFilePrompt':'Ruta del nuevo archivo (p. ej. notes/todo.md):','files.newFolderPrompt':'Ruta de la nueva carpeta:','files.refresh':'Actualizar','files.discard':'Descartar','files.create':'Crear',
312
+ 'drawer.loading':'Cargando…','drawer.loadError':'No se pudo cargar este archivo.','files.title':'Archivos','files.sub':'Explora los archivos del proyecto — visualiza Markdown y HTML, edita cualquier archivo de texto, crea otros nuevos.','files.newFile':'+ Archivo','files.newFolder':'+ Carpeta','files.pickFile':'Selecciona un archivo para verlo.','files.empty':'Aún no hay archivos.','files.edit':'Editar','files.preview':'Vista previa','files.save':'Guardar','files.saved':'✓ guardado','files.saveError':'No se pudo guardar este archivo.','files.loadError':'No se pudo cargar este archivo.','files.binary':'Este archivo no se puede previsualizar aquí (no es texto).','files.discardConfirm':'¿Descartar los cambios sin guardar?','files.newFilePrompt':'Nombre del nuevo archivo (p. ej. todo.md):','files.newFolderPrompt':'Nombre de la nueva carpeta:','files.projectRoot':'raíz del proyecto','files.creatingIn':'Creando en: {path}','files.refresh':'Actualizar','files.discard':'Descartar','files.create':'Crear',
313
313
  'chat.widgetTitle':'Ejecutar un agente','chat.widgetSub':'Acceso rápido · vista completa en la pestaña Chat',
314
314
  'chat.tabSub':'Conversación completa con el ejecutor — la misma ejecución que el widget, con más espacio para leerla.',
315
315
  'chat.idle':'Escribe una solicitud — el agente se ejecuta sin supervisión en este proyecto con toda su memoria (<code>CLAUDE.md → AGENTS.md</code>) y actualiza el tablero en vivo.',
@@ -421,7 +421,7 @@ de: {
421
421
  'team.skillsTitle':'Skills','team.skillsSub':'Sich weiterentwickelnde Vorgehensweisen — das <em>Wie</em>.',
422
422
  'team.standardsLabel':'Standards','team.usesLabel':'nutzt','team.standardLabel':'Standard',
423
423
  'drawer.agent':'Agent','drawer.skill':'Skill','drawer.file':'Datei · {rel}',
424
- 'drawer.loading':'Lädt…','drawer.loadError':'Diese Datei konnte nicht geladen werden.','files.title':'Dateien','files.sub':'Durchsuche die Projektdateien — Markdown & HTML ansehen, jede Textdatei bearbeiten, neue erstellen.','files.newFile':'+ Datei','files.newFolder':'+ Ordner','files.pickFile':'Wähle eine Datei aus, um sie anzuzeigen.','files.empty':'Noch keine Dateien.','files.edit':'Bearbeiten','files.preview':'Vorschau','files.save':'Speichern','files.saved':'✓ gespeichert','files.saveError':'Diese Datei konnte nicht gespeichert werden.','files.loadError':'Diese Datei konnte nicht geladen werden.','files.binary':'Diese Datei kann hier nicht angezeigt werden (kein Text).','files.discardConfirm':'Nicht gespeicherte Änderungen verwerfen?','files.newFilePrompt':'Pfad der neuen Datei (z. B. notes/todo.md):','files.newFolderPrompt':'Pfad des neuen Ordners:','files.refresh':'Aktualisieren','files.discard':'Verwerfen','files.create':'Erstellen',
424
+ 'drawer.loading':'Lädt…','drawer.loadError':'Diese Datei konnte nicht geladen werden.','files.title':'Dateien','files.sub':'Durchsuche die Projektdateien — Markdown & HTML ansehen, jede Textdatei bearbeiten, neue erstellen.','files.newFile':'+ Datei','files.newFolder':'+ Ordner','files.pickFile':'Wähle eine Datei aus, um sie anzuzeigen.','files.empty':'Noch keine Dateien.','files.edit':'Bearbeiten','files.preview':'Vorschau','files.save':'Speichern','files.saved':'✓ gespeichert','files.saveError':'Diese Datei konnte nicht gespeichert werden.','files.loadError':'Diese Datei konnte nicht geladen werden.','files.binary':'Diese Datei kann hier nicht angezeigt werden (kein Text).','files.discardConfirm':'Nicht gespeicherte Änderungen verwerfen?','files.newFilePrompt':'Name der neuen Datei (z. B. todo.md):','files.newFolderPrompt':'Name des neuen Ordners:','files.projectRoot':'Projektstamm','files.creatingIn':'Erstellen in: {path}','files.refresh':'Aktualisieren','files.discard':'Verwerfen','files.create':'Erstellen',
425
425
  'chat.widgetTitle':'Agenten ausführen','chat.widgetSub':'Schnellzugriff · vollständige Ansicht im Chat-Tab',
426
426
  'chat.tabSub':'Vollständiges Gespräch mit dem Runner — derselbe Lauf wie im Widget, mit mehr Platz zum Lesen.',
427
427
  'chat.idle':'Geben Sie eine Anfrage ein — der Agent läuft eigenständig in diesem Projekt mit vollem Gedächtnis (<code>CLAUDE.md → AGENTS.md</code>) und aktualisiert das Board live.',
@@ -533,7 +533,7 @@ pt: {
533
533
  'team.skillsTitle':'Habilidades','team.skillsSub':'Procedimentos em evolução — o <em>como</em>.',
534
534
  'team.standardsLabel':'padrões','team.usesLabel':'usa','team.standardLabel':'padrão',
535
535
  'drawer.agent':'Agente','drawer.skill':'Habilidade','drawer.file':'Ficheiro · {rel}',
536
- 'drawer.loading':'A carregar…','drawer.loadError':'Não foi possível carregar este ficheiro.','files.title':'Ficheiros','files.sub':'Percorra os ficheiros do projeto — veja Markdown e HTML, edite qualquer ficheiro de texto, crie novos.','files.newFile':'+ Ficheiro','files.newFolder':'+ Pasta','files.pickFile':'Selecione um ficheiro para o ver.','files.empty':'Ainda não há ficheiros.','files.edit':'Editar','files.preview':'Pré-visualizar','files.save':'Guardar','files.saved':'✓ guardado','files.saveError':'Não foi possível guardar este ficheiro.','files.loadError':'Não foi possível carregar este ficheiro.','files.binary':'Este ficheiro não pode ser pré-visualizado aqui (não é texto).','files.discardConfirm':'Descartar alterações não guardadas?','files.newFilePrompt':'Caminho do novo ficheiro (ex. notes/todo.md):','files.newFolderPrompt':'Caminho da nova pasta:','files.refresh':'Atualizar','files.discard':'Descartar','files.create':'Criar',
536
+ 'drawer.loading':'A carregar…','drawer.loadError':'Não foi possível carregar este ficheiro.','files.title':'Ficheiros','files.sub':'Percorra os ficheiros do projeto — veja Markdown e HTML, edite qualquer ficheiro de texto, crie novos.','files.newFile':'+ Ficheiro','files.newFolder':'+ Pasta','files.pickFile':'Selecione um ficheiro para o ver.','files.empty':'Ainda não há ficheiros.','files.edit':'Editar','files.preview':'Pré-visualizar','files.save':'Guardar','files.saved':'✓ guardado','files.saveError':'Não foi possível guardar este ficheiro.','files.loadError':'Não foi possível carregar este ficheiro.','files.binary':'Este ficheiro não pode ser pré-visualizado aqui (não é texto).','files.discardConfirm':'Descartar alterações não guardadas?','files.newFilePrompt':'Nome do novo ficheiro (ex. todo.md):','files.newFolderPrompt':'Nome da nova pasta:','files.projectRoot':'raiz do projeto','files.creatingIn':'A criar em: {path}','files.refresh':'Atualizar','files.discard':'Descartar','files.create':'Criar',
537
537
  'chat.widgetTitle':'Executar um agente','chat.widgetSub':'Acesso rápido · vista completa no separador Chat',
538
538
  'chat.tabSub':'Conversa completa com o executor — a mesma execução do widget, com mais espaço para ler.',
539
539
  'chat.idle':'Escreva um pedido — o agente corre sem supervisão neste projeto com toda a sua memória (<code>CLAUDE.md → AGENTS.md</code>) e atualiza o painel em direto.',
@@ -645,7 +645,7 @@ it: {
645
645
  'team.skillsTitle':'Skill','team.skillsSub':'Procedure in evoluzione — il <em>come</em>.',
646
646
  'team.standardsLabel':'standard','team.usesLabel':'usa','team.standardLabel':'standard',
647
647
  'drawer.agent':'Agente','drawer.skill':'Skill','drawer.file':'File · {rel}',
648
- 'drawer.loading':'Caricamento…','drawer.loadError':'Impossibile caricare questo file.','files.title':'File','files.sub':'Sfoglia i file del progetto — visualizza Markdown e HTML, modifica qualsiasi file di testo, creane di nuovi.','files.newFile':'+ File','files.newFolder':'+ Cartella','files.pickFile':'Seleziona un file per visualizzarlo.','files.empty':'Nessun file ancora.','files.edit':'Modifica','files.preview':'Anteprima','files.save':'Salva','files.saved':'✓ salvato','files.saveError':'Impossibile salvare questo file.','files.loadError':'Impossibile caricare questo file.','files.binary':'Questo file non può essere visualizzato qui (non è testo).','files.discardConfirm':'Scartare le modifiche non salvate?','files.newFilePrompt':'Percorso del nuovo file (es. notes/todo.md):','files.newFolderPrompt':'Percorso della nuova cartella:','files.refresh':'Aggiorna','files.discard':'Scarta','files.create':'Crea',
648
+ 'drawer.loading':'Caricamento…','drawer.loadError':'Impossibile caricare questo file.','files.title':'File','files.sub':'Sfoglia i file del progetto — visualizza Markdown e HTML, modifica qualsiasi file di testo, creane di nuovi.','files.newFile':'+ File','files.newFolder':'+ Cartella','files.pickFile':'Seleziona un file per visualizzarlo.','files.empty':'Nessun file ancora.','files.edit':'Modifica','files.preview':'Anteprima','files.save':'Salva','files.saved':'✓ salvato','files.saveError':'Impossibile salvare questo file.','files.loadError':'Impossibile caricare questo file.','files.binary':'Questo file non può essere visualizzato qui (non è testo).','files.discardConfirm':'Scartare le modifiche non salvate?','files.newFilePrompt':'Nome del nuovo file (es. todo.md):','files.newFolderPrompt':'Nome della nuova cartella:','files.projectRoot':'radice del progetto','files.creatingIn':'Creazione in: {path}','files.refresh':'Aggiorna','files.discard':'Scarta','files.create':'Crea',
649
649
  'chat.widgetTitle':'Avvia un agente','chat.widgetSub':'Accesso rapido · vista completa nella scheda Chat',
650
650
  'chat.tabSub':'Conversazione completa con l’esecutore — la stessa esecuzione del widget, con più spazio per leggerla.',
651
651
  'chat.idle':'Digita una richiesta — l’agente viene eseguito senza supervisione in questo progetto con tutta la sua memoria (<code>CLAUDE.md → AGENTS.md</code>) e aggiorna la bacheca in diretta.',
@@ -226,6 +226,7 @@
226
226
  <button id="filesRefresh" class="btn" type="button" title="Refresh" data-i18n-title="files.refresh">⟳</button>
227
227
  </div>
228
228
  <div class="files-create-form" id="filesCreateForm" hidden>
229
+ <div class="files-create-target" id="filesCreateTarget"></div>
229
230
  <input type="text" id="filesCreateInput" class="bl-add-input" autocomplete="off" />
230
231
  <div class="files-create-actions">
231
232
  <button id="filesCreateGo" class="btn primary" type="button" data-i18n="files.create">Create</button>
@@ -233,6 +234,7 @@
233
234
  </div>
234
235
  <span class="files-error-tip" id="filesCreateError" hidden></span>
235
236
  </div>
237
+ <div class="f-row f-root" id="filesRootRow" tabindex="0" data-i18n="files.projectRoot">project root</div>
236
238
  <div class="files-tree" id="filesTree"></div>
237
239
  </div>
238
240
  <div class="files-content-col" id="filesContent">
@@ -294,7 +294,7 @@ body { background:var(--bg); color:var(--ink); font-family:var(--sans); font-siz
294
294
  .team-wrap { max-width:1500px; } /* the agent/skill .cards grid fills more columns instead of sitting capped */
295
295
 
296
296
  /* Files tab — a two-pane explorer: a collapsible tree, and the selected file's preview/editor */
297
- .files-wrap { padding:26px 28px 60px; max-width:1600px; height:calc(100vh - 130px); display:flex; flex-direction:column; }
297
+ .files-wrap { padding:26px 28px 16px; max-width:1600px; height:calc(100vh - 90px); display:flex; flex-direction:column; }
298
298
  .files-body { flex:1; min-height:0; display:flex; gap:16px; margin-top:8px; }
299
299
  .files-tree-col { width:280px; flex-shrink:0; display:flex; flex-direction:column; gap:8px; min-height:0; }
300
300
  .files-toolbar { display:flex; gap:8px; }
@@ -313,6 +313,9 @@ body { background:var(--bg); color:var(--ink); font-family:var(--sans); font-siz
313
313
  .f-row { display:flex; align-items:center; gap:6px; padding:4px 6px; border-radius:6px; cursor:pointer; font-size:12.5px; white-space:nowrap; color:var(--muted); }
314
314
  .f-row:hover { background:var(--surface-2); color:var(--ink); }
315
315
  .f-row.is-active { background:var(--surface-2); color:var(--signal); font-weight:600; }
316
+ .f-row.is-target { background:color-mix(in srgb,var(--signal) 14%,transparent); color:var(--ink); } /* the folder new files/folders will be created in */
317
+ .f-root { font-weight:600; margin-bottom:4px; padding-bottom:6px; border-bottom:1px solid var(--line); border-radius:0; }
318
+ .files-create-target { font-size:11px; color:var(--muted); font-family:var(--mono); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
316
319
  .f-row .f-chevron { width:11px; height:11px; flex-shrink:0; transition:transform .15s; color:var(--faint); }
317
320
  .f-row.is-open .f-chevron { transform:rotate(90deg); }
318
321
  .f-row .f-name { overflow:hidden; text-overflow:ellipsis; }
@@ -329,6 +332,20 @@ body { background:var(--bg); color:var(--ink); font-family:var(--sans); font-siz
329
332
  .files-view::-webkit-scrollbar-track,.files-editor::-webkit-scrollbar-track { background:transparent; }
330
333
  .files-view { flex:1; min-height:0; overflow:auto; padding:16px 20px; }
331
334
  .files-editor { flex:1; min-height:0; width:100%; border:0; resize:none; padding:16px 20px; font-family:var(--mono); font-size:12.5px; line-height:1.6; background:var(--surface); color:var(--ink); outline:none; }
335
+ /* syntax-highlighted editor: a transparent textarea (real caret, real selection, real typing) sits
336
+ exactly on top of a highlighted <pre><code> backdrop showing through it — the standard technique
337
+ for highlighting without a full editor component. Both share identical font metrics so characters
338
+ line up; the backdrop never scrolls on its own (overflow:hidden), its scroll position is just
339
+ copied from the textarea on every scroll event. */
340
+ .files-code-wrap { position:relative; flex:1; min-height:0; }
341
+ .files-code-backdrop { position:absolute; inset:0; margin:0; overflow:hidden; pointer-events:none; white-space:pre-wrap; word-break:break-word; padding:16px 20px; font-family:var(--mono); font-size:12.5px; line-height:1.6; color:var(--ink); background:transparent; }
342
+ .files-code-backdrop code { font:inherit; background:none; }
343
+ .files-code-wrap .files-code-input { position:absolute; inset:0; background:transparent; color:transparent; caret-color:var(--ink); white-space:pre-wrap; word-break:break-word; }
344
+ .hl-comment { color:var(--faint); font-style:italic; }
345
+ .hl-string { color:var(--s-done); }
346
+ .hl-number { color:var(--cool); }
347
+ .hl-keyword { color:var(--signal); font-weight:600; }
348
+ .hl-tag { color:var(--s-in_progress); }
332
349
  .files-iframe { flex:1; min-height:0; width:100%; border:0; background:#fff; }
333
350
  .files-md-toolbar { display:flex; gap:6px; padding:8px 14px; border-bottom:1px solid var(--line); }
334
351
  .files-md-toolbar button { font-family:var(--mono); font-size:12px; padding:4px 9px; border:1px solid var(--line); border-radius:6px; background:var(--surface-2); color:var(--ink); cursor:pointer; }