@kitelev/exocortex-cli 15.139.0 → 15.141.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/dist/index.js +3 -3
- 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.
|
|
2
|
+
// @kitelev/exocortex-cli v15.141.0
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
@@ -88,7 +88,7 @@ ${Object.entries(t).map(([a,c])=>this.serializeValue(a,c)).join(`
|
|
|
88
88
|
${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};Pp.FrontmatterService=zu;zu.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;zu.IRI_PREFIX_MAP={"https://exocortex.my/ontology/ems#":"ems__","https://exocortex.my/ontology/exo#":"exo__","https://exocortex.my/ontology/exocmd#":"exocmd__","https://exocortex.my/ontology/ims#":"ims__","https://exocortex.my/ontology/ztlk#":"ztlk__","https://exocortex.my/ontology/ptms#":"ptms__","https://exocortex.my/ontology/lit#":"lit__","https://exocortex.my/ontology/inbox#":"inbox__","https://exocortex.my/ontology/pmbok#":"pmbok__"}});var qr=S(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.DateFormatter=void 0;var j1=class n{static{o(this,"DateFormatter")}static toISOTimestamp(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}static toLocalTimestamp(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0");return`${t}-${r}-${i}T${s}:${a}:${c}`}static toDateWikilink(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`"[[${t}-${r}-${i}]]"`}static getTodayWikilink(){return n.toDateWikilink(new Date)}static toDateString(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${i}`}static parseWikilink(e){let r=e.replace(/^["']|["']$/g,"").match(/\[\[(\d{4}-\d{2}-\d{2})\]\]/);return r?r[1]:null}static addDays(e,t){let r=new Date(e);return r.setDate(r.getDate()+t),r}static isSameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}static getTodayStartTimestamp(){let e=new Date;return e.setHours(0,0,0,0),n.toLocalTimestamp(e)}static toTimestampAtStartOfDay(e){let t=e.split("-").map(Number);if(t.length!==3||t.some(isNaN))throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD`);let[r,i,s]=t,a=new Date(r,i-1,s,0,0,0,0);if(isNaN(a.getTime()))throw new Error(`Invalid date values: ${e}`);return n.toLocalTimestamp(a)}static normalizeTimestamp(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp format: ${e}`);return n.toISOTimestamp(t)}static isISOTimestamp(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e)}};Fp.DateFormatter=j1});var xa=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.LoggingService=void 0;var Hu=class{static{o(this,"LoggingService")}static setVerbose(e){this.isVerbose=e}static setDevelopmentMode(e){this.isDevelopment=e}static checkIsDevelopment(){return this.isDevelopment!==void 0?this.isDevelopment:typeof process<"u"?(this.isDevelopment=!1,this.isDevelopment):(this.isDevelopment=!1,this.isDevelopment)}static debug(e,t){this.isVerbose&&console.debug(`[Exocortex] ${e}`,t??"")}static info(e,t){console.log(`[Exocortex] ${e}`,t??"")}static warn(e,t){console.warn(`[Exocortex] ${e}`,t??"")}static error(e,t,r){let i=this.checkIsDevelopment(),s=r?` [${r}]`:"";if(i){let a=t?.stack?`
|
|
89
89
|
Stack trace:
|
|
90
90
|
${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`,t??"")}else{let a=t?.message?`
|
|
91
|
-
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};Dp.LoggingService=Hu;Hu.isVerbose=!1;Hu.isDevelopment=void 0});var tA=S(ui=>{"use strict";var d5=ui&&ui.__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},h5=ui&&ui.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ui,"__esModule",{value:!0});ui.GroundingExecutor=ui.ServiceRegistry=void 0;var p5=le(),m5=Sn(),xo=pc(),g5=Gn(),y5=qr(),_5=xa();function S5(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(S5,"extractClassFromTargetValue");var Np=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};ui.ServiceRegistry=Np;var eA=20,$1=class{static{o(this,"GroundingExecutor")}constructor(e,t,r){this.frontmatterService=new g5.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r}async execute(e,t,r,i){try{switch(e.type){case xo.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case xo.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case xo.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case xo.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case xo.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,i);case xo.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};if(e.targetValue===void 0)return{success:!1,error:"property_set requires targetValue"};if(/\$(input|value)\b/.test(e.targetValue)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: targetValue contains $input/$value placeholder but no userInput.value provided"};let a=this.substituteVariables(e.targetValue,t,i),c=await this.fileReader.readFile(r),l=this.frontmatterService.updateProperty(c,e.targetProperty,a);return await this.fileWriter.updateFile(r,l),{success:!0}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=eA)return{success:!1,error:`Composite grounding exceeded maximum depth of ${eA}`};let a=e.steps??[];if(a.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<a.length;u++){let f=a[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=S5(e.targetValue);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let a=this.serviceRegistry.get(s);if(!a)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.targetValue)try{let l=JSON.parse(e.targetValue);typeof l=="object"&&l!==null&&(c={...l,...i??{}})}catch{}return await a.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Task]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Project]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeCreateInstance(e,t,r){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let i=(0,m5.v4)(),s=r?.label??"Untitled",a={exo__Asset_uid:i,exo__Asset_createdAt:new Date().toISOString(),exo__Asset_label:s};if(s!=="Untitled"&&(a.aliases=[s]),e.targetClass&&(a.exo__Instance_class=[`"[[${e.targetClass}]]"`]),e.targetPrototype&&(a.exo__Asset_prototype=`"[[${e.targetPrototype}]]"`),t&&(a.exo__Asset_source=`"[[${t}]]"`),r)for(let[u,f]of Object.entries(r))u!=="label"&&f!=null&&(a[u]=f);let c=this.frontmatterService.createFrontmatter("",a),l=`${e.targetFolder}/${i}.md`;return await this.fileWriter.createFile(l,c),{success:!0}}async executeStep(e,t,r,i,s){return e.type===xo.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){_5.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r){let i=new Date,s=i.toISOString(),a=y5.DateFormatter.toLocalTimestamp(i),c=s.slice(0,10),l=e.replace(/\$target/g,t).replace(/\$nowLocal/g,a).replace(/\$now/g,s).replace(/\$today/g,c);if(r?.value!==void 0&&r.value!==null){let u=String(r.value);l=l.replace(/\$input\b/g,u).replace(/\$value\b/g,u)}return l}};ui.GroundingExecutor=$1;ui.GroundingExecutor=$1=d5([(0,p5.injectable)(),h5("design:paramtypes",[Object,Object,Np])],$1)});var Qu=S(Us=>{"use strict";var b5=Us&&Us.__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},v5=Us&&Us.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Us,"__esModule",{value:!0});Us.WorkflowEngine=void 0;var w5=le(),B1=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}}};Us.WorkflowEngine=B1;Us.WorkflowEngine=B1=b5([(0,w5.injectable)(),v5("design:paramtypes",[Object])],B1)});var rA=S(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.EFFORT_WORKFLOW_PROPERTY=ss.WorkflowTransitionProperty=ss.WorkflowStateProperty=ss.WorkflowProperty=void 0;ss.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};ss.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};ss.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};ss.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var as=S(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});Lp.MetadataHelpers=void 0;var V1=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
|
|
91
|
+
Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${a}`)}}};Dp.LoggingService=Hu;Hu.isVerbose=!1;Hu.isDevelopment=void 0});var tA=S(ui=>{"use strict";var d5=ui&&ui.__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},h5=ui&&ui.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(ui,"__esModule",{value:!0});ui.GroundingExecutor=ui.ServiceRegistry=void 0;var p5=le(),m5=Sn(),xo=pc(),g5=Gn(),y5=qr(),_5=xa();function S5(n){if(!n)return;let e=n.match(/^"?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]"?$/);return e?e[1]:n}o(S5,"extractClassFromTargetValue");var Np=class{static{o(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};ui.ServiceRegistry=Np;var eA=20,$1=class{static{o(this,"GroundingExecutor")}constructor(e,t,r){this.frontmatterService=new g5.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r}async execute(e,t,r,i){try{switch(e.type){case xo.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case xo.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case xo.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case xo.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case xo.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,i);case xo.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};if(e.targetValue===void 0)return{success:!1,error:"property_set requires targetValue"};if(/\$(input|value)\b/.test(e.targetValue)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: targetValue contains $input/$value placeholder but no userInput.value provided"};let a=this.substituteVariables(e.targetValue,t,i),c=await this.fileReader.readFile(r),l=this.frontmatterService.updateProperty(c,e.targetProperty,a);return await this.fileWriter.updateFile(r,l),{success:!0}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=eA)return{success:!1,error:`Composite grounding exceeded maximum depth of ${eA}`};let a=e.steps??[];if(a.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<a.length;u++){let f=a[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=S5(e.targetValue);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let a=this.serviceRegistry.get(s);if(!a)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.targetValue)try{let l=this.substituteVariables(e.targetValue,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...i??{}})}catch{}return await a.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Task]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=this.frontmatterService.updateProperty(t,"exo__Instance_class",'["[[ems__Project]]"]');return await this.fileWriter.updateFile(e,r),{success:!0}}async executeCreateInstance(e,t,r){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let i=(0,m5.v4)(),s=r?.label??"Untitled",a={exo__Asset_uid:i,exo__Asset_createdAt:new Date().toISOString(),exo__Asset_label:s};if(s!=="Untitled"&&(a.aliases=[s]),e.targetClass&&(a.exo__Instance_class=[`"[[${e.targetClass}]]"`]),e.targetPrototype&&(a.exo__Asset_prototype=`"[[${e.targetPrototype}]]"`),t&&(a.exo__Asset_source=`"[[${t}]]"`),r)for(let[u,f]of Object.entries(r))u!=="label"&&f!=null&&(a[u]=f);let c=this.frontmatterService.createFrontmatter("",a),l=`${e.targetFolder}/${i}.md`;return await this.fileWriter.createFile(l,c),{success:!0}}async executeStep(e,t,r,i,s){return e.type===xo.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){_5.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r){let i=new Date,s=i.toISOString(),a=y5.DateFormatter.toLocalTimestamp(i),c=s.slice(0,10),l=e.replace(/\$target/g,t).replace(/\$nowLocal/g,a).replace(/\$now/g,s).replace(/\$today/g,c);if(r?.value!==void 0&&r.value!==null){let u=String(r.value);l=l.replace(/\$input\b/g,u).replace(/\$value\b/g,u)}return l}};ui.GroundingExecutor=$1;ui.GroundingExecutor=$1=d5([(0,p5.injectable)(),h5("design:paramtypes",[Object,Object,Np])],$1)});var Qu=S(Us=>{"use strict";var b5=Us&&Us.__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},v5=Us&&Us.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Us,"__esModule",{value:!0});Us.WorkflowEngine=void 0;var w5=le(),B1=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}}};Us.WorkflowEngine=B1;Us.WorkflowEngine=B1=b5([(0,w5.injectable)(),v5("design:paramtypes",[Object])],B1)});var rA=S(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.EFFORT_WORKFLOW_PROPERTY=ss.WorkflowTransitionProperty=ss.WorkflowStateProperty=ss.WorkflowProperty=void 0;ss.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};ss.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};ss.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};ss.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var as=S(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});Lp.MetadataHelpers=void 0;var V1=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([a,c])=>{if(Array.isArray(c)){let l=c.map(u=>` - ${u}`).join(`
|
|
92
92
|
`);return`${a}:
|
|
93
93
|
${l}`}return`${a}: ${c}`}).join(`
|
|
94
94
|
`),i=t;if(i===void 0){let a=e.exo__Asset_label;typeof a=="string"&&a.trim()!==""&&(i=`# ${a}`)}let s=i?`
|
|
@@ -790,7 +790,7 @@ exo__BacklinksTableBlock_columns:${f==="[]"?" []":f}
|
|
|
790
790
|
--- END PREVIEW ---
|
|
791
791
|
`)}o(QY,"printDryRunReport");function YY(n,e){let r=[`--- MIGRATION ${e.apply?"APPLY":"DRY RUN"} ---`,`Migrated pairs: ${n.pairs.length}`,`Skipped configs: ${n.skipped.length}`];e.apply&&(r.push(`Files written to: ${e.outDir}/ (relative to vault root)`),r.push(`Total files written: ${n.pairs.length*2} (${n.pairs.length} Layout + ${n.pairs.length} Block)`));for(let i of n.skipped)r.push(` SKIPPED: ${i.sourcePath} \u2014 ${i.reason}`);return r.push(`--- END SUMMARY ---
|
|
792
792
|
`),r.join(`
|
|
793
|
-
`)}o(YY,"formatSummary");function KY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(KY,"summariseResult");function bD(n){n.addCommand(sP()),n.addCommand(lP()),n.addCommand(uP())}o(bD,"addQuerySubcommands");function vD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.
|
|
793
|
+
`)}o(YY,"formatSummary");function KY(n,e){return{mode:e.apply?"apply":"dry-run",outDir:e.outDir,pairsCount:n.pairs.length,skippedCount:n.skipped.length,pairs:n.pairs.map(t=>({sourceUid:t.sourceUid,sourcePath:t.sourcePath,layoutUid:t.layout.uid,blockUid:t.block.uid,warnings:t.warnings})),skipped:n.skipped}}o(KY,"summariseResult");function bD(n){n.addCommand(sP()),n.addCommand(lP()),n.addCommand(uP())}o(bD,"addQuerySubcommands");function vD(n){let e=new Ie;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.141.0");let t=e.command("exoql").description("ExoQL query execution and cache management");bD(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return bD(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(_F()),e.addCommand(vF()),e.addCommand(wF()),e.addCommand(TF()),e.addCommand(AF()),e.addCommand(OF()),e.addCommand(NF()),e.addCommand(UF()),e.addCommand(GF()),e.addCommand(KF()),e.addCommand(ZF()),e.addCommand(eD()),e.addCommand(rD()),e.addCommand(cD()),e.addCommand(dD()),e.addCommand(SD()),e}o(vD,"createProgram");vD().parse();0&&(module.exports={createProgram});
|
|
794
794
|
/*! Bundled license information:
|
|
795
795
|
|
|
796
796
|
reflect-metadata/Reflect.js:
|
package/package.json
CHANGED