[{"data":1,"prerenderedAt":1124,"buildId":1125},["ShallowReactive",2],{"docs:\u002Fguide\u002Fconfig-files":3},{"page":4,"section":16,"document":17,"credits":10,"prev":1116,"next":1120},{"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},"config-files","\u002Fguide\u002Fconfig-files","guide\u002Fconfig-files.md","Config files","Edit JSON, JSONC and TOML files that agents and people also write, one key at a time, and keep every other byte.",null,[],"i-lucide-file-cog","article",true,3,"guide",{"nodes":18,"toc":1105},[19,35,144,152,169,268,274,285,292,298,378,381,390,396,403,409,456,461,467,581,587,596,599,605,620,626,649,711,716,734,836,842,845,851,860,1020,1030,1036,1048,1099],[20,21,22,23,27,28,27,31,34],"p",{},"Agents keep their settings in files people edit by hand: ",[24,25,26],"code",{},"~\u002F.claude.json",", ",[24,29,30],{},"opencode.jsonc",[24,32,33],{},"~\u002F.codex\u002Fconfig.toml",". skillrc changes one key in such a file and leaves the rest as it was: comments, key order, layout, a byte order mark, line endings and the file's mode.",[36,37,40],"pre",{"language":38,"class":39,"wrap":14},"ts","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,41,43,66,67,66,69,66,100,66,133,66,138],{"class":42},"language-ts",[44,45,48,52,56,59,63],"span",{"class":46,"style":47},"line","display: inline",[44,49,51],{"style":50},"color:#CF222E;--shiki-dark:#FF7B72","import",[44,53,55],{"style":54},"color:#1F2328;--shiki-dark:#E6EDF3"," { editConfigFile } ",[44,57,58],{"style":50},"from",[44,60,62],{"style":61},"color:#0A3069;--shiki-dark:#A5D6FF"," \"skillrc\u002Fio\"",[44,64,65],{"style":54},";","\n",[44,68],{"class":46,"style":47},[44,70,71,74,78,81,85,88,91,94,97],{"class":46,"style":47},[44,72,73],{"style":50},"const",[44,75,77],{"style":76},"color:#0550AE;--shiki-dark:#79C0FF"," result",[44,79,80],{"style":50}," =",[44,82,84],{"style":83},"color:#8250DF;--shiki-dark:#D2A8FF"," editConfigFile",[44,86,87],{"style":54},"(places, ",[44,89,90],{"style":61},"\"\u002Fhome\u002Fme\u002F.claude.json\"",[44,92,93],{"style":54},", () ",[44,95,96],{"style":50},"=>",[44,98,99],{"style":54}," [",[44,101,102,105,108,110,113,116,119,122,125,127,130],{"class":46,"style":47},[44,103,104],{"style":54},"  { path: [",[44,106,107],{"style":61},"\"mcpServers\"",[44,109,27],{"style":54},[44,111,112],{"style":61},"\"github\"",[44,114,115],{"style":54},"], value: { command: ",[44,117,118],{"style":61},"\"npx\"",[44,120,121],{"style":54},", args: [",[44,123,124],{"style":61},"\"-y\"",[44,126,27],{"style":54},[44,128,129],{"style":61},"\"github-mcp\"",[44,131,132],{"style":54},"] } },",[44,134,135],{"class":46,"style":47},[44,136,137],{"style":54},"]);",[44,139,140],{"class":46,"style":47},[44,141,143],{"style":142},"color:#6E7781;--shiki-dark:#8B949E","\u002F\u002F { changed: true }",[145,146,151],"h2",{"id":147,"anchor":148},"edit-a-json-or-jsonc-file",{"label":149,"icon":150},"Section titled \"Edit a JSON or JSONC file\"","#","Edit a JSON or JSONC file",[20,153,154,157,158,161,162,165,166,168],{},[24,155,156],{},"editConfigFile(places, file, plan, options?)"," reads the file and calls ",[24,159,160],{},"plan"," with the object it holds, or ",[24,163,164],{},"undefined"," when the file is missing. ",[24,167,160],{}," returns the edits. skillrc places each one in the text and writes the file once.",[36,170,171],{"language":38,"class":39,"wrap":14},[24,172,173,66,186,66,188,66,209,66,233,66,241,66,263],{"class":42},[44,174,175,177,180,182,184],{"class":46,"style":47},[44,176,51],{"style":50},[44,178,179],{"style":54}," { editConfigFile, valueAt } ",[44,181,58],{"style":50},[44,183,62],{"style":61},[44,185,65],{"style":54},[44,187],{"class":46,"style":47},[44,189,190,193,195,197,200,204,207],{"class":46,"style":47},[44,191,192],{"style":83},"editConfigFile",[44,194,87],{"style":54},[44,196,90],{"style":61},[44,198,199],{"style":54},", (",[44,201,203],{"style":202},"color:#953800;--shiki-dark:#FFA657","root",[44,205,206],{"style":54},") ",[44,208,96],{"style":50},[44,210,211,214,217,219,221,224,227,230],{"class":46,"style":47},[44,212,213],{"style":83},"  valueAt",[44,215,216],{"style":54},"(root, [",[44,218,107],{"style":61},[44,220,27],{"style":54},[44,222,223],{"style":61},"\"old\"",[44,225,226],{"style":54},"]) ",[44,228,229],{"style":50},"===",[44,231,232],{"style":76}," undefined",[44,234,235,238],{"class":46,"style":47},[44,236,237],{"style":50},"    ?",[44,239,240],{"style":54}," []",[44,242,243,246,249,251,253,255,258,260],{"class":46,"style":47},[44,244,245],{"style":50},"    :",[44,247,248],{"style":54}," [{ path: [",[44,250,107],{"style":61},[44,252,27],{"style":54},[44,254,223],{"style":61},[44,256,257],{"style":54},"], value: ",[44,259,164],{"style":76},[44,261,262],{"style":54}," }],",[44,264,265],{"class":46,"style":47},[44,266,267],{"style":54},");",[20,269,270,271,273],{},"An empty list writes nothing. Decide inside ",[24,272,160],{},", not before the call: it gets the object read under the lock, so no other write slips in between.",[20,275,276,277,280,281,284],{},"A ",[24,278,279],{},".jsonc"," file is read as JSONC, which allows comments and trailing commas. Any other file is read as strict JSON. Pass ",[24,282,283],{},"format"," to choose.",[286,287,291],"h3",{"id":288,"anchor":289},"key-edits",{"label":290,"icon":150},"Section titled \"Key edits\"","Key edits",[20,293,276,294,297],{},[24,295,296],{},"KeyEdit"," names a key path from the root and the value to put there.",[299,300,301,314],"table",{},[302,303,304],"thead",{},[305,306,307,311],"tr",{},[308,309,310],"th",{},"Edit",[308,312,313],{},"What it does",[315,316,317,328,338,356,366],"tbody",{},[305,318,319,325],{},[320,321,322],"td",{},[24,323,324],{},"{ path, value }",[320,326,327],{},"Sets the value. Missing objects on the way are created.",[305,329,330,335],{},[320,331,332],{},[24,333,334],{},"{ path, value: undefined }",[320,336,337],{},"Removes the key, with its lines and any comment that trails it",[305,339,340,345],{},[320,341,342],{},[24,343,344],{},"{ path, item, value }",[320,346,347,348,351,352,355],{},"Replaces the item at ",[24,349,350],{},"item"," in the list at ",[24,353,354],{},"path",". An index equal to the list's length adds one.",[305,357,358,363],{},[320,359,360],{},[24,361,362],{},"{ path, item, value: undefined }",[320,364,365],{},"Removes the item",[305,367,368,373],{},[320,369,370],{},[24,371,372],{},"{ path, item, insert: true, value }",[320,374,375,376],{},"Puts the value before the item at ",[24,377,350],{},[20,379,380],{},"A new member copies the layout of its neighbours. In a one-line object it goes on the same line; in a multi-line object it gets its own lines at the same indent.",[36,382,386],{"language":383,"filename":384,"class":385,"wrap":14},"jsonc","before","shiki dark:github-dark-default",[24,387,389],{"class":388},"language-jsonc","{\n  \"theme\": \"dark\", \u002F\u002F mine\n  \"mcpServers\": {}\n}",[36,391,393],{"language":383,"filename":392,"class":385,"wrap":14},"after",[24,394,395],{"class":388},"{\n  \"theme\": \"dark\", \u002F\u002F mine\n  \"mcpServers\": {\n    \"github\": {\n      \"command\": \"npx\"\n    }\n  }\n}",[20,397,398,399,402],{},"After the edits, skillrc parses the result and checks that it holds exactly the edited value. If not, nothing is written and ",[24,400,401],{},"error"," says the edit could not be placed.",[286,404,408],{"id":405,"anchor":406},"the-result",{"label":407,"icon":150},"Section titled \"The result\"","The result",[299,410,411,421],{},[302,412,413],{},[305,414,415,418],{},[308,416,417],{},"Field",[308,419,420],{},"When it is set",[315,422,423,433,447],{},[305,424,425,430],{},[320,426,427],{},[24,428,429],{},"changed",[320,431,432],{},"The file changed, or would in a dry run",[305,434,435,440],{},[320,436,437],{},[24,438,439],{},"skipped",[320,441,442,443,446],{},"Not done this time, and worth trying again: the lock was busy, the file changed meanwhile, or the file is missing and ",[24,444,445],{},"create"," is off",[305,448,449,453],{},[320,450,451],{},[24,452,401],{},[320,454,455],{},"Not done: the file doesn't parse, it repeats a key on the path, or the edit can't be placed",[20,457,458,460],{},[24,459,192],{}," doesn't throw for a file it can't edit, so a sync can report it and go on.",[286,462,466],{"id":463,"anchor":464},"options",{"label":465,"icon":150},"Section titled \"Options\"","Options",[299,468,469,481],{},[302,470,471],{},[305,472,473,476,479],{},[308,474,475],{},"Option",[308,477,478],{},"Default",[308,480,313],{},[315,482,483,501,518,533,547,566],{},[305,484,485,489,492],{},[320,486,487],{},[24,488,283],{},[320,490,491],{},"By extension",[320,493,494,497,498],{},[24,495,496],{},"\"json\""," or ",[24,499,500],{},"\"jsonc\"",[305,502,503,507,512],{},[320,504,505],{},[24,506,445],{},[320,508,509],{},[24,510,511],{},"false",[320,513,514,515],{},"Write a missing file, starting from ",[24,516,517],{},"{}",[305,519,520,525,530],{},[320,521,522],{},[24,523,524],{},"mode",[320,526,527],{},[24,528,529],{},"0o600",[320,531,532],{},"The mode of a file this creates. An existing file keeps its own.",[305,534,535,540,544],{},[320,536,537],{},[24,538,539],{},"dryRun",[320,541,542],{},[24,543,511],{},[320,545,546],{},"Return whether the file would change, and write nothing",[305,548,549,554,559],{},[320,550,551],{},[24,552,553],{},"lock",[320,555,556],{},[24,557,558],{},"true",[320,560,561,562,565],{},"Hold ",[24,563,564],{},"\u003Cfile>.lock"," while editing. Never taken in a dry run.",[305,567,568,573,578],{},[320,569,570],{},[24,571,572],{},"staleMs",[320,574,575],{},[24,576,577],{},"10_000",[320,579,580],{},"How old a lock may be before it is taken as left by a dead process",[145,582,586],{"id":583,"anchor":584},"locks-and-races",{"label":585,"icon":150},"Section titled \"Locks and races\"","Locks and races",[20,588,589,590,592,593,595],{},"Claude Code writes its files through proper-lockfile, which holds a ",[24,591,564],{}," folder. ",[24,594,192],{}," takes the same folder, so the two never write at once. A lock older than 10 seconds is stale and broken.",[20,597,598],{},"The new text goes to a temporary file, then renames over the file only if the file still holds what was read. A program that writes without the lock between that check and the rename still loses its write.",[20,600,601,602,604],{},"A file that is a link is edited at its target. A link to nothing gets an ",[24,603,401],{}," and is left alone.",[20,606,607,610,611,613,614,619],{},[24,608,609],{},"lockFile(file, staleMs?)"," takes the lock on its own. It returns the release, or ",[24,612,164],{}," while another holder has it. The ",[615,616,618],"a",{"href":617},"#toml","TOML"," example below uses it.",[145,621,625],{"id":622,"anchor":623},"read-without-writing",{"label":624,"icon":150},"Section titled \"Read without writing\"","Read without writing",[20,627,628,631,632,27,635,638,639,641,642,645,646,648],{},[24,629,630],{},"readConfigFile(file, format?)"," returns ",[24,633,634],{},"{ root }",[24,636,637],{},"{ error }"," for a file that doesn't parse, or ",[24,640,517],{}," for a missing file. ",[24,643,644],{},"valueAt(root, path)"," walks a key path and returns ",[24,647,164],{}," at the first missing key.",[36,650,651],{"language":38,"class":39,"wrap":14},[24,652,653,66,666,66,668,66,693],{"class":42},[44,654,655,657,660,662,664],{"class":46,"style":47},[44,656,51],{"style":50},[44,658,659],{"style":54}," { readConfigFile, valueAt } ",[44,661,58],{"style":50},[44,663,62],{"style":61},[44,665,65],{"style":54},[44,667],{"class":46,"style":47},[44,669,670,672,675,677,680,683,686,689,691],{"class":46,"style":47},[44,671,73],{"style":50},[44,673,674],{"style":54}," { ",[44,676,203],{"style":76},[44,678,679],{"style":54}," } ",[44,681,682],{"style":50},"=",[44,684,685],{"style":83}," readConfigFile",[44,687,688],{"style":54},"(",[44,690,90],{"style":61},[44,692,267],{"style":54},[44,694,695,697,700,702,705,707,709],{"class":46,"style":47},[44,696,73],{"style":50},[44,698,699],{"style":76}," servers",[44,701,80],{"style":50},[44,703,704],{"style":83}," valueAt",[44,706,216],{"style":54},[44,708,107],{"style":61},[44,710,137],{"style":54},[145,712,618],{"id":713,"anchor":714},"toml",{"label":715,"icon":150},"Section titled \"TOML\"",[20,717,718,719,722,723,726,727,730,731,733],{},"Codex and Grok keep MCP servers in TOML, one ",[24,720,721],{},"[mcp_servers.\u003Cname>]"," table each. ",[24,724,725],{},"setTomlTable(places, text, table, name, value)"," returns the text with that table and its subtables set, or removed when ",[24,728,729],{},"value"," is ",[24,732,164],{},".",[36,735,736],{"language":38,"class":39,"wrap":14},[24,737,738,66,751,66,753,66,778,66,788,66,802,66,807],{"class":42},[44,739,740,742,745,747,749],{"class":46,"style":47},[44,741,51],{"style":50},[44,743,744],{"style":54}," { readTomlTable, setTomlTable } ",[44,746,58],{"style":50},[44,748,62],{"style":61},[44,750,65],{"style":54},[44,752],{"class":46,"style":47},[44,754,755,757,760,762,765,768,771,773,775],{"class":46,"style":47},[44,756,73],{"style":50},[44,758,759],{"style":76}," edited",[44,761,80],{"style":50},[44,763,764],{"style":83}," setTomlTable",[44,766,767],{"style":54},"(places, text, ",[44,769,770],{"style":61},"\"mcp_servers\"",[44,772,27],{"style":54},[44,774,112],{"style":61},[44,776,777],{"style":54},", {",[44,779,780,783,785],{"class":46,"style":47},[44,781,782],{"style":54},"  command: ",[44,784,118],{"style":61},[44,786,787],{"style":54},",",[44,789,790,793,795,797,799],{"class":46,"style":47},[44,791,792],{"style":54},"  args: [",[44,794,124],{"style":61},[44,796,27],{"style":54},[44,798,129],{"style":61},[44,800,801],{"style":54},"],",[44,803,804],{"class":46,"style":47},[44,805,806],{"style":54},"});",[44,808,809,812,815,818,821,824,827,830,833],{"class":46,"style":47},[44,810,811],{"style":50},"if",[44,813,814],{"style":54}," (",[44,816,817],{"style":61},"\"refused\"",[44,819,820],{"style":50}," in",[44,822,823],{"style":54}," edited) ",[44,825,826],{"style":50},"throw",[44,828,829],{"style":50}," new",[44,831,832],{"style":83}," Error",[44,834,835],{"style":54},"(edited.refused);",[36,837,838],{"language":713,"class":385,"wrap":14},[24,839,841],{"class":840},"language-toml","[mcp_servers.github]\ncommand = \"npx\"\nargs = [ \"-y\", \"github-mcp\" ]",[20,843,844],{},"It writes header tables only. It refuses, with the reason, text that doesn't parse, an entry written inline or with dotted keys, and a result that would change another table. A parse error says where, not what: the text could hold a secret.",[20,846,847,850],{},[24,848,849],{},"readTomlTable(text, table, name)"," reads one entry back, and throws when the text doesn't parse.",[20,852,853,856,857,859],{},[24,854,855],{},"setTomlTable"," works on text. To edit a file, hold the lock and write only if the file is unchanged, as ",[24,858,192],{}," does:",[36,861,862],{"language":38,"class":39,"wrap":14},[24,863,864,66,877,66,879,66,893,66,908,66,915,66,923,66,938,66,968,66,992,66,1002,66,1010,66,1015],{"class":42},[44,865,866,868,871,873,875],{"class":46,"style":47},[44,867,51],{"style":50},[44,869,870],{"style":54}," { lockFile, readText, replaceIfUnchanged, setTomlTable } ",[44,872,58],{"style":50},[44,874,62],{"style":61},[44,876,65],{"style":54},[44,878],{"class":46,"style":47},[44,880,881,883,886,888,891],{"class":46,"style":47},[44,882,73],{"style":50},[44,884,885],{"style":76}," file",[44,887,80],{"style":50},[44,889,890],{"style":61}," \"\u002Fhome\u002Fme\u002F.codex\u002Fconfig.toml\"",[44,892,65],{"style":54},[44,894,895,897,900,902,905],{"class":46,"style":47},[44,896,73],{"style":50},[44,898,899],{"style":76}," release",[44,901,80],{"style":50},[44,903,904],{"style":83}," lockFile",[44,906,907],{"style":54},"(file);",[44,909,910,912],{"class":46,"style":47},[44,911,811],{"style":50},[44,913,914],{"style":54}," (release) {",[44,916,917,920],{"class":46,"style":47},[44,918,919],{"style":50},"  try",[44,921,922],{"style":54}," {",[44,924,925,928,931,933,936],{"class":46,"style":47},[44,926,927],{"style":50},"    const",[44,929,930],{"style":76}," before",[44,932,80],{"style":50},[44,934,935],{"style":83}," readText",[44,937,907],{"style":54},[44,939,940,942,944,946,948,951,954,957,959,961,963,965],{"class":46,"style":47},[44,941,927],{"style":50},[44,943,759],{"style":76},[44,945,80],{"style":50},[44,947,764],{"style":83},[44,949,950],{"style":54},"(places, before ",[44,952,953],{"style":50},"??",[44,955,956],{"style":61}," \"\"",[44,958,27],{"style":54},[44,960,770],{"style":61},[44,962,27],{"style":54},[44,964,112],{"style":61},[44,966,967],{"style":54},", server);",[44,969,970,973,975,978,980,982,985,988,990],{"class":46,"style":47},[44,971,972],{"style":50},"    if",[44,974,814],{"style":54},[44,976,977],{"style":61},"\"text\"",[44,979,820],{"style":50},[44,981,823],{"style":54},[44,983,984],{"style":83},"replaceIfUnchanged",[44,986,987],{"style":54},"(places, file, before, edited.text, ",[44,989,529],{"style":76},[44,991,267],{"style":54},[44,993,994,997,1000],{"class":46,"style":47},[44,995,996],{"style":54},"  } ",[44,998,999],{"style":50},"finally",[44,1001,922],{"style":54},[44,1003,1004,1007],{"class":46,"style":47},[44,1005,1006],{"style":83},"    release",[44,1008,1009],{"style":54},"();",[44,1011,1012],{"class":46,"style":47},[44,1013,1014],{"style":54},"  }",[44,1016,1017],{"class":46,"style":47},[44,1018,1019],{"style":54},"}",[20,1021,1022,631,1024,1026,1027,733],{},[24,1023,984],{},[24,1025,511],{}," when the file changed after ",[24,1028,1029],{},"readText",[145,1031,1035],{"id":1032,"anchor":1033},"hand-written-manifests",{"label":1034,"icon":150},"Section titled \"Hand-written manifests\"","Hand-written manifests",[20,1037,1038,1041,1042,1044,1045,1047],{},[24,1039,1040],{},"editJsonText(text, before, after)"," edits JSON text that parses to ",[24,1043,384],{}," so it parses to ",[24,1046,392],{},", changing only the parts that differ. A one-line array stays on one line. Use it for a file your program owns and people edit, such as its own manifest.",[36,1049,1050],{"language":38,"class":39,"wrap":14},[24,1051,1052,66,1065,66,1067],{"class":42},[44,1053,1054,1056,1059,1061,1063],{"class":46,"style":47},[44,1055,51],{"style":50},[44,1057,1058],{"style":54}," { editJsonText } ",[44,1060,58],{"style":50},[44,1062,62],{"style":61},[44,1064,65],{"style":54},[44,1066],{"class":46,"style":47},[44,1068,1069,1071,1074,1076,1079,1082,1085,1088,1090,1093,1096],{"class":46,"style":47},[44,1070,73],{"style":50},[44,1072,1073],{"style":76}," out",[44,1075,80],{"style":50},[44,1077,1078],{"style":83}," editJsonText",[44,1080,1081],{"style":54},"(text, before, { ",[44,1083,1084],{"style":50},"...",[44,1086,1087],{"style":54},"before, agents: [",[44,1089,1084],{"style":50},[44,1091,1092],{"style":54},"before.agents, ",[44,1094,1095],{"style":61},"\"codex\"",[44,1097,1098],{"style":54},"] });",[20,1100,1101,1102,1104],{},"It returns ",[24,1103,164],{}," for text it can't follow, such as comments. Write the whole file then.",[1106,1112,1113,1114,1115],{"id":147,"depth":1107,"text":151,"children":1108},2,[1109,1110,1111],{"id":288,"depth":15,"text":291},{"id":405,"depth":15,"text":408},{"id":463,"depth":15,"text":466},{"id":583,"depth":1107,"text":586},{"id":622,"depth":1107,"text":625},{"id":713,"depth":1107,"text":618},{"id":1032,"depth":1107,"text":1035},{"path":1117,"title":1118,"description":1119},"\u002Fguide\u002Finstallation","Installation","Install skillrc with fleethosts, name your program, and make a first edit to an agent's config.",{"path":1121,"title":1122,"description":1123},"\u002Fguide\u002Ffetching","Fetching","Fetch git repositories through a cache that works offline, download npm packages with checked integrity and size limits, and hold the sync lock.",1796390515878,"74c0e290-bf28-4a8a-b311-db0be1c3af18"]