[{"data":1,"prerenderedAt":350,"buildId":351},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Fintegrations\u002Fstudio":3},{"id":4,"title":5,"body":6,"description":332,"extension":333,"frontmatter":334,"heading":5,"meta":341,"navigation":343,"order":338,"path":344,"seo":345,"sitemap":346,"source":347,"stem":348,"__hash__":349},"docs\u002Fdocs\u002F5.x\u002Fintegrations\u002Fstudio.md","Connect a project to Kubb Studio",{"type":7,"value":8,"toc":323},"minimark",[9,23,28,105,110,113,135,138,142,145,206,218,222,225,237,265,269,306,313],[10,11,12,17,18,22],"p",{},[13,14,16],"a",{"href":15},"https:\u002F\u002Fkubb.studio","Kubb Studio"," lets you generate and review your project's clients, types, schemas, hooks, and mocks from the browser. ",[19,20,21],"code",{},"kubb studio"," connects your project as an agent: Studio sends the job, and Kubb runs on your machine.",[10,24,25,27],{},[19,26,21],{}," needs Kubb 5.11.6 or later. Studio refuses older agents. Pick the agent that fits:",[29,30,31,47],"table",{},[32,33,34],"thead",{},[35,36,37,41,44],"tr",{},[38,39,40],"th",{},"Agent",[38,42,43],{},"Runs on",[38,45,46],{},"Use it for",[48,49,50,63,77,88],"tbody",{},[35,51,52,57,60],{},[53,54,55],"td",{},[19,56,21],{},[53,58,59],{},"Your machine",[53,61,62],{},"Your own project",[35,64,65,71,74],{},[53,66,67],{},[13,68,70],{"href":69},"https:\u002F\u002Fhub.docker.com\u002Fr\u002Fkubblabs\u002Fkubb-agent","Docker agent",[53,72,73],{},"Your infrastructure",[53,75,76],{},"A team connection that stays up. An organization admin approves its pairing code.",[35,78,79,82,85],{},[53,80,81],{},"Shared sandbox",[53,83,84],{},"Studio",[53,86,87],{},"A quick trial, with a spec you are fine sharing",[35,89,90,95,98],{},[53,91,92],{},[19,93,94],{},"kubb studio snapshot",[53,96,97],{},"CI",[53,99,100,101],{},"A package per pull request: ",[13,102,104],{"href":103},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci","CI snapshots",[106,107,109],"h2",{"id":108},"connect-your-project","Connect your project",[10,111,112],{},"Run this in your project folder:",[114,115,119],"pre",{"language":116,"filename":117,"code":21,"class":118},"shell","Terminal","highlights",[19,120,122],{"class":121},"language-shell",[123,124,127,131],"span",{"class":125,"style":126},"line","display: inline",[123,128,130],{"style":129},"color:#6f42c1;--hls-dark:#b392f0","kubb ",[123,132,134],{"style":133},"color:#24292e;--hls-dark:#e1e4e8","studio",[10,136,137],{},"Approve the pairing code in Studio and answer the permission prompts. Keep the command running, select the agent in Studio, and generate. Each project folder pairs as its own agent.",[106,139,141],{"id":140},"permissions","Choose permissions",[10,143,144],{},"Every permission is off by default. Without any, Studio sees file paths, progress, and a hash of each generated file, and the agent never uploads a local spec. The CLI remembers your answers per project.",[29,146,147,157],{},[32,148,149],{},[35,150,151,154],{},[38,152,153],{},"Flag",[38,155,156],{},"Lets Studio",[48,158,159,169,179,189],{},[35,160,161,166],{},[53,162,163],{},[19,164,165],{},"--allow-read",[53,167,168],{},"Read generated file contents and diffs.",[35,170,171,176],{},[53,172,173],{},[19,174,175],{},"--allow-read-ast",[53,177,178],{},"Read the spec as Kubb parsed it.",[35,180,181,186],{},[53,182,183],{},[19,184,185],{},"--allow-write",[53,187,188],{},"Write generated files to your output folder.",[35,190,191,196],{},[53,192,193],{},[19,194,195],{},"--allow-exec",[53,197,198,199,202,203,205],{},"Run the formatter, the linter, and ",[19,200,201],{},"output.postGenerate",". Needs ",[19,204,185],{}," too.",[10,207,208,209,213,214,217],{},"See ",[13,210,212],{"href":211},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fstudio#permissions","Permissions"," for every flag, such as ",[19,215,216],{},"--allow-config-edit",".",[106,219,221],{"id":220},"review-and-save-generated-files","Review and save generated files",[10,223,224],{},"Connect with both flags to view contents and diffs, then write the files to disk:",[114,226,228],{"language":116,"filename":117,"code":227,"class":118},"kubb studio --allow-read --allow-write",[19,229,230],{"class":121},[123,231,232,234],{"class":125,"style":126},[123,233,130],{"style":129},[123,235,236],{"style":133},"studio --allow-read --allow-write",[238,239,240,247,253],"ul",{},[241,242,243,244,246],"li",{},"Without ",[19,245,185],{},", Kubb stages the files in a temporary folder and leaves your output folder unchanged.",[241,248,249,250,252],{},"With ",[19,251,165],{},", Studio opens your existing output before you generate, so line comments and HTML previews work at once. Each later generation compares with the previous one.",[241,254,255,256,259,260,264],{},"The agent keeps recent generations in ",[19,257,258],{},"node_modules\u002F.cache\u002Fkubb",". See ",[13,261,263],{"href":262},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands#environment-variables","Environment variables"," for the limits.",[106,266,268],{"id":267},"keep-an-agent-running-in-the-background","Keep an agent running in the background",[114,270,272],{"language":116,"filename":117,"code":271,"class":118},"kubb studio start --allow-read # pair if needed, then connect in the background\nkubb studio status # check that the worker is connected\nkubb studio stop # end the background connection",[19,273,274,285,286,285,296],{"class":121},[123,275,276,278,281],{"class":125,"style":126},[123,277,130],{"style":129},[123,279,280],{"style":133},"studio start --allow-read ",[123,282,284],{"style":283},"color:#6a737d;--hls-dark:#6a737d","# pair if needed, then connect in the background","\n",[123,287,288,290,293],{"class":125,"style":126},[123,289,130],{"style":129},[123,291,292],{"style":133},"studio status ",[123,294,295],{"style":283},"# check that the worker is connected",[123,297,298,300,303],{"class":125,"style":126},[123,299,130],{"style":129},[123,301,302],{"style":133},"studio stop ",[123,304,305],{"style":283},"# end the background connection",[10,307,208,308,312],{},[13,309,311],{"href":310},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fstudio#background-connection","Background connection"," for worker states, logs, and restarts.",[314,315,317,318,322],"blockquote",{"as":316},"important","Without a TTY, the CLI skips the permission prompts, so pass the flags the run needs. In CI it does not pair either: use ",[13,319,320],{"href":103},[19,321,94],{}," with a CI API key.",{"title":324,"searchDepth":325,"depth":325,"links":326},"",5,[327,329,330,331],{"id":108,"depth":328,"text":109},2,{"id":140,"depth":328,"text":141},{"id":220,"depth":328,"text":221},{"id":267,"depth":328,"text":268},"Pair a local Kubb project with Kubb Studio, choose what Studio may read and write, review generated code in the browser, and keep an agent running.","md",{"layout":335,"title":5,"description":332,"outline":336,"order":338,"navigation":339},"doc",[328,337],3,1,{"title":16,"icon":340},"i-iconoir-cube",{"layout":335,"outline":342},[328,337],{"title":16,"icon":340},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fstudio",{"title":5,"description":332},{"loc":344},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Fintegrations\u002Fstudio.md","docs\u002F5.x\u002Fintegrations\u002Fstudio","mNk3QZNCXhRG7SsgQ7st_klNJjL_su3TcgdpqP5i5p4",1795727674195,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]