@kitelev/exocortex-cli 15.46.1 → 15.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v15.46.1
2
+ // @kitelev/exocortex-cli v15.47.0
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -58,7 +58,7 @@ ${Object.entries(t).map(([a,c])=>`${a}: ${c}`).join(`
58
58
  `)}
59
59
  ---`,s=e.startsWith(`
60
60
  `)?"":`
61
- `;return`${i}${s}${e}`}getPropertyValue(e,t){let r=new RegExp(`${this.escapeRegex(t)}:\\s*(.*)$`,"m"),i=e.match(r);return i?i[1].trim():null}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Bf.FrontmatterService=Uf;Uf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/});var t0=_(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.WorkflowEngine=void 0;var e0=class{static{o(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(a=>a.from===i.status&&!a.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};qf.WorkflowEngine=e0});var n0=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.WorkflowResolver=void 0;var sl=ze(),Vr=mt(),dt=cn(),es=Gu(),se=zu(),r0=class{static{o(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,dt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof sl.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof sl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Vr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Vr.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Vr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Vr.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??se.EffortStatus.DRAFT,f=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_terminalStates"),void 0),h=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(T=>{let S=T.object instanceof Vr.Literal?T.object.value:"";return S==="true"||S==="1"}),y=await this.loadStates(e),w=await this.loadTransitions(e);return{id:s,name:r,targetClass:c,states:y,transitions:w,initialState:u,terminalStates:h.length>0?h:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_order"),void 0),h=f.length>0&&f[0].object instanceof Vr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"}),w=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(x=>x.object instanceof Vr.Literal?x.object.value:"").filter(x=>x.length>0),T=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),S=T.length>0&&T[0].object instanceof Vr.Literal?T[0].object.value:void 0;r.push({status:u,order:h,optional:p,timestampOnEnter:w,badgeColor:S})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_to"),void 0),h=this.resolveEffortStatus(f);if(!u||!h)continue;let d=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=d.length>0&&d[0].object instanceof Vr.Literal?d[0].object.value:`${u} \u2192 ${h}`,y=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),w=y.length>0&&y[0].object instanceof Vr.Literal?y[0].object.value:void 0,S=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"});r.push({from:u,to:h,label:p,icon:w,isRollback:S})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return es.AssetClass.TASK;let t=e[0].object;if(t instanceof sl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(es.AssetClass).includes(i)?i:es.AssetClass.TASK}if(t instanceof Vr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(es.AssetClass).includes(r)?r:es.AssetClass.TASK}return es.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof sl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Vr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(se.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof sl.IRI)return e.value===t.value;if(e instanceof Vr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===es.AssetClass.PROJECT?this.getProjectFallback():this.getTaskFallback()}getProjectFallback(){return{id:"hardcoded-project-default",name:"Project Default (hardcoded)",targetClass:es.AssetClass.PROJECT,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:se.EffortStatus.TODO,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.TODO,to:se.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}getTaskFallback(){return{id:"hardcoded-task-default",name:"Task Default (hardcoded)",targetClass:es.AssetClass.TASK,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}};Wf.WorkflowResolver=r0});var o0=_(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.TransactionError=xs.TripleNotFoundError=xs.TripleAlreadyExistsError=void 0;var i0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};xs.TripleAlreadyExistsError=i0;var s0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};xs.TripleNotFoundError=s0;var a0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};xs.TransactionError=a0});var Hf=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.LRUCache=void 0;var c0=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};Gf.LRUCache=c0});var f0=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.InMemoryTripleStore=void 0;var As=o0(),zf=ze(),JD=$t(),ZD=mt(),eN=cn(),tN=Hf(),rN=eN.Namespace.XSD.term("string").value,nN=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,ao="__default__",l0=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new tN.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new u0(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new zf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof zf.IRI))return;let t=e.value,r=t.match(nN);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof zf.IRI)return`i:${e.value}`;if(e instanceof JD.BlankNode)return`b:${e.id}`;if(e instanceof ZD.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==rN?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:ao}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===ao?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===ao)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===ao)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new zf.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===ao){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===ao)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Qf.InMemoryTripleStore=l0;var u0=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var Kf=_(ts=>{"use strict";var iN=ts&&ts.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},sN=ts&&ts.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ts,"__esModule",{value:!0});ts.EffortStatusWorkflow=void 0;var aN=Ue(),Yf=vr(),oN=t0(),cN=n0(),lN=f0(),h0=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new cN.WorkflowResolver(new lN.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new oN.WorkflowEngine(i);if(s.isInitialState(r))return null;let a=s.getPreviousStatus(r);if(a!==null)return this.wrapStatus(a)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,Yf.AssetClass.TASK)||this.hasInstanceClass(e,Yf.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Yf.AssetClass.TASK):this.resolver.getHardcodedFallback(Yf.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};ts.EffortStatusWorkflow=h0;ts.EffortStatusWorkflow=h0=iN([(0,aN.injectable)(),sN("design:paramtypes",[])],h0)});var Xf=_(Mn=>{"use strict";var uN=Mn&&Mn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},fN=Mn&&Mn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},hN=Mn&&Mn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.StatusTimestampService=void 0;var Cb=Ue(),dN=Zi(),oo=or(),pN=ht(),d0=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new dN.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=oo.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,a)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=oo.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);a=this.frontmatterService.updateProperty(a,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,a)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let a=new Date(s.replace(/["']/g,""));if(isNaN(a.getTime()))return;let c=new Date(a.getTime()+t),l=oo.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Mn.StatusTimestampService=d0;Mn.StatusTimestampService=d0=uN([(0,Cb.injectable)(),hN(0,(0,Cb.inject)(pN.DI_TOKENS.IVaultAdapter)),fN("design:paramtypes",[Object])],d0)});var m0=_(jn=>{"use strict";var mN=jn&&jn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},gN=jn&&jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},yN=jn&&jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(jn,"__esModule",{value:!0});jn.TaskStatusService=void 0;var Ib=Ue(),vN=Zi(),ma=or(),_N=Kf(),wN=Xf(),bN=ht(),p0=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new vN.FrontmatterService}async setDraftStatus(e){await this.updateStatus(e,"ems__EffortStatusDraft")}async moveToBacklog(e){await this.updateStatus(e,"ems__EffortStatusBacklog")}async moveToAnalysis(e){await this.updateStatus(e,"ems__EffortStatusAnalysis")}async moveToToDo(e){await this.updateStatus(e,"ems__EffortStatusToDo")}async startEffort(e){let t=await this.vault.read(e),r=ma.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_startTimestamp",r),await this.vault.modify(e,i)}async markTaskAsDone(e){let t=await this.vault.read(e),r=ma.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_endTimestamp",r),i=this.frontmatterService.updateProperty(i,"ems__Effort_resolutionTimestamp",r),await this.vault.modify(e,i)}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async trashEffort(e,t){let r=await this.vault.read(e),i=ma.DateFormatter.toLocalTimestamp(new Date),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),t&&(s=this.appendTrashReason(s,t)),await this.vault.modify(e,s)}appendTrashReason(e,t){let r=`
61
+ `;return`${i}${s}${e}`}getPropertyValue(e,t){let r=new RegExp(`${this.escapeRegex(t)}:\\s*(.*)$`,"m"),i=e.match(r);return i?i[1].trim():null}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Bf.FrontmatterService=Uf;Uf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/});var t0=_(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.WorkflowEngine=void 0;var e0=class{static{o(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(a=>a.from===i.status&&!a.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};qf.WorkflowEngine=e0});var n0=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.WorkflowResolver=void 0;var sl=ze(),Vr=mt(),dt=cn(),es=Gu(),se=zu(),r0=class{static{o(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,dt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof sl.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof sl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Vr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Vr.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Vr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,dt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Vr.Literal?i[0].object.value:e.value,a=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(a),l=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??se.EffortStatus.DRAFT,f=await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_terminalStates"),void 0),h=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,dt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(T=>{let S=T.object instanceof Vr.Literal?T.object.value:"";return S==="true"||S==="1"}),y=await this.loadStates(e),w=await this.loadTransitions(e);return y.length===0&&w.length===0?null:{id:s,name:r,targetClass:c,states:y,transitions:w,initialState:u,terminalStates:h.length>0?h:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_order"),void 0),h=f.length>0&&f[0].object instanceof Vr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"}),w=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(x=>x.object instanceof Vr.Literal?x.object.value:"").filter(x=>x.length>0),T=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),S=T.length>0&&T[0].object instanceof Vr.Literal?T[0].object.value:void 0;r.push({status:u,order:h,optional:p,timestampOnEnter:w,badgeColor:S})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,dt.Namespace.RDF.term("type"),dt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(x=>this.isSameSubject(x.object,e)))continue;let l=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_to"),void 0),h=this.resolveEffortStatus(f);if(!u||!h)continue;let d=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=d.length>0&&d[0].object instanceof Vr.Literal?d[0].object.value:`${u} \u2192 ${h}`,y=await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),w=y.length>0&&y[0].object instanceof Vr.Literal?y[0].object.value:void 0,S=(await this.tripleStore.match(s,dt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(x=>{let F=x.object instanceof Vr.Literal?x.object.value:"";return F==="true"||F==="1"});r.push({from:u,to:h,label:p,icon:w,isRollback:S})}return r}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return es.AssetClass.TASK;let t=e[0].object;if(t instanceof sl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(es.AssetClass).includes(i)?i:es.AssetClass.TASK}if(t instanceof Vr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(es.AssetClass).includes(r)?r:es.AssetClass.TASK}return es.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof sl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Vr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(se.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof sl.IRI)return e.value===t.value;if(e instanceof Vr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===es.AssetClass.PROJECT?this.getProjectFallback():this.getTaskFallback()}getProjectFallback(){return{id:"hardcoded-project-default",name:"Project Default (hardcoded)",targetClass:es.AssetClass.PROJECT,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:se.EffortStatus.TODO,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.ANALYSIS,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.TODO,to:se.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}getTaskFallback(){return{id:"hardcoded-task-default",name:"Task Default (hardcoded)",targetClass:es.AssetClass.TASK,initialState:se.EffortStatus.DRAFT,terminalStates:[se.EffortStatus.DONE,se.EffortStatus.TRASHED],isDefault:!0,states:[{status:se.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:se.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:se.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:se.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:se.EffortStatus.DRAFT,to:se.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:se.EffortStatus.DOING,to:se.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:se.EffortStatus.BACKLOG,to:se.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:se.EffortStatus.DOING,to:se.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:se.EffortStatus.DONE,to:se.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]}}};Wf.WorkflowResolver=r0});var o0=_(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.TransactionError=xs.TripleNotFoundError=xs.TripleAlreadyExistsError=void 0;var i0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};xs.TripleAlreadyExistsError=i0;var s0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};xs.TripleNotFoundError=s0;var a0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};xs.TransactionError=a0});var Hf=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.LRUCache=void 0;var c0=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};Gf.LRUCache=c0});var f0=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.InMemoryTripleStore=void 0;var As=o0(),zf=ze(),JD=$t(),ZD=mt(),eN=cn(),tN=Hf(),rN=eN.Namespace.XSD.term("string").value,nN=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,ao="__default__",l0=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new tN.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new u0(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new zf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof zf.IRI))return;let t=e.value,r=t.match(nN);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof zf.IRI)return`i:${e.value}`;if(e instanceof JD.BlankNode)return`b:${e.id}`;if(e instanceof ZD.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==rN?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:ao}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===ao?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===ao)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===ao)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new zf.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===ao){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===ao)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Qf.InMemoryTripleStore=l0;var u0=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new As.TransactionError("Transaction already committed");if(this.rolledBack)throw new As.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var Kf=_(ts=>{"use strict";var iN=ts&&ts.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},sN=ts&&ts.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ts,"__esModule",{value:!0});ts.EffortStatusWorkflow=void 0;var aN=Ue(),Yf=vr(),oN=t0(),cN=n0(),lN=f0(),h0=class{static{o(this,"EffortStatusWorkflow")}constructor(){this.resolver=new cN.WorkflowResolver(new lN.InMemoryTripleStore)}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new oN.WorkflowEngine(i);if(s.isInitialState(r))return null;let a=s.getPreviousStatus(r);if(a!==null)return this.wrapStatus(a)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,Yf.AssetClass.TASK)||this.hasInstanceClass(e,Yf.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Yf.AssetClass.TASK):this.resolver.getHardcodedFallback(Yf.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};ts.EffortStatusWorkflow=h0;ts.EffortStatusWorkflow=h0=iN([(0,aN.injectable)(),sN("design:paramtypes",[])],h0)});var Xf=_(Mn=>{"use strict";var uN=Mn&&Mn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},fN=Mn&&Mn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},hN=Mn&&Mn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.StatusTimestampService=void 0;var Cb=Ue(),dN=Zi(),oo=or(),pN=ht(),d0=class{static{o(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new dN.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=oo.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,a)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=oo.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=oo.DateFormatter.toLocalTimestamp(i),a=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);a=this.frontmatterService.updateProperty(a,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,a)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let a=new Date(s.replace(/["']/g,""));if(isNaN(a.getTime()))return;let c=new Date(a.getTime()+t),l=oo.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Mn.StatusTimestampService=d0;Mn.StatusTimestampService=d0=uN([(0,Cb.injectable)(),hN(0,(0,Cb.inject)(pN.DI_TOKENS.IVaultAdapter)),fN("design:paramtypes",[Object])],d0)});var m0=_(jn=>{"use strict";var mN=jn&&jn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},gN=jn&&jn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},yN=jn&&jn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(jn,"__esModule",{value:!0});jn.TaskStatusService=void 0;var Ib=Ue(),vN=Zi(),ma=or(),_N=Kf(),wN=Xf(),bN=ht(),p0=class{static{o(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.workflow=t,this.timestampService=r,this.frontmatterService=new vN.FrontmatterService}async setDraftStatus(e){await this.updateStatus(e,"ems__EffortStatusDraft")}async moveToBacklog(e){await this.updateStatus(e,"ems__EffortStatusBacklog")}async moveToAnalysis(e){await this.updateStatus(e,"ems__EffortStatusAnalysis")}async moveToToDo(e){await this.updateStatus(e,"ems__EffortStatusToDo")}async startEffort(e){let t=await this.vault.read(e),r=ma.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_startTimestamp",r),await this.vault.modify(e,i)}async markTaskAsDone(e){let t=await this.vault.read(e),r=ma.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');i=this.frontmatterService.updateProperty(i,"ems__Effort_endTimestamp",r),i=this.frontmatterService.updateProperty(i,"ems__Effort_resolutionTimestamp",r),await this.vault.modify(e,i)}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async trashEffort(e,t){let r=await this.vault.read(e),i=ma.DateFormatter.toLocalTimestamp(new Date),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),t&&(s=this.appendTrashReason(s,t)),await this.vault.modify(e,s)}appendTrashReason(e,t){let r=`
62
62
 
63
63
  ## Trash Reason
64
64
 
@@ -635,7 +635,7 @@ ${hr.dump(i,{lineWidth:-1})}---
635
635
  States (${s.states.length}):`);for(let a of s.states){let c=a.optional?" (optional)":"",l=a.timestampOnEnter.length>0?` [timestamps: ${a.timestampOnEnter.join(", ")}]`:"";console.log(` ${a.order}. ${a.status}${c}${l}`)}console.log(`
636
636
  Transitions (${s.transitions.length}):`);for(let a of s.transitions){let c=a.isRollback?" (rollback)":"";console.log(` ${a.label}: ${a.from} \u2192 ${a.to}${c}`)}}}catch(i){V.handle(i)}}),n.command("validate").description("Validate a workflow definition").argument("<uid>","UID of the workflow asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async(e,t)=>{let r=t.output||"text";V.setFormat(r);try{let i=(0,Rc.resolve)(t.vault);if(!(0,ms.existsSync)(i))throw new Be(i);let s=II(i,e);if(!s){if(r==="json"){let l=ce.success({error:`Workflow with UID "${e}" not found`});console.log(JSON.stringify(l,null,2))}else console.log(`\u274C Workflow with UID "${e}" not found.`);process.exitCode=1;return}let c=new mi.WorkflowEngine(s).validate();if(r==="json"){let l=ce.success({workflow:s.name,uid:s.id,...c});console.log(JSON.stringify(l,null,2))}else if(c.valid)console.log(`\u2705 Workflow "${s.name}" is valid.`);else{console.log(`\u274C Workflow "${s.name}" has ${c.errors.length} error(s):
637
637
  `);for(let l of c.errors)console.log(` \u2022 ${l}`);process.exitCode=1}}catch(i){V.handle(i)}}),n}o(OI,"workflowCommand");var RI=new mi.FrontmatterService;function PI(n){let e=[],t=[];FI(n,t);for(let{filePath:r,fm:i}of t){let s=i.exo__Instance_class;if(!s||!(Array.isArray(s)?s.some(p=>p.includes("ems__Workflow")&&!p.includes("WorkflowState")&&!p.includes("WorkflowTransition")):typeof s=="string"&&s.includes("ems__Workflow")&&!s.includes("WorkflowState")&&!s.includes("WorkflowTransition")))continue;let c=i.exo__Asset_uid??"",l=i.exo__Asset_label??iB(r),u=ps(i.ems__Workflow_targetClass??"ems__Task"),f=i.ems__Workflow_isDefault===!0||i.ems__Workflow_isDefault==="true",h=0,d=0;for(let{fm:p}of t){let y=p.exo__Instance_class;if(!ps(p.ems__WorkflowState_workflow??p.ems__WorkflowTransition_workflow??"").includes(c))continue;let S=Array.isArray(y)?y.some(F=>F.includes("ems__WorkflowState")):typeof y=="string"&&y.includes("ems__WorkflowState"),x=Array.isArray(y)?y.some(F=>F.includes("ems__WorkflowTransition")):typeof y=="string"&&y.includes("ems__WorkflowTransition");S&&h++,x&&d++}e.push({filePath:r,uid:c,label:l,targetClass:u,isDefault:f,stateCount:h,transitionCount:d})}return e}o(PI,"scanWorkflows");function FI(n,e){let t;try{t=(0,ms.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,Rc.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;FI(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,ms.readFileSync)(i,"utf-8"),a=RI.parse(s);a.exists&&e.push({filePath:i,fm:DI(a.content)})}catch{}}}o(FI,"collectParsedFiles");function II(n,e){let r=PI(n).find(i=>i.uid===e);if(!r)return null;try{let i=(0,ms.readFileSync)(r.filePath,"utf-8"),s=RI.parse(i);if(!s.exists)return null;let a=DI(s.content),c=ps(a.ems__Workflow_targetClass??"ems__Task"),l=ps(a.ems__Workflow_initialState??"ems__EffortStatusDraft"),u=Oc(l)??mi.EffortStatus.DRAFT,h=(Array.isArray(a.ems__Workflow_terminalStates)?a.ems__Workflow_terminalStates.map(S=>ps(S)):[]).map(Oc).filter(S=>S!==null),d=a.ems__Workflow_isDefault===!0||a.ems__Workflow_isDefault==="true",y=(Array.isArray(a.ems__Workflow_states)?a.ems__Workflow_states:[]).map((S,x)=>typeof S=="string"?{status:Oc(ps(S))??mi.EffortStatus.DRAFT,order:x+1,optional:!1,timestampOnEnter:[]}:{status:Oc(ps(S.status??""))??mi.EffortStatus.DRAFT,order:S.order??x+1,optional:S.optional===!0||S.optional==="true",timestampOnEnter:Array.isArray(S.timestampOnEnter)?S.timestampOnEnter:[],badgeColor:S.badgeColor}),T=(Array.isArray(a.ems__Workflow_transitions)?a.ems__Workflow_transitions:[]).map(S=>{let x=Oc(ps(S.from??"")),F=Oc(ps(S.to??""));return!x||!F?null:{from:x,to:F,label:S.label??`${x} \u2192 ${F}`,icon:S.icon,isRollback:S.isRollback===!0||S.isRollback==="true"}}).filter(S=>S!==null);return{id:e,name:r.label,targetClass:c,states:y,transitions:T,initialState:u,terminalStates:h.length>0?h:[mi.EffortStatus.DONE,mi.EffortStatus.TRASHED],isDefault:d}}catch{return null}}o(II,"loadWorkflowByUid");function DI(n){let e={},t=n.split(`
638
- `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let c=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(c),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let c=a[2].trim();if((c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),c===""){e[r]=[],i=e[r];continue}e[r]=c}}return e}o(DI,"parseYamlFrontmatter");function ps(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ps,"normalizeWikilink");function iB(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(iB,"extractLabelFromFilename");function Oc(n){return Object.values(mi.EffortStatus).includes(n)?n:null}o(Oc,"resolveEffortStatus");var Rr=new Ge;Rr.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.46.1");var qv=Rr.command("sparql").description("SPARQL query execution and cache management");qv.addCommand(MA());qv.addCommand(UA());qv.addCommand(BA());Rr.addCommand(KC());Rr.addCommand(ZC());Rr.addCommand(eI());Rr.addCommand(rI());Rr.addCommand(nI());Rr.addCommand(cI());Rr.addCommand(hI());Rr.addCommand(mI());Rr.addCommand(vI());Rr.addCommand(EI());Rr.addCommand(AI());Rr.addCommand(CI());Rr.addCommand(OI());Rr.parse();
638
+ `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let c=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(c),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let c=a[2].trim();if((c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),c==="true"?c=!0:c==="false"&&(c=!1),c===""){e[r]=[],i=e[r];continue}e[r]=c}}return e}o(DI,"parseYamlFrontmatter");function ps(n){return typeof n!="string"?"":n.replace(/["'[\]]/g,"").trim()}o(ps,"normalizeWikilink");function iB(n){let e=n.split("/");return e[e.length-1].replace(/\.md$/,"")}o(iB,"extractLabelFromFilename");function Oc(n){return Object.values(mi.EffortStatus).includes(n)?n:null}o(Oc,"resolveEffortStatus");var Rr=new Ge;Rr.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.47.0");var qv=Rr.command("sparql").description("SPARQL query execution and cache management");qv.addCommand(MA());qv.addCommand(UA());qv.addCommand(BA());Rr.addCommand(KC());Rr.addCommand(ZC());Rr.addCommand(eI());Rr.addCommand(rI());Rr.addCommand(nI());Rr.addCommand(cI());Rr.addCommand(hI());Rr.addCommand(mI());Rr.addCommand(vI());Rr.addCommand(EI());Rr.addCommand(AI());Rr.addCommand(CI());Rr.addCommand(OI());Rr.parse();
639
639
  /*! Bundled license information:
640
640
 
641
641
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "15.46.1",
3
+ "version": "15.47.0",
4
4
  "description": "CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more",
5
5
  "main": "dist/index.js",
6
6
  "bin": {