[{"data":1,"prerenderedAt":522,"buildId":523},["ShallowReactive",2],{"docs:\u002Fguide\u002Fplaces":3},{"page":4,"section":16,"document":17,"credits":10,"prev":514,"next":518},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"places","\u002Fguide\u002Fplaces","guide\u002Fplaces.md","Places","A Places object names your program and its folders. fleethosts writes and reads under that name only.",null,[],"i-lucide-folder-tree","article",true,3,"guide",{"nodes":18,"toc":506},[19,27,128,138,146,220,226,232,238,284,291,298,305,347,372,378,400,440,458,464,470],[20,21,22,23,26],"p",{},"Every function that reads or writes your program's files takes a ",[24,25,8],"code",{},": your program's name, its state folder and its config folder.",[28,29,32],"pre",{"language":30,"class":31,"wrap":14},"ts","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,33,35,58,59,58,61,58,86,58,92,58,94,58,111],{"class":34},"language-ts",[36,37,40,44,48,51,55],"span",{"class":38,"style":39},"line","display: inline",[36,41,43],{"style":42},"color:#CF222E;--shiki-dark:#FF7B72","import",[36,45,47],{"style":46},"color:#1F2328;--shiki-dark:#E6EDF3"," { envName, placePaths, standardPlaces } ",[36,49,50],{"style":42},"from",[36,52,54],{"style":53},"color:#0A3069;--shiki-dark:#A5D6FF"," \"fleethosts\u002Fplaces\"",[36,56,57],{"style":46},";","\n",[36,60],{"class":38,"style":39},[36,62,63,66,70,73,77,80,83],{"class":38,"style":39},[36,64,65],{"style":42},"const",[36,67,69],{"style":68},"color:#0550AE;--shiki-dark:#79C0FF"," places",[36,71,72],{"style":42}," =",[36,74,76],{"style":75},"color:#8250DF;--shiki-dark:#D2A8FF"," standardPlaces",[36,78,79],{"style":46},"(",[36,81,82],{"style":53},"\"mytool\"",[36,84,85],{"style":46},");",[36,87,88],{"class":38,"style":39},[36,89,91],{"style":90},"color:#6E7781;--shiki-dark:#8B949E","\u002F\u002F { program: \"mytool\", state: \"\u002Fhome\u002Fme\u002F.local\u002Fstate\u002Fmytool\", config: \"\u002Fhome\u002Fme\u002F.config\u002Fmytool\" }",[36,93],{"class":38,"style":39},[36,95,96,99,102,105,108],{"class":38,"style":39},[36,97,98],{"style":75},"placePaths",[36,100,101],{"style":46},"(places).",[36,103,104],{"style":75},"hosts",[36,106,107],{"style":46},"(); ",[36,109,110],{"style":90},"\u002F\u002F \"\u002Fhome\u002Fme\u002F.local\u002Fstate\u002Fmytool\u002Fhosts.json\"",[36,112,113,116,119,122,125],{"class":38,"style":39},[36,114,115],{"style":75},"envName",[36,117,118],{"style":46},"(places, ",[36,120,121],{"style":53},"\"SSH\"",[36,123,124],{"style":46},"); ",[36,126,127],{"style":90},"\u002F\u002F \"MYTOOL_SSH\"",[20,129,130,133,134,137],{},[24,131,132],{},"standardPlaces"," is also exported from ",[24,135,136],{},"fleethosts",".",[139,140,145],"h2",{"id":141,"anchor":142},"the-fields",{"label":143,"icon":144},"Section titled \"The fields\"","#","The fields",[147,148,149,162],"table",{},[150,151,152],"thead",{},[153,154,155,159],"tr",{},[156,157,158],"th",{},"Field",[156,160,161],{},"What it is",[163,164,165,176,186,200,210],"tbody",{},[153,166,167,173],{},[168,169,170],"td",{},[24,171,172],{},"program",[168,174,175],{},"The name your program writes under. It names environment variables and temporary folders.",[153,177,178,183],{},[168,179,180],{},[24,181,182],{},"state",[168,184,185],{},"Per-machine state: caches, locks, logs, and the recorded fleet.",[153,187,188,193],{},[168,189,190],{},[24,191,192],{},"config",[168,194,195,196,199],{},"Per-user config, where ",[24,197,198],{},"config.json"," lives.",[153,201,202,207],{},[168,203,204],{},[24,205,206],{},"formerProgram",[168,208,209],{},"Optional. A name the program had before. fleethosts doesn't read it.",[153,211,212,217],{},[168,213,214],{},[24,215,216],{},"legacyHookMark",[168,218,219],{},"Optional. A hook ownership key to keep from an earlier version. fleethosts doesn't read it.",[20,221,222,223,225],{},"A ",[24,224,8],{}," is a plain object, so tests can build one with folders in a temporary directory.",[139,227,231],{"id":228,"anchor":229},"where-the-folders-go",{"label":230,"icon":144},"Section titled \"Where the folders go\"","Where the folders go",[20,233,234,237],{},[24,235,236],{},"standardPlaces(program)"," follows the XDG base directory spec, and the platform's convention where it is unset:",[147,239,240,250],{},[150,241,242],{},[153,243,244,247],{},[156,245,246],{},"Folder",[156,248,249],{},"First match",[163,251,252,269],{},[153,253,254,256],{},[168,255,192],{},[168,257,258,261,262,265,266],{},[24,259,260],{},"$XDG_CONFIG_HOME\u002F\u003Cprogram>",", then ",[24,263,264],{},"%APPDATA%\\\u003Cprogram>"," on Windows, then ",[24,267,268],{},"~\u002F.config\u002F\u003Cprogram>",[153,270,271,273],{},[168,272,182],{},[168,274,275,261,278,265,281],{},[24,276,277],{},"$XDG_STATE_HOME\u002F\u003Cprogram>",[24,279,280],{},"%LOCALAPPDATA%\\\u003Cprogram>",[24,282,283],{},"~\u002F.local\u002Fstate\u002F\u003Cprogram>",[20,285,286,287,290],{},"A relative ",[24,288,289],{},"XDG_*"," path is ignored, as the spec says. The object comes back frozen.",[292,293,297],"h3",{"id":294,"anchor":295},"an-installed-copy",{"label":296,"icon":144},"Section titled \"An installed copy\"","An installed copy",[20,299,300,301,304],{},"A program that installs itself as ",[24,302,303],{},"\u003Cstate>\u002Fapp\u002Fcli.mjs"," can pass that folder as the second argument:",[28,306,307],{"language":30,"class":31,"wrap":14},[24,308,309,58,322,58,324],{"class":34},[36,310,311,313,316,318,320],{"class":38,"style":39},[36,312,43],{"style":42},[36,314,315],{"style":46}," { installedStateDir, standardPlaces } ",[36,317,50],{"style":42},[36,319,54],{"style":53},[36,321,57],{"style":46},[36,323],{"class":38,"style":39},[36,325,326,328,330,332,334,336,338,341,344],{"class":38,"style":39},[36,327,65],{"style":42},[36,329,69],{"style":68},[36,331,72],{"style":42},[36,333,76],{"style":75},[36,335,79],{"style":46},[36,337,82],{"style":53},[36,339,340],{"style":46},", ",[36,342,343],{"style":75},"installedStateDir",[36,345,346],{"style":46},"());",[20,348,349,352,353,356,357,360,361,364,365,368,369,371],{},[24,350,351],{},"installedStateDir()"," returns the state folder when the running script is ",[24,354,355],{},"\u003Cfolder>\u002Fapp\u002Fcli.mjs",", and ",[24,358,359],{},"undefined"," otherwise. ",[24,362,363],{},"XDG_STATE_HOME"," still wins over it. On Windows, an existing ",[24,366,367],{},"state.json"," in ",[24,370,280],{}," keeps that folder; the choice stays fixed for the process.",[139,373,377],{"id":374,"anchor":375},"environment-variables",{"label":376,"icon":144},"Section titled \"Environment variables\"","Environment variables",[20,379,380,383,384,387,388,391,392,395,396,399],{},[24,381,382],{},"envName(places, name)"," gives ",[24,385,386],{},"\u003CPROGRAM>_\u003Cname>",", upper case, with any character outside ",[24,389,390],{},"A-Z"," and ",[24,393,394],{},"0-9"," turned into ",[24,397,398],{},"_",". fleethosts reads two:",[147,401,402,412],{},[150,403,404],{},[153,405,406,409],{},[156,407,408],{},"Variable",[156,410,411],{},"What it changes",[163,413,414,427],{},[153,415,416,421],{},[168,417,418],{},[24,419,420],{},"\u003CPROGRAM>_SSH",[168,422,423,424],{},"The ssh to run instead of ",[24,425,426],{},"ssh",[153,428,429,434],{},[168,430,431],{},[24,432,433],{},"\u003CPROGRAM>_TAILSCALE",[168,435,436,437],{},"The Tailscale CLI to run instead of ",[24,438,439],{},"tailscale",[20,441,442,443,446,447,450,451,454,455,137],{},"A value ending in ",[24,444,445],{},".js"," or ",[24,448,449],{},".mjs"," runs with the current Node, which is how the tests stand in a fake ssh. For ",[24,452,453],{},"desk+tools",", the variable is ",[24,456,457],{},"DESK_TOOLS_SSH",[139,459,463],{"id":460,"anchor":461},"file-paths",{"label":462,"icon":144},"Section titled \"File paths\"","File paths",[20,465,466,469],{},[24,467,468],{},"placePaths(places)"," returns functions that build file paths in the folders. It also takes a function that returns the places, read on every call.",[20,471,472,473,476,477,484,485,340,488,340,491,340,494,391,497,500,501,505],{},"fleethosts itself writes one of them: ",[24,474,475],{},"hosts()",", the fleet ",[478,479,481],"a",{"href":480},"\u002Fguide\u002Fhosts#record-the-fleet",[24,482,483],{},"recordHosts"," keeps. The others name files a program built on fleethosts keeps, such as ",[24,486,487],{},"config()",[24,489,490],{},"state()",[24,492,493],{},"lock()",[24,495,496],{},"cache()",[24,498,499],{},"logs()",". See the ",[478,502,504],{"href":503},"\u002Freference\u002Fapi#placepaths","API reference"," for the full list.",[507,509,512,513],{"id":141,"depth":508,"text":145},2,{"id":228,"depth":508,"text":231,"children":510},[511],{"id":294,"depth":15,"text":297},{"id":374,"depth":508,"text":377},{"id":460,"depth":508,"text":463},{"path":515,"title":516,"description":517},"\u002Fguide\u002Finstallation","Installation","Install fleethosts, give it your program's places, and run a first command on your machines.",{"path":519,"title":520,"description":521},"\u002Fguide\u002Fhosts","Hosts","Check fleet entries, expand Tailscale tags into machines, run one command on each over ssh, and record the fleet.",1796388536397,"7b1f70a7-2953-4287-ada9-b3dc097b349d"]