velloo 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUN-LICENSE.md +91 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +288 -2
- package/THIRD-PARTY-NOTICES.md +467 -0
- package/assets/elsewhere-alps-9fqhv029.jpg +0 -0
- package/assets/elsewhere-bali-vp60g115.jpg +0 -0
- package/assets/elsewhere-forest-xgn23zrj.jpg +0 -0
- package/assets/elsewhere-japan-qs7qkbr2.jpg +0 -0
- package/assets/elsewhere-kyoto-map-n2bvkrya.svg +1 -0
- package/assets/elsewhere-kyoto-qemtn6nk.jpg +0 -0
- package/assets/elsewhere-room-g1gaw7cs.jpg +0 -0
- package/canvas/apple-touch-icon.png +0 -0
- package/canvas/assets/index-BCvDZiBo.css +2 -0
- package/canvas/assets/index-ClaBqcaS.js +28 -0
- package/canvas/assets/lucide-all-iIF-pmzN.js +1 -0
- package/canvas/assets/radix-C3HaOB-d.js +41 -0
- package/canvas/assets/react-D0Ec-185.js +9 -0
- package/canvas/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/canvas/assets/vendor-CKmQ-Zst.js +53 -0
- package/canvas/favicon.ico +0 -0
- package/canvas/favicon.svg +12 -0
- package/canvas/fonts/OFL-1.1.txt +93 -0
- package/canvas/fonts/poppins-700.woff2 +0 -0
- package/canvas/icon-192.png +0 -0
- package/canvas/icon-512.png +0 -0
- package/canvas/index.html +22 -0
- package/canvas/site.webmanifest +11 -0
- package/chunk-08sv3k41.js +4 -0
- package/chunk-0fe83yzt.js +2 -0
- package/chunk-0t68szgr.js +3 -0
- package/chunk-1h55s5he.js +2 -0
- package/chunk-2c7jbx46.js +2 -0
- package/chunk-2smsg2ct.js +7 -0
- package/chunk-308ynsxd.js +2 -0
- package/chunk-3e8vez4d.js +1229 -0
- package/chunk-40xgcth8.js +63 -0
- package/chunk-4dn75m6t.js +3 -0
- package/chunk-4fj5tahv.js +3 -0
- package/chunk-6nqghjda.js +3 -0
- package/chunk-6tx68d90.js +3 -0
- package/chunk-6w6ch4ce.js +2 -0
- package/chunk-735ezz23.js +86 -0
- package/chunk-7eq7nx37.js +7 -0
- package/chunk-7eyb8yrf.js +6 -0
- package/chunk-80fjfyha.js +86 -0
- package/chunk-80r93t2e.js +4 -0
- package/chunk-94vx1yb0.js +3 -0
- package/chunk-9vg3yafz.js +3 -0
- package/chunk-a84n72m2.js +4 -0
- package/chunk-ampmdzz4.js +10 -0
- package/chunk-avns4dbf.js +2 -0
- package/chunk-ayrb3qnm.js +3 -0
- package/chunk-bwnvcncx.js +3 -0
- package/chunk-ccszg02q.js +5 -0
- package/chunk-cvn689d5.js +3 -0
- package/chunk-cxe6jjwj.js +3 -0
- package/chunk-dg6z4vdd.js +3 -0
- package/chunk-dgwjpbp9.js +3 -0
- package/chunk-dy41n60j.js +52 -0
- package/chunk-ek71z2fv.js +226 -0
- package/chunk-er1fxb7d.js +2 -0
- package/chunk-eyr8hrzf.js +2 -0
- package/chunk-fjbzk4sw.js +3 -0
- package/chunk-fsbsksga.js +3 -0
- package/chunk-h6gchare.js +3 -0
- package/chunk-hcb68zt7.js +85 -0
- package/chunk-hggap8fq.js +3 -0
- package/chunk-j11fyeqh.js +2 -0
- package/chunk-jb21jkp1.js +8 -0
- package/chunk-jfx9xjmr.js +18 -0
- package/chunk-jr0ss0mm.js +303 -0
- package/chunk-jrsknzjt.js +3 -0
- package/chunk-jv0xggh0.js +2 -0
- package/chunk-k17gfwq3.js +2 -0
- package/chunk-mh2pr7cq.js +5 -0
- package/chunk-mnapdp1y.js +2 -0
- package/chunk-mzhdrawd.js +3 -0
- package/chunk-n9gs6yx9.js +2 -0
- package/chunk-ngnymg2q.js +3 -0
- package/chunk-nwx5700b.js +3 -0
- package/chunk-pjtg3wnm.js +4 -0
- package/chunk-pp86v6m6.js +3 -0
- package/chunk-r22epxz2.js +3 -0
- package/chunk-rgasy862.js +5 -0
- package/chunk-rpwpeph5.js +3 -0
- package/chunk-s23gtejf.js +3 -0
- package/chunk-sjgqnykd.js +6 -0
- package/chunk-sn3x2m0m.js +6 -0
- package/chunk-t448rrfr.js +2 -0
- package/chunk-tdsk5wxa.js +451 -0
- package/chunk-v40fn08f.js +442 -0
- package/chunk-vbk1qhdz.js +3 -0
- package/chunk-vdkrbzh1.js +2 -0
- package/chunk-vgmr98cv.js +40 -0
- package/chunk-vsv8z729.js +6 -0
- package/chunk-x4f4k9pp.js +26 -0
- package/chunk-xt5ayg7g.js +4 -0
- package/chunk-ydhwv29b.js +244 -0
- package/chunk-zb6hc1y0.js +2 -0
- package/cli.js +3 -0
- package/launcher.cjs +97 -0
- package/package.json +58 -5
- package/pkgs/helpers/src/box.tsx +21 -0
- package/pkgs/helpers/src/cn.ts +32 -0
- package/pkgs/helpers/src/descriptors.ts +270 -0
- package/pkgs/helpers/src/divider.tsx +123 -0
- package/pkgs/helpers/src/gradient.tsx +90 -0
- package/pkgs/helpers/src/heading.tsx +20 -0
- package/pkgs/helpers/src/icon-data.ts +8009 -0
- package/pkgs/helpers/src/icon.tsx +53 -0
- package/pkgs/helpers/src/image.tsx +111 -0
- package/pkgs/helpers/src/index.ts +29 -0
- package/pkgs/helpers/src/layer.tsx +61 -0
- package/pkgs/helpers/src/lowering.ts +53 -0
- package/pkgs/helpers/src/paths.ts +47 -0
- package/pkgs/helpers/src/placeholder.tsx +88 -0
- package/pkgs/helpers/src/prose.tsx +42 -0
- package/pkgs/helpers/src/registry.ts +41 -0
- package/pkgs/helpers/src/svg.tsx +62 -0
- package/pkgs/helpers/src/text.tsx +16 -0
- package/pkgs/provider-antd/src/index.ts +78 -0
- package/pkgs/provider-antd/src/intro.ts +14 -0
- package/pkgs/provider-antd/src/manifest.ts +439 -0
- package/pkgs/provider-antd/src/overlays.ts +176 -0
- package/pkgs/provider-antd/src/registry.ts +104 -0
- package/pkgs/provider-antd/src/render-pass.ts +43 -0
- package/pkgs/provider-antd/src/tailwind-entry.css +21 -0
- package/pkgs/provider-antd/src/theme.ts +132 -0
- package/pkgs/provider-antd/src/version.ts +8 -0
- package/pkgs/provider-chakra/src/index.ts +80 -0
- package/pkgs/provider-chakra/src/intro.ts +14 -0
- package/pkgs/provider-chakra/src/manifest.ts +421 -0
- package/pkgs/provider-chakra/src/overlays.ts +246 -0
- package/pkgs/provider-chakra/src/registry.ts +227 -0
- package/pkgs/provider-chakra/src/render-pass.ts +55 -0
- package/pkgs/provider-chakra/src/tailwind-entry.css +21 -0
- package/pkgs/provider-chakra/src/theme.ts +180 -0
- package/pkgs/provider-chakra/src/version.ts +8 -0
- package/pkgs/provider-mui/src/index.ts +117 -0
- package/pkgs/provider-mui/src/intro.ts +12 -0
- package/pkgs/provider-mui/src/manifest.ts +263 -0
- package/pkgs/provider-mui/src/overlays.ts +124 -0
- package/pkgs/provider-mui/src/registry.ts +120 -0
- package/pkgs/provider-mui/src/render-pass.ts +36 -0
- package/pkgs/provider-mui/src/tailwind-entry.css +21 -0
- package/pkgs/provider-mui/src/theme.ts +129 -0
- package/pkgs/provider-mui/src/version.ts +8 -0
- package/pkgs/provider-none/src/components-inline.tsx +204 -0
- package/pkgs/provider-none/src/components.tsx +155 -0
- package/pkgs/provider-none/src/index.ts +57 -0
- package/pkgs/provider-none/src/intro.ts +18 -0
- package/pkgs/provider-none/src/manifest.ts +163 -0
- package/pkgs/provider-none/src/registry-inline.ts +36 -0
- package/pkgs/provider-none/src/registry.ts +39 -0
- package/pkgs/provider-none/src/tailwind-entry.css +57 -0
- package/pkgs/provider-none/src/version.ts +10 -0
- package/pkgs/schema/src/annotation.ts +120 -0
- package/pkgs/schema/src/asset.ts +66 -0
- package/pkgs/schema/src/board.ts +71 -0
- package/pkgs/schema/src/comment.ts +107 -0
- package/pkgs/schema/src/config.ts +185 -0
- package/pkgs/schema/src/css-sanitize.ts +56 -0
- package/pkgs/schema/src/extension.ts +105 -0
- package/pkgs/schema/src/fonts.ts +690 -0
- package/pkgs/schema/src/frame.ts +40 -0
- package/pkgs/schema/src/icon-name.ts +21 -0
- package/pkgs/schema/src/ids.ts +14 -0
- package/pkgs/schema/src/index.ts +169 -0
- package/pkgs/schema/src/migrate.ts +297 -0
- package/pkgs/schema/src/node.ts +229 -0
- package/pkgs/schema/src/paths.ts +28 -0
- package/pkgs/schema/src/repo.ts +134 -0
- package/pkgs/schema/src/screen.ts +30 -0
- package/pkgs/schema/src/snippet-resolve.ts +193 -0
- package/pkgs/schema/src/snippet.ts +104 -0
- package/pkgs/schema/src/svg-sanitize.ts +487 -0
- package/pkgs/schema/src/theme.ts +218 -0
- package/pkgs/schema/src/typeset.ts +693 -0
- package/pkgs/schema/src/validate-ids.ts +46 -0
- package/pkgs/schema/src/viewport.ts +8 -0
- package/pkgs/shadcn-snapshot/dist/manifest.json +8109 -0
- package/pkgs/shadcn-snapshot/src/components/canvas-portal.tsx +55 -0
- package/pkgs/shadcn-snapshot/src/components/ui/accordion.tsx +122 -0
- package/pkgs/shadcn-snapshot/src/components/ui/alert-dialog.tsx +164 -0
- package/pkgs/shadcn-snapshot/src/components/ui/alert.tsx +74 -0
- package/pkgs/shadcn-snapshot/src/components/ui/aspect-ratio.tsx +13 -0
- package/pkgs/shadcn-snapshot/src/components/ui/attachment.tsx +197 -0
- package/pkgs/shadcn-snapshot/src/components/ui/avatar.tsx +100 -0
- package/pkgs/shadcn-snapshot/src/components/ui/badge.tsx +50 -0
- package/pkgs/shadcn-snapshot/src/components/ui/breadcrumb.tsx +109 -0
- package/pkgs/shadcn-snapshot/src/components/ui/bubble.tsx +130 -0
- package/pkgs/shadcn-snapshot/src/components/ui/button-group.tsx +82 -0
- package/pkgs/shadcn-snapshot/src/components/ui/button.tsx +72 -0
- package/pkgs/shadcn-snapshot/src/components/ui/calendar.tsx +229 -0
- package/pkgs/shadcn-snapshot/src/components/ui/card.tsx +92 -0
- package/pkgs/shadcn-snapshot/src/components/ui/carousel.tsx +235 -0
- package/pkgs/shadcn-snapshot/src/components/ui/chart-option.ts +250 -0
- package/pkgs/shadcn-snapshot/src/components/ui/chart.tsx +177 -0
- package/pkgs/shadcn-snapshot/src/components/ui/checkbox.tsx +41 -0
- package/pkgs/shadcn-snapshot/src/components/ui/collapsible.tsx +32 -0
- package/pkgs/shadcn-snapshot/src/components/ui/combobox.tsx +196 -0
- package/pkgs/shadcn-snapshot/src/components/ui/context-menu.tsx +227 -0
- package/pkgs/shadcn-snapshot/src/components/ui/dialog.tsx +131 -0
- package/pkgs/shadcn-snapshot/src/components/ui/direction.tsx +24 -0
- package/pkgs/shadcn-snapshot/src/components/ui/drawer.tsx +112 -0
- package/pkgs/shadcn-snapshot/src/components/ui/dropdown-menu.tsx +205 -0
- package/pkgs/shadcn-snapshot/src/components/ui/empty.tsx +98 -0
- package/pkgs/shadcn-snapshot/src/components/ui/field.tsx +228 -0
- package/pkgs/shadcn-snapshot/src/components/ui/hover-card.tsx +51 -0
- package/pkgs/shadcn-snapshot/src/components/ui/input-group.tsx +148 -0
- package/pkgs/shadcn-snapshot/src/components/ui/input.tsx +43 -0
- package/pkgs/shadcn-snapshot/src/components/ui/item.tsx +187 -0
- package/pkgs/shadcn-snapshot/src/components/ui/kbd.tsx +30 -0
- package/pkgs/shadcn-snapshot/src/components/ui/label.tsx +25 -0
- package/pkgs/shadcn-snapshot/src/components/ui/marker.tsx +71 -0
- package/pkgs/shadcn-snapshot/src/components/ui/menubar.tsx +243 -0
- package/pkgs/shadcn-snapshot/src/components/ui/message.tsx +89 -0
- package/pkgs/shadcn-snapshot/src/components/ui/native-select.tsx +60 -0
- package/pkgs/shadcn-snapshot/src/components/ui/navigation-menu.tsx +165 -0
- package/pkgs/shadcn-snapshot/src/components/ui/pagination.tsx +117 -0
- package/pkgs/shadcn-snapshot/src/components/ui/popover.tsx +66 -0
- package/pkgs/shadcn-snapshot/src/components/ui/progress.tsx +35 -0
- package/pkgs/shadcn-snapshot/src/components/ui/radio-group.tsx +48 -0
- package/pkgs/shadcn-snapshot/src/components/ui/scroll-area.tsx +59 -0
- package/pkgs/shadcn-snapshot/src/components/ui/select.tsx +180 -0
- package/pkgs/shadcn-snapshot/src/components/ui/separator.tsx +32 -0
- package/pkgs/shadcn-snapshot/src/components/ui/sheet.tsx +107 -0
- package/pkgs/shadcn-snapshot/src/components/ui/skeleton.tsx +17 -0
- package/pkgs/shadcn-snapshot/src/components/ui/slider.tsx +68 -0
- package/pkgs/shadcn-snapshot/src/components/ui/sonner.tsx +91 -0
- package/pkgs/shadcn-snapshot/src/components/ui/spinner.tsx +21 -0
- package/pkgs/shadcn-snapshot/src/components/ui/switch.tsx +41 -0
- package/pkgs/shadcn-snapshot/src/components/ui/table.tsx +93 -0
- package/pkgs/shadcn-snapshot/src/components/ui/tabs.tsx +84 -0
- package/pkgs/shadcn-snapshot/src/components/ui/textarea.tsx +24 -0
- package/pkgs/shadcn-snapshot/src/components/ui/toggle-group.tsx +94 -0
- package/pkgs/shadcn-snapshot/src/components/ui/toggle.tsx +50 -0
- package/pkgs/shadcn-snapshot/src/components/ui/tooltip.tsx +47 -0
- package/pkgs/shadcn-snapshot/src/examples.ts +36 -0
- package/pkgs/shadcn-snapshot/src/groups.ts +87 -0
- package/pkgs/shadcn-snapshot/src/index.ts +43 -0
- package/pkgs/shadcn-snapshot/src/lib/utils.ts +4 -0
- package/pkgs/shadcn-snapshot/src/manifest.ts +12 -0
- package/pkgs/shadcn-snapshot/src/notes.ts +97 -0
- package/pkgs/shadcn-snapshot/src/paths.ts +47 -0
- package/pkgs/shadcn-snapshot/src/registry-files.ts +293 -0
- package/pkgs/shadcn-snapshot/src/registry.ts +631 -0
- package/pkgs/shadcn-snapshot/src/shadcn-tailwind.css +632 -0
- package/pkgs/shadcn-snapshot/src/tailwind-entry.css +159 -0
- package/pkgs/shadcn-snapshot/src/version.ts +8 -0
- package/plugins/claude/velloo/.claude-plugin/plugin.json +6 -0
- package/plugins/claude/velloo/agents/velloo-design-reviewer.md +33 -0
- package/plugins/claude/velloo/agents/velloo-designer.md +39 -0
- package/plugins/claude/velloo/commands/design.md +11 -0
- package/plugins/claude/velloo/commands/implement.md +10 -0
- package/plugins/claude/velloo/commands/review.md +8 -0
- package/plugins/gemini/GEMINI.md +31 -0
- package/plugins/gemini/commands/velloo/design.toml +10 -0
- package/plugins/gemini/commands/velloo/implement.toml +9 -0
- package/plugins/gemini/gemini-extension.json +9 -0
- package/skills/velloo-brand/SKILL.md +124 -0
- package/skills/velloo-design/SKILL.md +144 -0
- package/skills/velloo-design-system/SKILL.md +90 -0
- package/skills/velloo-implement/SKILL.md +101 -0
- package/skills/velloo-logo/SKILL.md +93 -0
- package/skills/velloo-setup/SKILL.md +156 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{COMMANDS}from"./chunk-4fj5tahv.js";var SHELLS=["zsh","bash","fish"],zshName=(name)=>name.replace(/\\/g,"\\\\").replace(/:/g,"\\:");function zshArguments(c,indent){let flagSpecs=c.flags.map((f)=>`${indent} '${f.flag}${f.takesValue?"=":""}[${f.description}]'`).join(" \\\n");return flagSpecs?`${indent}_arguments \\
|
|
3
|
+
${flagSpecs} \\
|
|
4
|
+
${indent} '*:file:_files'`:`${indent}_files`}function zshScript(specs){let commandLines=specs.map((c)=>` '${zshName(c.name)}:${c.description}'`).join(`
|
|
5
|
+
`),cases=specs.map((c)=>{if(c.subcommands.length===0)return` ${c.name})
|
|
6
|
+
${zshArguments(c," ")}
|
|
7
|
+
;;`;let subLines=c.subcommands.map((sub)=>` '${zshName(sub.name)}:${sub.description}'`).join(`
|
|
8
|
+
`),subCases=c.subcommands.map((sub)=>` ${sub.name})
|
|
9
|
+
${zshArguments(sub," ")}
|
|
10
|
+
;;`).join(`
|
|
11
|
+
`),own=c.flags.length>0?`
|
|
12
|
+
${zshArguments(c," ")}`:"",fallback=c.flags.length>0?`
|
|
13
|
+
*)
|
|
14
|
+
${zshArguments(c," ")}
|
|
15
|
+
;;`:"";return` ${c.name})
|
|
16
|
+
if (( CURRENT == 3 )); then
|
|
17
|
+
local -a _velloo_subcommands
|
|
18
|
+
_velloo_subcommands=(
|
|
19
|
+
${subLines}
|
|
20
|
+
)
|
|
21
|
+
_describe 'velloo ${c.name} command' _velloo_subcommands${own}
|
|
22
|
+
return
|
|
23
|
+
fi
|
|
24
|
+
case $words[3] in
|
|
25
|
+
${subCases}${fallback}
|
|
26
|
+
esac
|
|
27
|
+
;;`}).join(`
|
|
28
|
+
`);return`#compdef velloo
|
|
29
|
+
# velloo shell completions (zsh) \u2014 generated by \`velloo completions\`.
|
|
30
|
+
_velloo() {
|
|
31
|
+
local -a _velloo_commands
|
|
32
|
+
_velloo_commands=(
|
|
33
|
+
${commandLines}
|
|
34
|
+
)
|
|
35
|
+
if (( CURRENT == 2 )); then
|
|
36
|
+
_describe 'velloo command' _velloo_commands
|
|
37
|
+
return
|
|
38
|
+
fi
|
|
39
|
+
case $words[2] in
|
|
40
|
+
${cases}
|
|
41
|
+
esac
|
|
42
|
+
}
|
|
43
|
+
if ! (( $+functions[compdef] )); then
|
|
44
|
+
autoload -Uz compinit && compinit -i
|
|
45
|
+
fi
|
|
46
|
+
compdef _velloo velloo
|
|
47
|
+
`}var flagWords=(c)=>c.flags.map((f)=>f.flag).join(" ");function bashScript(specs){let names=specs.map((c)=>c.name).join(" "),cases=specs.map((c)=>{if(c.subcommands.length===0)return` ${c.name}) flags="${flagWords(c)}" ;;`;let subCases=c.subcommands.map((sub)=>` ${sub.name}) flags="${flagWords(sub)}" ;;`).join(`
|
|
48
|
+
`);return` ${c.name})
|
|
49
|
+
subs="${c.subcommands.map((sub)=>sub.name).join(" ")}"
|
|
50
|
+
case "$sub" in
|
|
51
|
+
${subCases}
|
|
52
|
+
*) flags="${flagWords(c)}" ;;
|
|
53
|
+
esac
|
|
54
|
+
;;`}).join(`
|
|
55
|
+
`);return`# velloo shell completions (bash) \u2014 generated by \`velloo completions\`.
|
|
56
|
+
_velloo() {
|
|
57
|
+
local cur cmd sub subs flags
|
|
58
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
59
|
+
cmd="\${COMP_WORDS[1]}"
|
|
60
|
+
sub="\${COMP_WORDS[2]}"
|
|
61
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
62
|
+
COMPREPLY=( $(compgen -W "${names}" -- "$cur") )
|
|
63
|
+
return
|
|
64
|
+
fi
|
|
65
|
+
subs=""
|
|
66
|
+
flags=""
|
|
67
|
+
case "$cmd" in
|
|
68
|
+
${cases}
|
|
69
|
+
esac
|
|
70
|
+
if [[ $COMP_CWORD -eq 2 && -n "$subs" && "$cur" != -* ]]; then
|
|
71
|
+
COMPREPLY=( $(compgen -W "$subs" -- "$cur") )
|
|
72
|
+
return
|
|
73
|
+
fi
|
|
74
|
+
if [[ "$cur" == -* && -n "$flags" ]]; then
|
|
75
|
+
COMPREPLY=( $(compgen -W "$flags" -- "$cur") )
|
|
76
|
+
fi
|
|
77
|
+
}
|
|
78
|
+
complete -o default -F _velloo velloo
|
|
79
|
+
`}function fishFlags(c,condition){return c.flags.map((f)=>{let long=f.flag.replace(/^--/,"");return`complete -c velloo -n "${condition}" -l ${long}${f.takesValue?" -r":""} -d "${f.description}"`})}function fishScript(specs){let lines=["# velloo shell completions (fish) \u2014 generated by `velloo completions`.","function __velloo_is"," set -l words"," for token in (commandline -opc)[2..-1]"," string match -q -- '-*' $token; or set -a words $token"," end",' test "$words[1]" = "$argv[1]"; or return 1'," test (count $argv) -lt 2; and return 0",' test "$words[2]" = "$argv[2]"',"end","function __velloo_words"," set -l words"," for token in (commandline -opc)[2..-1]"," string match -q -- '-*' $token; or set -a words $token"," end"," count $words","end"];for(let c of specs){if(lines.push(`complete -c velloo -f -n "__fish_use_subcommand" -a "${c.name}" -d "${c.description}"`),c.subcommands.length===0){lines.push(...fishFlags(c,`__velloo_is ${c.name}`));continue}for(let sub of c.subcommands)lines.push(`complete -c velloo -f -n "__velloo_is ${c.name}; and test (__velloo_words) -eq 1" -a "${sub.name}" -d "${sub.description}"`),lines.push(...fishFlags(sub,`__velloo_is ${c.name} ${sub.name}`));let notSub=c.subcommands.map((sub)=>`; and not __velloo_is ${c.name} ${sub.name}`).join("");lines.push(...fishFlags(c,`__velloo_is ${c.name}${notSub}`))}return`${lines.join(`
|
|
80
|
+
`)}
|
|
81
|
+
`}function completionScript(shell,specs){switch(shell){case"zsh":return zshScript(specs);case"bash":return bashScript(specs);case"fish":return fishScript(specs)}}async function resolvable(value){return typeof value==="function"?await value():value}var kebab=(name)=>name.replace(/[A-Z]/g,(c)=>`-${c.toLowerCase()}`);function sanitize(desc){return(desc??"").split(`
|
|
82
|
+
`)[0]?.replace(/['"[\]:`$\\]/g,"").trim()??""}function flagSpecs(args){let flags=[];for(let[argName,def]of Object.entries(args)){if(def.type==="positional")continue;let isBool=def.type==="boolean",negated=isBool&&def.default===!0;flags.push({flag:negated?`--no-${kebab(argName)}`:`--${kebab(argName)}`,description:sanitize(def.description),takesValue:!isBool})}return flags}async function commandSpec(name,load,depth){let cmd,meta,args;try{cmd=await resolvable(load),meta=cmd.meta?await resolvable(cmd.meta):void 0,args=cmd.args?await resolvable(cmd.args):{}}catch{return null}if(meta?.hidden)return null;let subcommands=[];if(depth===0&&cmd.subCommands)for(let[child,loadChild]of Object.entries(await resolvable(cmd.subCommands))){let spec=await commandSpec(child,loadChild,depth+1);if(spec)subcommands.push(spec)}return{name,description:sanitize(meta?.description),flags:flagSpecs(args),subcommands}}async function commandSpecs(){let out=[];for(let[name,load]of Object.entries(COMMANDS)){if(name.startsWith("__"))continue;let spec=await commandSpec(name,load,0);if(spec)out.push(spec)}return out}import{existsSync}from"fs";import{appendFile,mkdir,readFile,writeFile}from"fs/promises";import{homedir}from"os";import{basename,dirname,join}from"path";function detectShell(env=process.env){let name=basename(env.SHELL??"");return SHELLS.includes(name)?name:null}var RC_MARKER="# velloo completions";function targets(shell,homeDir){switch(shell){case"zsh":return{scriptPath:join(homeDir,".velloo","completions","velloo.zsh"),rcPath:join(homeDir,".zshrc")};case"bash":return{scriptPath:join(homeDir,".velloo","completions","velloo.bash"),rcPath:join(homeDir,".bashrc")};case"fish":return{scriptPath:join(homeDir,".config","fish","completions","velloo.fish")}}}function completionsInstalled(homeDir=homedir(),shell){return(shell?[shell]:SHELLS).some((s)=>existsSync(targets(s,homeDir).scriptPath))}async function installCompletions(shell,homeDir=homedir()){let{scriptPath,rcPath}=targets(shell,homeDir),script=completionScript(shell,await commandSpecs());await mkdir(dirname(scriptPath),{recursive:!0}),await writeFile(scriptPath,script);let rcUpdated=!1;if(rcPath){let rc=await readFile(rcPath,"utf8").catch(()=>"");if(!rc.includes(RC_MARKER)){let rel=scriptPath.slice(homeDir.length+1),line=`[ -f "$HOME/${rel}" ] && source "$HOME/${rel}" ${RC_MARKER}`;await appendFile(rcPath,`${rc.endsWith(`
|
|
83
|
+
`)||rc===""?"":`
|
|
84
|
+
`}${line}
|
|
85
|
+
`),rcUpdated=!0}}return{shell,scriptPath,rcPath,rcUpdated}}
|
|
86
|
+
export{SHELLS,completionScript,commandSpecs,detectShell,completionsInstalled,installCompletions};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{normalizeRepoManifest,CURRENT_SCHEMA_VERSION,schemaVersionOf,planMigration}from"./chunk-40xgcth8.js";import{localDesignOf,findOwningManifest,recordedDesignName,loadDesignFolder}from"./chunk-tdsk5wxa.js";import{TOOL_VERSION}from"./chunk-dg6z4vdd.js";import{existsSync,realpathSync}from"fs";import{readdir,readFile,writeFile}from"fs/promises";import{join,resolve}from"path";function isObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}var isAnnotationSidecar=(file)=>file.endsWith(".annotations.json"),isThemeDocument=(file)=>file.endsWith(".json");async function planRewrites(folder,dir,matches,transform){let files=[];try{files=await readdir(join(folder,dir))}catch{return[]}let out=[];for(let file of files.sort()){if(!matches(file))continue;let rel=join(dir,file),prev=await readFile(join(folder,rel),"utf8"),next=`${JSON.stringify(transform(JSON.parse(prev)),null,2)}
|
|
3
|
+
`;if(next!==prev)out.push({rel,next})}return out}async function upgradeFolder(folder,opts={}){let configPath=join(folder,".design","config.json"),rawConfig=JSON.parse(await readFile(configPath,"utf8")),from=schemaVersionOf(rawConfig),manifest=await findOwningManifest(folder).catch(()=>null),run=planMigration(rawConfig,{name:legacyNameOf(folder,manifest)}),manifestFiles=manifest?.legacy?[manifest.path]:[];if(run.applied.length===0){if(manifest?.legacy&&!opts.dryRun)await migrateManifest(manifest);return{from,to:CURRENT_SCHEMA_VERSION,applied:[],changedFiles:manifestFiles}}let rewrites=[...await planRewrites(folder,"screens",isAnnotationSidecar,(parsed)=>Array.isArray(parsed)?parsed.map((e)=>typeof e==="object"&&e!==null?run.annotation(e):e):parsed),...await planRewrites(folder,"theme",isThemeDocument,(parsed)=>isObject(parsed)?run.theme(parsed):parsed)],nextConfig={...run.config,toolVersion:TOOL_VERSION},changedFiles=[join(".design","config.json"),...rewrites.map((r)=>r.rel),...manifestFiles];if(opts.dryRun)return{from,to:CURRENT_SCHEMA_VERSION,applied:run.applied,changedFiles};await writeFile(configPath,`${JSON.stringify(nextConfig,null,2)}
|
|
4
|
+
`,"utf8");for(let r of rewrites)await writeFile(join(folder,r.rel),r.next,"utf8");if(manifest?.legacy)await migrateManifest(manifest);return await loadDesignFolder(folder),{from,to:CURRENT_SCHEMA_VERSION,applied:run.applied,changedFiles}}function legacyNameOf(folder,manifest){let local=localDesignOf(folder);if(local)return local.legacyName;let target=realOr(folder);for(let[path,name]of manifest?.legacyNames??[])if(realOr(path)===target)return name;return}function realOr(path){return existsSync(path)?realpathSync(path):resolve(path)}async function migrateManifest(manifest){for(let[path,name]of manifest.legacyNames){if(recordedDesignName(path))continue;let configPath=join(path,".design","config.json"),raw;try{raw=JSON.parse(await readFile(configPath,"utf8"))}catch{continue}if(isObject(raw))await writeFile(configPath,`${JSON.stringify({...raw,name},null,2)}
|
|
5
|
+
`)}let raw=JSON.parse(await readFile(manifest.path,"utf8"));await writeFile(manifest.path,`${JSON.stringify(normalizeRepoManifest(raw).manifest,null,2)}
|
|
6
|
+
`)}
|
|
7
|
+
export{upgradeFolder};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{isCancel,confirm,select}from"./chunk-80fjfyha.js";import{designNameIssue}from"./chunk-40xgcth8.js";import{managedDesignId,localDesignOf,removeLocalDesign,recordedDesignName,designRenameConflict,followDesignRename,loadDesignFolder}from"./chunk-tdsk5wxa.js";import"./chunk-t448rrfr.js";import"./chunk-3e8vez4d.js";import{agentRootCandidates}from"./chunk-vgmr98cv.js";import"./chunk-dg6z4vdd.js";import{daemonRoot,readLock,isLive,stopDaemon}from"./chunk-sjgqnykd.js";import{fail}from"./chunk-s23gtejf.js";import"./chunk-08sv3k41.js";import"./chunk-4fj5tahv.js";import"./chunk-cvn689d5.js";import{displayPath}from"./chunk-dy41n60j.js";import"./chunk-xt5ayg7g.js";import{recordedAppRoot,planAppRootChange,applyAppRootChange,promptAppRootChoice,planRelocation,relocateDesign,runInit2}from"./chunk-x4f4k9pp.js";import"./chunk-80r93t2e.js";import{repinAgentConfigs,migrateFolder2}from"./chunk-4dn75m6t.js";import"./chunk-pjtg3wnm.js";import"./chunk-fsbsksga.js";import"./chunk-7eq7nx37.js";import{findManifest,manifestListing,findDesigns,unregisterDesign,isWithin,writeDesignName,registerLocalDesign,DESIGN_ARG_DESCRIPTION,hasDesignConfig,DESIGN_ID_ARG,resolveDesign,checkoutDesigns}from"./chunk-vsv8z729.js";import"./chunk-bwnvcncx.js";import"./chunk-735ezz23.js";import"./chunk-pp86v6m6.js";import{require_picocolors}from"./chunk-jrsknzjt.js";import{__toESM,defineCommand}from"./chunk-2smsg2ct.js";import{randomUUID}from"crypto";import{existsSync,realpathSync}from"fs";import{readdir,rm}from"fs/promises";import{join,relative,resolve}from"path";var import_picocolors=__toESM(require_picocolors(),1);async function countJson(dir,skipSuffix){try{return(await readdir(dir)).filter((f)=>f.endsWith(".json")&&!(skipSuffix&&f.endsWith(skipSuffix))).length}catch{return 0}}async function daemonState(folder){let rec=await readLock(daemonRoot(folder));if(!rec)return"stopped";return await isLive(rec)?`running :${rec.canvasPort}`:"stopped"}var list=defineCommand({meta:{name:"list",description:"List the repo's designs"},async run(){let cwd=resolve("."),found=await findDesigns(cwd).catch((err)=>{fail("design list",err.message)});if(!found||found.designs.length===0){let only=await resolveDesign(void 0,"design list",{requireConfig:!0,cwd,takesDesign:!1,onFail:(message)=>fail("design list",message)}),name=recordedDesignName(only)??"(unnamed)",owner=await manifestListing(only).catch(()=>null);if(owner&&owner.dir!==cwd){console.log(`velloo design: "${name}" (${relative(cwd,only)||only}) is listed in \`${relative(cwd,owner.path)}\`. Run \`velloo design list\` from \`${relative(cwd,owner.dir)||"."}\` to see that project's designs.`);return}console.log("velloo design: 1 design (no velloo.json yet)"),console.log(` ${import_picocolors.default.dim("1")} ${import_picocolors.default.bold(name)} ${relative(cwd,only)||only} ${await daemonState(only)}`),console.log(import_picocolors.default.dim(" `velloo design add` creates a second design and lists both."));return}let base=found.repo?.dir??found.local[0]?.root??cwd,rows=[];for(let design of found.designs){let live=design.exists&&!design.outsideRepo;rows.push({name:found.conflicts.has(design.name)?`${design.name} (duplicate)`:design.name,path:design.local?`${displayPath(design.root)} (local)`:relative(base,design.root)||".",boards:live?await countJson(join(design.root,"boards"),".notes.json"):0,state:design.outsideRepo?import_picocolors.default.yellow("outside the repo"):live?await daemonState(design.root):import_picocolors.default.yellow("missing"),live})}let pad=(text,width)=>text+" ".repeat(Math.max(0,width-Bun.stringWidth(text))),width=Math.max(...rows.map((r)=>Bun.stringWidth(r.name))),pathWidth=Math.max(...rows.map((r)=>Bun.stringWidth(r.path))),idWidth=String(rows.length).length;console.log(`velloo design: ${rows.length} in ${base}`);for(let[index,row]of rows.entries()){let marker=row.name===found.defaultDesign?import_picocolors.default.cyan("\u25CF"):" ",id=import_picocolors.default.dim(String(index+1).padStart(idWidth)),boards=row.live?`${row.boards} board${row.boards===1?"":"s"}`:"\u2014";console.log(` ${id} ${marker} ${import_picocolors.default.bold(pad(row.name,width))} ${import_picocolors.default.dim(pad(row.path,pathWidth))} ${boards.padEnd(9)} ${row.state}`)}console.log(import_picocolors.default.dim(" Pass a number as --id to the other `velloo design` commands."));for(let[name,designs]of found.conflicts)console.log(import_picocolors.default.yellow(` ! ${designs.length} designs are named "${name}" \u2014 rename one with \`velloo design rename <path> <new-name>\`.`))}}),add=defineCommand({meta:{name:"add",description:"Create another design in this repo (the init wizard, folder pre-chosen)"},args:{path:{type:"positional",required:!1,description:"Where the new design folder goes, relative to the repo (asked when omitted)"},external:{type:"boolean",description:"Create in Velloo-managed external storage"},nonInteractive:{type:"boolean",description:"Use defaults without prompting"},connect:{type:"boolean",default:!0,description:"Wire project agents"},library:{type:"string",description:"Component library (default: the sibling folder's)"},name:{type:"string",description:"The design's name (default: derived from its folder)"}},async run({args}){await runInit2({addFolder:!0,external:args.external,nonInteractive:args.nonInteractive,connect:args.connect,...args.path?{designFolder:args.path}:{},...args.library?{library:args.library}:{},...args.name?{name:args.name}:{}})}}),remove=defineCommand({meta:{name:"remove",description:"Remove a design \u2014 one outside the repo can keep its files (asked, or --delete-content)"},args:{design:{type:"positional",required:!1,description:DESIGN_ARG_DESCRIPTION},id:DESIGN_ID_ARG,deleteContent:{type:"boolean",description:"Also delete the files of a design outside the repo (with --yes, or to skip the question)"},yes:{type:"boolean",description:"Skip the confirmation (required without an interactive terminal)"}},async run({args}){let cwd=resolve("."),folder=await resolveDesign(args.design,"design remove",{id:args.id,interactive:!0,requireConfig:!0,cwd}),local=localDesignOf(folder);if(!Boolean(process.stdin.isTTY)&&args.yes!==!0)fail("design remove","refusing to delete a design folder without --yes");let boards=await countJson(join(folder,"boards"),".notes.json"),screens=await countJson(join(folder,"screens"),".annotations.json"),name=recordedDesignName(folder)??folder;console.log(`velloo design: ${name} (${folder})`),console.log(import_picocolors.default.dim(` ${boards} board${boards===1?"":"s"}, ${screens} screen${screens===1?"":"s"}`));let keepContent=local!==null&&args.deleteContent!==!0;if(args.yes!==!0)if(local&&args.deleteContent!==!0){let managed=managedDesignId(folder)!==null,choice=await select({message:"Remove this design?",initialValue:managed?"delete":"keep",options:[{value:"delete",label:"Delete it and its files",hint:managed?"in Velloo's storage":folder},{value:"keep",label:"Forget it, keep the files",hint:folder},{value:"cancel",label:"Cancel"}]});if(isCancel(choice)||choice==="cancel"){console.log(import_picocolors.default.dim(" Nothing changed."));return}keepContent=choice==="keep"}else{let approved=await confirm({message:"Delete this design folder and everything in it?",initialValue:!1});if(isCancel(approved)||!approved){console.log(import_picocolors.default.dim(" Nothing changed."));return}}if(await stopDaemon(daemonRoot(folder)))console.log(import_picocolors.default.dim(" Stopped its canvas."));let dropped=local?null:await unregisterDesign(folder,cwd).catch((err)=>fail("design remove",err.message));if(local)await removeLocalDesign(local.id);if(!keepContent)await rm(folder,{recursive:!0,force:!0});if(console.log(`velloo design: ${keepContent?"retained content at":"removed"} ${folder}`),local)console.log(import_picocolors.default.dim(` Forgot the local design "${name}".`));if(dropped?.name)console.log(import_picocolors.default.dim(dropped.removedManifest?` Dropped "${dropped.name}" \u2014 velloo.json listed no other designs, so it's gone too.`:` Dropped "${dropped.name}" from velloo.json.`))}}),move=defineCommand({meta:{name:"move",description:"Preview moving a design between the repository, managed storage and another directory; --yes applies"},args:{design:{type:"positional",required:!1,description:DESIGN_ARG_DESCRIPTION},id:DESIGN_ID_ARG,external:{type:"boolean",description:"Move to managed storage (a local design)"},to:{type:"string",description:"New directory \u2014 inside the repository it goes in velloo.json, outside it is local"},yes:{type:"boolean",description:"Apply the displayed move"}},async run({args}){let source=await resolveDesign(args.design,"design move",{id:args.id,interactive:!0,requireConfig:!0}),plan=await planRelocation(source,resolve("."),args.to,args.external===!0).catch((err)=>fail("design move",err.message)),local="a local design on this machine",recorded=plan.sourceManifestPath?plan.destinationLocal?`velloo.json path "${plan.sourceManifestPath}" \u2192 ${"a local design on this machine"}`:`velloo.json path "${plan.sourceManifestPath}" \u2192 "${plan.destinationManifestPath}"`:plan.destinationLocal?"stays a local design on this machine":`${"a local design on this machine"} \u2192 velloo.json path "${plan.destinationManifestPath}"`;if(console.log(`Source: ${plan.source}
|
|
3
|
+
Destination: ${plan.destination}
|
|
4
|
+
Design "${plan.designName}": ${recorded}`),!args.yes){console.log("Preview only. Add --yes to apply the move.");return}await relocateDesign(plan),console.log(`Moved ${plan.designName} to ${plan.destination}. Run velloo connect to refresh existing agent guidance.`)}});async function renameThroughCanvas(folder,name){let rec=await readLock(daemonRoot(folder));if(!rec||!await isLive(rec))return!1;let res;try{res=await fetch(`http://127.0.0.1:${rec.canvasPort}/api/mutate/update_design_name`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name}),signal:AbortSignal.timeout(1e4)})}catch(err){fail("design rename",`the running canvas didn't answer (${err.message}).`)}if(res.ok)return!0;let body=await res.json().catch(()=>null);fail("design rename",body?.error?.message??`the running canvas refused (HTTP ${res.status}).`)}var rename=defineCommand({meta:{name:"rename",description:"Rename a design"},args:{design:{type:"positional",required:!1,description:"The design to rename \u2014 its current name or its folder path (or use --id)"},name:{type:"positional",required:!1,description:"The new name"},id:DESIGN_ID_ARG},async run({args}){let cwd=resolve("."),newName=args.id!==void 0&&args.name===void 0?args.design:args.name,target=args.id!==void 0&&args.name===void 0?void 0:args.design;if(newName===void 0)fail("design rename","pass the design and its new name: `velloo design rename <design> <new name>`.");let folder=await resolveDesign(target,"design rename",{id:args.id,requireConfig:!0,cwd}),previous=recordedDesignName(folder);if(previous===newName){console.log(import_picocolors.default.dim(` Already named "${newName}" \u2014 nothing changed.`));return}let conflict=await designRenameConflict(folder,newName).catch((err)=>fail("design rename",err.message));if(conflict)fail("design rename",conflict);if(!await renameThroughCanvas(folder,newName)){if(await writeDesignName(folder,newName),previous&&await followDesignRename(folder,previous,newName))console.log(import_picocolors.default.dim(` velloo.json defaultDesign \u2192 "${newName}"`))}console.log(`velloo design: renamed ${previous?`"${previous}" `:""}to "${newName}".`);let repinned=previous?await repinAgentConfigs({projectRoots:await agentRootCandidates(folder),designFolder:folder,names:[previous]}).catch(()=>[]):[];for(let path of repinned)console.log(import_picocolors.default.dim(` ${relative(cwd,path)||path}: no longer names the design`))}}),upgrade=defineCommand({meta:{name:"upgrade",description:"Migrate a design to this Velloo's format, without upgrading Velloo itself"},args:{design:{type:"positional",required:!1,description:DESIGN_ARG_DESCRIPTION},id:DESIGN_ID_ARG,all:{type:"boolean",description:"Migrate every design in this checkout"},"dry-run":{type:"boolean",default:!1,description:"Show what would change without writing"},skills:{type:"boolean",default:!0,description:"Also refresh the installed agent skills / plugin / rules to this velloo's versions"}},async run({args}){if(args.all&&(args.design||args.id!==void 0))fail("design upgrade","pass a design or --all, not both.");let folders=args.all?await checkoutDesigns(resolve(".")):[await resolveDesign(args.design,"design upgrade",{id:args.id,interactive:!0,requireConfig:!0})];if(folders.length===0)fail("design upgrade","no designs here \u2014 `velloo init` creates one.");for(let folder of folders)await migrateFolder2(folder,{dryRun:args["dry-run"],skills:args.skills})}}),bind=defineCommand({meta:{name:"bind",description:"Attach a design folder outside this checkout to it, on this machine only"},args:{design:{type:"positional",required:!0,description:"The design folder (in managed storage or anywhere outside the checkout)"},name:{type:"string",description:"Rename the design as it is bound"},yes:{type:"boolean",description:"Confirm the local binding"}},async run({args}){let cwd=resolve("."),folder=resolve(args.design);if(!await hasDesignConfig(folder))fail("design bind",`${folder} is not a velloo design folder (no .design/config.json).`);let root=cwd;if(isWithin(root,folder))fail("design bind",`${folder} is inside this checkout (${root}); a design here belongs in velloo.json \u2014 see \`velloo design add\`.`);let name=args.name??recordedDesignName(folder);if(!name)fail("design bind",`${folder} has no design name \u2014 run \`velloo upgrade ${folder}\` first.`);let issue=designNameIssue(name);if(issue)fail("design bind",`invalid --name ${JSON.stringify(name)} \u2014 ${issue}`);let clash=(await findDesigns(root).catch((err)=>fail("design bind",err.message)))?.designs.find((d)=>d.name===name&&!(existsSync(d.root)&&realpathSync(d.root)===realpathSync(folder)));if(clash)fail("design bind",`a design named "${name}" already exists at ${clash.root} \u2014 pass --name to bind this one under another.`);let existing=localDesignOf(folder),appRoot=existing?join(root,relative(existing.root,existing.appRoot)):root,listed=(await findManifest(cwd).catch(()=>null))?.folders.some((path)=>existsSync(path)&&realpathSync(path)===realpathSync(folder));if(console.log(`Design: ${name} (${folder})
|
|
5
|
+
Checkout: ${root}
|
|
6
|
+
Application: ${appRoot}`),listed)console.log("velloo.json: drops its entry, which cannot point outside the repo");if(!args.yes){console.log("Preview only. Add --yes to confirm this local binding.");return}if(await loadDesignFolder(folder,{preferences:!1}),await stopDaemon(daemonRoot(folder)),listed)await unregisterDesign(folder,cwd).catch((err)=>fail("design bind",err.message));if(name!==recordedDesignName(folder))await writeDesignName(folder,name);await registerLocalDesign({id:existing?.id??managedDesignId(folder)??randomUUID(),root,appRoot:existsSync(appRoot)?appRoot:root,...managedDesignId(folder)?{}:{designPath:folder}}).catch((err)=>fail("design bind",err.message)),console.log(`Bound "${name}" to ${root} on this machine.`)}}),setAppRoot=defineCommand({meta:{name:"set-app-root",description:"Point a design at a different application root"},args:{design:{type:"positional",required:!1,description:DESIGN_ARG_DESCRIPTION},id:DESIGN_ID_ARG,to:{type:"string",description:"New application root (asked from the repo's apps when omitted)"},yes:{type:"boolean",description:"Apply the displayed change"}},async run({args}){let folder=await resolveDesign(args.design,"design set-app-root",{id:args.id,interactive:!0,requireConfig:!0}),current=await recordedAppRoot(folder);console.log(`Design: ${folder}`),console.log(`Application: ${current.path}${current.exists?current.looksLikeApp?"":import_picocolors.default.yellow(" (no package.json)"):import_picocolors.default.yellow(" (missing)")}`);let target=args.to?resolve(args.to):await promptAppRootChoice(current.path);if(!target){console.log(import_picocolors.default.dim(" No other application found in this repo \u2014 pass --to <path>."));return}let change=await planAppRootChange(folder,target).catch((err)=>fail("design set-app-root",err.message));if(resolve(change.to)===resolve(change.from)){console.log(import_picocolors.default.dim(" Already pointing there \u2014 nothing changed."));return}if(!existsSync(change.to))fail("design set-app-root",`${change.to} does not exist.`);if(console.log(`New application: ${change.to}`),!existsSync(join(change.to,"package.json")))console.log(import_picocolors.default.yellow(" ! no package.json there \u2014 codegen and live islands will not resolve"));if(change.local)console.log(import_picocolors.default.dim(` local design record: appRoot \u2192 ${change.to}`));for(let r of change.rewritten)console.log(import_picocolors.default.dim(` ${r.field}: ${r.from} \u2192 ${r.to}`));if(!args.yes){console.log("Preview only. Add --yes to apply.");return}await stopDaemon(daemonRoot(folder)),await applyAppRootChange(folder,change),console.log(`velloo design: application root is now ${change.to}`)}}),design_default=defineCommand({meta:{name:"design",description:"Manage this repo's designs (list, add, remove, move, rename, upgrade, \u2026)"},subCommands:{list,add,remove,move,rename,upgrade,bind,"set-app-root":setAppRoot},run:({args})=>args._?.length?void 0:list.run?.({args,cmd:list,rawArgs:[]})});export{design_default as default};
|
|
@@ -0,0 +1,86 @@
|
|
|
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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{string,object,record,literal}from"./chunk-40xgcth8.js";import{chmod,mkdir,readFile,writeFile}from"fs/promises";import{homedir}from"os";import{dirname,join}from"path";var CloudCredentialSchema=object({token:string().min(1),email:string().min(1)}),CredentialsFileSchema=object({version:literal(1),clouds:record(string(),CloudCredentialSchema)}),credentialsPath=()=>process.env.VELLOO_CREDENTIALS_PATH??join(homedir(),".velloo","credentials.json"),normalizeCloudUrl=(url)=>url.replace(/\/+$/,"");async function readAll(){try{let parsed=CredentialsFileSchema.safeParse(JSON.parse(await readFile(credentialsPath(),"utf8")));if(parsed.success)return parsed.data}catch{}return{version:1,clouds:{}}}async function loadCredential(cloudUrl){return(await readAll()).clouds[normalizeCloudUrl(cloudUrl)]??null}async function saveCredential(cloudUrl,cred){let all=await readAll();return all.clouds[normalizeCloudUrl(cloudUrl)]=cred,writeAll(all)}async function deleteCredential(cloudUrl){let all=await readAll(),key=normalizeCloudUrl(cloudUrl);if(!(key in all.clouds))return!1;return delete all.clouds[key],await writeAll(all),!0}async function clearCredentials(){let all=await readAll(),count=Object.keys(all.clouds).length;if(count===0)return 0;return await writeAll({version:1,clouds:{}}),count}async function writeAll(all){let path=credentialsPath();return await mkdir(dirname(path),{recursive:!0,mode:448}),await writeFile(path,`${JSON.stringify(all,null,2)}
|
|
3
|
+
`,{mode:384}),await chmod(path,384),path}
|
|
4
|
+
export{normalizeCloudUrl,loadCredential,saveCredential,deleteCredential,clearCredentials};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
async function resolve(value){return typeof value==="function"?await value():await value}async function firstPositional(rawArgs,args){let defs=args?await resolve(args):{},camel=(name)=>name.replace(/-([a-z0-9])/g,(_,c)=>c.toUpperCase()),takesValue=(flag)=>{let name=camel(flag.replace(/^-{1,2}/,""));return Object.entries(defs).some(([key,def])=>{if(def.type!=="string"&&def.type!=="enum")return!1;let aliases="alias"in def&&def.alias!==void 0?[def.alias].flat():[];return camel(key)===name||aliases.includes(name)})};for(let i=0;i<rawArgs.length;i++){let token=rawArgs[i]??"";if(token==="--")return;if(token.startsWith("-")){if(!token.includes("=")&&takesValue(token))i++;continue}return token}return}function withSubcommands(cmd,subCommands){let chosen=null,dispatches=(name)=>name===null||name!==void 0&&Object.hasOwn(subCommands,name);return{...cmd,subCommands:()=>dispatches(chosen)?subCommands:{},async setup(context){if(chosen=await firstPositional(context.rawArgs,cmd.args),!dispatches(chosen))await cmd.setup?.(context)},async run(context){if(!dispatches(chosen))await cmd.run?.(context)}}}
|
|
3
|
+
export{firstPositional,withSubcommands};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{join,sep}from"path";async function withAssetServer(folder,liveCode,fn){let assetsRoot=join(folder,"assets"),server=Bun.serve({port:0,hostname:"127.0.0.1",async fetch(req){let url=new URL(req.url);if(liveCode!==null&&url.pathname==="/live/bundle.js")return new Response(liveCode,{headers:{"Content-Type":"text/javascript"}});if(url.pathname.startsWith("/assets/")){let fsPath=join(folder,decodeURIComponent(url.pathname));if(fsPath.startsWith(assetsRoot+sep)){let file=Bun.file(fsPath);if(await file.exists())return new Response(file)}}return new Response("not found",{status:404})}});try{return await fn(`http://127.0.0.1:${server.port}/`)}finally{server.stop(!0)}}
|
|
3
|
+
export{withAssetServer};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{isCancel,select}from"./chunk-80fjfyha.js";import{preflightScreens}from"./chunk-tdsk5wxa.js";import{fail}from"./chunk-s23gtejf.js";import{copyToClipboard}from"./chunk-vbk1qhdz.js";import{require_picocolors}from"./chunk-jrsknzjt.js";import{__toESM}from"./chunk-2smsg2ct.js";import{stripVTControlCharacters}from"util";var import_picocolors=__toESM(require_picocolors(),1);function plural(count,noun){return`${count} ${noun}${count===1?"":"s"}`}function formatFailures(command,failures){let byScreen=new Map;for(let failure of failures)byScreen.set(failure.screenId,[...byScreen.get(failure.screenId)??[],failure]);let notDrawn=[...byScreen.values()].filter((group)=>group.some((failure)=>failure.componentId===null)),placeholders=[...byScreen.values()].filter((group)=>!notDrawn.includes(group)).reduce((sum,group)=>sum+group.length,0),consequences=[placeholders>0&&`${plural(placeholders,"component")} will appear as placeholders`,notDrawn.length>0&&`${plural(notDrawn.length,"screen")} will not render at all`].filter(Boolean),lines=[`${import_picocolors.default.yellow(`velloo ${command}:`)} render failures on ${plural(byScreen.size,"screen")} \u2014 ${consequences.join(", and ")}:`];for(let group of byScreen.values()){let[first]=group;if(!first)continue;let boards=first.boards.length>0?first.boards.map((board)=>board.name).join(", "):"no board";lines.push("",` ${import_picocolors.default.dim(`${boards} \u203A`)} ${import_picocolors.default.bold(first.screenName)} ${import_picocolors.default.dim(`(${first.screenId})`)}`);let pinned=group.some((failure)=>failure.componentId!==null);for(let failure of group)if(failure.componentId!==null)lines.push(` ${import_picocolors.default.cyan(failure.componentId)}: ${failure.reason}`);else{let label=pinned?"screen not drawn":"screen not drawn \u2014 the error could not be pinned on one component";lines.push(` ${import_picocolors.default.red(label)}: ${failure.reason}`)}}return lines}async function confirmRenderFailures(command,source,screens,yes){let failures=preflightScreens(source,screens);if(failures.length===0)return;let report=formatFailures(command,failures);for(let line of report)console.error(line);if(console.error(""),yes)return;if(!process.stdin.isTTY)fail(command,"refusing to continue \u2014 re-run with --yes to accept the placeholders.");for(;;){let choice=await select({message:"Continue anyway?",options:[{value:"cancel",label:"No, cancel"},{value:"continue",label:"Yes, continue with the failures"},{value:"copy",label:"Copy errors to clipboard"}],initialValue:"cancel"});if(isCancel(choice)||choice==="cancel")fail(command,"cancelled.");if(choice==="continue")return;let copied=await copyToClipboard(stripVTControlCharacters(report.join(`
|
|
3
|
+
`)));console.error(copied?` ${import_picocolors.default.green("\u2713")} Errors copied to the clipboard.`:import_picocolors.default.dim(" Couldn't reach a clipboard tool \u2014 copy the errors printed above."))}}
|
|
4
|
+
export{confirmRenderFailures};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ScreenSchema}from"./chunk-40xgcth8.js";import{detectTailwindMajor,emitCode,moduleTarget,v3ClassIssues,classNamesInJsx,styleChannelOf,loadDesignFolder,hostAppRootFrom,resolveProviders}from"./chunk-tdsk5wxa.js";import"./chunk-t448rrfr.js";import"./chunk-3e8vez4d.js";import"./chunk-80fjfyha.js";import{fail}from"./chunk-s23gtejf.js";import{findDesignConfig}from"./chunk-ngnymg2q.js";import{createProgress}from"./chunk-pjtg3wnm.js";import{DESIGN_ARG_DESCRIPTION,resolveDesign,pickScreen}from"./chunk-vsv8z729.js";import{defineCommand}from"./chunk-2smsg2ct.js";import{readFile,writeFile}from"fs/promises";import{isAbsolute,resolve}from"path";import{stdout}from"process";async function folderEmitContext(screenPath,screen){let found=await findDesignConfig(screenPath);if(!found)return{};let design=await loadDesignFolder(found.folder),{providers,defaultProvider}=await resolveProviders(design.config,found.folder),provider=screen.library&&providers[screen.library]||defaultProvider,adapter=provider,target;if(adapter.codegenModule){let manifest=await provider.loadManifest();target=moduleTarget(manifest.filter((c)=>c.source!=="velloo").map((c)=>c.id),adapter.codegenModule)}let inlineStyle=styleChannelOf(provider,design.config.styling?.framework).kind==="style";return{snippets:design.snippets,...design.config.extensions?{extensions:design.config.extensions}:{},...target?{target}:{},...inlineStyle?{inlineStyle:!0}:{}}}var emit_default=defineCommand({meta:{name:"emit",description:"Print or write agent-consumed IR for a screen."},args:{screen:{type:"positional",required:!1,description:"Screen id, or a path to a screen JSON. Omit to pick interactively."},design:{type:"string",description:DESIGN_ARG_DESCRIPTION},to:{type:"string",description:"Write IR as JSON to this path. Omit to print the JSX body to stdout (agent-friendly when piped)."},"components-alias":{type:"string",description:'Override the import prefix the IR mentions in snippet identifiers. Defaults to .design/config.json#codegen.componentsAlias, else "@/components/ui".'}},async run({args}){let interactive=Boolean(process.stdin.isTTY),screenArg=args.screen,screenPath=!!screenArg&&(screenArg.includes("/")||screenArg.endsWith(".json"))?resolve(screenArg):(await pickScreen(await resolveDesign(args.design,"emit",{designFlag:"--design"}),screenArg,interactive,"emit")).path,screenJson=JSON.parse(await readFile(screenPath,"utf8")),screen=ScreenSchema.parse(screenJson),progress=createProgress();progress.start("preparing code");try{let componentsAlias=args["components-alias"]??await readConfigAlias(screenPath),context=await folderEmitContext(screenPath,screen);progress.step("generating code");let result=await emitCode(screen,{...componentsAlias?{componentsAlias}:{},...context});if(!result.ok){progress.fail("code generation failed");let e=result.error;if(e.kind==="UnknownComponent")fail("emit",`unknown component: ${JSON.stringify(e.ref)}`);else if(e.kind==="SnippetNotFound")fail("emit",`snippet not found: ${JSON.stringify(e.snippetId)}`);else fail("emit",`screen not found: ${JSON.stringify(e.screenId)}`)}let found=await findDesignConfig(screenPath),tailwindV3Compat=found&&!context?.target&&!context?.inlineStyle?detectTailwindMajor(hostAppRootFrom(found.folder,found.config.hostApp))===3?v3ClassIssues([...result.value.classesUsed,...result.value.snippetsUsed.flatMap((s)=>classNamesInJsx(s.jsx))]):[]:[];if(args.to){progress.step("writing code");let outPath=isAbsolute(args.to)?args.to:resolve(args.to),ir=tailwindV3Compat.length>0?{...result.value,tailwindV3Compat}:result.value;await writeFile(outPath,JSON.stringify(ir,null,2),"utf8"),progress.succeed("generated code"),console.log(`velloo emit: wrote ${outPath}`);return}if(progress.succeed("generated code"),stdout.write(`// screen: ${result.value.screen.id} (${result.value.screen.name})
|
|
3
|
+
`),stdout.write(`// components: ${result.value.componentsUsed.join(", ")||"(none)"}
|
|
4
|
+
`),result.value.iconsUsed.length>0)stdout.write(`// icons (lucide): ${result.value.iconsUsed.join(", ")}
|
|
5
|
+
`);if(result.value.snippetsUsed.length>0)stdout.write(`// snippets: ${result.value.snippetsUsed.map((s)=>`${s.componentName}(${s.id})`).join(", ")}
|
|
6
|
+
`);for(let issue of tailwindV3Compat)stdout.write(issue.v3?`// tailwind v3 host: \`${issue.class}\` \u2192 \`${issue.v3}\` (${issue.note})
|
|
7
|
+
`:`// tailwind v3 host: \`${issue.class}\` \u2014 ${issue.note}
|
|
8
|
+
`);stdout.write(`
|
|
9
|
+
`),stdout.write(`${result.value.jsx}
|
|
10
|
+
`)}catch(error){throw progress.fail("code generation failed"),error}}});async function readConfigAlias(screenPath){return(await findDesignConfig(screenPath))?.config.codegen?.componentsAlias}export{emit_default as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{CHROMIUM_INSTALL_ARGV,CHROMIUM_FULL_INSTALL_ARGV,CHROMIUM_DEPS_INSTALL_ARGV}from"./chunk-3e8vez4d.js";import"./chunk-40xgcth8.js";import{fail}from"./chunk-s23gtejf.js";import{defineCommand}from"./chunk-2smsg2ct.js";async function run(argv){let code=await Bun.spawn([...argv],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;if(code!==0)fail("browser install",`browser setup exited with status ${code}`)}var install=defineCommand({meta:{name:"install",description:"Install the browser used for screenshots"},args:{full:{type:"boolean",default:!1,description:"Install full Chromium instead of the smaller headless shell"},"with-deps":{type:"boolean",default:!1,description:"Also install required Linux system packages (may use sudo)"}},async run({args}){if(args["with-deps"]&&process.platform==="linux")await run(CHROMIUM_DEPS_INSTALL_ARGV);await run(args.full?CHROMIUM_FULL_INSTALL_ARGV:CHROMIUM_INSTALL_ARGV)}}),browser_default=defineCommand({meta:{name:"browser",description:"Manage the optional browser used for screenshots"},subCommands:{install}});export{browser_default as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{loadDesignFolder,resolveProviders,findHostTailwindConfig,TailwindJit,extraThemeBlock}from"./chunk-tdsk5wxa.js";import{join}from"path";async function loadPipeline(folderPath){let design=await loadDesignFolder(folderPath),config=design.config,{providers,defaultProvider}=await resolveProviders(config,folderPath),jit=new TailwindJit(Object.values(providers),join(folderPath,"screens"),void 0,()=>extraThemeBlock(design),void 0,()=>findHostTailwindConfig(folderPath,config.hostApp),config.styling?.framework),snapshotCss=await jit.build();return{folderPath,design,config,providers,defaultProvider,jit,snapshotCss}}
|
|
3
|
+
export{loadPipeline};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{AuthConfigResponseSchema,AccountResponseSchema,DeviceCodeResponseSchema,DeviceTokenResponseSchema,CliTokenResponseSchema,readFailure}from"./chunk-t448rrfr.js";import{openUrl}from"./chunk-hggap8fq.js";import{isSecureCloudUrl,assertSecureCloudUrl}from"./chunk-pp86v6m6.js";async function fetchAccount(cloudUrl,token,timeoutMs=8000){if(!isSecureCloudUrl(cloudUrl))return{status:"unreachable"};let res=await fetch(`${cloudUrl}/v1/me`,{headers:{authorization:`Bearer ${token}`},signal:AbortSignal.timeout(timeoutMs)}).catch(()=>null);if(!res)return{status:"unreachable"};if(res.status===401||res.status===403)return{status:"rejected"};if(!res.ok)return{status:"unreachable"};let parsed=AccountResponseSchema.safeParse(await res.json().catch(()=>null));if(!parsed.success)return{status:"unreachable"};let body=parsed.data;return{status:"ok",account:{email:body.email,...body.name?{name:body.name}:{},...body.tier?{tier:body.tier}:{},...body.creditMicros!==void 0?{creditMicros:body.creditMicros}:{}}}}async function verifyCredential(cloudUrl,token,timeoutMs=8000){let found=await fetchAccount(cloudUrl,token,timeoutMs);return found.status==="ok"?found.account.email:null}var sleepCancelable=(ms,signal)=>new Promise((resolve,reject)=>{if(signal.aborted){reject(Error("cancelled"));return}let timer=setTimeout(resolve,ms);signal.addEventListener("abort",()=>{clearTimeout(timer),reject(Error("cancelled"))},{once:!0})});async function performDeviceLogin(cloudUrl,onPrompt,signal){assertSecureCloudUrl(cloudUrl);let configRes=await fetch(`${cloudUrl}/v1/auth/config`).catch(()=>null);if(!configRes?.ok)throw Error(`cannot reach ${cloudUrl} \u2014 is velloo-cloud up?`);let config=AuthConfigResponseSchema.safeParse(await configRes.json().catch(()=>null)),issuer=config.success?config.data.issuer:void 0,clientId=config.success?config.data.clientId:void 0;if(issuer===void 0||clientId===void 0)throw Error(`${cloudUrl} does not advertise a sign-in service \u2014 is velloo-cloud current?`);let codeRes=await fetch(`${issuer}/api/auth/device/code`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_id:clientId})}).catch(()=>null);if(!codeRes?.ok)throw Error(`the auth service at ${issuer} is not answering \u2014 is it up?`);let deviceBody=DeviceCodeResponseSchema.safeParse(await codeRes.json().catch(()=>null));if(!deviceBody.success)throw Error(`the auth service at ${issuer} answered something this velloo can't read`);let device=deviceBody.data;await onPrompt({verificationUrl:device.verification_uri_complete,userCode:device.user_code,expiresIn:device.expires_in}),openUrl(device.verification_uri_complete);let deadline=Date.now()+device.expires_in*1000,intervalMs=Math.max(1,device.interval)*1000,accessToken=null,abortSignal=signal??new AbortController().signal;while(Date.now()<deadline){await sleepCancelable(intervalMs,abortSignal);let res=await fetch(`${issuer}/api/auth/device/token`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:device.device_code,client_id:clientId}),signal:abortSignal}),polled=DeviceTokenResponseSchema.safeParse(await res.json().catch(()=>({}))),body=polled.success?polled.data:{};if(body.access_token){accessToken=body.access_token;break}if(body.error==="authorization_pending")continue;if(body.error==="slow_down"){intervalMs+=5000;continue}throw Error(body.error_description??body.error??"device authorization failed")}if(!accessToken)throw Error("the sign-in code expired \u2014 run velloo login again");let exchangeRes=await fetch(`${cloudUrl}/v1/auth/cli-token`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({accessToken})});if(exchangeRes.status!==201){let{detail}=await readFailure(exchangeRes);throw Error(`token exchange failed (${exchangeRes.status}): ${detail}`)}let exchanged=CliTokenResponseSchema.safeParse(await exchangeRes.json().catch(()=>null));if(!exchanged.success)throw Error(`${cloudUrl} returned a sign-in token this velloo can't read`);return exchanged.data}
|
|
3
|
+
export{fetchAccount,verifyCredential,performDeviceLogin};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ThemeSchema}from"./chunk-40xgcth8.js";import{colorizeDiff,emitTheme,emitNativeTheme,loadDesignFolder,resolveProviders}from"./chunk-tdsk5wxa.js";import"./chunk-t448rrfr.js";import"./chunk-3e8vez4d.js";import"./chunk-80fjfyha.js";import"./chunk-s23gtejf.js";import{detectHost}from"./chunk-fsbsksga.js";import{DESIGN_ARG_DESCRIPTION,resolveDesign}from"./chunk-vsv8z729.js";import{defineCommand}from"./chunk-2smsg2ct.js";import{readFile}from"fs/promises";import{isAbsolute,join,resolve}from"path";import{stdin,stdout}from"process";import{createInterface}from"readline/promises";async function readMaybe(path){try{return await readFile(path,"utf8")}catch{return}}async function themeEmitter(folderRoot,theme,outDir,cssOnly,tailwind3){let design=await loadDesignFolder(folderRoot),{defaultProvider}=await resolveProviders(design.config,folderRoot),adapter=defaultProvider;if(adapter.themeToNative&&adapter.themeModule){let toNative=adapter.themeToNative.bind(adapter),spec=adapter.themeModule;return{native:!0,produce:(apply)=>emitNativeTheme(toNative(theme),{spec,outputDir:outDir,apply,...theme.colorsDark?{darkThemeOptions:toNative(theme,!0)}:{},sourceTheme:theme})}}let customCss=await readMaybe(join(folderRoot,"theme","custom.css"));return{native:!1,produce:(apply)=>emitTheme(theme,{outputDir:outDir,apply,cssOnly,...customCss?{customCss}:{},...tailwind3?{tailwindMajor:3}:{}})}}var exportTheme=defineCommand({meta:{name:"export",description:"Export DTCG tokens.json plus the framework theme in diff mode \u2014 Tailwind v4 globals.css by default, or v3 CSS + preset when detected"},args:{to:{type:"string",required:!0,description:"Target app directory (writes <to>/app/globals.css and <to>/tailwind.config.ts)"},design:{type:"string",description:DESIGN_ARG_DESCRIPTION},theme:{type:"string",description:"Path to theme JSON (default: the design's theme/default.json)"},apply:{type:"boolean",description:"Write files instead of printing diffs. Default: dry-run."},"css-only":{type:"boolean",description:"Skip tailwind.config.ts (CSS-only export)."},"force-v4":{type:"boolean",description:"Emit the v4 artifacts even when the target app looks like Tailwind v3."}},async run({args}){let folderRoot=await resolveDesign(args.design,"theme export",{designFlag:"--design"}),themePath=args.theme?resolve(args.theme):join(folderRoot,"theme","default.json"),outDir=isAbsolute(args.to)?args.to:resolve(args.to),themeJson=JSON.parse(await readFile(themePath,"utf8")),theme=ThemeSchema.parse(themeJson),tailwind3=!args["force-v4"]&&detectHost(outDir).tailwindMajor===3,{native,produce}=await themeEmitter(folderRoot,theme,outDir,Boolean(args["css-only"]),tailwind3);if(!native&&tailwind3)console.log("velloo theme export: target looks like Tailwind v3 \u2014 emitting velloo-theme.css + velloo.preset (pass --force-v4 for the v4 artifacts).");let result=await produce(Boolean(args.apply)),useColor=stdout.isTTY===!0,anyChange=!1;for(let warning of result.warnings)console.error(`velloo theme export: warning: ${warning}`);for(let file of result.files){if(file.diff.identical){console.log(`velloo theme export: ${file.path} is already up to date.`);continue}if(anyChange=!0,file.applied)console.log(`velloo theme export: wrote ${file.path}`);else{let rendered=useColor?colorizeDiff(file.diff.diff):file.diff.diff;stdout.write(`${rendered}
|
|
3
|
+
`),stdout.write(`Would write to: ${file.path}
|
|
4
|
+
|
|
5
|
+
`)}}for(let note of result.notes)console.log(`velloo theme export: ${note}`);if(!anyChange||args.apply)return;if(!stdin.isTTY){console.log("(non-TTY) re-run with --apply to write the files.");return}let rl=createInterface({input:stdin,output:stdout}),answer=(await rl.question("Apply all? (y/N) ")).trim().toLowerCase();if(rl.close(),answer==="y"||answer==="yes"){let final=await produce(!0);for(let file of final.files)if(file.applied)console.log(`velloo theme export: wrote ${file.path}`)}else console.log("velloo theme export: skipped (no changes written).")}}),theme_default=defineCommand({meta:{name:"theme",description:"Work with a design's theme"},subCommands:{export:exportTheme}});export{theme_default as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{existsSync}from"fs";import{dirname,join}from"path";import{fileURLToPath}from"url";var package_default={name:"@velloo/shadcn-snapshot",version:"0.0.0",license:"Apache-2.0",private:!0,type:"module",description:"[internal] Canvas design-mode runtime for provider-shadcn-upstream \u2014 pinned shadcn snapshot, Tailwind v4 entry CSS, prop manifest. Not a user-facing provider.",snapshotVersion:"2026.09.03",shadcnStyle:"radix-nova",shadcnCliVersion:"4.20.1",exports:{".":"./src/index.ts","./tailwind-entry.css":"./src/tailwind-entry.css","./manifest.json":"./dist/manifest.json","./registry-files":"./src/registry-files.ts","./version":"./src/version.ts"},scripts:{build:"bun run build.ts",vendor:"bun run vendor.ts"},dependencies:{"@velloo/helpers":"workspace:*","@velloo/provider":"workspace:*","class-variance-authority":"0.7.1",echarts:"6.1.0","embla-carousel-react":"8.6.0","lucide-react":"1.40.0","radix-ui":"1.6.7",react:"19.2.8","react-day-picker":"10.0.1","react-dom":"19.2.8",sonner:"2.0.8",tailwindcss:"4.3.3","tw-animate-css":"1.4.0"},devDependencies:{"@types/react":"19.2.18","@types/react-dom":"19.2.7","ts-morph":"28.0.0"}};var snapshotVersion2=package_default.snapshotVersion,here=dirname(fileURLToPath(import.meta.url));function resolveRoot(){let dev=join(here,"..");return[process.env.VELLOO_SNAPSHOT_ROOT,join(here,"pkgs","shadcn-snapshot"),dev].filter((p)=>Boolean(p)).find((r)=>existsSync(join(r,"src","tailwind-entry.css")))??dev}var root=resolveRoot(),srcDir=join(root,"src"),distDir=join(root,"dist"),entryCssPath2=join(srcDir,"tailwind-entry.css"),componentsDir2=join(srcDir,"components"),manifestPath=join(distDir,"manifest.json");
|
|
3
|
+
export{snapshotVersion2,entryCssPath2,componentsDir2,manifestPath};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var package_default={name:"@velloo/cli",version:"0.2.0",license:"Apache-2.0",private:!0,type:"module",description:"Velloo CLI",bin:{velloo:"./src/cli.ts"},exports:{".":"./src/cli.ts"},engines:{bun:">=1.4.0"},scripts:{build:"bun run build.ts"},dependencies:{"@clack/prompts":"1.7.0","@velloo/canvas":"workspace:*","@velloo/codegen":"workspace:*","@velloo/protocol":"workspace:*","@velloo/provider":"workspace:*","@velloo/provider-antd":"workspace:*","@velloo/provider-chakra":"workspace:*","@velloo/provider-mui":"workspace:*","@velloo/provider-none":"workspace:*","@velloo/renderer":"workspace:*","@velloo/result":"workspace:*","@velloo/schema":"workspace:*","@velloo/server":"workspace:*","@velloo/shadcn-snapshot":"workspace:*",citty:"0.2.2",picocolors:"1.1.1",zod:"4.5.4"}};var PACKAGE_VERSION=package_default.version,TOOL_VERSION="0.2.0",BUILD_TIME_MS=1789624987317;
|
|
3
|
+
export{PACKAGE_VERSION,TOOL_VERSION,BUILD_TIME_MS};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{recordedDesignName}from"./chunk-tdsk5wxa.js";import{displayPath}from"./chunk-dy41n60j.js";import{basename,relative,resolve}from"path";function designWithFolder(folder,name,opts={}){let shown=name??recordedDesignName(folder)??basename(folder),rel=relative(resolve("."),folder),where=rel!==""&&!rel.startsWith("..")&&!opts.absolute?`./${rel}`:displayPath(folder);return`"${shown}" (${where})`}
|
|
3
|
+
export{designWithFolder};
|