claudecode-dashboard 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,23 +1,32 @@
1
1
  #!/usr/bin/env node
2
- import {c,i,h,g,f,e,d as d$1}from'./chunk-AHIRPBQB.js';import {b as b$1,a,d}from'./chunk-KBW7PPBV.js';var b=b$1(N=>{var w=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0;}},P=class extends w{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};N.CommanderError=w;N.InvalidArgumentError=P;});var E=b$1(q=>{var{InvalidArgumentError:le}=b(),T=class{constructor(e,t){switch(this.description=t||"",this.variadic=false,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case "<":this.required=true,this._name=e.slice(1,-1);break;case "[":this.required=false,this._name=e.slice(1,-1);break;default:this.required=true,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=true,this._name=this._name.slice(0,-3));}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new le(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=true,this}argOptional(){return this.required=false,this}};function ue(h){let e=h.name()+(h.variadic===true?"...":"");return h.required?"<"+e+">":"["+e+"]"}q.Argument=T;q.humanReadableArgName=ue;});var F=b$1(J=>{var{humanReadableArgName:ce}=E(),D=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=false,this.sortOptions=false,this.showGlobalOptions=false;}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!n&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description));}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return [];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n);}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||"";}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>ce(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(d,_){if(_){let y=`${d.padEnd(i+r)}${_}`;return t.wrap(y,n-s,i+r)}return d}function o(d){return d.join(`
3
- `).replace(/^/gm," ".repeat(s))}let l=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(l=l.concat([t.wrap(u,n,0),""]));let c=t.visibleArguments(e).map(d=>a(t.argumentTerm(d),t.argumentDescription(d)));c.length>0&&(l=l.concat(["Arguments:",o(c),""]));let p=t.visibleOptions(e).map(d=>a(t.optionTerm(d),t.optionDescription(d)));if(p.length>0&&(l=l.concat(["Options:",o(p),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(_=>a(t.optionTerm(_),t.optionDescription(_)));d.length>0&&(l=l.concat(["Global Options:",o(d),""]));}let O=t.visibleCommands(e).map(d=>a(t.subcommandTerm(d),t.subcommandDescription(d)));return O.length>0&&(l=l.concat(["Commands:",o(O),""])),l.join(`
4
- `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let a=t-i;if(a<n)return e;let o=e.slice(0,i),l=e.slice(i).replace(`\r
5
- `,`
6
- `),u=" ".repeat(i),p="\\s\u200B",O=new RegExp(`
7
- |.{1,${a-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g"),d=l.match(O)||[];return o+d.map((_,y)=>_===`
8
- `?"":(y>0?u:"")+_.trimEnd()).join(`
9
- `)}};J.Help=D;});var M=b$1(j=>{var{InvalidArgumentError:me}=b(),I=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=false;let i=pe(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=false,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=false,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0;}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:true}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=true){return this.mandatory=!!e,this}hideHelp(e=true){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new me(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return de(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return !this.required&&!this.optional&&!this.negate}},W=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t);}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i);});}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return true;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:false;return t.negate===(s===e)}};function de(h){return h.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function pe(h){let e,t,i=h.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}j.Option=I;j.DualOptions=W;});var z=b$1(K=>{function fe(h,e){if(Math.abs(h.length-e.length)>3)return Math.max(h.length,e.length);let t=[];for(let i=0;i<=h.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=h.length;n++){let s=1;h[n-1]===e[i-1]?s=0:s=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+s),n>1&&i>1&&h[n-1]===e[i-2]&&h[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1));}return t[h.length][e.length]}function ge(h,e){if(!e||e.length===0)return "";e=Array.from(new Set(e));let t=h.startsWith("--");t&&(h=h.slice(2),e=e.map(r=>r.slice(2)));let i=[],n=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let a=fe(h,r),o=Math.max(h.length,r.length);(o-a)/o>s&&(a<n?(n=a,i=[r]):a===n&&i.push(r));}),i.sort((r,a)=>r.localeCompare(a)),t&&(i=i.map(r=>`--${r}`)),i.length>1?`
10
- (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
11
- (Did you mean ${i[0]}?)`:""}K.suggestSimilar=ge;});var ee=b$1(Z=>{var _e=a("events").EventEmitter,U=a("child_process"),g=a("path"),L=a("fs"),m=a("process"),{Argument:Oe,humanReadableArgName:Ce}=E(),{CommanderError:R}=b(),{Help:Ae}=F(),{Option:Y,DualOptions:be}=M(),{suggestSimilar:Q}=z(),G=class h extends _e{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=false,this._allowExcessArguments=true,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=false,this._actionHandler=null,this._executableHandler=false,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=true,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=false,this._passThroughOptions=false,this._lifeCycleHooks={},this._showHelpAfterError=false,this._showSuggestionAfterError=true,this._outputConfiguration={writeOut:t=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=false,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={};}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,a]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(r);return n&&(o.description(n),o._executableHandler=true),s.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(s.noHelp||s.hidden),o._executableFile=s.executableFile||null,a&&o.arguments(a),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),n?this:o}createCommand(e){return new h(e)}createHelp(){return Object.assign(new Ae,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=true){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=true){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=true),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Oe(e,t)}argument(e,t,i,n){let s=this.createArgument(e,t);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t);}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",r=this.createCommand(i);return r.helpOption(false),n&&r.arguments(n),s&&r.description(s),this._addImplicitHelpCommand=true,this._helpCommand=r,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=true,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new R(e,t,i)),m.exit(e);}action(e){let t=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Y(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code});}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
- - already used by option '${t.flags}'`)}this.options.push(e);}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e);}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?true:e.defaultValue,"default");}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(s,r,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let o=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,o,r):s!==null&&e.variadic&&(s=e._concatValue(s,o)),s==null&&(e.negate?s=false:e.isBoolean()||e.optional?s=true:s=""),this.setOptionValueWithSource(i,s,a);};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,r,"cli");}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,r,"env");}),this}_optionEx(e,t,i,n,s){if(typeof t=="object"&&t instanceof Y)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,i);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(o,l)=>{let u=a.exec(o);return u?u[0]:l},r.default(s).argParser(n);}else r.default(n);return this.addOption(r)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:true},e,t,i,n)}combineFlagAndOptionalValue(e=true){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=true){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=true){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=true){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=true){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=true){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e));}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){m.versions?.electron&&(t.from="electron");let n=m.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval");}e===void 0&&(e=m.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case "node":this._scriptPath=e[1],i=e.slice(2);break;case "electron":m.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case "user":i=e.slice(0);break;case "eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return !this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=false,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,c){let p=g.resolve(u,c);if(L.existsSync(p))return p;if(n.includes(g.extname(c)))return;let O=n.find(d=>L.existsSync(`${p}${d}`));if(O)return `${p}${O}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=L.realpathSync(this._scriptPath);}catch{u=this._scriptPath;}a=g.resolve(g.dirname(u),a);}if(a){let u=s(a,r);if(!u&&!e._executableFile&&this._scriptPath){let c=g.basename(this._scriptPath,g.extname(this._scriptPath));c!==this._name&&(u=s(a,`${c}-${e._name}`));}r=u||r;}i=n.includes(g.extname(r));let o;m.platform!=="win32"?i?(t.unshift(r),t=X(m.execArgv).concat(t),o=U.spawn(m.argv[0],t,{stdio:"inherit"})):o=U.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=X(m.execArgv).concat(t),o=U.spawn(m.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{m.on(c,()=>{o.killed===false&&o.exitCode===null&&o.kill(c);});});let l=this._exitCallback;o.on("close",u=>{u=u??1,l?l(new R(u,"commander.executeSubCommandAsync","(close)")):m.exit(u);}),o.on("error",u=>{if(u.code==="ENOENT"){let c=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",p=`'${r}' does not exist
15
- - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
- - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${c}`;throw new Error(p)}else if(u.code==="EACCES")throw new Error(`'${r}' not executable`);if(!l)m.exit(1);else {let c=new R(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,l(c);}}),this.runningCommand=o;}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:true});let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name());}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args);}_processArguments(){let e=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,a);}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,a)=>e(i,a,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=e(i,s,i.defaultValue))),t[n]=s;}),this.processedArgs=t;}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:s,callback:r});});}),t==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this));}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t));}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:true}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0]);},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t);})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments());}else this.commands.length?(n(),this.help({error:true})):(n(),this._processArguments());}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t);});});}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?false:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n);});}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions();});}parseOptions(e){let t=[],i=[],n=t,s=e.slice();function r(o){return o.length>1&&o[0]==="-"}let a=null;for(;s.length;){let o=s.shift();if(o==="--"){n===i&&n.push(o),n.push(...s);break}if(a&&!r(o)){this.emit(`option:${a.name()}`,o);continue}if(a=null,r(o)){let l=this._findOption(o);if(l){if(l.required){let u=s.shift();u===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,u);}else if(l.optional){let u=null;s.length>0&&!r(s[0])&&(u=s.shift()),this.emit(`option:${l.name()}`,u);}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let l=this._findOption(`-${o[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,o.slice(2)):(this.emit(`option:${l.name()}`),s.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let l=o.indexOf("="),u=this._findOption(o.slice(0,l));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,o.slice(l+1));continue}}if(r(o)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(o)){t.push(o),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){t.push(o),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(o),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(o),s.length>0&&n.push(...s);break}n.push(o);}return {operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n];}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
- `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
- `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:true}));let i=t||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,e);}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`));}});}_parseOptionsImplied(){let e=new be(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied");});});}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"});}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"});}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"});}_conflictingOption(e,t){let i=r=>{let a=r.attributeName(),o=this.getOptionValue(a),l=this.options.find(c=>c.negate&&a===c.attributeName()),u=this.options.find(c=>!c.negate&&a===c.attributeName());return l&&(l.presetArg===void 0&&o===false||l.presetArg!==void 0&&o===l.presetArg)?l:u||r},n=r=>{let a=i(r),o=a.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"});}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(r),s=s.parent;}while(s&&!s._enablePositionalOptions);t=Q(e,n);}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"});}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"});}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias());}),t=Q(e,n);}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"});}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),this._exit(0,"commander.version",e);}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>Ce(i));return [].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=g.basename(e,g.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i));}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=m.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)");}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
- Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let r;typeof t=="function"?r=t({error:s.error,command:s.command}):r=t,r&&s.write(`${r}
23
- `);}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"));}};function X(h){return h.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return (s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}Z.Command=G;});var se=b$1(f=>{var{Argument:te}=E(),{Command:B}=ee(),{CommanderError:we,InvalidArgumentError:ie}=b(),{Help:Ee}=F(),{Option:ne}=M();f.program=new B;f.createCommand=h=>new B(h);f.createOption=(h,e)=>new ne(h,e);f.createArgument=(h,e)=>new te(h,e);f.Command=B;f.Option=ne;f.Argument=te;f.Help=Ee;f.CommanderError=we;f.InvalidArgumentError=ie;f.InvalidOptionArgumentError=ie;});var re=d(se(),1),{program:qe,createCommand:De,createArgument:Fe,createOption:Ie,CommanderError:We,InvalidArgumentError:je,InvalidOptionArgumentError:Me,Command:oe,Argument:Ue,Option:Le,Help:Re}=re.default;async function ae(h){let e=h?.toLowerCase()??"all";try{let t=await ye(e);console.log(JSON.stringify(t,null,2)),process.exit(0);}catch(t){console.error(JSON.stringify({error:t instanceof Error?t.message:"Unknown error"})),process.exit(1);}}async function ye(h$1){switch(h$1){case "skills":return d$1();case "agents":return e();case "commands":return f();case "hooks":return g();case "mcp":return h();case "plugins":return i();case "settings":return c();default:return xe()}}async function xe(){let[h$1,e$1,t,i$1,n,s,r]=await Promise.all([c(),d$1(),e(),f(),g(),h(),i()]);return {settings:h$1,skills:e$1,agents:t,commands:i$1,plugins:r,hooks:n,mcpServers:s,outputStyles:[]}}var $e=new oe().name("claudecode-dashboard").description("View Claude Code configurations").version("1.0.0").argument("[category]","Category to show (skills, agents, commands, hooks, mcp, plugins, settings)").option("-j, --json","Output as JSON instead of TUI").action(async(h,e)=>{e.json?await ae(h||"all"):await ve(h);});async function ve(h){let{render:e}=await import('./build-ATVYGQFJ.js'),t=await import('./react-JYLNFGAJ.js'),{App:i}=await import('./app-ALZQA2MU.js');e(t.createElement(i,{initialCategory:h}));}$e.parse();
2
+ import {homedir}from'os';import {join}from'path';import {readFile,readdir,mkdir,appendFile,writeFile,stat}from'fs/promises';import {existsSync}from'fs';import {useApp,useStdout,useInput,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';import wr from'openai';import vr from'@anthropic-ai/sdk';import {useState,useCallback,useEffect,useMemo}from'react';import ft from'ink-spinner';import {Command}from'commander';var Nt=Object.defineProperty;var d=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ut=(t,e)=>{for(var r in e)Nt(t,r,{get:e[r],enumerable:true});};function S(){return join(homedir(),".claude")}function Bt(){return join(homedir(),".claude.json")}var b,E=d(()=>{b={userSettings:()=>join(S(),"settings.json"),userSettingsLocal:()=>join(S(),"settings.local.json"),userMemory:()=>join(S(),"CLAUDE.md"),userSkills:()=>join(S(),"skills"),userAgents:()=>join(S(),"agents"),userCommands:()=>join(S(),"commands"),userHooks:()=>join(S(),"hooks"),userOutputStyles:()=>join(S(),"output-styles"),userPlugins:()=>join(S(),"plugins"),metadata:()=>join(S(),"metadata.json"),history:()=>join(S(),"history.jsonl"),todos:()=>join(S(),"todos"),projects:()=>join(S(),"projects"),claudeJson:()=>Bt()};});function $e(){return De}var ne,oe,ie,De,Vt,l,k=d(()=>{ne=class{name="memory";entries=[];listeners=new Set;maxEntries;constructor(e=100){this.maxEntries=e;}write(e){this.entries.push(e),this.entries.length>this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries)),this.notifyListeners();}getEntries(){return [...this.entries]}getRecent(e){return this.entries.slice(-e)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}clear(){this.entries=[],this.notifyListeners();}notifyListeners(){let e=this.getEntries();this.listeners.forEach(r=>r(e));}},oe=class{name="file";logDir;logFile;buffer=[];flushInterval=null;initialized=false;constructor(e){this.logDir=e||join(homedir(),".claude","claudecode-dashboard","logs");let r=new Date().toISOString().split("T")[0];this.logFile=join(this.logDir,`${r}.jsonl`);}async ensureDir(){this.initialized||(existsSync(this.logDir)||await mkdir(this.logDir,{recursive:true}),this.initialized=true);}async write(e){let r=JSON.stringify({ts:e.timestamp.toISOString(),lvl:e.level,src:e.source,msg:e.message,...e.meta&&{meta:e.meta}});this.buffer.push(r),(e.level==="error"||this.buffer.length>=10)&&await this.flush();}async flush(){if(this.buffer.length===0)return;await this.ensureDir();let e=this.buffer.join(`
3
+ `)+`
4
+ `;this.buffer=[],await appendFile(this.logFile,e);}startAutoFlush(e=5e3){this.flushInterval||(this.flushInterval=setInterval(()=>this.flush(),e));}stopAutoFlush(){this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null);}},ie=class{sinks=[];minLevel="info";levelOrder={debug:0,info:1,warn:2,error:3};addSink(e){this.sinks.push(e);}removeSink(e){this.sinks=this.sinks.filter(r=>r.name!==e);}getSink(e){return this.sinks.find(r=>r.name===e)}setMinLevel(e){this.minLevel=e;}shouldLog(e){return this.levelOrder[e]>=this.levelOrder[this.minLevel]}log(e,r,n,a){if(!this.shouldLog(e))return;let o={level:e,source:r,message:n,timestamp:new Date,meta:a};for(let s of this.sinks)try{s.write(o);}catch{}}debug(e,r,n){this.log("debug",e,r,n);}info(e,r,n){this.log("info",e,r,n);}warn(e,r,n){this.log("warn",e,r,n);}error(e,r,n){this.log("error",e,r,n);}async flush(){for(let e of this.sinks)e.flush&&await e.flush();}},De=new ne(100),Vt=new oe,l=new ie;l.addSink(De);l.addSink(Vt);});async function F(){let t=b.userSettings();if(!existsSync(t))return null;try{let e=await readFile(t,"utf-8");return JSON.parse(e)}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("settings",`Failed to parse ${t}: ${r}`),null}}var Oe=d(()=>{E();k();});function Gt(t){let e=t.match(/^---\n([\s\S]*?)\n---/);if(!e)return {};let r=e[1],n={};for(let a of r.split(`
5
+ `)){let[o,...s]=a.split(":"),i=s.join(":").trim();o==="name"&&(n.name=i),o==="description"&&(n.description=i),o==="allowed-tools"&&(n.allowedTools=i.split(",").map(c=>c.trim())),o==="model"&&(n.model=i);}return n}async function N(){let t=b.userSkills();if(!existsSync(t))return [];try{let e=await readdir(t,{withFileTypes:!0}),r=[];for(let n of e){if(!n.isDirectory())continue;let a=join(t,n.name,"SKILL.md");if(existsSync(a))try{let o=await readFile(a,"utf-8"),s=Gt(o);r.push({name:s.name||n.name,description:s.description,allowedTools:s.allowedTools,model:s.model,source:"user",path:a});}catch(o){let s=o instanceof Error?o.message:"Unknown error";l.warn("skills",`Failed to read skill ${n.name}: ${s}`);}}return r}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("skills",`Failed to read skills directory: ${r}`),[]}}var je=d(()=>{E();k();});function rr(t){let e=t.match(/^---\n([\s\S]*?)\n---/);if(!e)return {};let r=e[1],n={};for(let a of r.split(`
6
+ `)){let[o,...s]=a.split(":"),i=s.join(":").trim();o==="name"&&(n.name=i),o==="description"&&(n.description=i),o==="tools"&&(n.tools=i.split(",").map(c=>c.trim())),o==="model"&&(n.model=i),o==="permissionMode"&&(n.permissionMode=i),o==="skills"&&(n.skills=i.split(",").map(c=>c.trim()));}return n}async function U(){let t=b.userAgents();if(!existsSync(t))return [];try{let e=await readdir(t),r=[];for(let n of e){if(!n.endsWith(".md"))continue;let a=join(t,n);try{let o=await readFile(a,"utf-8"),s=rr(o),i=s.name||n.replace(".md","");r.push({name:i,description:s.description,tools:s.tools,model:s.model,permissionMode:s.permissionMode,skills:s.skills,source:"user",path:a});}catch(o){let s=o instanceof Error?o.message:"Unknown error";l.warn("agents",`Failed to read agent ${n}: ${s}`);}}return r}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("agents",`Failed to read agents directory: ${r}`),[]}}var Fe=d(()=>{E();k();});function ar(t){let e=t.match(/^---\n([\s\S]*?)\n---/);if(!e)return {};let r=e[1],n={};for(let a of r.split(`
7
+ `)){let[o,...s]=a.split(":"),i=s.join(":").trim();o==="description"&&(n.description=i),o==="argument-hint"&&(n.argumentHint=i),o==="allowed-tools"&&(n.allowedTools=i.split(",").map(c=>c.trim())),o==="model"&&(n.model=i);}return n}async function B(){let t=b.userCommands();if(!existsSync(t))return [];try{let e=await readdir(t,{recursive:!0}),r=[];for(let n of e){let a=String(n);if(!a.endsWith(".md"))continue;let o=join(t,a);try{let s=await readFile(o,"utf-8"),i=ar(s),c=a.replace(/\.md$/,"").replace(/[\/\\]/g,":");r.push({name:c,description:i.description,argumentHint:i.argumentHint,allowedTools:i.allowedTools,model:i.model,source:"user",path:o});}catch(s){let i=s instanceof Error?s.message:"Unknown error";l.warn("commands",`Failed to read command ${a}: ${i}`);}}return r}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("commands",`Failed to read commands directory: ${r}`),[]}}var Ne=d(()=>{E();k();});async function H(){let t=b.userSettings();if(!existsSync(t))return [];try{let e=await readFile(t,"utf-8"),r=JSON.parse(e);if(!r.hooks)return [];let n=[];for(let[a,o]of Object.entries(r.hooks))for(let s of o)for(let i of s.hooks)n.push({event:a,matcher:s.matcher,type:i.type,command:i.command,prompt:i.prompt,timeout:i.timeout,source:"user"});return n}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("hooks",`Failed to parse hooks from settings: ${r}`),[]}}var Ue=d(()=>{E();k();});function le(t,e){return Object.entries(t).map(([r,n])=>({name:r,type:n.type||(n.command?"stdio":"http"),url:n.url,command:n.command,args:n.args,env:n.env,scope:e}))}async function _(){let t=[],e=join(homedir(),".claude.json");if(existsSync(e))try{let a=await readFile(e,"utf-8"),o=JSON.parse(a);o.mcpServers&&Object.keys(o.mcpServers).length>0&&t.push(...le(o.mcpServers,"user"));}catch(a){let o=a instanceof Error?a.message:"Unknown error";l.error("mcp",`Failed to parse ~/.claude.json: ${o}`);}let r=join(homedir(),".mcp.json");if(existsSync(r))try{let a=await readFile(r,"utf-8"),o=JSON.parse(a);if(o.mcpServers){let s=new Set(t.map(c=>c.name)),i=le(o.mcpServers,"user").filter(c=>!s.has(c.name));t.push(...i);}}catch(a){let o=a instanceof Error?a.message:"Unknown error";l.error("mcp",`Failed to parse ~/.mcp.json: ${o}`);}let n=join(process.cwd(),".mcp.json");if(existsSync(n))try{let a=await readFile(n,"utf-8"),o=JSON.parse(a);o.mcpServers&&t.push(...le(o.mcpServers,"project"));}catch(a){let o=a instanceof Error?a.message:"Unknown error";l.error("mcp",`Failed to parse ./.mcp.json: ${o}`);}return t}var He=d(()=>{k();});async function J(){let t=b.userPlugins();if(!existsSync(t))return [];try{let e=await readdir(t,{withFileTypes:!0}),r=[];for(let n of e){if(!n.isDirectory())continue;let a=join(t,n.name),o=join(a,"plugin.json");if(existsSync(o))try{let s=await readFile(o,"utf-8"),i=JSON.parse(s),c=u=>u?Array.isArray(u)?u:[u]:[];r.push({name:i.name||n.name,version:i.version,description:i.description,enabled:!0,path:a,commands:c(i.commands),agents:c(i.agents),skills:c(i.skills),hooks:i.hooks?[i.hooks]:[],mcpServers:i.mcpServers?[i.mcpServers]:[]});}catch(s){let i=s instanceof Error?s.message:"Unknown error";l.warn("plugins",`Failed to read plugin ${n.name}: ${i}`);}}return r}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.error("plugins",`Failed to read plugins directory: ${r}`),[]}}var Ke=d(()=>{E();k();});var me=d(()=>{E();Oe();je();Fe();Ne();Ue();He();Ke();});function We({categories:t,selected:e,focused:r}){return jsxs(Box,{flexDirection:"column",children:[jsx(Text,{bold:true,underline:true,children:"CATEGORIES"}),jsx(Box,{marginTop:1,flexDirection:"column",children:t.map((n,a)=>{let o=a===e;return o&&r?jsxs(Text,{bold:true,underline:true,children:["\u25B8 ",n.label," ",jsx(Text,{bold:true,children:n.count})]},n.key):o?jsxs(Text,{bold:true,children:["\u203A ",n.label," ",jsx(Text,{dimColor:true,children:n.count})]},n.key):jsxs(Text,{dimColor:true,children:[" ",n.label," ",jsx(Text,{dimColor:true,children:n.count})]},n.key)})})]})}var Ye=d(()=>{});function qe({items:t,selected:e,focused:r,maxHeight:n=15}){if(t.length===0)return jsxs(Box,{flexDirection:"column",children:[jsx(Text,{bold:true,underline:true,children:"ITEMS"}),jsx(Box,{marginTop:1,children:jsx(Text,{dimColor:true,italic:true,children:"No items"})})]});let a=Math.max(5,n-3),o=Math.max(0,Math.min(e-Math.floor(a/2),t.length-a)),s=t.slice(o,o+a);return jsxs(Box,{flexDirection:"column",children:[jsxs(Text,{bold:true,underline:true,children:["ITEMS (",t.length,")"]}),jsxs(Box,{marginTop:1,flexDirection:"column",children:[o>0&&jsxs(Text,{dimColor:true,children:["\u2191 ",o," more"]}),s.map((i,c)=>{let u=o+c,g=u===e,m=i.name.length>24?i.name.slice(0,21)+"...":i.name;return g&&r?jsxs(Text,{bold:true,underline:true,children:["\u25B8 ",m]},`${i.name}-${u}`):g?jsxs(Text,{bold:true,children:["\u203A ",m]},`${i.name}-${u}`):jsxs(Text,{dimColor:true,children:[" ",m]},`${i.name}-${u}`)}),o+a<t.length&&jsxs(Text,{dimColor:true,children:["\u2193 ",t.length-o-a," more"]})]})]})}var Xe=d(()=>{});async function Ze(){existsSync(ge)||await mkdir(ge,{recursive:true});}async function de(){if(T)return T;if(await Ze(),!existsSync(pe))return T={version:1,entries:{}},T;try{let t=await readFile(pe,"utf-8");return T=JSON.parse(t),T}catch(t){let e=t instanceof Error?t.message:"Unknown error";return l.warn("cache",`Failed to load cache, starting fresh: ${e}`),T={version:1,entries:{}},T}}async function fe(){if(T)try{await Ze(),await writeFile(pe,JSON.stringify(T,null,2));}catch(t){let e=t instanceof Error?t.message:"Unknown error";l.error("cache",`Failed to save cache: ${e}`);}}async function et(t){try{return (await stat(t)).mtimeMs}catch(e){let r=e instanceof Error?e.message:"Unknown error";return l.warn("cache",`Failed to get mtime for ${t}: ${r}`),0}}async function he(t){let e=await de(),r=e.entries[t];return r?await et(t)!==r.mtime?(delete e.entries[t],await fe(),null):r.summary:null}async function ye(t,e){let r=await de(),n=await et(t);r.entries[t]={summary:e,mtime:n,generatedAt:Date.now()},await fe();}async function xe(t){let e=await de();return e.entries[t]?(delete e.entries[t],await fe(),l.info("cache",`Cache cleared for: ${t}`),true):false}var ge,pe,T,we=d(()=>{k();ge=join(homedir(),".claude","claudecode-dashboard"),pe=join(ge,"cache.json"),T=null;});function ee(){return process.env.ANTHROPIC_API_KEY?"anthropic":process.env.OPENAI_API_KEY?"openai":"none"}function V(){let t=ee();switch(t){case "anthropic":return {provider:t,description:`Claude AI (${Se})`};case "openai":return {provider:t,description:`OpenAI (${ve})`};case "none":return {provider:t,description:"Set ANTHROPIC_API_KEY or OPENAI_API_KEY for AI summaries"}}}function br(){if(Q)return Q;let t=process.env.OPENAI_API_KEY;return t?(Q=new wr({apiKey:t}),Q):null}function Cr(){if(Z)return Z;let t=process.env.ANTHROPIC_API_KEY;return t?(Z=new vr({apiKey:t}),Z):null}function Tr(t){return t.replace(/\|/g,"\u2502").replace(/─{3,}/g,"\u2500\u2500\u2500")}function Lr(t,e=tt){let r=t.split(`
8
+ `),n=r.slice(0,e);if(n[0]==="---"){let s=n.findIndex((i,c)=>c>0&&i==="---");s>0&&n.splice(0,s+1);}let a=r.length<=e,o=n.join(`
9
+ `).trim();return o=Tr(o),a?o+=`
10
+ \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
11
+ <EOF>`:o+=`
12
+ \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
13
+ ... (${r.length-e} more lines)`,{text:o,isEOF:a}}async function Er(t,e){let r=ee(),n=`You are a senior engineer reviewing this Claude Code ${e}.
14
+
15
+ Provide a structured analysis (keep it concise, ~500 words max):
16
+
17
+ **What it does:** 2-3 sentences explaining the core functionality and behavior.
18
+
19
+ **Key details:**
20
+ - Implementation: How it works technically (tools, patterns, integrations)
21
+ - Trigger: When/how it activates (events, commands, conditions)
22
+ - Scope: What it affects (files, sessions, permissions)
23
+
24
+ **Engineering notes:** 1-2 practical tips or gotchas.
25
+
26
+ Be specific and technical. Include actual values from the config. Ensure your response is COMPLETE - do not cut off mid-sentence.`,a=t.slice(0,4e3);if(r==="anthropic"){let o=Cr();if(!o)throw l.error("ai","Anthropic client initialization failed"),new Error("Anthropic client init failed");try{let i=(await o.messages.create({model:Se,max_tokens:1e3,messages:[{role:"user",content:`${n}
27
+
28
+ ${a}`}]})).content.find(c=>c.type==="text");if(i?.type==="text")return l.info("ai",`Generated summary using ${Se}`),i.text.trim();throw l.error("ai","No text in Anthropic response"),new Error("No text in Anthropic response")}catch(s){let i=s instanceof Error?s.message:"Unknown error";throw l.error("ai",`Anthropic API error: ${i}`),s}}if(r==="openai"){let o=br();if(!o)throw l.error("ai","OpenAI client initialization failed"),new Error("OpenAI client init failed");try{let i=(await o.chat.completions.create({model:ve,messages:[{role:"system",content:n},{role:"user",content:a}],max_tokens:1e3,temperature:.3})).choices[0]?.message?.content?.trim();if(i)return l.info("ai",`Generated summary using ${ve}`),i;throw l.error("ai","No text in OpenAI response"),new Error("No text in OpenAI response")}catch(s){let i=s instanceof Error?s.message:"Unknown error";throw l.error("ai",`OpenAI API error: ${i}`),s}}throw l.warn("ai","No AI provider configured"),new Error("No AI provider configured")}async function ke(t,e){if(!existsSync(t))return l.warn("summary",`File not found: ${t}`),{aiSummary:null,preview:"[File not found]"};let r;try{r=await readFile(t,"utf-8");}catch(s){let i=s instanceof Error?s.message:"Unknown error";return l.error("summary",`Failed to read file ${t}: ${i}`),{aiSummary:null,preview:"[Failed to read file]"}}let n=Lr(r),a=await he(t);if(a)return l.info("summary",`Using cached summary for ${t}`),{aiSummary:a,preview:n.text};if(ee()!=="none")try{let s=await Er(r,e);return await ye(t,s),{aiSummary:s,preview:n.text}}catch(s){let i=s instanceof Error?s.message:"Unknown error";return {aiSummary:null,preview:n.text,aiError:i}}return {aiSummary:null,preview:n.text}}var ve,Se,Q,Z,tt,rt=d(()=>{we();k();ve="gpt-4o-mini",Se="claude-haiku-4-5-latest",Q=null,Z=null;tt=30;});var be=d(()=>{rt();we();});function ot(t,e){let[r,n]=useState(null),[a,o]=useState(null),[s,i]=useState(null),[c,u]=useState(false),[g,m]=useState(null),x=V(),v=useCallback(async()=>{if(!t){n(null),o(null),i(null);return}u(true),m(null),o(null);try{let y=await ke(t,e);n(y.aiSummary),o(y.aiError||null),i(y.preview);}catch(y){let I=y instanceof Error?y.message:"Failed to load";l.error("summary-hook",`Failed to load summary: ${I}`),m(I);}finally{u(false);}},[t,e]),j=useCallback(async()=>{t&&(l.info("summary-hook",`Regenerating summary for: ${t}`),await xe(t),await v());},[t,v]);return useEffect(()=>{v();},[v]),{aiSummary:r,aiError:a,preview:s,loading:c,error:g,provider:x.provider,providerDescription:x.description,refresh:v,regenerate:j}}var it=d(()=>{be();k();});function mt({tabs:t,activeTab:e,onTabChange:r,disabled:n}){return useInput((a,o)=>{if(n)return;let s=t.findIndex(i=>i.key===e);if(s!==-1){if(o.tab&&!o.shift){let i=(s+1)%t.length;r(t[i].key);}else if(o.tab&&o.shift){let i=(s-1+t.length)%t.length;r(t[i].key);}}}),jsxs(Box,{children:[t.map(a=>{let o=a.key===e;return jsx(Box,{marginRight:1,children:jsxs(Text,{bold:o,color:o?"cyan":void 0,dimColor:!o,children:["[",o?"\u25CF":" ","] ",a.label]})},a.key)}),jsx(Text,{dimColor:true,children:" (Tab \u2194)"})]})}var ut=d(()=>{});function pt({content:t,maxLines:e=8,width:r,disabled:n}){let[a,o]=useState(false),{truncated:s,needsTruncation:i,totalVisualLines:c}=useMemo(()=>{let g=Math.max(20,r-2),m=$r(t,g);return m.length<=e?{truncated:t,needsTruncation:false,totalVisualLines:m.length}:{truncated:m.slice(0,e).join(`
29
+ `),needsTruncation:true,totalVisualLines:m.length}},[t,e,r]);useInput((g,m)=>{n||m.return&&i&&o(x=>!x);});let u=c-e;return i?jsxs(Box,{flexDirection:"column",children:[jsx(Text,{wrap:"wrap",children:a?t:s}),jsx(Box,{marginTop:1,children:jsx(Text,{color:"cyan",children:a?"[Enter: See less \u2191]":`[Enter: See more... +${u} lines]`})})]}):jsx(Text,{wrap:"wrap",children:t})}function $r(t,e){let r=t.split(`
30
+ `),n=[];for(let a of r){if(a.length===0){n.push("");continue}if(a.length<=e){n.push(a);continue}let o=a.split(" "),s="";for(let i of o){let c=s?`${s} ${i}`:i;if(c.length<=e)s=c;else if(s&&n.push(s),i.length>e){let u=i;for(;u.length>e;)n.push(u.slice(0,e)),u=u.slice(e);s=u;}else s=i;}s&&n.push(s);}return n}var dt=d(()=>{});function ht({item:t,width:e,maxHeight:r=30,category:n}){let[a,o]=useState("preview"),s=t?.path,i=n||"configuration",{aiSummary:c,aiError:u,preview:g,loading:m,provider:x,regenerate:v}=ot(s,i);if(useInput(q=>{(q==="r"||q==="R")&&a==="summary"&&!m&&v();}),!t)return jsxs(Box,{flexDirection:"column",paddingX:1,children:[jsx(Text,{bold:true,underline:true,children:"DETAILS"}),jsx(Text,{dimColor:true,italic:true,children:"Select an item to view details"})]});let j="\u2500".repeat(Math.max(10,e-4)),y=yt(t),re=Math.max(5,r-y-6);return jsxs(Box,{flexDirection:"column",paddingX:1,children:[jsx(Text,{bold:true,underline:true,children:"DETAILS"}),jsxs(Box,{marginTop:1,flexDirection:"column",children:[jsx(Text,{color:"green",bold:true,children:"Properties:"}),xt(t,1,e-4)]}),s&&jsxs(Box,{marginTop:1,flexDirection:"column",children:[jsx(Text,{dimColor:true,children:j}),jsx(Box,{marginTop:1,children:jsx(mt,{tabs:Fr,activeTab:a,onTabChange:q=>o(q)})}),jsx(Box,{marginTop:1,flexDirection:"column",minHeight:re,children:a==="preview"?jsx(Nr,{preview:g,loading:m,maxLines:re,width:e-6}):jsx(Ur,{summary:c,error:u,loading:m,provider:x,maxLines:re-2,width:e-6})})]})]})}function Nr({preview:t,loading:e,maxLines:r,width:n}){if(e)return jsxs(Text,{color:"cyan",children:[jsx(ft,{type:"dots"})," Loading preview..."]});if(!t)return jsx(Text,{dimColor:true,italic:true,children:"No content available"});let a=Br(t,r,n);return jsx(Text,{children:a})}function Ur({summary:t,error:e,loading:r,provider:n,maxLines:a,width:o}){return n==="none"?jsxs(Box,{flexDirection:"column",children:[jsx(Text,{dimColor:true,italic:true,children:"AI Summary not configured"}),jsx(Text,{dimColor:true,children:"Export ANTHROPIC_API_KEY or OPENAI_API_KEY to enable"})]}):r?jsxs(Text,{color:"cyan",children:[jsx(ft,{type:"dots"})," Generating summary..."]}):e?jsxs(Text,{color:"red",children:["Error: ",e]}):t?jsxs(Box,{flexDirection:"column",children:[jsx(pt,{content:t,maxLines:a-1,width:o}),jsx(Text,{dimColor:true,children:" (R: regenerate)"})]}):jsx(Text,{dimColor:true,italic:true,children:"No summary available"})}function yt(t){let e=0;for(let[,r]of Object.entries(t))r!=null&&(e++,typeof r=="object"&&!Array.isArray(r)?e+=yt(r):Array.isArray(r)&&r.length>0&&typeof r[0]=="object"&&(e+=Math.min(r.length,3),r.length>3&&e++));return e}function Br(t,e,r){let n=t.split(`
31
+ `),a=n[n.length-1]||"",o=a.includes("<EOF>"),s=a.includes("... (")&&a.includes("more lines)"),i=n.length>=2&&n[n.length-2]?.startsWith("\u2500\u2500\u2500"),c=o||s?i?2:1:0,u=e-c,g=[],m=c>0?n.slice(0,-c):n;for(let v of m){if(g.length>=u)break;if(v.length<=r)g.push(v);else {let j=v.split(" "),y="";for(let I of j){if(g.length>=u)break;(y+" "+I).trim().length<=r?y=(y+" "+I).trim():(y&&g.push(y),y=I);}y&&g.length<u&&g.push(y);}}return g.length<m.length&&g.length>0&&(g[g.length-1]=g[g.length-1].slice(0,r-15)+"... [truncated]"),c>0&&(i&&c===2&&g.push(n[n.length-2]),g.push(a)),g.join(`
32
+ `)}function xt(t,e,r){let n=[],a=" ".repeat(e);for(let[o,s]of Object.entries(t))if(s!=null)if(typeof s=="object"&&!Array.isArray(s))n.push(jsxs(Text,{children:[a,jsxs(Text,{color:"yellow",children:[o,":"]})]},o)),n.push(...xt(s,e+1,r));else if(Array.isArray(s))if(s.length===0)n.push(jsxs(Text,{children:[a,jsxs(Text,{color:"yellow",children:[o,":"]})," ",jsx(Text,{dimColor:true,children:"[]"})]},o));else if(typeof s[0]=="object"&&s[0]!==null)n.push(jsxs(Text,{children:[a,jsxs(Text,{color:"yellow",children:[o,":"]})," ",jsxs(Text,{dimColor:true,children:["[",s.length," items]"]})]},o)),s.slice(0,3).forEach((i,c)=>{let u=i.name||i.event||i.command||`[${c}]`;n.push(jsxs(Text,{children:[a," ",jsxs(Text,{dimColor:true,children:["\u2022 ",String(u).slice(0,r-e*2-6)]})]},`${o}-${c}`));}),s.length>3&&n.push(jsxs(Text,{children:[a," ",jsxs(Text,{dimColor:true,children:["... +",s.length-3," more"]})]},`${o}-more`));else {let i=s.length>5?`[${s.slice(0,5).join(", ")}... +${s.length-5}]`:`[${s.join(", ")}]`;n.push(jsxs(Text,{children:[a,jsxs(Text,{color:"yellow",children:[o,":"]})," ",i]},o));}else {let i=String(s),c=r-a.length-o.length-3,u=i.length>c?i.slice(0,c-3)+"...":i;n.push(jsxs(Text,{children:[a,jsxs(Text,{color:"yellow",children:[o,":"]})," ",u]},o));}return n}var Fr,wt=d(()=>{it();ut();dt();Fr=[{key:"preview",label:"Preview"},{key:"summary",label:"AI Summary"}];});function kt(){let{provider:t,description:e}=V(),r=t!=="none";return jsxs(Box,{borderStyle:"single",paddingX:1,justifyContent:"space-between",children:[jsx(Text,{dimColor:true,children:"\u2191\u2193 Navigate \u2190\u2192 Switch r Refresh q Quit"}),jsx(Text,{color:r?"green":"yellow",children:r?`\u25CF ${e}`:`\u25CB ${e}`})]})}var bt=d(()=>{be();});function Ct(t=10){let e=$e(),[r,n]=useState(()=>e.getRecent(t));return useEffect(()=>e.subscribe(o=>{n(o.slice(-t));}),[t,e]),r}var Tt=d(()=>{k();});function zr(t){switch(t){case "error":return "red";case "warn":return "yellow";case "info":return "cyan";case "debug":return "gray"}}function Wr(t){switch(t){case "error":return "\u2717";case "warn":return "\u26A0";case "info":return "\u2022";case "debug":return "\u25CB"}}function Yr(t){return t.toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Lt({height:t=5}){let e=Ct(t-1);return jsxs(Box,{flexDirection:"column",height:t,borderStyle:"single",borderColor:"gray",paddingX:1,children:[jsx(Text,{bold:true,dimColor:true,children:"LOG"}),e.length===0?jsx(Text,{dimColor:true,italic:true,children:"No logs yet"}):e.map((r,n)=>jsxs(Text,{wrap:"truncate",children:[jsx(Text,{dimColor:true,children:Yr(r.timestamp)})," ",jsx(Text,{color:zr(r.level),children:Wr(r.level)})," ",jsxs(Text,{dimColor:true,children:["[",r.source,"]"]})," ",jsx(Text,{color:r.level==="error"?"red":void 0,children:r.message})]},n))]})}var Et=d(()=>{Tt();});function At({config:t,nav:e,width:r,height:n}){let s=r-22-30-6,i=6,c=Math.max(10,n-6-i);return jsxs(Box,{flexDirection:"column",width:r,children:[jsxs(Box,{borderStyle:"single",paddingX:1,children:[jsx(Text,{bold:true,color:"cyan",children:"ClaudeCode Dashboard"}),jsx(Box,{flexGrow:1}),jsx(Text,{dimColor:true,children:"Claude Code Config Viewer"})]}),jsxs(Box,{height:c,children:[jsx(Box,{flexDirection:"column",width:22,borderStyle:"single",paddingX:1,children:jsx(We,{categories:e.categories,selected:e.categoryIndex,focused:e.panel==="category"})}),jsx(Box,{flexDirection:"column",width:30,borderStyle:"single",paddingX:1,children:jsx(qe,{items:e.currentItems,selected:e.itemIndex,focused:e.panel==="item",maxHeight:c-4})}),jsx(Box,{flexDirection:"column",width:s,borderStyle:"single",children:jsx(ht,{item:e.selectedItem,width:s,maxHeight:c-2,category:e.categories[e.categoryIndex]?.key})})]}),jsx(Lt,{height:i}),jsx(kt,{})]})}var It=d(()=>{Ye();Xe();wt();bt();Et();});function Mt(){let[t,e]=useState({settings:null,skills:[],agents:[],commands:[],plugins:[],hooks:[],mcpServers:[],outputStyles:[]}),[r,n]=useState(true),[a,o]=useState(null),s=useCallback(async()=>{n(true),l.info("config","Loading configurations...");try{let[i,c,u,g,m,x,v]=await Promise.all([F(),N(),U(),B(),H(),_(),J()]);e({settings:i,skills:c,agents:u,commands:g,plugins:v,hooks:m,mcpServers:x,outputStyles:[]}),o(null),l.info("config",`Loaded: ${c.length} skills, ${u.length} agents, ${g.length} commands`);}catch(i){let c=i instanceof Error?i.message:"Failed to load config";l.error("config",`Load failed: ${c}`),o(c);}finally{n(false);}},[]);return useEffect(()=>{s();},[s]),{data:t,loading:r,error:a,refresh:s}}var Dt=d(()=>{me();k();});function Ot(t,e){let[r,n]=useState("category"),[a,o]=useState(()=>{if(!e)return 0;let m=["skills","agents","commands","hooks","mcp","plugins","settings"].indexOf(e);return m>=0?m:0}),[s,i]=useState(0),c=useMemo(()=>[{key:"skills",label:"Skills",count:t.data.skills.length},{key:"agents",label:"Agents",count:t.data.agents.length},{key:"commands",label:"Commands",count:t.data.commands.length},{key:"hooks",label:"Hooks",count:t.data.hooks.length},{key:"mcp",label:"MCP Servers",count:t.data.mcpServers.length},{key:"plugins",label:"Plugins",count:t.data.plugins.length},{key:"settings",label:"Settings",count:t.data.settings?1:0}],[t.data]),u=useMemo(()=>{let m=c[a];if(!m)return [];switch(m.key){case "skills":return t.data.skills;case "agents":return t.data.agents;case "commands":return t.data.commands;case "hooks":return t.data.hooks.map(x=>({...x,name:`${x.event}${x.matcher?`:${x.matcher}`:""}`}));case "mcp":return t.data.mcpServers;case "plugins":return t.data.plugins;case "settings":return t.data.settings?[{name:"Settings",...t.data.settings}]:[]}},[t.data,a,c]),g=u[s]??null;return {panel:r,categoryIndex:a,itemIndex:s,categories:c,currentItems:u,selectedItem:g,up:()=>{r==="category"?(o(m=>Math.max(0,m-1)),i(0)):i(m=>Math.max(0,m-1));},down:()=>{r==="category"?(o(m=>Math.min(c.length-1,m+1)),i(0)):i(m=>Math.min(u.length-1,m+1));},left:()=>n("category"),right:()=>n("item"),select:()=>{r==="category"&&n("item");},pageUp:()=>{r==="item"&&i(m=>Math.max(0,m-10));},pageDown:()=>{r==="item"&&i(m=>Math.min(u.length-1,m+10));}}}var Rt=d(()=>{});var jt={};Ut(jt,{App:()=>tn});function tn({initialCategory:t}){let{exit:e}=useApp(),{stdout:r}=useStdout(),n=Mt(),a=Ot(n,t);useInput((i,c)=>{i==="q"&&e(),i==="r"&&n.refresh(),(c.upArrow||i==="k")&&a.up(),(c.downArrow||i==="j")&&a.down(),(c.leftArrow||i==="h")&&a.left(),(c.rightArrow||i==="l")&&a.right(),c.return&&a.select(),(c.pageUp||i==="u")&&a.pageUp(),(c.pageDown||i==="d")&&a.pageDown();});let o=r?.columns??120,s=r?.rows??30;return o<80?jsxs(Box,{flexDirection:"column",padding:1,children:[jsxs(Text,{color:"yellow",children:["Terminal too narrow (",o," cols)"]}),jsx(Text,{children:"Minimum 80 columns required."}),jsx(Text,{dimColor:true,children:"Press q to quit."})]}):n.loading?jsxs(Box,{padding:1,children:[jsx(Text,{color:"cyan",children:jsx(ft,{type:"dots"})}),jsx(Text,{children:" Loading configurations..."})]}):n.error?jsxs(Box,{flexDirection:"column",padding:1,children:[jsxs(Text,{color:"red",children:["Error: ",n.error]}),jsx(Text,{dimColor:true,children:"Press r to retry, q to quit."})]}):jsx(At,{config:n.data,nav:a,width:Math.min(o,160),height:s})}var Ft=d(()=>{It();Dt();Rt();});me();async function Ve(t){let e=t?.toLowerCase()??"all";try{let r=await gr(e);console.log(JSON.stringify(r,null,2)),process.exit(0);}catch(r){console.error(JSON.stringify({error:r instanceof Error?r.message:"Unknown error"})),process.exit(1);}}async function gr(t){switch(t){case "skills":return N();case "agents":return U();case "commands":return B();case "hooks":return H();case "mcp":return _();case "plugins":return J();case "settings":return F();default:return pr()}}async function pr(){let[t,e,r,n,a,o,s]=await Promise.all([F(),N(),U(),B(),H(),_(),J()]);return {settings:t,skills:e,agents:r,commands:n,plugins:s,hooks:a,mcpServers:o,outputStyles:[]}}var nn=new Command().name("claudecode-dashboard").description("View Claude Code configurations").version("1.0.0").argument("[category]","Category to show (skills, agents, commands, hooks, mcp, plugins, settings)").option("-j, --json","Output as JSON instead of TUI").action(async(t,e)=>{e.json?await Ve(t||"all"):await on(t);});async function on(t){let{render:e}=await import('ink'),r=await import('react'),{App:n}=await Promise.resolve().then(()=>(Ft(),jt));e(r.createElement(n,{initialCategory:t}));}nn.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudecode-dashboard",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI dashboard for viewing Claude Code configurations",
5
5
  "author": "camping89",
6
6
  "license": "MIT",
@@ -14,10 +14,12 @@
14
14
  },
15
15
  "type": "module",
16
16
  "bin": {
17
- "claudecode-dashboard": "./dist/cli.js",
18
- "ccd": "./dist/cli.js"
17
+ "claudecode-dashboard": "dist/cli.js",
18
+ "ccd": "dist/cli.js"
19
19
  },
20
- "files": ["dist"],
20
+ "files": [
21
+ "dist"
22
+ ],
21
23
  "scripts": {
22
24
  "dev": "tsx src/cli.tsx",
23
25
  "build": "tsup",
@@ -43,5 +45,11 @@
43
45
  "engines": {
44
46
  "node": ">=20"
45
47
  },
46
- "keywords": ["claude", "cli", "dashboard", "tui", "config"]
48
+ "keywords": [
49
+ "claude",
50
+ "cli",
51
+ "dashboard",
52
+ "tui",
53
+ "config"
54
+ ]
47
55
  }