velloo 0.8.0 → 0.10.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.
Files changed (117) hide show
  1. package/BUN-LICENSE.md +4 -3
  2. package/README.md +112 -128
  3. package/THIRD-PARTY-NOTICES.md +61 -61
  4. package/canvas/assets/InitWizard-C1CkcS7C.js +3 -0
  5. package/canvas/assets/index-CZPX0col.css +2 -0
  6. package/canvas/assets/index-D7gy-ZUv.js +49 -0
  7. package/canvas/assets/lucide-all-B49qZ9YE.js +1 -0
  8. package/canvas/assets/radix-CuVEihKE.js +41 -0
  9. package/canvas/assets/react-C1iE8mnY.js +9 -0
  10. package/canvas/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  11. package/canvas/assets/vendor-DXkvBgGY.js +58 -0
  12. package/canvas/assets/wand-sparkles-BxGgFkAt.js +1 -0
  13. package/canvas/index.html +6 -6
  14. package/{chunk-32cq4wpr.js → chunk-0rvdh1j3.js} +1 -1
  15. package/chunk-12pgt83m.js +8 -0
  16. package/chunk-12vc3f1h.js +3 -0
  17. package/{chunk-majd3gx9.js → chunk-28mhcvw2.js} +1 -1
  18. package/{chunk-ez720ked.js → chunk-3zm7ydna.js} +1 -1
  19. package/chunk-457fm9yy.js +7 -0
  20. package/chunk-46jg9aqy.js +40 -0
  21. package/chunk-5gwh0zpn.js +3 -0
  22. package/{chunk-q7wwqn03.js → chunk-5hb1e233.js} +1 -1
  23. package/{chunk-w30zfv3m.js → chunk-5ts4fvd9.js} +1 -1
  24. package/{chunk-rg86bhtb.js → chunk-62amy8bj.js} +1 -1
  25. package/{chunk-nrxqr4v5.js → chunk-6p8zwxxx.js} +1 -1
  26. package/{chunk-45wv1fs5.js → chunk-75gfv9g4.js} +11 -12
  27. package/chunk-84qjmqmz.js +2 -0
  28. package/{chunk-esg0x95a.js → chunk-85m9p67t.js} +2 -2
  29. package/chunk-91qesxwh.js +2 -0
  30. package/{chunk-hsk91jms.js → chunk-976rm76x.js} +1 -1
  31. package/chunk-99ccjbaa.js +4 -0
  32. package/{chunk-asqpx5v7.js → chunk-9hc7m55p.js} +3 -4
  33. package/{chunk-h3ser37q.js → chunk-a7xka0bj.js} +1 -1
  34. package/chunk-ak57bgnh.js +2 -0
  35. package/chunk-bf5808x5.js +2 -0
  36. package/{chunk-mqtnj8ws.js → chunk-bj47gjs9.js} +1 -1
  37. package/chunk-d0m56cjx.js +2 -0
  38. package/chunk-d6a6198y.js +3 -0
  39. package/{chunk-aefn23tr.js → chunk-etv7qsw7.js} +1 -1
  40. package/chunk-f2793pj6.js +85 -0
  41. package/{chunk-3612470d.js → chunk-fnv123mm.js} +1 -1
  42. package/{chunk-pjtg3wnm.js → chunk-fzevxpdz.js} +1 -1
  43. package/chunk-ghwy99py.js +68 -0
  44. package/chunk-gtt1qww8.js +2 -0
  45. package/chunk-hhkjqvww.js +1501 -0
  46. package/{chunk-d19ttv1a.js → chunk-hrvqwp8z.js} +1 -1
  47. package/{chunk-v6ks5v53.js → chunk-hxk0wkt3.js} +1 -1
  48. package/{chunk-qgbat4fv.js → chunk-jc95phff.js} +2 -2
  49. package/chunk-kwym0g80.js +11 -0
  50. package/chunk-kxcjme3n.js +6 -0
  51. package/{chunk-dy7qwj3t.js → chunk-mkctjrrz.js} +2 -2
  52. package/{chunk-z6r6wxm6.js → chunk-mknhfnkn.js} +1 -1
  53. package/chunk-mseawt58.js +849 -0
  54. package/{chunk-cg0sjdqt.js → chunk-nccfyeyy.js} +1 -1
  55. package/{chunk-c4164x55.js → chunk-npnxs0fy.js} +1 -1
  56. package/{chunk-ffm2jpxp.js → chunk-p9p2vbat.js} +2 -2
  57. package/chunk-pqc7dbhc.js +2 -0
  58. package/{chunk-g3k8k6fq.js → chunk-qc7c328q.js} +1 -1
  59. package/chunk-qe6pp4p6.js +72 -0
  60. package/{chunk-zgwvkgsz.js → chunk-qwy0jba8.js} +1 -1
  61. package/{chunk-mqx96m2g.js → chunk-s26bgjqz.js} +1 -1
  62. package/{chunk-8n07n0cr.js → chunk-s8pqbr4n.js} +2 -2
  63. package/{chunk-p93x4pn2.js → chunk-tjy12q19.js} +1 -1
  64. package/{chunk-cq2q36d1.js → chunk-v1by80c5.js} +1 -1
  65. package/chunk-vdy4ave9.js +2 -0
  66. package/chunk-vwhee991.js +3 -0
  67. package/chunk-wf7r45wh.js +12 -0
  68. package/chunk-x4jsr5et.js +17 -0
  69. package/{chunk-8qf0ne1p.js → chunk-x9gk2n9v.js} +1 -1
  70. package/chunk-xxjevh62.js +2 -0
  71. package/{chunk-s1cwck4c.js → chunk-y2y1b3zm.js} +1 -1
  72. package/chunk-y6jq6y8t.js +2 -0
  73. package/cli.js +1 -1
  74. package/package.json +11 -11
  75. package/pkgs/helpers/src/icon-data.ts +868 -172
  76. package/pkgs/schema/src/index.ts +1 -0
  77. package/pkgs/schema/src/snippet-resolve.ts +43 -0
  78. package/pkgs/shadcn-snapshot/dist/manifest.json +348 -0
  79. package/pkgs/shadcn-snapshot/src/components/canvas-portal.tsx +3 -3
  80. package/plugins/claude/velloo/.claude-plugin/plugin.json +5 -2
  81. package/plugins/gemini/gemini-extension.json +7 -2
  82. package/canvas/assets/index-CcPwhD7W.js +0 -31
  83. package/canvas/assets/index-CkVteRZ9.css +0 -2
  84. package/canvas/assets/lucide-all-Cezxn40A.js +0 -1
  85. package/canvas/assets/radix-gmpYzWRH.js +0 -41
  86. package/canvas/assets/react-D0Ec-185.js +0 -9
  87. package/canvas/assets/rolldown-runtime-hePW80VL.js +0 -1
  88. package/canvas/assets/vendor-CKmQ-Zst.js +0 -53
  89. package/chunk-07fxzrx2.js +0 -40
  90. package/chunk-4g4c9h7k.js +0 -2
  91. package/chunk-6w42sr61.js +0 -6
  92. package/chunk-80fjfyha.js +0 -86
  93. package/chunk-8ztgcajz.js +0 -8
  94. package/chunk-9g45c5md.js +0 -815
  95. package/chunk-b4hny6hw.js +0 -3
  96. package/chunk-bntsn3wj.js +0 -2
  97. package/chunk-djwvt6jx.js +0 -2
  98. package/chunk-dqqpbmxt.js +0 -22
  99. package/chunk-ejpccmcj.js +0 -18
  100. package/chunk-emty5315.js +0 -2
  101. package/chunk-jxgwdz2r.js +0 -5
  102. package/chunk-kvq7pcph.js +0 -2
  103. package/chunk-m0v3d581.js +0 -2
  104. package/chunk-nx0ex7qw.js +0 -2
  105. package/chunk-qqagacne.js +0 -4
  106. package/chunk-qx83fdv2.js +0 -85
  107. package/chunk-r5y1sh4f.js +0 -12
  108. package/chunk-rhfzy9c0.js +0 -2
  109. package/chunk-rrrn1mkq.js +0 -3
  110. package/chunk-sjxp2bx3.js +0 -2
  111. package/chunk-t08391mh.js +0 -3
  112. package/chunk-t61vyqpd.js +0 -2
  113. package/chunk-vbk1qhdz.js +0 -3
  114. package/chunk-x84qrz4q.js +0 -6
  115. package/chunk-xg49s85z.js +0 -1491
  116. package/chunk-xxw67jpk.js +0 -63
  117. package/chunk-yjwtdm71.js +0 -2
package/chunk-07fxzrx2.js DELETED
@@ -1,40 +0,0 @@
1
- // @bun
2
- import{localDesignOf}from"./chunk-9g45c5md.js";import{TOOL_VERSION}from"./chunk-rrrn1mkq.js";import{isCancel,multiselect,log,select}from"./chunk-80fjfyha.js";import{manifestListing,findDesigns}from"./chunk-6w42sr61.js";import{BUN_RUNTIME_FLAGS}from"./chunk-skk6yvnw.js";import{require_picocolors}from"./chunk-jrsknzjt.js";import{__toESM}from"./chunk-2smsg2ct.js";import{existsSync}from"fs";import{homedir}from"os";import{dirname,join}from"path";var claudeEntry=(conn)=>conn.transport==="http"?{type:"http",url:conn.url}:{command:conn.command,args:conn.args},cursorEntry=(conn)=>conn.transport==="http"?{url:conn.url}:{command:conn.command,args:conn.args},codexEntry=cursorEntry,continueEntry=(conn)=>conn.transport==="http"?{name:"velloo",type:"streamable-http",url:conn.url}:{name:"velloo",type:"stdio",command:conn.command,args:conn.args},droidEntry=(conn)=>conn.transport==="http"?{type:"http",url:conn.url}:{type:"stdio",command:conn.command,args:conn.args,disabled:!1},geminiEntry=(conn)=>conn.transport==="http"?{httpUrl:conn.url}:{command:conn.command,args:conn.args},opencodeEntry=(conn)=>conn.transport==="http"?{type:"remote",url:conn.url,enabled:!0}:{type:"local",command:[conn.command,...conn.args],enabled:!0},vscodeEntry=(conn)=>conn.transport==="http"?{type:"http",url:conn.url}:{type:"stdio",command:conn.command,args:conn.args};function claudeDesktopConfigPath(homeDir){if(process.platform==="win32")return join(homeDir,"AppData","Roaming","Claude","claude_desktop_config.json");if(process.platform==="darwin")return join(homeDir,"Library","Application Support","Claude","claude_desktop_config.json");return join(homeDir,".config","Claude","claude_desktop_config.json")}var AGENTS={"claude-code":{id:"claude-code",label:"Claude Code (project)",scope:"project",format:"json",family:"claude-code",path:(root)=>join(root,".mcp.json"),entry:claudeEntry},cursor:{id:"cursor",label:"Cursor (project)",scope:"project",format:"json",family:"cursor",path:(root)=>join(root,".cursor","mcp.json"),entry:cursorEntry},codex:{id:"codex",label:"Codex CLI (project)",scope:"project",format:"codex-toml",path:(root)=>join(root,".codex","config.toml"),entry:codexEntry},continue:{id:"continue",label:"Continue (project)",scope:"project",format:"continue-block",path:(root)=>join(root,".continue","mcpServers","velloo.yaml"),entry:continueEntry},"claude-code-global":{id:"claude-code-global",label:"Claude Code (global)",scope:"global",format:"json",family:"claude-code",path:(_root,home)=>join(home,".claude.json"),entry:claudeEntry},"cursor-global":{id:"cursor-global",label:"Cursor (global)",scope:"global",format:"json",family:"cursor",path:(_root,home)=>join(home,".cursor","mcp.json"),entry:cursorEntry},"codex-global":{id:"codex-global",label:"Codex CLI (global)",scope:"global",format:"codex-toml",path:(_root,home)=>join(home,".codex","config.toml"),entry:codexEntry},"continue-global":{id:"continue-global",label:"Continue (global)",scope:"global",format:"continue-config",path:(_root,home)=>join(home,".continue","config.yaml"),entry:continueEntry},"claude-desktop":{id:"claude-desktop",label:"Claude Desktop",scope:"global",format:"json",gui:!0,path:(_root,home)=>claudeDesktopConfigPath(home),entry:claudeEntry},opencode:{id:"opencode",label:"opencode (project)",scope:"project",format:"opencode-json",path:(root)=>join(root,"opencode.json"),entry:opencodeEntry},"opencode-global":{id:"opencode-global",label:"opencode (global)",scope:"global",format:"opencode-json",path:(_root,home)=>join(home,".config","opencode","opencode.json"),entry:opencodeEntry},"droid-global":{id:"droid-global",label:"Droid (global)",scope:"global",format:"json",path:(_root,home)=>join(home,".factory","mcp.json"),entry:droidEntry},"cline-global":{id:"cline-global",label:"Cline (global)",scope:"global",format:"json",path:(_root,home)=>join(home,".cline","data","settings","cline_mcp_settings.json"),entry:cursorEntry},gemini:{id:"gemini",label:"Gemini CLI (project)",scope:"project",format:"json",path:(root)=>join(root,".gemini","settings.json"),entry:geminiEntry},"gemini-global":{id:"gemini-global",label:"Gemini CLI (global)",scope:"global",format:"json",path:(_root,home)=>join(home,".gemini","settings.json"),entry:geminiEntry},"windsurf-global":{id:"windsurf-global",label:"Windsurf (global)",scope:"global",format:"json",path:(_root,home)=>join(home,".codeium","windsurf","mcp_config.json"),entry:cursorEntry},vscode:{id:"vscode",label:"VS Code / Copilot (project)",scope:"project",format:"vscode-json",path:(root)=>join(root,".vscode","mcp.json"),entry:vscodeEntry}},AGENT_IDS=Object.keys(AGENTS),PROJECT_AGENT_IDS=["claude-code","cursor"],GLOBAL_AGENT_IDS=["claude-code-global","cursor-global"];function detectInstalledAgents(homeDir=homedir()){let has=(rel)=>existsSync(join(homeDir,rel)),found=[];if(Bun.which("claude")||has(".claude.json")||has(".claude"))found.push("claude-code-global");if(Bun.which("cursor-agent")||Bun.which("cursor")||has(".cursor"))found.push("cursor-global");if(Bun.which("codex")||has(".codex"))found.push("codex-global");if(has(".continue"))found.push("continue-global");if(existsSync(dirname(claudeDesktopConfigPath(homeDir))))found.push("claude-desktop");if(Bun.which("opencode")||has(join(".config","opencode")))found.push("opencode-global");if(Bun.which("droid")||has(".factory"))found.push("droid-global");if(Bun.which("cline")||has(".cline"))found.push("cline-global");if(Bun.which("gemini")||has(join(".gemini","settings.json")))found.push("gemini-global");if(has(join(".codeium","windsurf")))found.push("windsurf-global");return found}import{existsSync as existsSync2,realpathSync}from"fs";import{access}from"fs/promises";import{dirname as dirname2,join as join2,parse,relative,resolve,sep}from"path";async function resolveProjectRoot(designFolder,override){if(override)return override;let local=localDesignOf(designFolder);if(local)return local.root;let registered=await registeringManifest(designFolder);if(registered)return registered.dir;return nearestPackageRoot(designFolder)}async function designArgumentFor(projectRoot,designFolder){let set=await findDesigns(projectRoot).catch(()=>null),target=realOr(designFolder);if(set?.designs.some((d)=>!d.outsideRepo&&realOr(d.root)===target))return null;return relative(projectRoot,designFolder).split(sep).join("/")||"."}function realOr(path){return existsSync2(path)?realpathSync(path):resolve(path)}async function agentRootCandidates(designFolder){if(localDesignOf(designFolder))return[];let roots=[await resolveProjectRoot(designFolder)];return roots.push(await nearestPackageRoot(designFolder)),[...new Set(roots)]}async function registeringManifest(designFolder){let abs=resolve(designFolder),found;try{found=await manifestListing(abs)}catch{return null}if(!found)return null;let real=existsSync2(abs)?realpathSync(abs):abs;return found.folders.some((folder)=>folder===abs||existsSync2(folder)&&realpathSync(folder)===real)?found:null}async function nearestPackageRoot(designFolder){let fallback=dirname2(designFolder),dir=fallback,fsRoot=parse(dir).root;for(let i=0;i<8;i++){try{return await access(join2(dir,"package.json")),dir}catch{}if(dir===fsRoot)break;dir=dirname2(dir)}return fallback}import{existsSync as existsSync5}from"fs";import{homedir as homedir3}from"os";import{join as join6}from"path";import{mkdir,writeFile}from"fs/promises";import{dirname as dirname3,join as join3}from"path";async function installCursorRules(projectRoot,designFolder){let pinned=await designArgumentFor(projectRoot,designFolder),arg=pinned?` ${pinned}`:"",body=`---
3
- description: Drive UI design through the Velloo MCP server (a local design canvas backed by this project's shadcn components).
4
- alwaysApply: false
5
- ---
6
-
7
- # Velloo design
8
-
9
- Velloo is a local, code-shaped design canvas exposed over MCP. ${pinned?`The design folder for this project is \`${pinned}\`.`:"`velloo design list` shows this project's designs; the MCP server's instructions say which one a session is on."}
10
-
11
- - Cursor starts the velloo MCP server itself (wired as \`velloo mcp\`), so the
12
- tools are available once the MCP config is loaded \u2014 nothing to start first. If
13
- they're missing, ask the user to run \`velloo connect${arg}\` and
14
- restart Cursor. To watch the canvas, the user runs \`velloo run${arg}\`
15
- (stays in the foreground; \`b\` background, \`s\` stop, \`o\` open). If you start
16
- it yourself, pass \`--background\` so you aren't stuck in that session. It
17
- prints the canvas URL (defaults to \`:7300\`, or a free port if that's taken,
18
- so don't assume 7300). When a canvas is already up, the server's
19
- \`initialize\` instructions hand you its live URL.
20
- - You are the designer: compose screens from the project's shadcn components via
21
- the velloo MCP tools, verify visually with \`screenshot\`, then \`emit_code\` to
22
- turn a design into real code in this project's conventions.
23
- - Read the server's \`initialize\` instructions \u2014 they are the authoritative tool
24
- reference; this rule is just the pointer.
25
- - Designs are static on the canvas (no handlers, routing, or data fetching);
26
- write those when you implement.
27
- `,dest=join3(projectRoot,".cursor","rules","velloo.mdc");return await mkdir(dirname3(dest),{recursive:!0}),await writeFile(dest,body,"utf8"),{installed:!0,path:dest}}import{existsSync as existsSync4}from"fs";import{cp as cp2,mkdir as mkdir3,readFile,rm,writeFile as writeFile2}from"fs/promises";import{homedir as homedir2}from"os";import{dirname as dirname5,join as join5}from"path";import{fileURLToPath as fileURLToPath2}from"url";import{existsSync as existsSync3}from"fs";import{access as access2,cp,mkdir as mkdir2,readdir}from"fs/promises";import{dirname as dirname4,join as join4}from"path";import{fileURLToPath}from"url";var here=dirname4(fileURLToPath(import.meta.url));function resolveSkillsRoot(){let dev=join4(here,"..","..","..","..","skills");return[process.env.VELLOO_SKILLS_SRC,join4(here,"skills"),dev].filter((p)=>Boolean(p)).find((p)=>existsSync3(p))??dev}var SKILLS_ROOT=resolveSkillsRoot();async function installSkills(projectRoot,baseDir=".agents"){let entries;try{entries=await readdir(SKILLS_ROOT,{withFileTypes:!0})}catch{return[]}let results=[];for(let entry of entries){if(!entry.isDirectory())continue;let name=entry.name,srcDir=join4(SKILLS_ROOT,name);try{await access2(join4(srcDir,"SKILL.md"))}catch{continue}let destDir=join4(projectRoot,baseDir,"skills",name);await mkdir2(dirname4(destDir),{recursive:!0}),await cp(srcDir,destDir,{recursive:!0}),results.push({name,installed:!0,path:join4(destDir,"SKILL.md")})}return results}var here2=dirname5(fileURLToPath2(import.meta.url));function resolvePluginsRoot(){let dev=join5(here2,"..","..","..","..","plugins");return[process.env.VELLOO_PLUGINS_SRC,join5(here2,"plugins"),dev].filter((p)=>Boolean(p)).find((p)=>existsSync4(p))??dev}var PLUGINS_ROOT=resolvePluginsRoot(),bareVersion=()=>TOOL_VERSION.split(" ")[0]??"0.0.0";async function patchVersion(manifestPath){let manifest=JSON.parse(await readFile(manifestPath,"utf8"));return manifest.version=bareVersion(),await writeFile2(manifestPath,`${JSON.stringify(manifest,null,2)}
28
- `),bareVersion()}async function installClaudePlugin(homeDir=homedir2()){let src=join5(PLUGINS_ROOT,"claude","velloo");if(!existsSync4(src))return null;let marketplaceDir=join5(homeDir,".velloo","claude-plugins"),pluginDir=join5(marketplaceDir,"plugins","velloo");if(await rm(pluginDir,{recursive:!0,force:!0}),await mkdir3(join5(marketplaceDir,".claude-plugin"),{recursive:!0}),await cp2(src,pluginDir,{recursive:!0}),existsSync4(SKILLS_ROOT))await cp2(SKILLS_ROOT,join5(pluginDir,"skills"),{recursive:!0});let version=await patchVersion(join5(pluginDir,".claude-plugin","plugin.json"));await writeFile2(join5(marketplaceDir,".claude-plugin","marketplace.json"),`${JSON.stringify({name:"velloo",owner:{name:"Velloo",url:"https://velloo.design"},plugins:[{name:"velloo",source:"./plugins/velloo",description:"Design and implement UI on the Velloo canvas \u2014 skills, slash commands, and subagents.",version}]},null,2)}
29
- `);let settingsPath=join5(homeDir,".claude","settings.json"),settings={};try{settings=JSON.parse(await readFile(settingsPath,"utf8"))}catch(err){if(err.code!=="ENOENT")throw Error(`${settingsPath} exists but isn't valid JSON \u2014 fix or remove it, then re-run connect.`)}let marketplaces=settings.extraKnownMarketplaces&&typeof settings.extraKnownMarketplaces==="object"?settings.extraKnownMarketplaces:{},enabled=settings.enabledPlugins&&typeof settings.enabledPlugins==="object"?settings.enabledPlugins:{},merged={...settings,extraKnownMarketplaces:{...marketplaces,velloo:{source:{source:"directory",path:marketplaceDir}}},enabledPlugins:{...enabled,"velloo@velloo":!0}};return await mkdir3(dirname5(settingsPath),{recursive:!0}),await writeFile2(settingsPath,`${JSON.stringify(merged,null,2)}
30
- `),{marketplaceDir,settingsPath,version}}async function installGeminiExtension(homeDir=homedir2()){let src=join5(PLUGINS_ROOT,"gemini");if(!existsSync4(src))return null;let dir=join5(homeDir,".velloo","gemini-extension");if(await rm(dir,{recursive:!0,force:!0}),await cp2(src,dir,{recursive:!0}),existsSync4(SKILLS_ROOT))await cp2(SKILLS_ROOT,join5(dir,"skills"),{recursive:!0});await patchVersion(join5(dir,"gemini-extension.json"));let linked=!1;if(homeDir===homedir2()&&Bun.which("gemini"))try{let proc=Bun.spawn(["gemini","extensions","link",dir],{stdin:"ignore",stdout:"ignore",stderr:"ignore"}),timeout=setTimeout(()=>proc.kill(),15000);linked=await proc.exited===0,clearTimeout(timeout)}catch{linked=!1}return{dir,linked}}async function refreshAgentArtifacts(opts){let homeDir=opts.homeDir??homedir3(),refreshed=[];if(existsSync5(join6(homeDir,".velloo","claude-plugins","plugins","velloo"))){let plugin=await installClaudePlugin(homeDir);if(plugin)refreshed.push(`claude plugin (${plugin.marketplaceDir})`)}for(let projectRoot of opts.projectRoots){let skillsDir=join6(projectRoot,".agents","skills");if(existsSync5(skillsDir)){let skills=await installSkills(projectRoot);if(skills.length>0)refreshed.push(`${skills.length} skills (${skillsDir})`)}}if(existsSync5(join6(homeDir,".velloo","gemini-extension"))){let ext=await installGeminiExtension(homeDir);if(ext)refreshed.push(`gemini extension (${ext.dir})`)}for(let projectRoot of opts.projectRoots){let cursorRule=join6(projectRoot,".cursor","rules","velloo.mdc");if(existsSync5(cursorRule)){let rules=await installCursorRules(projectRoot,opts.designFolder);if(rules.installed&&rules.path)refreshed.push(`cursor rule (${rules.path})`)}}return{refreshed}}import{readFile as readFile3}from"fs/promises";import{homedir as homedir4}from"os";import{resolve as resolve2}from"path";var import_picocolors=__toESM(require_picocolors(),1);import{mkdir as mkdir4,readFile as readFile2,writeFile as writeFile3}from"fs/promises";import{dirname as dirname6}from"path";async function writeAgentConfig(projectRoot,agent,conn,homeDir){let path=agent.path(projectRoot,homeDir),entry=agent.entry(conn),existing=null;try{existing=await readFile2(path,"utf8")}catch(err){if(err.code!=="ENOENT")throw err}let content;switch(agent.format){case"json":content=mergeJson(existing,entry,path);break;case"codex-toml":content=mergeCodexToml(existing,entry,path);break;case"continue-block":content=continueBlockFile(entry);break;case"continue-config":content=mergeContinueConfig(existing,entry,path);break;case"opencode-json":content=mergeOpencodeJson(existing,entry,path);break;case"vscode-json":content=mergeVscodeJson(existing,entry,path);break}return await mkdir4(dirname6(path),{recursive:!0}),await writeFile3(path,content,"utf8"),{agent:agent.id,path,action:existing===null?"created":"updated"}}function invalidConfig(path,format,err){let msg=err instanceof Error?err.message:String(err);return Error(`${path} exists but isn't valid ${format} (${msg}) \u2014 fix or remove it, then re-run connect.`)}function mergeJson(existing,entry,path){let parsed={};if(existing!==null)try{parsed=JSON.parse(existing)}catch(err){throw invalidConfig(path,"JSON",err)}let servers=parsed.mcpServers&&typeof parsed.mcpServers==="object"?parsed.mcpServers:{},merged={...parsed,mcpServers:{...servers,velloo:entry}};return`${JSON.stringify(merged,null,2)}
31
- `}function mergeOpencodeJson(existing,entry,path){let parsed={$schema:"https://opencode.ai/config.json"};if(existing!==null)try{parsed=JSON.parse(existing)}catch(err){throw invalidConfig(path,"JSON",err)}let mcp=parsed.mcp&&typeof parsed.mcp==="object"?parsed.mcp:{},merged={...parsed,mcp:{...mcp,velloo:entry}};return`${JSON.stringify(merged,null,2)}
32
- `}function mergeVscodeJson(existing,entry,path){let parsed={};if(existing!==null)try{parsed=JSON.parse(existing)}catch(err){throw invalidConfig(path,"JSON",err)}let servers=parsed.servers&&typeof parsed.servers==="object"?parsed.servers:{},merged={...parsed,servers:{...servers,velloo:entry}};return`${JSON.stringify(merged,null,2)}
33
- `}function tomlValue(v){if(typeof v==="string")return JSON.stringify(v);if(Array.isArray(v))return`[${v.map(tomlValue).join(", ")}]`;return String(v)}var VELLOO_TABLE=/^\s*\[\s*mcp_servers\s*\.\s*(?:"velloo"|velloo)\s*(?:\]|\.)/,ANY_TABLE=/^\s*\[/;function mergeCodexToml(existing,entry,path){if(existing!==null&&existing.trim()!=="")try{Bun.TOML.parse(existing)}catch(err){throw invalidConfig(path,"TOML",err)}let lines=existing===null?[]:existing.split(`
34
- `);while(lines.length>0&&lines[lines.length-1]?.trim()==="")lines.pop();let keep=[],insertAt=-1,i=0;while(i<lines.length){let line=lines[i];if(VELLOO_TABLE.test(line)){if(insertAt===-1)insertAt=keep.length;i++;while(i<lines.length&&!ANY_TABLE.test(lines[i]))i++;continue}keep.push(line),i++}let block=["[mcp_servers.velloo]",...Object.entries(entry).map(([k,v])=>`${k} = ${tomlValue(v)}`)];if(insertAt===-1){if(keep.length>0&&keep[keep.length-1]?.trim()!=="")keep.push("");keep.push(...block)}else keep.splice(insertAt,0,...block);let content=`${keep.join(`
35
- `)}
36
- `;return Bun.TOML.parse(content),content}function toYaml(value){let yaml=Bun.YAML.stringify(value,null,2).replace(/[ \t]+$/gm,"");return yaml.endsWith(`
37
- `)?yaml:`${yaml}
38
- `}function continueBlockFile(entry){let version=TOOL_VERSION.split(" ")[0]??"0.0.0";return toYaml({name:"velloo",version,schema:"v1",mcpServers:[entry]})}function mergeContinueConfig(existing,entry,path){let doc={name:"Local Assistant",version:"1.0.0",schema:"v1"};if(existing!==null&&existing.trim()!==""){let parsed;try{parsed=Bun.YAML.parse(existing)}catch(err){throw invalidConfig(path,"YAML",err)}if(parsed===null||typeof parsed!=="object"||Array.isArray(parsed))throw invalidConfig(path,"YAML",Error("expected a top-level mapping"));doc=parsed}let others=(Array.isArray(doc.mcpServers)?doc.mcpServers:[]).filter((s)=>!(s!==null&&typeof s==="object"&&s.name==="velloo"));return toYaml({...doc,mcpServers:[...others,entry]})}var MANUAL_AGENT_ID="manual";function manualSetupText(){return["velloo speaks MCP over stdio (recommended) or HTTP \u2014 any MCP-capable agent can connect.","","stdio \u2014 the agent spawns the server itself:",' command: "velloo" args: ["mcp"]',` (resolves the design folder from the agent's cwd; pin one with ["mcp", "path/to/velloo"])`,""," Most agents take the JSON convention:",' { "mcpServers": { "velloo": { "command": "velloo", "args": ["mcp"] } } }',"","HTTP \u2014 for agents that dial a URL: `velloo mcp --http <design>` prints the URL of the","running canvas's MCP server, then point the agent at it:",' { "mcpServers": { "velloo": { "type": "http", "url": "<the printed URL>" } } }'," The port changes whenever the canvas restarts, so prefer stdio where the agent allows it."].join(`
39
- `)}function baseLabel(id){return(AGENTS[id]?.label??id).replace(/\s*\((?:project|global)\)$/,"")}function projectVariantOf(id){let agent=AGENTS[id];if(!agent)return;if(agent.scope==="project")return id;let candidate=id.replace(/-global$/,"");return candidate!==id&&AGENTS[candidate]?candidate:void 0}async function askAgentWiring(opts){let preWired=await globallyWiredAgents(),projectWired=opts?.projectRoot&&!opts.globalOnly?await projectWiredAgents(opts.projectRoot):[],detected=detectInstalledAgents(),fallback=detected.length===0,wanted=fallback?GLOBAL_AGENT_IDS:detected,missing=wanted.filter((id)=>!preWired.includes(id)),alreadyWired=[...new Set([...preWired,...projectWired])];if(projectWired.length>0)log.info(`Already wired for this project: ${projectWired.map(baseLabel).join(", ")} ${import_picocolors.default.dim("(re-wiring is a no-op merge)")}`);if(preWired.length>0){let labels=preWired.map(baseLabel).join(", ");if(opts?.skipWhenCovered&&missing.length===0)return log.success(`velloo is already wired globally \u2014 ${labels} ${import_picocolors.default.dim("(covers this project; skipping agent setup)")}`),{agents:[],manual:!1,preWired:alreadyWired};log.info(`Already wired globally: ${labels} ${import_picocolors.default.dim("(covers this project)")}`)}log.info(fallback?`No coding agents detected on this machine \u2014 offering the defaults (${wanted.map(baseLabel).join(", ")}).`:`Coding agents detected: ${detected.map(baseLabel).join(", ")}`);let targets=missing.length>0?missing:wanted,names=targets.map(baseLabel).join(", "),projectTargets=opts?.globalOnly?[]:targets.map(projectVariantOf).filter((id)=>Boolean(id));if(opts?.globalOnly)log.info(import_picocolors.default.dim("This design lives outside the repository, so only global agent configs are offered \u2014 nothing is written into the checkout."));let mode=await select({message:"Wire the velloo MCP into your coding agents?",options:[{value:"global",label:`Install globally \u2014 ${names}`,hint:"recommended \u2014 one config covers every project"},...projectTargets.length>0?[{value:"project",label:"Install for this project only",hint:projectTargets.map(baseLabel).join(", ")}]:[],{value:"choose",label:"Let me pick agents",hint:"the full list"},{value:"manual",label:"Manual MCP setup instructions",hint:"prints the config to paste into any agent"},{value:"skip",label:"Don't install now",hint:"wire later with `velloo connect`"}],initialValue:"global"});if(isCancel(mode))return null;if(mode==="skip")return{agents:[],manual:!1,preWired:alreadyWired};if(mode==="manual")return{agents:[],manual:!0,preWired:alreadyWired};if(mode==="global")return{agents:targets,manual:!1,preWired:alreadyWired};if(mode==="project")return{agents:projectTargets,manual:!1,preWired:alreadyWired};let picked=await pickAgents({exclude:[...opts?.skipWhenCovered?preWired:[],...opts?.globalOnly?Object.values(AGENTS).filter((agent)=>agent.scope==="project").map((agent)=>agent.id):[]],initial:[...new Set([...targets,...preWired,...projectWired])],wired:alreadyWired});if(picked===null)return null;return{agents:picked.filter((id)=>id!==MANUAL_AGENT_ID),manual:picked.includes(MANUAL_AGENT_ID),preWired:alreadyWired}}async function pickAgents(opts){let exclude=new Set(opts?.exclude??[]),wired=new Set(opts?.wired??[]),agents=Object.values(AGENTS).filter((a)=>!exclude.has(a.id)).sort((a,b)=>a.scope===b.scope?0:a.scope==="global"?-1:1),detected=detectInstalledAgents(),initial=(opts?.initial??(detected.length>0?detected:GLOBAL_AGENT_IDS)).filter((id)=>!exclude.has(id)),picked=await multiselect({message:"Wire the velloo MCP into which agents?",options:[...agents.map((a)=>({value:a.id,label:a.label,hint:wired.has(a.id)?`already wired \u2014 ${a.path(".","~")}`:a.path(".","~")})),{value:MANUAL_AGENT_ID,label:"Manual / other agent",hint:"prints the MCP config to paste anywhere"}],initialValues:initial,required:!1});return isCancel(picked)?null:picked}function hasVellooEntry(content,format){try{switch(format){case"json":{let parsed=JSON.parse(content);return Boolean(parsed.mcpServers&&"velloo"in parsed.mcpServers)}case"codex-toml":return/^\s*\[\s*mcp_servers\s*\.\s*(?:"velloo"|velloo)\s*(?:\]|\.)/m.test(content);case"continue-block":return!0;case"continue-config":{let doc=Bun.YAML.parse(content);return Array.isArray(doc?.mcpServers)&&doc.mcpServers.some((s)=>s!==null&&typeof s==="object"&&s.name==="velloo")}case"opencode-json":{let parsed=JSON.parse(content);return Boolean(parsed.mcp&&"velloo"in parsed.mcp)}case"vscode-json":{let parsed=JSON.parse(content);return Boolean(parsed.servers&&"velloo"in parsed.servers)}}}catch{return!1}}async function projectWiredAgents(projectRoot){let out=[];for(let agent of Object.values(AGENTS)){if(agent.scope!=="project")continue;let content;try{content=await readFile3(agent.path(projectRoot,homedir4()),"utf8")}catch{continue}if(hasVellooEntry(content,agent.format))out.push(agent.id)}return out}async function globallyWiredAgents(homeDir=homedir4()){let out=[];for(let agent of Object.values(AGENTS)){if(agent.scope!=="global")continue;let content;try{content=await readFile3(agent.path(".",homeDir),"utf8")}catch{continue}if(hasVellooEntry(content,agent.format))out.push(agent.id)}return out}function localDesignScopeProblem(folder,agents){if(!localDesignOf(folder))return null;let refused=agents.filter((id)=>AGENTS[id]?.scope==="project");if(refused.length===0)return null;let globals=refused.map((id)=>`${id}-global`).filter((id)=>AGENTS[id]).join(", ");return`${refused.join(", ")} ${refused.length===1?"writes":"write"} into the checkout, and ${folder} is a local design outside it \u2014 only global configs are allowed${globals?` (use ${globals})`:""}.`}async function connect(opts){let transport=opts.transport??"stdio",homeDir=opts.homeDir??homedir4(),projectRoot=await resolveProjectRoot(opts.designFolder,opts.projectRoot),local=localDesignOf(opts.designFolder)!==null,httpUrl=opts.mcpUrl;if(transport==="http"&&!httpUrl)throw Error("the HTTP transport needs the server URL: run `velloo mcp --http` and pass the URL it prints as --mcp-url");let designArg=await designArgumentFor(projectRoot,opts.designFolder),connectionFor=(agent)=>{if(transport==="http")return{transport:"http",url:httpUrl};if(agent.gui){let script=process.argv[1]?resolve2(process.argv[1]):Bun.which("velloo");return script?{transport:"stdio",command:process.execPath,args:[...BUN_RUNTIME_FLAGS,script,"mcp",resolve2(opts.designFolder)]}:{transport:"stdio",command:"velloo",args:["mcp",resolve2(opts.designFolder)]}}return{transport:"stdio",command:"velloo",args:agent.scope==="project"&&designArg?["mcp",designArg]:["mcp"]}},configs=[],unknownAgents=[],projectScoped=[];for(let id of opts.agents){let agent=AGENTS[id];if(!agent){unknownAgents.push(id);continue}if(local&&agent.scope==="project"){projectScoped.push(id);continue}configs.push(await writeAgentConfig(projectRoot,agent,connectionFor(agent),homeDir))}let hasFamily=(family)=>opts.agents.some((id)=>AGENTS[id]?.family===family),hasAny=(...ids)=>opts.agents.some((id)=>ids.includes(id)),plugin=opts.installSkill&&hasFamily("claude-code")?await installClaudePlugin(homeDir)??void 0:void 0,skills=opts.installSkill&&!local&&hasAny("opencode","opencode-global","droid-global","cline-global","gemini","gemini-global","codex","codex-global")?await installSkills(projectRoot):void 0,geminiExtension=opts.installSkill&&hasAny("gemini","gemini-global")?await installGeminiExtension(homeDir)??void 0:void 0,cursorRules=opts.installSkill&&!local&&hasFamily("cursor")?await installCursorRules(projectRoot,opts.designFolder):void 0;return{projectRoot,transport,configs,skills,plugin,geminiExtension,cursorRules,unknownAgents,projectScoped}}
40
- export{AGENTS,AGENT_IDS,PROJECT_AGENT_IDS,GLOBAL_AGENT_IDS,resolveProjectRoot,designArgumentFor,agentRootCandidates,writeAgentConfig,refreshAgentArtifacts,MANUAL_AGENT_ID,manualSetupText,askAgentWiring,globallyWiredAgents,localDesignScopeProblem,connect};
package/chunk-4g4c9h7k.js DELETED
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{init_default,runInit2}from"./chunk-dqqpbmxt.js";import"./chunk-cg0sjdqt.js";import"./chunk-rg86bhtb.js";import"./chunk-07fxzrx2.js";import"./chunk-ez720ked.js";import"./chunk-45wv1fs5.js";import"./chunk-z6r6wxm6.js";import"./chunk-asqpx5v7.js";import"./chunk-dy7qwj3t.js";import"./chunk-qgbat4fv.js";import"./chunk-6w42sr61.js";import"./chunk-80fjfyha.js";import"./chunk-9g45c5md.js";import"./chunk-xg49s85z.js";import"./chunk-w30zfv3m.js";import"./chunk-bntsn3wj.js";import"./chunk-d19ttv1a.js";import"./chunk-32cq4wpr.js";import"./chunk-rrrn1mkq.js";import"./chunk-s23gtejf.js";import"./chunk-p93x4pn2.js";import"./chunk-xxw67jpk.js";export{init_default as default,runInit2 as runInit};
package/chunk-6w42sr61.js DELETED
@@ -1,6 +0,0 @@
1
- // @bun
2
- import{BoardSchema,isArchived,designNameIssue,toDesignName,ConfigSchema,ScreenSchema}from"./chunk-xxw67jpk.js";import{writeJsonAtomic,listLocalDesigns,writeLocalDesign,readRepoManifestAt,findOwningManifest,recordedDesignName,findDesigns2,pickDesign}from"./chunk-9g45c5md.js";import{isCancel,multiselect,select}from"./chunk-80fjfyha.js";import{fail}from"./chunk-s23gtejf.js";import{existsSync,realpathSync}from"fs";import{readdir,readFile,rm,stat}from"fs/promises";import{homedir}from"os";import{basename,dirname,isAbsolute,join,relative,resolve,sep}from"path";var MANIFEST_FILE="velloo.json",DEFAULT_FOLDER_NAME="velloo";function findManifest(dir){return readRepoManifestAt(dir,{strict:!0})}function manifestListing(folder){return findOwningManifest(folder,{strict:!0})}function findDesigns(cwd){return findDesigns2(cwd,{strict:!0})}function sameFolder(a,b){return a===b||existsSync(a)&&existsSync(b)&&realpathSync(a)===realpathSync(b)}function assertCurrent(found){if(found.legacy)throw Error(`${found.path} is in the pre-designs format (\`projects\`) \u2014 run \`velloo upgrade\` to migrate it first.`)}async function unregisterDesign(folder,projectDir){let abs=resolve(folder),here=projectDir?await findManifest(projectDir):null,found=here?.folders.some((path)=>sameFolder(path,abs))?here:await manifestListing(abs);if(!found)return{name:null,path:null,removedManifest:!1};let index=found.folders.findIndex((path)=>sameFolder(path,abs));if(index===-1)return{name:null,path:found.path,removedManifest:!1};assertCurrent(found);let name=recordedDesignName(abs)??basename(abs),manifest=withoutDesign(found.manifest,index,name);if(manifest===null)return await rm(found.path,{force:!0}),{name,path:found.path,removedManifest:!0};return await writeJsonAtomic(found.path,manifest),{name,path:found.path,removedManifest:!1}}function withoutDesign(manifest,index,name){let designs=manifest.designs.filter((_,i)=>i!==index),{defaultDesign,...rest}=manifest;if(designs.length===0&&!rest.feedback)return null;return{...rest,designs,...defaultDesign&&defaultDesign!==name?{defaultDesign}:{}}}function isWithin(parent,child){let rel=relative(parent,child);return rel===""||!rel.startsWith("..")&&!isAbsolute(rel)}async function findGitRoot(start){let home=homedir(),dir=resolve(start);while(dir!==home){try{return await stat(join(dir,".git")),dir}catch{}let parent=dirname(dir);if(parent===dir)return null;dir=parent}return null}var SCAN_SKIP=new Set(["node_modules",".git","dist","build",".next",".turbo","coverage",".velloo"]);async function discoverDesignFolders(root,maxDepth=3){let out=[],walk=async(dir,depth)=>{let entries;try{entries=await readdir(dir,{withFileTypes:!0})}catch{return}for(let entry of entries){if(!entry.isDirectory()||entry.name.startsWith(".")||SCAN_SKIP.has(entry.name))continue;let child=join(dir,entry.name);try{await stat(join(child,".design","config.json")),out.push(child);continue}catch{}if(depth<maxDepth)await walk(child,depth+1)}};return await walk(resolve(root),1),out.sort()}function deriveName(folder,projectDir){let base=basename(folder),nested=base===DEFAULT_FOLDER_NAME&&dirname(folder)!==projectDir;return toDesignName(nested?basename(dirname(folder)):base)??"app"}async function chooseDesignName(request){let folder=resolve(request.folder),issue=request.requested===void 0?null:designNameIssue(request.requested);if(issue)throw Error(`invalid --name ${JSON.stringify(request.requested)} \u2014 ${issue}`);let taken=await takenNames(request,folder);if(request.requested){let holder=taken.get(request.requested);if(holder)throw Error(`a design named "${request.requested}" already exists at ${holder} \u2014 pick another --name.`);return request.requested}let base;if(request.storage==="repository")base=deriveName(folder,resolve(request.checkout));else{let chosen=request.storage==="chosen"&&basename(folder)!==DEFAULT_FOLDER_NAME;base=deriveName(chosen?folder:request.appRoot)}let name=base;for(let n=2;taken.has(name);n++)name=`${base}-${n}`;return name}async function takenNames(request,folder){let from=request.checkout,taken=new Map,set=await findDesigns(from).catch(()=>null);for(let design of set?.designs??[])if(!sameFolder(design.root,folder))taken.set(design.name,design.root);if(!set?.repo)for(let sibling of await discoverDesignFolders(request.checkout,1)){let name=recordedDesignName(sibling);if(name&&!sameFolder(sibling,folder))taken.set(name,sibling)}return taken}async function writeDesignName(folder,name){let path=join(folder,".design","config.json"),config=ConfigSchema.parse(JSON.parse(await readFile(path,"utf8")));await writeJsonAtomic(path,{...config,name})}async function registerDesign(folder,projectDir){let abs=resolve(folder),name=recordedDesignName(abs);if(!name)throw Error(`${abs} has no design name \u2014 run \`velloo design upgrade ${abs}\` first.`);let dir=resolve(projectDir),found=await findManifest(dir),path=found?found.path:join(dir,MANIFEST_FILE);if(found?.folders.some((target)=>sameFolder(target,abs)))return{name,path,created:!1};if(found)assertCurrent(found);let clash=(await findDesigns(dir))?.designs.find((d)=>d.name===name&&!sameFolder(d.root,abs));if(clash)throw Error(`a design named "${name}" already exists at ${clash.root} \u2014 rename one with \`velloo design rename\`.`);let designs=[...found?.manifest.designs??[]],rel=(target)=>relative(dir,target).split("\\").join("/")||".",defaultDesign=found?.manifest.defaultDesign;if(!found)for(let sibling of await discoverDesignFolders(dir,1)){if(sibling===abs)continue;if(designs.push(rel(sibling)),sibling===join(dir,DEFAULT_FOLDER_NAME))defaultDesign=recordedDesignName(sibling)??void 0}designs.push(rel(abs));let manifest={...found?.manifest??{},designs,...defaultDesign?{defaultDesign}:{}};return await writeJsonAtomic(path,manifest),{name,path,created:!0}}async function registerLocalDesign(opts){await writeLocalDesign(opts.id,{root:opts.root,appRoot:opts.appRoot,...opts.designPath?{designPath:opts.designPath}:{}})}import{existsSync as existsSync2,readdirSync}from"fs";import{readdir as readdir2,readFile as readFile2}from"fs/promises";import{homedir as homedir2}from"os";import{basename as basename2,dirname as dirname2,join as join2,relative as relative2,resolve as resolve2,sep as sep2}from"path";var DEFAULT_FOLDER="velloo",DESIGN_ARG_DESCRIPTION="A design name from ./velloo.json, a design folder, or a velloo.json file or its directory (default: the design folder you're in, else this directory's velloo.json: its only design or defaultDesign)";async function existingDesignFolder(appRoot){try{let found=await findDesigns(appRoot);for(let design of found?.designs??[])if(design.exists)return design.root}catch{}let conventional=join2(resolve2(appRoot),DEFAULT_FOLDER);if(await hasDesignConfig(conventional))return conventional;let[first]=await discoverDesignFolders(resolve2(appRoot));return first??null}function isDesignFolderSync(dir){return existsSync2(join2(dir,".design","config.json"))}function isEmptyOrMissingSync(dir){try{return readdirSync(dir).length===0}catch(err){if(err.code==="ENOENT")return!0;throw err}}async function hasDesignConfig(dir){try{return await readFile2(join2(dir,".design","config.json"),"utf8"),!0}catch{return!1}}var DESIGN_ID_ARG={type:"string",description:"The design's number in `velloo design list`, instead of its name or path"};async function designFolder(set,design,abort){let repo=set.repo;if(repo&&design.outsideRepo){let entry=relative2(repo.dir,design.root);abort(`design ${JSON.stringify(design.name)} in ${repo.path} points outside the repository (${entry}), which velloo.json cannot authorize. Pass the design path explicitly, or run \`velloo design bind ${design.root}\` here to keep it as a local design on this machine.`)}if(!design.exists)abort(`design ${JSON.stringify(design.name)} ${design.local?"(a local design)":`in ${repo?.path}`} points at ${design.root}, which is not a velloo design folder (no .design/config.json).`);return design.root}function quoteArg(value){return/^[\w@%+=:,./-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}function designsLabel(set){return set.repo?.path??"this checkout's local designs"}function byName(set,name,abort){let shared=set.conflicts.get(name);if(shared)abort(`${shared.length} designs are named ${JSON.stringify(name)}: ${shared.map((d)=>d.root).join(", ")}. Pass a path, and rename one with \`velloo design rename <path> <new-name>\`.`);return set.byName.get(name)}async function resolveDesign(arg,cmd,opts={}){let abort=opts.onFail??((m)=>fail(cmd,m)),cwd=resolve2(opts.cwd??"."),set=null;try{set=await findDesigns(cwd)}catch(err){abort(err.message)}if(opts.id!==void 0){if(arg)abort("pass a design or --id, not both.");let n=Number(opts.id);if(!Number.isInteger(n)||n<1)abort("--id takes a design's number from `velloo design list`.");if(!set||set.designs.length===0){if(n===1)return resolveDesign(void 0,cmd,{...opts,id:void 0});abort(`there is no design #${n} here \u2014 \`velloo design list\` numbers them.`)}let entry=set.designs[n-1];if(!entry)abort(`there is no design #${n} \u2014 ${designsLabel(set)} has ${set.designs.length}. \`velloo design list\` numbers them.`);return designFolder(set,entry,abort)}if(arg){let named=set&&!arg.includes(sep2)?byName(set,arg,abort):void 0;if(set&&named)return designFolder(set,named,abort);let explicit=resolve2(cwd,arg);if(await hasDesignConfig(explicit))return explicit;let project=basename2(explicit)==="velloo.json"&&existsSync2(explicit)?dirname2(explicit):explicit;if((await findDesigns(project).catch((err)=>abort(err.message)))?.designs.length)return resolveDesign(void 0,cmd,{...opts,cwd:project});let nested=join2(explicit,DEFAULT_FOLDER);if(await hasDesignConfig(nested))return nested;if(!set&&!arg.includes(sep2)){let above=await enclosingProject(cwd),match=above?.designs.find((d)=>d.name===arg);if(above&&match)abort(`design ${JSON.stringify(arg)} is listed in \`${shortPath(cwd,above.label)}\`, and commands only read the directory they run in. Run from \`${shortPath(cwd,above.dir)}\`, or pass its folder (\`${quoteArg(shortPath(cwd,match.root))}\`) instead of its name.`)}if(set&&!arg.includes(sep2))abort(`unknown design ${JSON.stringify(arg)} \u2014 ${designsLabel(set)} lists: ${set.designs.map((d)=>d.name).join(", ")}. Pass a design name or a folder path.`);if(opts.requireConfig)abort(`${explicit} is not a velloo design folder (no .design/config.json).`);return explicit}if(set&&set.designs.length>0){if(await hasDesignConfig(cwd))return cwd;let picked=pickDesign(set,cwd);if(picked&&picked.reason!=="arbitrary")return designFolder(set,picked.design,abort);let names=set.designs.map((d)=>d.name);if(opts.interactive&&process.stdin.isTTY){let chosen=await select({message:"Which design?",options:set.designs.map((d)=>({value:d.root,label:d.name,hint:relative2(cwd,d.root)}))});if(isCancel(chosen))abort("cancelled.");let design=set.designs.find((d)=>d.root===chosen);return designFolder(set,design,abort)}let example=cmd.startsWith("design ")?`velloo ${cmd} --id 1\` for ${quoteArg(names[0]??"")}, as numbered by \`velloo design list`:`velloo ${cmd} ${designExample(opts,names[0]??"")}`;abort(`${designsLabel(set)} lists several designs: ${names.join(", ")}. Pass one (e.g. \`${example}\`)${set.repo?' or set "defaultDesign"':""}.`)}if(await hasDesignConfig(cwd))return cwd;let here=join2(cwd,DEFAULT_FOLDER);if(await hasDesignConfig(here))return here;let takesDesign=opts.takesDesign!==!1,above=await enclosingProject(cwd);if(above){let nearest=[...above.designs].sort((a,b)=>relative2(cwd,a.root).length-relative2(cwd,b.root).length)[0],example=takesDesign&&nearest?`, or pass a design folder (e.g. \`velloo ${cmd} ${designExample(opts,relative2(cwd,nearest.root).split(sep2).join("/"))}\`)`:"";abort(`no velloo.json or design folder here. \`${shortPath(cwd,above.label)}\` lists ${above.designs.map((d)=>JSON.stringify(d.name)).join(", ")}, and commands only read the directory they run in: run from \`${shortPath(cwd,above.dir)}\`${example}.`)}let example=takesDesign?`, pass a design folder or a velloo.json path (e.g. \`velloo ${cmd} ${designExample(opts,"apps/web")}\`)`:"";abort(`no velloo.json or design folder in ${cwd}. Run from the directory that has your velloo.json${example}, or \`velloo init\` here.${movedCheckoutHint(cwd)}`)}function shortPath(cwd,path){let rel=relative2(cwd,path);return rel!==""&&rel.length<path.length?rel.split(sep2).join("/"):path}function designExample(opts,design){return opts.designFlag?`${opts.designFlag}=${quoteArg(design)}`:quoteArg(design)}async function enclosingProject(cwd){let here=resolve2(cwd);for(let dir=dirname2(here);dir!==here;){let set=await findDesigns(dir).catch(()=>null),designs=set?.designs.filter((d)=>d.exists&&!d.outsideRepo)??[];if(set&&designs.length>0)return{dir,label:set.repo?.path??`${dir} (local designs)`,designs};let parent=dirname2(dir);if(parent===dir)return null;dir=parent}return null}async function checkoutDesigns(cwd){let set=await findDesigns(cwd).catch(()=>null);if(set&&set.designs.length>0)return set.designs.filter((d)=>d.exists&&!d.outsideRepo).map((d)=>d.root);try{return[await resolveDesign(void 0,"upgrade",{requireConfig:!0,cwd,onFail:()=>{throw Error("no design here")}})]}catch{return[]}}async function resolveDesignForSession(arg,cmd,cwd=resolve2(".")){if(!arg&&!await hasDesignConfig(cwd)){let set=await findDesigns(cwd).catch(()=>null),picked=set?pickDesign(set,cwd):null;if(set&&picked?.reason==="arbitrary")return{folder:await designFolder(set,picked.design,(m)=>fail(cmd,m)),pick:"arbitrary"}}return{folder:await resolveDesign(arg,cmd,{cwd}),pick:void 0}}function movedCheckoutHint(cwd){if(!insideProject(cwd))return"";let orphans=listLocalDesigns().filter((design)=>!existsSync2(design.root)&&existsSync2(design.designRoot));if(orphans.length===0)return"";return`
3
- This machine has designs for checkouts that no longer exist at their old paths:${orphans.map((design)=>`
4
- "${recordedDesignName(design.designRoot)??design.legacyName??design.id}" at ${design.designRoot}, made for ${design.root}`).join("")}
5
- If this is one of those checkouts, moved, attach its design with \`velloo design bind <design folder>\`. Otherwise forget it with \`velloo design remove <design folder>\`.`}function insideProject(cwd){let home=homedir2();for(let dir=cwd;dir!==home&&dirname2(dir)!==dir;dir=dirname2(dir))if(existsSync2(join2(dir,".git"))||existsSync2(join2(dir,"package.json")))return!0;return!1}async function listScreens(folder){let files;try{files=(await readdir2(join2(folder,"screens"))).filter((f)=>f.endsWith(".json"))}catch{return[]}let out=[];for(let f of files.sort()){let path=join2(folder,"screens",f);try{let s=ScreenSchema.parse(JSON.parse(await readFile2(path,"utf8")));out.push({id:s.id,name:s.name||s.id,path})}catch{}}return out}async function listBoards(folder){let files;try{files=(await readdir2(join2(folder,"boards"))).filter((f)=>f.endsWith(".json"))}catch{return[]}let out=[];for(let f of files.sort())try{let b=BoardSchema.parse(JSON.parse(await readFile2(join2(folder,"boards",f),"utf8")));out.push({id:b.id,name:b.name||b.id,screens:b.frames.map((fr)=>fr.screen),archived:isArchived(b)})}catch{}return out}function boardsByScreen(boards){let map=new Map;for(let b of boards)for(let sid of b.screens){let names=map.get(sid)??[];names.push(b.name),map.set(sid,names)}return map}async function pickBoards(folder,arg,interactive,cmd){let all=await listBoards(folder);if(all.length===0)return[];if(arg){let ids=new Set(arg.split(",").map((s)=>s.trim()).filter(Boolean)),chosen=all.filter((b)=>ids.has(b.id));if(chosen.length===0)fail(cmd,`no boards matched "${arg}". Available: ${all.map((b)=>b.id).join(", ")}`);return chosen}let boards=all.filter((b)=>!b.archived);if(boards.length===0)return[];if(!interactive)return boards;let chosen=await multiselect(boardSelectionPrompt(boards));if(isCancel(chosen))fail(cmd,"cancelled.");return resolveBoardSelection(boards,chosen)}function boardSelectionPrompt(boards){return{message:"Which boards to publish? (a: select all / clear all)",options:boards.map((board)=>({value:board.id,label:board.name,hint:`${board.screens.length} screen${board.screens.length===1?"":"s"}`})),initialValues:[],required:!1}}function resolveBoardSelection(boards,selectedIds){let selected=new Set(selectedIds),chosen=boards.filter((board)=>selected.has(board.id));return chosen.length>0?chosen:null}async function pickScreen(folder,arg,interactive,cmd){let screens=await listScreens(folder);if(arg){let byId=screens.find((s)=>s.id===arg);if(byId)return byId;return{id:arg,name:arg,path:resolve2(arg)}}if(screens.length===0)fail(cmd,`no screens found in ${folder}/screens.`);if(screens.length===1)return screens[0];if(!interactive)fail(cmd,`pick a screen: ${screens.map((s)=>s.id).join(", ")}`);let onBoard=boardsByScreen(await listBoards(folder)),chosen=await select({message:"Which screen?",options:screens.map((s)=>({value:s.id,label:s.name,hint:onBoard.get(s.id)?.join(", ")??`${s.id}.json`}))});if(isCancel(chosen))fail(cmd,"cancelled.");return screens.find((s)=>s.id===chosen)}
6
- export{findManifest,manifestListing,findDesigns,unregisterDesign,withoutDesign,isWithin,findGitRoot,chooseDesignName,writeDesignName,registerDesign,registerLocalDesign,DESIGN_ARG_DESCRIPTION,existingDesignFolder,isDesignFolderSync,isEmptyOrMissingSync,hasDesignConfig,DESIGN_ID_ARG,resolveDesign,checkoutDesigns,resolveDesignForSession,pickBoards,pickScreen};
package/chunk-80fjfyha.js DELETED
@@ -1,86 +0,0 @@
1
- // @bun
2
- import{__toESM,__commonJS}from"./chunk-2smsg2ct.js";var require_src=__commonJS(function(exports,module){var cursor={to(x,y){if(!y)return`\x1B[${x+1}G`;return`\x1B[${y+1};${x+1}H`},move(x,y){let ret="";if(x<0)ret+=`\x1B[${-x}D`;else if(x>0)ret+=`\x1B[${x}C`;if(y<0)ret+=`\x1B[${-y}A`;else if(y>0)ret+=`\x1B[${y}B`;return ret},up:(count=1)=>`\x1B[${count}A`,down:(count=1)=>`\x1B[${count}B`,forward:(count=1)=>`\x1B[${count}C`,backward:(count=1)=>`\x1B[${count}D`,nextLine:(count=1)=>"\x1B[E".repeat(count),prevLine:(count=1)=>"\x1B[F".repeat(count),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},scroll={up:(count=1)=>"\x1B[S".repeat(count),down:(count=1)=>"\x1B[T".repeat(count)},erase={screen:"\x1B[2J",up:(count=1)=>"\x1B[1J".repeat(count),down:(count=1)=>"\x1B[J".repeat(count),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(count){let clear="";for(let i=0;i<count;i++)clear+=this.line+(i<count-1?cursor.up():"");if(count)clear+=cursor.left;return clear}};module.exports={cursor,scroll,erase,beep:"\x07"}});import{styleText}from"util";import{stdout,stdin}from"process";import*as l from"readline";import l__default from"readline";var getCodePointsLength=(()=>{let SURROGATE_PAIR_RE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(input)=>{let surrogatePairsNr=0;SURROGATE_PAIR_RE.lastIndex=0;while(SURROGATE_PAIR_RE.test(input))surrogatePairsNr+=1;return input.length-surrogatePairsNr}})(),isFullWidth=(x)=>x===12288||x>=65281&&x<=65376||x>=65504&&x<=65510,isWideNotCJKTNotEmoji=(x)=>x===8987||x===9001||x>=12272&&x<=12287||x>=12289&&x<=12350||x>=12441&&x<=12543||x>=12549&&x<=12591||x>=12593&&x<=12686||x>=12688&&x<=12771||x>=12783&&x<=12830||x>=12832&&x<=12871||x>=12880&&x<=19903||x>=65040&&x<=65049||x>=65072&&x<=65106||x>=65108&&x<=65126||x>=65128&&x<=65131||x>=127488&&x<=127490||x>=127504&&x<=127547||x>=127552&&x<=127560||x>=131072&&x<=196605||x>=196608&&x<=262141;var ANSI_RE=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,CONTROL_RE=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,CJKT_WIDE_RE=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,TAB_RE=/\t{1,1000}/y,EMOJI_RE=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,LATIN_RE=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,MODIFIER_RE=/\p{M}+/gu,NO_TRUNCATION={limit:1/0,ellipsis:""},getStringTruncatedWidth=(input,truncationOptions={},widthOptions={})=>{let LIMIT=truncationOptions.limit??1/0,ELLIPSIS=truncationOptions.ellipsis??"",ELLIPSIS_WIDTH=truncationOptions?.ellipsisWidth??(ELLIPSIS?getStringTruncatedWidth(ELLIPSIS,NO_TRUNCATION,widthOptions).width:0),ANSI_WIDTH=0,CONTROL_WIDTH=widthOptions.controlWidth??0,TAB_WIDTH=widthOptions.tabWidth??8,EMOJI_WIDTH=widthOptions.emojiWidth??2,FULL_WIDTH_WIDTH=2,REGULAR_WIDTH=widthOptions.regularWidth??1,WIDE_WIDTH=widthOptions.wideWidth??2,PARSE_BLOCKS=[[LATIN_RE,REGULAR_WIDTH],[ANSI_RE,0],[CONTROL_RE,CONTROL_WIDTH],[TAB_RE,TAB_WIDTH],[EMOJI_RE,EMOJI_WIDTH],[CJKT_WIDE_RE,WIDE_WIDTH]],indexPrev=0,index=0,length=input.length,lengthExtra=0,truncationEnabled=!1,truncationIndex=length,truncationLimit=Math.max(0,LIMIT-ELLIPSIS_WIDTH),unmatchedStart=0,unmatchedEnd=0,width=0,widthExtra=0;outer:while(!0){if(unmatchedEnd>unmatchedStart||index>=length&&index>indexPrev){let unmatched=input.slice(unmatchedStart,unmatchedEnd)||input.slice(indexPrev,index);lengthExtra=0;for(let char of unmatched.replaceAll(MODIFIER_RE,"")){let codePoint=char.codePointAt(0)||0;if(isFullWidth(codePoint))widthExtra=2;else if(isWideNotCJKTNotEmoji(codePoint))widthExtra=WIDE_WIDTH;else widthExtra=REGULAR_WIDTH;if(width+widthExtra>truncationLimit)truncationIndex=Math.min(truncationIndex,Math.max(unmatchedStart,indexPrev)+lengthExtra);if(width+widthExtra>LIMIT){truncationEnabled=!0;break outer}lengthExtra+=char.length,width+=widthExtra}unmatchedStart=unmatchedEnd=0}if(index>=length)break outer;for(let i=0,l=PARSE_BLOCKS.length;i<l;i++){let[BLOCK_RE,BLOCK_WIDTH]=PARSE_BLOCKS[i];if(BLOCK_RE.lastIndex=index,BLOCK_RE.test(input)){if(lengthExtra=BLOCK_RE===CJKT_WIDE_RE?getCodePointsLength(input.slice(index,BLOCK_RE.lastIndex)):BLOCK_RE===EMOJI_RE?1:BLOCK_RE.lastIndex-index,widthExtra=lengthExtra*BLOCK_WIDTH,width+widthExtra>truncationLimit)truncationIndex=Math.min(truncationIndex,index+Math.floor((truncationLimit-width)/BLOCK_WIDTH));if(width+widthExtra>LIMIT){truncationEnabled=!0;break outer}width+=widthExtra,unmatchedStart=indexPrev,unmatchedEnd=index,index=indexPrev=BLOCK_RE.lastIndex;continue outer}}index+=1}return{width:truncationEnabled?truncationLimit:width,index:truncationEnabled?truncationIndex:length,truncated:truncationEnabled,ellipsed:truncationEnabled&&LIMIT>=ELLIPSIS_WIDTH}},dist_default=getStringTruncatedWidth;var NO_TRUNCATION2={limit:1/0,ellipsis:"",ellipsisWidth:0},fastStringWidth=(input,options={})=>dist_default(input,NO_TRUNCATION2,options).width,dist_default2=fastStringWidth;var ESC="\x1B",CSI="\x9B",END_CODE=39,ANSI_ESCAPE_BELL="\x07",ANSI_CSI="[",ANSI_OSC="]",ANSI_SGR_TERMINATOR="m",ANSI_ESCAPE_LINK=`${ANSI_OSC}8;;`,GROUP_REGEX=new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`,"y"),getClosingCode=(openingCode)=>{if(openingCode>=30&&openingCode<=37)return 39;if(openingCode>=90&&openingCode<=97)return 39;if(openingCode>=40&&openingCode<=47)return 49;if(openingCode>=100&&openingCode<=107)return 49;if(openingCode===1||openingCode===2)return 22;if(openingCode===3)return 23;if(openingCode===4)return 24;if(openingCode===7)return 27;if(openingCode===8)return 28;if(openingCode===9)return 29;if(openingCode===0)return 0;return},wrapAnsiCode=(code)=>`${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`,wrapAnsiHyperlink=(url)=>`${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`,wrapWord=(rows,word,columns)=>{let characters=word[Symbol.iterator](),isInsideEscape=!1,isInsideLinkEscape=!1,lastRow=rows.at(-1),visible=lastRow===void 0?0:dist_default2(lastRow),currentCharacter=characters.next(),nextCharacter=characters.next(),rawCharacterIndex=0;while(!currentCharacter.done){let character=currentCharacter.value,characterLength=dist_default2(character);if(visible+characterLength<=columns)rows[rows.length-1]+=character;else rows.push(character),visible=0;if(character===ESC||character===CSI)isInsideEscape=!0,isInsideLinkEscape=word.startsWith(ANSI_ESCAPE_LINK,rawCharacterIndex+1);if(isInsideEscape){if(isInsideLinkEscape){if(character===ANSI_ESCAPE_BELL)isInsideEscape=!1,isInsideLinkEscape=!1}else if(character===ANSI_SGR_TERMINATOR)isInsideEscape=!1}else if(visible+=characterLength,visible===columns&&!nextCharacter.done)rows.push(""),visible=0;currentCharacter=nextCharacter,nextCharacter=characters.next(),rawCharacterIndex+=character.length}if(lastRow=rows.at(-1),!visible&&lastRow!==void 0&&lastRow.length&&rows.length>1)rows[rows.length-2]+=rows.pop()},stringVisibleTrimSpacesRight=(string)=>{let words=string.split(" "),last=words.length;while(last){if(dist_default2(words[last-1]))break;last--}if(last===words.length)return string;return words.slice(0,last).join(" ")+words.slice(last).join("")},exec=(string,columns,options={})=>{if(options.trim!==!1&&string.trim()==="")return"";let returnValue="",escapeCode,escapeUrl,words=string.split(" "),rows=[""],rowLength=0;for(let index=0;index<words.length;index++){let word=words[index];if(options.trim!==!1){let row=rows.at(-1)??"",trimmed=row.trimStart();if(row.length!==trimmed.length)rows[rows.length-1]=trimmed,rowLength=dist_default2(trimmed)}if(index!==0){if(rowLength>=columns&&(options.wordWrap===!1||options.trim===!1))rows.push(""),rowLength=0;if(rowLength||options.trim===!1)rows[rows.length-1]+=" ",rowLength++}let wordLength=dist_default2(word);if(options.hard&&wordLength>columns){let remainingColumns=columns-rowLength,breaksStartingThisLine=1+Math.floor((wordLength-remainingColumns-1)/columns);if(Math.floor((wordLength-1)/columns)<breaksStartingThisLine)rows.push("");wrapWord(rows,word,columns),rowLength=dist_default2(rows.at(-1)??"");continue}if(rowLength+wordLength>columns&&rowLength&&wordLength){if(options.wordWrap===!1&&rowLength<columns){wrapWord(rows,word,columns),rowLength=dist_default2(rows.at(-1)??"");continue}rows.push(""),rowLength=0}if(rowLength+wordLength>columns&&options.wordWrap===!1){wrapWord(rows,word,columns),rowLength=dist_default2(rows.at(-1)??"");continue}rows[rows.length-1]+=word,rowLength+=wordLength}if(options.trim!==!1)rows=rows.map((row)=>stringVisibleTrimSpacesRight(row));let preString=rows.join(`
3
- `),inSurrogate=!1;for(let i=0;i<preString.length;i++){let character=preString[i];if(returnValue+=character,!inSurrogate){if(inSurrogate=character>="\uD800"&&character<="\uDBFF",inSurrogate)continue}else inSurrogate=!1;if(character===ESC||character===CSI){GROUP_REGEX.lastIndex=i+1;let groups=GROUP_REGEX.exec(preString)?.groups;if(groups?.code!==void 0){let code=Number.parseFloat(groups.code);escapeCode=code===END_CODE?void 0:code}else if(groups?.uri!==void 0)escapeUrl=groups.uri.length===0?void 0:groups.uri}if(preString[i+1]===`
4
- `){if(escapeUrl)returnValue+=wrapAnsiHyperlink("");let closingCode=escapeCode?getClosingCode(escapeCode):void 0;if(escapeCode&&closingCode)returnValue+=wrapAnsiCode(closingCode)}else if(character===`
5
- `){if(escapeCode&&getClosingCode(escapeCode))returnValue+=wrapAnsiCode(escapeCode);if(escapeUrl)returnValue+=wrapAnsiHyperlink(escapeUrl)}}return returnValue},CRLF_OR_LF=/\r?\n/;function wrapAnsi(string,columns,options){return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line,columns,options)).join(`
6
- `)}var import_sisteransi=__toESM(require_src(),1);import{ReadStream}from"tty";function findCursor(s,o,l){if(!l.some((r)=>!r.disabled))return s;let t=s+o,n=Math.max(l.length-1,0),e=t<0?n:t>n?0:t;return l[e]?.disabled?findCursor(e,o<0?-1:1,l):e}var a$1=["up","down","left","right","space","enter","cancel"],t=["January","February","March","April","May","June","July","August","September","October","November","December"],settings={actions:new Set(a$1),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...t],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(n,e)=>`There are only ${n} days in ${e}`,afterMin:(n)=>`Date must be on or after ${n.toISOString().slice(0,10)}`,beforeMax:(n)=>`Date must be on or before ${n.toISOString().slice(0,10)}`}}};function isActionKey(n,e){if(typeof n=="string")return settings.aliases.get(n)===e;for(let s of n)if(s!==void 0&&isActionKey(s,e))return!0;return!1}function diffLines(i,s){if(i===s)return;let e=i.split(`
7
- `),t=s.split(`
8
- `),r=Math.max(e.length,t.length),f=[];for(let n=0;n<r;n++)e[n]!==t[n]&&f.push(n);return{lines:f,numLinesBefore:e.length,numLinesAfter:t.length,numLines:r}}var R=globalThis.process.platform.startsWith("win"),CANCEL_SYMBOL=Symbol("clack:cancel");function isCancel(e){return e===CANCEL_SYMBOL}function setRawMode(e,r){let o=e;o.isTTY&&o.setRawMode(r)}function block({input:e=stdin,output:r=stdout,overwrite:o=!0,hideCursor:t=!0}={}){let s=l.createInterface({input:e,output:r,prompt:"",tabSize:1});l.emitKeypressEvents(e,s),e instanceof ReadStream&&e.isTTY&&e.setRawMode(!0);let n=(f,{name:a,sequence:p})=>{let c=String(f);if(isActionKey([c,a,p],"cancel")){t&&r.write(import_sisteransi.cursor.show),process.exit(0);return}if(!o)return;l.moveCursor(r,a==="return"?0:-1,a==="return"?-1:0,()=>{l.clearLine(r,1,()=>{e.once("keypress",n)})})};return t&&r.write(import_sisteransi.cursor.hide),e.once("keypress",n),()=>{e.off("keypress",n),t&&r.write(import_sisteransi.cursor.show),e instanceof ReadStream&&e.isTTY&&!R&&e.setRawMode(!1),s.terminal=!1,s.close()}}var getColumns=(e)=>("columns"in e)&&typeof e.columns=="number"?e.columns:80,getRows=(e)=>("rows"in e)&&typeof e.rows=="number"?e.rows:20;function wrapTextWithPrefix(e,r,o,t=o,s=o,n){let f=getColumns(e??stdout);return wrapAnsi(r,f-o.length,{hard:!0,trim:!1}).split(`
9
- `).map((c,i,m)=>{let d=n?n(c,i):c;return i===0?`${t}${d}`:i===m.length-1?`${s}${d}`:`${o}${d}`}).join(`
10
- `)}function runValidation(e,n){if("~standard"in e){let a=e["~standard"].validate(n);if(a instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return a.issues?.at(0)?.message}return e(n)}class V{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,e=!0){let{input:i=stdin,output:n=stdout,render:s,signal:r,...o}=t;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=s.bind(this),this._track=e,this._abortSignal=r,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){let i=this._subscribers.get(t)??[];i.push(e),this._subscribers.set(t,i)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){let i=this._subscribers.get(t)??[],n=[];for(let s of i)s.cb(...e),s.once&&n.push(()=>i.splice(i.indexOf(s),1));for(let s of n)s()}prompt(){return new Promise((t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(CANCEL_SYMBOL);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=l__default.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),setRawMode(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(import_sisteransi.cursor.show),this.output.off("resize",this.render),setRawMode(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(import_sisteransi.cursor.show),this.output.off("resize",this.render),setRawMode(this.input,!1),t(CANCEL_SYMBOL)})})}_isActionKey(t,e){return t==="\t"}_shouldSubmit(t,e){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,e){this.userInput=t??"",this.emit("userInput",this.userInput),e&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(t,e)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&settings.aliases.has(e.name)&&this.emit("cursor",settings.aliases.get(e.name)),settings.actions.has(e.name)&&this.emit("cursor",e.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,e),e?.name==="return"&&this._shouldSubmit(t,e)){if(this.opts.validate){let i=runValidation(this.opts.validate,this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}isActionKey([t,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
11
- `),setRawMode(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=wrapAnsi(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
12
- `).length-1;this.output.write(import_sisteransi.cursor.move(-999,t*-1))}render(){let t=wrapAnsi(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(import_sisteransi.cursor.hide);else{let e=diffLines(this._prevFrame,t),i=getRows(this.output);if(this.restoreCursor(),e){let n=Math.max(0,e.numLinesAfter-i),s=Math.max(0,e.numLinesBefore-i),r=e.lines.find((o)=>o>=n);if(r===void 0){this._prevFrame=t;return}if(e.lines.length===1){this.output.write(import_sisteransi.cursor.move(0,r-s)),this.output.write(import_sisteransi.erase.lines(1));let o=t.split(`
13
- `);this.output.write(o[r]),this._prevFrame=t,this.output.write(import_sisteransi.cursor.move(0,o.length-r-1));return}else if(e.lines.length>1){if(n<s)r=n;else{let h=r-s;h>0&&this.output.write(import_sisteransi.cursor.move(0,h))}this.output.write(import_sisteransi.erase.down());let f=t.split(`
14
- `).slice(r);this.output.write(f.join(`
15
- `)),this._prevFrame=t;return}}this.output.write(import_sisteransi.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class r extends V{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(i)=>{this.output.write(import_sisteransi.cursor.move(0,-1)),this.value=i,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class a extends V{options;cursor=0;get _value(){return this.options[this.cursor]?.value}get _enabledOptions(){return this.options.filter((e)=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,i=this.value!==void 0&&this.value.length===e.length;this.value=i?[]:e.map((t)=>t.value)}toggleInvert(){let e=this.value;if(!e)return;let i=this._enabledOptions.filter((t)=>!e.includes(t.value));this.value=i.map((t)=>t.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter((i)=>i!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let i=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0);this.cursor=this.options[i]?.disabled?findCursor(i,1,this.options):i,this.on("key",(t,l)=>{l.name==="a"&&this.toggleAll(),l.name==="i"&&this.toggleInvert()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=findCursor(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=findCursor(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}}var u$1=class extends V{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${styleText(["inverse","hidden"],"_")}`;let s=this.masked,r=s.slice(0,this.cursor),i=s.slice(this.cursor,this.cursor+1),o=s.slice(this.cursor+1);return`${r}${styleText("inverse",i)}${o}`}clear(){this._clearUserInput()}constructor({mask:t,...s}){super(s),this._mask=t??"\u2022",this.on("userInput",(r)=>{this._setValue(r)}),this.on("finalize",()=>{this.value===void 0&&(this.value="")})}},n$1=class extends V{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let o=this.options.findIndex(({value:s})=>s===e.initialValue),t=o===-1?0:o;this.cursor=this.options[t]?.disabled?findCursor(t,1,this.options):t,this.changeValue(),this.on("cursor",(s)=>{switch(s){case"left":case"up":this.cursor=findCursor(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=findCursor(this.cursor,1,this.options);break}this.changeValue()})}};class n extends V{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),s=t.slice(this.cursor,this.cursor+1),e=t.slice(this.cursor+1);return`${r}${styleText("inverse",s)}${e}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",(r)=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}import{styleText as styleText2,stripVTControlCharacters}from"util";import process$1 from"process";var import_sisteransi2=__toESM(require_src(),1);function isUnicodeSupported(){if(process$1.platform!=="win32")return process$1.env.TERM!=="linux";return Boolean(process$1.env.CI)||Boolean(process$1.env.WT_SESSION)||Boolean(process$1.env.TERMINUS_SUBLIME)||process$1.env.ConEmuTask==="{cmd::Cmder}"||process$1.env.TERM_PROGRAM==="Terminus-Sublime"||process$1.env.TERM_PROGRAM==="vscode"||process$1.env.TERM==="xterm-256color"||process$1.env.TERM==="alacritty"||process$1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var unicode=isUnicodeSupported(),isCI=()=>process.env.CI==="true";var unicodeOr=(o,e)=>unicode?o:e,S_STEP_ACTIVE=unicodeOr("\u25C6","*"),S_STEP_CANCEL=unicodeOr("\u25A0","x"),S_STEP_ERROR=unicodeOr("\u25B2","x"),S_STEP_SUBMIT=unicodeOr("\u25C7","o"),S_BAR_START=unicodeOr("\u250C","T"),S_BAR=unicodeOr("\u2502","|"),S_BAR_END=unicodeOr("\u2514","\u2014"),S_BAR_START_RIGHT=unicodeOr("\u2510","T"),S_BAR_END_RIGHT=unicodeOr("\u2518","\u2014"),S_RADIO_ACTIVE=unicodeOr("\u25CF",">"),S_RADIO_INACTIVE=unicodeOr("\u25CB"," "),S_CHECKBOX_ACTIVE=unicodeOr("\u25FB","[\u2022]"),S_CHECKBOX_SELECTED=unicodeOr("\u25FC","[+]"),S_CHECKBOX_INACTIVE=unicodeOr("\u25FB","[ ]"),S_PASSWORD_MASK=unicodeOr("\u25AA","\u2022"),S_BAR_H=unicodeOr("\u2500","-"),S_CORNER_TOP_RIGHT=unicodeOr("\u256E","+"),S_CONNECT_LEFT=unicodeOr("\u251C","+"),S_CORNER_BOTTOM_RIGHT=unicodeOr("\u256F","+"),S_CORNER_BOTTOM_LEFT=unicodeOr("\u2570","+"),S_CORNER_TOP_LEFT=unicodeOr("\u256D","+"),S_INFO=unicodeOr("\u25CF","\u2022"),S_SUCCESS=unicodeOr("\u25C6","*"),S_WARN=unicodeOr("\u25B2","!"),S_ERROR=unicodeOr("\u25A0","x"),symbol=(o)=>{switch(o){case"initial":case"active":return styleText2("cyan",S_STEP_ACTIVE);case"cancel":return styleText2("red",S_STEP_CANCEL);case"error":return styleText2("yellow",S_STEP_ERROR);case"submit":return styleText2("green",S_STEP_SUBMIT)}},symbolBar=(o)=>{switch(o){case"initial":case"active":return styleText2("cyan",S_BAR);case"cancel":return styleText2("red",S_BAR);case"error":return styleText2("yellow",S_BAR);case"submit":return styleText2("green",S_BAR)}};function formatInstructionFooter(o,e){let r=[`${e?`${styleText2("cyan",S_BAR)} `:""}${o.join(" \u2022 ")}`];return e&&r.push(styleText2("cyan",S_BAR_END)),r}var I=(l,e,w,p,b,C=!1)=>{let r=e,O=0;if(C)for(let i=p-1;i>=w;i--){let m=l[i];if(m&&(r-=m.length),O++,r<=b)break}else for(let i=w;i<p;i++){let m=l[i];if(m&&(r-=m.length),O++,r<=b)break}return{lineCount:r,removals:O}},limitOptions=({cursor:l,options:e,style:w,output:p=process.stdout,maxItems:b=Number.POSITIVE_INFINITY,columnPadding:C=0,rowPadding:r=4})=>{let i=getColumns(p)-C,m=getRows(p),M=styleText2("dim","..."),v=Math.max(m-r,0),a=Math.max(Math.min(b,v),5),f=0;l>=a-3&&(f=Math.max(Math.min(l-a+3,e.length-a),0));let d=a<e.length&&f>0,c=a<e.length&&f+a<e.length,W=Math.min(f+a,e.length),s=[],g=0;d&&g++,c&&g++;let T=f+(d?1:0),y=W-(c?1:0);for(let t=T;t<y;t++){let n=e[t],o=n?w(n,t===l):"",h=wrapAnsi(o,i,{hard:!0,trim:!1}).split(`
16
- `);s.push(h),g+=h.length}if(g>v){let t=0,n=0,o=g,h=l-T,u=v,L=()=>I(s,o,0,h,u),E=()=>I(s,o,h+1,s.length,u,!0);d?({lineCount:o,removals:t}=L(),o>u&&(c||(u-=1),{lineCount:o,removals:n}=E())):(c||(u-=1),{lineCount:o,removals:n}=E(),o>u&&(u-=1,{lineCount:o,removals:t}=L())),t>0&&(d=!0,s.splice(0,t)),n>0&&(c=!0,s.splice(s.length-n,n))}let x=[];d&&x.push(M);for(let t of s)for(let n of t)x.push(n);return c&&x.push(M),x};var confirm=(i)=>{let a=i.active??"Yes",s=i.inactive??"No";return new r({active:a,inactive:s,signal:i.signal,input:i.input,output:i.output,initialValue:i.initialValue??!0,render(){let e=i.withGuide??settings.withGuide,u=`${symbol(this.state)} `,l=e?`${styleText2("gray",S_BAR)} `:"",f=wrapTextWithPrefix(i.output,i.message,l,u),o=`${e?`${styleText2("gray",S_BAR)}
17
- `:""}${f}
18
- `,c=this.value?a:s;switch(this.state){case"submit":{let r=e?`${styleText2("gray",S_BAR)} `:"";return`${o}${r}${styleText2("dim",c)}`}case"cancel":{let r=e?`${styleText2("gray",S_BAR)} `:"";return`${o}${r}${styleText2(["strikethrough","dim"],c)}${e?`
19
- ${styleText2("gray",S_BAR)}`:""}`}default:{let r=e?`${styleText2("cyan",S_BAR)} `:"",g=e?styleText2("cyan",S_BAR_END):"";return`${o}${r}${this.value?`${styleText2("green",S_RADIO_ACTIVE)} ${a}`:`${styleText2("dim",S_RADIO_INACTIVE)} ${styleText2("dim",a)}`}${i.vertical?e?`
20
- ${styleText2("cyan",S_BAR)} `:`
21
- `:` ${styleText2("dim","/")} `}${this.value?`${styleText2("dim",S_RADIO_INACTIVE)} ${styleText2("dim",s)}`:`${styleText2("green",S_RADIO_ACTIVE)} ${s}`}
22
- ${g}
23
- `}}}}).prompt()};var MULTISELECT_INSTRUCTIONS=[`${styleText2("dim","\u2191/\u2193")} to navigate`,`${styleText2("dim","Space:")} select`,`${styleText2("dim","Enter:")} confirm`],m=(i,u)=>i.split(`
24
- `).map((d)=>u(d)).join(`
25
- `),multiselect=(i)=>{let u=(t,a)=>{let r=t.label??String(t.value);return a==="disabled"?`${styleText2("gray",S_CHECKBOX_INACTIVE)} ${m(r,(o)=>styleText2(["strikethrough","gray"],o))}${t.hint?` ${styleText2("dim",`(${t.hint??"disabled"})`)}`:""}`:a==="active"?`${styleText2("cyan",S_CHECKBOX_ACTIVE)} ${r}${t.hint?` ${styleText2("dim",`(${t.hint})`)}`:""}`:a==="selected"?`${styleText2("green",S_CHECKBOX_SELECTED)} ${m(r,(o)=>styleText2("dim",o))}${t.hint?` ${styleText2("dim",`(${t.hint})`)}`:""}`:a==="cancelled"?`${m(r,(o)=>styleText2(["strikethrough","dim"],o))}`:a==="active-selected"?`${styleText2("green",S_CHECKBOX_SELECTED)} ${r}${t.hint?` ${styleText2("dim",`(${t.hint})`)}`:""}`:a==="submitted"?`${m(r,(o)=>styleText2("dim",o))}`:`${styleText2("dim",S_CHECKBOX_INACTIVE)} ${m(r,(o)=>styleText2("dim",o))}`},d=i.required??!0,v=i.showInstructions??!0;return new a({options:i.options,signal:i.signal,input:i.input,output:i.output,initialValues:i.initialValues,required:d,cursorAt:i.cursorAt,validate(t){if(d&&(t===void 0||t.length===0))return`Please select at least one option.
26
- ${styleText2("reset",styleText2("dim",`Press ${styleText2(["gray","bgWhite","inverse"]," space ")} to select, ${styleText2("gray",styleText2("bgWhite",styleText2("inverse"," enter ")))} to submit`))}`},render(){let t=i.withGuide??settings.withGuide,a=wrapTextWithPrefix(i.output,i.message,t?`${symbolBar(this.state)} `:"",`${symbol(this.state)} `),r=`${t?`${styleText2("gray",S_BAR)}
27
- `:""}${a}
28
- `,o=this.value??[],p=(n,l)=>{if(n.disabled)return u(n,"disabled");let s=o.includes(n.value);return l&&s?u(n,"active-selected"):s?u(n,"selected"):u(n,l?"active":"inactive")};switch(this.state){case"submit":{let n=this.options.filter(({value:s})=>o.includes(s)).map((s)=>u(s,"submitted")).join(styleText2("dim",", "))||styleText2("dim","none"),l=wrapTextWithPrefix(i.output,n,t?`${styleText2("gray",S_BAR)} `:"");return`${r}${l}`}case"cancel":{let n=this.options.filter(({value:s})=>o.includes(s)).map((s)=>u(s,"cancelled")).join(styleText2("dim",", "));if(n.trim()==="")return`${r}${styleText2("gray",S_BAR)}`;let l=wrapTextWithPrefix(i.output,n,t?`${styleText2("gray",S_BAR)} `:"");return`${r}${l}${t?`
29
- ${styleText2("gray",S_BAR)}`:""}`}case"error":{let n=t?`${styleText2("yellow",S_BAR)} `:"",l=this.error.split(`
30
- `).map(($,C)=>C===0?`${t?`${styleText2("yellow",S_BAR_END)} `:""}${styleText2("yellow",$)}`:` ${$}`).join(`
31
- `),s=r.split(`
32
- `).length,h=l.split(`
33
- `).length+1;return`${r}${n}${limitOptions({output:i.output,options:this.options,cursor:this.cursor,maxItems:i.maxItems,columnPadding:n.length,rowPadding:s+h,style:p}).join(`
34
- ${n}`)}
35
- ${l}
36
- `}default:{let n=t?`${styleText2("cyan",S_BAR)} `:"",l=r.split(`
37
- `).length,s=v?formatInstructionFooter(MULTISELECT_INSTRUCTIONS,t):t?[styleText2("cyan",S_BAR_END)]:[],h=s.join(`
38
- `),$=s.length+1;return`${r}${n}${limitOptions({output:i.output,options:this.options,cursor:this.cursor,maxItems:i.maxItems,columnPadding:n.length,rowPadding:l+$,style:p}).join(`
39
- ${n}`)}
40
- ${h}
41
- `}}}}).prompt()};var log={message:(s=[],{symbol:e=styleText2("gray",S_BAR),secondarySymbol:r=styleText2("gray",S_BAR),output:m=process.stdout,spacing:l=1,withGuide:c}={})=>{let t=[],o=c??settings.withGuide,f=o?r:"",O=o?`${e} `:"",u=o?`${r} `:"";for(let i=0;i<l;i++)t.push(f);let g=Array.isArray(s)?s:s.split(`
42
- `);if(g.length>0){let[i,...y]=g;i.length>0?t.push(`${O}${i}`):t.push(o?e:"");for(let p of y)p.length>0?t.push(`${u}${p}`):t.push(o?r:"")}m.write(`${t.join(`
43
- `)}
44
- `)},info:(s,e)=>{log.message(s,{...e,symbol:styleText2("blue",S_INFO)})},success:(s,e)=>{log.message(s,{...e,symbol:styleText2("green",S_SUCCESS)})},step:(s,e)=>{log.message(s,{...e,symbol:styleText2("green",S_STEP_SUBMIT)})},warn:(s,e)=>{log.message(s,{...e,symbol:styleText2("yellow",S_WARN)})},warning:(s,e)=>{log.warn(s,e)},error:(s,e)=>{log.message(s,{...e,symbol:styleText2("red",S_ERROR)})}},cancel=(o="",t)=>{let i=t?.output??process.stdout,e=t?.withGuide??settings.withGuide?`${styleText2("gray",S_BAR_END)} `:"";i.write(`${e}${styleText2("red",o)}
45
-
46
- `)};var W$1=(o)=>o,C=(o,e,s)=>{let a={hard:!0,trim:!1},i=wrapAnsi(o,e,a).split(`
47
- `),c=i.reduce((n,t)=>Math.max(dist_default2(t),n),0),u=i.map(s).reduce((n,t)=>Math.max(dist_default2(t),n),0),g=e-(u-c);return wrapAnsi(o,g,a)},note=(o="",e="",s)=>{let a=s?.output??process$1.stdout,i=s?.withGuide??settings.withGuide,c=s?.format??W$1,g=["",...C(o,getColumns(a)-6,c).split(`
48
- `).map(c),""],n=dist_default2(e),t=Math.max(g.reduce((m,F)=>{let O=dist_default2(F);return O>m?O:m},0),n)+2,h=g.map((m)=>`${styleText2("gray",S_BAR)} ${m}${" ".repeat(t-dist_default2(m))}${styleText2("gray",S_BAR)}`).join(`
49
- `),T=i?`${styleText2("gray",S_BAR)}
50
- `:"",l$1=i?S_CONNECT_LEFT:S_CORNER_BOTTOM_LEFT;a.write(`${T}${styleText2("green",S_STEP_SUBMIT)} ${styleText2("reset",e)} ${styleText2("gray",S_BAR_H.repeat(Math.max(t-n-1,1))+S_CORNER_TOP_RIGHT)}
51
- ${h}
52
- ${styleText2("gray",l$1+S_BAR_H.repeat(t+2)+S_CORNER_BOTTOM_RIGHT)}
53
- `)},password=(r)=>new u$1({validate:r.validate,mask:r.mask??S_PASSWORD_MASK,signal:r.signal,input:r.input,output:r.output,render(){let e=r.withGuide??settings.withGuide,o=`${e?`${styleText2("gray",S_BAR)}
54
- `:""}${symbol(this.state)} ${r.message}
55
- `,c=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let s=e?`${styleText2("yellow",S_BAR)} `:"",n=e?`${styleText2("yellow",S_BAR_END)} `:"",l=i??"";return r.clearOnError&&this.clear(),`${o.trim()}
56
- ${s}${l}
57
- ${n}${styleText2("yellow",this.error)}
58
- `}case"submit":{let s=e?`${styleText2("gray",S_BAR)} `:"",n=i?styleText2("dim",i):"";return`${o}${s}${n}`}case"cancel":{let s=e?`${styleText2("gray",S_BAR)} `:"",n=i?styleText2(["strikethrough","dim"],i):"";return`${o}${s}${n}${i&&e?`
59
- ${styleText2("gray",S_BAR)}`:""}`}default:{let s=e?`${styleText2("cyan",S_BAR)} `:"",n=e?styleText2("cyan",S_BAR_END):"";return`${o}${s}${c}
60
- ${n}
61
- `}}}}).prompt();var W=(l)=>styleText2("magenta",l),spinner=({indicator:l="dots",onCancel:h,output:n=process.stdout,cancelMessage:G,errorMessage:O,frames:E=unicode?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:F=unicode?80:120,signal:m,...I}={})=>{let u=isCI(),M,T,d=!1,S=!1,s="",p,w=performance.now(),x=getColumns(n),k=I?.styleFrame??W,g=(e)=>{let r=e>1?O??settings.messages.error:G??settings.messages.cancel;S=e===1,d&&(a(r,e),S&&typeof h=="function"&&h())},f=()=>g(2),i=()=>g(1),A=()=>{process.on("uncaughtExceptionMonitor",f),process.on("unhandledRejection",f),process.on("SIGINT",i),process.on("SIGTERM",i),process.on("exit",g),m&&m.addEventListener("abort",i)},H=()=>{process.removeListener("uncaughtExceptionMonitor",f),process.removeListener("unhandledRejection",f),process.removeListener("SIGINT",i),process.removeListener("SIGTERM",i),process.removeListener("exit",g),m&&m.removeEventListener("abort",i)},y=()=>{if(p===void 0)return;u&&n.write(`
62
- `);let r=wrapAnsi(p,x,{hard:!0,trim:!1}).split(`
63
- `);r.length>1&&n.write(import_sisteransi2.cursor.up(r.length-1)),n.write(import_sisteransi2.cursor.to(0)),n.write(import_sisteransi2.erase.down())},C=(e)=>e.replace(/\.+$/,""),_=(e)=>{let r=(performance.now()-e)/1000,t=Math.floor(r/60),o=Math.floor(r%60);return t>0?`[${t}m ${o}s]`:`[${o}s]`},N=I.withGuide??settings.withGuide,P=(e="")=>{d=!0,M=block({output:n}),s=C(e),w=performance.now(),N&&n.write(`${styleText2("gray",S_BAR)}
64
- `);let r=0,t=0;A(),T=setInterval(()=>{if(u&&s===p)return;y(),p=s;let o=k(E[r]),v;if(u)v=`${o} ${s}...`;else if(l==="timer")v=`${o} ${s} ${_(w)}`;else{let B=".".repeat(Math.floor(t)).slice(0,3);v=`${o} ${s}${B}`}let j=wrapAnsi(v,x,{hard:!0,trim:!1});n.write(j),r=r+1<E.length?r+1:0,t=t<4?t+0.125:0},F)},a=(e="",r=0,t=!1)=>{if(!d)return;d=!1,clearInterval(T),y();let o=r===0?styleText2("green",S_STEP_SUBMIT):r===1?styleText2("red",S_STEP_CANCEL):styleText2("red",S_STEP_ERROR);s=e??s,t||(l==="timer"?n.write(`${o} ${s} ${_(w)}
65
- `):n.write(`${o} ${s}
66
- `)),H(),M()};return{start:P,stop:(e="")=>a(e,0),message:(e="")=>{s=C(e??s)},cancel:(e="")=>a(e,1),error:(e="")=>a(e,2),clear:()=>a("",0,!0),get isCancelled(){return S}}},u2={light:unicodeOr("\u2500","-"),heavy:unicodeOr("\u2501","="),block:unicodeOr("\u2588","#")};var SELECT_INSTRUCTIONS=[`${styleText2("dim","\u2191/\u2193")} to navigate`,`${styleText2("dim","Enter:")} confirm`],c=(t,o)=>t.includes(`
67
- `)?t.split(`
68
- `).map((d)=>o(d)).join(`
69
- `):o(t),select=(t)=>{let o=(n,m)=>{if(n===void 0)return"";let s=n.label??String(n.value);switch(m){case"disabled":return`${styleText2("gray",S_RADIO_INACTIVE)} ${c(s,(i)=>styleText2("gray",i))}${n.hint?` ${styleText2("dim",`(${n.hint??"disabled"})`)}`:""}`;case"selected":return`${c(s,(i)=>styleText2("dim",i))}`;case"active":return`${styleText2("green",S_RADIO_ACTIVE)} ${s}${n.hint?` ${styleText2("dim",`(${n.hint})`)}`:""}`;case"cancelled":return`${c(s,(i)=>styleText2(["strikethrough","dim"],i))}`;default:return`${styleText2("dim",S_RADIO_INACTIVE)} ${c(s,(i)=>styleText2("dim",i))}`}},d=t.showInstructions??!0;return new n$1({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){let n=t.withGuide??settings.withGuide,m=`${symbol(this.state)} `,s=`${symbolBar(this.state)} `,i=wrapTextWithPrefix(t.output,t.message,s,m),u=`${n?`${styleText2("gray",S_BAR)}
70
- `:""}${i}
71
- `;switch(this.state){case"submit":{let r=n?`${styleText2("gray",S_BAR)} `:"",a=wrapTextWithPrefix(t.output,o(this.options[this.cursor],"selected"),r);return`${u}${a}`}case"cancel":{let r=n?`${styleText2("gray",S_BAR)} `:"",a=wrapTextWithPrefix(t.output,o(this.options[this.cursor],"cancelled"),r);return`${u}${a}${n?`
72
- ${styleText2("gray",S_BAR)}`:""}`}default:{let r=n?`${styleText2("cyan",S_BAR)} `:"",a=u.split(`
73
- `).length,p=d?formatInstructionFooter(SELECT_INSTRUCTIONS,n):n?[styleText2("cyan",S_BAR_END)]:[],b=p.join(`
74
- `),f=p.length+1;return`${u}${r}${limitOptions({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:r.length,rowPadding:a+f,style:(g,x)=>o(g,g.disabled?"disabled":x?"active":"inactive")}).join(`
75
- ${r}`)}
76
- ${b}
77
- `}}}}).prompt()};var i=`${styleText2("gray",S_BAR)} `;var text=(e)=>new n({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let i=e?.withGuide??settings.withGuide,s=`${`${i?`${styleText2("gray",S_BAR)}
78
- `:""}${symbol(this.state)} `}${e.message}
79
- `,c=e.placeholder&&e.placeholder.length>0?styleText2("inverse",e.placeholder[0])+styleText2("dim",e.placeholder.slice(1)):styleText2(["inverse","hidden"],"_"),o=this.userInput?this.userInputWithCursor:c,l=this.value??"";switch(this.state){case"error":{let n=this.error?` ${styleText2("yellow",this.error)}`:"",r=i?`${styleText2("yellow",S_BAR)} `:"",d=i?styleText2("yellow",S_BAR_END):"";return`${s.trim()}
80
- ${r}${o}
81
- ${d}${n}
82
- `}case"submit":{let n=l?` ${styleText2("dim",l)}`:"",r=i?styleText2("gray",S_BAR):"";return`${s}${r}${n}`}case"cancel":{let n=l?` ${styleText2(["strikethrough","dim"],l)}`:"",r=i?styleText2("gray",S_BAR):"";return`${s}${r}${n}${l.trim()?`
83
- ${r}`:""}`}default:{let n=i?`${styleText2("cyan",S_BAR)} `:"",r=i?styleText2("cyan",S_BAR_END):"";return`${s}${n}${o}
84
- ${r}
85
- `}}}}).prompt();
86
- export{isCancel,confirm,multiselect,log,cancel,note,password,spinner,select,text};
package/chunk-8ztgcajz.js DELETED
@@ -1,8 +0,0 @@
1
- // @bun
2
- import{require_react_development}from"./chunk-xg49s85z.js";import{__toESM,__commonJS}from"./chunk-2smsg2ct.js";var require_react_jsx_runtime_development=__commonJS(function(exports){var React=__toESM(require_react_development());(function(){function getComponentNameFromType(type){if(type==null)return null;if(typeof type==="function")return type.$$typeof===REACT_CLIENT_REFERENCE?null:type.displayName||type.name||null;if(typeof type==="string")return type;switch(type){case REACT_FRAGMENT_TYPE:return"Fragment";case REACT_PROFILER_TYPE:return"Profiler";case REACT_STRICT_MODE_TYPE:return"StrictMode";case REACT_SUSPENSE_TYPE:return"Suspense";case REACT_SUSPENSE_LIST_TYPE:return"SuspenseList";case REACT_ACTIVITY_TYPE:return"Activity"}if(typeof type==="object")switch(typeof type.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),type.$$typeof){case REACT_PORTAL_TYPE:return"Portal";case REACT_CONTEXT_TYPE:return type.displayName||"Context";case REACT_CONSUMER_TYPE:return(type._context.displayName||"Context")+".Consumer";case REACT_FORWARD_REF_TYPE:var innerType=type.render;return type=type.displayName,type||(type=innerType.displayName||innerType.name||"",type=type!==""?"ForwardRef("+type+")":"ForwardRef"),type;case REACT_MEMO_TYPE:return innerType=type.displayName||null,innerType!==null?innerType:getComponentNameFromType(type.type)||"Memo";case REACT_LAZY_TYPE:innerType=type._payload,type=type._init;try{return getComponentNameFromType(type(innerType))}catch(x){}}return null}function testStringCoercion(value){return""+value}function checkKeyStringCoercion(value){try{testStringCoercion(value);var JSCompiler_inline_result=!1}catch(e){JSCompiler_inline_result=!0}if(JSCompiler_inline_result){JSCompiler_inline_result=console;var JSCompiler_temp_const=JSCompiler_inline_result.error,JSCompiler_inline_result$jscomp$0=typeof Symbol==="function"&&Symbol.toStringTag&&value[Symbol.toStringTag]||value.constructor.name||"Object";return JSCompiler_temp_const.call(JSCompiler_inline_result,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",JSCompiler_inline_result$jscomp$0),testStringCoercion(value)}}function getTaskName(type){if(type===REACT_FRAGMENT_TYPE)return"<>";if(typeof type==="object"&&type!==null&&type.$$typeof===REACT_LAZY_TYPE)return"<...>";try{var name=getComponentNameFromType(type);return name?"<"+name+">":"<...>"}catch(x){return"<...>"}}function getOwner(){var dispatcher=ReactSharedInternals.A;return dispatcher===null?null:dispatcher.getOwner()}function UnknownOwner(){return Error("react-stack-top-frame")}function hasValidKey(config){if(hasOwnProperty.call(config,"key")){var getter=Object.getOwnPropertyDescriptor(config,"key").get;if(getter&&getter.isReactWarning)return!1}return config.key!==void 0}function defineKeyPropWarningGetter(props,displayName){function warnAboutAccessingKey(){specialPropKeyWarningShown||(specialPropKeyWarningShown=!0,console.error("%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://react.dev/link/special-props)",displayName))}warnAboutAccessingKey.isReactWarning=!0,Object.defineProperty(props,"key",{get:warnAboutAccessingKey,configurable:!0})}function elementRefGetterWithDeprecationWarning(){var componentName=getComponentNameFromType(this.type);return didWarnAboutElementRef[componentName]||(didWarnAboutElementRef[componentName]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),componentName=this.props.ref,componentName!==void 0?componentName:null}function ReactElement(type,key,props,owner,debugStack,debugTask){var refProp=props.ref;return type={$$typeof:REACT_ELEMENT_TYPE,type,key,props,_owner:owner},(refProp!==void 0?refProp:null)!==null?Object.defineProperty(type,"ref",{enumerable:!1,get:elementRefGetterWithDeprecationWarning}):Object.defineProperty(type,"ref",{enumerable:!1,value:null}),type._store={},Object.defineProperty(type._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(type,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(type,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:debugStack}),Object.defineProperty(type,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:debugTask}),Object.freeze&&(Object.freeze(type.props),Object.freeze(type)),type}function jsxDEVImpl(type,config,maybeKey,isStaticChildren,debugStack,debugTask){var children=config.children;if(children!==void 0)if(isStaticChildren)if(isArrayImpl(children)){for(isStaticChildren=0;isStaticChildren<children.length;isStaticChildren++)validateChildKeys(children[isStaticChildren]);Object.freeze&&Object.freeze(children)}else console.error("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 validateChildKeys(children);if(hasOwnProperty.call(config,"key")){children=getComponentNameFromType(type);var keys=Object.keys(config).filter(function(k){return k!=="key"});isStaticChildren=0<keys.length?"{key: someKey, "+keys.join(": ..., ")+": ...}":"{key: someKey}",didWarnAboutKeySpread[children+isStaticChildren]||(keys=0<keys.length?"{"+keys.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
3
- let props = %s;
4
- <%s {...props} />
5
- React keys must be passed directly to JSX without using spread:
6
- let props = %s;
7
- <%s key={someKey} {...props} />`,isStaticChildren,children,keys,children),didWarnAboutKeySpread[children+isStaticChildren]=!0)}if(children=null,maybeKey!==void 0&&(checkKeyStringCoercion(maybeKey),children=""+maybeKey),hasValidKey(config)&&(checkKeyStringCoercion(config.key),children=""+config.key),"key"in config){maybeKey={};for(var propName in config)propName!=="key"&&(maybeKey[propName]=config[propName])}else maybeKey=config;return children&&defineKeyPropWarningGetter(maybeKey,typeof type==="function"?type.displayName||type.name||"Unknown":type),ReactElement(type,children,maybeKey,getOwner(),debugStack,debugTask)}function validateChildKeys(node){isValidElement(node)?node._store&&(node._store.validated=1):typeof node==="object"&&node!==null&&node.$$typeof===REACT_LAZY_TYPE&&(node._payload.status==="fulfilled"?isValidElement(node._payload.value)&&node._payload.value._store&&(node._payload.value._store.validated=1):node._store&&(node._store.validated=1))}function isValidElement(object){return typeof object==="object"&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE}var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_PORTAL_TYPE=Symbol.for("react.portal"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment"),REACT_STRICT_MODE_TYPE=Symbol.for("react.strict_mode"),REACT_PROFILER_TYPE=Symbol.for("react.profiler"),REACT_CONSUMER_TYPE=Symbol.for("react.consumer"),REACT_CONTEXT_TYPE=Symbol.for("react.context"),REACT_FORWARD_REF_TYPE=Symbol.for("react.forward_ref"),REACT_SUSPENSE_TYPE=Symbol.for("react.suspense"),REACT_SUSPENSE_LIST_TYPE=Symbol.for("react.suspense_list"),REACT_MEMO_TYPE=Symbol.for("react.memo"),REACT_LAZY_TYPE=Symbol.for("react.lazy"),REACT_ACTIVITY_TYPE=Symbol.for("react.activity"),REACT_CLIENT_REFERENCE=Symbol.for("react.client.reference"),ReactSharedInternals=React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,hasOwnProperty=Object.prototype.hasOwnProperty,isArrayImpl=Array.isArray,createTask=console.createTask?console.createTask:function(){return null};React={react_stack_bottom_frame:function(callStackForError){return callStackForError()}};var specialPropKeyWarningShown,didWarnAboutElementRef={},unknownOwnerDebugStack=React.react_stack_bottom_frame.bind(React,UnknownOwner)(),unknownOwnerDebugTask=createTask(getTaskName(UnknownOwner)),didWarnAboutKeySpread={};exports.Fragment=REACT_FRAGMENT_TYPE,exports.jsx=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!1,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)},exports.jsxs=function(type,config,maybeKey){var trackActualOwner=1e4>ReactSharedInternals.recentlyCreatedOwnerStacks++;return jsxDEVImpl(type,config,maybeKey,!0,trackActualOwner?Error("react-stack-top-frame"):unknownOwnerDebugStack,trackActualOwner?createTask(getTaskName(type)):unknownOwnerDebugTask)}})()});
8
- export{require_react_jsx_runtime_development};