velloo 0.0.0 → 0.1.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 +262 -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-BcBJ11d2.js +28 -0
- package/canvas/assets/lucide-all-BdEyryfF.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-0t68szgr.js +3 -0
- package/chunk-1bywxgc5.js +4 -0
- package/chunk-1gx45384.js +41 -0
- package/chunk-1y50g9vp.js +2 -0
- package/chunk-1yhc252b.js +3 -0
- package/chunk-2mv65qxs.js +5 -0
- package/chunk-2smsg2ct.js +7 -0
- package/chunk-2vx420g2.js +442 -0
- package/chunk-2z0k59hz.js +3 -0
- package/chunk-329e3phg.js +451 -0
- package/chunk-40657ggd.js +10 -0
- package/chunk-56vqqr8s.js +3 -0
- package/chunk-582y60bv.js +2 -0
- package/chunk-5js0qw32.js +2 -0
- package/chunk-5x173xay.js +2 -0
- package/chunk-65wb0g7d.js +3 -0
- package/chunk-6tx68d90.js +3 -0
- package/chunk-74skmg76.js +2 -0
- package/chunk-75wbh438.js +2 -0
- package/chunk-79ykzywe.js +4 -0
- package/chunk-7dggmqwq.js +53 -0
- package/chunk-7e39xe21.js +18 -0
- package/chunk-7p7ha0qk.js +3 -0
- package/chunk-8ssr8a8w.js +89 -0
- package/chunk-946pcnt5.js +5 -0
- package/chunk-9vg3yafz.js +3 -0
- package/chunk-aapybh30.js +6 -0
- package/chunk-b2ebm1t3.js +303 -0
- package/chunk-b7j86xq7.js +4 -0
- package/chunk-bjnhhsak.js +2 -0
- package/chunk-bk8b7f9a.js +62 -0
- package/chunk-cep3ktr3.js +4 -0
- package/chunk-cxe6jjwj.js +3 -0
- package/chunk-d385435m.js +8 -0
- package/chunk-dt03awr1.js +2 -0
- package/chunk-e2ag33vd.js +226 -0
- package/chunk-erwfk47h.js +3 -0
- package/chunk-fgw3hp2v.js +3 -0
- package/chunk-fjbzk4sw.js +3 -0
- package/chunk-g02nd9hn.js +4 -0
- package/chunk-h0c36khx.js +2 -0
- package/chunk-h6gchare.js +3 -0
- package/chunk-hggap8fq.js +3 -0
- package/chunk-hs2j6s1v.js +75 -0
- package/chunk-jnsfgtn9.js +3 -0
- package/chunk-jrsknzjt.js +3 -0
- package/chunk-k6ferbam.js +4 -0
- package/chunk-k784090q.js +6 -0
- package/chunk-kxk5x7g6.js +3 -0
- package/chunk-mq4znqv2.js +2 -0
- package/chunk-mzhdrawd.js +3 -0
- package/chunk-n5007jcz.js +2 -0
- package/chunk-nfr3q7mg.js +5 -0
- package/chunk-nsqs1bqf.js +2 -0
- package/chunk-nwx5700b.js +3 -0
- package/chunk-pphgrsxa.js +2 -0
- package/chunk-qpvj6kzq.js +6 -0
- package/chunk-qwv7xkms.js +2 -0
- package/chunk-rksq3w72.js +244 -0
- package/chunk-s23gtejf.js +3 -0
- package/chunk-t2ttkxe9.js +85 -0
- package/chunk-tmtzxcs5.js +2 -0
- package/chunk-vbk1qhdz.js +3 -0
- package/chunk-w5rzk6ms.js +1229 -0
- package/chunk-xr6f94rj.js +2 -0
- package/chunk-y0zxzefg.js +5 -0
- package/chunk-zf3xc1wz.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 +178 -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 +161 -0
- package/pkgs/schema/src/migrate.ts +244 -0
- package/pkgs/schema/src/node.ts +229 -0
- package/pkgs/schema/src/paths.ts +28 -0
- package/pkgs/schema/src/repo.ts +52 -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 +74 -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,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ScreenSchema}from"./chunk-bk8b7f9a.js";import{detectTailwindMajor,emitCode,moduleTarget,v3ClassIssues,classNamesInJsx,styleChannelOf,loadDesignFolder,hostAppRootFrom,resolveProviders}from"./chunk-329e3phg.js";import"./chunk-mq4znqv2.js";import"./chunk-w5rzk6ms.js";import{fail}from"./chunk-s23gtejf.js";import{findDesignConfig,FOLDER_ARG_DESCRIPTION,resolveDesignFolder,pickScreen}from"./chunk-8ssr8a8w.js";import{createProgress}from"./chunk-79ykzywe.js";import"./chunk-1bywxgc5.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."},folder:{type:"string",description:FOLDER_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 resolveDesignFolder(args.folder,"emit"),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,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{detectTailwindMajor}from"./chunk-329e3phg.js";import{existsSync,readFileSync}from"fs";import{join}from"path";function readJson(path){try{return JSON.parse(readFileSync(path,"utf8"))}catch{return null}}function depRange(deps,name){let v=deps[name];return typeof v==="string"?v:void 0}function detectHost(appRoot){let pkg=readJson(join(appRoot,"package.json"))??{},deps={...pkg.dependencies??{},...pkg.devDependencies??{}},tailwindMajor=detectTailwindMajor(appRoot),componentsJson=readJson(join(appRoot,"components.json")),shadcn=componentsJson!==null,shadcnStyle=typeof componentsJson?.style==="string"?componentsJson.style:void 0,uiLibrary=depRange(deps,"@mui/material")?"mui":depRange(deps,"antd")?"antd":depRange(deps,"@chakra-ui/react")?"chakra":shadcn?"shadcn":void 0,unsupportedUi=uiLibrary?void 0:detectUnsupportedUi(deps);return{shadcn,shadcnStyle,tailwindMajor,globalsCssPath:findGlobalsCss(appRoot,componentsJson),...uiLibrary?{uiLibrary}:{},...unsupportedUi?{unsupportedUi}:{}}}var COMPONENT_DIR_CANDIDATES=["src/components/ui","components/ui","app/components/ui","src/app/components/ui","src/components","components"];function findComponentsDir(appRoot){return COMPONENT_DIR_CANDIDATES.find((rel)=>existsSync(join(appRoot,rel)))}function detectUnsupportedUi(deps){let known=[["@mantine/core","Mantine"],["@nextui-org/react","NextUI"],["@heroui/react","HeroUI"],["react-bootstrap","React Bootstrap"],["@fluentui/react-components","Fluent UI"],["@untitledui/icons","Untitled UI"],["@untitledui/file-icons","Untitled UI"],["react-aria-components","React Aria"]];for(let[pkg,label]of known)if(depRange(deps,pkg))return label;return}function findGlobalsCss(appRoot,componentsJson){let candidates=[componentsJson&&typeof componentsJson.tailwind?.css==="string"?componentsJson.tailwind.css:void 0,"src/app/globals.css","app/globals.css","src/styles/globals.css","styles/globals.css","src/index.css","src/globals.css","src/app.css"].filter((c)=>Boolean(c));for(let rel of candidates){let abs=join(appRoot,rel);if(existsSync(abs))return abs}return}
|
|
3
|
+
export{detectHost,findComponentsDir};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{isCancel,select,findDesignConfig,FOLDER_ARG_DESCRIPTION,resolveDesignFolder,pickScreen}from"./chunk-8ssr8a8w.js";import{closePooledBrowser,renderScreen,screenshot}from"./chunk-w5rzk6ms.js";import{ScreenSchema}from"./chunk-bk8b7f9a.js";import{writeText,registryForScreen,renderPassForScreen}from"./chunk-329e3phg.js";import"./chunk-mq4znqv2.js";import{fail}from"./chunk-s23gtejf.js";import{captureWithBrowserSetup}from"./chunk-k6ferbam.js";import{loadPipeline}from"./chunk-kxk5x7g6.js";import{withAssetServer}from"./chunk-9vg3yafz.js";import{createProgress}from"./chunk-79ykzywe.js";import"./chunk-1bywxgc5.js";import{defineCommand}from"./chunk-2smsg2ct.js";import{readFile}from"fs/promises";import{extname,isAbsolute,resolve}from"path";var render_default=defineCommand({meta:{name:"render",description:"dev: render a screen headless to .html or .png"},args:{screen:{type:"positional",required:!1,description:"Screen id, or a path to a screen JSON. Omit to pick interactively."},folder:{type:"string",description:FOLDER_ARG_DESCRIPTION},to:{type:"string",description:"Output path; extension picks the format (.html | .png). Default: ./<screen>.html"},w:{type:"string",description:"Viewport width in px (default: 1440)"},h:{type:"string",description:"Viewport height in px (default: 900)"}},async run({args}){let interactive=Boolean(process.stdin.isTTY),screenArg=args.screen,looksLikePath=!!screenArg&&(screenArg.includes("/")||screenArg.endsWith(".json")),folder,screenPath;if(looksLikePath&&screenArg)if(screenPath=resolve(screenArg),args.folder)folder=await resolveDesignFolder(args.folder,"render");else{let found=await findDesignConfig(screenPath);if(!found)fail("render",`${screenPath} is not inside a velloo design folder (no .design/config.json above it). Pass --folder with a project name or a path.`);folder=found.folder}else folder=await resolveDesignFolder(args.folder,"render"),screenPath=(await pickScreen(folder,screenArg,interactive,"render")).path;let screen=ScreenSchema.parse(JSON.parse(await readFile(screenPath,"utf8"))),viewport={w:args.w?Number(args.w):1440,h:args.h?Number(args.h):900},outPath;if(args.to)outPath=isAbsolute(args.to)?args.to:resolve(args.to);else{let ext="html";if(interactive){let fmt=await select({message:"Output format?",options:[{value:"html",label:"HTML",hint:"no browser needed"},{value:"png",label:"PNG",hint:"screenshot (needs a headless browser)"}]});if(isCancel(fmt))fail("render","cancelled.");ext=fmt}outPath=resolve(`${screen.id}.${ext}`)}let out=extname(outPath).toLowerCase();if(out!==".html"&&out!==".png")fail("render",`unsupported output extension ${JSON.stringify(out)}. Use .html or .png.`);let progress=createProgress();progress.start("preparing render");try{let pipeline=await loadPipeline(folder),{design,config,providers,defaultProvider,snapshotCss}=pipeline,theme=design.theme,registry=registryForScreen(screen,providers,defaultProvider,config.extensions??{}),renderPass=renderPassForScreen(screen,providers,defaultProvider,theme),renderHtml=async(baseHref)=>{let{html}=await renderScreen(screen,theme,{viewport,snapshotCss,registry,snippets:design.snippets,renderPass,customCss:design.customCss,...baseHref?{baseHref}:{}});return html};if(out===".html"){progress.step("rendering HTML"),await writeText(outPath,await renderHtml()),progress.succeed("rendered HTML"),console.log(`velloo render: wrote ${outPath} (screen=${screen.id})`);return}progress.step("rendering screen"),await withAssetServer(folder,null,async(baseHref)=>{let html=await renderHtml(baseHref);try{await captureWithBrowserSetup("render",async()=>{progress.step("capturing PNG");try{await screenshot({html,viewport,outPath})}catch(error){throw progress.fail("PNG capture failed"),error}})}finally{await closePooledBrowser()}}),progress.succeed("rendered PNG"),console.log(`velloo render: wrote ${outPath} (screen=${screen.id})`)}catch(error){throw progress.fail("render failed"),error}}});export{render_default as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{TAILWIND_CLASSNAME,helperSourcePath}from"./chunk-329e3phg.js";import{snapshotVersion2,entryCssPath2,componentsDir2}from"./chunk-jnsfgtn9.js";import{registry2}from"./chunk-t2ttkxe9.js";import"./chunk-d385435m.js";import{readFile}from"fs/promises";import{join}from"path";async function readManifest(cacheDir){let raw=await readFile(join(cacheDir,"manifest.json"),"utf8");return JSON.parse(raw)}import{existsSync as existsSync4}from"fs";import{join as join5}from"path";import{existsSync as existsSync3,readFileSync as readFileSync3}from"fs";import{join as join4}from"path";import{existsSync,readFileSync}from"fs";import{join as join2}from"path";function exportsName(source,id){let name=id.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\bexport\\s+(?:async\\s+)?(?:function|const|let|var|class)\\s+${name}\\b`).test(source))return!0;for(let match of source.matchAll(/\bexport\s*\{([^}]*)\}/g)){let clause=match[1]??"";for(let part of clause.split(",")){let local=part.trim().split(/\s+as\s+/);if((local.length>1?local[1]:local[0])?.trim()===id)return!0}}return/\bexport\s+\*\s+from\b/.test(source)}function hostComponentFile(uiDir,addName,id){for(let extension of["tsx","ts","jsx","js"]){let path=join2(uiDir,`${addName}.${extension}`);if(!existsSync(path))continue;try{return exportsName(readFileSync(path,"utf8"),id)?path:null}catch{return null}}return null}import{existsSync as existsSync2,readdirSync,readFileSync as readFileSync2}from"fs";import{join as join3,resolve}from"path";function kebab(id){return id.replace(/(?<!^)(?=[A-Z])/g,"-").toLowerCase()}function addNameIndex(manifest){let byId=new Map(manifest.flatMap((c)=>c.registryName?[[c.id,c.registryName]]:[]));return(id)=>byId.get(id)??kebab(id)}function findUiDir(hostAppRoot){let candidates=[];try{let cj=JSON.parse(readFileSync2(join3(hostAppRoot,"components.json"),"utf8")),fromAlias=(alias,suffix="")=>{if(!alias)return;let srcBase=existsSync2(join3(hostAppRoot,"src"))?"src":"",rel=alias.replace(/^@\//,srcBase?`${srcBase}/`:"")+suffix;candidates.push(resolve(hostAppRoot,rel))};fromAlias(cj.aliases?.ui),fromAlias(cj.aliases?.components,"/ui")}catch{}candidates.push(resolve(hostAppRoot,"src/components/ui"),resolve(hostAppRoot,"components/ui"),resolve(hostAppRoot,"app/components/ui"));for(let dir of candidates)if(existsSync2(dir))return dir;return null}function installedAddNames(hostAppRoot){let dir=findUiDir(hostAppRoot);if(!dir)return new Set;try{return new Set(readdirSync(dir).filter((f)=>f.endsWith(".tsx")||f.endsWith(".ts")).map((f)=>f.replace(/\.(tsx|ts)$/,"")))}catch{return new Set}}function enrichManifestFromHost(manifest,uiDir){if(!uiDir)return manifest;let addNameOf=addNameIndex(manifest),byFile=new Map,read=(addName)=>{if(byFile.has(addName))return byFile.get(addName)??null;for(let ext of["tsx","ts","jsx","js"]){let path=join4(uiDir,`${addName}.${ext}`);if(!existsSync3(path))continue;let source=readFileSync3(path,"utf8");return byFile.set(addName,source),source}return byFile.set(addName,""),null};return manifest.map((descriptor)=>{if(descriptor.source==="velloo")return descriptor;let source=read(addNameOf(descriptor.id));if(!source||!exportsName(source,descriptor.id))return descriptor;let additions=[...variantPropsFor(source,descriptor.id===descriptor.family),...declaredPropsFor(source,descriptor.id)];if(additions.length===0)return descriptor;let props=[...descriptor.props];for(let addition of additions){let index=props.findIndex((prop)=>prop.name===addition.name);if(index>=0)props[index]={...props[index],...addition};else props.push(addition)}return{...descriptor,props,designModeNotes:appendNote(descriptor.designModeNotes,"Props include variants detected from the app's component source.")}})}function appendNote(current,next){return current?`${current} ${next}`:next}function variantPropsFor(source,primary){let out=[];if(!primary)return out;let variantsAt=source.indexOf("variants:");if(variantsAt<0)return out;let open=source.indexOf("{",variantsAt),block=balancedBlock(source,open);if(!block)return out;for(let[name,value]of objectEntries(block.slice(1,-1))){let values=objectEntries(value.slice(1,-1)).map(([key])=>key);if(values.length===0)continue;out.push({name,type:`${values.map((value)=>JSON.stringify(value)).join(" | ")} | undefined`,optional:!0,control:"enum",enumValues:values,...defaultVariant(source,name)?{defaultValue:defaultVariant(source,name)}:{}})}return out}function defaultVariant(source,name){let at=source.indexOf("defaultVariants:");if(at<0)return;let open=source.indexOf("{",at),block=balancedBlock(source,open);if(!block)return;return objectEntries(block.slice(1,-1)).find(([key])=>key===name)?.[1].replace(/["'`\s]/g,"")}function declaredPropsFor(source,componentId){let match=[new RegExp(`interface\\s+${componentId}Props(?:\\s+extends[^\\{]+)?\\s*\\{`,"m"),new RegExp(`type\\s+${componentId}Props\\s*=.*?&\\s*\\{`,"m")].map((pattern)=>pattern.exec(source)).find(Boolean);if(!match||match.index===void 0)return[];let open=source.indexOf("{",match.index),block=balancedBlock(source,open);if(!block)return[];let out=[],property=/(?:^|[;{\n])\s*([A-Za-z_$][\w$]*)(\?)?\s*:\s*([^;\n}]+)/gm;for(let found of block.slice(1,-1).matchAll(property)){let name=found[1],raw=found[3]?.trim();if(!name||!raw||name==="children")continue;let enumValues=[...raw.matchAll(/["']([^"']+)["']/g)].map((value)=>value[1]),optional=found[2]==="?"||raw.includes("undefined");out.push({name,type:optional&&!raw.includes("undefined")?`${raw} | undefined`:raw,optional,control:enumValues.length>0?"enum":/boolean/.test(raw)?"boolean":/number/.test(raw)?"number":"string",...enumValues.length>0?{enumValues}:{}})}return out}function balancedBlock(source,open){if(open<0||source[open]!=="{")return null;let depth=0,quote="";for(let index=open;index<source.length;index++){let char=source[index],prev=source[index-1];if(quote){if(char===quote&&prev!=="\\")quote="";continue}if(char==='"'||char==="'"||char==="`"){quote=char;continue}if(char==="{")depth++;if(char==="}"&&--depth===0)return source.slice(open,index+1)}return null}function objectEntries(body){let out=[],index=0;while(index<body.length){while(index<body.length&&/[\s,]/.test(body[index]))index++;let keyMatch=/^(?:["']([^"']+)["']|([A-Za-z_$][\w$-]*))\s*:/.exec(body.slice(index));if(!keyMatch)break;let key=keyMatch[1]??keyMatch[2];if(!key)break;index+=keyMatch[0].length;while(/\s/.test(body[index]??""))index++;if(body[index]==="{"){let block=balancedBlock(body,index);if(!block)break;out.push([key,block]),index+=block.length;continue}let end=body.indexOf(",",index),value=body.slice(index,end<0?body.length:end).trim();out.push([key,value]),index=end<0?body.length:end+1}return out}function createProvider(opts={}){let cacheDir=opts.cacheDir,plannedUiDir=cacheDir?join5(cacheDir,"ui"):void 0,hostUiDir=()=>plannedUiDir&&existsSync4(plannedUiDir)?plannedUiDir:opts.hostAppRoot?findUiDir(opts.hostAppRoot):null,componentsDir=componentsDir2,version=opts.version??snapshotVersion2,hostAppRoot=opts.hostAppRoot,loadManifest=async()=>{if(cacheDir&&existsSync4(join5(cacheDir,"manifest.json")))return enrichManifestFromHost(await readManifest(cacheDir),hostUiDir());let{loadManifest:snapshotManifest}=await import("./chunk-pphgrsxa.js");return enrichManifestFromHost(await snapshotManifest(),hostUiDir())};return{id:"shadcn-upstream",version,componentsDir,styleEntryPath:entryCssPath2,registry:registry2,loadManifest,label:`shadcn (upstream @ ${version})`,styleChannel:TAILWIND_CLASSNAME,styleChannels:["tailwind-classname"],mcpIntro:()=>['**This folder targets shadcn/ui with Tailwind.** The canvas imports client-safe components directly from the app, uses named canvas-safe adaptations for portal/state-heavy families, and falls back per component when a host file is missing or cannot compile. Velloo helpers (`Box`, `Heading`, `Text`, `Icon`, `Image`, `Gradient`, `Layer`, `SVG`, `Divider`, `Placeholder`, `Prose`) remain canvas primitives. Style through `update_props { style: "flex gap-4 p-6" }` \u2014 a Tailwind className string. Call `list_components` for the catalog and `component_status` before making a fidelity claim.',""],catalog:async()=>{let manifest=await loadManifest(),addNameOf=addNameIndex(manifest),shadcn=manifest.filter((c)=>c.source!=="velloo"),present=hostAppRoot?installedAddNames(hostAppRoot):new Set;return shadcn.map((c)=>{let addName=addNameOf(c.id);return{id:c.id,installed:present.has(addName),importPath:`@/components/ui/${addName}`}})},canvasBundleSpec:{styleRuntime:{kind:"none"},components:async(ids)=>{let manifest=await loadManifest(),addNameOf=addNameIndex(manifest),sourceById=new Map(manifest.map((entry)=>[entry.id,entry.source])),uiDir=hostUiDir();return ids.flatMap((id)=>{if(sourceById.get(id)==="velloo"){let path=helperSourcePath(id);return path?[{id,sources:[{importPath:path,exportName:id,fidelity:"fallback",note:"Velloo helper used alongside repo-backed shadcn components."}]}]:[]}if(!sourceById.has(id))return[];let addName=addNameOf(id),snapshotPath=join5(componentsDir2,"ui",`${addName}.tsx`);if(CANVAS_ADAPTED_FAMILIES.has(addName))return[{id,sources:[{importPath:snapshotPath,exportName:id,fidelity:"adapted",note:"The app component uses portals or runtime state; Velloo renders its canvas-safe counterpart inline."}]}];let hostPath=uiDir?hostComponentFile(uiDir,addName,id):null;return[{id,sources:[...hostPath?[{importPath:hostPath,exportName:id,fidelity:"exact",preflight:!0,note:"Rendered directly from the app's shadcn source file."}]:[],{importPath:snapshotPath,exportName:id,fidelity:"fallback",note:hostPath?"The app source did not compile for the browser canvas; using the bundled canvas fallback.":"The app does not install this component under this name (it may be renamed in its own file); using the bundled canvas fallback."}]}]})},sourceDirs:()=>{let uiDir=hostUiDir()??plannedUiDir;return uiDir?[uiDir]:[]}}}}var CANVAS_ADAPTED_FAMILIES=new Set(["alert-dialog","calendar","carousel","chart","dialog","dropdown-menu","popover","select","sheet","sonner","tooltip"]);export{createProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-bk8b7f9a.js";import{MCP_SURFACE_MODES,parseMcpSurfaceSelection,withMcpSurfaceUrl,runStdioFormatGate,runStdioMcpProxy}from"./chunk-329e3phg.js";import"./chunk-mq4znqv2.js";import"./chunk-w5rzk6ms.js";import"./chunk-65wb0g7d.js";import{assertLoopbackHost,daemonRoot,DesignFolderFormatError,ensureDaemon,stopDaemon}from"./chunk-k784090q.js";import{FOLDER_ARG_DESCRIPTION,resolveDesignFolder}from"./chunk-8ssr8a8w.js";import"./chunk-s23gtejf.js";import{upgradeFolder}from"./chunk-y0zxzefg.js";import"./chunk-1bywxgc5.js";import"./chunk-2z0k59hz.js";import{traceEnabled}from"./chunk-6tx68d90.js";import{defineCommand}from"./chunk-2smsg2ct.js";import{join}from"path";async function serveFormatGate(err){console.error(`velloo mcp: ${err.message.slice(8)}`),console.error("velloo mcp: serving the upgrade gate over MCP instead of the design tools.");let closing=!1,shutdown=async(close)=>{if(closing)return;closing=!0,await close?.(),process.exit(0)},gate=await runStdioFormatGate({root:err.root,found:err.found,current:err.current,upgrade:err.found<err.current?async()=>(await stopDaemon(daemonRoot(err.root)),upgradeFolder(err.root)):void 0,onExit:()=>void shutdown()});return process.on("SIGINT",()=>void shutdown(gate.close)),process.on("SIGTERM",()=>void shutdown(gate.close)),process.stdin.on("end",()=>void shutdown(gate.close)),process.stdin.on("close",()=>void shutdown(gate.close)),await new Promise(()=>{})}var mcp_default=defineCommand({meta:{name:"mcp",description:"Connect this agent to the folder's canvas over MCP (stdio by default). Usually spawned by your agent."},args:{folder:{type:"positional",required:!1,description:FOLDER_ARG_DESCRIPTION},http:{type:"boolean",default:!1,description:"Print the daemon's HTTP MCP URL instead of bridging over stdio"},port:{type:"string",description:"Preferred canvas port when starting the daemon fresh (default 7300)"},host:{type:"string",description:"Loopback bind hostname: 127.0.0.1 (default), localhost or ::1"},surface:{type:"string",description:`Tool surface: ${MCP_SURFACE_MODES.join(", ")} (default guided; env VELLOO_MCP_SURFACE)`}},async run({args}){assertLoopbackHost(args.host??"127.0.0.1");let folder=await resolveDesignFolder(args.folder,"mcp"),preferredPort=args.port?Number(args.port):void 0,parsedSurface=parseMcpSurfaceSelection(args.surface??process.env.VELLOO_MCP_SURFACE);if(!parsedSurface.ok)throw Error(`velloo mcp: ${parsedSurface.error}`);let surface=parsedSurface.selection,spawned=!1,rec;try{rec=await ensureDaemon(folder,{preferredPort,host:args.host,onSpawn:()=>{spawned=!0}})}catch(err){if(err instanceof DesignFolderFormatError&&!args.http)await serveFormatGate(err);throw err}if(traceEnabled())console.error(spawned?`velloo: \u29BF trace recording ON \u2014 tapes \u2192 ${join(folder,".velloo","trace")} (view with \`velloo trace\`)`:"velloo: VELLOO_TRACE is set, but attached to an already-running canvas \u2014 recording is only active if that daemon was started trace-enabled (`velloo stop` then reconnect to force a fresh one).");if(args.http){let selectedUrl=withMcpSurfaceUrl(rec.mcpUrl,surface);console.log(`velloo: canvas at ${rec.canvasUrl}`),console.log(`velloo: MCP server at ${selectedUrl} (point your AI agent here)`),console.log("velloo: it keeps running in the background \u2014 `velloo stop` to stop it.");return}console.error(`velloo: bridging MCP to the canvas at ${rec.canvasUrl}`);let closing=!1,shutdown=async(close)=>{if(closing)return;closing=!0,await close?.(),process.exit(0)},proxy=await runStdioMcpProxy(withMcpSurfaceUrl(rec.mcpUrl,surface),{onExit:()=>void shutdown(),rediscover:async()=>{try{let fresh=await ensureDaemon(folder,{preferredPort,host:args.host});return withMcpSurfaceUrl(fresh.mcpUrl,surface)}catch{return null}}});process.on("SIGINT",()=>void shutdown(proxy.close)),process.on("SIGTERM",()=>void shutdown(proxy.close)),process.stdin.on("end",()=>void shutdown(proxy.close)),process.stdin.on("close",()=>void shutdown(proxy.close)),await new Promise(()=>{})}});export{mcp_default as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var package_default={name:"@velloo/cli",version:"0.1.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.1.0 (f18ce63-dirty \xB7 2026-09-15)",BUILD_TIME_MS=1789490581891;
|
|
3
|
+
export{PACKAGE_VERSION,TOOL_VERSION,BUILD_TIME_MS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-mq4znqv2.js";import"./chunk-bk8b7f9a.js";import{normalizeCloudUrl,loadCredential,deleteCredential,clearCredentials}from"./chunk-b7j86xq7.js";import{defaultCloudUrl}from"./chunk-2z0k59hz.js";import{defineCommand}from"./chunk-2smsg2ct.js";var logout_default=defineCommand({meta:{name:"logout",description:"Log out of velloo-cloud (removes the saved CLI token)"},args:{url:{type:"string",description:"velloo-cloud base URL (default: $VELLOO_CLOUD_URL or the built-in default)"},all:{type:"boolean",default:!1,description:"Remove saved credentials for every cloud"}},async run({args}){if(args.all){let count=await clearCredentials();console.log(count>0?`velloo logout: removed credentials for ${count} cloud${count===1?"":"s"}`:"velloo logout: no saved credentials");return}let cloudUrl=args.url?normalizeCloudUrl(args.url):defaultCloudUrl(),existing=await loadCredential(cloudUrl);if(await deleteCredential(cloudUrl))console.log(`velloo logout: logged out of ${cloudUrl}${existing?.email?` (${existing.email})`:""}`);else console.log(`velloo logout: not logged in to ${cloudUrl}`)}});export{logout_default as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-bk8b7f9a.js";import"./chunk-329e3phg.js";import"./chunk-mq4znqv2.js";import"./chunk-w5rzk6ms.js";import"./chunk-65wb0g7d.js";import{daemonRoot,listDaemons,stopDaemon}from"./chunk-k784090q.js";import{FOLDER_ARG_DESCRIPTION,resolveDesignFolder}from"./chunk-8ssr8a8w.js";import"./chunk-s23gtejf.js";import{projectLabel}from"./chunk-1bywxgc5.js";import"./chunk-2z0k59hz.js";import{require_picocolors}from"./chunk-jrsknzjt.js";import{__toESM,defineCommand}from"./chunk-2smsg2ct.js";var import_picocolors=__toESM(require_picocolors(),1);var stop_default=defineCommand({meta:{name:"stop",description:"Stop the persistent canvas daemon for a folder (or --all)"},args:{folder:{type:"positional",required:!1,description:FOLDER_ARG_DESCRIPTION},all:{type:"boolean",default:!1,description:"Stop every running velloo canvas daemon on this machine"}},async run({args}){if(args.all){let daemons=await listDaemons();if(daemons.length===0){console.log("velloo: no canvas daemons running.");return}for(let d of daemons)await stopDaemon(d.root),console.log(`velloo: stopped ${d.canvasUrl} (${d.root})`);return}let folder=await resolveDesignFolder(args.folder,"stop"),root=daemonRoot(folder);if(await stopDaemon(root)){console.log(`velloo: stopped canvas for ${root}`);return}console.log(`velloo: no canvas running for ${root}`);let others=await listDaemons();if(others.length===0)return;console.log(import_picocolors.default.dim(` ${others.length} canvas${others.length===1?"":"es"} running elsewhere \u2014 stop one by path, or \`velloo stop --all\`:`));for(let d of others)console.log(import_picocolors.default.dim(` ${d.canvasUrl} ${await projectLabel(d.root)??d.root}`))}});export{stop_default as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{spinner}from"./chunk-8ssr8a8w.js";import{stderr}from"process";function createProgress(options={}){let output=options.output??stderr,silent=options.silent===!0,interactive=options.interactive??(Boolean(output.isTTY)&&process.env.CI===void 0),makeSpinner=options.createSpinner??((stream)=>spinner({output:stream,indicator:"dots",withGuide:!1})),active=!1,current="",lastPrinted="",live=null,writeLine=(message)=>{if(!message||message===lastPrinted)return;output.write(` ${message}
|
|
3
|
+
`),lastPrinted=message},begin=(message)=>{if(active=!0,current=message,silent)return;if(interactive)live=makeSpinner(output),live.start(message);else writeLine(message)};return{start(message){if(active){this.step(message);return}begin(message)},step(message,stepOptions={}){if(!active){begin(message);return}if(current=message,silent)return;if(interactive)live?.message(message);else if(!stepOptions.transient)writeLine(message)},succeed(message=current){if(!active)return;if(active=!1,current=message,silent)return;if(interactive)live?.stop(message);else writeLine(message);live=null},fail(message=current){if(!active)return;if(active=!1,current=message,silent)return;if(interactive)live?.error(message);else writeLine(message);live=null},log(message){if(silent)return;if(interactive&&active){live?.clear(),writeLine(message),live=makeSpinner(output),live.start(current);return}writeLine(message)}}}
|
|
4
|
+
export{createProgress};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{COMMANDS}from"./chunk-1yhc252b.js";var SHELLS=["zsh","bash","fish"],zshName=(name)=>name.replace(/\\/g,"\\\\").replace(/:/g,"\\:");function zshScript(specs){let commandLines=specs.map((c)=>` '${zshName(c.name)}:${c.description}'`).join(`
|
|
3
|
+
`),cases=specs.map((c)=>{let flagSpecs=c.flags.map((f)=>` '${f.flag}${f.takesValue?"=":""}[${f.description}]'`).join(" \\\n"),body=flagSpecs?` _arguments \\
|
|
4
|
+
${flagSpecs} \\
|
|
5
|
+
'*:file:_files'`:" _files";return` ${c.name})
|
|
6
|
+
${body}
|
|
7
|
+
;;`}).join(`
|
|
8
|
+
`);return`#compdef velloo
|
|
9
|
+
# velloo shell completions (zsh) \u2014 generated by \`velloo completions\`.
|
|
10
|
+
_velloo() {
|
|
11
|
+
local -a _velloo_commands
|
|
12
|
+
_velloo_commands=(
|
|
13
|
+
${commandLines}
|
|
14
|
+
)
|
|
15
|
+
if (( CURRENT == 2 )); then
|
|
16
|
+
_describe 'velloo command' _velloo_commands
|
|
17
|
+
return
|
|
18
|
+
fi
|
|
19
|
+
case $words[2] in
|
|
20
|
+
${cases}
|
|
21
|
+
esac
|
|
22
|
+
}
|
|
23
|
+
if ! (( $+functions[compdef] )); then
|
|
24
|
+
autoload -Uz compinit && compinit -i
|
|
25
|
+
fi
|
|
26
|
+
compdef _velloo velloo
|
|
27
|
+
`}function bashScript(specs){let names=specs.map((c)=>c.name).join(" "),cases=specs.map((c)=>` ${c.name}) flags="${c.flags.map((f)=>f.flag).join(" ")}" ;;`).join(`
|
|
28
|
+
`);return`# velloo shell completions (bash) \u2014 generated by \`velloo completions\`.
|
|
29
|
+
_velloo() {
|
|
30
|
+
local cur cmd flags
|
|
31
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
32
|
+
cmd="\${COMP_WORDS[1]}"
|
|
33
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
34
|
+
COMPREPLY=( $(compgen -W "${names}" -- "$cur") )
|
|
35
|
+
return
|
|
36
|
+
fi
|
|
37
|
+
flags=""
|
|
38
|
+
case "$cmd" in
|
|
39
|
+
${cases}
|
|
40
|
+
esac
|
|
41
|
+
if [[ "$cur" == -* && -n "$flags" ]]; then
|
|
42
|
+
COMPREPLY=( $(compgen -W "$flags" -- "$cur") )
|
|
43
|
+
fi
|
|
44
|
+
}
|
|
45
|
+
complete -o default -F _velloo velloo
|
|
46
|
+
`}function fishScript(specs){let lines=["# velloo shell completions (fish) \u2014 generated by `velloo completions`."];for(let c of specs){lines.push(`complete -c velloo -f -n "__fish_use_subcommand" -a "${c.name}" -d "${c.description}"`);for(let f of c.flags){let long=f.flag.replace(/^--/,"");lines.push(`complete -c velloo -n "__fish_seen_subcommand_from ${c.name}" -l ${long}${f.takesValue?" -r":""} -d "${f.description}"`)}}return`${lines.join(`
|
|
47
|
+
`)}
|
|
48
|
+
`}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(`
|
|
49
|
+
`)[0]?.replace(/['"[\]:`$\\]/g,"").trim()??""}async function commandSpecs(){let out=[];for(let[name,load]of Object.entries(COMMANDS)){if(name.startsWith("__"))continue;let meta,args;try{let cmd=await resolvable(load);meta=cmd.meta?await resolvable(cmd.meta):void 0,args=cmd.args?await resolvable(cmd.args):{}}catch{continue}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})}out.push({name,description:sanitize(meta?.description),flags})}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(`
|
|
50
|
+
`)||rc===""?"":`
|
|
51
|
+
`}${line}
|
|
52
|
+
`),rcUpdated=!0}}return{shell,scriptPath,rcPath,rcUpdated}}
|
|
53
|
+
export{SHELLS,completionScript,commandSpecs,detectShell,completionsInstalled,installCompletions};
|