ace-assistant-cli 0.1.1 → 0.3.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/README.dev.md CHANGED
@@ -52,6 +52,19 @@ ace actions list --status active # Filter by status
52
52
  ace actions add "New task" # Create action
53
53
  ace actions complete <id> # Mark complete
54
54
  ace actions update <id> --status waiting --waiting "Bob"
55
+
56
+ # Date-based filtering
57
+ ace actions due # Actions due today
58
+ ace actions due --week # Actions due this week
59
+ ace actions overdue # Overdue actions
60
+ ace actions completed # Recently completed (last 7 days)
61
+ ace actions completed --days 14 # Completed in last 14 days
62
+
63
+ # Other filters
64
+ ace actions waiting # Actions waiting on someone
65
+ ace actions count # Count by status
66
+ ace actions list --due today # Filter by due date
67
+ ace actions list --overdue # Include overdue flag
55
68
  ```
56
69
 
57
70
  ### Projects
@@ -63,7 +76,47 @@ ace projects list --domain Work # Filter by domain
63
76
  ace projects add "New Project" # Create project
64
77
  ace projects activate <id> # Set to active
65
78
  ace projects complete <id> # Mark complete
79
+
80
+ # Reviews
66
81
  ace projects review # Projects due for review
82
+ ace projects mark-reviewed <id> # Mark as reviewed
83
+
84
+ # Status changes
85
+ ace projects drop <id> # Drop a project
86
+ ace projects completed # Recently completed (last 7 days)
87
+ ace projects completed --days 14 # Completed in last 14 days
88
+ ```
89
+
90
+ ### Goals
91
+
92
+ ```bash
93
+ ace goals list # List all goals
94
+ ace goals active # List active goals
95
+ ace goals list --domain Work # Filter by domain
96
+ ace goals get <id> # Get goal details
97
+ ace goals add "New Goal" --domain Work # Create goal
98
+ ace goals update <id> --name "Updated" # Update goal
99
+ ace goals complete <id> # Mark complete
100
+ ace goals pause <id> # Pause goal
101
+ ace goals drop <id> # Drop goal
102
+ ace goals review # Goals due for review
103
+ ace goals mark-reviewed <id> # Mark as reviewed
104
+ ```
105
+
106
+ ### Activity Log
107
+
108
+ ```bash
109
+ ace activity list # Recent activity (last 7 days)
110
+ ace activity list --days 14 # Activity from last 14 days
111
+ ace activity list --source manual # Filter by source
112
+ ace activity log "Did the thing" # Log new activity
113
+ ace activity log "Meeting" --category <id> # With category
114
+ ```
115
+
116
+ ### Contexts
117
+
118
+ ```bash
119
+ ace contexts list # List all contexts
67
120
  ```
68
121
 
69
122
  ## JSON Output
package/dist/index.js CHANGED
@@ -1,41 +1,60 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{createRequire as M$}from"node:module";var T$=Object.create;var{getPrototypeOf:Q$,defineProperty:zj,getOwnPropertyNames:U$}=Object;var Z$=Object.prototype.hasOwnProperty;var G$=(j,$,S)=>{S=j!=null?T$(Q$(j)):{};let y=$||!j||!j.__esModule?zj(S,"default",{value:j,enumerable:!0}):S;for(let q of U$(j))if(!Z$.call(y,q))zj(y,q,{get:()=>j[q],enumerable:!0});return y};var F=(j,$)=>()=>($||j(($={exports:{}}).exports,$),$.exports);var C=M$(import.meta.url);var k=F((X$)=>{class r extends Error{constructor(j,$,S){super(S);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=j,this.nestedError=void 0}}class Wj extends r{constructor(j){super(1,"commander.invalidArgument",j);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}X$.CommanderError=r;X$.InvalidArgumentError=Wj});var O=F((L$)=>{var{InvalidArgumentError:W$}=k();class Hj{constructor(j,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,j[0]){case"<":this.required=!0,this._name=j.slice(1,-1);break;case"[":this.required=!1,this._name=j.slice(1,-1);break;default:this.required=!0,this._name=j;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(j,$){if($===this.defaultValue||!Array.isArray($))return[j];return $.concat(j)}default(j,$){return this.defaultValue=j,this.defaultValueDescription=$,this}argParser(j){return this.parseArg=j,this}choices(j){return this.argChoices=j.slice(),this.parseArg=($,S)=>{if(!this.argChoices.includes($))throw new W$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,S);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function H$(j){let $=j.name()+(j.variadic===!0?"...":"");return j.required?"<"+$+">":"["+$+"]"}L$.Argument=Hj;L$.humanReadableArgName=H$});var l=F((B$)=>{var{humanReadableArgName:F$}=O();class Lj{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(j){let $=j.commands.filter((y)=>!y._hidden),S=j._getHelpCommand();if(S&&!S._hidden)$.push(S);if(this.sortSubcommands)$.sort((y,q)=>{return y.name().localeCompare(q.name())});return $}compareOptions(j,$){let S=(y)=>{return y.short?y.short.replace(/^-/,""):y.long.replace(/^--/,"")};return S(j).localeCompare(S($))}visibleOptions(j){let $=j.options.filter((y)=>!y.hidden),S=j._getHelpOption();if(S&&!S.hidden){let y=S.short&&j._findOption(S.short),q=S.long&&j._findOption(S.long);if(!y&&!q)$.push(S);else if(S.long&&!q)$.push(j.createOption(S.long,S.description));else if(S.short&&!y)$.push(j.createOption(S.short,S.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(j){if(!this.showGlobalOptions)return[];let $=[];for(let S=j.parent;S;S=S.parent){let y=S.options.filter((q)=>!q.hidden);$.push(...y)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(j){if(j._argsDescription)j.registeredArguments.forEach(($)=>{$.description=$.description||j._argsDescription[$.name()]||""});if(j.registeredArguments.find(($)=>$.description))return j.registeredArguments;return[]}subcommandTerm(j){let $=j.registeredArguments.map((S)=>F$(S)).join(" ");return j._name+(j._aliases[0]?"|"+j._aliases[0]:"")+(j.options.length?" [options]":"")+($?" "+$:"")}optionTerm(j){return j.flags}argumentTerm(j){return j.name()}longestSubcommandTermLength(j,$){return $.visibleCommands(j).reduce((S,y)=>{return Math.max(S,$.subcommandTerm(y).length)},0)}longestOptionTermLength(j,$){return $.visibleOptions(j).reduce((S,y)=>{return Math.max(S,$.optionTerm(y).length)},0)}longestGlobalOptionTermLength(j,$){return $.visibleGlobalOptions(j).reduce((S,y)=>{return Math.max(S,$.optionTerm(y).length)},0)}longestArgumentTermLength(j,$){return $.visibleArguments(j).reduce((S,y)=>{return Math.max(S,$.argumentTerm(y).length)},0)}commandUsage(j){let $=j._name;if(j._aliases[0])$=$+"|"+j._aliases[0];let S="";for(let y=j.parent;y;y=y.parent)S=y.name()+" "+S;return S+$+" "+j.usage()}commandDescription(j){return j.description()}subcommandDescription(j){return j.summary()||j.description()}optionDescription(j){let $=[];if(j.argChoices)$.push(`choices: ${j.argChoices.map((S)=>JSON.stringify(S)).join(", ")}`);if(j.defaultValue!==void 0){if(j.required||j.optional||j.isBoolean()&&typeof j.defaultValue==="boolean")$.push(`default: ${j.defaultValueDescription||JSON.stringify(j.defaultValue)}`)}if(j.presetArg!==void 0&&j.optional)$.push(`preset: ${JSON.stringify(j.presetArg)}`);if(j.envVar!==void 0)$.push(`env: ${j.envVar}`);if($.length>0)return`${j.description} (${$.join(", ")})`;return j.description}argumentDescription(j){let $=[];if(j.argChoices)$.push(`choices: ${j.argChoices.map((S)=>JSON.stringify(S)).join(", ")}`);if(j.defaultValue!==void 0)$.push(`default: ${j.defaultValueDescription||JSON.stringify(j.defaultValue)}`);if($.length>0){let S=`(${$.join(", ")})`;if(j.description)return`${j.description} ${S}`;return S}return j.description}formatHelp(j,$){let S=$.padWidth(j,$),y=$.helpWidth||80,q=2,R=2;function I(G,H){if(H){let s=`${G.padEnd(S+2)}${H}`;return $.wrap(s,y-2,S+2)}return G}function E(G){return G.join(`
4
- `).replace(/^/gm," ".repeat(2))}let P=[`Usage: ${$.commandUsage(j)}`,""],J=$.commandDescription(j);if(J.length>0)P=P.concat([$.wrap(J,y,0),""]);let Y=$.visibleArguments(j).map((G)=>{return I($.argumentTerm(G),$.argumentDescription(G))});if(Y.length>0)P=P.concat(["Arguments:",E(Y),""]);let Z=$.visibleOptions(j).map((G)=>{return I($.optionTerm(G),$.optionDescription(G))});if(Z.length>0)P=P.concat(["Options:",E(Z),""]);if(this.showGlobalOptions){let G=$.visibleGlobalOptions(j).map((H)=>{return I($.optionTerm(H),$.optionDescription(H))});if(G.length>0)P=P.concat(["Global Options:",E(G),""])}let X=$.visibleCommands(j).map((G)=>{return I($.subcommandTerm(G),$.subcommandDescription(G))});if(X.length>0)P=P.concat(["Commands:",E(X),""]);return P.join(`
5
- `)}padWidth(j,$){return Math.max($.longestOptionTermLength(j,$),$.longestGlobalOptionTermLength(j,$),$.longestSubcommandTermLength(j,$),$.longestArgumentTermLength(j,$))}wrap(j,$,S,y=40){let R=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(j.match(R))return j;let I=$-S;if(I<y)return j;let E=j.slice(0,S),P=j.slice(S).replace(`\r
3
+ import{createRequire as I$}from"node:module";var f$=Object.create;var{getPrototypeOf:P$,defineProperty:kc,getOwnPropertyNames:R$}=Object;var G$=Object.prototype.hasOwnProperty;var U$=(c,y,$)=>{$=c!=null?f$(P$(c)):{};let j=y||!c||!c.__esModule?kc($,"default",{value:c,enumerable:!0}):$;for(let f of R$(c))if(!G$.call(j,f))kc(j,f,{get:()=>c[f],enumerable:!0});return j};var C=(c,y)=>()=>(y||c((y={exports:{}}).exports,y),y.exports);var v=I$(import.meta.url);var b=C((L$)=>{class $c extends Error{constructor(c,y,$){super($);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=y,this.exitCode=c,this.nestedError=void 0}}class tc extends $c{constructor(c){super(1,"commander.invalidArgument",c);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}L$.CommanderError=$c;L$.InvalidArgumentError=tc});var r=C((Y$)=>{var{InvalidArgumentError:w$}=b();class uc{constructor(c,y){switch(this.description=y||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,c[0]){case"<":this.required=!0,this._name=c.slice(1,-1);break;case"[":this.required=!1,this._name=c.slice(1,-1);break;default:this.required=!0,this._name=c;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(c,y){if(y===this.defaultValue||!Array.isArray(y))return[c];return y.concat(c)}default(c,y){return this.defaultValue=c,this.defaultValueDescription=y,this}argParser(c){return this.parseArg=c,this}choices(c){return this.argChoices=c.slice(),this.parseArg=(y,$)=>{if(!this.argChoices.includes(y))throw new w$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(y,$);return y},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function E$(c){let y=c.name()+(c.variadic===!0?"...":"");return c.required?"<"+y+">":"["+y+"]"}Y$.Argument=uc;Y$.humanReadableArgName=E$});var jc=C((F$)=>{var{humanReadableArgName:Z$}=r();class hc{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(c){let y=c.commands.filter((j)=>!j._hidden),$=c._getHelpCommand();if($&&!$._hidden)y.push($);if(this.sortSubcommands)y.sort((j,f)=>{return j.name().localeCompare(f.name())});return y}compareOptions(c,y){let $=(j)=>{return j.short?j.short.replace(/^-/,""):j.long.replace(/^--/,"")};return $(c).localeCompare($(y))}visibleOptions(c){let y=c.options.filter((j)=>!j.hidden),$=c._getHelpOption();if($&&!$.hidden){let j=$.short&&c._findOption($.short),f=$.long&&c._findOption($.long);if(!j&&!f)y.push($);else if($.long&&!f)y.push(c.createOption($.long,$.description));else if($.short&&!j)y.push(c.createOption($.short,$.description))}if(this.sortOptions)y.sort(this.compareOptions);return y}visibleGlobalOptions(c){if(!this.showGlobalOptions)return[];let y=[];for(let $=c.parent;$;$=$.parent){let j=$.options.filter((f)=>!f.hidden);y.push(...j)}if(this.sortOptions)y.sort(this.compareOptions);return y}visibleArguments(c){if(c._argsDescription)c.registeredArguments.forEach((y)=>{y.description=y.description||c._argsDescription[y.name()]||""});if(c.registeredArguments.find((y)=>y.description))return c.registeredArguments;return[]}subcommandTerm(c){let y=c.registeredArguments.map(($)=>Z$($)).join(" ");return c._name+(c._aliases[0]?"|"+c._aliases[0]:"")+(c.options.length?" [options]":"")+(y?" "+y:"")}optionTerm(c){return c.flags}argumentTerm(c){return c.name()}longestSubcommandTermLength(c,y){return y.visibleCommands(c).reduce(($,j)=>{return Math.max($,y.subcommandTerm(j).length)},0)}longestOptionTermLength(c,y){return y.visibleOptions(c).reduce(($,j)=>{return Math.max($,y.optionTerm(j).length)},0)}longestGlobalOptionTermLength(c,y){return y.visibleGlobalOptions(c).reduce(($,j)=>{return Math.max($,y.optionTerm(j).length)},0)}longestArgumentTermLength(c,y){return y.visibleArguments(c).reduce(($,j)=>{return Math.max($,y.argumentTerm(j).length)},0)}commandUsage(c){let y=c._name;if(c._aliases[0])y=y+"|"+c._aliases[0];let $="";for(let j=c.parent;j;j=j.parent)$=j.name()+" "+$;return $+y+" "+c.usage()}commandDescription(c){return c.description()}subcommandDescription(c){return c.summary()||c.description()}optionDescription(c){let y=[];if(c.argChoices)y.push(`choices: ${c.argChoices.map(($)=>JSON.stringify($)).join(", ")}`);if(c.defaultValue!==void 0){if(c.required||c.optional||c.isBoolean()&&typeof c.defaultValue==="boolean")y.push(`default: ${c.defaultValueDescription||JSON.stringify(c.defaultValue)}`)}if(c.presetArg!==void 0&&c.optional)y.push(`preset: ${JSON.stringify(c.presetArg)}`);if(c.envVar!==void 0)y.push(`env: ${c.envVar}`);if(y.length>0)return`${c.description} (${y.join(", ")})`;return c.description}argumentDescription(c){let y=[];if(c.argChoices)y.push(`choices: ${c.argChoices.map(($)=>JSON.stringify($)).join(", ")}`);if(c.defaultValue!==void 0)y.push(`default: ${c.defaultValueDescription||JSON.stringify(c.defaultValue)}`);if(y.length>0){let $=`(${y.join(", ")})`;if(c.description)return`${c.description} ${$}`;return $}return c.description}formatHelp(c,y){let $=y.padWidth(c,y),j=y.helpWidth||80,f=2,P=2;function R(Q,H){if(H){let yc=`${Q.padEnd($+2)}${H}`;return y.wrap(yc,j-2,$+2)}return Q}function G(Q){return Q.join(`
4
+ `).replace(/^/gm," ".repeat(2))}let U=[`Usage: ${y.commandUsage(c)}`,""],q=y.commandDescription(c);if(q.length>0)U=U.concat([y.wrap(q,j,0),""]);let w=y.visibleArguments(c).map((Q)=>{return R(y.argumentTerm(Q),y.argumentDescription(Q))});if(w.length>0)U=U.concat(["Arguments:",G(w),""]);let Y=y.visibleOptions(c).map((Q)=>{return R(y.optionTerm(Q),y.optionDescription(Q))});if(Y.length>0)U=U.concat(["Options:",G(Y),""]);if(this.showGlobalOptions){let Q=y.visibleGlobalOptions(c).map((H)=>{return R(y.optionTerm(H),y.optionDescription(H))});if(Q.length>0)U=U.concat(["Global Options:",G(Q),""])}let Z=y.visibleCommands(c).map((Q)=>{return R(y.subcommandTerm(Q),y.subcommandDescription(Q))});if(Z.length>0)U=U.concat(["Commands:",G(Z),""]);return U.join(`
5
+ `)}padWidth(c,y){return Math.max(y.longestOptionTermLength(c,y),y.longestGlobalOptionTermLength(c,y),y.longestSubcommandTermLength(c,y),y.longestArgumentTermLength(c,y))}wrap(c,y,$,j=40){let P=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if(c.match(P))return c;let R=y-$;if(R<j)return c;let G=c.slice(0,$),U=c.slice($).replace(`\r
6
6
  `,`
7
- `),J=" ".repeat(S),Z=`\\s${"​"}`,X=new RegExp(`
8
- |.{1,${I-1}}([${Z}]|$)|[^${Z}]+?([${Z}]|$)`,"g"),G=P.match(X)||[];return E+G.map((H,s)=>{if(H===`
9
- `)return"";return(s>0?J:"")+H.trimEnd()}).join(`
10
- `)}}B$.Help=Lj});var d=F((w$)=>{var{InvalidArgumentError:V$}=k();class Dj{constructor(j,$){this.flags=j,this.description=$||"",this.required=j.includes("<"),this.optional=j.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(j),this.mandatory=!1;let S=f$(j);if(this.short=S.shortFlag,this.long=S.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(j,$){return this.defaultValue=j,this.defaultValueDescription=$,this}preset(j){return this.presetArg=j,this}conflicts(j){return this.conflictsWith=this.conflictsWith.concat(j),this}implies(j){let $=j;if(typeof j==="string")$={[j]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(j){return this.envVar=j,this}argParser(j){return this.parseArg=j,this}makeOptionMandatory(j=!0){return this.mandatory=!!j,this}hideHelp(j=!0){return this.hidden=!!j,this}_concatValue(j,$){if($===this.defaultValue||!Array.isArray($))return[j];return $.concat(j)}choices(j){return this.argChoices=j.slice(),this.parseArg=($,S)=>{if(!this.argChoices.includes($))throw new V$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue($,S);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return A$(this.name().replace(/^no-/,""))}is(j){return this.short===j||this.long===j}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class Kj{constructor(j){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,j.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,S)=>{if(this.positiveOptions.has(S))this.dualOptions.add(S)})}valueFromOption(j,$){let S=$.attributeName();if(!this.dualOptions.has(S))return!0;let y=this.negativeOptions.get(S).presetArg,q=y!==void 0?y:!1;return $.negate===(q===j)}}function A$(j){return j.split("-").reduce(($,S)=>{return $+S[0].toUpperCase()+S.slice(1)})}function f$(j){let $,S,y=j.split(/[ |,]+/);if(y.length>1&&!/^[[<]/.test(y[1]))$=y.shift();if(S=y.shift(),!$&&/^-[^-]$/.test(S))$=S,S=void 0;return{shortFlag:$,longFlag:S}}w$.Option=Dj;w$.DualOptions=Kj});var Fj=F((u$)=>{function k$(j,$){if(Math.abs(j.length-$.length)>3)return Math.max(j.length,$.length);let S=[];for(let y=0;y<=j.length;y++)S[y]=[y];for(let y=0;y<=$.length;y++)S[0][y]=y;for(let y=1;y<=$.length;y++)for(let q=1;q<=j.length;q++){let R=1;if(j[q-1]===$[y-1])R=0;else R=1;if(S[q][y]=Math.min(S[q-1][y]+1,S[q][y-1]+1,S[q-1][y-1]+R),q>1&&y>1&&j[q-1]===$[y-2]&&j[q-2]===$[y-1])S[q][y]=Math.min(S[q][y],S[q-2][y-2]+1)}return S[j.length][$.length]}function b$(j,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let S=j.startsWith("--");if(S)j=j.slice(2),$=$.map((I)=>I.slice(2));let y=[],q=3,R=0.4;if($.forEach((I)=>{if(I.length<=1)return;let E=k$(j,I),P=Math.max(j.length,I.length);if((P-E)/P>R){if(E<q)q=E,y=[I];else if(E===q)y.push(I)}}),y.sort((I,E)=>I.localeCompare(E)),S)y=y.map((I)=>`--${I}`);if(y.length>1)return`
11
- (Did you mean one of ${y.join(", ")}?)`;if(y.length===1)return`
12
- (Did you mean ${y[0]}?)`;return""}u$.suggestSimilar=b$});var Aj=F((m$)=>{var c$=C("node:events").EventEmitter,i=C("node:child_process"),z=C("node:path"),p=C("node:fs"),M=C("node:process"),{Argument:h$,humanReadableArgName:v$}=O(),{CommanderError:o}=k(),{Help:t$}=l(),{Option:Bj,DualOptions:g$}=d(),{suggestSimilar:Nj}=Fj();class n extends c${constructor(j){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=j||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:($)=>M.stdout.write($),writeErr:($)=>M.stderr.write($),getOutHelpWidth:()=>M.stdout.isTTY?M.stdout.columns:void 0,getErrHelpWidth:()=>M.stderr.isTTY?M.stderr.columns:void 0,outputError:($,S)=>S($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(j){return this._outputConfiguration=j._outputConfiguration,this._helpOption=j._helpOption,this._helpCommand=j._helpCommand,this._helpConfiguration=j._helpConfiguration,this._exitCallback=j._exitCallback,this._storeOptionsAsProperties=j._storeOptionsAsProperties,this._combineFlagAndOptionalValue=j._combineFlagAndOptionalValue,this._allowExcessArguments=j._allowExcessArguments,this._enablePositionalOptions=j._enablePositionalOptions,this._showHelpAfterError=j._showHelpAfterError,this._showSuggestionAfterError=j._showSuggestionAfterError,this}_getCommandAndAncestors(){let j=[];for(let $=this;$;$=$.parent)j.push($);return j}command(j,$,S){let y=$,q=S;if(typeof y==="object"&&y!==null)q=y,y=null;q=q||{};let[,R,I]=j.match(/([^ ]+) *(.*)/),E=this.createCommand(R);if(y)E.description(y),E._executableHandler=!0;if(q.isDefault)this._defaultCommandName=E._name;if(E._hidden=!!(q.noHelp||q.hidden),E._executableFile=q.executableFile||null,I)E.arguments(I);if(this._registerCommand(E),E.parent=this,E.copyInheritedSettings(this),y)return this;return E}createCommand(j){return new n(j)}createHelp(){return Object.assign(new t$,this.configureHelp())}configureHelp(j){if(j===void 0)return this._helpConfiguration;return this._helpConfiguration=j,this}configureOutput(j){if(j===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,j),this}showHelpAfterError(j=!0){if(typeof j!=="string")j=!!j;return this._showHelpAfterError=j,this}showSuggestionAfterError(j=!0){return this._showSuggestionAfterError=!!j,this}addCommand(j,$){if(!j._name)throw Error(`Command passed to .addCommand() must have a name
13
- - specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=j._name;if($.noHelp||$.hidden)j._hidden=!0;return this._registerCommand(j),j.parent=this,j._checkForBrokenPassThrough(),this}createArgument(j,$){return new h$(j,$)}argument(j,$,S,y){let q=this.createArgument(j,$);if(typeof S==="function")q.default(y).argParser(S);else q.default(S);return this.addArgument(q),this}arguments(j){return j.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(j){let $=this.registeredArguments.slice(-1)[0];if($&&$.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(j.required&&j.defaultValue!==void 0&&j.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${j.name()}'`);return this.registeredArguments.push(j),this}helpCommand(j,$){if(typeof j==="boolean")return this._addImplicitHelpCommand=j,this;j=j??"help [command]";let[,S,y]=j.match(/([^ ]+) *(.*)/),q=$??"display help for command",R=this.createCommand(S);if(R.helpOption(!1),y)R.arguments(y);if(q)R.description(q);return this._addImplicitHelpCommand=!0,this._helpCommand=R,this}addHelpCommand(j,$){if(typeof j!=="object")return this.helpCommand(j,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=j,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(j,$){let S=["preSubcommand","preAction","postAction"];if(!S.includes(j))throw Error(`Unexpected value for event passed to hook : '${j}'.
14
- Expecting one of '${S.join("', '")}'`);if(this._lifeCycleHooks[j])this._lifeCycleHooks[j].push($);else this._lifeCycleHooks[j]=[$];return this}exitOverride(j){if(j)this._exitCallback=j;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(j,$,S){if(this._exitCallback)this._exitCallback(new o(j,$,S));M.exit(j)}action(j){let $=(S)=>{let y=this.registeredArguments.length,q=S.slice(0,y);if(this._storeOptionsAsProperties)q[y]=this;else q[y]=this.opts();return q.push(this),j.apply(this,q)};return this._actionHandler=$,this}createOption(j,$){return new Bj(j,$)}_callParseArg(j,$,S,y){try{return j.parseArg($,S)}catch(q){if(q.code==="commander.invalidArgument"){let R=`${y} ${q.message}`;this.error(R,{exitCode:q.exitCode,code:q.code})}throw q}}_registerOption(j){let $=j.short&&this._findOption(j.short)||j.long&&this._findOption(j.long);if($){let S=j.long&&this._findOption(j.long)?j.long:j.short;throw Error(`Cannot add option '${j.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${S}'
15
- - already used by option '${$.flags}'`)}this.options.push(j)}_registerCommand(j){let $=(y)=>{return[y.name()].concat(y.aliases())},S=$(j).find((y)=>this._findCommand(y));if(S){let y=$(this._findCommand(S)).join("|"),q=$(j).join("|");throw Error(`cannot add command '${q}' as already have command '${y}'`)}this.commands.push(j)}addOption(j){this._registerOption(j);let $=j.name(),S=j.attributeName();if(j.negate){let q=j.long.replace(/^--no-/,"--");if(!this._findOption(q))this.setOptionValueWithSource(S,j.defaultValue===void 0?!0:j.defaultValue,"default")}else if(j.defaultValue!==void 0)this.setOptionValueWithSource(S,j.defaultValue,"default");let y=(q,R,I)=>{if(q==null&&j.presetArg!==void 0)q=j.presetArg;let E=this.getOptionValue(S);if(q!==null&&j.parseArg)q=this._callParseArg(j,q,E,R);else if(q!==null&&j.variadic)q=j._concatValue(q,E);if(q==null)if(j.negate)q=!1;else if(j.isBoolean()||j.optional)q=!0;else q="";this.setOptionValueWithSource(S,q,I)};if(this.on("option:"+$,(q)=>{let R=`error: option '${j.flags}' argument '${q}' is invalid.`;y(q,R,"cli")}),j.envVar)this.on("optionEnv:"+$,(q)=>{let R=`error: option '${j.flags}' value '${q}' from env '${j.envVar}' is invalid.`;y(q,R,"env")});return this}_optionEx(j,$,S,y,q){if(typeof $==="object"&&$ instanceof Bj)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let R=this.createOption($,S);if(R.makeOptionMandatory(!!j.mandatory),typeof y==="function")R.default(q).argParser(y);else if(y instanceof RegExp){let I=y;y=(E,P)=>{let J=I.exec(E);return J?J[0]:P},R.default(q).argParser(y)}else R.default(y);return this.addOption(R)}option(j,$,S,y){return this._optionEx({},j,$,S,y)}requiredOption(j,$,S,y){return this._optionEx({mandatory:!0},j,$,S,y)}combineFlagAndOptionalValue(j=!0){return this._combineFlagAndOptionalValue=!!j,this}allowUnknownOption(j=!0){return this._allowUnknownOption=!!j,this}allowExcessArguments(j=!0){return this._allowExcessArguments=!!j,this}enablePositionalOptions(j=!0){return this._enablePositionalOptions=!!j,this}passThroughOptions(j=!0){return this._passThroughOptions=!!j,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(j=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!j,this}getOptionValue(j){if(this._storeOptionsAsProperties)return this[j];return this._optionValues[j]}setOptionValue(j,$){return this.setOptionValueWithSource(j,$,void 0)}setOptionValueWithSource(j,$,S){if(this._storeOptionsAsProperties)this[j]=$;else this._optionValues[j]=$;return this._optionValueSources[j]=S,this}getOptionValueSource(j){return this._optionValueSources[j]}getOptionValueSourceWithGlobals(j){let $;return this._getCommandAndAncestors().forEach((S)=>{if(S.getOptionValueSource(j)!==void 0)$=S.getOptionValueSource(j)}),$}_prepareUserArgs(j,$){if(j!==void 0&&!Array.isArray(j))throw Error("first parameter to parse must be array or undefined");if($=$||{},j===void 0&&$.from===void 0){if(M.versions?.electron)$.from="electron";let y=M.execArgv??[];if(y.includes("-e")||y.includes("--eval")||y.includes("-p")||y.includes("--print"))$.from="eval"}if(j===void 0)j=M.argv;this.rawArgs=j.slice();let S;switch($.from){case void 0:case"node":this._scriptPath=j[1],S=j.slice(2);break;case"electron":if(M.defaultApp)this._scriptPath=j[1],S=j.slice(2);else S=j.slice(1);break;case"user":S=j.slice(0);break;case"eval":S=j.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",S}parse(j,$){let S=this._prepareUserArgs(j,$);return this._parseCommand([],S),this}async parseAsync(j,$){let S=this._prepareUserArgs(j,$);return await this._parseCommand([],S),this}_executeSubCommand(j,$){$=$.slice();let S=!1,y=[".js",".ts",".tsx",".mjs",".cjs"];function q(J,Y){let Z=z.resolve(J,Y);if(p.existsSync(Z))return Z;if(y.includes(z.extname(Y)))return;let X=y.find((G)=>p.existsSync(`${Z}${G}`));if(X)return`${Z}${X}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let R=j._executableFile||`${this._name}-${j._name}`,I=this._executableDir||"";if(this._scriptPath){let J;try{J=p.realpathSync(this._scriptPath)}catch(Y){J=this._scriptPath}I=z.resolve(z.dirname(J),I)}if(I){let J=q(I,R);if(!J&&!j._executableFile&&this._scriptPath){let Y=z.basename(this._scriptPath,z.extname(this._scriptPath));if(Y!==this._name)J=q(I,`${Y}-${j._name}`)}R=J||R}S=y.includes(z.extname(R));let E;if(M.platform!=="win32")if(S)$.unshift(R),$=Vj(M.execArgv).concat($),E=i.spawn(M.argv[0],$,{stdio:"inherit"});else E=i.spawn(R,$,{stdio:"inherit"});else $.unshift(R),$=Vj(M.execArgv).concat($),E=i.spawn(M.execPath,$,{stdio:"inherit"});if(!E.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((Y)=>{M.on(Y,()=>{if(E.killed===!1&&E.exitCode===null)E.kill(Y)})});let P=this._exitCallback;E.on("close",(J)=>{if(J=J??1,!P)M.exit(J);else P(new o(J,"commander.executeSubCommandAsync","(close)"))}),E.on("error",(J)=>{if(J.code==="ENOENT"){let Y=I?`searched for local subcommand relative to directory '${I}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Z=`'${R}' does not exist
16
- - if '${j._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
7
+ `),q=" ".repeat($),Y=`\\s${"​"}`,Z=new RegExp(`
8
+ |.{1,${R-1}}([${Y}]|$)|[^${Y}]+?([${Y}]|$)`,"g"),Q=U.match(Z)||[];return G+Q.map((H,yc)=>{if(H===`
9
+ `)return"";return(yc>0?q:"")+H.trimEnd()}).join(`
10
+ `)}}F$.Help=hc});var fc=C((_$)=>{var{InvalidArgumentError:X$}=b();class vc{constructor(c,y){this.flags=c,this.description=y||"",this.required=c.includes("<"),this.optional=c.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(c),this.mandatory=!1;let $=W$(c);if(this.short=$.shortFlag,this.long=$.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(c,y){return this.defaultValue=c,this.defaultValueDescription=y,this}preset(c){return this.presetArg=c,this}conflicts(c){return this.conflictsWith=this.conflictsWith.concat(c),this}implies(c){let y=c;if(typeof c==="string")y={[c]:!0};return this.implied=Object.assign(this.implied||{},y),this}env(c){return this.envVar=c,this}argParser(c){return this.parseArg=c,this}makeOptionMandatory(c=!0){return this.mandatory=!!c,this}hideHelp(c=!0){return this.hidden=!!c,this}_concatValue(c,y){if(y===this.defaultValue||!Array.isArray(y))return[c];return y.concat(c)}choices(c){return this.argChoices=c.slice(),this.parseArg=(y,$)=>{if(!this.argChoices.includes(y))throw new X$(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(y,$);return y},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return H$(this.name().replace(/^no-/,""))}is(c){return this.short===c||this.long===c}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class bc{constructor(c){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,c.forEach((y)=>{if(y.negate)this.negativeOptions.set(y.attributeName(),y);else this.positiveOptions.set(y.attributeName(),y)}),this.negativeOptions.forEach((y,$)=>{if(this.positiveOptions.has($))this.dualOptions.add($)})}valueFromOption(c,y){let $=y.attributeName();if(!this.dualOptions.has($))return!0;let j=this.negativeOptions.get($).presetArg,f=j!==void 0?j:!1;return y.negate===(f===c)}}function H$(c){return c.split("-").reduce((y,$)=>{return y+$[0].toUpperCase()+$.slice(1)})}function W$(c){let y,$,j=c.split(/[ |,]+/);if(j.length>1&&!/^[[<]/.test(j[1]))y=j.shift();if($=j.shift(),!y&&/^-[^-]$/.test($))y=$,$=void 0;return{shortFlag:y,longFlag:$}}_$.Option=vc;_$.DualOptions=bc});var Oc=C((B$)=>{function T$(c,y){if(Math.abs(c.length-y.length)>3)return Math.max(c.length,y.length);let $=[];for(let j=0;j<=c.length;j++)$[j]=[j];for(let j=0;j<=y.length;j++)$[0][j]=j;for(let j=1;j<=y.length;j++)for(let f=1;f<=c.length;f++){let P=1;if(c[f-1]===y[j-1])P=0;else P=1;if($[f][j]=Math.min($[f-1][j]+1,$[f][j-1]+1,$[f-1][j-1]+P),f>1&&j>1&&c[f-1]===y[j-2]&&c[f-2]===y[j-1])$[f][j]=Math.min($[f][j],$[f-2][j-2]+1)}return $[c.length][y.length]}function C$(c,y){if(!y||y.length===0)return"";y=Array.from(new Set(y));let $=c.startsWith("--");if($)c=c.slice(2),y=y.map((R)=>R.slice(2));let j=[],f=3,P=0.4;if(y.forEach((R)=>{if(R.length<=1)return;let G=T$(c,R),U=Math.max(c.length,R.length);if((U-G)/U>P){if(G<f)f=G,j=[R];else if(G===f)j.push(R)}}),j.sort((R,G)=>R.localeCompare(G)),$)j=j.map((R)=>`--${R}`);if(j.length>1)return`
11
+ (Did you mean one of ${j.join(", ")}?)`;if(j.length===1)return`
12
+ (Did you mean ${j[0]}?)`;return""}B$.suggestSimilar=C$});var rc=C((t$)=>{var N$=v("node:events").EventEmitter,Pc=v("node:child_process"),X=v("node:path"),Rc=v("node:fs"),J=v("node:process"),{Argument:V$,humanReadableArgName:A$}=r(),{CommanderError:Gc}=b(),{Help:D$}=jc(),{Option:sc,DualOptions:k$}=fc(),{suggestSimilar:gc}=Oc();class Uc extends N${constructor(c){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=c||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:(y)=>J.stdout.write(y),writeErr:(y)=>J.stderr.write(y),getOutHelpWidth:()=>J.stdout.isTTY?J.stdout.columns:void 0,getErrHelpWidth:()=>J.stderr.isTTY?J.stderr.columns:void 0,outputError:(y,$)=>$(y)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(c){return this._outputConfiguration=c._outputConfiguration,this._helpOption=c._helpOption,this._helpCommand=c._helpCommand,this._helpConfiguration=c._helpConfiguration,this._exitCallback=c._exitCallback,this._storeOptionsAsProperties=c._storeOptionsAsProperties,this._combineFlagAndOptionalValue=c._combineFlagAndOptionalValue,this._allowExcessArguments=c._allowExcessArguments,this._enablePositionalOptions=c._enablePositionalOptions,this._showHelpAfterError=c._showHelpAfterError,this._showSuggestionAfterError=c._showSuggestionAfterError,this}_getCommandAndAncestors(){let c=[];for(let y=this;y;y=y.parent)c.push(y);return c}command(c,y,$){let j=y,f=$;if(typeof j==="object"&&j!==null)f=j,j=null;f=f||{};let[,P,R]=c.match(/([^ ]+) *(.*)/),G=this.createCommand(P);if(j)G.description(j),G._executableHandler=!0;if(f.isDefault)this._defaultCommandName=G._name;if(G._hidden=!!(f.noHelp||f.hidden),G._executableFile=f.executableFile||null,R)G.arguments(R);if(this._registerCommand(G),G.parent=this,G.copyInheritedSettings(this),j)return this;return G}createCommand(c){return new Uc(c)}createHelp(){return Object.assign(new D$,this.configureHelp())}configureHelp(c){if(c===void 0)return this._helpConfiguration;return this._helpConfiguration=c,this}configureOutput(c){if(c===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,c),this}showHelpAfterError(c=!0){if(typeof c!=="string")c=!!c;return this._showHelpAfterError=c,this}showSuggestionAfterError(c=!0){return this._showSuggestionAfterError=!!c,this}addCommand(c,y){if(!c._name)throw Error(`Command passed to .addCommand() must have a name
13
+ - specify the name in Command constructor or using .name()`);if(y=y||{},y.isDefault)this._defaultCommandName=c._name;if(y.noHelp||y.hidden)c._hidden=!0;return this._registerCommand(c),c.parent=this,c._checkForBrokenPassThrough(),this}createArgument(c,y){return new V$(c,y)}argument(c,y,$,j){let f=this.createArgument(c,y);if(typeof $==="function")f.default(j).argParser($);else f.default($);return this.addArgument(f),this}arguments(c){return c.trim().split(/ +/).forEach((y)=>{this.argument(y)}),this}addArgument(c){let y=this.registeredArguments.slice(-1)[0];if(y&&y.variadic)throw Error(`only the last argument can be variadic '${y.name()}'`);if(c.required&&c.defaultValue!==void 0&&c.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${c.name()}'`);return this.registeredArguments.push(c),this}helpCommand(c,y){if(typeof c==="boolean")return this._addImplicitHelpCommand=c,this;c=c??"help [command]";let[,$,j]=c.match(/([^ ]+) *(.*)/),f=y??"display help for command",P=this.createCommand($);if(P.helpOption(!1),j)P.arguments(j);if(f)P.description(f);return this._addImplicitHelpCommand=!0,this._helpCommand=P,this}addHelpCommand(c,y){if(typeof c!=="object")return this.helpCommand(c,y),this;return this._addImplicitHelpCommand=!0,this._helpCommand=c,this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(c,y){let $=["preSubcommand","preAction","postAction"];if(!$.includes(c))throw Error(`Unexpected value for event passed to hook : '${c}'.
14
+ Expecting one of '${$.join("', '")}'`);if(this._lifeCycleHooks[c])this._lifeCycleHooks[c].push(y);else this._lifeCycleHooks[c]=[y];return this}exitOverride(c){if(c)this._exitCallback=c;else this._exitCallback=(y)=>{if(y.code!=="commander.executeSubCommandAsync")throw y};return this}_exit(c,y,$){if(this._exitCallback)this._exitCallback(new Gc(c,y,$));J.exit(c)}action(c){let y=($)=>{let j=this.registeredArguments.length,f=$.slice(0,j);if(this._storeOptionsAsProperties)f[j]=this;else f[j]=this.opts();return f.push(this),c.apply(this,f)};return this._actionHandler=y,this}createOption(c,y){return new sc(c,y)}_callParseArg(c,y,$,j){try{return c.parseArg(y,$)}catch(f){if(f.code==="commander.invalidArgument"){let P=`${j} ${f.message}`;this.error(P,{exitCode:f.exitCode,code:f.code})}throw f}}_registerOption(c){let y=c.short&&this._findOption(c.short)||c.long&&this._findOption(c.long);if(y){let $=c.long&&this._findOption(c.long)?c.long:c.short;throw Error(`Cannot add option '${c.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${$}'
15
+ - already used by option '${y.flags}'`)}this.options.push(c)}_registerCommand(c){let y=(j)=>{return[j.name()].concat(j.aliases())},$=y(c).find((j)=>this._findCommand(j));if($){let j=y(this._findCommand($)).join("|"),f=y(c).join("|");throw Error(`cannot add command '${f}' as already have command '${j}'`)}this.commands.push(c)}addOption(c){this._registerOption(c);let y=c.name(),$=c.attributeName();if(c.negate){let f=c.long.replace(/^--no-/,"--");if(!this._findOption(f))this.setOptionValueWithSource($,c.defaultValue===void 0?!0:c.defaultValue,"default")}else if(c.defaultValue!==void 0)this.setOptionValueWithSource($,c.defaultValue,"default");let j=(f,P,R)=>{if(f==null&&c.presetArg!==void 0)f=c.presetArg;let G=this.getOptionValue($);if(f!==null&&c.parseArg)f=this._callParseArg(c,f,G,P);else if(f!==null&&c.variadic)f=c._concatValue(f,G);if(f==null)if(c.negate)f=!1;else if(c.isBoolean()||c.optional)f=!0;else f="";this.setOptionValueWithSource($,f,R)};if(this.on("option:"+y,(f)=>{let P=`error: option '${c.flags}' argument '${f}' is invalid.`;j(f,P,"cli")}),c.envVar)this.on("optionEnv:"+y,(f)=>{let P=`error: option '${c.flags}' value '${f}' from env '${c.envVar}' is invalid.`;j(f,P,"env")});return this}_optionEx(c,y,$,j,f){if(typeof y==="object"&&y instanceof sc)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let P=this.createOption(y,$);if(P.makeOptionMandatory(!!c.mandatory),typeof j==="function")P.default(f).argParser(j);else if(j instanceof RegExp){let R=j;j=(G,U)=>{let q=R.exec(G);return q?q[0]:U},P.default(f).argParser(j)}else P.default(j);return this.addOption(P)}option(c,y,$,j){return this._optionEx({},c,y,$,j)}requiredOption(c,y,$,j){return this._optionEx({mandatory:!0},c,y,$,j)}combineFlagAndOptionalValue(c=!0){return this._combineFlagAndOptionalValue=!!c,this}allowUnknownOption(c=!0){return this._allowUnknownOption=!!c,this}allowExcessArguments(c=!0){return this._allowExcessArguments=!!c,this}enablePositionalOptions(c=!0){return this._enablePositionalOptions=!!c,this}passThroughOptions(c=!0){return this._passThroughOptions=!!c,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(c=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!c,this}getOptionValue(c){if(this._storeOptionsAsProperties)return this[c];return this._optionValues[c]}setOptionValue(c,y){return this.setOptionValueWithSource(c,y,void 0)}setOptionValueWithSource(c,y,$){if(this._storeOptionsAsProperties)this[c]=y;else this._optionValues[c]=y;return this._optionValueSources[c]=$,this}getOptionValueSource(c){return this._optionValueSources[c]}getOptionValueSourceWithGlobals(c){let y;return this._getCommandAndAncestors().forEach(($)=>{if($.getOptionValueSource(c)!==void 0)y=$.getOptionValueSource(c)}),y}_prepareUserArgs(c,y){if(c!==void 0&&!Array.isArray(c))throw Error("first parameter to parse must be array or undefined");if(y=y||{},c===void 0&&y.from===void 0){if(J.versions?.electron)y.from="electron";let j=J.execArgv??[];if(j.includes("-e")||j.includes("--eval")||j.includes("-p")||j.includes("--print"))y.from="eval"}if(c===void 0)c=J.argv;this.rawArgs=c.slice();let $;switch(y.from){case void 0:case"node":this._scriptPath=c[1],$=c.slice(2);break;case"electron":if(J.defaultApp)this._scriptPath=c[1],$=c.slice(2);else $=c.slice(1);break;case"user":$=c.slice(0);break;case"eval":$=c.slice(1);break;default:throw Error(`unexpected parse option { from: '${y.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",$}parse(c,y){let $=this._prepareUserArgs(c,y);return this._parseCommand([],$),this}async parseAsync(c,y){let $=this._prepareUserArgs(c,y);return await this._parseCommand([],$),this}_executeSubCommand(c,y){y=y.slice();let $=!1,j=[".js",".ts",".tsx",".mjs",".cjs"];function f(q,w){let Y=X.resolve(q,w);if(Rc.existsSync(Y))return Y;if(j.includes(X.extname(w)))return;let Z=j.find((Q)=>Rc.existsSync(`${Y}${Q}`));if(Z)return`${Y}${Z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let P=c._executableFile||`${this._name}-${c._name}`,R=this._executableDir||"";if(this._scriptPath){let q;try{q=Rc.realpathSync(this._scriptPath)}catch(w){q=this._scriptPath}R=X.resolve(X.dirname(q),R)}if(R){let q=f(R,P);if(!q&&!c._executableFile&&this._scriptPath){let w=X.basename(this._scriptPath,X.extname(this._scriptPath));if(w!==this._name)q=f(R,`${w}-${c._name}`)}P=q||P}$=j.includes(X.extname(P));let G;if(J.platform!=="win32")if($)y.unshift(P),y=mc(J.execArgv).concat(y),G=Pc.spawn(J.argv[0],y,{stdio:"inherit"});else G=Pc.spawn(P,y,{stdio:"inherit"});else y.unshift(P),y=mc(J.execArgv).concat(y),G=Pc.spawn(J.execPath,y,{stdio:"inherit"});if(!G.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((w)=>{J.on(w,()=>{if(G.killed===!1&&G.exitCode===null)G.kill(w)})});let U=this._exitCallback;G.on("close",(q)=>{if(q=q??1,!U)J.exit(q);else U(new Gc(q,"commander.executeSubCommandAsync","(close)"))}),G.on("error",(q)=>{if(q.code==="ENOENT"){let w=R?`searched for local subcommand relative to directory '${R}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Y=`'${P}' does not exist
16
+ - if '${c._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
17
17
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
18
- - ${Y}`;throw Error(Z)}else if(J.code==="EACCES")throw Error(`'${R}' not executable`);if(!P)M.exit(1);else{let Y=new o(1,"commander.executeSubCommandAsync","(error)");Y.nestedError=J,P(Y)}}),this.runningCommand=E}_dispatchSubcommand(j,$,S){let y=this._findCommand(j);if(!y)this.help({error:!0});let q;return q=this._chainOrCallSubCommandHook(q,y,"preSubcommand"),q=this._chainOrCall(q,()=>{if(y._executableHandler)this._executeSubCommand(y,$.concat(S));else return y._parseCommand($,S)}),q}_dispatchHelpCommand(j){if(!j)this.help();let $=this._findCommand(j);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(j,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((j,$)=>{if(j.required&&this.args[$]==null)this.missingArgument(j.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let j=(S,y,q)=>{let R=y;if(y!==null&&S.parseArg){let I=`error: command-argument value '${y}' is invalid for argument '${S.name()}'.`;R=this._callParseArg(S,y,q,I)}return R};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((S,y)=>{let q=S.defaultValue;if(S.variadic){if(y<this.args.length){if(q=this.args.slice(y),S.parseArg)q=q.reduce((R,I)=>{return j(S,I,R)},S.defaultValue)}else if(q===void 0)q=[]}else if(y<this.args.length){if(q=this.args[y],S.parseArg)q=j(S,q,S.defaultValue)}$[y]=q}),this.processedArgs=$}_chainOrCall(j,$){if(j&&j.then&&typeof j.then==="function")return j.then(()=>$());return $()}_chainOrCallHooks(j,$){let S=j,y=[];if(this._getCommandAndAncestors().reverse().filter((q)=>q._lifeCycleHooks[$]!==void 0).forEach((q)=>{q._lifeCycleHooks[$].forEach((R)=>{y.push({hookedCommand:q,callback:R})})}),$==="postAction")y.reverse();return y.forEach((q)=>{S=this._chainOrCall(S,()=>{return q.callback(q.hookedCommand,this)})}),S}_chainOrCallSubCommandHook(j,$,S){let y=j;if(this._lifeCycleHooks[S]!==void 0)this._lifeCycleHooks[S].forEach((q)=>{y=this._chainOrCall(y,()=>{return q(this,$)})});return y}_parseCommand(j,$){let S=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),j=j.concat(S.operands),$=S.unknown,this.args=j.concat($),j&&this._findCommand(j[0]))return this._dispatchSubcommand(j[0],j.slice(1),$);if(this._getHelpCommand()&&j[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(j[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,j,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(S.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let y=()=>{if(S.unknown.length>0)this.unknownOption(S.unknown[0])},q=`command:${this.name()}`;if(this._actionHandler){y(),this._processArguments();let R;if(R=this._chainOrCallHooks(R,"preAction"),R=this._chainOrCall(R,()=>this._actionHandler(this.processedArgs)),this.parent)R=this._chainOrCall(R,()=>{this.parent.emit(q,j,$)});return R=this._chainOrCallHooks(R,"postAction"),R}if(this.parent&&this.parent.listenerCount(q))y(),this._processArguments(),this.parent.emit(q,j,$);else if(j.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",j,$);if(this.listenerCount("command:*"))this.emit("command:*",j,$);else if(this.commands.length)this.unknownCommand();else y(),this._processArguments()}else if(this.commands.length)y(),this.help({error:!0});else y(),this._processArguments()}_findCommand(j){if(!j)return;return this.commands.find(($)=>$._name===j||$._aliases.includes(j))}_findOption(j){return this.options.find(($)=>$.is(j))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((j)=>{j.options.forEach(($)=>{if($.mandatory&&j.getOptionValue($.attributeName())===void 0)j.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let j=this.options.filter((S)=>{let y=S.attributeName();if(this.getOptionValue(y)===void 0)return!1;return this.getOptionValueSource(y)!=="default"});j.filter((S)=>S.conflictsWith.length>0).forEach((S)=>{let y=j.find((q)=>S.conflictsWith.includes(q.attributeName()));if(y)this._conflictingOption(S,y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((j)=>{j._checkForConflictingLocalOptions()})}parseOptions(j){let $=[],S=[],y=$,q=j.slice();function R(E){return E.length>1&&E[0]==="-"}let I=null;while(q.length){let E=q.shift();if(E==="--"){if(y===S)y.push(E);y.push(...q);break}if(I&&!R(E)){this.emit(`option:${I.name()}`,E);continue}if(I=null,R(E)){let P=this._findOption(E);if(P){if(P.required){let J=q.shift();if(J===void 0)this.optionMissingArgument(P);this.emit(`option:${P.name()}`,J)}else if(P.optional){let J=null;if(q.length>0&&!R(q[0]))J=q.shift();this.emit(`option:${P.name()}`,J)}else this.emit(`option:${P.name()}`);I=P.variadic?P:null;continue}}if(E.length>2&&E[0]==="-"&&E[1]!=="-"){let P=this._findOption(`-${E[1]}`);if(P){if(P.required||P.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${P.name()}`,E.slice(2));else this.emit(`option:${P.name()}`),q.unshift(`-${E.slice(2)}`);continue}}if(/^--[^=]+=/.test(E)){let P=E.indexOf("="),J=this._findOption(E.slice(0,P));if(J&&(J.required||J.optional)){this.emit(`option:${J.name()}`,E.slice(P+1));continue}}if(R(E))y=S;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&S.length===0){if(this._findCommand(E)){if($.push(E),q.length>0)S.push(...q);break}else if(this._getHelpCommand()&&E===this._getHelpCommand().name()){if($.push(E),q.length>0)$.push(...q);break}else if(this._defaultCommandName){if(S.push(E),q.length>0)S.push(...q);break}}if(this._passThroughOptions){if(y.push(E),q.length>0)y.push(...q);break}y.push(E)}return{operands:$,unknown:S}}opts(){if(this._storeOptionsAsProperties){let j={},$=this.options.length;for(let S=0;S<$;S++){let y=this.options[S].attributeName();j[y]=y===this._versionOptionName?this._version:this[y]}return j}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((j,$)=>Object.assign(j,$.opts()),{})}error(j,$){if(this._outputConfiguration.outputError(`${j}
18
+ - ${w}`;throw Error(Y)}else if(q.code==="EACCES")throw Error(`'${P}' not executable`);if(!U)J.exit(1);else{let w=new Gc(1,"commander.executeSubCommandAsync","(error)");w.nestedError=q,U(w)}}),this.runningCommand=G}_dispatchSubcommand(c,y,$){let j=this._findCommand(c);if(!j)this.help({error:!0});let f;return f=this._chainOrCallSubCommandHook(f,j,"preSubcommand"),f=this._chainOrCall(f,()=>{if(j._executableHandler)this._executeSubCommand(j,y.concat($));else return j._parseCommand(y,$)}),f}_dispatchHelpCommand(c){if(!c)this.help();let y=this._findCommand(c);if(y&&!y._executableHandler)y.help();return this._dispatchSubcommand(c,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((c,y)=>{if(c.required&&this.args[y]==null)this.missingArgument(c.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let c=($,j,f)=>{let P=j;if(j!==null&&$.parseArg){let R=`error: command-argument value '${j}' is invalid for argument '${$.name()}'.`;P=this._callParseArg($,j,f,R)}return P};this._checkNumberOfArguments();let y=[];this.registeredArguments.forEach(($,j)=>{let f=$.defaultValue;if($.variadic){if(j<this.args.length){if(f=this.args.slice(j),$.parseArg)f=f.reduce((P,R)=>{return c($,R,P)},$.defaultValue)}else if(f===void 0)f=[]}else if(j<this.args.length){if(f=this.args[j],$.parseArg)f=c($,f,$.defaultValue)}y[j]=f}),this.processedArgs=y}_chainOrCall(c,y){if(c&&c.then&&typeof c.then==="function")return c.then(()=>y());return y()}_chainOrCallHooks(c,y){let $=c,j=[];if(this._getCommandAndAncestors().reverse().filter((f)=>f._lifeCycleHooks[y]!==void 0).forEach((f)=>{f._lifeCycleHooks[y].forEach((P)=>{j.push({hookedCommand:f,callback:P})})}),y==="postAction")j.reverse();return j.forEach((f)=>{$=this._chainOrCall($,()=>{return f.callback(f.hookedCommand,this)})}),$}_chainOrCallSubCommandHook(c,y,$){let j=c;if(this._lifeCycleHooks[$]!==void 0)this._lifeCycleHooks[$].forEach((f)=>{j=this._chainOrCall(j,()=>{return f(this,y)})});return j}_parseCommand(c,y){let $=this.parseOptions(y);if(this._parseOptionsEnv(),this._parseOptionsImplied(),c=c.concat($.operands),y=$.unknown,this.args=c.concat(y),c&&this._findCommand(c[0]))return this._dispatchSubcommand(c[0],c.slice(1),y);if(this._getHelpCommand()&&c[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(c[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(y),this._dispatchSubcommand(this._defaultCommandName,c,y);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested($.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let j=()=>{if($.unknown.length>0)this.unknownOption($.unknown[0])},f=`command:${this.name()}`;if(this._actionHandler){j(),this._processArguments();let P;if(P=this._chainOrCallHooks(P,"preAction"),P=this._chainOrCall(P,()=>this._actionHandler(this.processedArgs)),this.parent)P=this._chainOrCall(P,()=>{this.parent.emit(f,c,y)});return P=this._chainOrCallHooks(P,"postAction"),P}if(this.parent&&this.parent.listenerCount(f))j(),this._processArguments(),this.parent.emit(f,c,y);else if(c.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",c,y);if(this.listenerCount("command:*"))this.emit("command:*",c,y);else if(this.commands.length)this.unknownCommand();else j(),this._processArguments()}else if(this.commands.length)j(),this.help({error:!0});else j(),this._processArguments()}_findCommand(c){if(!c)return;return this.commands.find((y)=>y._name===c||y._aliases.includes(c))}_findOption(c){return this.options.find((y)=>y.is(c))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((c)=>{c.options.forEach((y)=>{if(y.mandatory&&c.getOptionValue(y.attributeName())===void 0)c.missingMandatoryOptionValue(y)})})}_checkForConflictingLocalOptions(){let c=this.options.filter(($)=>{let j=$.attributeName();if(this.getOptionValue(j)===void 0)return!1;return this.getOptionValueSource(j)!=="default"});c.filter(($)=>$.conflictsWith.length>0).forEach(($)=>{let j=c.find((f)=>$.conflictsWith.includes(f.attributeName()));if(j)this._conflictingOption($,j)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((c)=>{c._checkForConflictingLocalOptions()})}parseOptions(c){let y=[],$=[],j=y,f=c.slice();function P(G){return G.length>1&&G[0]==="-"}let R=null;while(f.length){let G=f.shift();if(G==="--"){if(j===$)j.push(G);j.push(...f);break}if(R&&!P(G)){this.emit(`option:${R.name()}`,G);continue}if(R=null,P(G)){let U=this._findOption(G);if(U){if(U.required){let q=f.shift();if(q===void 0)this.optionMissingArgument(U);this.emit(`option:${U.name()}`,q)}else if(U.optional){let q=null;if(f.length>0&&!P(f[0]))q=f.shift();this.emit(`option:${U.name()}`,q)}else this.emit(`option:${U.name()}`);R=U.variadic?U:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let U=this._findOption(`-${G[1]}`);if(U){if(U.required||U.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${U.name()}`,G.slice(2));else this.emit(`option:${U.name()}`),f.unshift(`-${G.slice(2)}`);continue}}if(/^--[^=]+=/.test(G)){let U=G.indexOf("="),q=this._findOption(G.slice(0,U));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,G.slice(U+1));continue}}if(P(G))j=$;if((this._enablePositionalOptions||this._passThroughOptions)&&y.length===0&&$.length===0){if(this._findCommand(G)){if(y.push(G),f.length>0)$.push(...f);break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){if(y.push(G),f.length>0)y.push(...f);break}else if(this._defaultCommandName){if($.push(G),f.length>0)$.push(...f);break}}if(this._passThroughOptions){if(j.push(G),f.length>0)j.push(...f);break}j.push(G)}return{operands:y,unknown:$}}opts(){if(this._storeOptionsAsProperties){let c={},y=this.options.length;for(let $=0;$<y;$++){let j=this.options[$].attributeName();c[j]=j===this._versionOptionName?this._version:this[j]}return c}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((c,y)=>Object.assign(c,y.opts()),{})}error(c,y){if(this._outputConfiguration.outputError(`${c}
19
19
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
20
20
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
21
- `),this.outputHelp({error:!0});let S=$||{},y=S.exitCode||1,q=S.code||"commander.error";this._exit(y,q,j)}_parseOptionsEnv(){this.options.forEach((j)=>{if(j.envVar&&j.envVar in M.env){let $=j.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(j.required||j.optional)this.emit(`optionEnv:${j.name()}`,M.env[j.envVar]);else this.emit(`optionEnv:${j.name()}`)}})}_parseOptionsImplied(){let j=new g$(this.options),$=(S)=>{return this.getOptionValue(S)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(S))};this.options.filter((S)=>S.implied!==void 0&&$(S.attributeName())&&j.valueFromOption(this.getOptionValue(S.attributeName()),S)).forEach((S)=>{Object.keys(S.implied).filter((y)=>!$(y)).forEach((y)=>{this.setOptionValueWithSource(y,S.implied[y],"implied")})})}missingArgument(j){let $=`error: missing required argument '${j}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(j){let $=`error: option '${j.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(j){let $=`error: required option '${j.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(j,$){let S=(R)=>{let I=R.attributeName(),E=this.getOptionValue(I),P=this.options.find((Y)=>Y.negate&&I===Y.attributeName()),J=this.options.find((Y)=>!Y.negate&&I===Y.attributeName());if(P&&(P.presetArg===void 0&&E===!1||P.presetArg!==void 0&&E===P.presetArg))return P;return J||R},y=(R)=>{let I=S(R),E=I.attributeName();if(this.getOptionValueSource(E)==="env")return`environment variable '${I.envVar}'`;return`option '${I.flags}'`},q=`error: ${y(j)} cannot be used with ${y($)}`;this.error(q,{code:"commander.conflictingOption"})}unknownOption(j){if(this._allowUnknownOption)return;let $="";if(j.startsWith("--")&&this._showSuggestionAfterError){let y=[],q=this;do{let R=q.createHelp().visibleOptions(q).filter((I)=>I.long).map((I)=>I.long);y=y.concat(R),q=q.parent}while(q&&!q._enablePositionalOptions);$=Nj(j,y)}let S=`error: unknown option '${j}'${$}`;this.error(S,{code:"commander.unknownOption"})}_excessArguments(j){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,S=$===1?"":"s",q=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${S} but got ${j.length}.`;this.error(q,{code:"commander.excessArguments"})}unknownCommand(){let j=this.args[0],$="";if(this._showSuggestionAfterError){let y=[];this.createHelp().visibleCommands(this).forEach((q)=>{if(y.push(q.name()),q.alias())y.push(q.alias())}),$=Nj(j,y)}let S=`error: unknown command '${j}'${$}`;this.error(S,{code:"commander.unknownCommand"})}version(j,$,S){if(j===void 0)return this._version;this._version=j,$=$||"-V, --version",S=S||"output the version number";let y=this.createOption($,S);return this._versionOptionName=y.attributeName(),this._registerOption(y),this.on("option:"+y.name(),()=>{this._outputConfiguration.writeOut(`${j}
22
- `),this._exit(0,"commander.version",j)}),this}description(j,$){if(j===void 0&&$===void 0)return this._description;if(this._description=j,$)this._argsDescription=$;return this}summary(j){if(j===void 0)return this._summary;return this._summary=j,this}alias(j){if(j===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(j===$._name)throw Error("Command alias can't be the same as its name");let S=this.parent?._findCommand(j);if(S){let y=[S.name()].concat(S.aliases()).join("|");throw Error(`cannot add alias '${j}' to command '${this.name()}' as already have command '${y}'`)}return $._aliases.push(j),this}aliases(j){if(j===void 0)return this._aliases;return j.forEach(($)=>this.alias($)),this}usage(j){if(j===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((S)=>{return v$(S)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=j,this}name(j){if(j===void 0)return this._name;return this._name=j,this}nameFromFilename(j){return this._name=z.basename(j,z.extname(j)),this}executableDir(j){if(j===void 0)return this._executableDir;return this._executableDir=j,this}helpInformation(j){let $=this.createHelp();if($.helpWidth===void 0)$.helpWidth=j&&j.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return $.formatHelp(this,$)}_getHelpContext(j){j=j||{};let $={error:!!j.error},S;if($.error)S=(y)=>this._outputConfiguration.writeErr(y);else S=(y)=>this._outputConfiguration.writeOut(y);return $.write=j.write||S,$.command=this,$}outputHelp(j){let $;if(typeof j==="function")$=j,j=void 0;let S=this._getHelpContext(j);this._getCommandAndAncestors().reverse().forEach((q)=>q.emit("beforeAllHelp",S)),this.emit("beforeHelp",S);let y=this.helpInformation(S);if($){if(y=$(y),typeof y!=="string"&&!Buffer.isBuffer(y))throw Error("outputHelp callback must return a string or a Buffer")}if(S.write(y),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",S),this._getCommandAndAncestors().forEach((q)=>q.emit("afterAllHelp",S))}helpOption(j,$){if(typeof j==="boolean"){if(j)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return j=j??"-h, --help",$=$??"display help for command",this._helpOption=this.createOption(j,$),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(j){return this._helpOption=j,this}help(j){this.outputHelp(j);let $=M.exitCode||0;if($===0&&j&&typeof j!=="function"&&j.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(j,$){let S=["beforeAll","before","after","afterAll"];if(!S.includes(j))throw Error(`Unexpected value for position to addHelpText.
23
- Expecting one of '${S.join("', '")}'`);let y=`${j}Help`;return this.on(y,(q)=>{let R;if(typeof $==="function")R=$({error:q.error,command:q.command});else R=$;if(R)q.write(`${R}
24
- `)}),this}_outputHelpIfRequested(j){let $=this._getHelpOption();if($&&j.find((y)=>$.is(y)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Vj(j){return j.map(($)=>{if(!$.startsWith("--inspect"))return $;let S,y="127.0.0.1",q="9229",R;if((R=$.match(/^(--inspect(-brk)?)$/))!==null)S=R[1];else if((R=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(S=R[1],/^\d+$/.test(R[3]))q=R[3];else y=R[3];else if((R=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)S=R[1],y=R[3],q=R[4];if(S&&q!=="0")return`${S}=${y}:${parseInt(q)+1}`;return $})}m$.Command=n});var Cj=F((d$)=>{var{Argument:fj}=O(),{Command:a}=Aj(),{CommanderError:r$,InvalidArgumentError:wj}=k(),{Help:l$}=l(),{Option:xj}=d();d$.program=new a;d$.createCommand=(j)=>new a(j);d$.createOption=(j,$)=>new xj(j,$);d$.createArgument=(j,$)=>new fj(j,$);d$.Command=a;d$.Option=xj;d$.Argument=fj;d$.Help=l$;d$.CommanderError=r$;d$.InvalidArgumentError=wj;d$.InvalidOptionArgumentError=wj});var kj=G$(Cj(),1),{program:W,createCommand:SS,createArgument:yS,createOption:qS,CommanderError:RS,InvalidArgumentError:ES,InvalidOptionArgumentError:IS,Command:PS,Argument:JS,Option:YS,Help:TS}=kj.default;var bj="0.1.1";import{homedir as E1}from"os";import{join as uj}from"path";import{existsSync as e,mkdirSync as I1,readFileSync as P1,writeFileSync as J1,unlinkSync as Y1}from"fs";function Oj(){let j=process.env.ACE_TEST_HOME??E1();return uj(j,".ace")}function jj(){return uj(Oj(),"credentials.json")}var T1=process.env.DEBUG==="true"||process.env.ACE_DEBUG==="true";function A(j,...$){if(T1)console.error(`[ace-cli debug] ${j}`,...$)}function Q1(){let j=Oj();if(!e(j))I1(j,{recursive:!0,mode:448})}function B(){try{let j=jj();if(!e(j))return A("Credentials file does not exist:",j),null;let $=P1(j,"utf-8"),S=JSON.parse($);if(S.expiresAt&&new Date(S.expiresAt)<new Date)return A("Token expired at:",S.expiresAt),null;return S}catch(j){return A("Error reading credentials:",j),null}}function $j(j){Q1();let $=jj();J1($,JSON.stringify(j,null,2),{mode:384}),A("Credentials saved to:",$)}function Sj(){try{let j=jj();if(e(j))return Y1(j),A("Credentials cleared"),!0;return!1}catch(j){return A("Error clearing credentials:",j),!1}}function b(){return B()?.apiUrl??process.env.ACE_API_URL??"https://aceisyourassistant.com"}import Uj from"node:process";import{Buffer as pj}from"node:buffer";import oj from"node:path";import{fileURLToPath as O1}from"node:url";import{promisify as c1}from"node:util";import nj from"node:child_process";import h1,{constants as v1}from"node:fs/promises";import tj from"node:process";import gj,{constants as z1}from"node:fs/promises";import vj from"node:process";import X1 from"node:os";import _1 from"node:fs";import G1 from"node:fs";import cj from"node:fs";var yj;function U1(){try{return cj.statSync("/.dockerenv"),!0}catch{return!1}}function Z1(){try{return cj.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function qj(){if(yj===void 0)yj=U1()||Z1();return yj}var Rj,M1=()=>{try{return G1.statSync("/run/.containerenv"),!0}catch{return!1}};function f(){if(Rj===void 0)Rj=M1()||qj();return Rj}var hj=()=>{if(vj.platform!=="linux")return!1;if(X1.release().toLowerCase().includes("microsoft")){if(f())return!1;return!0}try{return _1.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!f():!1}catch{return!1}},L=vj.env.__IS_WSL_TEST__?hj:hj();var W1=(()=>{let $;return async function(){if($)return $;let S="/etc/wsl.conf",y=!1;try{await gj.access(S,z1.F_OK),y=!0}catch{}if(!y)return"/mnt/";let q=await gj.readFile(S,{encoding:"utf8"}),R=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(q);if(!R)return"/mnt/";return $=R.groups.mountPoint.trim(),$=$.endsWith("/")?$:`${$}/`,$}})(),H1=async()=>{return`${await W1()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},Ej=async()=>{if(L)return H1();return`${tj.env.SYSTEMROOT||tj.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`};function D(j,$,S){let y=(q)=>Object.defineProperty(j,$,{value:q,enumerable:!0,writable:!0});return Object.defineProperty(j,$,{configurable:!0,enumerable:!0,get(){let q=S();return y(q),q},set(q){y(q)}}),j}import{promisify as C1}from"node:util";import Tj from"node:process";import{execFile as k1}from"node:child_process";import{promisify as L1}from"node:util";import D1 from"node:process";import{execFile as K1}from"node:child_process";var F1=L1(K1);async function Ij(){if(D1.platform!=="darwin")throw Error("macOS only");let{stdout:j}=await F1("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),S=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(j)?.groups.id??"com.apple.Safari";if(S==="com.apple.safari")return"com.apple.Safari";return S}import B1 from"node:process";import{promisify as N1}from"node:util";import{execFile as V1,execFileSync as tS}from"node:child_process";var A1=N1(V1);async function mj(j,{humanReadableOutput:$=!0,signal:S}={}){if(B1.platform!=="darwin")throw Error("macOS only");let y=$?[]:["-ss"],q={};if(S)q.signal=S;let{stdout:R}=await A1("osascript",["-e",j,y],q);return R.trim()}async function Pj(j){return mj(`tell application "Finder" to set app_path to application file id "${j}" as string
25
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as f1}from"node:util";import{execFile as w1}from"node:child_process";var x1=f1(w1),sj={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},dS=new Map(Object.entries(sj));class Jj extends Error{}async function Yj(j=x1){let{stdout:$}=await j("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),S=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec($);if(!S)throw new Jj(`Cannot find Windows browser in stdout: ${JSON.stringify($)}`);let{id:y}=S.groups,q=sj[y];if(!q)throw new Jj(`Unknown browser ID: ${y}`);return q}var b1=C1(k1),u1=(j)=>j.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,($)=>$.toUpperCase());async function Qj(){if(Tj.platform==="darwin"){let j=await Ij();return{name:await Pj(j),id:j}}if(Tj.platform==="linux"){let{stdout:j}=await b1("xdg-mime",["query","default","x-scheme-handler/http"]),$=j.trim();return{name:u1($.replace(/.desktop$/,"").replace("-"," ")),id:$}}if(Tj.platform==="win32")return Yj();throw Error("Only macOS, Linux, and Windows are supported")}var t1=c1(nj.execFile),Zj=oj.dirname(O1(import.meta.url)),rj=oj.join(Zj,"xdg-open"),{platform:w,arch:lj}=Uj;async function g1(){let j=await Ej(),$=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,S=pj.from($,"utf16le").toString("base64"),{stdout:y}=await t1(j,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",S],{encoding:"utf8"}),q=y.trim(),R={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return R[q]?{id:R[q]}:{}}var dj=async(j,$)=>{let S;for(let y of j)try{return await $(y)}catch(q){S=q}throw S},c=async(j)=>{if(j={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...j},Array.isArray(j.app))return dj(j.app,(E)=>c({...j,app:E}));let{name:$,arguments:S=[]}=j.app??{};if(S=[...S],Array.isArray($))return dj($,(E)=>c({...j,app:{name:E,arguments:S}}));if($==="browser"||$==="browserPrivate"){let E={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},P={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},J=L?await g1():await Qj();if(J.id in E){let Y=E[J.id];if($==="browserPrivate")S.push(P[Y]);return c({...j,app:{name:N[Y],arguments:S}})}throw Error(`${J.name} is not supported as a default browser`)}let y,q=[],R={};if(w==="darwin"){if(y="open",j.wait)q.push("--wait-apps");if(j.background)q.push("--background");if(j.newInstance)q.push("--new");if($)q.push("-a",$)}else if(w==="win32"||L&&!f()&&!$){if(y=await Ej(),q.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),!L)R.windowsVerbatimArguments=!0;let E=["Start"];if(j.wait)E.push("-Wait");if($){if(E.push(`"\`"${$}\`""`),j.target)S.push(j.target)}else if(j.target)E.push(`"${j.target}"`);if(S.length>0)S=S.map((P)=>`"\`"${P}\`""`),E.push("-ArgumentList",S.join(","));j.target=pj.from(E.join(" "),"utf16le").toString("base64")}else{if($)y=$;else{let E=!Zj||Zj==="/",P=!1;try{await h1.access(rj,v1.X_OK),P=!0}catch{}y=Uj.versions.electron??(w==="android"||E||!P)?"xdg-open":rj}if(S.length>0)q.push(...S);if(!j.wait)R.stdio="ignore",R.detached=!0}if(w==="darwin"&&S.length>0)q.push("--args",...S);if(j.target)q.push(j.target);let I=nj.spawn(y,q,R);if(j.wait)return new Promise((E,P)=>{I.once("error",P),I.once("close",(J)=>{if(!j.allowNonzeroExitCode&&J>0){P(Error(`Exited with code ${J}`));return}E(I)})});return I.unref(),I},m1=(j,$)=>{if(typeof j!=="string")throw TypeError("Expected a `target`");return c({...$,target:j})};function ij(j){if(typeof j==="string"||Array.isArray(j))return j;let{[lj]:$}=j;if(!$)throw Error(`${lj} is not supported`);return $}function h({[w]:j},{wsl:$}){if($&&L)return ij($);if(!j)throw Error(`${w} is not supported`);return ij(j)}var N={};D(N,"chrome",()=>h({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));D(N,"brave",()=>h({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));D(N,"firefox",()=>h({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));D(N,"edge",()=>h({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));D(N,"browser",()=>"browser");D(N,"browserPrivate",()=>"browserPrivate");var aj=m1;var s1=2000,r1=600;async function Gj(j){let $=j??b();console.log(`Initiating authentication...
26
- `);let S=await fetch(`${$}/api/cli-auth/initiate`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!S.ok){let Z=await S.text();throw Error(`Failed to initiate auth: ${Z}`)}let{deviceCode:y,userCode:q,verificationUrl:R,interval:I,expiresIn:E}=await S.json(),P=(I||s1/1000)*1000,J=Math.ceil((E||r1)/(P/1000));console.log("Opening browser to authenticate..."),console.log(""),console.log(` Your code: ${q}`),console.log(""),console.log(` Or visit: ${R}`),console.log(""),await aj(R),console.log("Waiting for authorization...");let Y=0;while(Y<J){await l1(P),Y++;try{let Z=await fetch(`${$}/api/cli-auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:y})});if(!Z.ok){if(Z.status===400)continue;throw Error(`Poll failed: ${await Z.text()}`)}let X=await Z.json();if(X.status==="authorized"&&X.token){let G={apiUrl:$,token:X.token.token,expiresAt:X.token.expiresAt,userId:X.token.userId,userEmail:X.token.userEmail};$j(G),console.log(""),console.log(`Authenticated as ${X.token.userEmail}`),console.log(""),console.log("You can now use ace commands. Try:"),console.log(" ace orient"),console.log(' ace capture "My new task"');return}if(X.status==="expired")throw Error("Authentication code expired. Please try again.")}catch(Z){if(Z instanceof TypeError)continue;throw Z}}throw Error("Authentication timed out. Please try again.")}function l1(j){return new Promise(($)=>setTimeout($,j))}function T(){return process.argv.includes("--json")}function Q(j,$){if($?.json||T())console.log(JSON.stringify(j,null,2));else if(typeof j==="string")console.log(j);else console.log(JSON.stringify(j,null,2))}function U(j){if(T())console.log(JSON.stringify({error:j}));else console.error(`Error: ${j}`)}function K(j){let $=[`[${j.id.slice(0,8)}] ${j.name}`];if(j.project_name)$.push(`(${j.project_name})`);if(j.dueDate)$.push(`due: ${j.dueDate}`);if(j.status==="waiting"&&j.waitingFor)$.push(`waiting: ${j.waitingFor}`);return $.join(" ")}function V(j){let $=[`[${j.id.slice(0,8)}] ${j.name}`];if(j.category_name)$.push(`(${j.category_name})`);if(j.status!=="active")$.push(`[${j.status}]`);return $.join(" ")}function x(j,$){if(j.length===0)return $?`${$}: (none)`:"(no actions)";let S=j.map((y)=>` ${K(y)}`);if($)return`${$} (${j.length}):
27
- ${S.join(`
28
- `)}`;return S.join(`
29
- `)}function u(j,$){if(j.length===0)return $?`${$}: (none)`:"(no projects)";let S=j.map((y)=>` ${V(y)}`);if($)return`${$} (${j.length}):
30
- ${S.join(`
31
- `)}`;return S.join(`
32
- `)}function ej(j){let $=[];$.push(`Inbox: ${j.inboxCount} items`);let S=j.domains.map((y)=>` ${y.name}: ${y.active_count}/${y.activeProjectLimit} active`);if($.push(`Capacity:
33
- ${S.join(`
34
- `)}`),j.activeProjects.length>0)$.push(u(j.activeProjects,"Active Projects"));if(j.overdue.length>0)$.push(x(j.overdue,"Overdue"));if(j.dueToday.length>0)$.push(x(j.dueToday,"Due Today"));if(j.waiting.length>0)$.push(x(j.waiting,"Waiting"));return $.join(`
21
+ `),this.outputHelp({error:!0});let $=y||{},j=$.exitCode||1,f=$.code||"commander.error";this._exit(j,f,c)}_parseOptionsEnv(){this.options.forEach((c)=>{if(c.envVar&&c.envVar in J.env){let y=c.attributeName();if(this.getOptionValue(y)===void 0||["default","config","env"].includes(this.getOptionValueSource(y)))if(c.required||c.optional)this.emit(`optionEnv:${c.name()}`,J.env[c.envVar]);else this.emit(`optionEnv:${c.name()}`)}})}_parseOptionsImplied(){let c=new k$(this.options),y=($)=>{return this.getOptionValue($)!==void 0&&!["default","implied"].includes(this.getOptionValueSource($))};this.options.filter(($)=>$.implied!==void 0&&y($.attributeName())&&c.valueFromOption(this.getOptionValue($.attributeName()),$)).forEach(($)=>{Object.keys($.implied).filter((j)=>!y(j)).forEach((j)=>{this.setOptionValueWithSource(j,$.implied[j],"implied")})})}missingArgument(c){let y=`error: missing required argument '${c}'`;this.error(y,{code:"commander.missingArgument"})}optionMissingArgument(c){let y=`error: option '${c.flags}' argument missing`;this.error(y,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(c){let y=`error: required option '${c.flags}' not specified`;this.error(y,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(c,y){let $=(P)=>{let R=P.attributeName(),G=this.getOptionValue(R),U=this.options.find((w)=>w.negate&&R===w.attributeName()),q=this.options.find((w)=>!w.negate&&R===w.attributeName());if(U&&(U.presetArg===void 0&&G===!1||U.presetArg!==void 0&&G===U.presetArg))return U;return q||P},j=(P)=>{let R=$(P),G=R.attributeName();if(this.getOptionValueSource(G)==="env")return`environment variable '${R.envVar}'`;return`option '${R.flags}'`},f=`error: ${j(c)} cannot be used with ${j(y)}`;this.error(f,{code:"commander.conflictingOption"})}unknownOption(c){if(this._allowUnknownOption)return;let y="";if(c.startsWith("--")&&this._showSuggestionAfterError){let j=[],f=this;do{let P=f.createHelp().visibleOptions(f).filter((R)=>R.long).map((R)=>R.long);j=j.concat(P),f=f.parent}while(f&&!f._enablePositionalOptions);y=gc(c,j)}let $=`error: unknown option '${c}'${y}`;this.error($,{code:"commander.unknownOption"})}_excessArguments(c){if(this._allowExcessArguments)return;let y=this.registeredArguments.length,$=y===1?"":"s",f=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${y} argument${$} but got ${c.length}.`;this.error(f,{code:"commander.excessArguments"})}unknownCommand(){let c=this.args[0],y="";if(this._showSuggestionAfterError){let j=[];this.createHelp().visibleCommands(this).forEach((f)=>{if(j.push(f.name()),f.alias())j.push(f.alias())}),y=gc(c,j)}let $=`error: unknown command '${c}'${y}`;this.error($,{code:"commander.unknownCommand"})}version(c,y,$){if(c===void 0)return this._version;this._version=c,y=y||"-V, --version",$=$||"output the version number";let j=this.createOption(y,$);return this._versionOptionName=j.attributeName(),this._registerOption(j),this.on("option:"+j.name(),()=>{this._outputConfiguration.writeOut(`${c}
22
+ `),this._exit(0,"commander.version",c)}),this}description(c,y){if(c===void 0&&y===void 0)return this._description;if(this._description=c,y)this._argsDescription=y;return this}summary(c){if(c===void 0)return this._summary;return this._summary=c,this}alias(c){if(c===void 0)return this._aliases[0];let y=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)y=this.commands[this.commands.length-1];if(c===y._name)throw Error("Command alias can't be the same as its name");let $=this.parent?._findCommand(c);if($){let j=[$.name()].concat($.aliases()).join("|");throw Error(`cannot add alias '${c}' to command '${this.name()}' as already have command '${j}'`)}return y._aliases.push(c),this}aliases(c){if(c===void 0)return this._aliases;return c.forEach((y)=>this.alias(y)),this}usage(c){if(c===void 0){if(this._usage)return this._usage;let y=this.registeredArguments.map(($)=>{return A$($)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?y:[]).join(" ")}return this._usage=c,this}name(c){if(c===void 0)return this._name;return this._name=c,this}nameFromFilename(c){return this._name=X.basename(c,X.extname(c)),this}executableDir(c){if(c===void 0)return this._executableDir;return this._executableDir=c,this}helpInformation(c){let y=this.createHelp();if(y.helpWidth===void 0)y.helpWidth=c&&c.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return y.formatHelp(this,y)}_getHelpContext(c){c=c||{};let y={error:!!c.error},$;if(y.error)$=(j)=>this._outputConfiguration.writeErr(j);else $=(j)=>this._outputConfiguration.writeOut(j);return y.write=c.write||$,y.command=this,y}outputHelp(c){let y;if(typeof c==="function")y=c,c=void 0;let $=this._getHelpContext(c);this._getCommandAndAncestors().reverse().forEach((f)=>f.emit("beforeAllHelp",$)),this.emit("beforeHelp",$);let j=this.helpInformation($);if(y){if(j=y(j),typeof j!=="string"&&!Buffer.isBuffer(j))throw Error("outputHelp callback must return a string or a Buffer")}if($.write(j),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",$),this._getCommandAndAncestors().forEach((f)=>f.emit("afterAllHelp",$))}helpOption(c,y){if(typeof c==="boolean"){if(c)this._helpOption=this._helpOption??void 0;else this._helpOption=null;return this}return c=c??"-h, --help",y=y??"display help for command",this._helpOption=this.createOption(c,y),this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(c){return this._helpOption=c,this}help(c){this.outputHelp(c);let y=J.exitCode||0;if(y===0&&c&&typeof c!=="function"&&c.error)y=1;this._exit(y,"commander.help","(outputHelp)")}addHelpText(c,y){let $=["beforeAll","before","after","afterAll"];if(!$.includes(c))throw Error(`Unexpected value for position to addHelpText.
23
+ Expecting one of '${$.join("', '")}'`);let j=`${c}Help`;return this.on(j,(f)=>{let P;if(typeof y==="function")P=y({error:f.error,command:f.command});else P=y;if(P)f.write(`${P}
24
+ `)}),this}_outputHelpIfRequested(c){let y=this._getHelpOption();if(y&&c.find((j)=>y.is(j)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function mc(c){return c.map((y)=>{if(!y.startsWith("--inspect"))return y;let $,j="127.0.0.1",f="9229",P;if((P=y.match(/^(--inspect(-brk)?)$/))!==null)$=P[1];else if((P=y.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if($=P[1],/^\d+$/.test(P[3]))f=P[3];else j=P[3];else if((P=y.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)$=P[1],j=P[3],f=P[4];if($&&f!=="0")return`${$}=${j}:${parseInt(f)+1}`;return y})}t$.Command=Uc});var ac=C((b$)=>{var{Argument:lc}=r(),{Command:Ic}=rc(),{CommanderError:h$,InvalidArgumentError:dc}=b(),{Help:v$}=jc(),{Option:ec}=fc();b$.program=new Ic;b$.createCommand=(c)=>new Ic(c);b$.createOption=(c,y)=>new ec(c,y);b$.createArgument=(c,y)=>new lc(c,y);b$.Command=Ic;b$.Option=ec;b$.Argument=lc;b$.Help=v$;b$.CommanderError=h$;b$.InvalidArgumentError=dc;b$.InvalidOptionArgumentError=dc});var ic=U$(ac(),1),{program:F,createCommand:$f,createArgument:jf,createOption:ff,CommanderError:Pf,InvalidArgumentError:Rf,InvalidOptionArgumentError:Gf,Command:Uf,Argument:If,Option:Lf,Help:Sf}=ic.default;var nc="0.3.0";import{homedir as p$}from"os";import{join as oc}from"path";import{existsSync as Lc,mkdirSync as cj,readFileSync as yj,writeFileSync as $j,unlinkSync as jj}from"fs";function pc(){let c=process.env.ACE_TEST_HOME??p$();return oc(c,".ace")}function Sc(){return oc(pc(),"credentials.json")}var cy="https://aceisyourassistant.com",fj=process.env.DEBUG==="true"||process.env.ACE_DEBUG==="true";function B(c,...y){if(fj)console.error(`[ace-cli debug] ${c}`,...y)}function Pj(){let c=pc();if(!Lc(c))cj(c,{recursive:!0,mode:448})}function x(){let c=process.env.ACE_TOKEN;if(c)return B("Using ACE_TOKEN environment variable"),{apiUrl:process.env.ACE_API_URL??cy,token:c,expiresAt:null,userId:"env-token",userEmail:"ACE_TOKEN"};try{let y=Sc();if(!Lc(y))return B("Credentials file does not exist:",y),null;let $=yj(y,"utf-8"),j=JSON.parse($);if(j.expiresAt&&new Date(j.expiresAt)<new Date)return B("Token expired at:",j.expiresAt),null;return j}catch(y){return B("Error reading credentials:",y),null}}function qc(c){Pj();let y=Sc();$j(y,JSON.stringify(c,null,2),{mode:384}),B("Credentials saved to:",y)}function wc(){try{let c=Sc();if(Lc(c))return jj(c),B("Credentials cleared"),!0;return!1}catch(c){return B("Error clearing credentials:",c),!1}}function O(){return x()?.apiUrl??process.env.ACE_API_URL??cy}function l(){return!!process.env.ACE_TOKEN}import _c from"node:process";import{Buffer as qy}from"node:buffer";import wy from"node:path";import{fileURLToPath as xj}from"node:url";import{promisify as Nj}from"node:util";import Ey from"node:child_process";import Vj,{constants as Aj}from"node:fs/promises";import fy from"node:process";import Py,{constants as qj}from"node:fs/promises";import jy from"node:process";import Lj from"node:os";import Sj from"node:fs";import Uj from"node:fs";import yy from"node:fs";var Ec;function Rj(){try{return yy.statSync("/.dockerenv"),!0}catch{return!1}}function Gj(){try{return yy.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Yc(){if(Ec===void 0)Ec=Rj()||Gj();return Ec}var Qc,Ij=()=>{try{return Uj.statSync("/run/.containerenv"),!0}catch{return!1}};function k(){if(Qc===void 0)Qc=Ij()||Yc();return Qc}var $y=()=>{if(jy.platform!=="linux")return!1;if(Lj.release().toLowerCase().includes("microsoft")){if(k())return!1;return!0}try{return Sj.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!k():!1}catch{return!1}},W=jy.env.__IS_WSL_TEST__?$y:$y();var wj=(()=>{let y;return async function(){if(y)return y;let $="/etc/wsl.conf",j=!1;try{await Py.access($,qj.F_OK),j=!0}catch{}if(!j)return"/mnt/";let f=await Py.readFile($,{encoding:"utf8"}),P=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(f);if(!P)return"/mnt/";return y=P.groups.mountPoint.trim(),y=y.endsWith("/")?y:`${y}/`,y}})(),Ej=async()=>{return`${await wj()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},Jc=async()=>{if(W)return Ej();return`${fy.env.SYSTEMROOT||fy.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`};function _(c,y,$){let j=(f)=>Object.defineProperty(c,y,{value:f,enumerable:!0,writable:!0});return Object.defineProperty(c,y,{configurable:!0,enumerable:!0,get(){let f=$();return j(f),f},set(f){j(f)}}),c}import{promisify as Kj}from"node:util";import Hc from"node:process";import{execFile as Tj}from"node:child_process";import{promisify as Yj}from"node:util";import Qj from"node:process";import{execFile as Jj}from"node:child_process";var Zj=Yj(Jj);async function Zc(){if(Qj.platform!=="darwin")throw Error("macOS only");let{stdout:c}=await Zj("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),$=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(c)?.groups.id??"com.apple.Safari";if($==="com.apple.safari")return"com.apple.Safari";return $}import Fj from"node:process";import{promisify as zj}from"node:util";import{execFile as Xj,execFileSync as Of}from"node:child_process";var Hj=zj(Xj);async function Ry(c,{humanReadableOutput:y=!0,signal:$}={}){if(Fj.platform!=="darwin")throw Error("macOS only");let j=y?[]:["-ss"],f={};if($)f.signal=$;let{stdout:P}=await Hj("osascript",["-e",c,j],f);return P.trim()}async function Fc(c){return Ry(`tell application "Finder" to set app_path to application file id "${c}" as string
25
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as Wj}from"node:util";import{execFile as _j}from"node:child_process";var Mj=Wj(_j),Gy={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},df=new Map(Object.entries(Gy));class zc extends Error{}async function Xc(c=Mj){let{stdout:y}=await c("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),$=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(y);if(!$)throw new zc(`Cannot find Windows browser in stdout: ${JSON.stringify(y)}`);let{id:j}=$.groups,f=Gy[j];if(!f)throw new zc(`Unknown browser ID: ${j}`);return f}var Cj=Kj(Tj),Bj=(c)=>c.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(y)=>y.toUpperCase());async function Wc(){if(Hc.platform==="darwin"){let c=await Zc();return{name:await Fc(c),id:c}}if(Hc.platform==="linux"){let{stdout:c}=await Cj("xdg-mime",["query","default","x-scheme-handler/http"]),y=c.trim();return{name:Bj(y.replace(/.desktop$/,"").replace("-"," ")),id:y}}if(Hc.platform==="win32")return Xc();throw Error("Only macOS, Linux, and Windows are supported")}var Dj=Nj(Ey.execFile),Mc=wy.dirname(xj(import.meta.url)),Uy=wy.join(Mc,"xdg-open"),{platform:t,arch:Iy}=_c;async function kj(){let c=await Jc(),y=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,$=qy.from(y,"utf16le").toString("base64"),{stdout:j}=await Dj(c,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",$],{encoding:"utf8"}),f=j.trim(),P={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return P[f]?{id:P[f]}:{}}var Ly=async(c,y)=>{let $;for(let j of c)try{return await y(j)}catch(f){$=f}throw $},d=async(c)=>{if(c={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...c},Array.isArray(c.app))return Ly(c.app,(G)=>d({...c,app:G}));let{name:y,arguments:$=[]}=c.app??{};if($=[...$],Array.isArray(y))return Ly(y,(G)=>d({...c,app:{name:G,arguments:$}}));if(y==="browser"||y==="browserPrivate"){let G={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},U={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},q=W?await kj():await Wc();if(q.id in G){let w=G[q.id];if(y==="browserPrivate")$.push(U[w]);return d({...c,app:{name:N[w],arguments:$}})}throw Error(`${q.name} is not supported as a default browser`)}let j,f=[],P={};if(t==="darwin"){if(j="open",c.wait)f.push("--wait-apps");if(c.background)f.push("--background");if(c.newInstance)f.push("--new");if(y)f.push("-a",y)}else if(t==="win32"||W&&!k()&&!y){if(j=await Jc(),f.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),!W)P.windowsVerbatimArguments=!0;let G=["Start"];if(c.wait)G.push("-Wait");if(y){if(G.push(`"\`"${y}\`""`),c.target)$.push(c.target)}else if(c.target)G.push(`"${c.target}"`);if($.length>0)$=$.map((U)=>`"\`"${U}\`""`),G.push("-ArgumentList",$.join(","));c.target=qy.from(G.join(" "),"utf16le").toString("base64")}else{if(y)j=y;else{let G=!Mc||Mc==="/",U=!1;try{await Vj.access(Uy,Aj.X_OK),U=!0}catch{}j=_c.versions.electron??(t==="android"||G||!U)?"xdg-open":Uy}if($.length>0)f.push(...$);if(!c.wait)P.stdio="ignore",P.detached=!0}if(t==="darwin"&&$.length>0)f.push("--args",...$);if(c.target)f.push(c.target);let R=Ey.spawn(j,f,P);if(c.wait)return new Promise((G,U)=>{R.once("error",U),R.once("close",(q)=>{if(!c.allowNonzeroExitCode&&q>0){U(Error(`Exited with code ${q}`));return}G(R)})});return R.unref(),R},tj=(c,y)=>{if(typeof c!=="string")throw TypeError("Expected a `target`");return d({...y,target:c})};function Sy(c){if(typeof c==="string"||Array.isArray(c))return c;let{[Iy]:y}=c;if(!y)throw Error(`${Iy} is not supported`);return y}function e({[t]:c},{wsl:y}){if(y&&W)return Sy(y);if(!c)throw Error(`${t} is not supported`);return Sy(c)}var N={};_(N,"chrome",()=>e({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));_(N,"brave",()=>e({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));_(N,"firefox",()=>e({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));_(N,"edge",()=>e({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));_(N,"browser",()=>"browser");_(N,"browserPrivate",()=>"browserPrivate");var Yy=tj;var uj=2000,hj=600;async function Kc(c){let y=c??O();console.log(`Initiating authentication...
26
+ `);let $=await fetch(`${y}/api/cli-auth/initiate`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!$.ok){let Y=await $.text();throw Error(`Failed to initiate auth: ${Y}`)}let{deviceCode:j,userCode:f,verificationUrl:P,interval:R,expiresIn:G}=await $.json(),U=(R||uj/1000)*1000,q=Math.ceil((G||hj)/(U/1000));console.log("Opening browser to authenticate..."),console.log(""),console.log(` Your code: ${f}`),console.log(""),console.log(` Or visit: ${P}`),console.log(""),await Yy(P),console.log("Waiting for authorization...");let w=0;while(w<q){await vj(U),w++;try{let Y=await fetch(`${y}/api/cli-auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:j})});if(!Y.ok){if(Y.status===400)continue;throw Error(`Poll failed: ${await Y.text()}`)}let Z=await Y.json();if(Z.status==="authorized"&&Z.token){let Q={apiUrl:y,token:Z.token.token,expiresAt:Z.token.expiresAt,userId:Z.token.userId,userEmail:Z.token.userEmail};qc(Q),console.log(""),console.log(`Authenticated as ${Z.token.userEmail}`),console.log(""),console.log("You can now use ace commands. Try:"),console.log(" ace orient"),console.log(' ace capture "My new task"');return}if(Z.status==="expired")throw Error("Authentication code expired. Please try again.")}catch(Y){if(Y instanceof TypeError)continue;throw Y}}throw Error("Authentication timed out. Please try again.")}function vj(c){return new Promise((y)=>setTimeout(y,c))}function Tc(c,y){let $=y?new Date(y):new Date,j=c.toLowerCase().trim().replace(/\s+/g,""),f,P=0,R=j.match(/^(\d{1,2}):(\d{2})(?::\d{2})?$/);if(R)f=parseInt(R[1],10),P=parseInt(R[2],10);else{let G=j.match(/^(\d{1,2})(?::(\d{2}))?([ap]m?)$/);if(G){f=parseInt(G[1],10),P=G[2]?parseInt(G[2],10):0;let U=G[3].startsWith("p");if(U&&f!==12)f+=12;else if(!U&&f===12)f=0}else{let U=new Date(c);if(!isNaN(U.getTime()))return U.toISOString();throw Error(`Invalid time format: ${c}. Use "HH:MM", "H:MMam/pm", or ISO format.`)}}if(f<0||f>23)throw Error(`Invalid hours: ${f}. Must be between 0 and 23.`);if(P<0||P>59)throw Error(`Invalid minutes: ${P}. Must be between 0 and 59.`);return $.setHours(f,P,0,0),$.toISOString()}function Qy(c,y){let $=new Date(c);return new Date($.getTime()+y*60*1000).toISOString()}function A(c){let $=new Date(new Date);if($.setHours(0,0,0,0),c==="today"){let R=new Date($);return R.setHours(23,59,59,999),{startDate:$.toISOString(),endDate:R.toISOString()}}if(c==="week"){let R=new Date($);return R.setDate(R.getDate()+7),R.setHours(23,59,59,999),{startDate:$.toISOString(),endDate:R.toISOString()}}if(!/^\d{4}-\d{2}-\d{2}$/.test(c))throw Error(`Invalid date format: ${c}. Use YYYY-MM-DD format.`);let f=new Date(c);if(isNaN(f.getTime()))throw Error(`Invalid date: ${c}. Use YYYY-MM-DD format.`);f.setHours(0,0,0,0);let P=new Date(f);return P.setHours(23,59,59,999),{startDate:f.toISOString(),endDate:P.toISOString()}}function s(c){return new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function V(c){return new Date(c).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}function Jy(c,y,$){if($)return s(c);let j=new Date(c),f=new Date(y);if(j.toDateString()===f.toDateString())return`${V(c)} - ${V(y)}`;return`${s(c)} ${V(c)} - ${s(y)} ${V(y)}`}function g(){return new Date().toISOString().split("T")[0]}function L(){return process.argv.includes("--json")}function S(c,y){if(y?.json||L())console.log(JSON.stringify(c,null,2));else if(typeof c==="string")console.log(c);else console.log(JSON.stringify(c,null,2))}function I(c){if(L())console.log(JSON.stringify({error:c}));else console.error(`Error: ${c}`)}function M(c){let y=[`[${c.id.slice(0,8)}] ${c.name}`];if(c.project_name)y.push(`(${c.project_name})`);if(c.dueDate)y.push(`due: ${c.dueDate}`);if(c.status==="waiting"&&c.waitingFor)y.push(`waiting: ${c.waitingFor}`);return y.join(" ")}function K(c){let y=[`[${c.id.slice(0,8)}] ${c.name}`];if(c.category_name)y.push(`(${c.category_name})`);if(c.status!=="active")y.push(`[${c.status}]`);return y.join(" ")}function z(c,y){if(c.length===0)return y?`${y}: (none)`:"(no actions)";let $=c.map((j)=>` ${M(j)}`);if(y)return`${y} (${c.length}):
27
+ ${$.join(`
28
+ `)}`;return $.join(`
29
+ `)}function u(c,y){if(c.length===0)return y?`${y}: (none)`:"(no projects)";let $=c.map((j)=>` ${K(j)}`);if(y)return`${y} (${c.length}):
30
+ ${$.join(`
31
+ `)}`;return $.join(`
32
+ `)}function Zy(c){let y=[];y.push(`Inbox: ${c.inboxCount} items`);let $=c.domains.map((j)=>` ${j.name}: ${j.active_count}/${j.activeProjectLimit} active`);if(y.push(`Capacity:
33
+ ${$.join(`
34
+ `)}`),c.activeProjects.length>0)y.push(u(c.activeProjects,"Active Projects"));if(c.overdue.length>0)y.push(z(c.overdue,"Overdue"));if(c.dueToday.length>0)y.push(z(c.dueToday,"Due Today"));if(c.waiting.length>0)y.push(z(c.waiting,"Waiting"));return y.join(`
35
35
 
36
- `)}function j$(j){let $=j.command("auth").description("Manage authentication");$.command("login").description("Authenticate with Ace").option("--api-url <url>","Ace API URL (default: https://aceisyourassistant.com)").action(async(S)=>{try{await Gj(S.apiUrl)}catch(y){U(y instanceof Error?y.message:"Login failed"),process.exit(1)}}),$.command("logout").description("Remove stored credentials").action(()=>{let S=Sj();if(T())Q({success:S});else if(S)console.log("Logged out successfully");else console.log("No credentials to remove")}),$.command("status").description("Show current authentication status").action(()=>{let S=B();if(T())Q({authenticated:!!S,email:S?.userEmail??null,apiUrl:S?.apiUrl??null});else if(S)console.log(`Authenticated as ${S.userEmail}`),console.log(`API URL: ${S.apiUrl}`);else console.log("Not authenticated. Run: ace auth login")}),$.command("whoami").description("Show current user").action(()=>{let S=B();if(T())Q({authenticated:!!S,email:S?.userEmail??null,userId:S?.userId??null});else if(S)console.log(S.userEmail);else console.log("Not authenticated"),process.exit(1)})}class Xj extends Error{status;body;constructor(j,$,S){super(j);this.status=$;this.body=S;this.name="ApiError"}}class Mj extends Xj{constructor(j="Not authenticated. Run: ace auth login"){super(j,401);this.name="AuthError"}}async function _(j,$={},S){let y=B();if(!y)throw new Mj;let R=`${S??y.apiUrl??b()}/api${j}`,I=await fetch(R,{...$,headers:{Authorization:`Bearer ${y.token}`,"Content-Type":"application/json",...$.headers}});if(I.status===401)throw new Mj("Session expired. Run: ace auth login");if(!I.ok){let E=await I.json().catch(()=>({}));throw new Xj(E.error??`Request failed with status ${I.status}`,I.status,E)}return I.json()}async function $$(){return _("/dashboard")}async function v(j={}){let $=new URLSearchParams;if(j.status)$.set("status",j.status);if(j.projectId)$.set("project_id",j.projectId);if(j.contextId)$.set("context_id",j.contextId);if(j.search)$.set("search",j.search);if(j.limit)$.set("limit",String(j.limit));if(j.offset)$.set("offset",String(j.offset));let S=$.toString(),y=S?`/actions?${S}`:"/actions";return(await _(y)).actions}async function S$(j){return _(`/actions/${j}`)}async function t(j){return _("/actions",{method:"POST",body:JSON.stringify(j)})}async function _j(j,$){return _(`/actions/${j}`,{method:"PUT",body:JSON.stringify($)})}async function y$(j){return _j(j,{status:"completed"})}async function q$(j){await _(`/actions/${j}`,{method:"DELETE"})}async function g(j={}){let $=new URLSearchParams;if(j.status)$.set("status",j.status);if(j.domain)$.set("domain",j.domain);if(j.categoryId)$.set("category_id",j.categoryId);if(j.search)$.set("search",j.search);if(j.dueForReview)$.set("due_for_review","true");let S=$.toString(),y=S?`/projects?${S}`:"/projects";return(await _(y)).projects}async function R$(j){return _(`/projects/${j}`)}async function E$(j){return _("/projects",{method:"POST",body:JSON.stringify(j)})}async function m(j,$){return _(`/projects/${j}`,{method:"PUT",body:JSON.stringify($)})}function I$(j){j.command("capture").description("Quick capture an item to inbox").argument("<text>","The item to capture").option("-n, --notes <notes>","Additional notes").action(async($,S)=>{try{let y=await t({name:$,status:"inbox",notes:S.notes});if(T())Q(y);else console.log(`Captured: ${K(y)}`)}catch(y){U(y instanceof Error?y.message:"Capture failed"),process.exit(1)}})}function P$(j){j.command("orient").description("Daily orientation - see your current state").alias("dashboard").action(async()=>{try{let $=await $$();if(T())Q($);else console.log(ej($))}catch($){U($ instanceof Error?$.message:"Failed to load dashboard"),process.exit(1)}})}function J$(j){let $=j.command("actions").description("Manage actions");$.command("list").description("List actions").option("-s, --status <status>","Filter by status (inbox, active, waiting, someday)").option("-p, --project <id>","Filter by project ID").option("-c, --context <id>","Filter by context ID").option("-q, --search <query>","Search by name").option("-l, --limit <n>","Limit results","50").action(async(S)=>{try{let y=await v({status:S.status,projectId:S.project,contextId:S.context,search:S.search,limit:parseInt(S.limit)});if(T())Q({actions:y});else{let q=S.status?`${S.status} actions`:"Actions";console.log(x(y,q))}}catch(y){U(y instanceof Error?y.message:"Failed to list actions"),process.exit(1)}}),$.command("inbox").description("List inbox items").action(async()=>{try{let S=await v({status:"inbox"});if(T())Q({actions:S,count:S.length});else console.log(x(S,"Inbox"))}catch(S){U(S instanceof Error?S.message:"Failed to list inbox"),process.exit(1)}}),$.command("get <id>").description("Get action details").action(async(S)=>{try{let y=await S$(S);if(T())Q(y);else{if(console.log(K(y)),y.notes)console.log(`
37
- Notes: ${y.notes}`);if(y.contexts.length>0)console.log(`
38
- Contexts: ${y.contexts.map((q)=>q.name).join(", ")}`)}}catch(y){U(y instanceof Error?y.message:"Failed to get action"),process.exit(1)}}),$.command("add <name>").description("Create a new action").option("-s, --status <status>","Initial status (default: inbox)").option("-p, --project <id>","Assign to project").option("-d, --due <date>","Due date (YYYY-MM-DD)").option("-n, --notes <notes>","Additional notes").action(async(S,y)=>{try{let q=await t({name:S,status:y.status??"inbox",projectId:y.project,dueDate:y.due,notes:y.notes});if(T())Q(q);else console.log(`Created: ${K(q)}`)}catch(q){U(q instanceof Error?q.message:"Failed to create action"),process.exit(1)}}),$.command("update <id>").description("Update an action").option("-n, --name <name>","New name").option("-s, --status <status>","New status").option("-p, --project <id>",'Assign to project (use "none" to unassign)').option("-d, --due <date>",'Due date (YYYY-MM-DD, or "none" to clear)').option("--notes <notes>","Update notes").option("-w, --waiting <reason>","Set waiting reason").action(async(S,y)=>{try{let q={};if(y.name)q.name=y.name;if(y.status)q.status=y.status;if(y.project==="none")q.projectId=null;else if(y.project)q.projectId=y.project;if(y.due==="none")q.dueDate=null;else if(y.due)q.dueDate=y.due;if(y.notes)q.notes=y.notes;if(y.waiting)q.waitingFor=y.waiting,q.status="waiting";let R=await _j(S,q);if(T())Q(R);else console.log(`Updated: ${K(R)}`)}catch(q){U(q instanceof Error?q.message:"Failed to update action"),process.exit(1)}}),$.command("complete <id>").description("Mark an action as completed").action(async(S)=>{try{let y=await y$(S);if(T())Q(y);else console.log(`Completed: ${K(y)}`)}catch(y){U(y instanceof Error?y.message:"Failed to complete action"),process.exit(1)}}),$.command("delete <id>").description("Delete an action").action(async(S)=>{try{if(await q$(S),T())Q({success:!0,id:S});else console.log(`Deleted action ${S}`)}catch(y){U(y instanceof Error?y.message:"Failed to delete action"),process.exit(1)}}),$.command("count").description("Count actions by status").option("-s, --status <status>","Status to count (default: inbox)").action(async(S)=>{try{let y=S.status??"inbox",q=await v({status:y});if(T())Q({status:y,count:q.length});else console.log(`${y}: ${q.length}`)}catch(y){U(y instanceof Error?y.message:"Failed to count actions"),process.exit(1)}})}function Y$(j){let $=j.command("projects").description("Manage projects");$.command("list").description("List projects").option("-s, --status <status>","Filter by status").option("-d, --domain <domain>","Filter by domain (Work, Personal)").option("-c, --category <id>","Filter by category ID").option("-q, --search <query>","Search by name").option("-r, --review","Show only projects due for review").action(async(S)=>{try{let y=await g({status:S.status,domain:S.domain,categoryId:S.category,search:S.search,dueForReview:S.review});if(T())Q({projects:y});else{let q=S.status?`${S.status} projects`:"Projects";console.log(u(y,q))}}catch(y){U(y instanceof Error?y.message:"Failed to list projects"),process.exit(1)}}),$.command("active").description("List active projects").option("-d, --domain <domain>","Filter by domain (Work, Personal)").action(async(S)=>{try{let y=await g({status:"active",domain:S.domain});if(T())Q({projects:y,count:y.length});else console.log(u(y,"Active Projects"))}catch(y){U(y instanceof Error?y.message:"Failed to list active projects"),process.exit(1)}}),$.command("get <id>").description("Get project details").action(async(S)=>{try{let y=await R$(S);if(T())Q(y);else{if(console.log(V(y)),y.theOneThing)console.log(`
39
- The One Thing: ${y.theOneThing}`);if(y.notes)console.log(`
40
- Notes: ${y.notes}`);if(console.log(`
41
- Status: ${y.status}`),y.reviewAfter)console.log(`Review after: ${y.reviewAfter}`)}}catch(y){U(y instanceof Error?y.message:"Failed to get project"),process.exit(1)}}),$.command("add <name>").description("Create a new project").option("-s, --status <status>","Initial status (default: incubating)").option("-c, --category <id>","Assign to category").option("-t, --the-one-thing <text>","Set the one thing").option("-n, --notes <notes>","Additional notes").action(async(S,y)=>{try{let q=await E$({name:S,status:y.status??"incubating",categoryId:y.category,theOneThing:y.theOneThing,notes:y.notes});if(T())Q(q);else console.log(`Created: ${V(q)}`)}catch(q){U(q instanceof Error?q.message:"Failed to create project"),process.exit(1)}}),$.command("update <id>").description("Update a project").option("-n, --name <name>","New name").option("-s, --status <status>","New status").option("-c, --category <id>",'Assign to category (use "none" to unassign)').option("-t, --the-one-thing <text>","Set the one thing").option("--notes <notes>","Update notes").action(async(S,y)=>{try{let q={};if(y.name)q.name=y.name;if(y.status)q.status=y.status;if(y.category==="none")q.categoryId=null;else if(y.category)q.categoryId=y.category;if(y.theOneThing)q.theOneThing=y.theOneThing;if(y.notes)q.notes=y.notes;let R=await m(S,q);if(T())Q(R);else console.log(`Updated: ${V(R)}`)}catch(q){U(q instanceof Error?q.message:"Failed to update project"),process.exit(1)}}),$.command("activate <id>").description("Set project status to active").action(async(S)=>{try{let y=await m(S,{status:"active"});if(T())Q(y);else console.log(`Activated: ${V(y)}`)}catch(y){U(y instanceof Error?y.message:"Failed to activate project"),process.exit(1)}}),$.command("complete <id>").description("Mark a project as completed").action(async(S)=>{try{let y=await m(S,{status:"completed"});if(T())Q(y);else console.log(`Completed: ${V(y)}`)}catch(y){U(y instanceof Error?y.message:"Failed to complete project"),process.exit(1)}}),$.command("review").description("List projects due for review").action(async()=>{try{let S=await g({dueForReview:!0});if(T())Q({projects:S,count:S.length});else console.log(u(S,"Projects Due for Review"))}catch(S){U(S instanceof Error?S.message:"Failed to list projects for review"),process.exit(1)}})}W.name("ace").description("CLI for Ace productivity assistant").version(bj);j$(W);I$(W);P$(W);J$(W);Y$(W);W.option("--json","Output in JSON format for AI consumption").option("--api-url <url>","Override API URL");W.parse();
36
+ `)}function bj(c){let y=[`[${c.id.slice(0,8)}] ${c.name}`];if(y.push(`(${c.accountEmail})`),!c.isEnabled)y.push("[disabled]");return y.join(" ")}function Fy(c,y){if(c.length===0)return y?`${y}: (none)`:"(no calendars connected)";let $=c.map((j)=>` ${bj(j)}`);if(y)return`${y} (${c.length}):
37
+ ${$.join(`
38
+ `)}`;return $.join(`
39
+ `)}function zy(c){let $=[`${Jy(c.startTime,c.endTime,c.isAllDay)} - ${c.summary}`];if(c.location)$.push(`@ ${c.location}`);return $.join(" ")}function Cc(c,y){if(c.length===0)return y?`${y}: (no events)`:"(no events)";let $=new Map;for(let f of c){let P=s(f.startTime),R=$.get(P)||[];R.push(f),$.set(P,R)}let j=[];if(y)j.push(`${y} (${c.length}):`);for(let[f,P]of $){j.push(`
40
+ ${f}:`);for(let R of P){let U=` ${R.isAllDay?"All day":`${V(R.startTime)} - ${V(R.endTime)}`}: ${R.summary}`;if(R.location)U+=` @ ${R.location}`;j.push(U)}}return j.join(`
41
+ `)}function Xy(c){let y=c.command("auth").description("Manage authentication");y.command("login").description("Authenticate with Ace").option("--api-url <url>","Ace API URL (default: https://aceisyourassistant.com)").action(async($)=>{try{await Kc($.apiUrl)}catch(j){I(j instanceof Error?j.message:"Login failed"),process.exit(1)}}),y.command("logout").description("Remove stored credentials").action(()=>{let $=wc();if(L())S({success:$});else if($)console.log("Logged out successfully");else console.log("No credentials to remove")}),y.command("status").description("Show current authentication status").action(()=>{let $=x(),j=l();if(L())S({authenticated:!!$,method:j?"env-token":"stored-credentials",email:$?.userEmail??null,apiUrl:$?.apiUrl??null});else if($&&j)console.log("Authenticated via ACE_TOKEN environment variable"),console.log(`API URL: ${$.apiUrl}`);else if($)console.log(`Authenticated as ${$.userEmail}`),console.log(`API URL: ${$.apiUrl}`);else console.log("Not authenticated. Run: ace auth login")}),y.command("whoami").description("Show current user").action(()=>{let $=x(),j=l();if(L())S({authenticated:!!$,method:j?"env-token":"stored-credentials",email:j?null:$?.userEmail??null,userId:j?null:$?.userId??null});else if($&&j)console.log("Authenticated via ACE_TOKEN (run ace auth login for full user info)");else if($)console.log($.userEmail);else console.log("Not authenticated"),process.exit(1)})}class xc extends Error{status;body;constructor(c,y,$){super(c);this.status=y;this.body=$;this.name="ApiError"}}class Bc extends xc{constructor(c="Not authenticated. Run: ace auth login"){super(c,401);this.name="AuthError"}}async function E(c,y={},$){let j=x();if(!j)throw new Bc;let P=`${$??j.apiUrl??O()}/api${c}`,R=await fetch(P,{...y,headers:{Authorization:`Bearer ${j.token}`,"Content-Type":"application/json",...y.headers}});if(R.status===401)throw new Bc("Session expired. Run: ace auth login");if(!R.ok){let G=await R.json().catch(()=>({}));throw new xc(G.error??`Request failed with status ${R.status}`,R.status,G)}return R.json()}async function Hy(){return E("/dashboard")}async function T(c={}){let y=new URLSearchParams;if(c.status)y.set("status",c.status);if(c.projectId)y.set("project_id",c.projectId);if(c.contextId)y.set("context_id",c.contextId);if(c.search)y.set("search",c.search);if(c.limit)y.set("limit",String(c.limit));if(c.offset)y.set("offset",String(c.offset));if(c.dueBefore)y.set("due_before",c.dueBefore);if(c.dueAfter)y.set("due_after",c.dueAfter);if(c.completedAfter)y.set("completed_after",c.completedAfter);let $=y.toString(),j=$?`/actions?${$}`:"/actions";return(await E(j)).actions}async function Wy(c){return E(`/actions/${c}`)}async function a(c){return E("/actions",{method:"POST",body:JSON.stringify(c)})}async function Nc(c,y){return E(`/actions/${c}`,{method:"PUT",body:JSON.stringify(y)})}async function _y(c){return Nc(c,{status:"completed"})}async function My(c){await E(`/actions/${c}`,{method:"DELETE"})}async function m(c={}){let y=new URLSearchParams;if(c.status)y.set("status",c.status);if(c.domain)y.set("domain",c.domain);if(c.categoryId)y.set("category_id",c.categoryId);if(c.search)y.set("search",c.search);if(c.dueForReview)y.set("dueForReview","true");if(c.completedAfter)y.set("completed_after",c.completedAfter);let $=y.toString(),j=$?`/projects?${$}`:"/projects";return(await E(j)).projects}async function Ky(c){return E(`/projects/${c}`)}async function Ty(c){return E("/projects",{method:"POST",body:JSON.stringify(c)})}async function i(c,y){return E(`/projects/${c}`,{method:"PUT",body:JSON.stringify(y)})}async function Cy(c){return E(`/projects/${c}`,{method:"PUT",body:JSON.stringify({action:"review"})})}async function By(c){await E(`/projects/${c}`,{method:"DELETE"})}async function xy(){return(await E("/contexts")).contexts}async function n(c={}){let y=new URLSearchParams;if(c.status)y.set("status",c.status);if(c.domain)y.set("domain",c.domain);if(c.search)y.set("search",c.search);if(c.dueForReview)y.set("dueForReview","true");let $=y.toString(),j=$?`/goals?${$}`:"/goals";return(await E(j)).goals}async function Ny(c,y=!1){let $=y?`/goals/${c}?include=projects`:`/goals/${c}`;return E($)}async function Vy(c){return E("/goals",{method:"POST",body:JSON.stringify(c)})}async function o(c,y){return E(`/goals/${c}`,{method:"PUT",body:JSON.stringify(y)})}async function Ay(c){return E(`/goals/${c}`,{method:"PUT",body:JSON.stringify({action:"review"})})}async function Dy(c){await E(`/goals/${c}`,{method:"DELETE"})}async function ky(){return(await E("/domains")).domains}async function ty(c={}){let y=new URLSearchParams;if(c.source)y.set("source",c.source);if(c.limit)y.set("limit",String(c.limit));let $=y.toString(),j=$?`/activity-log?${$}`:"/activity-log";return(await E(j)).logs}async function uy(c){return E("/activity-log",{method:"POST",body:JSON.stringify(c)})}async function Vc(){return(await E("/calendar/calendars")).calendars}async function Ac(c={}){let y=new URLSearchParams;if(c.calendarId)y.set("calendarId",c.calendarId);if(c.startDate)y.set("startDate",c.startDate);if(c.endDate)y.set("endDate",c.endDate);if(c.limit)y.set("limit",String(c.limit));if(c.pageToken)y.set("pageToken",c.pageToken);let $=y.toString(),j=$?`/calendar/events?${$}`:"/calendar/events";return E(j)}async function hy(c){return(await E("/calendar/events",{method:"POST",body:JSON.stringify(c)})).event}async function vy(c={}){let y=new URLSearchParams;if(c.limit)y.set("limit",String(c.limit));if(c.offset)y.set("offset",String(c.offset));let $=y.toString(),j=$?`/updates?${$}`:"/updates";return(await E(j)).updates}async function by(c={}){return E("/updates",{method:"POST",body:JSON.stringify(c)})}async function Oy(c){return E(`/updates/${c}`)}async function sy(c={}){let y=new URLSearchParams;if(c.hours)y.set("hours",String(c.hours));if(c.since)y.set("since",c.since);if(c.until)y.set("until",c.until);if(c.statuses)y.set("statuses",c.statuses);let $=y.toString(),j=$?`/linear/issues?${$}`:"/linear/issues";return E(j)}async function gy(){return E("/linear/statuses")}function my(c){c.command("capture").description("Quick capture an item to inbox").argument("<text>","The item to capture").option("-n, --notes <notes>","Additional notes").action(async(y,$)=>{try{let j=await a({name:y,status:"inbox",notes:$.notes});if(L())S(j);else console.log(`Captured: ${M(j)}`)}catch(j){I(j instanceof Error?j.message:"Capture failed"),process.exit(1)}})}function ry(c){c.command("orient").description("Daily orientation - see your current state").alias("dashboard").action(async()=>{try{let y=await Hy();if(L())S(y);else console.log(Zy(y))}catch(y){I(y instanceof Error?y.message:"Failed to load dashboard"),process.exit(1)}})}function Oj(){let c=new Date;return c.setHours(0,0,0,0),c}function p(c){return c.toISOString().split("T")[0]}function h(c){let y=Oj();if(c==="overdue")return{dueBefore:p(y)};if(c==="today"){let $=new Date(y);return $.setDate($.getDate()+1),{dueAfter:p(y),dueBefore:p($)}}if(c==="week"){let $=new Date(y);return $.setDate($.getDate()+7),{dueBefore:p($)}}return{}}function ly(c){if(c==="today")return h("today");if(c==="week")return h("week");return{dueBefore:c}}function cc(c){let y=new Date;return y.setDate(y.getDate()-c),y.toISOString()}function dy(c){let y=c.command("actions").description("Manage actions");y.command("list").description("List actions").option("-s, --status <status>","Filter by status (inbox, active, waiting, someday)").option("-p, --project <id>","Filter by project ID").option("-c, --context <id>","Filter by context ID").option("-q, --search <query>","Search by name").option("-l, --limit <n>","Limit results","50").option("-d, --due <period>","Filter by due date (today, week, or YYYY-MM-DD)").option("--overdue","Show only overdue actions").action(async($)=>{try{let j,f;if($.overdue)j=h("overdue").dueBefore;else if($.due){let R=ly($.due);j=R.dueBefore,f=R.dueAfter}let P=await T({status:$.status,projectId:$.project,contextId:$.context,search:$.search,limit:parseInt($.limit),dueBefore:j,dueAfter:f});if(L())S({actions:P});else{let R=$.status?`${$.status} actions`:"Actions";console.log(z(P,R))}}catch(j){I(j instanceof Error?j.message:"Failed to list actions"),process.exit(1)}}),y.command("inbox").description("List inbox items").action(async()=>{try{let $=await T({status:"inbox"});if(L())S({actions:$,count:$.length});else console.log(z($,"Inbox"))}catch($){I($ instanceof Error?$.message:"Failed to list inbox"),process.exit(1)}}),y.command("due").description("List actions due today").option("-w, --week","Show actions due this week").action(async($)=>{try{let j=h($.week?"week":"today"),f=await T({status:"active",dueBefore:j.dueBefore,dueAfter:j.dueAfter});if(L())S({actions:f,count:f.length});else{let P=$.week?"Due This Week":"Due Today";console.log(z(f,P))}}catch(j){I(j instanceof Error?j.message:"Failed to list due actions"),process.exit(1)}}),y.command("overdue").description("List overdue actions").action(async()=>{try{let $=h("overdue"),j=await T({status:"active",dueBefore:$.dueBefore});if(L())S({actions:j,count:j.length});else console.log(z(j,"Overdue"))}catch($){I($ instanceof Error?$.message:"Failed to list overdue actions"),process.exit(1)}}),y.command("waiting").description("List actions waiting on someone/something").action(async()=>{try{let $=await T({status:"waiting"});if(L())S({actions:$,count:$.length});else console.log(z($,"Waiting"))}catch($){I($ instanceof Error?$.message:"Failed to list waiting actions"),process.exit(1)}}),y.command("get <id>").description("Get action details").action(async($)=>{try{let j=await Wy($);if(L())S(j);else{if(console.log(M(j)),j.notes)console.log(`
42
+ Notes: ${j.notes}`);if(j.contexts.length>0)console.log(`
43
+ Contexts: ${j.contexts.map((f)=>f.name).join(", ")}`)}}catch(j){I(j instanceof Error?j.message:"Failed to get action"),process.exit(1)}}),y.command("add <name>").description("Create a new action").option("-s, --status <status>","Initial status (default: inbox)").option("-p, --project <id>","Assign to project").option("-d, --due <date>","Due date (YYYY-MM-DD)").option("-n, --notes <notes>","Additional notes").action(async($,j)=>{try{let f=await a({name:$,status:j.status??"inbox",projectId:j.project,dueDate:j.due,notes:j.notes});if(L())S(f);else console.log(`Created: ${M(f)}`)}catch(f){I(f instanceof Error?f.message:"Failed to create action"),process.exit(1)}}),y.command("update <id>").description("Update an action").option("-n, --name <name>","New name").option("-s, --status <status>","New status").option("-p, --project <id>",'Assign to project (use "none" to unassign)').option("-d, --due <date>",'Due date (YYYY-MM-DD, or "none" to clear)').option("--notes <notes>","Update notes").option("-w, --waiting <reason>","Set waiting reason").action(async($,j)=>{try{let f={};if(j.name)f.name=j.name;if(j.status)f.status=j.status;if(j.project==="none")f.projectId=null;else if(j.project)f.projectId=j.project;if(j.due==="none")f.dueDate=null;else if(j.due)f.dueDate=j.due;if(j.notes)f.notes=j.notes;if(j.waiting)f.waitingFor=j.waiting,f.status="waiting";let P=await Nc($,f);if(L())S(P);else console.log(`Updated: ${M(P)}`)}catch(f){I(f instanceof Error?f.message:"Failed to update action"),process.exit(1)}}),y.command("complete <id>").description("Mark an action as completed").action(async($)=>{try{let j=await _y($);if(L())S(j);else console.log(`Completed: ${M(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to complete action"),process.exit(1)}}),y.command("delete <id>").description("Delete an action").action(async($)=>{try{if(await My($),L())S({success:!0,id:$});else console.log(`Deleted action ${$}`)}catch(j){I(j instanceof Error?j.message:"Failed to delete action"),process.exit(1)}}),y.command("count").description("Count actions by status").option("-s, --status <status>","Status to count (default: inbox)").action(async($)=>{try{let j=$.status??"inbox",f=await T({status:j});if(L())S({status:j,count:f.length});else console.log(`${j}: ${f.length}`)}catch(j){I(j instanceof Error?j.message:"Failed to count actions"),process.exit(1)}}),y.command("completed").description("List recently completed actions").option("-d, --days <n>","Number of days to look back","7").option("-l, --limit <n>","Max items to return","50").action(async($)=>{try{let j=parseInt($.days),f=await T({status:"completed",completedAfter:cc(j),limit:parseInt($.limit)});if(L())S({actions:f,count:f.length,days:j});else console.log(z(f,`Completed (last ${$.days} days)`))}catch(j){I(j instanceof Error?j.message:"Failed to list completed actions"),process.exit(1)}})}function ey(c){let y=c.command("projects").description("Manage projects");y.command("list").description("List projects").option("-s, --status <status>","Filter by status").option("-d, --domain <domain>","Filter by domain (Work, Personal)").option("-c, --category <id>","Filter by category ID").option("-q, --search <query>","Search by name").option("-r, --review","Show only projects due for review").action(async($)=>{try{let j=await m({status:$.status,domain:$.domain,categoryId:$.category,search:$.search,dueForReview:$.review});if(L())S({projects:j});else{let f=$.status?`${$.status} projects`:"Projects";console.log(u(j,f))}}catch(j){I(j instanceof Error?j.message:"Failed to list projects"),process.exit(1)}}),y.command("active").description("List active projects").option("-d, --domain <domain>","Filter by domain (Work, Personal)").action(async($)=>{try{let j=await m({status:"active",domain:$.domain});if(L())S({projects:j,count:j.length});else console.log(u(j,"Active Projects"))}catch(j){I(j instanceof Error?j.message:"Failed to list active projects"),process.exit(1)}}),y.command("get <id>").description("Get project details").action(async($)=>{try{let j=await Ky($);if(L())S(j);else{if(console.log(K(j)),j.theOneThing)console.log(`
44
+ The One Thing: ${j.theOneThing}`);if(j.notes)console.log(`
45
+ Notes: ${j.notes}`);if(console.log(`
46
+ Status: ${j.status}`),j.reviewAfter)console.log(`Review after: ${j.reviewAfter}`)}}catch(j){I(j instanceof Error?j.message:"Failed to get project"),process.exit(1)}}),y.command("add <name>").description("Create a new project").option("-s, --status <status>","Initial status (default: incubating)").option("-c, --category <id>","Assign to category").option("-t, --the-one-thing <text>","Set the one thing").option("-n, --notes <notes>","Additional notes").action(async($,j)=>{try{let f=await Ty({name:$,status:j.status??"incubating",categoryId:j.category,theOneThing:j.theOneThing,notes:j.notes});if(L())S(f);else console.log(`Created: ${K(f)}`)}catch(f){I(f instanceof Error?f.message:"Failed to create project"),process.exit(1)}}),y.command("update <id>").description("Update a project").option("-n, --name <name>","New name").option("-s, --status <status>","New status").option("-c, --category <id>",'Assign to category (use "none" to unassign)').option("-t, --the-one-thing <text>","Set the one thing").option("--notes <notes>","Update notes").action(async($,j)=>{try{let f={};if(j.name)f.name=j.name;if(j.status)f.status=j.status;if(j.category==="none")f.categoryId=null;else if(j.category)f.categoryId=j.category;if(j.theOneThing)f.theOneThing=j.theOneThing;if(j.notes)f.notes=j.notes;let P=await i($,f);if(L())S(P);else console.log(`Updated: ${K(P)}`)}catch(f){I(f instanceof Error?f.message:"Failed to update project"),process.exit(1)}}),y.command("activate <id>").description("Set project status to active").action(async($)=>{try{let j=await i($,{status:"active"});if(L())S(j);else console.log(`Activated: ${K(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to activate project"),process.exit(1)}}),y.command("complete <id>").description("Mark a project as completed").action(async($)=>{try{let j=await i($,{status:"completed"});if(L())S(j);else console.log(`Completed: ${K(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to complete project"),process.exit(1)}}),y.command("review").description("List projects due for review").action(async()=>{try{let $=await m({dueForReview:!0});if(L())S({projects:$,count:$.length});else console.log(u($,"Projects Due for Review"))}catch($){I($ instanceof Error?$.message:"Failed to list projects for review"),process.exit(1)}}),y.command("mark-reviewed <id>").description("Mark a project as reviewed (resets review timer)").action(async($)=>{try{let j=await Cy($);if(L())S(j);else console.log(`Marked as reviewed: ${K(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to mark project as reviewed"),process.exit(1)}}),y.command("drop <id>").description("Drop a project (soft delete)").action(async($)=>{try{if(await By($),L())S({success:!0,id:$});else console.log(`Dropped project ${$}`)}catch(j){I(j instanceof Error?j.message:"Failed to drop project"),process.exit(1)}}),y.command("completed").description("List recently completed projects").option("-d, --days <n>","Number of days to look back","7").action(async($)=>{try{let j=parseInt($.days),f=await m({status:"completed",completedAfter:cc(j)});if(L())S({projects:f,count:f.length,days:j});else console.log(u(f,`Completed (last ${$.days} days)`))}catch(j){I(j instanceof Error?j.message:"Failed to list completed projects"),process.exit(1)}})}function D(c){let y=c.id.slice(0,8),$=c.domain_name?` (${c.domain_name})`:"";return`[${y}] ${c.name}${$}`}function Dc(c,y){if(c.length===0)return`${y}: (none)`;let $=[`${y} (${c.length}):`],j=c.reduce((f,P)=>{let R=P.domain_name||"Unknown";if(!f[R])f[R]=[];return f[R].push(P),f},{});for(let[f,P]of Object.entries(j)){$.push(`
47
+ ${f}:`);for(let R of P){let G=R.status!=="active"?` [${R.status}]`:"";if($.push(` ${D(R)}${G}`),R.theOneThing)$.push(` Focus: ${R.theOneThing}`);if(R.project_count!==void 0)$.push(` Projects: ${R.project_count}`)}}return $.join(`
48
+ `)}function ay(c){let y=c.command("goals").description("Manage goals");y.command("list").description("List goals").option("-s, --status <status>","Filter by status (active, paused, completed, dropped)").option("-d, --domain <domain>","Filter by domain (Work, Personal)").option("-q, --search <query>","Search by name").option("-r, --review","Show only goals due for review").action(async($)=>{try{let j=await n({status:$.status,domain:$.domain,search:$.search,dueForReview:$.review});if(L())S({goals:j});else{let f=$.status?`${$.status} goals`:"Goals";console.log(Dc(j,f))}}catch(j){I(j instanceof Error?j.message:"Failed to list goals"),process.exit(1)}}),y.command("active").description("List active goals").option("-d, --domain <domain>","Filter by domain (Work, Personal)").action(async($)=>{try{let j=await n({status:"active",domain:$.domain});if(L())S({goals:j,count:j.length});else console.log(Dc(j,"Active Goals"))}catch(j){I(j instanceof Error?j.message:"Failed to list active goals"),process.exit(1)}}),y.command("get <id>").description("Get goal details").option("-p, --projects","Include linked projects").action(async($,j)=>{try{let f=await Ny($,j.projects);if(L())S(f);else{if(console.log(D(f)),console.log(`
49
+ Status: ${f.status}`),f.theOneThing)console.log(`Focus: ${f.theOneThing}`);if(f.notes)console.log(`
50
+ Notes: ${f.notes}`);if(f.reviewAfter)console.log(`
51
+ Review after: ${f.reviewAfter}`);if(f.projects&&f.projects.length>0){console.log(`
52
+ Linked Projects (${f.projects.length}):`);for(let P of f.projects)console.log(` - ${P.name} [${P.status}]`)}}}catch(f){I(f instanceof Error?f.message:"Failed to get goal"),process.exit(1)}}),y.command("add <name>").description("Create a new goal").option("-d, --domain <domain>","Domain (Work or Personal)","Personal").option("-s, --status <status>","Initial status (default: active)").option("-f, --focus <text>","Set the focus/one thing").option("-n, --notes <notes>","Additional notes").action(async($,j)=>{try{let f=await ky();if(!f||f.length===0)I("No domains found. Please check your Ace configuration."),process.exit(1);let P=f.find((G)=>G.name.toLowerCase()===j.domain.toLowerCase());if(!P){let G=f.map((U)=>U.name).join(", ");I(`Invalid domain: ${j.domain}. Valid options: ${G}`),process.exit(1)}let R=await Vy({name:$,domainId:P.id,status:j.status??"active",theOneThing:j.focus,notes:j.notes});if(L())S(R);else console.log(`Created: ${D(R)}`)}catch(f){I(f instanceof Error?f.message:"Failed to create goal"),process.exit(1)}}),y.command("update <id>").description("Update a goal").option("-n, --name <name>","New name").option("-s, --status <status>","New status").option("-f, --focus <text>","Update the focus/one thing").option("--notes <notes>","Update notes").action(async($,j)=>{try{let f={};if(j.name)f.name=j.name;if(j.status)f.status=j.status;if(j.focus)f.theOneThing=j.focus;if(j.notes)f.notes=j.notes;let P=await o($,f);if(L())S(P);else console.log(`Updated: ${D(P)}`)}catch(f){I(f instanceof Error?f.message:"Failed to update goal"),process.exit(1)}}),y.command("mark-reviewed <id>").description("Mark a goal as reviewed (resets review timer)").action(async($)=>{try{let j=await Ay($);if(L())S(j);else console.log(`Marked as reviewed: ${D(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to mark goal as reviewed"),process.exit(1)}}),y.command("complete <id>").description("Mark a goal as completed").action(async($)=>{try{let j=await o($,{status:"completed"});if(L())S(j);else console.log(`Completed: ${D(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to complete goal"),process.exit(1)}}),y.command("pause <id>").description("Pause a goal").action(async($)=>{try{let j=await o($,{status:"paused"});if(L())S(j);else console.log(`Paused: ${D(j)}`)}catch(j){I(j instanceof Error?j.message:"Failed to pause goal"),process.exit(1)}}),y.command("drop <id>").description("Drop a goal").action(async($)=>{try{if(await Dy($),L())S({success:!0,id:$});else console.log(`Dropped goal ${$}`)}catch(j){I(j instanceof Error?j.message:"Failed to drop goal"),process.exit(1)}}),y.command("review").description("List goals due for review").action(async()=>{try{let $=await n({dueForReview:!0});if(L())S({goals:$,count:$.length});else console.log(Dc($,"Goals Due for Review"))}catch($){I($ instanceof Error?$.message:"Failed to list goals for review"),process.exit(1)}})}function sj(c,y){if(c.length===0)return`${y}: (none)`;let $=[`${y} (${c.length}):`],j=c.reduce((f,P)=>{let R=new Date(P.timestamp).toLocaleDateString();if(!f[R])f[R]=[];return f[R].push(P),f},{});for(let[f,P]of Object.entries(j)){$.push(`
53
+ ${f}:`);for(let R of P){let G=new Date(R.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});$.push(` ${G} [${R.source}] ${R.summary}`)}}return $.join(`
54
+ `)}function iy(c){let y=c.command("activity").description("View and log activity");y.command("list").description("List activity log entries").option("-s, --source <source>","Filter by source (manual, git, calendar, etc.)").option("-l, --limit <n>","Limit results","50").action(async($)=>{try{let j=await ty({source:$.source,limit:parseInt($.limit)});if(L())S({logs:j});else{let f=$.source?`Activity (${$.source})`:"Recent Activity";console.log(sj(j,f))}}catch(j){I(j instanceof Error?j.message:"Failed to list activity"),process.exit(1)}}),y.command("log <summary>").description("Log an activity").option("-s, --source <source>","Activity source","manual").option("-p, --project <id>","Link to project").option("-a, --action <id>","Link to action").action(async($,j)=>{try{let f=await uy({source:j.source,summary:$,project_id:j.project,action_id:j.action});if(L())S(f);else if(console.log(`Logged: ${$}`),j.project)console.log(` Linked to project: ${j.project}`)}catch(f){I(f instanceof Error?f.message:"Failed to log activity"),process.exit(1)}})}function ny(c){c.command("contexts").description("Manage contexts").command("list").description("List all contexts").action(async()=>{try{let $=await xy();if(L())S({contexts:$});else if($.length===0)console.log("No contexts found");else{console.log("Contexts:");for(let j of $){let f=j.type?` (${j.type})`:"";console.log(` [${j.id.slice(0,8)}] ${j.name}${f}`)}}}catch($){I($ instanceof Error?$.message:"Failed to list contexts"),process.exit(1)}})}var gj=30,oy=1,py=250,mj=50;function c$(c){let y=c.command("calendar").description("Manage calendar events");y.command("list").description("List connected calendars").action(async()=>{try{let $=await Vc();if(L())S({calendars:$});else console.log(Fy($,"Connected Calendars"))}catch($){I($ instanceof Error?$.message:"Failed to list calendars"),process.exit(1)}}),y.command("events").description("List calendar events").option("-c, --calendar <id>","Filter by calendar ID").option("-d, --date <date>","Date to show events for (YYYY-MM-DD, default: today)").option("-w, --week","Show events for the next 7 days").option("--from <date>","Start date for range (YYYY-MM-DD)").option("--to <date>","End date for range (YYYY-MM-DD)").option("-l, --limit <n>","Maximum number of events",String(mj)).option("--page-token <token>","Page token for pagination (requires --calendar)").action(async($)=>{try{if($.pageToken&&!$.calendar)I("--page-token requires --calendar to be specified"),process.exit(1);let j,f;if($.from&&$.to){let G=A($.from),U=A($.to);j=G.startDate,f=U.endDate}else if($.week){let G=A("week");j=G.startDate,f=G.endDate}else if($.date){let G=A($.date);j=G.startDate,f=G.endDate}else{let G=A("today");j=G.startDate,f=G.endDate}let P=parseInt($.limit);if(isNaN(P)||P<oy||P>py)I(`Invalid limit. Must be between ${oy} and ${py}.`),process.exit(1);let R=await Ac({calendarId:$.calendar,startDate:j,endDate:f,limit:P,pageToken:$.pageToken});if(L())S({events:R.events,count:R.events.length,nextPageToken:R.nextPageToken});else{let G="Events";if($.week)G="Events (next 7 days)";else if($.date)G=`Events for ${$.date}`;else if($.from&&$.to)G=`Events from ${$.from} to ${$.to}`;else G=`Events for ${g()}`;if(console.log(Cc(R.events,G)),R.nextPageToken)console.log(`
55
+ More events available. Use --page-token ${R.nextPageToken} to see next page.`)}}catch(j){I(j instanceof Error?j.message:"Failed to list events"),process.exit(1)}}),y.command("today").description("List today's calendar events").option("-c, --calendar <id>","Filter by calendar ID").action(async($)=>{try{let j=A("today"),f=await Ac({calendarId:$.calendar,startDate:j.startDate,endDate:j.endDate});if(L())S({events:f.events,count:f.events.length,date:g()});else console.log(Cc(f.events,`Today (${g()})`))}catch(j){I(j instanceof Error?j.message:"Failed to list today's events"),process.exit(1)}}),y.command("add <summary>").description("Create a new calendar event").option("-c, --calendar <id>","Calendar ID to create event on").option("-s, --start <time>","Start time (e.g., 14:00, 2pm)","").option("-e, --end <time>","End time (e.g., 15:00, 3pm)").option("--duration <minutes>","Duration in minutes (alternative to --end)",String(gj)).option("-d, --date <date>","Date for the event (YYYY-MM-DD, default: today)").option("-l, --location <location>","Event location").option("--description <text>","Event description").option("--timezone <tz>","Timezone for the event (e.g., America/New_York, default: calendar's timezone)").action(async($,j)=>{try{if(!j.calendar){let q=(await Vc()).filter((w)=>w.isEnabled);if(q.length===0)I("No calendars connected. Connect a calendar via the web app first."),process.exit(1);if(q.length===1)j.calendar=q[0].id;else{let w=q.map((Y)=>` ${Y.id.slice(0,8)} - ${Y.name} (${Y.accountEmail})`).join(`
56
+ `);I(`Multiple calendars available. Please specify --calendar <id>:
57
+ ${w}`),process.exit(1)}}if(!j.start)I("Start time is required. Use --start <time> (e.g., --start 14:00 or --start 2pm)"),process.exit(1);let f=j.date||g(),P;try{P=Tc(j.start,f)}catch(U){I(U instanceof Error?U.message:"Invalid start time"),process.exit(1)}let R;if(j.end)try{R=Tc(j.end,f)}catch(U){I(U instanceof Error?U.message:"Invalid end time"),process.exit(1)}else{let U=parseInt(j.duration);if(isNaN(U)||U<=0)I("Invalid duration. Must be a positive number of minutes."),process.exit(1);R=Qy(P,U)}let G=await hy({calendarId:j.calendar,summary:$,startTime:P,endTime:R,location:j.location,description:j.description,timeZone:j.timezone});if(L())S(G);else console.log(`Created: ${zy(G)}`)}catch(f){I(f instanceof Error?f.message:"Failed to create event"),process.exit(1)}})}function y$(c){let y=c.command("linear").description("Linear integration commands");y.command("issues").description("List Linear issues for a time period or by workflow status").option("-h, --hours <n>","Hours to look back","24").option("-s, --since <date>","Start date (ISO string)").option("-u, --until <date>","End date (ISO string, defaults to now)").option("--status <names>",'Filter by workflow status names (comma-separated, e.g. "In Progress,Todo")').option("-f, --format <format>","Output format: text, markdown, slack, html","text").action(async($)=>{try{let j=!!$.status,f=await sy({hours:j?void 0:$.hours?parseInt($.hours):void 0,since:j?void 0:$.since,until:j?void 0:$.until,statuses:$.status});if(L())S(f);else{let P=$.format.toLowerCase();switch(P){case"html":console.log(f.formatted.html);break;case"markdown":console.log(f.formatted.markdown);break;case"slack":console.log(f.formatted.slack);break;case"text":default:console.log(f.formatted.text);break}if(P==="text")if(console.log(""),j)console.log(`--- Stats: ${f.stats.totalIssues} issues (${f.stats.completedIssues} completed)`);else console.log(`--- Stats: ${f.stats.totalIssues} issues (${f.stats.completedIssues} completed), ${f.stats.comments} comments, ${f.stats.statusChanges} status changes`)}}catch(j){I(j instanceof Error?j.message:"Failed to fetch Linear issues"),process.exit(1)}}),y.command("statuses").description("List available workflow statuses from linked Linear teams").action(async()=>{try{let $=await gy();if(L())S($);else{if($.teams.length===0){console.log("No linked Linear teams found.");return}for(let j of $.teams){console.log(`${j.teamName} (${j.teamKey})`);for(let f of j.states)console.log(` ${f.name} [${f.type}]`);console.log("")}}}catch($){I($ instanceof Error?$.message:"Failed to fetch Linear statuses"),process.exit(1)}})}function rj(c){let y=new Date(c.periodEnd).toLocaleDateString(),$=c.aceActivityCount+c.githubActivityCount+c.linearActivityCount+c.calendarActivityCount,j=[`[${c.id.slice(0,8)}] ${y}`];if(j.push(`(${$} activities)`),c.categoriesIncluded.length>0)j.push(`- ${c.categoriesIncluded.join(", ")}`);return j.join(" ")}function lj(c,y){if(c.length===0)return`${y}: (none)`;let $=c.map((j)=>` ${rj(j)}`);return`${y} (${c.length}):
58
+ ${$.join(`
59
+ `)}`}function $$(c){let y=c.stats,$=[];if(y.aceItems>0)$.push(`${y.aceItems} ace`);if(y.commits>0)$.push(`${y.commits} commits`);if(y.pullRequests>0)$.push(`${y.pullRequests} PRs`);if(y.issues>0)$.push(`${y.issues} issues`);if(y.linearIssues>0)$.push(`${y.linearIssues} linear`);if(y.calendarEvents>0)$.push(`${y.calendarEvents} meetings`);if(y.slackMessages>0)$.push(`${y.slackMessages} slack`);return["",`--- Period: ${c.periodStart.slice(0,10)} to ${c.periodEnd.slice(0,10)}`,`--- Stats: ${$.join(", ")||"no activity"}`].join(`
60
+ `)}function j$(c){let y=c.command("updates").description("Daily update commands");y.command("list").description("List recent updates").option("-l, --limit <n>","Number of updates to show","10").option("-o, --offset <n>","Skip first N updates","0").action(async($)=>{try{let j=await vy({limit:parseInt($.limit,10),offset:parseInt($.offset,10)});if(L())S({updates:j,count:j.length});else console.log(lj(j,"Recent Updates"))}catch(j){I(j instanceof Error?j.message:"Failed to list updates"),process.exit(1)}}),y.command("generate").description("Generate a new daily update").option("-d, --date <YYYY-MM-DD>","Target date (defaults to today)").option("--days-off <dates>","Comma-separated ISO dates to skip").option("--timezone <tz>","IANA timezone for working day calculation").option("-f, --format <format>","Output format: markdown, slack","markdown").action(async($)=>{try{let j=$.daysOff?$.daysOff.split(",").map((P)=>P.trim()):void 0,f=await by({targetDate:$.date,daysOff:j,timezone:$.timezone});if(L())S(f);else{if($.format.toLowerCase()==="slack")console.log(f.formatted.slackMrkdwn);else console.log(f.formatted.markdown);console.log($$(f)),console.log(`--- ID: ${f.id}`)}}catch(j){I(j instanceof Error?j.message:"Failed to generate update"),process.exit(1)}}),y.command("show <id>").description("Show a specific update").option("-f, --format <format>","Output format: markdown, slack","markdown").action(async($,j)=>{try{let f=await Oy($);if(L())S(f);else{if(j.format.toLowerCase()==="slack")console.log(f.formatted.slackMrkdwn);else console.log(f.formatted.markdown);console.log($$(f))}}catch(f){I(f instanceof Error?f.message:"Failed to show update"),process.exit(1)}})}F.name("ace").description("CLI for Ace productivity assistant").version(nc);Xy(F);my(F);ry(F);dy(F);ey(F);ay(F);iy(F);ny(F);c$(F);y$(F);j$(F);F.option("--json","Output in JSON format for AI consumption").option("--api-url <url>","Override API URL");F.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ace-assistant-cli",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "CLI for Ace productivity assistant - bring your own AI",
5
5
  "type": "module",
6
6
  "bin": {