kadence 0.7.0 → 0.8.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/CHANGELOG.md +72 -0
- package/README.md +15 -16
- package/dist/chunks/{board-5SQP5RX6.js → board-2HUYLTND.js} +1 -1
- package/dist/chunks/{chunk-MOXGQLKI.js → chunk-E7WLBKNZ.js} +100 -65
- package/dist/chunks/chunk-IP426V3B.js +16 -0
- package/dist/chunks/{ui-O7JSS6KE.js → ui-PATAOGVA.js} +2 -2
- package/dist/cli.js +136 -139
- package/package.json +1 -1
- package/dist/chunks/chunk-CR5YON2J.js +0 -10
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var j=["backlog","todo","in_progress","blocked","in_review","done","cancelled"],x="done",S="cancelled",F="in_progress",G="backlog",gt=["task","bug","story","epic"],pt=["low","normal","high","urgent"];function yt(t){let n=b(t.data?.title),e=t.data?.body,d=t.data?.parents;return n===null||typeof e!="string"||e.trim().length===0||!Array.isArray(d)?null:{title:n,body:e,parents:d.filter(o=>typeof o=="string")}}function ht(t,n,e){let d=[];for(let[o,a]of t){let s=a.filter((f,y)=>a.findIndex(m=>m.id===f.id)===y).map(f=>({e:f,r:yt(f)})).filter(f=>f.r!==null);if(s.length===0)continue;let l=new Set(s.flatMap(f=>f.r.parents)),i=s.filter(f=>!l.has(f.e.id));i.length===0&&(i=[s[s.length-1]]);let g=i[i.length-1],p=s[0];d.push({id:o,label:"",title:g.r.title,body:g.r.body,tasks:(n.get(o)??[]).filter(f=>e.has(f)),revision:g.e.id,revisions:s.length,conflicts:i.slice(0,-1).map(f=>({revision:f.e.id,title:f.r.title,body:f.r.body,at:f.e.ts,by:f.e.actor,source:f.e.source})),createdAt:p.e.ts,createdBy:p.e.actor,updatedAt:g.e.ts,updatedBy:g.e.actor,source:g.e.source})}return d.sort((o,a)=>o.id<a.id?-1:1),d.forEach((o,a)=>{o.label=`DOC-${a+1}`}),d}function L(t,n){for(let e=t.length-1;e>=0;e--)if(t[e].id<n)return t[e].started;return F}function Lt(t){let n=[...t].sort((r,u)=>r.id<u.id?-1:r.id>u.id?1:0),e=new Map,d=new Map,o=new Map,a=new Map,c=new Map,s=[],l=new Map,i=new Map,g=null,p=[],f={started:F,changes:[]},y=[],m=[];for(let r of n)r.type==="task.created"?V(e,r):r.type==="sprint.created"?J(d,r):r.type==="milestone.created"&&Z(o,r);for(let r of n){if(r.type==="decision.recorded"){let u=r.data??{},h=v=>typeof u[v]=="string"&&u[v].length>0?u[v]:null,w=h("title"),A=h("why");w!==null&&A!==null&&c.set(r.id,{id:r.id,label:"",title:w,why:A,rejected:h("rejected"),task:h("task"),docs:Array.isArray(u.docs)?u.docs.filter(v=>typeof v=="string"):[],supersedes:h("supersedes"),supersededBy:null,at:r.ts,by:r.actor,source:r.source});continue}if(r.type==="note.recorded"){let u=b(r.data?.text);u!==null&&s.push({id:r.id,text:u,task:b(r.data?.task),at:r.ts,by:r.actor,source:r.source});continue}if(r.type==="doc.written"){let u=l.get(r.entity)??[];u.push(r),l.set(r.entity,u);continue}if(r.type==="doc.linked"){let u=b(r.data?.task);if(u!==null){let h=i.get(r.entity)??[];h.includes(u)||h.push(u),i.set(r.entity,h)}continue}if(r.type==="template.saved"){let u=typeof r.data?.name=="string"?r.data.name:null;u!==null&&a.set(u,{name:u,fields:r.data?.fields??{},author:r.actor});continue}if(r.type==="board.configured"){let u=r.data?.statuses;if(Array.isArray(u)){let A=u.filter(v=>typeof v=="string"&&v.length>0);A.length>0&&(g=A)}let h=r.data?.dod;Array.isArray(h)&&(p=h.filter(A=>typeof A=="string"&&A.length>0));let w=b(r.data?.started);w!==null&&(f.started=w,f.changes.push({id:r.id,started:w}));continue}if(r.type==="template.deleted"){let u=typeof r.data?.name=="string"?r.data.name:null;u!==null&&a.delete(u);continue}mt(r,e,d,o,y,m,f)}let k=m,T=[...e.values()].sort((r,u)=>r.id<u.id?-1:1);T.forEach((r,u)=>{r.label=`KAD-${u+1}`,kt(r),r.criteria.sort((h,w)=>h.id<w.id?-1:1),r.criteria.forEach((h,w)=>{h.n=w+1}),bt(r)});let M=new Set(T.map(r=>r.id));for(let r of T)r.parent!==null&&!M.has(r.parent)&&(r.parent=null),r.blockedBy=r.blockedBy.filter(u=>M.has(u));let R=[...c.values()].sort((r,u)=>r.id<u.id?-1:1);R.forEach((r,u)=>{r.label=`DEC-${u+1}`});for(let r of R){if(r.supersedes===null)continue;let u=c.get(r.supersedes);u!==void 0&&(u.supersededBy=r.id)}let _=[...o.values()].sort((r,u)=>r.id<u.id?-1:1);_.forEach((r,u)=>{r.label=`MS-${u+1}`});let C=new Map;for(let r of T){if(r.milestone===null||!o.has(r.milestone))continue;let u=C.get(r.milestone)??[];u.push(r.id),C.set(r.milestone,u)}for(let r of _){r.taskIds=C.get(r.id)??[];let u=r.taskIds.map(h=>e.get(h)).filter(h=>h!==void 0);r.totalTasks=u.length,r.doneTasks=u.filter(h=>h.status===x).length,r.totalPoints=u.reduce((h,w)=>h+(w.estimate??0),0),r.donePoints=u.filter(h=>h.status===x).reduce((h,w)=>h+(w.estimate??0),0)}for(let r of R)r.task!==null&&!M.has(r.task)&&(r.task=null);for(let r of s)r.task!==null&&!M.has(r.task)&&(r.task=null);let K=ht(l,i,M);return{tasks:T,decisions:R,documents:K,milestones:_,notes:s,sprints:[...d.values()].sort((r,u)=>r.id<u.id?-1:1),statuses:g??[...j],dod:p,started:f.started,startedChanges:[...f.changes],orphanStatuses:[...new Set(T.map(r=>r.status).filter(r=>!(g??j).includes(r)))].sort(),templates:[...a.values()].sort((r,u)=>r.name.localeCompare(u.name)),cycles:wt(T),pending:k,rejected:y}}function V(t,n){if(t.has(n.entity))return;let e=n.data??{};t.set(n.entity,{id:n.entity,label:"",title:typeof e.title=="string"?e.title:"(untitled)",description:b(e.description),type:Q(e.type),priority:X(e.priority),status:G,labels:tt(e.labels),assignee:b(e.assignee),reporter:n.actor,sprint:null,milestone:null,parent:b(e.parent),blockedBy:[],due:b(e.due),claimedBy:null,claimedAt:null,claimedEventId:null,contestedBy:[],criteria:[],comments:[],docs:[],estimate:typeof e.estimate=="number"?e.estimate:null,loggedHours:0,createdAt:n.ts,updatedAt:n.ts,history:[]})}function J(t,n){if(t.has(n.entity))return;let e=n.data??{};t.set(n.entity,{id:n.entity,name:typeof e.name=="string"?e.name:"(untitled)",description:b(e.description),startDate:b(e.startDate),endDate:b(e.endDate),status:"planned",closedBy:null,taskIds:[]})}function Z(t,n){if(t.has(n.entity))return;let e=n.data??{};t.set(n.entity,{id:n.entity,label:"",name:typeof e.name=="string"?e.name:"(untitled)",due:b(e.due),status:"open",closedBy:null,taskIds:[],donePoints:0,totalPoints:0,doneTasks:0,totalTasks:0})}function mt(t,n,e,d,o,a,c){let s=t.data??{};if(t.type==="milestone.created")return Z(d,t),!0;if(t.type==="milestone.task_added"){let i=b(s.task);if(i===null)return!0;let g=n.get(i);return g===void 0?(a.push(t),!1):(g.milestone=t.entity,!0)}if(t.type==="milestone.closed"){let i=d.get(t.entity);return i===void 0?(a.push(t),!1):(i.closedBy===null?(i.status="closed",i.closedBy=t.id):o.push(t),!0)}if(t.type==="task.created")return V(n,t),q(n.get(t.entity),t),!0;if(t.type==="sprint.created")return J(e,t),!0;if(t.type.startsWith("sprint.")){let i=e.get(t.entity);if(i===void 0)return a.push(t),!1;if(t.type==="sprint.started")return i.status==="planned"&&(i.status="active"),!0;if(t.type==="sprint.updated")return i.status==="closed"?(o.push(t),!0):(typeof s.name=="string"&&(i.name=s.name),s.description!==void 0&&(i.description=b(s.description)),s.startDate!==void 0&&(i.startDate=b(s.startDate)),s.endDate!==void 0&&(i.endDate=b(s.endDate)),!0);if(t.type==="sprint.closed")return i.closedBy===null?(i.status="closed",i.closedBy=t.id):o.push(t),!0;if(t.type==="sprint.cancelled")return i.status==="planned"?i.status="cancelled":o.push(t),!0;if(t.type==="sprint.task_added"){if(i.status==="closed")return o.push(t),!0;let g=typeof s.task=="string"?s.task:null;if(g===null)return!0;let p=n.get(g);return p===void 0?(a.push(t),!1):(p.sprint=i.id,i.taskIds.includes(g)||i.taskIds.push(g),q(p,t),!0)}return!0}let l=n.get(t.entity);if(l===void 0)return a.push(t),!1;if(t.type==="task.deleted")return n.delete(t.entity),!0;switch(t.type){case"task.moved":{let i=s.to;typeof i=="string"&&i.length>0&&(l.status=i);break}case"task.cancelled":l.status=S;break;case"task.reopened":l.status=L(c.changes,t.id);break;case"task.assigned":l.assignee=b(s.assignee);break;case"task.updated":typeof s.title=="string"&&(l.title=s.title),s.description!==void 0&&(l.description=b(s.description)),s.type!==void 0&&(l.type=Q(s.type)),s.priority!==void 0&&(l.priority=X(s.priority)),s.labels!==void 0&&(l.labels=tt(s.labels)),s.due!==void 0&&(l.due=b(s.due)),typeof s.estimate=="number"&&(l.estimate=s.estimate);break;case"task.parent_set":l.parent=b(s.parent);break;case"task.blocked_by_added":{let i=b(s.blocker);i!==null&&!l.blockedBy.includes(i)&&l.blockedBy.push(i);break}case"task.blocked_by_removed":{let i=b(s.blocker);i!==null&&(l.blockedBy=l.blockedBy.filter(g=>g!==i));break}case"task.label_added":{let i=b(s.label);i!==null&&!l.labels.includes(i)&&l.labels.push(i);break}case"task.label_removed":{let i=b(s.label);i!==null&&(l.labels=l.labels.filter(g=>g!==i));break}case"task.criterion_added":{let i=b(s.text);i!==null&&l.criteria.push({id:t.id,n:0,text:i,checked:!1,checkedBy:null});break}case"task.criterion_checked":case"task.criterion_unchecked":break;case"task.doc_linked":{let i=b(s.path);i!==null&&!l.docs.includes(i)&&l.docs.push(i);break}case"task.time_logged":{let i=s.hours;typeof i=="number"&&Number.isFinite(i)&&(l.loggedHours=Math.max(0,l.loggedHours+i));break}case"task.commented":{let i=b(s.text);i!==null&&l.comments.push({id:t.id,author:t.actor,ts:t.ts,text:i,source:t.source});break}default:break}return q(l,t),!0}function bt(t){let n=new Map(t.criteria.map(e=>[e.id,e]));for(let e of t.criteria)e.checked=!1,e.checkedBy=null;for(let e of t.history){if(e.type!=="task.criterion_checked"&&e.type!=="task.criterion_unchecked")continue;let d=b(e.data.criterion),o=d===null?void 0:n.get(d);if(o===void 0)continue;let a=e.type==="task.criterion_checked";o.checked=a,o.checkedBy=a?e.actor:null}}function kt(t){let n=null,e=null,d=null,o=[],a=()=>{n=null,e=null,d=null,o=[]};for(let c of t.history)if(c.type==="task.claimed"){let s=b(c.data.by)??c.actor;n===null?(n=s,e=c.ts,d=c.id):s!==n&&!o.includes(s)&&o.push(s)}else if(c.type==="task.released"){let s=b(c.data.by)??c.actor;n===s?a():o=o.filter(l=>l!==s)}else(c.type==="task.cancelled"||c.type==="task.moved"&&c.data.to===x)&&a();t.claimedBy=n,t.claimedAt=e,t.claimedEventId=d,t.contestedBy=o}function q(t,n){t.history.push({id:n.id,type:n.type,actor:n.actor,ts:n.ts,source:n.source,data:n.data??{}}),n.ts>t.updatedAt&&(t.updatedAt=n.ts)}function b(t){return typeof t=="string"&&t.length>0?t:null}function Q(t){return gt.includes(t)?t:"task"}function X(t){return pt.includes(t)?t:"normal"}function tt(t){return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}function wt(t){let n=new Map(t.map(a=>[a.id,a])),e=[],d=new Set,o=(a,c)=>{let s=new Map,l=(i,g)=>{let p=s.get(i);if(p==="done")return;if(p==="visiting"){let y=g.indexOf(i),m=g.slice(y),k=`${a}:${[...m].sort().join(",")}`;d.has(k)||(d.add(k),e.push({kind:a,path:[...m,i]}));return}s.set(i,"visiting");let f=n.get(i);if(f!==void 0)for(let y of c(f))l(y,[...g,i]);s.set(i,"done")};for(let i of t)l(i.id,[])};return o("parent",a=>a.parent===null?[]:[a.parent]),o("blocking",a=>a.blockedBy),e}var $t=["task","decision","note","doc","sprint","milestone"];var Tt=new Set(["a","an","and","are","as","at","be","but","by","can","did","do","does","for","from","had","has","have","how","i","if","in","is","it","its","of","on","or","our","so","than","that","the","their","them","then","there","these","they","this","to","was","we","were","what","when","where","which","who","why","will","with","would","you","your"]),xt=.2,St=.35,At=new RegExp("\\p{Cc}","gu");function N(t){return t.toLowerCase().match(/[\p{L}\p{N}](?:[\p{L}\p{N}_.-]*[\p{L}\p{N}])?/gu)??[]}function it(t){return t.replace(At," ").replace(/\s+/gu," ").trim()}function vt(t,n){let e=t.split(`
|
|
3
|
+
`),d=[],o=n,a=[],c=1,s=l=>{let i=a.join(`
|
|
4
|
+
`).trim();i.length>0&&d.push({heading:o,text:i,from:c,to:l})};for(let l=0;l<e.length;l++){let i=/^(#{1,6})\s+(.*)$/.exec(e[l]);i!==null?(s(l),o=i[2].trim(),a=[],c=l+1):a.push(e[l])}return s(e.length),d}function Dt(t){let n=[];for(let e of t.tasks){let d=[e.title,e.description??"",...e.criteria.map(o=>o.text),...e.comments.map(o=>o.text)];n.push({kind:"task",id:e.id,label:e.label,title:e.title,heading:e.title,subject:"",text:d.filter(o=>o.length>0).join(`
|
|
5
|
+
`),lines:null,at:e.history[0]?.ts??"",by:e.reporter,superseded:!1})}for(let e of t.decisions)n.push({kind:"decision",id:e.id,label:e.label,title:e.title,heading:e.title,subject:"",text:[e.title,e.why,e.rejected??""].filter(d=>d.length>0).join(`
|
|
6
|
+
`),lines:null,at:e.at,by:e.by,superseded:e.supersededBy!==null});for(let e of t.notes)n.push({kind:"note",id:e.id,label:null,title:it(e.text).slice(0,60),heading:"",subject:"",text:e.text,lines:null,at:e.at,by:e.by,superseded:!1});for(let e of t.documents)for(let d of vt(e.body,e.title))n.push({kind:"doc",id:e.id,label:e.label,title:e.title,heading:d.heading,subject:e.title,text:`${d.heading}
|
|
7
|
+
${d.text}`,lines:{from:d.from,to:d.to},at:e.updatedAt,by:e.updatedBy,superseded:!1});for(let e of t.sprints)n.push({kind:"sprint",id:e.id,label:null,title:e.name,heading:e.name,subject:"",text:[e.name,e.description??""].filter(d=>d.length>0).join(`
|
|
8
|
+
`),lines:null,at:"",by:"",superseded:!1});for(let e of t.milestones)n.push({kind:"milestone",id:e.id,label:e.label,title:e.name,heading:e.name,subject:"",text:e.name,lines:null,at:"",by:"",superseded:!1});return n}var et=1.2,nt=.45,st=3,rt=2;function Et(t,n){let e=new Map,d=new Array(t.length),o=new Float64Array(t.length),a=0;for(let c=0;c<t.length;c++){let s=new Map,l=0;for(let i of N(t[c].heading))l+=st,n.has(i)&&s.set(i,(s.get(i)??0)+st);for(let i of N(t[c].subject))l+=rt,n.has(i)&&s.set(i,(s.get(i)??0)+rt);for(let i of N(t[c].text))l+=1,n.has(i)&&s.set(i,(s.get(i)??0)+1);for(let i of s.keys())e.set(i,(e.get(i)??0)+1);d[c]=s,o[c]=l,a+=l}return{df:e,frequency:d,length:o,average:t.length===0?1:a/t.length,count:t.length}}function Mt(t){let e=N(t).filter(d=>!Tt.has(d));return e.length>0?e:[]}function Rt(t,n){let e=it(t),d=e.toLowerCase(),o=-1;for(let s of n){let l=d.indexOf(s);l>=0&&(o<0||l<o)&&(o=l)}if(o<0)return{text:e.slice(0,180),start:0,end:Math.min(180,e.length)};let a=Math.max(0,o-Math.floor(180/3)),c=Math.min(e.length,a+180);if(a>0){let s=e.indexOf(" ",a);s>=0&&s<o&&(a=s+1)}if(c<e.length){let s=e.lastIndexOf(" ",c);s>a&&(c=s)}return{text:e.slice(a,c),start:a,end:c}}function _t(t,n){let e=Et(t,n),d=s=>{let l=e.df.get(s)??0;return Math.log(1+(e.count-l+.5)/(l+.5))},o=new Map([...n].map(s=>[s,d(s)])),a=0;for(let s of o.values())a+=s;let c=new Map;for(let s=0;s<t.length;s++){let l=e.frequency[s];if(l.size===0)continue;let i=1-nt+nt*(e.length[s]/e.average),g=0,p=0;for(let[f,y]of l){let m=o.get(f);g+=m*(y*(et+1))/(y+et*i),p+=m}p>=a*St&&c.set(s,{score:g,coverage:a===0?1:p/a})}return c}function ot(t,n,e={}){let d=Mt(n);if(d.length===0)return[];let o=e.kinds===void 0?null:new Set(e.kinds),a=Dt(t).filter(f=>(o===null||o.has(f.kind))&&(e.all===!0||!f.superseded));if(a.length===0)return[];let c=new Set(d),s=_t(a,c);if(s.size===0)return[];let l=[...s.entries()].sort((f,y)=>y[1].score!==f[1].score?y[1].score-f[1].score:a[f[0]].id<a[y[0]].id?-1:1),i=l[0][1].score,g=e.every===!0?l.length:e.limit??5,p=e.every===!0?0:i*xt;return l.filter(([,f])=>f.score>=p).slice(0,g).map(([f,{score:y,coverage:m}])=>{let k=a[f];return{kind:k.kind,id:k.id,label:k.label,title:k.title,score:Math.round(y*100)/100,coverage:Math.round(m*100)/100,span:Rt(k.text,d),lines:k.lines,at:k.at,by:k.by}})}var D=864e5;function P(t){return new Date(t).toISOString().slice(0,10)}function E(t){return Date.parse(`${t}T00:00:00.000Z`)}function Ct(t){let n=new Date(E(t)),e=(n.getUTCDay()+6)%7;return P(n.getTime()-e*D)}function lt(t,n){let e=P(t.getTime());return{from:P(E(e)-(n-1)*D),to:e,days:n}}function at(t,n){let e=t.slice(0,10);return e>=n.from&&e<=n.to}function $(t,n){if(t.length===0)return 0;let e=Math.max(1,Math.ceil(n*t.length));return t[e-1]}var B=t=>Math.round(t*10)/10;function z(t){if(t.length===0)return null;let n=[...t].sort((e,d)=>e-d);return{shown:{n:n.length,p50:B($(n,.5)),p85:B($(n,.85)),p95:B($(n,.95))},rawP85:$(n,.85)}}function U(t,n){let e=t.indexOf(n);return e===-1?null:new Set(t.slice(0,e))}function Y(t,n,e=[],d=[]){let o=U(e,n),a=s=>s===x||s===S?!1:o===null?s===n:s===n||!o.has(s);return t.history.find(s=>s.type==="task.reopened"?a(L(d,s.id)):s.type==="task.moved"&&typeof s.data.to=="string"&&a(s.data.to))?.ts??null}function It(t,n){if(n.status===x||n.status===S)return!1;let e=U(t.statuses,t.started);return e===null?n.status===t.started:e.has(n.status)?!1:Y(n,t.started,t.statuses,t.startedChanges)!==null}function I(t){if(t.status!==x)return null;for(let n=t.history.length-1;n>=0;n--){let e=t.history[n];if(e.type==="task.moved"&&e.data.to===x)return e.ts}return null}function Bt(t){if(t.status!==S)return null;for(let n=t.history.length-1;n>=0;n--){let e=t.history[n];if(e.type==="task.cancelled"||e.type==="task.moved"&&e.data.to===S)return e.ts}return null}function O(t,n){return Math.max(0,(Date.parse(n)-Date.parse(t))/D)}function Pt(t,n,e,d){let o=I(t)??Bt(t),a=o===null?d:Date.parse(o),c=[],s=new Map;for(let y of t.history){let m=typeof y.data.blocker=="string"?y.data.blocker:null;if(m!==null){if(y.type==="task.blocked_by_added")s.has(m)||s.set(m,Date.parse(y.ts));else if(y.type==="task.blocked_by_removed"){let k=s.get(m);k!==void 0&&(c.push([k,Math.min(Date.parse(y.ts),a)]),s.delete(m))}}}for(let[y,m]of s){let k=Math.min(n.get(y)??d,a);c.push([m,Math.max(m,k)])}let l=E(e.from),i=E(e.to)+D,g=c.map(([y,m])=>[Math.max(y,l),Math.min(m,i)]).filter(([y,m])=>m>y).sort((y,m)=>y[0]-m[0]),p=0,f=null;for(let[y,m]of g)f===null||y>f[1]?(f!==null&&(p+=f[1]-f[0]),f=[y,m]):m>f[1]&&(f[1]=m);return f!==null&&(p+=f[1]-f[0]),p/D}function Ht(t,n=new Date,e=30){let d=lt(n,e),o=n.getTime(),a=[],c=t.tasks.filter(r=>r.status!==S),s=c.filter(r=>{let u=I(r);return u!==null&&at(u,d)}),l=[],i=[],g=[];for(let r of s){let u=I(r),h=Y(r,t.started,t.statuses,t.startedChanges);i.push(O(r.createdAt,u)),h!==null&&(l.push(O(h,u)),g.push(O(r.createdAt,h)))}let p=z(l),f=p?.shown??null,y=c.filter(r=>It(t,r)),m=y.map(r=>{let u=O(Y(r,t.started,t.statuses,t.startedChanges),n.toISOString());return{label:r.label,title:r.title,status:r.status,ageDays:B(u),overP85:p!==null&&u>p.rawP85}}).sort((r,u)=>u.ageDays-r.ageDays),k=new Map,T=r=>{let u=Ct(r),h=k.get(u);return h===void 0&&(h={week:u,finished:0,created:0},k.set(u,h)),h};for(let r=E(d.from);r<=E(d.to);r+=D)T(P(r));for(let r of s)T(I(r).slice(0,10)).finished+=1;for(let r of c)at(r.createdAt,d)&&(T(r.createdAt.slice(0,10)).created+=1);let M=[...k.values()].sort((r,u)=>r.week<u.week?-1:1),R=new Map;for(let r of t.tasks){let u=I(r);u!==null&&R.set(r.id,Date.parse(u))}let _=0,C=0;for(let r of c){let u=Pt(r,R,d,o);u>0&&(_+=1,C+=u)}t.tasks.length===0?a.push("No tasks yet."):(y.length===0&&s.length===0&&a.push(`Nothing has crossed "${t.started}" yet. If work starts in another column, say so: kadence board config --started <status>`),s.length===0?a.push(`Nothing finished between ${d.from} and ${d.to}; cycle time needs finished work.`):l.length===0&&a.push(`${s.length} item(s) finished without ever entering "${t.started}", so there is no cycle time to measure.`),t.statuses.includes(t.started)||a.push(`"${t.started}" is not one of the board's columns; set one with kadence board config --started.`));let K=f===null?null:`${f.n<10?`From ${f.n} finished items (a small sample): `:""}85% of finished items took ${f.p85} calendar days or less.`;return{window:d,started:t.started,unit:"calendar days",wip:y.length,finished:s.length,perWeek:M,cycleTime:f,leadTime:z(i)?.shown??null,responseTime:z(g)?.shown??null,sle:K,aging:m,blocked:{tasks:_,days:B(C)},notes:a}}function Wt(t,n=new Date,e=30){let d=lt(n,e),o=[...t.statuses];for(let l of t.tasks)o.includes(l.status)||o.push(l.status);let a=G;!o.includes(a)&&t.tasks.length>0&&o.unshift(a);let c=t.tasks.map(l=>{let i=[];for(let g of l.history)g.type==="task.moved"&&typeof g.data.to=="string"?i.push({at:Date.parse(g.ts),status:g.data.to}):g.type==="task.cancelled"?i.push({at:Date.parse(g.ts),status:S}):g.type==="task.reopened"&&i.push({at:Date.parse(g.ts),status:L(t.startedChanges,g.id)});return{createdAt:Date.parse(l.createdAt),changes:i,next:0,status:a}}),s=[];for(let l=E(d.from);l<=E(d.to);l+=D){let i=l+D,g={};for(let p of o)g[p]=0;for(let p of c){for(;p.next<p.changes.length&&p.changes[p.next].at<i;)p.status=p.changes[p.next].status,p.next+=1;p.createdAt>=i||(g[p.status]=(g[p.status]??0)+1)}s.push({date:P(l),counts:g})}return{window:d,statuses:o,days:s}}var H={urgent:0,high:1,normal:2,low:3};function dt(t,n,e=new Date){let d=e.toISOString().slice(0,10);return t.filter(o=>{if(n.status!==void 0&&o.status!==n.status||n.type!==void 0&&o.type!==n.type||n.priority!==void 0&&o.priority!==n.priority)return!1;if(n.assignee!==void 0){let a=n.assignee.toLowerCase(),c=(o.assignee??"").toLowerCase();if(a==="none"?c!=="":c!==a)return!1}if(n.label!==void 0){let a=n.label.toLowerCase();if(!o.labels.some(c=>c.toLowerCase()===a))return!1}return!(n.sprint!==void 0&&o.sprint!==n.sprint||n.overdue===!0&&(o.due===null||o.due>=d)||n.dueBefore!==void 0&&(o.due===null||o.due>=n.dueBefore))})}function Yt(t,n,e=new Date){let d=n.search?.trim()??"";if(d.length===0)return dt(t.tasks,n,e);let o=new Map(ot(t,d,{kinds:["task"],every:!0}).map((a,c)=>[a.id,c]));return dt(t.tasks.filter(a=>o.has(a.id)),n,e).sort((a,c)=>o.get(a.id)-o.get(c.id))}function Vt(t,n){let e=[...t];switch(n){case"priority":return e.sort((d,o)=>H[d.priority]-H[o.priority]);case"due":return e.sort((d,o)=>ut(d.due,o.due,(a,c)=>a<c?-1:a>c?1:0));case"estimate":return e.sort((d,o)=>ut(d.estimate,o.estimate,(a,c)=>c-a));default:return e.sort((d,o)=>d.id<o.id?-1:d.id>o.id?1:0)}}function ut(t,n,e){return t===null&&n===null?0:t===null?1:n===null?-1:e(t,n)}function Jt(t){let n=[];return t.search!==void 0&&n.push(`search="${t.search}"`),t.status!==void 0&&n.push(`status=${t.status}`),t.type!==void 0&&n.push(`type=${t.type}`),t.priority!==void 0&&n.push(`priority=${t.priority}`),t.assignee!==void 0&&n.push(`assignee=${t.assignee}`),t.label!==void 0&&n.push(`label=${t.label}`),t.overdue===!0&&n.push("overdue"),t.dueBefore!==void 0&&n.push(`due before ${t.dueBefore}`),n.length===0?`No tasks yet.
|
|
9
|
+
Create the first one:
|
|
10
|
+
kadence task add "title"`:`No tasks match ${n.join(" and ")}.
|
|
11
|
+
Try fewer filters:
|
|
12
|
+
kadence task list`}function ct(t,n){return t===null||n===null?!1:t===n?!0:!n.includes("#")&&t.startsWith(`${n}#`)}function jt(t){let n=t.indexOf("#");return n===-1?t:t.slice(0,n)}function ft(t){return U(t.statuses??j,t.started??F)}function W(t){return t.status===x||t.status===S}function Zt(t,n={}){let e=n.viewer??null,d=new Set(t.filter(W).map(s=>s.id)),o=n.assignee==="me"?e===null?null:jt(e):n.assignee??null,a=ft(n);return t.filter(s=>{if(W(s)||a!==null&&!a.has(s.status)||s.blockedBy.some(l=>!d.has(l))||s.claimedBy!==null&&!ct(s.claimedBy,e)&&s.contestedBy.length===0)return!1;if(o!==null){if(o==="none")return s.assignee===null;if(s.assignee!==o)return!1}return!0}).sort((s,l)=>H[s.priority]-H[l.priority]||(s.id<l.id?-1:1))}function Qt(t,n,e,d={}){if(t.length===0)return`No tasks yet.
|
|
13
|
+
Create the first one:
|
|
14
|
+
kadence task add "title"`;let o=t.filter(f=>!W(f));if(o.length===0)return"Nothing ready: every task is done or cancelled.";let a=new Set(t.filter(W).map(f=>f.id)),c=ft(d),s=c===null?0:o.filter(f=>!c.has(f.status)).length,l=o.filter(f=>f.blockedBy.some(y=>!a.has(y))).length,i=o.filter(f=>f.claimedBy!==null&&!ct(f.claimedBy,n)&&f.contestedBy.length===0).length,g=[];return s>0&&g.push(`${s} already started`),l>0&&g.push(`${l} blocked`),i>0&&g.push(`${i} claimed by someone else`),e!==void 0&&g.push(`filtered to assignee=${e}`),`Nothing ready${g.length>0?` (${g.join(", ")})`:""}.
|
|
15
|
+
See the whole board:
|
|
16
|
+
kadence task list`}var Ft=["created","priority","due","estimate"];function Xt(t){return Ft.includes(t)}export{j as a,x as b,S as c,gt as d,pt as e,Lt as f,$t as g,ot as h,Y as i,It as j,I as k,Ht as l,Wt as m,Yt as n,Vt as o,Jt as p,ct as q,W as r,Zt as s,Qt as t,Ft as u,Xt as v};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{$ as N,A as p,D as f,G as d,I as m,K as S,N as x,O as E,Q as y,S as B,V as A,aa as R,b as g,ba as F,c as b,ca as P,d as T,ga as U,ha as j,ia as O,w as h,y as k,z as C}from"./chunk-
|
|
2
|
+
import{$ as N,A as p,D as f,G as d,I as m,K as S,N as x,O as E,Q as y,S as B,V as A,aa as R,b as g,ba as F,c as b,ca as P,d as T,ga as U,ha as j,ia as O,w as h,y as k,z as C}from"./chunk-E7WLBKNZ.js";import"./chunk-IP426V3B.js";async function q(t,e){let i=h(t,e);if(!k(i))return i;if(process.stdout.isTTY!==!0)return{ok:!1,exitCode:1,message:`The interactive board needs a terminal.
|
|
3
3
|
For pipes and scripts use:
|
|
4
|
-
kadence board --json`};let c;try{c=await import("./board-
|
|
4
|
+
kadence board --json`};let c;try{c=await import("./board-2HUYLTND.js")}catch(r){return{ok:!1,exitCode:1,message:`The interactive board could not start: ${r.message}
|
|
5
5
|
The plain board always works:
|
|
6
6
|
kadence board`}}return c.runBoardUi({reload:()=>p(i.root,i.actor),actor:i.actor,branchEventIds:()=>{let r=g(i.root);if(r===null)return{reason:"detached"};let n=b(i.root),a=T(i.root,n,r);return a===null?{reason:"no-base",base:n}:{ids:a,name:r,base:n}},move:(r,n)=>o(f(t,e,r,n)),assign:(r,n)=>o(d(t,e,r,n)),create:r=>o(C(t,e,r,{})),remove:r=>o(S(t,e,r)),edit:r=>{if(!O(e,!0))return"No editor available.";let{state:n}=p(i.root,i.actor),a=n.tasks.find(u=>u.id===r);if(a===void 0)return"Task not found.";let s=j(e,a.description??"",`Editing the description of ${a.label}.`);return s.error!==null?s.error:s.text===null?"Aborted \u2014 nothing changed.":o(m(t,e,r,{description:s.text}))},comment:(r,n)=>o(B(t,e,r,n)),setField:(r,n,a)=>{let s=a.trim();if(n==="status")return o(f(t,e,r,s));if(n==="assignee")return o(d(t,e,r,s.length===0?"none":s));if(n==="estimate"){let u=Number(s);return!Number.isFinite(u)||u<0?"Estimate must be a positive number.":o(m(t,e,r,{estimate:u}))}if(n==="labels"){let u=s.split(",").map(l=>l.trim()).filter(l=>l.length>0);return o(m(t,e,r,{labels:u}))}return o(m(t,e,r,{[n]:s}))},logTime:(r,n)=>o(A(t,e,r,n)),setPriority:(r,n)=>o(m(t,e,r,{priority:n})),addToSprint:r=>o(N(t,e,r,{})),claim:r=>o(x(t,e,r,{})),release:r=>o(E(t,e,r)),toggleCriterion:(r,n,a)=>o(y(t,e,r,String(n),a)),sprintStatus:()=>F(t,e).message,burndown:()=>U(t,e,void 0).message,sprintStart:()=>o(P(t,e,void 0)),sprintClose:()=>o(R(t,e))}),{ok:!0,exitCode:0,message:""}}function o(t){return t.message.split(`
|
|
7
7
|
`)[0]??""}export{q as runUi};
|