kadence 0.4.1 → 0.6.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 +255 -0
- package/README.md +131 -87
- package/dist/chunks/board-5SQP5RX6.js +12 -0
- package/dist/chunks/chunk-CR5YON2J.js +10 -0
- package/dist/chunks/chunk-J7QEHKDW.js +248 -0
- package/dist/chunks/{ui-BZTPZE22.js → ui-OTWFK76P.js} +3 -3
- package/dist/cli.js +225 -125
- package/package.json +10 -8
- package/scripts/reference.mjs +120 -0
- package/dist/chunks/board-YUJ6VL5O.js +0 -12
- package/dist/chunks/chunk-CDGGOWGY.js +0 -10
- package/dist/chunks/chunk-FKPFXIL4.js +0 -224
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kadence",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Your team and your AI agents work from the same context: tasks, their full history and time as plain files in your git repository",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
+
"scripts/reference.mjs",
|
|
15
16
|
"README.md",
|
|
16
17
|
"LICENSE",
|
|
17
18
|
"CHANGELOG.md"
|
|
@@ -21,7 +22,8 @@
|
|
|
21
22
|
"test:watch": "vitest",
|
|
22
23
|
"build": "node scripts/build.mjs",
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
25
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
26
|
+
"reference": "node scripts/reference.mjs"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
27
29
|
"blessed": "^0.1.81"
|
|
@@ -37,14 +39,14 @@
|
|
|
37
39
|
"keywords": [
|
|
38
40
|
"cli",
|
|
39
41
|
"git",
|
|
42
|
+
"ai-agents",
|
|
43
|
+
"shared-context",
|
|
44
|
+
"claude-code",
|
|
45
|
+
"agents-md",
|
|
46
|
+
"decisions",
|
|
40
47
|
"task",
|
|
41
|
-
"sprint",
|
|
42
|
-
"velocity",
|
|
43
48
|
"kanban",
|
|
44
49
|
"tui",
|
|
45
|
-
"project-management",
|
|
46
|
-
"ai-agents",
|
|
47
|
-
"shared-context",
|
|
48
50
|
"event-sourcing",
|
|
49
51
|
"offline"
|
|
50
52
|
],
|
|
@@ -52,7 +54,7 @@
|
|
|
52
54
|
"type": "git",
|
|
53
55
|
"url": "git+https://github.com/bogutskiandriy/kadence.git"
|
|
54
56
|
},
|
|
55
|
-
"homepage": "https://
|
|
57
|
+
"homepage": "https://kadence.guru",
|
|
56
58
|
"bugs": {
|
|
57
59
|
"url": "https://github.com/bogutskiandriy/kadence/issues"
|
|
58
60
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command reference, read out of the binary rather than written about it.
|
|
3
|
+
*
|
|
4
|
+
* The site used to carry a hand-typed CLI page. It described 0.3 for the whole
|
|
5
|
+
* of 0.4 — nine commands and a dozen flags shipped without it noticing, because
|
|
6
|
+
* prose has no test. This produces the same page's content from the binary that
|
|
7
|
+
* is about to be published: `--help` for the shape a person reads, and
|
|
8
|
+
* `schema --json` for the contract an agent reads, in one file.
|
|
9
|
+
*
|
|
10
|
+
* The generator lives here and not in the site because ADR-008 puts anything
|
|
11
|
+
* derived from the product inside the product: the site consumes the output of
|
|
12
|
+
* a release, it does not reach into the source. `dist/reference.json` ships in
|
|
13
|
+
* the package, so a site build — or an agent with kadence installed — reads the
|
|
14
|
+
* reference of the exact version it depends on, with no network and no
|
|
15
|
+
* guessing.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately no timestamp. It would rewrite the file on every build and fill
|
|
18
|
+
* diffs with noise, while the version changes exactly when the content might
|
|
19
|
+
* have. The same argument as the provenance marker `init` writes (ADR-009).
|
|
20
|
+
*
|
|
21
|
+
* node scripts/reference.mjs writes dist/reference.json
|
|
22
|
+
* node scripts/reference.mjs --stdout prints it, for a pipe
|
|
23
|
+
*/
|
|
24
|
+
import { execFileSync } from 'node:child_process';
|
|
25
|
+
import { writeFileSync } from 'node:fs';
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
|
|
28
|
+
const CLI = fileURLToPath(new URL('../dist/cli.js', import.meta.url));
|
|
29
|
+
const OUT = fileURLToPath(new URL('../dist/reference.json', import.meta.url));
|
|
30
|
+
|
|
31
|
+
/** Runs the built CLI and returns stdout. Its stderr is never part of a contract. */
|
|
32
|
+
function cli(args) {
|
|
33
|
+
return execFileSync('node', [CLI, ...args], {
|
|
34
|
+
encoding: 'utf8',
|
|
35
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
36
|
+
env: { ...process.env, NO_COLOR: '1' },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Splits a help line into its left column and its description.
|
|
42
|
+
*
|
|
43
|
+
* cac pads the columns with spaces, so two or more of them is the separator.
|
|
44
|
+
* A single space inside a flag — `--keep-months <n>`, `-a, --assignee <who>` —
|
|
45
|
+
* is therefore safe, which is why this is not a split on whitespace.
|
|
46
|
+
*/
|
|
47
|
+
function twoColumns(line) {
|
|
48
|
+
const match = line.trim().match(/^(.*?)\s{2,}(.*)$/);
|
|
49
|
+
if (!match) return { left: line.trim(), right: '' };
|
|
50
|
+
return { left: match[1].trim(), right: match[2].trim() };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Returns the indented body of a `Heading:` block, stopping at the next one. */
|
|
54
|
+
function section(help, heading) {
|
|
55
|
+
const lines = help.split('\n');
|
|
56
|
+
const start = lines.findIndex((l) => l.trim() === `${heading}:`);
|
|
57
|
+
if (start === -1) return [];
|
|
58
|
+
|
|
59
|
+
const body = [];
|
|
60
|
+
for (const line of lines.slice(start + 1)) {
|
|
61
|
+
if (line.trim() === '') continue;
|
|
62
|
+
if (/^\S/.test(line)) break; // an unindented line starts the next section
|
|
63
|
+
body.push(line);
|
|
64
|
+
}
|
|
65
|
+
return body;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** One command, as `kadence <name> --help` describes it. */
|
|
69
|
+
function readCommand(name, summary) {
|
|
70
|
+
const help = cli([name, '--help']);
|
|
71
|
+
|
|
72
|
+
const usage = (section(help, 'Usage')[0] ?? '').trim().replace(/^\$\s*/, '');
|
|
73
|
+
|
|
74
|
+
const options = section(help, 'Options')
|
|
75
|
+
.map(twoColumns)
|
|
76
|
+
.filter(({ left }) => left.startsWith('-'))
|
|
77
|
+
.map(({ left, right }) => ({ flag: left, description: right }));
|
|
78
|
+
|
|
79
|
+
// Examples keep their internal spacing: several carry an aligned note after
|
|
80
|
+
// the command, and collapsing it would run the two together.
|
|
81
|
+
const examples = section(help, 'Examples').map((l) => l.replace(/^\s{2}/, '').trimEnd());
|
|
82
|
+
|
|
83
|
+
return { name, summary, usage, options, examples };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function buildReference() {
|
|
87
|
+
const topLevel = cli(['--help']);
|
|
88
|
+
|
|
89
|
+
const version = (topLevel.match(/^kadence\/(\S+)/m) ?? [])[1];
|
|
90
|
+
if (!version) throw new Error('could not read the version from `kadence --help`');
|
|
91
|
+
|
|
92
|
+
const commands = section(topLevel, 'Commands')
|
|
93
|
+
.map(twoColumns)
|
|
94
|
+
.map(({ left, right }) => ({ name: left.split(/\s+/)[0], summary: right }))
|
|
95
|
+
.filter(({ name }) => name && !name.startsWith('-'))
|
|
96
|
+
.map(({ name, summary }) => readCommand(name, summary));
|
|
97
|
+
|
|
98
|
+
const contract = JSON.parse(cli(['schema', '--json'])).contract;
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
tool: { name: 'kadence', version },
|
|
102
|
+
generatedFrom: 'scripts/reference.mjs, from `kadence --help` and `kadence schema --json`',
|
|
103
|
+
commands,
|
|
104
|
+
contract,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Only when run directly: importing this from a test must not write a file.
|
|
109
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
110
|
+
const reference = buildReference();
|
|
111
|
+
const json = `${JSON.stringify(reference, null, 2)}\n`;
|
|
112
|
+
|
|
113
|
+
if (process.argv.includes('--stdout')) {
|
|
114
|
+
process.stdout.write(json);
|
|
115
|
+
} else {
|
|
116
|
+
writeFileSync(OUT, json);
|
|
117
|
+
const kb = (Buffer.byteLength(json) / 1024).toFixed(0);
|
|
118
|
+
console.error(`wrote dist/reference.json (${kb} KB, ${reference.commands.length} commands)`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{p as ee}from"./chunk-CDGGOWGY.js";import S from"blessed";var u={border:"gray",borderFocus:"cyan",headerFg:"white",headerBg:"blue",selectedFg:"black",selectedBg:"cyan",dim:"gray",hint:"gray",warn:"yellow",danger:"red"},he={backlog:"gray",todo:"white",in_progress:"blue",doing:"blue",blocked:"red",in_review:"magenta",review:"magenta",done:"green",shipped:"green"};function te(n){return he[n]??"white"}var pe={urgent:"\u203C",high:"\u2191",normal:" ",low:"\u2193"},me={urgent:"red",high:"yellow",normal:"white",low:"gray"},ye={bug:"\u2716",story:"\u25C6",epic:"\u2B22",task:"\xB7"};function k(n,o){return`{${o}-fg}${n}{/}`}function q(n,o){let d=k(pe[n.priority],me[n.priority]),h=k(ye[n.type]??"\xB7","gray"),f=k(n.label,"cyan"),c=[];n.blockedBy.length>0&&c.push(k("\u2298","red")),n.contestedBy.length>0?c.push(k("\u2691","magenta")):n.claimedBy!==null&&c.push(k("\u2713","green"));let E=n.criteria.filter(L=>!L.checked).length;if(E>0?c.push(k(`${n.criteria.length-E}/${n.criteria.length}`,"yellow")):n.criteria.length>0&&c.push(k("\u2611","green")),n.comments.length>0&&c.push(k("\u{1F4AC}","gray")),n.due!==null){let L=n.due<new Date().toISOString().slice(0,10);c.push(k(L?"\u23F0":"\u{1F4C5}",L?"red":"gray"))}let C=[n.assignee!==null?k(`@${n.assignee.split("@")[0]}`,"gray"):"",n.estimate!==null?k(String(n.estimate),"yellow"):"",c.join("")].filter(L=>L.length>0).join(" "),p=`${N(d)}${N(h)} ${N(f)} `,y=C.length>0?` ${N(C)}`:"",T=Math.max(4,o-p.length-y.length),O=[...n.title],U=O.length>T?`${O.slice(0,T-1).join("")}\u2026`:n.title;return`${d}${h} ${f} ${U}${C.length>0?` ${C}`:""}`}function G(n,o){return o?`{cyan-bg}{black-fg}${N(n)}{/}`:` ${n}`}function W(n,o,d,h=12){let f=`${n.padEnd(h)} ${o}`;return d?`{cyan-bg}{black-fg}\u25B8 ${f}{/}`:` ${f}`}function N(n){return n.replace(/\{[^}]*\}/g,"")}var ne=["\u2190\u2192\u2191\u2193 move","enter details","[ ] shift","m status","a assign","c comment","e edit","n new","s sprint","/ filter","R ready","b branch","M milestone","C claim","? help","q quit (Ctrl-C forces)"].join(" ");function ie(n){let o=[],d=!1;function h(){d=!0,setImmediate(()=>{d=!1})}return{dispatch(f){if(d)return;let c=o[o.length-1];c!==void 0?c(f):n(f)},push(f){o.push(f),h();let c=!1;return()=>{if(c)return;c=!0;let E=o.lastIndexOf(f);E!==-1&&o.splice(E,1),h()}},isDialogOpen:()=>o.length>0,depth:()=>o.length}}function se(n){if(n.ch==="")return!1;let o=n.ch.charCodeAt(0);return o<32||o===127}var be=["up","down","pageup","pagedown","home","end"],re=["escape","q"];function z(n){return be.includes(n.name)}function oe(n){return re.includes(n.name)||re.includes(n.ch)}function _(n,o,d){return d===0?0:(n+o+d)%d}var le="cancelled";function Se(n){let o=S.screen({smartCSR:!0,title:"kadence",fullUnicode:!0,mouse:!0}),{state:d}=n.reload(),h=n.branchEventIds(),f="",c=!1,E=!1,C="",p=[],y=0,T=ie(t=>ce(t));function O(t=0){try{o.destroy()}catch{}process.exit(t)}process.on("SIGINT",()=>O(0)),process.on("SIGTERM",()=>O(0)),o.program.on("keypress",(t,r)=>{let i={ch:t??"",name:r?.name??""};(i.name==="C-c"||i.ch==="")&&O(0),!(se(i)&&i.name!=="enter"&&i.name!=="escape")&&T.dispatch(i)});let U=S.box({parent:o,top:0,height:1,width:"100%",tags:!0,style:{fg:u.headerFg,bg:u.headerBg}}),L=S.box({parent:o,bottom:0,height:1,width:"100%",tags:!0,content:` ${ne}`,style:{fg:u.hint}}),J=S.box({parent:o,bottom:1,height:1,width:"100%",tags:!0,style:{fg:u.warn}});function b(t,r=u.warn){J.setContent(` ${t}`),J.style.fg=r,o.render()}function A(){let t=d.statuses.filter(i=>i!==le),r=d.orphanStatuses.filter(i=>i!==le);return[...t,...r]}function ae(t){let r=f.toLowerCase(),i=c?new Set(ee(d.tasks,{viewer:n.actor,statuses:d.statuses,started:d.started}).map(s=>s.id)):null,e=E&&!("reason"in h)?h:null,l=e===null?null:s=>e.ids.has(s.id)||s.history.some(w=>e.ids.has(w.id)),a=C===""?null:d.milestones.find(s=>s.label===C)?.id??null;return d.tasks.filter(s=>s.status===t&&(i===null||i.has(s.id))&&(l===null||l(s))&&(a===null||s.milestone===a)&&(r===""||s.title.toLowerCase().includes(r)||(s.assignee??"").toLowerCase().includes(r)||s.labels.some(w=>w.toLowerCase().includes(r))))}function Q(){for(let i of p)i.box.destroy();p=[];let t=A(),r=Math.max(Math.floor(100/Math.max(t.length,1)),12);t.forEach((i,e)=>{let l=S.box({parent:o,top:1,left:`${e*r}%`,width:`${r}%`,bottom:2,label:` ${i} `,border:{type:"line"},style:{border:{fg:u.border},label:{fg:te(i)}}}),a=S.list({parent:l,top:0,left:0,right:0,bottom:0,keys:!1,mouse:!1,interactive:!1,tags:!0,scrollable:!0,style:{selected:{fg:u.selectedFg,bg:u.selectedBg},item:{fg:"white"}}});p.push({status:i,box:l,list:a,tasks:[],cursor:0})})}function m(t=!1){t&&(d=n.reload().state,h=n.branchEventIds()),p.length!==A().length&&Q();let r=0,i=0;p.forEach((s,w)=>{s.tasks=ae(s.status),r+=s.tasks.length,i+=s.tasks.reduce((R,F)=>R+(F.estimate??0),0);let P=s.box.width-4;s.cursor=Math.min(s.cursor,Math.max(0,s.tasks.length-1)),s.list.setItems(s.tasks.map((R,F)=>G(q(R,P),w===y&&F===s.cursor)));let Y=s.tasks.reduce((R,F)=>R+(F.estimate??0),0);s.box.setLabel(` ${s.status} (${s.tasks.length}${Y>0?`, ${Y}`:""}) `),s.box.style.border.fg=w===y?u.borderFocus:u.border});let e=d.sprints.find(s=>s.status==="active"),l=e===void 0?"no active sprint":e.name,a=(f===""?"":` filter: "${f}"`)+(c?" ready only":"")+(E&&!("reason"in h)?` branch: ${h.name}`:"")+(C===""?"":` milestone: ${C}`);U.setContent(` kadence ${l} ${r} tasks, ${i} points${a}`),d.cycles.length>0&&b(`${d.cycles.length} dependency cycle(s) \u2014 see kadence task list`,u.danger),o.render()}function I(){let t=p[y];return t?.tasks[t.cursor]}function V(){p.forEach((t,r)=>{let i=t.box.width-4;t.list.setItems(t.tasks.map((e,l)=>G(q(e,i),r===y&&l===t.cursor))),t.box.style.border.fg=r===y?u.borderFocus:u.border}),o.render()}function x(t){t!==null?b(t,u.warn):b(""),m(!0)}function K(t,r,i){let e=T.push(()=>{}),l=S.prompt({parent:o,top:"center",left:"center",width:"60%",height:7,border:{type:"line"},style:{border:{fg:u.borderFocus}},keys:!0,mouse:!0});l.input(t,r,(a,s)=>{l.destroy(),e(),o.render(),typeof s=="string"&&i(s.trim())})}function de(t){let r=S.box({parent:o,top:"center",left:"center",width:"75%",height:"80%",border:{type:"line"},label:` ${t.label} `,style:{border:{fg:u.borderFocus}},tags:!0,keys:!0,mouse:!0}),i=[{key:"title",label:"title",value:()=>t.title,hint:"Title:"},{key:"description",label:"description",value:()=>(t.description??"\u2014").split(`
|
|
3
|
-
`)[0]??"\u2014",hint:"Description (one line here, e for $EDITOR):"},{key:"status",label:"status",value:()=>t.status,hint:`Status (${A().join(", ")}):`},{key:"type",label:"type",value:()=>t.type,hint:"Type (task, bug, story, epic):"},{key:"priority",label:"priority",value:()=>t.priority,hint:"Priority (low, normal, high, urgent):"},{key:"assignee",label:"assignee",value:()=>t.assignee??"\u2014",hint:'Assignee (or "none"):'},{key:"estimate",label:"estimate",value:()=>t.estimate===null?"\u2014":String(t.estimate),hint:"Estimate in points:"},{key:"due",label:"due",value:()=>t.due??"\u2014",hint:"Due date YYYY-MM-DD (empty clears):"},{key:"labels",label:"labels",value:()=>t.labels.length>0?t.labels.join(", "):"\u2014",hint:"Labels, comma separated:"}],e=()=>[...i.map((v,g)=>({kind:"field",index:g})),...t.criteria.map(v=>({kind:"criterion",n:v.n}))],l=S.list({parent:r,top:0,left:1,right:1,height:i.length+t.criteria.length,keys:!1,mouse:!1,interactive:!1,tags:!0,style:{selected:{fg:u.selectedFg,bg:u.selectedBg}}}),a=0,s=S.box({parent:r,top:i.length+t.criteria.length+1,left:1,right:1,bottom:0,tags:!0,scrollable:!0});function w(){l.setItems(e().map((g,M)=>g.kind==="field"?W(i[g.index].label,i[g.index].value(),M===a):W(` ${g.n}.`,`[${t.criteria.find($=>$.n===g.n)?.checked===!0?"x":" "}] ${t.criteria.find($=>$.n===g.n)?.text??""}`,M===a)));let v=[t.blockedBy.length>0?`{red-fg}blocked by ${t.blockedBy.length} task(s){/}`:"",t.parent!==null?"{gray-fg}has a parent{/}":"",t.loggedHours>0?`{gray-fg}logged ${t.loggedHours.toFixed(1)}h{/}`:"","",t.description!==null&&t.description.includes(`
|
|
4
|
-
`)?`{gray-fg}${t.description.split(`
|
|
5
|
-
`).slice(1).join(`
|
|
6
|
-
`)}{/}`:"",t.comments.length>0?`{cyan-fg}comments (${t.comments.length}){/}`:"",...t.comments.map(g=>` {gray-fg}${g.author}:{/} ${g.text}`),"",t.criteria.length>0?"{gray-fg}space toggles the criterion under the cursor{/}":"","{gray-fg}\u2191\u2193 field enter edit e description in $EDITOR esc close{/}","{gray-fg}description opens the editor, so it can hold paragraphs{/}"].filter(g=>g!=="");s.setContent(v.join(`
|
|
7
|
-
`)),o.render()}w();let P=T.push(v=>ge(v)),Y=()=>{P(),r.destroy(),m(!0)};function R(){d=n.reload().state;let v=d.tasks.find(g=>g.id===t.id);if(v===void 0){Y();return}Object.assign(t,v),w()}function F(){let v=Z(()=>n.edit(t.id));v!==null&&b(v),R()}function ge(v){let{ch:g,name:M}=v;if(M==="up"||g==="k")return a=_(a,-1,e().length),w();if(M==="down"||g==="j")return a=_(a,1,e().length),w();if(g===" "||M==="space"){let $=e()[a];if($===void 0||$.kind!=="criterion")return;let j=t.criteria.find(D=>D.n===$.n);if(j===void 0)return;let B=n.toggleCriterion(t.id,$.n,j.checked);return B!==null&&b(B),R()}if(oe(v))return Y();if(g==="e")return F();if(M==="enter"){let $=e()[a];if($!==void 0&&$.kind==="criterion"){let B=t.criteria.find(fe=>fe.n===$.n);if(B===void 0)return;let D=n.toggleCriterion(t.id,$.n,B.checked);return D!==null&&b(D),R()}let j=i[a];if(j===void 0)return;if(j.key==="description")return F();K(j.hint,j.value()==="\u2014"?"":j.value(),B=>{let D=n.setField(t.id,j.key,B);D!==null&&b(D),R()})}}o.render()}function ue(){let t=["{cyan-fg}Navigation{/}"," \u2190 \u2192 h l move between columns"," \u2191 \u2193 k j move between tasks"," enter task details"," / filter escape clears it"," r reload from the journal"," R show only what can be started now (ready)"," b show only what this branch introduced"," M show only one milestone (empty clears it)"," C claim the selected task, or release it if it is yours","","{cyan-fg}Task actions{/}"," [ ] move one column left or right"," m move to a named status"," a assign c comment"," e edit description in $EDITOR"," p priority t log time"," n new task d delete","","{cyan-fg}Sprint{/}"," s sprint menu: status, start, close, burndown"," S add the selected task to the active sprint","","{cyan-fg}Mouse{/}"," click select a card"," drag move a card to another column","","{gray-fg}press any key to close{/}"],r=S.box({parent:o,top:"center",left:"center",width:60,height:Math.min(t.length+2,30),border:{type:"line"},label:" Keys ",style:{border:{fg:u.borderFocus}},tags:!0,scrollable:!0,keys:!0,mouse:!0,content:t.join(`
|
|
8
|
-
`)}),i=T.push(e=>{z(e)||(i(),r.destroy(),m())});r.on("click",()=>{i(),r.destroy(),m()}),o.render()}function X(t,r,i){let e=i.length>0?`
|
|
9
|
-
|
|
10
|
-
{gray-fg}${i.map(s=>`${s.key} ${s.label}`).join(" ")} esc close{/}`:`
|
|
11
|
-
|
|
12
|
-
{gray-fg}press any key to close{/}`,l=S.box({parent:o,top:"center",left:"center",width:"80%",height:"70%",border:{type:"line"},label:` ${t} `,style:{border:{fg:u.borderFocus}},tags:!0,scrollable:!0,mouse:!0,content:r+e}),a=T.push(s=>{if(z(s))return;let w=i.find(P=>P.key===s.ch);a(),l.destroy(),w!==void 0?w.run():m()});o.render()}function ce(t){let{ch:r,name:i}=t;if(i==="left"||r==="h")return y=Math.max(0,y-1),m();if(i==="right"||r==="l")return y=Math.min(p.length-1,y+1),m();if(i==="up"||r==="k"){let e=p[y];e!==void 0&&(e.cursor=_(e.cursor,-1,e.tasks.length),V());return}if(i==="down"||r==="j"){let e=p[y];e!==void 0&&(e.cursor=_(e.cursor,1,e.tasks.length),V());return}if(i==="enter"){let e=I();e!==void 0&&de(e);return}if(r==="["||r==="]"){let e=I();if(e===void 0)return;let l=r==="]"?1:-1,a=p[y+l];return a===void 0?void 0:(x(n.move(e.id,a.status)),y+=l,m())}if(r==="m"){let e=I();return e===void 0?void 0:K(`Move ${e.label} to (${A().join(", ")}):`,"",l=>x(n.move(e.id,l)))}if(r==="a"){let e=I();return e===void 0?void 0:K(`Assign ${e.label} to (or "none"):`,e.assignee??"",l=>x(n.assign(e.id,l)))}if(r==="c"){let e=I();return e===void 0?void 0:K(`Comment on ${e.label}:`,"",l=>x(n.comment(e.id,l)))}if(r==="t"){let e=I();return e===void 0?void 0:K(`Log time on ${e.label} (2h, 90m, -30m):`,"",l=>x(n.logTime(e.id,l)))}if(r==="p"){let e=I();return e===void 0?void 0:K(`Priority for ${e.label} (low, normal, high, urgent):`,e.priority,l=>x(n.setPriority(e.id,l)))}if(r==="n")return K("New task title:","",e=>x(n.create(e)));if(r==="d"){let e=I();return e===void 0?void 0:K(`Delete ${e.label}? type "yes":`,"",l=>{l.toLowerCase()==="yes"?x(n.remove(e.id)):b("Not deleted.")})}if(r==="e"){let e=I();return e===void 0?void 0:x(Z(()=>n.edit(e.id)))}if(r==="S"){let e=I();return e===void 0?void 0:x(n.addToSprint(e.id))}if(r==="s")return X("Sprint",n.sprintStatus(),[{key:"b",label:"burndown",run:()=>X("Burndown",n.burndown(),[])},{key:"n",label:"start next sprint",run:()=>x(n.sprintStart())},{key:"x",label:"close sprint",run:()=>x(n.sprintClose())}]);if(r==="/")return K("Filter (title, assignee or label):",f,e=>{f=e==="*"?"":e,m()});if(i==="escape"&&f!=="")return f="",b("Filter cleared."),m();if(r==="r")return b("Reloaded."),m(!0);if(r==="R")return c=!c,b(c?"Showing only what can be started now.":"Showing every task."),m();if(r==="b")return"reason"in h?b(h.reason==="detached"?"HEAD is detached, so there is no branch to filter by.":`There is no branch "${h.base}" to compare against.`,u.warn):(E=!E,b(E?`Showing only what ${h.name} introduced since ${h.base}.`:"Showing every task."),m());if(r==="M"){if(d.milestones.length===0)return b("No milestones yet. Create one with kadence milestone create.",u.warn);let e=d.milestones.map(l=>`${l.label} ${l.name}`).join(", ");return K(`Milestone (${e}; empty for all):`,C,l=>{let a=l.trim();if(a==="")return C="",b("Showing every task."),m();let s=d.milestones.find(w=>w.label.toUpperCase()===a.toUpperCase()||w.name.toLowerCase()===a.toLowerCase());if(s===void 0)return b(`No milestone "${a}".`,u.warn);C=s.label,b(`Showing ${s.label} ${s.name}.`),m()})}if(r==="C"){let e=I();return e===void 0?void 0:x(e.claimedBy===null?n.claim(e.id):n.release(e.id))}if(r==="?")return ue();(r==="q"||i==="C-c")&&O(0)}function Z(t){let r=o;r.leave();let i=t();return r.enter(),i}let H=null;p.forEach(()=>{}),o.on("mousedown",t=>{if(T.isDialogOpen())return;let r=p.findIndex(a=>{let s=a.box.left;return t.x>=s&&t.x<s+a.box.width});if(r===-1)return;y=r;let i=p[r],e=t.y-i.box.top-1,l=i.tasks[e];l!==void 0&&(i.cursor=e,H={task:l,from:r}),m()}),o.on("mouseup",t=>{if(T.isDialogOpen()||H===null)return;let r=p.findIndex(i=>{let e=i.box.left;return t.x>=e&&t.x<e+i.box.width});r!==-1&&r!==H.from&&(x(n.move(H.task.id,p[r].status)),y=r,m()),H=null}),Q(),m()}export{Se as runBoardUi};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var I=["backlog","todo","in_progress","blocked","in_review","done","cancelled"],S="done",A="cancelled",P="in_progress",O="backlog",nt=["task","bug","story","epic"],st=["low","normal","high","urgent"];function $(t,e){for(let n=t.length-1;n>=0;n--)if(t[n].id<e)return t[n].started;return P}function pt(t){let e=[...t].sort((r,d)=>r.id<d.id?-1:r.id>d.id?1:0),n=new Map,u=new Map,a=new Map,o=new Map,p=new Map,s=[],l=null,i=[],f={started:P,changes:[]},y=[],g=[];for(let r of e)r.type==="task.created"?Y(n,r):r.type==="sprint.created"?Z(u,r):r.type==="milestone.created"&&q(a,r);for(let r of e){if(r.type==="decision.recorded"){let d=r.data??{},w=T=>typeof d[T]=="string"&&d[T].length>0?d[T]:null,c=w("title"),h=w("why");c!==null&&h!==null&&p.set(r.id,{id:r.id,label:"",title:c,why:h,rejected:w("rejected"),task:w("task"),docs:Array.isArray(d.docs)?d.docs.filter(T=>typeof T=="string"):[],supersedes:w("supersedes"),supersededBy:null,at:r.ts,by:r.actor,source:r.source});continue}if(r.type==="note.recorded"){let d=b(r.data?.text);d!==null&&s.push({id:r.id,text:d,task:b(r.data?.task),at:r.ts,by:r.actor,source:r.source});continue}if(r.type==="template.saved"){let d=typeof r.data?.name=="string"?r.data.name:null;d!==null&&o.set(d,{name:d,fields:r.data?.fields??{},author:r.actor});continue}if(r.type==="board.configured"){let d=r.data?.statuses;if(Array.isArray(d)){let h=d.filter(T=>typeof T=="string"&&T.length>0);h.length>0&&(l=h)}let w=r.data?.dod;Array.isArray(w)&&(i=w.filter(h=>typeof h=="string"&&h.length>0));let c=b(r.data?.started);c!==null&&(f.started=c,f.changes.push({id:r.id,started:c}));continue}if(r.type==="template.deleted"){let d=typeof r.data?.name=="string"?r.data.name:null;d!==null&&o.delete(d);continue}rt(r,n,u,a,y,g,f)}let k=g,m=[...n.values()].sort((r,d)=>r.id<d.id?-1:1);m.forEach((r,d)=>{r.label=`KAD-${d+1}`,ot(r),r.criteria.sort((w,c)=>w.id<c.id?-1:1),r.criteria.forEach((w,c)=>{w.n=c+1}),it(r)});let x=new Set(m.map(r=>r.id));for(let r of m)r.parent!==null&&!x.has(r.parent)&&(r.parent=null),r.blockedBy=r.blockedBy.filter(d=>x.has(d));let v=[...p.values()].sort((r,d)=>r.id<d.id?-1:1);v.forEach((r,d)=>{r.label=`DEC-${d+1}`});for(let r of v){if(r.supersedes===null)continue;let d=p.get(r.supersedes);d!==void 0&&(d.supersededBy=r.id)}let M=[...a.values()].sort((r,d)=>r.id<d.id?-1:1);M.forEach((r,d)=>{r.label=`MS-${d+1}`});let B=new Map;for(let r of m){if(r.milestone===null||!a.has(r.milestone))continue;let d=B.get(r.milestone)??[];d.push(r.id),B.set(r.milestone,d)}for(let r of M){r.taskIds=B.get(r.id)??[];let d=r.taskIds.map(w=>n.get(w)).filter(w=>w!==void 0);r.totalTasks=d.length,r.doneTasks=d.filter(w=>w.status===S).length,r.totalPoints=d.reduce((w,c)=>w+(c.estimate??0),0),r.donePoints=d.filter(w=>w.status===S).reduce((w,c)=>w+(c.estimate??0),0)}for(let r of v)r.task!==null&&!x.has(r.task)&&(r.task=null);for(let r of s)r.task!==null&&!x.has(r.task)&&(r.task=null);return{tasks:m,decisions:v,milestones:M,notes:s,sprints:[...u.values()].sort((r,d)=>r.id<d.id?-1:1),statuses:l??[...I],dod:i,started:f.started,startedChanges:[...f.changes],orphanStatuses:[...new Set(m.map(r=>r.status).filter(r=>!(l??I).includes(r)))].sort(),templates:[...o.values()].sort((r,d)=>r.name.localeCompare(d.name)),cycles:at(m),pending:k,rejected:y}}function Y(t,e){if(t.has(e.entity))return;let n=e.data??{};t.set(e.entity,{id:e.entity,label:"",title:typeof n.title=="string"?n.title:"(untitled)",description:b(n.description),type:z(n.type),priority:G(n.priority),status:O,labels:J(n.labels),assignee:b(n.assignee),reporter:e.actor,sprint:null,milestone:null,parent:b(n.parent),blockedBy:[],due:b(n.due),claimedBy:null,claimedAt:null,claimedEventId:null,contestedBy:[],criteria:[],comments:[],docs:[],estimate:typeof n.estimate=="number"?n.estimate:null,loggedHours:0,createdAt:e.ts,updatedAt:e.ts,history:[]})}function Z(t,e){if(t.has(e.entity))return;let n=e.data??{};t.set(e.entity,{id:e.entity,name:typeof n.name=="string"?n.name:"(untitled)",description:b(n.description),startDate:b(n.startDate),endDate:b(n.endDate),status:"planned",closedBy:null,taskIds:[]})}function q(t,e){if(t.has(e.entity))return;let n=e.data??{};t.set(e.entity,{id:e.entity,label:"",name:typeof n.name=="string"?n.name:"(untitled)",due:b(n.due),status:"open",closedBy:null,taskIds:[],donePoints:0,totalPoints:0,doneTasks:0,totalTasks:0})}function rt(t,e,n,u,a,o,p){let s=t.data??{};if(t.type==="milestone.created")return q(u,t),!0;if(t.type==="milestone.task_added"){let i=b(s.task);if(i===null)return!0;let f=e.get(i);return f===void 0?(o.push(t),!1):(f.milestone=t.entity,!0)}if(t.type==="milestone.closed"){let i=u.get(t.entity);return i===void 0?(o.push(t),!1):(i.closedBy===null?(i.status="closed",i.closedBy=t.id):a.push(t),!0)}if(t.type==="task.created")return Y(e,t),W(e.get(t.entity),t),!0;if(t.type==="sprint.created")return Z(n,t),!0;if(t.type.startsWith("sprint.")){let i=n.get(t.entity);if(i===void 0)return o.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"?(a.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):a.push(t),!0;if(t.type==="sprint.cancelled")return i.status==="planned"?i.status="cancelled":a.push(t),!0;if(t.type==="sprint.task_added"){if(i.status==="closed")return a.push(t),!0;let f=typeof s.task=="string"?s.task:null;if(f===null)return!0;let y=e.get(f);return y===void 0?(o.push(t),!1):(y.sprint=i.id,i.taskIds.includes(f)||i.taskIds.push(f),W(y,t),!0)}return!0}let l=e.get(t.entity);if(l===void 0)return o.push(t),!1;if(t.type==="task.deleted")return e.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=A;break;case"task.reopened":l.status=$(p.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=z(s.type)),s.priority!==void 0&&(l.priority=G(s.priority)),s.labels!==void 0&&(l.labels=J(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(f=>f!==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(f=>f!==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 W(l,t),!0}function it(t){let e=new Map(t.criteria.map(n=>[n.id,n]));for(let n of t.criteria)n.checked=!1,n.checkedBy=null;for(let n of t.history){if(n.type!=="task.criterion_checked"&&n.type!=="task.criterion_unchecked")continue;let u=b(n.data.criterion),a=u===null?void 0:e.get(u);if(a===void 0)continue;let o=n.type==="task.criterion_checked";a.checked=o,a.checkedBy=o?n.actor:null}}function ot(t){let e=null,n=null,u=null,a=[],o=()=>{e=null,n=null,u=null,a=[]};for(let p of t.history)if(p.type==="task.claimed"){let s=b(p.data.by)??p.actor;e===null?(e=s,n=p.ts,u=p.id):s!==e&&!a.includes(s)&&a.push(s)}else if(p.type==="task.released"){let s=b(p.data.by)??p.actor;e===s?o():a=a.filter(l=>l!==s)}else(p.type==="task.cancelled"||p.type==="task.moved"&&p.data.to===S)&&o();t.claimedBy=e,t.claimedAt=n,t.claimedEventId=u,t.contestedBy=a}function W(t,e){t.history.push({id:e.id,type:e.type,actor:e.actor,ts:e.ts,source:e.source,data:e.data??{}}),e.ts>t.updatedAt&&(t.updatedAt=e.ts)}function b(t){return typeof t=="string"&&t.length>0?t:null}function z(t){return nt.includes(t)?t:"task"}function G(t){return st.includes(t)?t:"normal"}function J(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):[]}function at(t){let e=new Map(t.map(o=>[o.id,o])),n=[],u=new Set,a=(o,p)=>{let s=new Map,l=(i,f)=>{let y=s.get(i);if(y==="done")return;if(y==="visiting"){let k=f.indexOf(i),m=f.slice(k),x=`${o}:${[...m].sort().join(",")}`;u.has(x)||(u.add(x),n.push({kind:o,path:[...m,i]}));return}s.set(i,"visiting");let g=e.get(i);if(g!==void 0)for(let k of p(g))l(k,[...f,i]);s.set(i,"done")};for(let i of t)l(i.id,[])};return a("parent",o=>o.parent===null?[]:[o.parent]),a("blocking",o=>o.blockedBy),n}var D=864e5;function C(t){return new Date(t).toISOString().slice(0,10)}function E(t){return Date.parse(`${t}T00:00:00.000Z`)}function lt(t){let e=new Date(E(t)),n=(e.getUTCDay()+6)%7;return C(e.getTime()-n*D)}function V(t,e){let n=C(t.getTime());return{from:C(E(n)-(e-1)*D),to:n,days:e}}function Q(t,e){let n=t.slice(0,10);return n>=e.from&&n<=e.to}function F(t,e){if(t.length===0)return 0;let n=Math.max(1,Math.ceil(e*t.length));return t[n-1]}var _=t=>Math.round(t*10)/10;function K(t){if(t.length===0)return null;let e=[...t].sort((n,u)=>n-u);return{shown:{n:e.length,p50:_(F(e,.5)),p85:_(F(e,.85)),p95:_(F(e,.95))},rawP85:F(e,.85)}}function N(t,e){let n=t.indexOf(e);return n===-1?null:new Set(t.slice(0,n))}function H(t,e,n=[],u=[]){let a=N(n,e),o=s=>s===S||s===A?!1:a===null?s===e:s===e||!a.has(s);return t.history.find(s=>s.type==="task.reopened"?o($(u,s.id)):s.type==="task.moved"&&typeof s.data.to=="string"&&o(s.data.to))?.ts??null}function dt(t,e){if(e.status===S||e.status===A)return!1;let n=N(t.statuses,t.started);return n===null?e.status===t.started:n.has(e.status)?!1:H(e,t.started,t.statuses,t.startedChanges)!==null}function R(t){if(t.status!==S)return null;for(let e=t.history.length-1;e>=0;e--){let n=t.history[e];if(n.type==="task.moved"&&n.data.to===S)return n.ts}return null}function ut(t){if(t.status!==A)return null;for(let e=t.history.length-1;e>=0;e--){let n=t.history[e];if(n.type==="task.cancelled"||n.type==="task.moved"&&n.data.to===A)return n.ts}return null}function L(t,e){return Math.max(0,(Date.parse(e)-Date.parse(t))/D)}function ct(t,e,n,u){let a=R(t)??ut(t),o=a===null?u:Date.parse(a),p=[],s=new Map;for(let k of t.history){let m=typeof k.data.blocker=="string"?k.data.blocker:null;if(m!==null){if(k.type==="task.blocked_by_added")s.has(m)||s.set(m,Date.parse(k.ts));else if(k.type==="task.blocked_by_removed"){let x=s.get(m);x!==void 0&&(p.push([x,Math.min(Date.parse(k.ts),o)]),s.delete(m))}}}for(let[k,m]of s){let x=Math.min(e.get(k)??u,o);p.push([m,Math.max(m,x)])}let l=E(n.from),i=E(n.to)+D,f=p.map(([k,m])=>[Math.max(k,l),Math.min(m,i)]).filter(([k,m])=>m>k).sort((k,m)=>k[0]-m[0]),y=0,g=null;for(let[k,m]of f)g===null||k>g[1]?(g!==null&&(y+=g[1]-g[0]),g=[k,m]):m>g[1]&&(g[1]=m);return g!==null&&(y+=g[1]-g[0]),y/D}function mt(t,e=new Date,n=30){let u=V(e,n),a=e.getTime(),o=[],p=t.tasks.filter(c=>c.status!==A),s=p.filter(c=>{let h=R(c);return h!==null&&Q(h,u)}),l=[],i=[],f=[];for(let c of s){let h=R(c),T=H(c,t.started,t.statuses,t.startedChanges);i.push(L(c.createdAt,h)),T!==null&&(l.push(L(T,h)),f.push(L(c.createdAt,T)))}let y=K(l),g=y?.shown??null,k=p.filter(c=>dt(t,c)),m=k.map(c=>{let h=L(H(c,t.started,t.statuses,t.startedChanges),e.toISOString());return{label:c.label,title:c.title,status:c.status,ageDays:_(h),overP85:y!==null&&h>y.rawP85}}).sort((c,h)=>h.ageDays-c.ageDays),x=new Map,v=c=>{let h=lt(c),T=x.get(h);return T===void 0&&(T={week:h,finished:0,created:0},x.set(h,T)),T};for(let c=E(u.from);c<=E(u.to);c+=D)v(C(c));for(let c of s)v(R(c).slice(0,10)).finished+=1;for(let c of p)Q(c.createdAt,u)&&(v(c.createdAt.slice(0,10)).created+=1);let M=[...x.values()].sort((c,h)=>c.week<h.week?-1:1),B=new Map;for(let c of t.tasks){let h=R(c);h!==null&&B.set(c.id,Date.parse(h))}let r=0,d=0;for(let c of p){let h=ct(c,B,u,a);h>0&&(r+=1,d+=h)}t.tasks.length===0?o.push("No tasks yet."):(k.length===0&&s.length===0&&o.push(`Nothing has crossed "${t.started}" yet. If work starts in another column, say so: kadence board config --started <status>`),s.length===0?o.push(`Nothing finished between ${u.from} and ${u.to}; cycle time needs finished work.`):l.length===0&&o.push(`${s.length} item(s) finished without ever entering "${t.started}", so there is no cycle time to measure.`),t.statuses.includes(t.started)||o.push(`"${t.started}" is not one of the board's columns; set one with kadence board config --started.`));let w=g===null?null:`${g.n<10?`From ${g.n} finished items (a small sample): `:""}85% of finished items took ${g.p85} calendar days or less.`;return{window:u,started:t.started,unit:"calendar days",wip:k.length,finished:s.length,perWeek:M,cycleTime:g,leadTime:K(i)?.shown??null,responseTime:K(f)?.shown??null,sle:w,aging:m,blocked:{tasks:r,days:_(d)},notes:o}}function ht(t,e=new Date,n=30){let u=V(e,n),a=[...t.statuses];for(let l of t.tasks)a.includes(l.status)||a.push(l.status);let o=O;!a.includes(o)&&t.tasks.length>0&&a.unshift(o);let p=t.tasks.map(l=>{let i=[];for(let f of l.history)f.type==="task.moved"&&typeof f.data.to=="string"?i.push({at:Date.parse(f.ts),status:f.data.to}):f.type==="task.cancelled"?i.push({at:Date.parse(f.ts),status:A}):f.type==="task.reopened"&&i.push({at:Date.parse(f.ts),status:$(t.startedChanges,f.id)});return{createdAt:Date.parse(l.createdAt),changes:i,next:0,status:o}}),s=[];for(let l=E(u.from);l<=E(u.to);l+=D){let i=l+D,f={};for(let y of a)f[y]=0;for(let y of p){for(;y.next<y.changes.length&&y.changes[y.next].at<i;)y.status=y.changes[y.next].status,y.next+=1;y.createdAt>=i||(f[y.status]=(f[y.status]??0)+1)}s.push({date:C(l),counts:f})}return{window:u,statuses:a,days:s}}var j={urgent:0,high:1,normal:2,low:3};function X(t,e){return t!==null&&t.toLowerCase().includes(e)}function Tt(t,e,n=new Date){let u=n.toISOString().slice(0,10),a=e.search?.toLowerCase();return t.filter(o=>{if(a!==void 0&&a.length>0){let p=o.comments.some(s=>s.text.toLowerCase().includes(a));if(!X(o.title,a)&&!X(o.description,a)&&!p)return!1}if(e.status!==void 0&&o.status!==e.status||e.type!==void 0&&o.type!==e.type||e.priority!==void 0&&o.priority!==e.priority)return!1;if(e.assignee!==void 0){let p=e.assignee.toLowerCase(),s=(o.assignee??"").toLowerCase();if(p==="none"?s!=="":s!==p)return!1}if(e.label!==void 0){let p=e.label.toLowerCase();if(!o.labels.some(s=>s.toLowerCase()===p))return!1}return!(e.sprint!==void 0&&o.sprint!==e.sprint||e.overdue===!0&&(o.due===null||o.due>=u)||e.dueBefore!==void 0&&(o.due===null||o.due>=e.dueBefore))})}function xt(t,e){let n=[...t];switch(e){case"priority":return n.sort((u,a)=>j[u.priority]-j[a.priority]);case"due":return n.sort((u,a)=>tt(u.due,a.due,(o,p)=>o<p?-1:o>p?1:0));case"estimate":return n.sort((u,a)=>tt(u.estimate,a.estimate,(o,p)=>p-o));default:return n.sort((u,a)=>u.id<a.id?-1:u.id>a.id?1:0)}}function tt(t,e,n){return t===null&&e===null?0:t===null?1:e===null?-1:n(t,e)}function St(t){let e=[];return t.search!==void 0&&e.push(`search="${t.search}"`),t.status!==void 0&&e.push(`status=${t.status}`),t.type!==void 0&&e.push(`type=${t.type}`),t.priority!==void 0&&e.push(`priority=${t.priority}`),t.assignee!==void 0&&e.push(`assignee=${t.assignee}`),t.label!==void 0&&e.push(`label=${t.label}`),t.overdue===!0&&e.push("overdue"),t.dueBefore!==void 0&&e.push(`due before ${t.dueBefore}`),e.length===0?`No tasks yet.
|
|
3
|
-
Create the first one:
|
|
4
|
-
kadence task add "title"`:`No tasks match ${e.join(" and ")}.
|
|
5
|
-
Try fewer filters:
|
|
6
|
-
kadence task list`}function et(t){return N(t.statuses??I,t.started??P)}function U(t){return t.status===S||t.status===A}function At(t,e={}){let n=e.viewer??null,u=new Set(t.filter(U).map(s=>s.id)),a=e.assignee==="me"?n:e.assignee??null,o=et(e);return t.filter(s=>{if(U(s)||o!==null&&!o.has(s.status)||s.blockedBy.some(l=>!u.has(l))||s.claimedBy!==null&&s.claimedBy!==n&&s.contestedBy.length===0)return!1;if(a!==null){if(a==="none")return s.assignee===null;if(s.assignee!==a)return!1}return!0}).sort((s,l)=>j[s.priority]-j[l.priority]||(s.id<l.id?-1:1))}function vt(t,e,n,u={}){if(t.length===0)return`No tasks yet.
|
|
7
|
-
Create the first one:
|
|
8
|
-
kadence task add "title"`;let a=t.filter(g=>!U(g));if(a.length===0)return"Nothing ready: every task is done or cancelled.";let o=new Set(t.filter(U).map(g=>g.id)),p=et(u),s=p===null?0:a.filter(g=>!p.has(g.status)).length,l=a.filter(g=>g.blockedBy.some(k=>!o.has(k))).length,i=a.filter(g=>g.claimedBy!==null&&g.claimedBy!==e&&g.contestedBy.length===0).length,f=[];return s>0&&f.push(`${s} already started`),l>0&&f.push(`${l} blocked`),i>0&&f.push(`${i} claimed by someone else`),n!==void 0&&f.push(`filtered to assignee=${n}`),`Nothing ready${f.length>0?` (${f.join(", ")})`:""}.
|
|
9
|
-
See the whole board:
|
|
10
|
-
kadence task list`}var ft=["created","priority","due","estimate"];function Dt(t){return ft.includes(t)}export{I as a,S as b,A as c,nt as d,st as e,pt as f,H as g,dt as h,R as i,mt as j,ht as k,Tt as l,xt as m,St as n,U as o,At as p,vt as q,ft as r,Dt as s};
|