@ironbee-ai/cli 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/clients/base.js +1 -1
- package/dist/clients/claude/agents/ironbee-scenario.md +36 -10
- package/dist/clients/claude/agents/ironbee-verifier.md +19 -1
- package/dist/clients/claude/commands/ironbee-manage-scenario.md +2 -1
- package/dist/clients/claude/index.js +4 -4
- package/dist/clients/codex/agents/ironbee-scenario.md +36 -10
- package/dist/clients/codex/agents/ironbee-verifier.md +19 -1
- package/dist/clients/codex/commands/ironbee-manage-scenario/SKILL.main.md +18 -6
- package/dist/clients/codex/commands/ironbee-manage-scenario/SKILL.md +2 -1
- package/dist/clients/codex/commands/ironbee-sync-scenario/SKILL.main.md +1 -1
- package/dist/clients/codex/commands/ironbee-verify/SKILL.main.md +1 -0
- package/dist/clients/codex/index.js +2 -2
- package/dist/clients/codex/skills/ironbee-verification.main.md +11 -0
- package/dist/clients/cursor/commands/ironbee-manage-scenario/SKILL.md +18 -6
- package/dist/clients/cursor/commands/ironbee-sync-scenario/SKILL.md +1 -1
- package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +1 -0
- package/dist/clients/cursor/skills/ironbee-verification.md +5 -0
- package/dist/clients/registry.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/hook.js +22 -19
- package/dist/commands/install.js +1 -1
- package/dist/commands/platform-suggest.js +2 -0
- package/dist/hooks/core/actions.js +9 -7
- package/dist/hooks/core/run-checks.js +7 -0
- package/dist/hooks/core/verify-gate.js +30 -21
- package/dist/lib/config.js +1 -1
- package/dist/lib/event.js +1 -1
- package/dist/lib/headless.js +1 -0
- package/dist/lib/install-version.js +1 -1
- package/dist/lib/prompt.js +6 -5
- package/dist/tui/config/schema.js +1 -1
- package/dist/tui/platforms/area.js +2 -2
- package/dist/tui/projects/area.js +4 -4
- package/dist/tui/shell/session.js +5 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}l(
|
|
1
|
+
"use strict";var F=Object.create;var C=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var l=(e,r)=>C(e,"name",{value:r,configurable:!0});var ee=(e,r)=>{for(var s in r)C(e,s,{get:r[s],enumerable:!0})},_=(e,r,s,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of X(r))!x.call(e,c)&&c!==s&&C(e,c,{get:()=>r[c],enumerable:!(u=Q(r,c))||u.enumerable});return e};var re=(e,r,s)=>(s=e!=null?F(Z(e)):{},_(r||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),ne=e=>_(C({},"__esModule",{value:!0}),e);var ae={};ee(ae,{platformsArea:()=>se});module.exports=ne(ae);var B=re(require("blessed")),g=require("../../lib/config"),y=require("../config/introspect"),P=require("../config/value"),f=require("../shell/util"),w=require("../config/edit"),S=require("../../clients/registry"),Y=require("../../commands/platform-suggest"),H=require("../../commands/cycle-toggle"),M=require("../../commands/install");const K={browser:"Browser",node:"Node",backend:"Backend",android:"Android",terminal:"Terminal"},D=" {bold}\u2191/\u2193{/bold} move {bold}e{/bold}/{bold}g{/bold}/{bold}l{/bold} toggle project/global/local {bold}x{/bold} clear enable flag {bold}Esc{/bold} back {bold}q{/bold} quit",te={global:"global ",project:"project",local:"local "};function oe(e){const r=e.session.projectDir,s=g.ALL_CYCLES;let u=(0,y.loadLayers)(r),c=(0,g.loadConfig)(r),L=0;const b=(0,S.resolveSuggestionClient)((0,S.detectClients)(r)),R=b?D+` {bold}s{/bold} suggest (${(0,f.escapeTags)(b.name)})`:D;let m=!1,E=!1,$=null;const d=B.list({parent:e.container,top:0,left:0,width:"40%",height:"100%",border:{type:"line"},label:" Cycles ",tags:!0,keys:!1,mouse:!1,style:{selected:{bg:"blue",fg:"white"},border:{fg:"cyan"}},items:[]}),k=B.box({parent:e.container,top:0,left:"40%",width:"60%",height:"100%",border:{type:"line"},label:" Detail ",tags:!0,scrollable:!0,alwaysScroll:!0,scrollbar:{ch:" "},style:{border:{fg:"cyan"}},content:""});function A(){return s[(0,f.clamp)(L,0,s.length-1)]}l(A,"currentCycle");function T(n){return(0,g.isCycleEnabled)(c,n)}l(T,"enabled");function O(n){const t=T(n),a=t?"{green-fg}\u25CF{/green-fg}":"{gray-fg}\u25CB{/gray-fg}",i=t?"{green-fg}enabled{/green-fg}":"{gray-fg}disabled{/gray-fg}";return`${a} {bold}${K[n]??n}{/bold} ${i}`}l(O,"rowLabel");function U(n){const t=[],a=T(n),i=K[n]??n,o=g.CYCLE_TO_SERVER[n]??"";t.push(`{bold}{cyan-fg}${(0,f.escapeTags)(i)} cycle{/cyan-fg}{/bold} {gray-fg}${(0,f.escapeTags)(o)}{/gray-fg}`),t.push("{gray-fg}"+"\u2500".repeat(46)+"{/gray-fg}"),t.push(`Effective: ${a?"{green-fg}enabled{/green-fg}":"{gray-fg}disabled{/gray-fg}"}`),t.push("");const v=(0,y.introspectKey)(`${n}.enable`,u);t.push("{bold}enable flag by layer{/bold}");for(const h of v.layers){const J=h.present?(0,f.escapeTags)((0,P.formatValueShort)(h.value,20)):"{gray-fg}(unset){/gray-fg}",z=v.effective===h.layer?" {green-fg}\u2190 effective{/green-fg}":"";t.push(` ${te[h.layer]} ${J}${z}`)}if(v.effective==="none"){const h=n==="browser"?"on (browser is default-on)":"off (opt-in cycle)";t.push(` {gray-fg}(no enable flag set \u2014 default: ${h}){/gray-fg}`)}t.push("");const p=(0,y.introspectKey)(`${n}.verifyPatterns`,u);t.push("{bold}verifyPatterns (config){/bold}");const W=p.merged===void 0?"{gray-fg}(unset \u2192 code defaults apply when enabled){/gray-fg}":(0,f.escapeTags)((0,P.formatValueShort)(p.merged,60));return t.push(` ${W}`),t.push(" {gray-fg}edit patterns in the Configuration area{/gray-fg}"),t.push(""),t.push("{gray-fg}e/g/l toggles the enable flag in project/global/local; x clears it.{/gray-fg}"),t.join(`
|
|
2
|
+
`)}l(U,"buildDetail");function I(){d.setItems(s.map(n=>O(n))),d.select((0,f.clamp)(L,0,s.length-1)),k.setContent(U(A())),k.setScroll(0),e.screen.render()}l(I,"render");function j(){u=(0,y.loadLayers)(r),c=(0,g.loadConfig)(r),I()}l(j,"reload");function V(n){m||(L=(0,f.clamp)(L+n,0,s.length-1),I())}l(V,"move");function N(n){if(m)return;const t=A(),a=!T(t),i=(0,g.getTargetConfigPath)(n,r);try{(0,w.setLayerValue)(i,`${t}.enable`,a?"true":"false",!1),e.session.markRerenderNeeded(r),j()}catch(o){e.session.message(`Toggle failed: ${o instanceof Error?o.message:String(o)}`)}}l(N,"toggleEnable");function q(){if(m)return;const n=A(),a=(0,y.introspectKey)(`${n}.enable`,u).layers.filter(o=>o.present);if(a.length===0){e.session.message(`${n}.enable is not set in any layer.`);return}const i=l(o=>{const v=(0,g.getTargetConfigPath)(o,r);try{(0,w.unsetLayerValue)(v,`${n}.enable`),e.session.markRerenderNeeded(r),j()}catch(p){e.session.message(`Clear failed: ${p instanceof Error?p.message:String(p)}`)}},"apply");if(a.length===1){i(a[0].layer);return}e.session.pick("Clear enable flag from which layer?",a.map(o=>o.layer),o=>{o>=0&&o<a.length&&i(a[o].layer)})}l(q,"clearEnable");function G(){if(m||!b)return;m=!0,$=new AbortController,e.setStatus(`{cyan-fg}Analysing project with ${(0,f.escapeTags)(b.name)}... please wait{/cyan-fg}`),e.screen.render();const n=l(()=>{m=!1,$=null,E||(e.setStatus(R),e.screen.render())},"done");(0,Y.suggestPlatforms)(b,{projectDir:r,timeoutMs:M.SUGGEST_TIMEOUT_MS,signal:$.signal}).then(t=>{if(n(),!E){if(t===null||t.length===0){e.session.message("Couldn't analyse the project \u2014 no changes made.");return}e.session.confirm(`Apply suggested platforms to the PROJECT config: ${t.join(", ")}? (other cycles will be disabled)`,a=>{if(!(!a||E))try{(0,H.reconcileCyclesInLayer)(r,"project",t,!0),e.session.markRerenderNeeded(r),j()}catch(i){e.session.message(`Apply failed: ${i instanceof Error?i.message:String(i)}`)}})}},()=>n())}return l(G,"runSuggest"),d.key(["up","k"],()=>V(-1)),d.key(["down","j"],()=>V(1)),d.key(["e"],()=>N("project")),d.key(["g"],()=>N("global")),d.key(["l"],()=>N("local")),d.key(["x","d"],()=>q()),b&&d.key(["s"],()=>G()),e.setStatus(R),I(),d.focus(),e.screen.render(),{unmount(){E=!0,$?.abort(),d.destroy(),k.destroy()}}}l(oe,"mountPlatformsView");const se={id:"platforms",title:"Platforms",summary:"Enable / disable the browser \xB7 node \xB7 backend \xB7 android \xB7 terminal cycles per layer",mount(e){return oe(e)}};0&&(module.exports={platformsArea});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}r(
|
|
3
|
-
`)}const
|
|
4
|
-
`)}r(
|
|
1
|
+
"use strict";var ve=Object.create;var T=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var r=(n,o)=>T(n,"name",{value:o,configurable:!0});var Se=(n,o)=>{for(var h in o)T(n,h,{get:o[h],enumerable:!0})},X=(n,o,h,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of je(o))!Ce.call(n,a)&&a!==h&&T(n,a,{get:()=>o[a],enumerable:!(p=we(o,a))||p.enumerable});return n};var Ee=(n,o,h)=>(h=n!=null?ve($e(n)):{},X(o||!n||!n.__esModule?T(h,"default",{value:n,enumerable:!0}):h,n)),Ie=n=>X(T({},"__esModule",{value:!0}),n);var Pe={};Se(Pe,{projectsArea:()=>Ae});module.exports=Ie(Pe);var H=Ee(require("blessed")),O=require("fs"),J=require("path"),m=require("../../clients/registry"),L=require("../../commands/install"),K=require("../../commands/platform-suggest"),Z=require("../../commands/cycle-toggle"),u=require("../../commands/mode-select"),x=require("../../commands/uninstall"),j=require("../../lib/config"),w=require("../../lib/projects-registry"),f=require("../shell/util");const D=6;function y(n){const o=n.replace(/[/\\]+$/,"").split(/[/\\]/);return o[o.length-1]||n}r(y,"basename");function ke(n){const o=n.session.launchDir;function h(e){try{return(0,w.canonicalizePath)(e)}catch{return e}}r(h,"safeCanonical");const p=h(o);let a=(0,w.listProjects)(),E=Math.max(0,a.findIndex(e=>e.path===p)),V=h(n.session.projectDir),v="cwd";const U=H.box({parent:n.container,top:0,left:0,width:"100%",height:D,border:{type:"line"},label:" Current directory ",tags:!0,style:{border:{fg:"yellow"}},content:""}),d=H.list({parent:n.container,top:D,left:0,width:"52%",height:`100%-${D}`,border:{type:"line"},label:" Registered projects ",tags:!0,keys:!1,mouse:!1,invertSelected:!1,scrollbar:{ch:" "},style:{selected:{bg:"blue"},border:{fg:"cyan"}},items:[]}),R=H.box({parent:n.container,top:D,left:"52%",width:"48%",height:`100%-${D}`,border:{type:"line"},label:" Detail ",tags:!0,scrollable:!0,alwaysScroll:!0,scrollbar:{ch:" "},style:{border:{fg:"cyan"}},content:""});function M(){return a.length===0?void 0:a[(0,f.clamp)(E,0,a.length-1)]}r(M,"selected");function k(e){return(0,m.detectClients)(e).map(i=>i.name).join(", ")}r(k,"detectedNames");function W(e){return e===V||h(e)===V}r(W,"isActive");function ee(e){const s=(0,m.isProjectActive)(e)?"{green-fg}\u25CF{/green-fg}":"{red-fg}\u25CB{/red-fg}";return`${W(e.path)?"{yellow-fg}\u2605{/yellow-fg} ":" "}${s} ${(0,f.escapeTags)(y(e.path))} {gray-fg}${(0,f.escapeTags)(k(e.path))}{/gray-fg}`}r(ee,"rowLabel");function N(){return{installed:k(o),registered:a.some(e=>e.path===p),active:W(p)}}r(N,"cwdState");function C(e,i){return i?`{bold}${e}{/bold}`:`{gray-fg}${e}{/gray-fg}`}r(C,"keyLabel");function ne(){const{installed:e,registered:i,active:s}=N(),t=e.length>0,c=[];c.push(t?`{green-fg}\u25CF installed{/green-fg} {gray-fg}(${(0,f.escapeTags)(e)}){/gray-fg}`:"{gray-fg}\u25CB not installed{/gray-fg}"),c.push(i?"{green-fg}registered{/green-fg}":"{gray-fg}not registered{/gray-fg}"),c.push(s?"{yellow-fg}\u2605 active project{/yellow-fg}":"{gray-fg}not the active project{/gray-fg}");const b=`${C("i install",!t)} ${C("x uninstall",t)} {gray-fg}\xB7{/gray-fg} ${C("a register",!i)} ${C("d unregister",i)} {gray-fg}\xB7{/gray-fg} ${C("c make active",!s)}`,l=[];return l.push(`{bold}${(0,f.escapeTags)(o)}{/bold}`),l.push(c.join(" {gray-fg}\xB7{/gray-fg} ")),l.push(b),l.join(`
|
|
2
|
+
`)}r(ne,"buildCwdPanel");function te(){const e="{bold}Tab{/bold} switch section {bold}I/X{/bold} all {bold}r{/bold} refresh {bold}Esc/q{/bold}";let i;if(v==="cwd"){const{installed:s,registered:t}=N(),c=s.length>0;i=`{cyan-fg}cwd:{/cyan-fg} ${C("i install",!c)} ${C("x uninstall",c)} ${C("a register",!t)} ${C("d unregister",t)} {bold}c{/bold} make active`}else i="{bold}\u2191/\u2193{/bold} move {bold}Enter{/bold} switch {bold}i{/bold} install {bold}x{/bold} uninstall {bold}d{/bold} unregister";return` ${i} {gray-fg}\u2502{/gray-fg} ${e}`}r(te,"buildStatus");function ie(e){if(e===void 0){const c=k(o).length>0,b=[];return b.push("{gray-fg}No projects registered yet.{/gray-fg}"),b.push(""),b.push("{gray-fg}Use the {/gray-fg}{bold}Current directory{/bold}{gray-fg} panel above:{/gray-fg}"),b.push(c?"{bold}x{/bold} {gray-fg}\u2014 uninstall IronBee from here (removes hooks + guidance){/gray-fg}":"{bold}i{/bold} {gray-fg}\u2014 install IronBee here (writes hooks + guidance, registers it){/gray-fg}"),b.push("{bold}a{/bold} {gray-fg}\u2014 register here only (inventory, no artifact writes){/gray-fg}"),b.join(`
|
|
3
|
+
`)}const i=(0,m.isProjectActive)(e),s=(0,j.getConfigLayerPaths)(e.path),t=[];return t.push(`{bold}${(0,f.escapeTags)(y(e.path))}{/bold}`),t.push("{gray-fg}"+"\u2500".repeat(46)+"{/gray-fg}"),t.push(`{gray-fg}path:{/gray-fg} ${(0,f.escapeTags)(e.path)}`),t.push(`{gray-fg}detected:{/gray-fg} ${(0,f.escapeTags)(k(e.path))||"(none on disk)"}`),t.push(`{gray-fg}added:{/gray-fg} ${(0,f.escapeTags)(e.installedAt)}`),t.push(`{gray-fg}on disk:{/gray-fg} ${i?"{green-fg}detected{/green-fg}":"{red-fg}stale (artifacts not detected){/red-fg}"}`),t.push(""),t.push("{bold}config layers{/bold}"),t.push(` {gray-fg}global {/gray-fg} ${(0,f.escapeTags)(s.global)}`),t.push(` {gray-fg}project{/gray-fg} ${(0,f.escapeTags)(s.project??"-")}`),t.push(` {gray-fg}local {/gray-fg} ${(0,f.escapeTags)(s.local??"-")}`),t.push(""),W(e.path)?(t.push("{yellow-fg}\u2605 active project{/yellow-fg} \u2014 Config / Sessions / Queue target this."),t.push("{gray-fg}c (in the cwd panel) = unselect \u2192 back to the current directory{/gray-fg}")):t.push("{gray-fg}Enter/s = make active (Config / Sessions / Queue switch to it){/gray-fg}"),t.push("{gray-fg}i = install \xB7 x = uninstall (pick a client when >1 registered; runs here, blocking){/gray-fg}"),t.join(`
|
|
4
|
+
`)}r(ie,"buildDetail");function B(e,i){const s=e.style;s.border!==void 0&&(s.border.fg=i)}r(B,"setBorderFg");function re(){const e=v==="cwd";U.setLabel(e?" {yellow-fg}\u25B8 Current directory{/yellow-fg} ":" Current directory "),d.setLabel(e?" Registered projects ":" {yellow-fg}\u25B8 Registered projects{/yellow-fg} "),B(U,e?"yellow":"gray"),B(d,e?"gray":"yellow"),B(R,e?"gray":"cyan");const i=d.style.selected??{};i.bg=e?void 0:"blue",i.fg=void 0}r(re,"applyFocusStyles");function A(){V=h(n.session.projectDir),n.setStatus(te()),re(),U.setContent(ne()),a.length===0?d.setItems(["{gray-fg}(no registered projects){/gray-fg}"]):(d.setItems(a.map(e=>ee(e))),d.select((0,f.clamp)(E,0,a.length-1))),R.setContent(ie(M())),R.setScroll(0),n.screen.render()}r(A,"render");function G(){v=v==="cwd"?"list":"cwd",A()}r(G,"toggleSection");function I(e){if(a=(0,w.listProjects)(),e!==void 0){const i=a.findIndex(s=>s.path===e);i>=0&&(E=i)}E=(0,f.clamp)(E,0,Math.max(0,a.length-1)),A()}r(I,"refresh");function F(e){a.length!==0&&(E=(0,f.clamp)(E+e,0,a.length-1),A())}r(F,"move");function oe(){try{(0,w.upsertProject)(o),I(p),n.session.message(`Registered ${y(o)} in the inventory. Use d to unregister, i to install.`)}catch(e){n.session.message(`Register failed: ${e instanceof Error?e.message:String(e)}`)}}r(oe,"registerCwd");function se(){n.session.confirm(`Unregister ${y(o)}? (inventory only, no files touched)`,e=>{if(e)try{(0,w.removeProject)(o),I()}catch(i){n.session.message(`Unregister failed: ${i instanceof Error?i.message:String(i)}`)}})}r(se,"unregisterCwd");function le(){if(a.some(e=>e.path===p)){n.session.message(`${y(o)} is already registered \u2014 press d to unregister.`);return}oe()}r(le,"cwdRegister");function ae(){if(!a.some(e=>e.path===p)){n.session.message(`${y(o)} is not registered \u2014 nothing to unregister.`);return}se()}r(ae,"cwdUnregister");function Q(){if(W(p)){n.session.message(`The current directory (${y(o)}) is already the active project.`);return}n.setActiveProject(p);const e=a.findIndex(i=>i.path===p);e>=0&&(E=e),A(),n.session.message(`Active project \u2192 current directory (${y(o)}). Any switched project is unselected.`)}r(Q,"setActiveToCwd");function ge(e,i){const s=n.session.silently(()=>(0,u.resolveInstallDefaultMode)(e)),t=[s,...u.ALL_MODES.filter(g=>g!==s)],c=t.map(g=>`${u.MODE_LABELS[g]} \u2014 ${u.MODE_HINTS[g]}`),l=n.session.silently(()=>(0,u.resolveInstallDefaultStrict)(e))?[!0,!1]:[!1,!0],S=l.map(g=>`${u.STRICT_LABELS[g?"true":"false"]} \u2014 ${u.STRICT_HINTS[g?"true":"false"]}`),_=r(()=>{n.session.pick("Which verification mode?",c,g=>{if(g<0){i("cancel");return}const $=t[g];if($!=="enforce"){i($);return}n.session.pick("How strict should verification be? ({cyan-fg}Esc{/cyan-fg} = back)",S,P=>{if(P<0){_();return}i($,l[P])})})},"askMode");_()}r(ge,"chooseMode");function de(e,i,s,t){if(i==="monitor"){t(void 0);return}const c=n.session.silently(()=>(0,j.loadConfig)(e)),b=j.ALL_CYCLES.map(g=>`${g} \u2014 ${L.CYCLE_HINTS[g]}`),l=j.ALL_CYCLES.map((g,$)=>(0,j.isCyclePatternsActive)(c,g)?$:-1).filter(g=>g>=0),S=(0,m.resolveSuggestionClient)(s),_=S?{suggestLabel:S.name,onSuggest:r(async g=>{const $=await(0,K.suggestPlatforms)(S,{projectDir:e,timeoutMs:L.SUGGEST_TIMEOUT_MS,signal:g});return $===null?null:$.map(P=>j.ALL_CYCLES.indexOf(P)).filter(P=>P>=0)},"onSuggest")}:void 0;n.session.pickMulti("Which platforms should require verification?",b,l,g=>{if(g===null){t("cancel");return}t(g.map($=>j.ALL_CYCLES[$]))},_)}r(de,"choosePlatforms");function q(e,i,s){z(i,t=>{ge(e,(c,b)=>{c!=="cancel"&&de(e,c,t,l=>{l!=="cancel"&&n.session.runWithOutput(`Install ${y(e)} (${t.map(S=>S.name).join(", ")})`,()=>{(0,u.applyModeToLayer)(e,"project",c,b),l!==void 0&&(0,Z.reconcileCyclesInLayer)(e,"project",l,!0);for(const S of t)S.install(e);(0,w.upsertProject)(e)}).then(()=>I(s))})})})}r(q,"doInstall");function Y(e,i){z("Uninstall which client?",s=>{n.session.confirm(`Uninstall ${s.map(t=>t.name).join(", ")} from ${y(e)}?`,t=>{t&&n.session.runWithOutput(`Uninstall ${y(e)} (${s.map(c=>c.name).join(", ")})`,()=>{const c=new Set(s.map(l=>l.name));for(const l of s)l.uninstall(e);if(!m.REGISTERED_CLIENTS.some(l=>!c.has(l.name)&&l.detect(e))){const l=(0,J.join)(e,".ironbee");(0,O.existsSync)(l)&&(0,O.rmSync)(l,{recursive:!0,force:!0}),(0,w.removeProject)(e)}}).then(()=>I(i))})})}r(Y,"doUninstall");function ce(){if(k(o).length>0){n.session.message(`${y(o)} is already installed \u2014 press x to uninstall.`);return}q(o,"Install into the current directory \u2014 which client?",p)}r(ce,"cwdInstall");function fe(){if(k(o).length===0){n.session.message(`${y(o)} is not installed \u2014 nothing to uninstall.`);return}Y(o,p)}r(fe,"cwdUninstall");function ue(){const e=M();e!==void 0&&(n.setActiveProject(e.path),A(),n.session.message(`Active project \u2192 ${y(e.path)}. Config / Sessions / Queue now target it.`))}r(ue,"switchTo");function ye(){const e=M();e!==void 0&&n.session.confirm(`Unregister ${y(e.path)}? (inventory only, no files touched)`,i=>{if(i)try{(0,w.removeProject)(e.path),I()}catch(s){n.session.message(`Unregister failed: ${s instanceof Error?s.message:String(s)}`)}})}r(ye,"unregisterSelected");function z(e,i){if(m.REGISTERED_CLIENTS.length<=1){i(m.REGISTERED_CLIENTS);return}const s=m.REGISTERED_CLIENTS.map(t=>t.name);n.session.pick(e,["All clients",...s],t=>{t<0||i(t===0?m.REGISTERED_CLIENTS:[m.REGISTERED_CLIENTS[t-1]])})}r(z,"pickClient");function pe(){const e=M();e!==void 0&&q(e.path,"Install which client?")}r(pe,"installSelected");function be(){const e=M();e!==void 0&&Y(e.path)}r(be,"uninstallSelected");async function me(){await n.session.runWithOutput("Install \u2014 all registered projects",async()=>{await(0,L.runInstallAll)({})}),I()}r(me,"installAll");function he(){n.session.confirm("Uninstall IronBee from ALL registered projects? (destructive)",e=>{e&&n.session.runWithOutput("Uninstall \u2014 all registered projects",async()=>{await(0,x.runUninstallAll)({yes:!0})}).then(()=>I())})}return r(he,"uninstallAllFlow"),d.key(["tab"],()=>G()),d.key(["S-tab"],()=>G()),d.key(["up","k"],()=>{v==="list"&&F(-1)}),d.key(["down","j"],()=>{v==="list"&&F(1)}),d.key(["i"],()=>{v==="cwd"?ce():pe()}),d.key(["x"],()=>{v==="cwd"?fe():be()}),d.key(["d"],()=>{v==="cwd"?ae():ye()}),d.key(["a"],()=>{v==="cwd"&&le()}),d.key(["c"],()=>{v==="cwd"&&Q()}),d.key(["enter","s"],()=>{v==="list"?ue():Q()}),d.key(["S-i"],()=>{me()}),d.key(["S-x"],()=>he()),d.key(["r"],()=>I()),A(),d.focus(),n.screen.render(),{unmount(){U.destroy(),d.destroy(),R.destroy()}}}r(ke,"mountProjectsView");const Ae={id:"projects",title:"Projects",summary:"Registry \u2014 switch active \xB7 register / unregister \xB7 install / uninstall (+ --all)",mount(n){return ke(n)}};0&&(module.exports={projectsArea});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var j=Object.create;var w=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var h=(i,e)=>w(i,"name",{value:e,configurable:!0});var C=(i,e)=>{for(var t in e)w(i,t,{get:e[t],enumerable:!0})},M=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!T.call(i,s)&&s!==t&&w(i,s,{get:()=>e[s],enumerable:!(n=x(e,s))||n.enumerable});return i};var A=(i,e,t)=>(t=i!=null?j(O(i)):{},M(e||!i||!i.__esModule?w(t,"default",{value:i,enumerable:!0}):t,i)),L=i=>M(w({},"__esModule",{value:!0}),i);var _={};C(_,{TuiSession:()=>q});module.exports=L(_);var p=A(require("blessed")),a=require("./util");class q{constructor(e,t){this.rerenderDirs=new Set;this.modalOpen=!1;this.screen=e,this.launchDir=t,this.activeProjectDir=t}static{h(this,"TuiSession")}get projectDir(){return this.activeProjectDir}setProjectDir(e){this.activeProjectDir=e}markRerenderNeeded(e){this.rerenderDirs.add(e)}isRerenderNeeded(){return this.rerenderDirs.size>0}rerenderProjects(){const e=[...this.rerenderDirs];return this.rerenderDirs.clear(),e}isModalOpen(){return this.modalOpen}openModal(){const e=this.screen.focused;return this.modalOpen=!0,()=>{e!=null&&e.detached!==!0&&e.focus(),this.screen.render(),setImmediate(()=>{this.modalOpen=!1})}}message(e){const t=this.openModal(),n=p.message({parent:this.screen,top:"center",left:"center",width:"60%",height:"shrink",border:{type:"line"},tags:!0,style:{border:{fg:"yellow"}}});n.display((0,a.escapeTags)(e),3,()=>{n.destroy(),t()})}prompt(e,t,n){const s=this.openModal(),r=p.prompt({parent:this.screen,top:"center",left:"center",width:"72%",height:"shrink",border:{type:"line"},tags:!0,keys:!0,style:{border:{fg:"green"}}});r.input(e,t,(g,o)=>{r.destroy(),s(),n(typeof o=="string"?o:null)}),this.screen.render()}confirm(e,t){const n=this.openModal(),s=p.box({parent:this.screen,top:"center",left:"center",width:"60%",height:8,border:{type:"line"},tags:!0,style:{border:{fg:"cyan"}},content:` ${(0,a.escapeTags)(e)}
|
|
2
2
|
|
|
3
|
-
{gray-fg}\u2191/\u2193 choose \xB7 Enter confirm \xB7 Esc cancel{/gray-fg}`}),
|
|
3
|
+
{gray-fg}\u2191/\u2193 choose \xB7 Enter confirm \xB7 Esc cancel{/gray-fg}`}),r=p.list({parent:s,bottom:0,left:1,right:1,height:2,keys:!0,tags:!0,style:{selected:{bg:"blue",fg:"white"}},items:["Yes","No"]});r.select(1);const g=h(o=>{s.destroy(),n(),t(o)},"finish");r.on("select",(o,y)=>g(y===0)),r.key(["escape","q"],()=>g(!1)),r.focus(),this.screen.render()}pickMulti(e,t,n,s,r){const g=this.openModal(),o=new Set(n.filter(l=>l>=0&&l<t.length)),y=r?.onSuggest,v=typeof y=="function",m=r?.suggestLabel??"the agent",d=` {gray-fg}space toggle \xB7 a all${v?` \xB7 s suggest (${(0,a.escapeTags)(m)})`:""} \xB7 Enter confirm \xB7 Esc cancel{/gray-fg}`;let c=!1,b=null,k=null;const W=h(()=>t.map((l,f)=>`${o.has(f)?"{green-fg}[x]{/green-fg}":"[ ]"} ${(0,a.escapeTags)(l)}`),"rows"),$=h(()=>c?` {cyan-fg}Analysing project with ${(0,a.escapeTags)(m)}... (Esc to cancel){/cyan-fg}`:b!==null?` {gray-fg}${(0,a.escapeTags)(b)}{/gray-fg}`:d,"statusText"),E=p.box({parent:this.screen,top:"center",left:"center",width:"60%",height:t.length+5,border:{type:"line"},label:` ${e} `,tags:!0,style:{border:{fg:"yellow"}},content:d}),u=p.list({parent:E,top:1,left:1,right:1,bottom:0,keys:!0,tags:!0,style:{selected:{bg:"blue",fg:"white"}},items:W()}),D=h(l=>{E.destroy(),g(),s(l)},"finish"),S=h(()=>{const l=u.selected;u.setItems(W()),u.select(l),E.setContent($()),this.screen.render()},"redraw");u.key(["space"],()=>{if(c)return;const l=u.selected;o.has(l)?o.delete(l):o.add(l),b=null,S()}),u.key(["a"],()=>{c||(o.size===t.length?o.clear():t.forEach((l,f)=>{o.add(f)}),b=null,S())}),u.on("select",()=>{c||D([...o].sort((l,f)=>l-f))}),u.key(["escape","q"],()=>{if(c){k?.abort();return}D(null)}),v&&u.key(["s"],()=>{c||(c=!0,b=null,k=new AbortController,E.setContent($()),this.screen.render(),y(k.signal).then(l=>{const f=(l??[]).filter(P=>P>=0&&P<t.length);f.length>0?(o.clear(),f.forEach(P=>{o.add(P)}),b=null):b="Couldn't analyse \u2014 keeping current selection"},()=>{b="Couldn't analyse \u2014 keeping current selection"}).then(()=>{c=!1,k=null,S()}))}),u.focus(),this.screen.render()}pick(e,t,n){const s=this.openModal(),r=p.list({parent:this.screen,top:"center",left:"center",width:"50%",height:t.length+2,border:{type:"line"},label:` ${e} `,tags:!0,keys:!0,style:{selected:{bg:"blue",fg:"white"},border:{fg:"yellow"}},items:t.map(g=>(0,a.escapeTags)(g))});r.on("select",(g,o)=>{r.destroy(),s(),n(o)}),r.key(["escape","q"],()=>{r.destroy(),s(),n(-1)}),r.focus(),this.screen.render()}silently(e){const t=process.stdout.write,n=process.stderr.write,s=h(()=>!0,"noop");process.stdout.write=s,process.stderr.write=s;try{return e()}finally{process.stdout.write=t,process.stderr.write=n}}bindPaneKeys(e,t){e.key(["up","k"],()=>{e.scroll(-1),this.screen.render()}),e.key(["down","j"],()=>{e.scroll(1),this.screen.render()}),e.key(["pageup"],()=>{e.scroll(-10),this.screen.render()}),e.key(["pagedown"],()=>{e.scroll(10),this.screen.render()}),e.key(["escape","enter","q"],()=>{e.destroy(),t()}),e.focus()}showPane(e,t){const n=this.openModal(),s=p.box({parent:this.screen,top:"center",left:"center",width:"82%",height:"82%",border:{type:"line"},label:` ${e} `,tags:!0,scrollable:!0,alwaysScroll:!0,scrollbar:{ch:" "},style:{border:{fg:"cyan"}},content:`${t}
|
|
4
4
|
|
|
5
|
-
{gray-fg}[ \u2191/\u2193 scroll \xB7 Esc/Enter close ]{/gray-fg}`});this.bindPaneKeys(
|
|
6
|
-
`:"")+
|
|
5
|
+
{gray-fg}[ \u2191/\u2193 scroll \xB7 Esc/Enter close ]{/gray-fg}`});this.bindPaneKeys(s,n),this.screen.render()}runWithOutput(e,t){return new Promise(n=>{const s=this.openModal(),r=p.box({parent:this.screen,top:"center",left:"center",width:"82%",height:"82%",border:{type:"line"},label:` ${e} `,tags:!0,scrollable:!0,alwaysScroll:!0,scrollbar:{ch:" "},style:{border:{fg:"green"}},content:"{gray-fg}Running\u2026 (the TUI is blocked until this finishes){/gray-fg}"});r.focus(),this.screen.render();const g=[],o=process.stdout.write,y=process.stderr.write,v=h(d=>(g.push(typeof d=="string"?d:String(d)),!0),"capture");process.stdout.write=v,process.stderr.write=v;const m=h(d=>{process.stdout.write=o,process.stderr.write=y;let c=(0,a.stripAnsi)(g.join(""));d.length>0&&(c+=(c.length>0?`
|
|
6
|
+
`:"")+d),c=c.trim(),c.length===0&&(c="(done \u2014 no output)"),r.setContent(`${(0,a.escapeTags)(c)}
|
|
7
7
|
|
|
8
|
-
{gray-fg}[ \u2191/\u2193 scroll \xB7 Esc/Enter close ]{/gray-fg}`),
|
|
8
|
+
{gray-fg}[ \u2191/\u2193 scroll \xB7 Esc/Enter close ]{/gray-fg}`),r.setScroll(0),this.bindPaneKeys(r,()=>{s(),n()}),this.screen.render()},"present");Promise.resolve().then(()=>t()).then(d=>m(typeof d=="string"?d:""),d=>m(`\u2717 ${d instanceof Error?d.message:String(d)}`))})}}0&&(module.exports={TuiSession});
|