infra-kit 0.1.122 → 0.1.124

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.
@@ -1,2 +0,0 @@
1
- import{render as D}from"ink";import M from"node:process";import{Box as d,Text as o,useApp as E,useInput as v}from"ink";import{useEffect as A,useMemo as b,useState as h}from"react";import{jsx as r,jsxs as f}from"react/jsx-runtime";var I=x=>{let{items:l,onSelect:s,onCancel:g}=x,m={hint:"Select a command \u2014 type to filter, \u2191\u2193 to move, Enter to run, Esc to cancel",prompt:"\u276F ",empty:"No matching commands"},y=24,{exit:C}=E(),[i,P]=h(""),[B,a]=h(0),[u,T]=h(!1);A(()=>{u&&C()},[u,C]);let c=b(()=>{let e=i.trim().toLowerCase();return e?l.filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e)):l},[l,i]),p=Math.min(B,Math.max(0,c.length-1));if(v((e,t)=>{if(!u){if(t.escape||t.ctrl&&e==="c"){g(),T(!0);return}if(t.return){let n=c[p];n&&(s(n.name),T(!0));return}if(t.upArrow){let n=c.length;n>0&&a((p-1+n)%n);return}if(t.downArrow){let n=c.length;n>0&&a((p+1)%n);return}if(t.backspace||t.delete){P(i.slice(0,-1)),a(0);return}e&&!t.ctrl&&!t.meta&&(P(i+e),a(0))}}),u)return null;let w="";return f(d,{flexDirection:"column",children:[r(o,{dimColor:!0,children:m.hint}),f(d,{children:[r(o,{color:"cyan",children:m.prompt}),r(o,{children:i})]}),r(d,{flexDirection:"column",marginTop:1,children:c.length===0?r(o,{dimColor:!0,children:m.empty}):c.map((e,t)=>{let n=t===p,S=e.group!==w;return w=e.group,f(d,{flexDirection:"column",children:[S&&t>0?r(o,{children:" "}):null,S?r(o,{color:"yellow",children:`\u2014 ${e.group} \u2014`}):null,f(o,{color:n?"green":void 0,children:[n?"\u203A ":" ",e.name.padEnd(y)," ",r(o,{dimColor:!0,children:e.description})]})]},e.name)})})]})};import{jsx as $}from"react/jsx-runtime";var U=async x=>new Promise(l=>{let s=null,{waitUntilExit:g}=D($(I,{items:x,onSelect:m=>{s=m},onCancel:()=>{s=null}}),{stdout:M.stderr});g().then(()=>{l(s)}).catch(()=>{l(null)})});export{U as runCommandPalette};
2
- //# sourceMappingURL=boot-K4QUAFSP.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/tui/boot.tsx", "../src/tui/screens/command-palette.tsx"],
4
- "sourcesContent": ["import { render } from 'ink'\nimport process from 'node:process'\n\nimport { CommandPalette } from './screens/command-palette'\nimport type { PaletteItem } from './types'\n\n/**\n * Entry point for the Ink TUI. This module (and everything under `src/tui/`) is\n * the ONLY place allowed to import `ink`/`react`; it is reached exclusively via a\n * dynamic `await import('src/tui/boot')` from the TTY branch of entry/cli.ts, so\n * React never loads on the MCP / `--json` / non-TTY paths. Build splitting keeps\n * it in a separate lazy chunk (see scripts/build.js).\n */\n\n/**\n * Render the command palette and resolve to the chosen command name, or `null`\n * if the user cancels. Frames are written to stderr so stdout stays clean for\n * the command that runs afterwards (mirrors the previous Inquirer menu).\n */\nexport const runCommandPalette = async (items: PaletteItem[]): Promise<string | null> => {\n return new Promise((resolve) => {\n let selected: string | null = null\n\n const { waitUntilExit } = render(\n <CommandPalette\n items={items}\n onSelect={(name) => {\n selected = name\n }}\n onCancel={() => {\n selected = null\n }}\n />,\n { stdout: process.stderr as unknown as NodeJS.WriteStream },\n )\n\n waitUntilExit()\n .then(() => {\n resolve(selected)\n })\n .catch(() => {\n resolve(null)\n })\n })\n}\n", "import { Box, Text, useApp, useInput } from 'ink'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport type { PaletteItem } from '../types'\n\ninterface CommandPaletteProps {\n items: PaletteItem[]\n /** Called with the chosen command name; the app then exits. */\n onSelect: (name: string) => void\n /** Called when the user cancels (Esc / Ctrl-C); the app then exits. */\n onCancel: () => void\n}\n\n/**\n * Fuzzy-ish command picker rendered with Ink. Pure presentation: it receives a\n * flat list of commands (already grouped/ordered by the catalog) and returns the\n * selected name. It never executes anything \u2014 the caller runs the command via\n * the existing Commander path.\n */\nexport const CommandPalette = (props: CommandPaletteProps) => {\n const { items, onSelect, onCancel } = props\n\n const T = {\n hint: 'Select a command \u2014 type to filter, \u2191\u2193 to move, Enter to run, Esc to cancel',\n prompt: '\u276F ',\n empty: 'No matching commands',\n }\n const nameWidth = 24\n\n const { exit } = useApp()\n const [query, setQuery] = useState('')\n const [index, setIndex] = useState(0)\n // When set, the component renders `null` for one frame so Ink erases the list\n // before unmount commits its final frame (Ink's `log.done()` would otherwise\n // freeze the last drawn frame \u2014 the command list \u2014 into the scrollback).\n const [submitted, setSubmitted] = useState(false)\n\n // Exit only after the empty frame has committed, so the list is wiped first.\n useEffect(() => {\n if (submitted) {\n exit()\n }\n }, [submitted, exit])\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase()\n\n if (!q) {\n return items\n }\n\n return items.filter((item) => {\n return `${item.name} ${item.description}`.toLowerCase().includes(q)\n })\n }, [items, query])\n\n const activeIndex = Math.min(index, Math.max(0, filtered.length - 1))\n\n useInput((input, key) => {\n if (submitted) {\n return\n }\n\n if (key.escape || (key.ctrl && input === 'c')) {\n onCancel()\n setSubmitted(true)\n\n return\n }\n\n if (key.return) {\n const selected = filtered[activeIndex]\n\n if (selected) {\n onSelect(selected.name)\n setSubmitted(true)\n }\n\n return\n }\n\n if (key.upArrow) {\n const n = filtered.length\n\n // Wrap to the bottom when stepping up past the first item. The `+ n`\n // sidesteps JS negative modulo (e.g. -1 % 5 === -1, not 4).\n if (n > 0) {\n setIndex((activeIndex - 1 + n) % n)\n }\n\n return\n }\n\n if (key.downArrow) {\n const n = filtered.length\n\n // Wrap to the top when stepping down past the last item.\n if (n > 0) {\n setIndex((activeIndex + 1) % n)\n }\n\n return\n }\n\n if (key.backspace || key.delete) {\n setQuery(query.slice(0, -1))\n setIndex(0)\n\n return\n }\n\n // Printable character: append to the filter.\n if (input && !key.ctrl && !key.meta) {\n setQuery(query + input)\n setIndex(0)\n }\n })\n\n // Final frame: render nothing so Ink erases the list on its way out.\n if (submitted) {\n return null\n }\n\n let lastGroup = ''\n\n return (\n <Box flexDirection=\"column\">\n <Text dimColor>{T.hint}</Text>\n <Box>\n <Text color=\"cyan\">{T.prompt}</Text>\n <Text>{query}</Text>\n </Box>\n <Box flexDirection=\"column\" marginTop={1}>\n {filtered.length === 0 ? (\n <Text dimColor>{T.empty}</Text>\n ) : (\n filtered.map((item, position) => {\n const isActive = position === activeIndex\n const showGroup = item.group !== lastGroup\n\n lastGroup = item.group\n\n return (\n <Box flexDirection=\"column\" key={item.name}>\n {/* Blank line between groups (not before the very first group). */}\n {showGroup && position > 0 ? <Text> </Text> : null}\n {showGroup ? <Text color=\"yellow\">{`\u2014 ${item.group} \u2014`}</Text> : null}\n <Text color={isActive ? 'green' : undefined}>\n {isActive ? '\u203A ' : ' '}\n {item.name.padEnd(nameWidth)} <Text dimColor>{item.description}</Text>\n </Text>\n </Box>\n )\n })\n )}\n </Box>\n </Box>\n )\n}\n"],
5
- "mappings": "AAAA,OAAS,UAAAA,MAAc,MACvB,OAAOC,MAAa,eCDpB,OAAS,OAAAC,EAAK,QAAAC,EAAM,UAAAC,EAAQ,YAAAC,MAAgB,MAC5C,OAAS,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QA8HvC,cAAAC,EACA,QAAAC,MADA,oBA5GC,IAAMC,EAAkBC,GAA+B,CAC5D,GAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,SAAAC,CAAS,EAAIH,EAEhCI,EAAI,CACR,KAAM,4FACN,OAAQ,UACR,MAAO,sBACT,EACMC,EAAY,GAEZ,CAAE,KAAAC,CAAK,EAAId,EAAO,EAClB,CAACe,EAAOC,CAAQ,EAAIZ,EAAS,EAAE,EAC/B,CAACa,EAAOC,CAAQ,EAAId,EAAS,CAAC,EAI9B,CAACe,EAAWC,CAAY,EAAIhB,EAAS,EAAK,EAGhDF,EAAU,IAAM,CACViB,GACFL,EAAK,CAET,EAA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"CommandPalette", "props", "items", "onSelect", "onCancel", "T", "nameWidth", "exit", "query", "setQuery", "index", "setIndex", "submitted", "setSubmitted", "filtered", "q", "item", "activeIndex", "input", "key", "selected", "lastGroup", "position", "isActive", "showGroup", "jsx", "runCommandPalette", "items", "resolve", "selected", "waitUntilExit", "render", "CommandPalette", "name", "process"]
7
- }