@hastycapybara/tasks-cli 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/tasksmd.cjs +1 -1
  2. package/package.json +1 -1
package/dist/tasksmd.cjs CHANGED
@@ -169,7 +169,7 @@ Options:
169
169
  --expect <text> refuse the edit when the line no longer equals this text
170
170
  -h, --help this help
171
171
 
172
- Lines are 1-based in <path:line>. Settings are read from <root>/.vscode/settings.json (tasksmd.*).`,kE="1.1.0";function gV(e){let t=[],n={};for(let i=0;i<e.length;i++){let r=e[i];if(r==="--"){t.push(...e.slice(i+1));break}if(r.startsWith("--")){let o=r.indexOf("=");if(o>0){n[r.slice(2,o)]=r.slice(o+1);continue}let a=r.slice(2),s=e[i+1];yV.has(a)||s===void 0||s.startsWith("--")?n[a]=!0:(n[a]=s,i++)}else r==="-h"?n.help=!0:t.push(r)}return{positional:t,flags:n}}var yV=new Set(["json","md","help"]);function Nr(e,t){let n=e[t];return typeof n=="string"?n:void 0}function pi(e){return`${e.originalMarkdown.trim()} (${e.path}:${e.line+1})`}function vV(e,t){if(t)return[JSON.stringify(e,null,2)];let n=[],i=(o,a,s="")=>{n.push(`${" ".repeat(a)}${pi(o)}${s}`);for(let c of o.notes)n.push(`${" ".repeat(a+1)}- ${c.text}`)},r=(o,a)=>{if(a>0&&n.push(`${"#".repeat(Math.min(6,a+1))} ${o.name} (${o.count})`),o.tree){let s=(c,u)=>{for(let l of c)i(l.task,u,l.matched?"":" [context]"),s(l.children,u+1)};s(o.tree,0)}else for(let s of o.tasks)i(s,0);for(let s of o.children)r(s,a+1)};if(e.groups)r(e.groups,0);else for(let o of e.tasks)i(o,0);n.push("",`${e.shown} of ${e.matched} tasks`);for(let o of e.runtimeErrors)n.push(`warning: ${o}`);return n}async function SE(e,t,n=!1){let{positional:i,flags:r}=gV(e),[o,...a]=i;if(!o||r.help)return t.out(hV),o?0:2;let s=r.json===!0?!0:r.md===!0?!1:!n,c=wE.resolve(t.cwd,Nr(r,"root")??".");if(o==="mcp")return await xE({root:c,today:Nr(r,"today"),version:kE}),0;let u=(l,f)=>{if(s)t.out(JSON.stringify(l,null,2));else for(let h of f())t.out(h)};try{let l=yl(ks(c),Nr(r,"today")),f=Nr(r,"expect");switch(o){case"query":{let h=a.join(" ").replace(/\\n/g,`
172
+ Lines are 1-based in <path:line>. Settings are read from <root>/.vscode/settings.json (tasksmd.*).`,kE="1.1.1";function gV(e){let t=[],n={};for(let i=0;i<e.length;i++){let r=e[i];if(r==="--"){t.push(...e.slice(i+1));break}if(r.startsWith("--")){let o=r.indexOf("=");if(o>0){n[r.slice(2,o)]=r.slice(o+1);continue}let a=r.slice(2),s=e[i+1];yV.has(a)||s===void 0||s.startsWith("--")?n[a]=!0:(n[a]=s,i++)}else r==="-h"?n.help=!0:t.push(r)}return{positional:t,flags:n}}var yV=new Set(["json","md","help"]);function Nr(e,t){let n=e[t];return typeof n=="string"?n:void 0}function pi(e){return`${e.originalMarkdown.trim()} (${e.path}:${e.line+1})`}function vV(e,t){if(t)return[JSON.stringify(e,null,2)];let n=[],i=(o,a,s="")=>{n.push(`${" ".repeat(a)}${pi(o)}${s}`);for(let c of o.notes)n.push(`${" ".repeat(a+1)}- ${c.text}`)},r=(o,a)=>{if(a>0&&n.push(`${"#".repeat(Math.min(6,a+1))} ${o.name} (${o.count})`),o.tree){let s=(c,u)=>{for(let l of c)i(l.task,u,l.matched?"":" [context]"),s(l.children,u+1)};s(o.tree,0)}else for(let s of o.tasks)i(s,0);for(let s of o.children)r(s,a+1)};if(e.groups)r(e.groups,0);else for(let o of e.tasks)i(o,0);n.push("",`${e.shown} of ${e.matched} tasks`);for(let o of e.runtimeErrors)n.push(`warning: ${o}`);return n}async function SE(e,t,n=!1){let{positional:i,flags:r}=gV(e),[o,...a]=i;if(!o||r.help)return t.out(hV),o?0:2;let s=r.json===!0?!0:r.md===!0?!1:!n,c=wE.resolve(t.cwd,Nr(r,"root")??".");if(o==="mcp")return await xE({root:c,today:Nr(r,"today"),version:kE}),0;let u=(l,f)=>{if(s)t.out(JSON.stringify(l,null,2));else for(let h of f())t.out(h)};try{let l=yl(ks(c),Nr(r,"today")),f=Nr(r,"expect");switch(o){case"query":{let h=a.join(" ").replace(/\\n/g,`
173
173
  `);!h.trim()&&!s&&t.err("note: empty query matches every task");let g=Is(l,h,Nr(r,"source"));for(let y of vV(g,s))t.out(y);return 0}case"explain":{let h=vl(l,a.join(" ").replace(/\\n/g,`
174
174
  `),Nr(r,"source"));return u(h,()=>[h.explain,...h.errors.map(g=>`error line ${g.line}: ${g.message}`)]),h.errors.length?1:0}case"list":{let h=Nr(r,"file"),g=l.index.all().filter(_=>!h||_.location.path===h.replace(/\\/g,"/")),y=Is(l,h?`path includes ${h}`:"");return u(y.tasks,()=>y.tasks.map(pi)),0}case"info":{let h=$l(l,kE);return u(h,()=>[`tasksmd ${h.version}`,`features: ${h.features.join(", ")}`,`requireDueDate: ${h.settings.requireDueDate} \xB7 taskFormat: ${h.settings.taskFormat} \xB7 globalFilter: ${h.settings.globalFilter||"(none)"}`]),0}case"saved":{let h=nh(l.cfg);return u(h,()=>h.map(g=>`${g.name} [${g.source}]
175
175
  ${g.query.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastycapybara/tasks-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Command line for Tasks for Markdown: query, add, complete and edit Obsidian Tasks-style task lines in a folder of Markdown notes — no editor required.",
5
5
  "license": "MIT",
6
6
  "author": "HastyCapybara (W.Leester)",