citadel_cli 1.1.0 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +17 -19
  2. package/dist/App.d.ts +2 -0
  3. package/dist/citadel.css +1 -1
  4. package/dist/citadel.es.js +760 -1386
  5. package/dist/citadel.umd.js +18 -38
  6. package/dist/{src/components → components}/Citadel/Citadel.d.ts +1 -1
  7. package/dist/{src/components → components}/Citadel/config/CitadelConfigContext.d.ts +9 -5
  8. package/dist/components/Citadel/config/hooks.d.ts +4 -0
  9. package/dist/{src/components → components}/Citadel/hooks/useCommandParser.d.ts +1 -1
  10. package/dist/{src/components → components}/Citadel/types/command-registry.d.ts +5 -1
  11. package/dist/{src/components → components}/Citadel/types/command-results.d.ts +2 -2
  12. package/dist/{src/components → components}/Citadel/types/help-command.d.ts +1 -1
  13. package/dist/{src/components → components}/Citadel/utils/logger.d.ts +5 -5
  14. package/dist/index.d.ts +4 -2
  15. package/package.json +10 -3
  16. package/dist/command_examples/basic-commands.d.ts +0 -2
  17. package/dist/dist/styles.css +0 -789
  18. package/dist/src/App.d.ts +0 -4
  19. package/dist/src/components/Citadel/commands/history-commands.d.ts +0 -2
  20. package/dist/src/components/Citadel/hooks/__tests__/useCommandTrie.test.d.ts +0 -1
  21. package/dist/src/components/Citadel/hooks/useCommandTrie.d.ts +0 -2
  22. package/dist/src/components/Citadel/types/__tests__/command-trie.test.d.ts +0 -1
  23. package/dist/src/components/Citadel/types/command-context.d.ts +0 -4
  24. package/dist/src/components/Citadel/types/command-trie.d.ts +0 -84
  25. package/dist/src/components/Citadel/utils/keySimulation.d.ts +0 -2
  26. package/dist/src/index.d.ts +0 -3
  27. /package/dist/{src/__test-utils__ → __test-utils__}/factories.d.ts +0 -0
  28. /package/dist/{src/components → components}/Citadel/Cursor.d.ts +0 -0
  29. /package/dist/{src/components → components}/Citadel/__tests__/Citadel.test.d.ts +0 -0
  30. /package/dist/{src/components → components}/Citadel/components/AvailableCommands.d.ts +0 -0
  31. /package/dist/{src/components → components}/Citadel/components/CommandInput.d.ts +0 -0
  32. /package/dist/{src/components → components}/Citadel/components/CommandOutput.d.ts +0 -0
  33. /package/dist/{src/components → components}/Citadel/components/CommandOutputLine.d.ts +0 -0
  34. /package/dist/{src/components → components}/Citadel/components/Spinner.d.ts +0 -0
  35. /package/dist/{src/components → components}/Citadel/components/__tests__/AvailableCommands.test.d.ts +0 -0
  36. /package/dist/{src/components → components}/Citadel/components/__tests__/CommandInput.test.d.ts +0 -0
  37. /package/dist/{src/components → components}/Citadel/components/__tests__/CommandOutput.test.d.ts +0 -0
  38. /package/dist/{src/components → components}/Citadel/components/__tests__/CommandOutputLine.test.d.ts +0 -0
  39. /package/dist/{src/components → components}/Citadel/components/__tests__/Spinner.test.d.ts +0 -0
  40. /package/dist/{src/components → components}/Citadel/config/__tests__/CitadelConfigContext.test.d.ts +0 -0
  41. /package/dist/{src/components → components}/Citadel/config/defaults.d.ts +0 -0
  42. /package/dist/{src/components → components}/Citadel/config/types.d.ts +0 -0
  43. /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCitadelState.test.d.ts +0 -0
  44. /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCommandHistory.test.d.ts +0 -0
  45. /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCommandParser.test.d.ts +0 -0
  46. /package/dist/{src/components → components}/Citadel/hooks/useCitadelState.d.ts +0 -0
  47. /package/dist/{src/components → components}/Citadel/hooks/useCommandHistory.d.ts +0 -0
  48. /package/dist/{src/components → components}/Citadel/hooks/useGlobalShortcut.d.ts +0 -0
  49. /package/dist/{src/components → components}/Citadel/hooks/useSegmentStack.d.ts +0 -0
  50. /package/dist/{src/components → components}/Citadel/hooks/useSegmentStackVersion.d.ts +0 -0
  51. /package/dist/{src/components → components}/Citadel/hooks/useSlideAnimation.d.ts +0 -0
  52. /package/dist/{src/components → components}/Citadel/index.d.ts +0 -0
  53. /package/dist/{src/components → components}/Citadel/services/HistoryService.d.ts +0 -0
  54. /package/dist/{src/components → components}/Citadel/storage/BaseStorage.d.ts +0 -0
  55. /package/dist/{src/components → components}/Citadel/storage/LocalStorage.d.ts +0 -0
  56. /package/dist/{src/components → components}/Citadel/storage/MemoryStorage.d.ts +0 -0
  57. /package/dist/{src/components → components}/Citadel/storage/StorageFactory.d.ts +0 -0
  58. /package/dist/{src/components → components}/Citadel/storage/__tests__/LocalStorage.test.d.ts +0 -0
  59. /package/dist/{src/components → components}/Citadel/storage/__tests__/MemoryStorage.test.d.ts +0 -0
  60. /package/dist/{src/components → components}/Citadel/types/__tests__/command-registry.test.d.ts +0 -0
  61. /package/dist/{src/components → components}/Citadel/types/__tests__/segment-stack.test.d.ts +0 -0
  62. /package/dist/{src/components → components}/Citadel/types/cursor.d.ts +0 -0
  63. /package/dist/{src/components → components}/Citadel/types/index.d.ts +0 -0
  64. /package/dist/{src/components → components}/Citadel/types/segment-stack.d.ts +0 -0
  65. /package/dist/{src/components → components}/Citadel/types/state.d.ts +0 -0
  66. /package/dist/{src/components → components}/Citadel/types/storage.d.ts +0 -0
  67. /package/dist/{src/main.d.ts → main.d.ts} +0 -0
  68. /package/dist/{src/test → test}/setup.d.ts +0 -0
@@ -1,38 +1,17 @@
1
- (function(j,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],s):(j=typeof globalThis<"u"?globalThis:j||self,s(j.Citadel={},j.React,j.ReactDOM))})(this,function(j,s,G){"use strict";var Et=Object.defineProperty;var _t=(j,s,G)=>s in j?Et(j,s,{enumerable:!0,configurable:!0,writable:!0,value:G}):j[s]=G;var A=(j,s,G)=>_t(j,typeof s!="symbol"?s+"":s,G);var we={exports:{}},ee={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Oe;function kn(){if(Oe)return ee;Oe=1;var o=s,n=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function p(m,d,g){var y,h={},x=null,N=null;g!==void 0&&(x=""+g),d.key!==void 0&&(x=""+d.key),d.ref!==void 0&&(N=d.ref);for(y in d)r.call(d,y)&&!i.hasOwnProperty(y)&&(h[y]=d[y]);if(m&&m.defaultProps)for(y in d=m.defaultProps,d)h[y]===void 0&&(h[y]=d[y]);return{$$typeof:n,type:m,key:x,ref:N,props:h,_owner:l.current}}return ee.Fragment=t,ee.jsx=p,ee.jsxs=p,ee}var ne={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Ie;function En(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&function(){var o=s,n=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),m=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),T=Symbol.iterator,D="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var a=T&&e[T]||e[D];return typeof a=="function"?a:null}var u=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var a=arguments.length,c=new Array(a>1?a-1:0),w=1;w<a;w++)c[w-1]=arguments[w];_("error",e,c)}}function _(e,a,c){{var w=u.ReactDebugCurrentFrame,k=w.getStackAddendum();k!==""&&(a+="%s",c=c.concat([k]));var E=c.map(function(S){return String(S)});E.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,E)}}var C=!1,P=!1,Y=!1,z=!1,$=!1,V;V=Symbol.for("react.module.reference");function se(e){return!!(typeof e=="string"||typeof e=="function"||e===r||e===i||$||e===l||e===g||e===y||z||e===N||C||P||Y||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===h||e.$$typeof===p||e.$$typeof===m||e.$$typeof===d||e.$$typeof===V||e.getModuleId!==void 0))}function Xn(e,a,c){var w=e.displayName;if(w)return w;var k=a.displayName||a.name||"";return k!==""?c+"("+k+")":c}function en(e){return e.displayName||"Context"}function L(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case l:return"StrictMode";case g:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m:var a=e;return en(a)+".Consumer";case p:var c=e;return en(c._context)+".Provider";case d:return Xn(e,e.render,"ForwardRef");case h:var w=e.displayName||null;return w!==null?w:L(e.type)||"Memo";case x:{var k=e,E=k._payload,S=k._init;try{return L(S(E))}catch{return null}}}return null}var q=Object.assign,ie=0,nn,tn,rn,on,an,sn,ln;function cn(){}cn.__reactDisabledLog=!0;function Qn(){{if(ie===0){nn=console.log,tn=console.info,rn=console.warn,on=console.error,an=console.group,sn=console.groupCollapsed,ln=console.groupEnd;var e={configurable:!0,enumerable:!0,value:cn,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ie++}}function Zn(){{if(ie--,ie===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},e,{value:nn}),info:q({},e,{value:tn}),warn:q({},e,{value:rn}),error:q({},e,{value:on}),group:q({},e,{value:an}),groupCollapsed:q({},e,{value:sn}),groupEnd:q({},e,{value:ln})})}ie<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Se=u.ReactCurrentDispatcher,ke;function pe(e,a,c){{if(ke===void 0)try{throw Error()}catch(k){var w=k.stack.trim().match(/\n( *(at )?)/);ke=w&&w[1]||""}return`
18
- `+ke+e}}var Ee=!1,ge;{var et=typeof WeakMap=="function"?WeakMap:Map;ge=new et}function un(e,a){if(!e||Ee)return"";{var c=ge.get(e);if(c!==void 0)return c}var w;Ee=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var E;E=Se.current,Se.current=null,Qn();try{if(a){var S=function(){throw Error()};if(Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(S,[])}catch(H){w=H}Reflect.construct(e,[],S)}else{try{S.call()}catch(H){w=H}e.call(S.prototype)}}else{try{throw Error()}catch(H){w=H}e()}}catch(H){if(H&&w&&typeof H.stack=="string"){for(var v=H.stack.split(`
19
- `),F=w.stack.split(`
20
- `),R=v.length-1,O=F.length-1;R>=1&&O>=0&&v[R]!==F[O];)O--;for(;R>=1&&O>=0;R--,O--)if(v[R]!==F[O]){if(R!==1||O!==1)do if(R--,O--,O<0||v[R]!==F[O]){var W=`
21
- `+v[R].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),typeof e=="function"&&ge.set(e,W),W}while(R>=1&&O>=0);break}}}finally{Ee=!1,Se.current=E,Zn(),Error.prepareStackTrace=k}var Z=e?e.displayName||e.name:"",J=Z?pe(Z):"";return typeof e=="function"&&ge.set(e,J),J}function nt(e,a,c){return un(e,!1)}function tt(e){var a=e.prototype;return!!(a&&a.isReactComponent)}function he(e,a,c){if(e==null)return"";if(typeof e=="function")return un(e,tt(e));if(typeof e=="string")return pe(e);switch(e){case g:return pe("Suspense");case y:return pe("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return nt(e.render);case h:return he(e.type,a,c);case x:{var w=e,k=w._payload,E=w._init;try{return he(E(k),a,c)}catch{}}}return""}var le=Object.prototype.hasOwnProperty,dn={},mn=u.ReactDebugCurrentFrame;function be(e){if(e){var a=e._owner,c=he(e.type,e._source,a?a.type:null);mn.setExtraStackFrame(c)}else mn.setExtraStackFrame(null)}function rt(e,a,c,w,k){{var E=Function.call.bind(le);for(var S in e)if(E(e,S)){var v=void 0;try{if(typeof e[S]!="function"){var F=Error((w||"React class")+": "+c+" type `"+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[S]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw F.name="Invariant Violation",F}v=e[S](a,S,w,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){v=R}v&&!(v instanceof Error)&&(be(k),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",w||"React class",c,S,typeof v),be(null)),v instanceof Error&&!(v.message in dn)&&(dn[v.message]=!0,be(k),b("Failed %s type: %s",c,v.message),be(null))}}}var ot=Array.isArray;function _e(e){return ot(e)}function at(e){{var a=typeof Symbol=="function"&&Symbol.toStringTag,c=a&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function st(e){try{return fn(e),!1}catch{return!0}}function fn(e){return""+e}function pn(e){if(st(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",at(e)),fn(e)}var ce=u.ReactCurrentOwner,it={key:!0,ref:!0,__self:!0,__source:!0},gn,hn,je;je={};function lt(e){if(le.call(e,"ref")){var a=Object.getOwnPropertyDescriptor(e,"ref").get;if(a&&a.isReactWarning)return!1}return e.ref!==void 0}function ct(e){if(le.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function ut(e,a){if(typeof e.ref=="string"&&ce.current&&a&&ce.current.stateNode!==a){var c=L(ce.current.type);je[c]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',L(ce.current.type),e.ref),je[c]=!0)}}function dt(e,a){{var c=function(){gn||(gn=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function mt(e,a){{var c=function(){hn||(hn=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ft=function(e,a,c,w,k,E,S){var v={$$typeof:n,type:e,key:a,ref:c,props:S,_owner:E};return v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(v,"_self",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.defineProperty(v,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v};function pt(e,a,c,w,k){{var E,S={},v=null,F=null;c!==void 0&&(pn(c),v=""+c),ct(a)&&(pn(a.key),v=""+a.key),lt(a)&&(F=a.ref,ut(a,k));for(E in a)le.call(a,E)&&!it.hasOwnProperty(E)&&(S[E]=a[E]);if(e&&e.defaultProps){var R=e.defaultProps;for(E in R)S[E]===void 0&&(S[E]=R[E])}if(v||F){var O=typeof e=="function"?e.displayName||e.name||"Unknown":e;v&&dt(S,O),F&&mt(S,O)}return ft(e,v,F,k,w,ce.current,S)}}var Te=u.ReactCurrentOwner,bn=u.ReactDebugCurrentFrame;function Q(e){if(e){var a=e._owner,c=he(e.type,e._source,a?a.type:null);bn.setExtraStackFrame(c)}else bn.setExtraStackFrame(null)}var Pe;Pe=!1;function Ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function wn(){{if(Te.current){var e=L(Te.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function gt(e){return""}var yn={};function ht(e){{var a=wn();if(!a){var c=typeof e=="string"?e:e.displayName||e.name;c&&(a=`
24
-
25
- Check the top-level render call using <`+c+">.")}return a}}function vn(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ht(a);if(yn[c])return;yn[c]=!0;var w="";e&&e._owner&&e._owner!==Te.current&&(w=" It was passed a child from "+L(e._owner.type)+"."),Q(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,w),Q(null)}}function xn(e,a){{if(typeof e!="object")return;if(_e(e))for(var c=0;c<e.length;c++){var w=e[c];Ae(w)&&vn(w,a)}else if(Ae(e))e._store&&(e._store.validated=!0);else if(e){var k=M(e);if(typeof k=="function"&&k!==e.entries)for(var E=k.call(e),S;!(S=E.next()).done;)Ae(S.value)&&vn(S.value,a)}}}function bt(e){{var a=e.type;if(a==null||typeof a=="string")return;var c;if(typeof a=="function")c=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===d||a.$$typeof===h))c=a.propTypes;else return;if(c){var w=L(a);rt(c,e.props,"prop",w,e)}else if(a.PropTypes!==void 0&&!Pe){Pe=!0;var k=L(a);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wt(e){{for(var a=Object.keys(e.props),c=0;c<a.length;c++){var w=a[c];if(w!=="children"&&w!=="key"){Q(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",w),Q(null);break}}e.ref!==null&&(Q(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),Q(null))}}var Cn={};function Sn(e,a,c,w,k,E){{var S=se(e);if(!S){var v="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(v+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var F=gt();F?v+=F:v+=wn();var R;e===null?R="null":_e(e)?R="array":e!==void 0&&e.$$typeof===n?(R="<"+(L(e.type)||"Unknown")+" />",v=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,v)}var O=pt(e,a,c,k,E);if(O==null)return O;if(S){var W=a.children;if(W!==void 0)if(w)if(_e(W)){for(var Z=0;Z<W.length;Z++)xn(W[Z],e);Object.freeze&&Object.freeze(W)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else xn(W,e)}if(le.call(a,"key")){var J=L(e),H=Object.keys(a).filter(function(kt){return kt!=="key"}),Re=H.length>0?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}";if(!Cn[J+Re]){var St=H.length>0?"{"+H.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,Re,J,St,J),Cn[J+Re]=!0}}return e===r?wt(O):bt(O),O}}function yt(e,a,c){return Sn(e,a,c,!0)}function vt(e,a,c){return Sn(e,a,c,!1)}var xt=vt,Ct=yt;ne.Fragment=r,ne.jsx=xt,ne.jsxs=Ct}()),ne}process.env.NODE_ENV==="production"?we.exports=kn():we.exports=En();var f=we.exports,ye,ue=G;if(process.env.NODE_ENV==="production")ye=ue.createRoot,ue.hydrateRoot;else{var Ne=ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ye=function(o,n){Ne.usingClientEntryPoint=!0;try{return ue.createRoot(o,n)}finally{Ne.usingClientEntryPoint=!1}}}const _n=({onOpen:o,onClose:n,isVisible:t,showCitadelKey:r})=>{s.useEffect(()=>{const l=i=>{var p,m;!t&&i.key===r&&!["input","textarea"].includes(((m=(p=i.target)==null?void 0:p.tagName)==null?void 0:m.toLowerCase())||"")&&(i.preventDefault(),o()),t&&i.key==="Escape"&&(i.preventDefault(),n())};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o,n,t,r])},De={container:"_container_141sr_3",innerContainer:"_innerContainer_141sr_19",inputSection:"_inputSection_141sr_28",resizeHandle:"_resizeHandle_141sr_35",citadel_slideUp:"_citadel_slideUp_141sr_64",citadel_slideDown:"_citadel_slideDown_141sr_68"},jn=o=>{const{isVisible:n,isClosing:t,onAnimationComplete:r}=o,l=s.useMemo(()=>n?t?De.slideDown:De.slideUp:"",[n,t]);return s.useEffect(()=>{if(r){const p=setTimeout(()=>{r()},200);return()=>clearTimeout(p)}},[t,r]),{style:s.useMemo(()=>({opacity:n?1:0,transform:n?"translateY(0)":t?"translateY(100%)":"translateY(-100%)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),[n,t]),animationClass:l}};var X=(o=>(o.Pending="pending",o.Success="success",o.Failure="failure",o.Timeout="timeout",o))(X||{});class K{constructor(n=Date.now()){A(this,"_status","pending");this.timestamp=n}get status(){return this._status}markSuccess(){this._status="success"}markFailure(){this._status="failure"}markTimeout(){this._status="timeout"}}class Tn extends K{constructor(n,t){super(t),this.data=n}render(){return f.jsx("pre",{className:"text-gray-200",children:JSON.stringify(this.data,null,2)})}}class ve extends K{constructor(n,t){super(t),this.text=n}render(){return f.jsx("div",{className:"text-gray-200 whitespace-pre font-mono",children:this.text})}}class ze extends K{constructor(n,t){super(t),this.error=n,this.markFailure()}render(){return f.jsx("div",{className:"mt-1 text-red-400",children:this.error})}}class Fe extends K{render(){return f.jsx("div",{className:"text-gray-400",children:"..."})}}class Pn extends K{constructor(n,t="",r){super(r),this.imageUrl=n,this.altText=t}render(){return f.jsx("div",{className:"my-2",children:f.jsx("img",{src:this.imageUrl,alt:this.altText,className:"max-w-[400px] max-h-[300px] h-auto rounded-lg object-contain"})})}}const An=o=>async function(n){const t=o.commands.filter(r=>r.fullPath[0]!=="help").map(r=>`${r.segments.map(i=>i.type==="argument"?`<${i.name}>`:i.name).join(" ")} - ${r.description}`).sort();return t.push("help - Show available commands"),new ve(t.length>0?`Available Commands:
31
- `+t.join(`
32
- `):"No commands available yet. Add some commands to get started!")};var de=(o=>(o[o.NONE=0]="NONE",o[o.ERROR=1]="ERROR",o[o.WARN=2]="WARN",o[o.INFO=3]="INFO",o[o.DEBUG=4]="DEBUG",o[o.TRACE=5]="TRACE",o))(de||{});class I{static configure(n){this.level=n.level,this.prefix=n.prefix||"[Citadel]"}static trace(...n){this.level>=5&&process.env.NODE_ENV!=="production"&&console.trace(this.prefix,...n)}static debug(...n){this.level>=4&&process.env.NODE_ENV!=="production"&&console.debug(this.prefix,...n)}static info(...n){this.level>=3&&console.info(this.prefix,...n)}static warn(...n){this.level>=2&&console.warn(this.prefix,...n)}static error(...n){this.level>=1&&console.error(this.prefix,...n)}}A(I,"level",0),A(I,"prefix","");const U={commandTimeoutMs:1e4,cursorColor:"var(--cursor-color, #fff)",cursorSpeed:530,cursorType:"blink",includeHelpCommand:!0,initialHeight:"40vh",logLevel:process.env.NODE_ENV==="production"?de.ERROR:de.DEBUG,maxHeight:"80vh",minHeight:"200",outputFontSize:"0.875rem",resetStateOnHide:!1,showCitadelKey:".",storage:{type:"localStorage",maxCommands:100}};class Ue{constructor(n){A(this,"config");this.config={type:"localStorage",maxCommands:100,...n}}async addStoredCommand(n){const t=await this.getStoredCommands();for(t.push(n);t.length>this.config.maxCommands;)t.shift();await this.saveCommands(t)}}class Rn extends Ue{constructor(t){super(t);A(this,"storageKey","citadel_command_history")}async getStoredCommands(){try{const t=window.localStorage.getItem(this.storageKey);return t?JSON.parse(t).map(l=>({commandSegments:l.commandSegments||[],timestamp:l.timestamp})):[]}catch(t){return console.warn("Failed to load commands from localStorage:",t),[]}}async clear(){try{window.localStorage.removeItem(this.storageKey)}catch(t){console.warn("Failed to clear localStorage:",t)}}async saveCommands(t){try{const r=t.map(l=>({commandSegments:Array.isArray(l.commandSegments)?[...l.commandSegments]:[],timestamp:l.timestamp}));window.localStorage.setItem(this.storageKey,JSON.stringify(r))}catch(r){throw console.warn("Failed to save commands to localStorage:",r),r}}}class On extends Ue{constructor(t){super(t);A(this,"storedCommands",[])}async getStoredCommands(){return this.storedCommands.map(t=>({commandSegments:Array.isArray(t.commandSegments)?[...t.commandSegments]:[],timestamp:t.timestamp}))}async clear(){this.storedCommands=[]}async saveCommands(t){this.storedCommands=t.map(r=>({commandSegments:Array.isArray(r.commandSegments)?[...r.commandSegments]:[],timestamp:r.timestamp}))}}const B=class B{constructor(){A(this,"currentStorage")}static getInstance(){return B.instance||(B.instance=new B),B.instance}initializeStorage(n){if(!this.currentStorage)try{this.currentStorage=new Rn(n)}catch(t){console.warn("Failed to create storage, falling back to memory storage:",t),this.currentStorage=new On(n)}}getStorage(){if(!this.currentStorage)throw new Error("Storage not initialized. Call initializeStorage first.");return this.currentStorage}};A(B,"instance");let me=B;const Me=async o=>new ve("");class xe{constructor(n,t,r){this.type=n,this.name=t,this.description=r}toString(){return this.name}}class He extends xe{constructor(){super("null",">null<","Empty segment")}}class In extends xe{constructor(n,t){super("word",n,t)}}class Nn extends xe{constructor(n,t,r,l){super("argument",n,t),this.value=r,this.valid=l}}class Dn{constructor(n,t,r=Me){A(this,"_segments");A(this,"_description");A(this,"_handler");this._segments=n,this._description=t,this._handler=r}get segments(){return this._segments}get description(){return this._description}get handler(){return this._handler}get hasArguments(){return this.segments.some(n=>n.type==="argument")}get fullPath(){return this.segments.map(n=>n.name)}get fullPath_s(){return this.fullPath.join(" ")}equals(n){return this.fullPath.join(" ")===n.fullPath.join(" ")}}class Ce{constructor(){A(this,"_commands",[])}get commands(){return this._commands}addCommand(n,t,r=Me){if(n===void 0||n.length===0)throw new Error("Command path cannot be empty");const l=new Dn(n,t,r),i=this._commands.find(p=>{const m=p.segments.map(g=>g.type==="argument"?"*":g.name).join(" "),d=n.map(g=>g.type==="argument"?"*":g.name).join(" ");return m===d});if(i)throw new Error(`Duplicate commands: '${i.fullPath_s}' and '${l.fullPath_s}'`);this._commands.push(l)}getCommand(n){return this._commands.find(t=>{const r=t.fullPath.join(" "),l=n.join(" ");return r===l})}commandExistsForPath(n){const t=this._commands.map(l=>l.segments.map(i=>i.type==="argument"?"*":i.name).join(" ")),r=n.map((l,i)=>this._commands.some(m=>{var d;return((d=m.segments[i])==null?void 0:d.type)==="argument"})?"*":l).join(" ");return t.includes(r)}getCompletions_s(n){return this.getCompletions(n).map(t=>t.name)}getCompletions(n){if(I.debug("[getCompletions] path: ",n),!n.length){const i=this._commands.map(d=>d.segments[0]),p=(d,g)=>d.type===g.type&&d.name===g.name;return i.filter((d,g,y)=>g===y.findIndex(h=>p(h,d)))}const t=n.length;return this._commands.filter(i=>{const p=i.segments;if(p.length<=t-1)return!1;for(let m=0;m<t;m++){const d=n[m],g=p[m];if(!(d==="*"&&g.type==="argument")&&d!==g.name)return!1}return!0}).filter(i=>i.segments.length>t).map(i=>{const p=i.segments[t],m=p.type==="argument"?Nn:In;return new m(p.name,p.description)}).filter((i,p,m)=>p===m.findIndex(d=>d.type===i.type&&d.name===i.name))}hasNextSegment(n){return this.getCompletions(n).length>0}}class $e{constructor(){A(this,"segments",[]);A(this,"nullSegment",new He);A(this,"observers",[])}subscribe(n){this.observers.push(n)}unsubscribe(n){this.observers=this.observers.filter(t=>t!==n)}notifyObservers(){this.observers.forEach(n=>n.update())}clear(){this.segments=[],this.notifyObservers()}push(n){this.segments.push(n),this.notifyObservers()}pushAll(n){n.forEach(t=>this.push(t))}pop(){const n=this.segments.pop()||this.nullSegment;return this.notifyObservers(),n}peek(){return this.segments[this.segments.length-1]||this.nullSegment}size(){return this.segments.length}isEmpty(){return this.segments.length===0}get hasArguments(){return this.segments.some(n=>n.type==="argument")}get arguments(){return this.segments.filter(n=>n.type==="argument")}path(){return this.segments.map(n=>n.name)}toArray(){return[...this.segments]}}const zn={config:U,commands:new Ce,segmentStack:new $e},te=s.createContext(zn),Fn=({config:o=U,commands:n,children:t})=>{const[r,l]=s.useState(),i={...U,...o,storage:{...U.storage,...o.storage},cursorType:o.cursorType??U.cursorType,cursorColor:o.cursorColor??U.cursorColor,cursorSpeed:o.cursorSpeed??U.cursorSpeed,showCitadelKey:o.showCitadelKey||"."};s.useEffect(()=>{me.getInstance().initializeStorage(i.storage??U.storage),l(me.getInstance().getStorage())},[]),s.useEffect(()=>{if(n&&i.includeHelpCommand&&!n.commandExistsForPath(["help"])){const m=An(n);n.addCommand([{type:"word",name:"help"}],"Show available commands",m)}},[n,i.includeHelpCommand]);const p={config:i,commands:n||new Ce,storage:r,segmentStack:new $e};return f.jsx(te.Provider,{value:p,children:t})},re=()=>{const o=s.useContext(te);if(o===void 0)throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");return o.config},fe=()=>{const o=s.useContext(te);if(o===void 0)throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");return o.commands},We=()=>{const o=s.useContext(te);if(o===void 0)throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");return o.storage},oe=()=>{const o=s.useContext(te);if(o===void 0)throw new Error("useSegmentStack must be used within a CitadelConfigProvider");return o.segmentStack};class Le{constructor(n,t){A(this,"timestamp");A(this,"command");A(this,"result");this.command=n.toArray().map(r=>r.type==="argument"?r.value||"":r.name),this.timestamp=Date.now(),this.result=t??new Fe}}const ae=()=>{const o=oe(),[n,t]=s.useState(0);return s.useEffect(()=>{const r={update:()=>{t(l=>l+1)}};return o.subscribe(r),()=>{o.unsubscribe(r)}},[o]),n};function Un(o){return{commandSegments:o,timestamp:Date.now()}}function Ye(){const o=We(),[n,t]=s.useState({storedCommands:[],position:null}),r=s.useCallback(async m=>{if(o)try{const d=Un(m);await o.addStoredCommand(d),t(g=>({...g,storedCommands:[...g.storedCommands,d],position:null}))}catch(d){console.warn("Failed to save command to history:",d)}},[o]),l=s.useCallback(async()=>o?await o.getStoredCommands():[],[o]);s.useEffect(()=>{if(!o)return;(async()=>{try{const d=await o.getStoredCommands();return t(g=>({...g,storedCommands:d})),d}catch(d){console.warn("Failed to load command history:",d)}})()},[o]);const i=s.useCallback(async m=>{if((await l()).length===0)return{segments:null,position:null};let g=null;return m==="up"?n.position===null?g=n.storedCommands.length-1:n.position>0?g=n.position-1:g=0:n.position===null||n.position>=n.storedCommands.length-1?g=null:g=n.position+1,t(h=>({...h,position:g})),g===null?{segments:[],position:null}:{segments:g!==null?n.storedCommands[g].commandSegments:null,position:g}},[n,ae]),p=s.useCallback(async()=>{try{if(!o)return;await o.clear(),t({storedCommands:[],position:null})}catch(m){console.warn("Failed to clear command history:",m)}},[o]);return{history:n,addStoredCommand:r,getStoredCommands:l,navigateHistory:i,clear:p}}const Ve=()=>{const o=re(),n=fe(),t=Ye(),r=oe(),l=ae(),i=We(),[p,m]=s.useState({currentInput:"",isEnteringArg:!1,output:[],history:{commands:[],position:null,storage:i}});s.useEffect(()=>{},[i]),s.useEffect(()=>{m(h=>({...h,history:{commands:t.history.storedCommands,position:t.history.position,storage:i}}))},[t.history,i]);const d={setCurrentInput:s.useCallback(h=>{I.debug("[CitadelActions] setCurrentInput: ",h),m(x=>({...x,currentInput:h}))},[]),setIsEnteringArg:s.useCallback(h=>{I.debug("[CitadelActions] setIsEnteringArg: ",h),m(x=>({...x,isEnteringArg:h}))},[]),addOutput:s.useCallback(h=>{I.debug("[CitadelActions]addOutput: ",h),m(x=>({...x,output:[...x.output,h]}))},[]),executeCommand:s.useCallback(async()=>{const h=r.path(),x=n.getCommand(h);if(!x){console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ",h);return}const N=new Le(r);m(T=>({...T,output:[...T.output,N]}));try{const T=new Promise((u,b)=>{setTimeout(()=>{b(new Error("Request timed out"))},o.commandTimeoutMs)}),D=r.arguments.map(u=>u.value||""),M=await Promise.race([x.handler(D),T]);if(!(M instanceof K))throw new Error(`The ${h.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
1
+ (function(w,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("react-dom/client")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom/client"],i):(w=typeof globalThis<"u"?globalThis:w||self,i(w.Citadel={},w.jsxRuntime,w.React,w.client))})(this,function(w,i,s,me){"use strict";var je=Object.defineProperty;var Me=(w,i,s)=>i in w?je(w,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):w[i]=s;var y=(w,i,s)=>Me(w,typeof i!="symbol"?i+"":i,s);const ue=({onOpen:r,onClose:e,isVisible:n,showCitadelKey:t})=>{s.useEffect(()=>{const o=a=>{var c,m;!n&&a.key===t&&!["input","textarea"].includes(((m=(c=a.target)==null?void 0:c.tagName)==null?void 0:m.toLowerCase())||"")&&(a.preventDefault(),r()),n&&a.key==="Escape"&&(a.preventDefault(),e())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[r,e,n,t])},Y={container:"_container_141sr_3",innerContainer:"_innerContainer_141sr_19",inputSection:"_inputSection_141sr_28",resizeHandle:"_resizeHandle_141sr_35",citadel_slideUp:"_citadel_slideUp_141sr_64",citadel_slideDown:"_citadel_slideDown_141sr_68"},pe=r=>{const{isVisible:e,isClosing:n,onAnimationComplete:t}=r,o=s.useMemo(()=>e?n?Y.slideDown:Y.slideUp:"",[e,n]);return s.useEffect(()=>{if(t){const c=setTimeout(()=>{t()},200);return()=>clearTimeout(c)}},[n,t]),{style:s.useMemo(()=>({opacity:e?1:0,transform:e?"translateY(0)":n?"translateY(100%)":"translateY(-100%)",transition:"opacity 200ms ease-in-out, transform 200ms ease-in-out"}),[e,n]),animationClass:o}};var T=(r=>(r.Pending="pending",r.Success="success",r.Failure="failure",r.Timeout="timeout",r))(T||{});class H{constructor(e=Date.now()){y(this,"_status","pending");this.timestamp=e}get status(){return this._status}markSuccess(){this._status="success"}markFailure(){this._status="failure"}markTimeout(){this._status="timeout"}}class ge extends H{constructor(e,n){super(n),this.data=e}render(){return i.jsx("pre",{className:"text-gray-200",children:JSON.stringify(this.data,null,2)})}}class V extends H{constructor(e,n){super(n),this.text=e}render(){return i.jsx("div",{className:"text-gray-200 whitespace-pre font-mono",children:this.text})}}class B extends H{constructor(e,n){super(n),this.error=e,this.markFailure()}render(){return i.jsx("div",{className:"mt-1 text-red-400",children:this.error})}}class G extends H{render(){return i.jsx("div",{className:"text-gray-400",children:"..."})}}class he extends H{constructor(e,n="",t){super(t),this.imageUrl=e,this.altText=n}render(){return i.jsx("div",{className:"my-2",children:i.jsx("img",{src:this.imageUrl,alt:this.altText,className:"max-w-[400px] max-h-[300px] h-auto rounded-lg object-contain"})})}}const fe=r=>async function(){const e=r.commands.filter(n=>n.fullPath[0]!=="help").map(n=>`${n.segments.map(o=>o.type==="argument"?`<${o.name}>`:o.name).join(" ")} - ${n.description}`).sort();return e.push("help - Show available commands"),new V(e.length>0?`Available Commands:
2
+ `+e.join(`
3
+ `):"No commands available yet. Add some commands to get started!")};var $=(r=>(r[r.NONE=0]="NONE",r[r.ERROR=1]="ERROR",r[r.WARN=2]="WARN",r[r.INFO=3]="INFO",r[r.DEBUG=4]="DEBUG",r[r.TRACE=5]="TRACE",r))($||{});class S{static configure(e){this.level=e.level,this.prefix=e.prefix||"[Citadel]"}static trace(...e){this.level>=5&&process.env.NODE_ENV!=="production"&&console.trace(this.prefix,...e)}static debug(...e){this.level>=4&&process.env.NODE_ENV!=="production"&&console.debug(this.prefix,...e)}static info(...e){this.level>=3&&console.info(this.prefix,...e)}static warn(...e){this.level>=2&&console.warn(this.prefix,...e)}static error(...e){this.level>=1&&console.error(this.prefix,...e)}}y(S,"level",0),y(S,"prefix","");const N={commandTimeoutMs:1e4,cursorColor:"var(--cursor-color, #fff)",cursorSpeed:530,cursorType:"blink",includeHelpCommand:!0,initialHeight:"40vh",logLevel:process.env.NODE_ENV==="production"?$.ERROR:$.DEBUG,maxHeight:"80vh",minHeight:"200",outputFontSize:"0.875rem",resetStateOnHide:!1,showCitadelKey:".",storage:{type:"localStorage",maxCommands:100}};class J{constructor(e){y(this,"config");this.config={type:"localStorage",maxCommands:100,...e}}async addStoredCommand(e){const n=await this.getStoredCommands();for(n.push(e);n.length>this.config.maxCommands;)n.shift();await this.saveCommands(n)}}class we extends J{constructor(n){super(n);y(this,"storageKey","citadel_command_history")}async getStoredCommands(){try{const n=window.localStorage.getItem(this.storageKey);return n?JSON.parse(n).map(o=>({commandSegments:o.commandSegments||[],timestamp:o.timestamp})):[]}catch(n){return console.warn("Failed to load commands from localStorage:",n),[]}}async clear(){try{window.localStorage.removeItem(this.storageKey)}catch(n){console.warn("Failed to clear localStorage:",n)}}async saveCommands(n){try{const t=n.map(o=>({commandSegments:Array.isArray(o.commandSegments)?[...o.commandSegments]:[],timestamp:o.timestamp}));window.localStorage.setItem(this.storageKey,JSON.stringify(t))}catch(t){throw console.warn("Failed to save commands to localStorage:",t),t}}}class be extends J{constructor(n){super(n);y(this,"storedCommands",[])}async getStoredCommands(){return this.storedCommands.map(n=>({commandSegments:Array.isArray(n.commandSegments)?[...n.commandSegments]:[],timestamp:n.timestamp}))}async clear(){this.storedCommands=[]}async saveCommands(n){this.storedCommands=n.map(t=>({commandSegments:Array.isArray(t.commandSegments)?[...t.commandSegments]:[],timestamp:t.timestamp}))}}const D=class D{constructor(){y(this,"currentStorage")}static getInstance(){return D.instance||(D.instance=new D),D.instance}initializeStorage(e){if(!this.currentStorage)try{this.currentStorage=new we(e)}catch(n){console.warn("Failed to create storage, falling back to memory storage:",n),this.currentStorage=new be(e)}}getStorage(){if(!this.currentStorage)throw new Error("Storage not initialized. Call initializeStorage first.");return this.currentStorage}};y(D,"instance");let K=D;const Q=async()=>new V("");class W{constructor(e,n,t){this.type=e,this.name=n,this.description=t}toString(){return this.name}}class X extends W{constructor(){super("null",">null<","Empty segment")}}class ye extends W{constructor(e,n){super("word",e,n)}}class xe extends W{constructor(e,n,t,o){super("argument",e,n),this.value=t,this.valid=o}}class Ce{constructor(e,n,t=Q){y(this,"_segments");y(this,"_description");y(this,"_handler");this._segments=e,this._description=n,this._handler=t}get segments(){return this._segments}get description(){return this._description}get handler(){return this._handler}get hasArguments(){return this.segments.some(e=>e.type==="argument")}get fullPath(){return this.segments.map(e=>e.name)}get fullPath_s(){return this.fullPath.join(" ")}equals(e){return this.fullPath.join(" ")===e.fullPath.join(" ")}}class L{constructor(){y(this,"_commands",[])}get commands(){return this._commands}addCommand(e,n,t=Q){if(e===void 0||e.length===0)throw new Error("Command path cannot be empty");const o=new Ce(e,n,t),a=this._commands.find(c=>{const m=c.segments.map(d=>d.type==="argument"?"*":d.name).join(" "),u=e.map(d=>d.type==="argument"?"*":d.name).join(" ");return m===u});if(a)throw new Error(`Duplicate commands: '${a.fullPath_s}' and '${o.fullPath_s}'`);this._commands.push(o)}getCommand(e){return this._commands.find(n=>{const t=n.fullPath.join(" "),o=e.join(" ");if(t===o)return!0;const c=n.segments.filter(m=>m.type==="word").map(m=>m.name);return c.length===e.length&&c.join(" ")===o})}commandExistsForPath(e){const n=this._commands.map(o=>o.segments.map(a=>a.type==="argument"?"*":a.name).join(" ")),t=e.map((o,a)=>this._commands.some(m=>{var u;return((u=m.segments[a])==null?void 0:u.type)==="argument"})?"*":o).join(" ");return n.includes(t)}getCompletions_s(e){return this.getCompletions(e).map(n=>n.name)}getCompletions(e){if(S.debug("[getCompletions] path: ",e),!e.length){const a=this._commands.map(u=>u.segments[0]),c=(u,d)=>u.type===d.type&&u.name===d.name;return a.filter((u,d,p)=>d===p.findIndex(g=>c(g,u)))}const n=e.length;return this._commands.filter(a=>{const c=a.segments;if(c.length<=n-1)return!1;for(let m=0;m<n;m++){const u=e[m],d=c[m];if(!(u==="*"&&d.type==="argument")&&u!==d.name)return!1}return!0}).filter(a=>a.segments.length>n).map(a=>{const c=a.segments[n],m=c.type==="argument"?xe:ye;return new m(c.name,c.description)}).filter((a,c,m)=>c===m.findIndex(u=>u.type===a.type&&u.name===a.name))}hasNextSegment(e){return this.getCompletions(e).length>0}}class Z{constructor(){y(this,"segments",[]);y(this,"nullSegment",new X);y(this,"observers",[])}subscribe(e){this.observers.push(e)}unsubscribe(e){this.observers=this.observers.filter(n=>n!==e)}notifyObservers(){this.observers.forEach(e=>e.update())}clear(){this.segments=[],this.notifyObservers()}push(e){this.segments.push(e),this.notifyObservers()}pushAll(e){e.forEach(n=>this.push(n))}pop(){const e=this.segments.pop()||this.nullSegment;return this.notifyObservers(),e}peek(){return this.segments[this.segments.length-1]||this.nullSegment}size(){return this.segments.length}isEmpty(){return this.segments.length===0}get hasArguments(){return this.segments.some(e=>e.type==="argument")}get arguments(){return this.segments.filter(e=>e.type==="argument")}path(){return this.segments.map(e=>e.name)}toArray(){return[...this.segments]}}const ve={config:N,commands:new L,segmentStack:new Z},U=s.createContext(ve),Se=({config:r=N,commandRegistry:e,children:n})=>{const[t,o]=s.useState(),a={...N,...r,storage:{...N.storage,...r.storage},cursorType:r.cursorType??N.cursorType,cursorColor:r.cursorColor??N.cursorColor,cursorSpeed:r.cursorSpeed??N.cursorSpeed,showCitadelKey:r.showCitadelKey||"."};s.useEffect(()=>{K.getInstance().initializeStorage(a.storage??N.storage),o(K.getInstance().getStorage())},[]),s.useEffect(()=>{if(e&&a.includeHelpCommand&&!e.commandExistsForPath(["help"])){const m=fe(e);e.addCommand([{type:"word",name:"help"}],"Show available commands",m)}},[e,a.includeHelpCommand]);const c={config:a,commands:e||new L,storage:t,segmentStack:new Z};return i.jsx(U.Provider,{value:c,children:n})},F=()=>{const r=s.useContext(U);if(r===void 0)throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");return r.config},q=()=>{const r=s.useContext(U);if(r===void 0)throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");return r.commands},R=()=>{const r=s.useContext(U);if(r===void 0)throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");return r.storage},j=()=>{const r=s.useContext(U);if(r===void 0)throw new Error("useSegmentStack must be used within a CitadelConfigProvider");return r.segmentStack};class ee{constructor(e,n){y(this,"timestamp");y(this,"command");y(this,"result");this.command=e.toArray().map(t=>t.type==="argument"?t.value||"":t.name),this.timestamp=Date.now(),this.result=n??new G}}function ke(r){return{commandSegments:r,timestamp:Date.now()}}function ne(){const r=R(),[e,n]=s.useState({storedCommands:[],position:null}),t=s.useCallback(async m=>{if(r)try{const u=ke(m);await r.addStoredCommand(u),n(d=>({...d,storedCommands:[...d.storedCommands,u],position:null}))}catch(u){console.warn("Failed to save command to history:",u)}},[r]),o=s.useCallback(async()=>r?await r.getStoredCommands():[],[r]);s.useEffect(()=>{if(!r)return;(async()=>{try{const u=await r.getStoredCommands();return n(d=>({...d,storedCommands:u})),u}catch(u){console.warn("Failed to load command history:",u)}})()},[r]);const a=s.useCallback(async m=>{if((await o()).length===0)return{segments:null,position:null};let d=null;return m==="up"?e.position===null?d=e.storedCommands.length-1:e.position>0?d=e.position-1:d=0:e.position===null||e.position>=e.storedCommands.length-1?d=null:d=e.position+1,n(g=>({...g,position:d})),d===null?{segments:[],position:null}:{segments:d!==null?e.storedCommands[d].commandSegments:null,position:d}},[e,o]),c=s.useCallback(async()=>{try{if(!r)return;await r.clear(),n({storedCommands:[],position:null})}catch(m){console.warn("Failed to clear command history:",m)}},[r]);return{history:e,addStoredCommand:t,getStoredCommands:o,navigateHistory:a,clear:c}}const te=()=>{const r=F(),e=q(),n=ne(),t=j(),o=R(),[a,c]=s.useState({currentInput:"",isEnteringArg:!1,output:[],history:{commands:[],position:null,storage:o}});s.useEffect(()=>{},[o]),s.useEffect(()=>{c(p=>({...p,history:{commands:n.history.storedCommands,position:n.history.position,storage:o}}))},[n.history,o]);const m={setCurrentInput:s.useCallback(p=>{S.debug("[CitadelActions] setCurrentInput: ",p),c(g=>({...g,currentInput:p}))},[]),setIsEnteringArg:s.useCallback(p=>{S.debug("[CitadelActions] setIsEnteringArg: ",p),c(g=>({...g,isEnteringArg:p}))},[]),addOutput:s.useCallback(p=>{S.debug("[CitadelActions]addOutput: ",p),c(g=>({...g,output:[...g.output,p]}))},[]),executeCommand:s.useCallback(async()=>{const p=t.path(),g=e.getCommand(p);if(!g){console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ",p);return}const k=new ee(t);c(x=>({...x,output:[...x.output,k]}));try{const x=new Promise((l,h)=>{setTimeout(()=>{h(new Error("Request timed out"))},r.commandTimeoutMs)}),A=t.arguments.map(l=>l.value||""),_=await Promise.race([g.handler(A),x]);if(!(_ instanceof H))throw new Error(`The ${p.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
33
4
  For example:
34
5
  return new JsonCommandResult({ text: "Hello World" });
35
- Check the definition of the ${h.join(".")} command and update the return type for its handler.`);M.markSuccess(),m(u=>({...u,output:u.output.map(b=>b.timestamp===N.timestamp?{...b,result:M}:b)}))}catch(T){const D=new ze(T instanceof Error?T.message:"Unknown error");D.markFailure(),m(M=>({...M,output:M.output.map(u=>u.timestamp===N.timestamp?{...u,result:D}:u)}))}},[n,o.commandTimeoutMs,l]),clearHistory:s.useCallback(async()=>{try{await t.clear()}catch(h){console.warn("Failed to clear history:",h)}},[t])},g=s.useCallback(()=>n.getCompletions_s(r.path()),[r,n]),y=s.useCallback(()=>n.getCompletions(r.path()),[r,n]);return{state:p,actions:d,getAvailableCommands_s:g,getAvailableCommandSegments:y}},Ke={blink:{character:"▋",speed:530,color:"#fff"},spin:{character:"⠋",speed:120,color:"#fff"},solid:{character:"▋",speed:0,color:"#fff"},bbs:{character:"|",speed:120,color:"#fff"}},Be=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],qe=["|","/","-","\\"],Mn=({style:o={type:"blink"},isValid:n=!0,errorMessage:t})=>{const r=s.useMemo(()=>({...Ke[o.type],...o}),[o]),[l,i]=s.useState(!0),[p,m]=s.useState(0);s.useEffect(()=>{if(r.speed===0)return;const y=setInterval(()=>{r.type==="blink"?i(h=>!h):["spin","bbs"].includes(r.type)&&m(h=>(h+1)%(r.type==="bbs"?qe.length:Be.length))},r.speed);return()=>clearInterval(y)},[r.type,r.speed]);const d=s.useMemo(()=>({color:n?r.color:"#ff4444",transition:"color 0.15s ease-in-out"}),[n,r.color]),g=()=>!n&&t?"✗":["spin","bbs"].includes(r.type)?(r.type==="bbs"?qe:Be)[p]:r.type==="solid"||l?r.character:" ";return f.jsx("div",{className:"relative inline-block",children:f.jsx("span",{className:`command-cursor ${n?"":"animate-shake"}`,style:d,title:t,children:g()})})};function Hn(o,n){switch(n.type){case"set":return I.debug(`[inputStateReducer] InputState changing from ${o} to ${n.state}`),n.state;default:return o}}const $n=()=>{const{state:o}=Ve(),n=fe(),t=Ye(),r=oe(),l=ae(),[i,p]=s.useReducer(Hn,"idle"),m=u=>{p({type:"set",state:u})},d=()=>{const b=n.getCompletions(r.path())[0]||r.nullSegment;return I.debug("[getNextExpectedSegment] ",b),b},g=s.useCallback(()=>n.getCompletions_s(r.path()).map(b=>n.getCommand([...r.path(),b])).filter(b=>b!==void 0),[n]),y=s.useCallback((u,b)=>{if(!u)return b;const _=b.reduce((P,Y)=>{const z=d();return(z==null?void 0:z.type)==="word"&&P.set(z.name,Y),P},new Map);return Array.from(_.values()).filter(P=>{const Y=d();return Y.type!=="word"?!1:Y.name.toLowerCase().startsWith(u.toLowerCase())})},[]),h=s.useCallback(u=>{const _=n.getCompletions(r.path()).filter(C=>C.type==="word").filter(C=>C.name.toLowerCase().startsWith(u.toLowerCase()));return _.length===1?_[0]:r.nullSegment},[y]),x=s.useCallback(u=>{const b=r.path(),_=n.getCompletions(b);return _.length===0&&u?!1:_.some(C=>C.type==="argument")?!0:_.some(C=>C.type==="word"&&C.name.toLowerCase().startsWith(u.toLowerCase()))},[n]),N=s.useCallback(u=>{I.debug("[tryAutoComplete] input: ",u);const b=h(u);return!b||b.name===u?new He:(I.debug("[tryAutoComplete] result: ",b),b)},[g,h,r,n,d]),T=s.useCallback((u,b)=>{if(o.history.position===null){if(b.setCurrentInput(u),I.debug("[useCommandParser][handleInputChange] newValue: ",u),i==="entering_argument"){const _=Je(u);if(_.isQuoted)if(_.isComplete){const C=d();if(C.type==="argument"){const P=C;P.value=u.trim()||"",I.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",P),r.push(P),b.setCurrentInput(""),m("idle");return}}else return;else if(_.isComplete){const C=d();C.value=u.trim()||"",I.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",C),r.push(C),b.setCurrentInput(""),m("idle");return}else return}if(i=="entering_command"){const _=N(u);if(_.type==="word"){I.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",_),r.push(_),b.setCurrentInput(""),m("idle");return}}}},[N,l,o]),D=s.useCallback(async(u,b,_)=>{if(!(u.key==="Backspace"||u.key==="Enter"||u.key==="ArrowUp"||u.key==="ArrowDown"||u.key==="ArrowLeft"||u.key==="ArrowRight"||u.key==="Escape"||u.key==="Delete"||u.key==="Home"||u.key==="End"||u.key.length===1))return;const{currentInput:P,isEnteringArg:Y}=b,z=Je(P);switch(u.key){case"Backspace":{P===""&&(u.preventDefault(),r.size()>0&&r.pop(),m("idle"));return}case"Enter":{if(u.preventDefault(),z.isQuoted&&!z.isComplete)return;if(i==="entering_argument"){const V=d();V.value=P,I.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ",V),r.push(V)}I.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ",r),_.executeCommand(),t.addStoredCommand(r.toArray()),M(_);return}case"ArrowUp":{u.preventDefault();const $=await t.navigateHistory("up",r.toArray());$.segments&&(r.clear(),r.pushAll($.segments),_.setCurrentInput(""));return}case"ArrowDown":{u.preventDefault();const $=await t.navigateHistory("down",r.toArray());$.segments&&(r.clear(),r.pushAll($.segments),_.setCurrentInput(""));return}default:if(!Y&&u.key.length===1){const $=P+u.key;if(!x($)){u.preventDefault();return}}}},[n,y,g,h,i,x,l]),M=s.useCallback(u=>{u.setCurrentInput(""),u.setIsEnteringArg(!1),r.clear(),m("idle")},[]);return{handleInputChange:T,handleKeyDown:D,inputState:i,setInputStateWithLogging:m,findMatchingCommands:y,getAutocompleteSuggestion:h,getAvailableNodes:g,getNextExpectedSegment:d,isValidCommandInput:x}};function Je(o){const n=[];let t="",r=!1,l;for(let i=0;i<o.length;i++){const p=o[i];(p==='"'||p==="'")&&(!r||p===l)?r?(n.push(t),t="",r=!1,l=void 0):(t&&(n.push(t),t=""),r=!0,l=p):!r&&p===" "?t&&(n.push(t),t=""):t+=p}return{words:n,currentWord:t,isQuoted:r,quoteChar:l,isComplete:!r&&!t}}const Wn={invalidInput:"_invalidInput_e9b9w_12",shake:"_shake_e9b9w_1",flashBorder:"_flashBorder_e9b9w_1"},Ln=({state:o,actions:n})=>{const t=s.useRef(null),r=fe(),l=oe(),{handleKeyDown:i,handleInputChange:p,inputState:m,setInputStateWithLogging:d,getNextExpectedSegment:g}=$n(),[y]=s.useState(!1),h=re(),x=ae(),N=C=>{i(C,o,n)},T=C=>{p(C.target.value,n)},D=C=>{C.preventDefault();const P=C.clipboardData.getData("text");p(P,n)};s.useEffect(()=>{t.current&&t.current.focus(),m!=="entering_command"&&d("entering_command")},[]),s.useEffect(()=>{if(m!=="idle")return;const C=g();let P="idle";switch(C.type){case"word":P="entering_command",n.setIsEnteringArg(!1);break;case"argument":P="entering_argument",n.setIsEnteringArg(!0);break}I.debug(`[CommandInput] changing inputState to '${P}'`),d(P)},[x]);const[M,u]=s.useState([]);s.useEffect(()=>{const C=[],P=l.toArray().map((z,$)=>{C.push(z.name);const V=r.hasNextSegment(C);if(z.type==="argument"){let se=z;return f.jsxs(s.Fragment,{children:[f.jsx("span",{className:"text-gray-200 whitespace-pre",children:se.value}),$<l.size()&&V&&f.jsx("span",{className:"text-gray-200 whitespace-pre",children:" "})]},"arg-"+se.name+se.value)}return f.jsxs(s.Fragment,{children:[f.jsx("span",{className:"text-blue-400 whitespace-pre",children:z.name}),$<l.size()&&V&&f.jsx("span",{className:"text-blue-400 whitespace-pre",children:" "})]},"word-"+z.name)});u([f.jsx("div",{className:"flex items-center gap-1","data-testid":"user-input-area",children:P},"{segmentStackVersion}")])},[x]);const[b,_]=s.useState("");return s.useEffect(()=>{const C=g();C.type==="argument"?_(C.name):_("")},[x]),f.jsx("div",{className:"flex flex-col w-full bg-gray-900 rounded-lg p-4",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-gray-400 font-mono",children:">"}),f.jsxs("div",{className:"flex-1 font-mono flex items-center",children:[M,f.jsxs("div",{className:"relative flex-1",children:[f.jsx("input",{ref:t,type:"text",role:"textbox",value:o.currentInput,onChange:T,onKeyDown:N,onPaste:D,"data-testid":"citadel-command-input",className:`w-full bg-transparent outline-none text-gray-200 caret-transparent ${y?Wn.invalidInput:""}`,spellCheck:!1,autoComplete:"off",placeholder:b}),f.jsx("div",{className:"absolute top-0 pointer-events-none",style:{left:`${o.currentInput.length}ch`,transition:"left 0.05s ease-out"},children:f.jsx(Mn,{style:{type:h.cursorType??U.cursorType,color:h.cursorColor||U.cursorColor,speed:h.cursorSpeed||U.cursorSpeed}})})]})]})]})})},Yn=()=>f.jsx("div",{"data-testid":"spinner",className:"animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"}),Vn=({command:o,timestamp:n,status:t})=>f.jsxs("div",{className:"flex items-center gap-2 font-mono text-sm",children:[f.jsxs("span",{className:"text-gray-200",children:["> ",o.split(" ").map((r,l)=>{const i=r.startsWith("<")&&r.endsWith(">");return f.jsxs("span",{className:i?"text-green-400":"text-gray-200",children:[l>0?" ":"",r]},l)})]}),f.jsx("span",{className:"text-gray-400",children:"·"}),f.jsx("span",{className:"text-gray-500",children:n}),t===X.Pending&&f.jsx(Yn,{}),t===X.Success&&f.jsx("div",{"data-testid":"success-indicator",className:"w-4 h-4 rounded-full bg-green-500"}),(t===X.Timeout||t===X.Failure)&&f.jsx("div",{"data-testid":"success-indicator",className:"w-4 h-4 rounded-full bg-red-500"})]}),Kn=({output:o,outputRef:n})=>{const t=re(),r=s.useCallback(()=>{if(n.current){const l=n.current;requestAnimationFrame(()=>{l.scrollTop=l.scrollHeight})}},[n]);return s.useEffect(()=>{if(r(),n.current){const l=n.current.getElementsByTagName("img"),i=l[l.length-1];if(i&&!i.complete)return i.addEventListener("load",r),()=>i.removeEventListener("load",r)}},[o,r]),f.jsx("div",{ref:n,className:"h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",children:o.map((l,i)=>f.jsxs("div",{className:"mb-4 last:mb-0",children:[f.jsx(Vn,{command:l.command.join(" "),timestamp:new Date(l.timestamp).toLocaleTimeString(),status:l.result.status}),f.jsx("pre",{className:`text-gray-200 whitespace-pre font-mono ${t.outputFontSize}`,children:l.result.render()})]},i))})},Bn=()=>{const o=fe(),n=re(),t=oe(),r=ae(),l="h-12 mt-2 border-t border-gray-700 px-4",i="text-gray-300 pt-2",p=o.getCompletions(t.path());I.debug("[AvailableCommands] nextCommandSegments: ",p);const m=s.useMemo(()=>{if(n.includeHelpCommand){const y=p.filter(x=>x.name!=="help"),h=p.find(x=>x.name==="help");return[...y,...h?[h]:[]]}return p},[p,r,n.includeHelpCommand]),d=p.some(y=>y.type==="argument"),g=p[0];return f.jsx("div",{className:l,"data-testid":"available-commands",children:f.jsx("div",{className:i,children:d?p.length>0?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-blue-400",children:g.name}),g.description&&f.jsxs("span",{className:"text-gray-400 ml-2",children:["- ",g.description]})]}):null:f.jsx("div",{className:"flex flex-wrap gap-2",children:m==null?void 0:m.map(y=>{const h=m==null?void 0:m.reduce((x,N)=>{if(N===y)return x;let T=0;for(;T<y.name.length&&T<N.name.length&&y.name[T].toLowerCase()===N.name[T].toLowerCase();)T++;return Math.max(x,T+1)},1);return f.jsx("div",{className:"px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",children:f.jsxs("span",{className:"font-mono text-white",children:[f.jsx("strong",{className:"underline",children:y.name.slice(0,h)}),y.name.slice(h)]})},y.name)})})})})},Ge=`:host {
6
+ Check the definition of the ${p.join(".")} command and update the return type for its handler.`);_.markSuccess(),c(l=>({...l,output:l.output.map(h=>h.timestamp===k.timestamp?{...h,result:_}:h)}))}catch(x){const A=new B(x instanceof Error?x.message:"Unknown error");A.markFailure(),c(_=>({..._,output:_.output.map(l=>l.timestamp===k.timestamp?{...l,result:A}:l)}))}},[e,r.commandTimeoutMs,t]),clearHistory:s.useCallback(async()=>{try{await n.clear()}catch(p){console.warn("Failed to clear history:",p)}},[n])},u=s.useCallback(()=>e.getCompletions_s(t.path()),[t,e]),d=s.useCallback(()=>e.getCompletions(t.path()),[t,e]);return{state:a,actions:m,getAvailableCommands_s:u,getAvailableCommandSegments:d}},re={blink:{character:"▋",speed:530,color:"#fff"},spin:{character:"⠋",speed:120,color:"#fff"},solid:{character:"▋",speed:0,color:"#fff"},bbs:{character:"|",speed:120,color:"#fff"}},oe=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],se=["|","/","-","\\"],Ee=({style:r={type:"blink"},isValid:e=!0,errorMessage:n})=>{const t=s.useMemo(()=>({...re[r.type],...r}),[r]),[o,a]=s.useState(!0),[c,m]=s.useState(0);s.useEffect(()=>{if(t.speed===0)return;const p=setInterval(()=>{t.type==="blink"?a(g=>!g):["spin","bbs"].includes(t.type)&&m(g=>(g+1)%(t.type==="bbs"?se.length:oe.length))},t.speed);return()=>clearInterval(p)},[t.type,t.speed]);const u=s.useMemo(()=>({color:e?t.color:"#ff4444",transition:"color 0.15s ease-in-out"}),[e,t.color]),d=()=>!e&&n?"✗":["spin","bbs"].includes(t.type)?(t.type==="bbs"?se:oe)[c]:t.type==="solid"||o?t.character:" ";return i.jsx("div",{className:"relative inline-block",children:i.jsx("span",{className:`command-cursor ${e?"":"animate-shake"}`,style:u,title:n,children:d()})})};function _e(r,e){switch(e.type){case"set":return S.debug(`[inputStateReducer] InputState changing from ${r} to ${e.state}`),e.state;default:return r}}const Ne=()=>{const{state:r}=te(),e=q(),n=ne(),t=j(),[o,a]=s.useReducer(_e,"idle"),c=l=>{a({type:"set",state:l})},m=s.useCallback(()=>{const h=e.getCompletions(t.path())[0]||t.nullSegment;return S.debug("[getNextExpectedSegment] ",h),h},[e,t]),u=s.useCallback(()=>e.getCompletions_s(t.path()).map(h=>e.getCommand([...t.path(),h])).filter(h=>h!==void 0),[e,t]),d=s.useCallback((l,h)=>{if(!l)return h;const f=h.reduce((b,C)=>{const v=m();return(v==null?void 0:v.type)==="word"&&b.set(v.name,C),b},new Map);return Array.from(f.values()).filter(()=>{const b=m();return b.type!=="word"?!1:b.name.toLowerCase().startsWith(l.toLowerCase())})},[m]),p=s.useCallback(l=>{const f=e.getCompletions(t.path()).filter(E=>E.type==="word").filter(E=>E.name.toLowerCase().startsWith(l.toLowerCase()));return f.length===1?f[0]:t.nullSegment},[e,t]),g=s.useCallback(l=>{const h=t.path(),f=e.getCompletions(h);return f.length===0&&l?!1:f.some(b=>b.type==="argument")?!0:f.some(b=>b.type==="word"&&b.name.toLowerCase().startsWith(l.toLowerCase()))},[e,t]),k=s.useCallback(l=>{S.debug("[tryAutoComplete] input: ",l);const h=p(l);return!h||h.name===l?new X:(S.debug("[tryAutoComplete] result: ",h),h)},[p]),x=s.useCallback((l,h)=>{if(r.history.position===null){if(h.setCurrentInput(l),S.debug("[useCommandParser][handleInputChange] newValue: ",l),o==="entering_argument"){const f=ae(l);if(f.isQuoted)if(f.isComplete){const E=m();if(E.type==="argument"){const b=E;b.value=l.trim()||"",S.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",b),t.push(b),h.setCurrentInput(""),c("idle");return}}else return;else if(f.isComplete){const E=m();E.value=l.trim()||"",S.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",E),t.push(E),h.setCurrentInput(""),c("idle");return}else return}if(o=="entering_command"){const f=k(l);if(f.type==="word"){S.debug("[useCommandParser][handleInputChange][entering_command] pushing: ",f),t.push(f),h.setCurrentInput(""),c("idle");return}}}},[k,r,m,o,t]),A=s.useCallback(l=>{l.setCurrentInput(""),l.setIsEnteringArg(!1),t.clear(),c("idle")},[t]),_=s.useCallback((l,h,f)=>{if(!(l.key==="Backspace"||l.key==="Enter"||l.key==="ArrowUp"||l.key==="ArrowDown"||l.key==="ArrowLeft"||l.key==="ArrowRight"||l.key==="Escape"||l.key==="Delete"||l.key==="Home"||l.key==="End"||l.key.length===1))return!0;const{currentInput:b,isEnteringArg:C}=h,v=ae(b);switch(l.key){case"Backspace":return b===""&&(l.preventDefault(),t.size()>0&&t.pop(),c("idle")),!0;case"Enter":{if(l.preventDefault(),v.isQuoted&&!v.isComplete)return!0;if(o==="entering_argument"||C&&b.trim()){const P=m();P.value=b,S.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ",P),t.push(P)}const z=t.path(),I=e.getCommand(z);if(I){const M=I.segments.filter(O=>O.type==="argument"),P=t.arguments;if(M.length>P.length)return!1}return S.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ",t),f.executeCommand(),n.addStoredCommand(t.toArray()),A(f),!0}case"ArrowUp":return l.preventDefault(),(async()=>{const z=await n.navigateHistory("up",t.toArray());return z.segments&&(t.clear(),t.pushAll(z.segments),f.setCurrentInput("")),!0})();case"ArrowDown":return l.preventDefault(),(async()=>{const z=await n.navigateHistory("down",t.toArray());return z.segments&&(t.clear(),t.pushAll(z.segments),f.setCurrentInput("")),!0})();default:{if(!C&&l.key.length===1){const z=b+l.key;if(!g(z))return l.preventDefault(),!1}return!0}}},[o,g,m,n,A,t]);return{handleInputChange:x,handleKeyDown:_,inputState:o,setInputStateWithLogging:c,findMatchingCommands:d,getAutocompleteSuggestion:p,getAvailableNodes:u,getNextExpectedSegment:m,isValidCommandInput:g}};function ae(r){const e=[];let n="",t=!1,o;for(let a=0;a<r.length;a++){const c=r[a];(c==='"'||c==="'")&&(!t||c===o)?t?(e.push(n),n="",t=!1,o=void 0):(n&&(e.push(n),n=""),t=!0,o=c):!t&&c===" "?n&&(e.push(n),n=""):n+=c}return{words:e,currentWord:n,isQuoted:t,quoteChar:o,isComplete:!t&&!n}}const Ae=()=>{const r=j(),[e,n]=s.useState(0);return s.useEffect(()=>{const t={update:()=>{n(o=>o+1)}};return r.subscribe(t),()=>{r.unsubscribe(t)}},[r]),e},ze=({state:r,actions:e})=>{const n=s.useRef(null),t=q(),o=j(),{handleKeyDown:a,handleInputChange:c,inputState:m,setInputStateWithLogging:u,getNextExpectedSegment:d}=Ne(),[p,g]=s.useState(!1),k=F(),x=Ae(),A=async C=>{const v=a(C,r,e);await Promise.resolve(v)===!1&&(g(!0),setTimeout(()=>g(!1),500))},_=C=>{c(C.target.value,e)},l=C=>{C.preventDefault();const v=C.clipboardData.getData("text");c(v,e)};s.useEffect(()=>{n.current&&n.current.focus(),m!=="entering_command"&&u("entering_command")},[m,u]),s.useEffect(()=>{if(m!=="idle")return;const C=d();let v="idle";switch(C.type){case"word":v="entering_command",e.setIsEnteringArg(!1);break;case"argument":v="entering_argument",e.setIsEnteringArg(!0);break}u(v)},[x,m,d,u,e]);const[h,f]=s.useState([]);s.useEffect(()=>{const C=[],v=o.toArray().map((I,M)=>{C.push(I.name);const P=t.hasNextSegment(C);if(I.type==="argument"){const O=I;return i.jsxs(s.Fragment,{children:[i.jsx("span",{className:"text-gray-200 whitespace-pre",children:O.value}),M<o.size()&&P&&i.jsx("span",{className:"text-gray-200 whitespace-pre",children:" "})]},"arg-"+O.name+O.value)}return i.jsxs(s.Fragment,{children:[i.jsx("span",{className:"text-blue-400 whitespace-pre",children:I.name}),M<o.size()&&P&&i.jsx("span",{className:"text-blue-400 whitespace-pre",children:" "})]},"word-"+I.name)});f([i.jsx("div",{className:"flex items-center gap-1","data-testid":"user-input-area",children:v},"{segmentStackVersion}")])},[x,t,o]);const[E,b]=s.useState("");return s.useEffect(()=>{const C=d();C.type==="argument"?b(C.name):b("")},[x,d]),i.jsxs("div",{className:"flex flex-col w-full bg-gray-900 rounded-lg p-4",children:[i.jsx("style",{children:`
7
+ @keyframes subtleGlow {
8
+ 0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
9
+ 50% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
10
+ }
11
+ .invalid-input-animation {
12
+ animation: subtleGlow 0.4s ease-in-out;
13
+ }
14
+ `}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-gray-400 font-mono",children:">"}),i.jsxs("div",{className:"flex-1 font-mono flex items-center",children:[h,i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{ref:n,type:"text",role:"textbox",value:r.currentInput,onChange:_,onKeyDown:A,onPaste:l,"data-testid":"citadel-command-input",className:`w-full bg-transparent outline-none text-gray-200 caret-transparent ${p?"invalid-input-animation":""}`,spellCheck:!1,autoComplete:"off",placeholder:E}),i.jsx("div",{className:"absolute top-0 pointer-events-none",style:{left:`${r.currentInput.length}ch`,transition:"left 0.05s ease-out"},children:i.jsx(Ee,{style:{type:k.cursorType??N.cursorType,color:k.cursorColor||N.cursorColor,speed:k.cursorSpeed||N.cursorSpeed}})})]})]})]})]})},Ie=()=>i.jsx("div",{"data-testid":"spinner",className:"animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"}),Pe=({command:r,timestamp:e,status:n})=>i.jsxs("div",{className:"flex items-center gap-2 font-mono text-sm",children:[i.jsxs("span",{className:"text-gray-200",children:["> ",r.split(" ").map((t,o)=>{const a=t.startsWith("<")&&t.endsWith(">");return i.jsxs("span",{className:a?"text-green-400":"text-gray-200",children:[o>0?" ":"",t]},o)})]}),i.jsx("span",{className:"text-gray-400",children:"·"}),i.jsx("span",{className:"text-gray-500",children:e}),n===T.Pending&&i.jsx(Ie,{}),n===T.Success&&i.jsx("div",{"data-testid":"success-indicator",className:"w-4 h-4 rounded-full bg-green-500"}),(n===T.Timeout||n===T.Failure)&&i.jsx("div",{"data-testid":"success-indicator",className:"w-4 h-4 rounded-full bg-red-500"})]}),He=({output:r,outputRef:e})=>{const n=F(),t=s.useCallback(()=>{if(e.current){const o=e.current;requestAnimationFrame(()=>{o.scrollTop=o.scrollHeight})}},[e]);return s.useEffect(()=>{if(t(),e.current){const o=e.current.getElementsByTagName("img"),a=o[o.length-1];if(a&&!a.complete)return a.addEventListener("load",t),()=>a.removeEventListener("load",t)}},[r,t,e]),i.jsx("div",{ref:e,className:"h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",children:r.map((o,a)=>i.jsxs("div",{className:"mb-4 last:mb-0",children:[i.jsx(Pe,{command:o.command.join(" "),timestamp:new Date(o.timestamp).toLocaleTimeString(),status:o.result.status}),i.jsx("pre",{className:`text-gray-200 whitespace-pre font-mono ${n.outputFontSize}`,children:o.result.render()})]},a))})},De=()=>{const r=q(),e=F(),n=j(),t="h-12 mt-2 border-t border-gray-700 px-4",o="text-gray-300 pt-2",a=r.getCompletions(n.path());S.debug("[AvailableCommands] nextCommandSegments: ",a);const c=s.useMemo(()=>{if(e.includeHelpCommand){const d=a.filter(g=>g.name!=="help"),p=a.find(g=>g.name==="help");return[...d,...p?[p]:[]]}return a},[a,e.includeHelpCommand]),m=a.some(d=>d.type==="argument"),u=a[0];return i.jsx("div",{className:t,"data-testid":"available-commands",children:i.jsx("div",{className:o,children:m?a.length>0?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-blue-400",children:u.name}),u.description&&i.jsxs("span",{className:"text-gray-400 ml-2",children:["- ",u.description]})]}):null:i.jsx("div",{className:"flex flex-wrap gap-2",children:c==null?void 0:c.map(d=>{const p=c==null?void 0:c.reduce((g,k)=>{if(k===d)return g;let x=0;for(;x<d.name.length&&x<k.name.length&&d.name[x].toLowerCase()===k.name[x].toLowerCase();)x++;return Math.max(g,x+1)},1);return i.jsx("div",{className:"px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",children:i.jsxs("span",{className:"font-mono text-white",children:[i.jsx("strong",{className:"underline",children:d.name.slice(0,p)}),d.name.slice(p)]})},d.name)})})})})},ie=`:host {
36
15
  --citadel-bg: rgb(17, 24, 39);
37
16
  --citadel-text: rgba(255, 255, 255, 0.87);
38
17
  --citadel-border: rgb(55, 65, 81);
@@ -52,6 +31,7 @@ Check the definition of the ${h.join(".")} command and update the return type fo
52
31
  bottom: 0;
53
32
  left: 0;
54
33
  right: 0;
34
+ z-index: 2147483647; /* Maximum z-index value */
55
35
  overflow: hidden;
56
36
 
57
37
  pointer-events: auto;
@@ -121,7 +101,7 @@ a:hover {
121
101
  text-align: left;
122
102
  }
123
103
 
124
- `,Xe=`/* Keep only component-specific styles here */
104
+ `,le=`/* Keep only component-specific styles here */
125
105
 
126
106
  .container {
127
107
  position: fixed;
@@ -191,10 +171,10 @@ a:hover {
191
171
  .citadel_slideDown {
192
172
  animation: citadel_slideDown 0.2s ease-out forwards;
193
173
  }
194
- `,Qe=`@tailwind base;
174
+ `,ce=`@tailwind base;
195
175
  @tailwind components;
196
176
  @tailwind utilities;
197
- `,qn=`*, ::before, ::after {
177
+ `,Te=`*, ::before, ::after {
198
178
  --tw-border-spacing-x: 0;
199
179
  --tw-border-spacing-y: 0;
200
180
  --tw-translate-x: 0;
@@ -1011,5 +991,5 @@ video {
1011
991
  .last\\:mr-0:last-child {
1012
992
  margin-right: 0px;
1013
993
  }
1014
- `,Jn=({config:o=U,commandRegistry:n=new Ce,containerId:t=null})=>(s.useEffect(()=>{I.configure({level:o.logLevel||U.logLevel||de.ERROR,prefix:"[Citadel]"});const r=new Ze(n,o),l=t?document.getElementById(t):document.body;return l?l.appendChild(r):(console.warn(`Container with id "${t}" not found, falling back to body`),document.body.appendChild(r)),()=>{var i;(i=r.parentElement)==null||i.removeChild(r)}},[n,t]),null);class Ze extends HTMLElement{constructor(t,r){super();A(this,"shadow");A(this,"root",null);A(this,"commands");A(this,"config");this.shadow=this.attachShadow({mode:"open"}),this.commands=t,this.config=r}connectedCallback(){try{const r=[Ge,Xe,Qe,qn].map(l=>{const i=new CSSStyleSheet;return i.replaceSync(l),i});this.shadow.adoptedStyleSheets=[...r]}catch{const l=[Ge,Xe,Qe].join(`
1015
- `),i=document.createElement("style");i.textContent=l,this.shadow.appendChild(i)}const t=document.createElement("div");t.id="citadel-root",this.shadow.appendChild(t),this.root=ye(t),this.root.render(f.jsx(Fn,{config:this.config||U,commands:this.commands,children:f.jsx(Gn,{})}))}}customElements.define("citadel-element",Ze);const Gn=()=>{const[o,n]=s.useState(!1),[t,r]=s.useState(!1),l=re(),[i,p]=s.useState(()=>l.initialHeight||null),m=s.useRef(null),d=s.useRef(null),g=s.useRef(!1),y=s.useRef(0),h=s.useRef(0),{state:x,actions:N}=Ve(),T=s.useCallback(u=>{d.current&&(g.current=!0,y.current=u.clientY,h.current=d.current.offsetHeight,document.documentElement.style.userSelect="none",document.documentElement.style.webkitUserSelect="none",document.documentElement.style.mozUserSelect="none",document.documentElement.style.msUserSelect="none",document.addEventListener("mouseup",D))},[]),D=s.useCallback(()=>{g.current=!1,document.documentElement.style.userSelect="",document.documentElement.style.webkitUserSelect="",document.documentElement.style.mozUserSelect="",document.documentElement.style.msUserSelect="",document.removeEventListener("mouseup",D)},[]);s.useEffect(()=>()=>{document.removeEventListener("mouseup",D)},[D]),_n({onOpen:()=>n(!0),onClose:()=>r(!0),isVisible:o,showCitadelKey:l.showCitadelKey||"."});const M=s.useCallback(()=>{t&&(n(!1),r(!1))},[t]);return jn({isVisible:o,isClosing:t,onAnimationComplete:M}),o?f.jsxs("div",{ref:d,className:`container ${o?"citadel_slideUp":""} ${t?"citadel_slideDown":""}`,style:{...i?{height:i}:void 0,maxHeight:l.maxHeight},children:[f.jsx("div",{className:"resizeHandle",onMouseDown:T}),f.jsxs("div",{className:"innerContainer",children:[f.jsx("div",{className:"flex-1 min-h-0 pt-3 px-4",children:f.jsx(Kn,{output:x.output,outputRef:m})}),f.jsxs("div",{children:[f.jsx(Ln,{state:x,actions:N}),f.jsx(Bn,{})]})]})]}):null};j.Citadel=Jn,j.CommandResult=K,j.CommandStatus=X,j.DEFAULT_CURSOR_CONFIGS=Ke,j.ErrorCommandResult=ze,j.ImageCommandResult=Pn,j.JsonCommandResult=Tn,j.OutputItem=Le,j.PendingCommandResult=Fe,j.TextCommandResult=ve,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
994
+ `,Ue=({config:r=N,commandRegistry:e=new L,containerId:n=null})=>(s.useEffect(()=>{S.configure({level:r.logLevel||N.logLevel||$.ERROR,prefix:"[Citadel]"});const t=new de(e,r),o=n?document.getElementById(n):document.body;return o?o.appendChild(t):(console.warn(`Container with id "${n}" not found, falling back to body`),document.body.appendChild(t)),()=>{var a;(a=t.parentElement)==null||a.removeChild(t)}},[e,n,r]),null);class de extends HTMLElement{constructor(n,t){super();y(this,"shadow");y(this,"root",null);y(this,"commandRegistry");y(this,"config");this.shadow=this.attachShadow({mode:"open"}),this.commandRegistry=n,this.config=t}connectedCallback(){try{const t=[ie,le,ce,Te].map(o=>{const a=new CSSStyleSheet;return a.replaceSync(o),a});this.shadow.adoptedStyleSheets=[...t]}catch{const t=[ie,le,ce].join(`
995
+ `),o=document.createElement("style");o.textContent=t,this.shadow.appendChild(o)}const n=document.createElement("div");n.id="citadel-root",this.shadow.appendChild(n),this.root=me.createRoot(n),this.root.render(i.jsx(Se,{config:this.config||N,commandRegistry:this.commandRegistry,children:i.jsx(Fe,{})}))}}customElements.define("citadel-element",de);const Fe=()=>{const[r,e]=s.useState(!1),[n,t]=s.useState(!1),o=F(),[a,c]=s.useState(()=>o.initialHeight||null),m=s.useRef(null),u=s.useRef(null),d=s.useRef(!1),p=s.useRef(0),g=s.useRef(0),{state:k,actions:x}=te();ue({onOpen:()=>e(!0),onClose:()=>t(!0),isVisible:r,showCitadelKey:o.showCitadelKey||"."});const A=s.useCallback(f=>{u.current&&(d.current=!0,p.current=f.clientY,g.current=u.current.offsetHeight,document.documentElement.style.userSelect="none",document.documentElement.style.webkitUserSelect="none",document.documentElement.style.mozUserSelect="none",document.documentElement.style.msUserSelect="none",document.addEventListener("mousemove",_),document.addEventListener("mouseup",l))},[]),_=s.useCallback(f=>{var v;if(!d.current)return;const E=f.clientY-p.current,b=(v=o.maxHeight)!=null&&v.endsWith("vh")?window.innerHeight*parseInt(o.maxHeight,10)/100:parseInt(o.maxHeight||"80vh",10),C=Math.min(Math.max(g.current-E,parseInt(o.minHeight||"200",10)),b);u.current&&(u.current.style.height=`${C}px`,u.current.style.bottom="0",c(`${C}px`))},[o.maxHeight,o.minHeight]),l=s.useCallback(()=>{d.current=!1,document.documentElement.style.userSelect="",document.documentElement.style.webkitUserSelect="",document.documentElement.style.mozUserSelect="",document.documentElement.style.msUserSelect="",document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",l)},[_]);s.useEffect(()=>()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",l)},[_,l]);const h=s.useCallback(()=>{n&&(e(!1),t(!1))},[n]);return pe({isVisible:r,isClosing:n,onAnimationComplete:h}),r?i.jsxs("div",{ref:u,className:`container ${r?"citadel_slideUp":""} ${n?"citadel_slideDown":""}`,style:{...a?{height:a}:void 0,maxHeight:o.maxHeight},children:[i.jsx("div",{className:"resizeHandle",onMouseDown:A}),i.jsxs("div",{className:"innerContainer",children:[i.jsx("div",{className:"flex-1 min-h-0 pt-3 px-4",children:i.jsx(He,{output:k.output,outputRef:m})}),i.jsxs("div",{children:[i.jsx(ze,{state:k,actions:x}),i.jsx(De,{})]})]})]}):null};w.Citadel=Ue,w.CommandRegistry=L,w.CommandResult=H,w.CommandStatus=T,w.DEFAULT_CURSOR_CONFIGS=re,w.ErrorCommandResult=B,w.ImageCommandResult=he,w.JsonCommandResult=ge,w.OutputItem=ee,w.PendingCommandResult=G,w.TextCommandResult=V,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
@@ -8,7 +8,7 @@ export declare const Citadel: ({ config, commandRegistry, containerId }: {
8
8
  export declare class CitadelElement extends HTMLElement {
9
9
  private shadow;
10
10
  private root;
11
- private commands?;
11
+ private commandRegistry?;
12
12
  private config?;
13
13
  constructor(commandRegistry: CommandRegistry, config?: CitadelConfig);
14
14
  connectedCallback(): void;
@@ -3,12 +3,16 @@ import { CitadelConfig } from './types';
3
3
  import { CommandStorage } from '../types/storage';
4
4
  import { CommandRegistry } from '../types/command-registry';
5
5
  import { SegmentStack } from '../types/segment-stack';
6
+ interface CitadelContextValue {
7
+ config: CitadelConfig;
8
+ commands: CommandRegistry;
9
+ storage?: CommandStorage;
10
+ segmentStack: SegmentStack;
11
+ }
12
+ declare const CitadelConfigContext: React.Context<CitadelContextValue>;
13
+ export { CitadelConfigContext };
6
14
  export declare const CitadelConfigProvider: React.FC<{
7
15
  config?: CitadelConfig;
8
- commands?: CommandRegistry;
16
+ commandRegistry?: CommandRegistry;
9
17
  children: React.ReactNode;
10
18
  }>;
11
- export declare const useCitadelConfig: () => CitadelConfig;
12
- export declare const useCitadelCommands: () => CommandRegistry;
13
- export declare const useCitadelStorage: () => CommandStorage | undefined;
14
- export declare const useSegmentStack: () => SegmentStack;
@@ -0,0 +1,4 @@
1
+ export declare const useCitadelConfig: () => import('./types').CitadelConfig;
2
+ export declare const useCitadelCommands: () => import('../types/command-registry').CommandRegistry;
3
+ export declare const useCitadelStorage: () => import('../types/storage').CommandStorage | undefined;
4
+ export declare const useSegmentStack: () => import('../types/segment-stack').SegmentStack;
@@ -3,7 +3,7 @@ import { CitadelState, CitadelActions } from '../types/state';
3
3
  export type InputState = 'idle' | 'entering_command' | 'entering_argument';
4
4
  export declare const useCommandParser: () => {
5
5
  handleInputChange: (newValue: string, actions: CitadelActions) => void;
6
- handleKeyDown: (e: KeyboardEvent | React.KeyboardEvent, state: CitadelState, actions: CitadelActions) => Promise<void>;
6
+ handleKeyDown: (e: KeyboardEvent | React.KeyboardEvent, state: CitadelState, actions: CitadelActions) => boolean | Promise<boolean>;
7
7
  inputState: InputState;
8
8
  setInputStateWithLogging: (newState: InputState) => void;
9
9
  findMatchingCommands: (input: string, availableNodes: CommandNode[]) => CommandNode[];
@@ -1,5 +1,9 @@
1
1
  import { CommandResult } from './command-results';
2
- /** Function type for handling command execution */
2
+ /**
3
+ * A callback function that executes a command and returns a Promise of CommandResult.
4
+ * Similar to a lambda in Ruby, this is a first-class function that can be passed
5
+ * as an argument and stored as a variable.
6
+ */
3
7
  export type CommandHandler = (args: string[]) => Promise<CommandResult>;
4
8
  /**
5
9
  * A no-op handler that returns an empty string. Used as the default handler
@@ -16,8 +16,8 @@ export declare abstract class CommandResult {
16
16
  abstract render(): React.ReactNode;
17
17
  }
18
18
  export declare class JsonCommandResult extends CommandResult {
19
- readonly data: any;
20
- constructor(data: any, timestamp?: number);
19
+ readonly data: unknown;
20
+ constructor(data: unknown, timestamp?: number);
21
21
  render(): React.ReactNode;
22
22
  }
23
23
  export declare class TextCommandResult extends CommandResult {
@@ -1,3 +1,3 @@
1
1
  import { CommandRegistry } from './command-registry';
2
2
  import { TextCommandResult } from './command-results';
3
- export declare const createHelpHandler: (cmdRegistry: CommandRegistry) => (_args: string[]) => Promise<TextCommandResult>;
3
+ export declare const createHelpHandler: (cmdRegistry: CommandRegistry) => () => Promise<TextCommandResult>;
@@ -13,9 +13,9 @@ export declare class Logger {
13
13
  level: LogLevel;
14
14
  prefix?: string;
15
15
  }): void;
16
- static trace(...args: any[]): void;
17
- static debug(...args: any[]): void;
18
- static info(...args: any[]): void;
19
- static warn(...args: any[]): void;
20
- static error(...args: any[]): void;
16
+ static trace(...args: unknown[]): void;
17
+ static debug(...args: unknown[]): void;
18
+ static info(...args: unknown[]): void;
19
+ static warn(...args: unknown[]): void;
20
+ static error(...args: unknown[]): void;
21
21
  }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export * from './src/index'
2
- export {}
1
+ export { Citadel } from './components/Citadel/Citadel';
2
+ export { CommandRegistry } from './components/Citadel/types/command-registry';
3
+ export type { CitadelConfig } from './components/Citadel/config/types';
4
+ export * from './components/Citadel/types';
package/package.json CHANGED
@@ -8,19 +8,24 @@
8
8
  "interface",
9
9
  "console"
10
10
  ],
11
- "author": "James Childers <james.childers@gmail.com>",
11
+ "author": {
12
+ "name": "James Childers",
13
+ "email": "james.childers@gmail.com"
14
+ },
12
15
  "license": "MIT",
13
16
  "repository": {
14
17
  "type": "git",
15
18
  "url": "git+https://github.com/jchilders/citadel_cli.git"
16
19
  },
17
- "version": "1.1.0",
20
+ "version": "1.1.4",
18
21
  "type": "module",
19
22
  "scripts": {
20
23
  "build": "tsc && vite build",
21
24
  "dev": "vite",
22
25
  "lint": "eslint .",
26
+ "lint:fix": "eslint . --fix",
23
27
  "preview": "vite preview",
28
+ "push": "NODE_ENV=production && npm run build && npm push",
24
29
  "test": "vitest --run",
25
30
  "coverage": "vitest run --coverage"
26
31
  },
@@ -41,7 +46,9 @@
41
46
  "dist"
42
47
  ],
43
48
  "dependencies": {
44
- "lucide-react": "^0.460.0",
49
+ "lucide-react": "^0.460.0"
50
+ },
51
+ "peerDependencies": {
45
52
  "react": "^18.2.0",
46
53
  "react-dom": "^18.2.0"
47
54
  },
@@ -1,2 +0,0 @@
1
- import { CommandRegistry } from '../src/components/Citadel/types/command-registry';
2
- export declare function registerBasicCommands(): CommandRegistry;