[{"data":1,"prerenderedAt":953},["ShallowReactive",2],{"figure-telemetry":3,"menu-audits":6,"menu-decisions":7,"menu-projects":23,"menu-workflows":99,"decision-0004-scripts-architecture":116},{"value":4,"alert":5},"18%",false,[],[8,11,14,17,20],{"label":9,"to":10},"0041 The visitor view becomes its own app, and the portal reads only as a developer platform","\u002Fdecisions\u002F0041-personal-site-splits-from-developer-portal",{"label":12,"to":13},"0040 Visitors land on the front page and toggle to the developer view","\u002Fdecisions\u002F0040-developer-portal-visitor-structure",{"label":15,"to":16},"0039 The developer portal is redesigned for visitors, from a twelve-site benchmark","\u002Fdecisions\u002F0039-developer-portal-benchmark",{"label":18,"to":19},"0038 Marina Roustan's discovery","\u002Fdecisions\u002F0038-marina-roustan-discovery",{"label":21,"to":22},"0013 New linters: the robustness gap is tsconfig and enforcement, not plugins","\u002Fdecisions\u002F0013-linter-coverage",[24,29,60,83],{"labelKey":25,"icon":26,"to":27,"badge":28},"app.menu.allProjects","i-lucide-layers","\u002Fprojects","11",{"labelKey":30,"icon":31,"to":32,"badge":33,"children":34},"app.menu.kinds.apps","i-lucide-app-window","\u002Fprojects?kind=apps","5",[35,40,45,50,55],{"label":36,"icon":31,"to":37,"badge":38,"coverage":39},"developer-portal","\u002Fprojects\u002Fdeveloper-portal","94%",94.37,{"label":41,"icon":31,"to":42,"badge":43,"coverage":44},"huella-legal","\u002Fprojects\u002Fhuella-legal","97%",97.48,{"label":46,"icon":31,"to":47,"badge":48,"coverage":49},"marina-roustan","\u002Fprojects\u002Fmarina-roustan","100%",100,{"label":51,"icon":31,"to":52,"badge":53,"coverage":54},"portfolio","\u002Fprojects\u002Fportfolio","91%",91.31,{"label":56,"icon":31,"to":57,"badge":58,"coverage":59},"wp-editor","\u002Fprojects\u002Fwp-editor","50%",49.89,{"labelKey":61,"icon":62,"to":63,"badge":64,"children":65},"app.menu.kinds.packages","i-lucide-package","\u002Fprojects?kind=packages","4",[66,71,75,80],{"label":67,"icon":62,"to":68,"badge":69,"coverage":70},"configs","\u002Fprojects\u002Fconfigs","76%",75.7,{"label":72,"icon":62,"to":73,"badge":48,"coverage":74},"content","\u002Fprojects\u002Fcontent",99.58,{"label":76,"icon":62,"to":77,"badge":78,"coverage":79},"i18n","\u002Fprojects\u002Fi18n","99%",99.08,{"label":81,"icon":62,"to":82,"badge":48,"coverage":49},"observability","\u002Fprojects\u002Fobservability",{"labelKey":84,"icon":85,"to":86,"badge":87,"children":88},"app.menu.kinds.infrastructure","i-lucide-server","\u002Fprojects?kind=infrastructure","2",[89,94],{"label":90,"icon":85,"to":91,"badge":92,"coverage":93},"scripts","\u002Fprojects\u002Fscripts","79%",78.6,{"label":95,"icon":85,"to":96,"badge":97,"coverage":98},"translations","\u002Fprojects\u002Ftranslations","93%",93.33,[100,103,106,109,112],{"label":101,"to":102},"Huella Legal","\u002Fworkflows\u002Fhuella-legal",{"label":104,"to":105},"Marina Roustan","\u002Fworkflows\u002Fmarina-roustan",{"label":107,"to":108},"Developer portal front door","\u002Fworkflows\u002Fdeveloper-portal-front-door",{"label":110,"to":111},"Huella Legal editorial","\u002Fworkflows\u002Fhuella-legal-editorial",{"labelKey":113,"icon":114,"to":115},"app.menu.newProject","i-lucide-plus","\u002Fworkflows\u002Fnew",{"id":117,"title":118,"body":119,"description":265,"extension":942,"kind":943,"meta":944,"navigation":948,"path":949,"seo":950,"stem":951,"url":943,"verdict":943,"__hash__":952},"docs\u002Fdocs\u002Fdecisions\u002F0004-scripts-architecture.md","🧭 One architecture for the scripts package",{"type":120,"value":121,"toc":934},"minimark",[122,126,131,184,219,223,256,266,407,427,442,498,547,585,618,622,835,839,856,900,903,907],[123,124,118],"h1",{"id":125},"one-architecture-for-the-scripts-package",[127,128,130],"h2",{"id":129},"context","Context",[132,133,134,138,139,142,143,142,146,142,149,152,153,156,157,160,161,164,165,168,169,142,172,175,176,179,180,183],"p",{},[135,136,137],"code",{},"infrastructure\u002Fscripts"," grew one folder per script — ",[135,140,141],{},"issue\u002F",", ",[135,144,145],{},"drift\u002F",[135,147,148],{},"map\u002F",[135,150,151],{},"coverage\u002F",", plus\n",[135,154,155],{},"shared\u002F"," — with no stated hierarchy inside a folder. ",[135,158,159],{},"issue\u002Findex.ts"," consumes only ",[135,162,163],{},"add"," and\n",[135,166,167],{},"pick",", so ",[135,170,171],{},"gh.ts",[135,173,174],{},"git.ts"," and ",[135,177,178],{},"branch.ts"," are reached from somewhere else in the folder and\nnothing says from where or in which direction. The symptoms are concrete: four ",[135,181,182],{},"index.ts"," files with\nfour different shapes, six exit conventions, two output idioms picked per-file rather than per\naudience, and the repo root resolved three separate times three different ways.",[132,185,186,187,190,191,194,195,142,198,175,201,142,204,207,208,175,210,212,213,215,216,218],{},"The proposal on the table was to give every script the same set of subfolders — ",[135,188,189],{},"commands\u002F"," with a\nbarrel index, ",[135,192,193],{},"types\u002F"," or ",[135,196,197],{},"types.ts",[135,199,200],{},"constants.ts",[135,202,203],{},"configs\u002Fenvironment.ts",[135,205,206],{},"helpers\u002F"," — and\nto move ",[135,209,174],{},[135,211,171],{}," into ",[135,214,155],{},", since two ",[135,217,174],{}," files exist today.",[127,220,222],{"id":221},"result","Result",[132,224,225,226,228,229,233,234,237,238,241,242,245,246,248,249,175,252,255],{},"The package is four files short of already being layered, and three of those four are ",[135,227,182],{},".\nClassifying all 21 non-spec files leaves no residue: each is an ",[230,231,232],"strong",{},"entry",", a ",[230,235,236],{},"command",", an\n",[230,239,240],{},"adapter"," or a pure ",[230,243,244],{},"domain"," module. Those four roles become the layout — ",[135,247,182],{}," and the\ncommand at a script folder's root, then ",[135,250,251],{},"adapters\u002F",[135,253,254],{},"domain\u002F"," beneath it:",[257,258,263],"pre",{"className":259,"code":261,"language":262},[260],"language-text","issue\u002F                    drift\u002F                   map\u002F\n  index.ts                  index.ts                 index.ts\n  add.ts                    main.ts                  main.ts\n  pick.ts                   adapters\u002Fgit.ts          adapters\u002Ffiles.ts\n  adapters\u002Fgh.ts            domain\u002Fdetect.ts         domain\u002Fcapabilities.ts\n  adapters\u002Fgit.ts                                    domain\u002Frender.ts\n  adapters\u002Fprompts.ts\n  domain\u002Fbranch.ts\n","text",[135,264,261],{"__ignoreMap":265},"",[267,268,269,288],"table",{},[270,271,272],"thead",{},[273,274,275,279,282,285],"tr",{},[276,277,278],"th",{},"Layer",[276,280,281],{},"What it is",[276,283,284],{},"Where",[276,286,287],{},"May import",[289,290,291,314,334,373],"tbody",{},[273,292,293,296,303,308],{},[294,295,232],"td",{},[294,297,298,299,302],{},"Hands its commands to ",[135,300,301],{},"run"," and nothing else",[294,304,305,306],{},"always ",[135,307,182],{},[294,309,310,313],{},[135,311,312],{},"shared\u002Fcli.ts"," + its own commands",[273,315,316,318,321,328],{},[294,317,236],{},[294,319,320],{},"One user-facing invocation: orchestration, prompts, output, exit meaning",[294,322,323,324,327],{},"the folder root — ",[135,325,326],{},"main.ts",", or one file per subcommand",[294,329,330,331],{},"anything in its own folder, ",[135,332,333],{},"shared\u002F*",[273,335,336,338,341,368],{},[294,337,240],{},[294,339,340],{},"Exactly one door out: subprocess, filesystem, network, terminal",[294,342,343,142,345,348,349,142,351,142,353,142,356,142,359,142,362,142,365],{},[135,344,251],{},[230,346,347],{},"named after the boundary it wraps"," — ",[135,350,174],{},[135,352,171],{},[135,354,355],{},"nx.ts",[135,357,358],{},"cache.ts",[135,360,361],{},"files.ts",[135,363,364],{},"prompts.ts",[135,366,367],{},"io.ts",[294,369,370,371],{},"domain, ",[135,372,333],{},[273,374,375,377,380,400],{},[294,376,244],{},[294,378,379],{},"Pure functions and the types they operate on",[294,381,382,384,385,142,388,142,391,142,394,142,397],{},[135,383,254],{},", named after the noun it computes — ",[135,386,387],{},"branch",[135,389,390],{},"detect",[135,392,393],{},"capabilities",[135,395,396],{},"render",[135,398,399],{},"merge",[294,401,402,403,406],{},"other domain, ",[135,404,405],{},"shared\u002Ferrors.ts",", pure stdlib",[132,408,409,410,413,414,418,419,422,423,426],{},"Direction: ",[230,411,412],{},"entry → command → adapter → domain, never back up and never sideways between script\nfolders."," One scoped exception — a command may import another command in the ",[415,416,417],"em",{},"same"," folder, which\nis what keeps ",[135,420,421],{},"add.ts"," → ",[135,424,425],{},"pick.ts"," legal rather than pushing that prompt into the dispatcher.",[132,428,429,430,433,434,437,438,441],{},"The four roles were first adopted as a ",[230,431,432],{},"naming convention on a flat tree",", documented in the\npackage README, on the grounds that nine directories for 21 files was poor economics and three of\nthem would hold a single file. That was reversed on review, and the reason is worth keeping: the\ncomplaint being answered was ",[415,435,436],{},"\"I open the folder and it's a mess\"",", and a flat ",[135,439,440],{},"add.ts branch.ts gh.ts git.ts index.ts pick.ts prompts.ts"," answers none of \"what can I run\", \"what talks to the\noutside\", \"what's pure\" until you open all seven. A README table that carries structure the\nfilesystem could carry is a table nobody reads. Directory economics is the wrong axis when\nlegibility-without-docs is the requirement — and once the folders exist, the README's layer table\nbecomes redundant, which is the test of whether the layout works.",[132,443,444,445,451,452,455,456,459,460,463,464,467,468,471,472,175,475,478,479,482,483,486,487,490,491,494,495,497],{},"The load-bearing half is the adapter naming rule, because it resolves the question that prompted the\nissue: ",[230,446,447,448,450],{},"two ",[135,449,174],{}," files are correct."," They share one line and have zero export overlap — five of\nthe eight functions have a single caller in ",[135,453,454],{},"drift",", three have a single caller in ",[135,457,458],{},"issue",". What is\ngenuinely shared is ",[135,461,462],{},"git"," itself, so ",[135,465,466],{},"shared\u002Fadapters\u002Fgit.ts"," takes ",[135,469,470],{},"git()",", a memoised lazy\n",[135,473,474],{},"repoRoot()",[135,476,477],{},"at()",", retiring three ",[135,480,481],{},"git rev-parse --show-toplevel"," subprocesses. ",[135,484,485],{},"PROJECT_ROOTS","\n— the only constant in the package that had two homes — goes to ",[135,488,489],{},"shared\u002Fdomain\u002Flayout.ts"," rather\nthan alongside it, because ",[135,492,493],{},"drift\u002Fdomain\u002Fdetect.ts"," is pure and needs it, and a pure file importing\nthe module that shells out to ",[135,496,462],{}," would defeat the point of the layer.",[132,499,500,501,503,504,507,508,142,510,142,513,516,517,519,520,523,524,527,528,142,531,534,535,538,539,542,543,546],{},"Three modules land in ",[135,502,155],{},": ",[135,505,506],{},"cli.ts"," (",[135,509,301],{},[135,511,512],{},"fail",[135,514,515],{},"flag","), which makes every ",[135,518,182],{}," the\nsame three lines and retires the ",[135,521,522],{},"COMMANDS"," dispatch constant without a barrel; ",[135,525,526],{},"errors.ts","\n(",[135,529,530],{},"ExpectedError",[135,532,533],{},"CancelledError","); and ",[135,536,537],{},"adapters\u002Fio.ts",", where ",[135,540,541],{},"isTTY && !CI"," picks clack or plain\nlines behind one ",[135,544,545],{},"out.*"," surface with failures on stderr in both modes.",[132,548,549,550,553,554,557,558,560,561,564,565,568,569,572,573,576,577,580,581,584],{},"The runner turns out to fix four defects that read as style until you look: ",[135,551,552],{},"coverage","'s\nactionable \"run ",[135,555,556],{},"nx run-many -t test:coverage"," first\" reaches the user as an unhandled-rejection\nstack trace, ",[135,559,458],{},"'s usage error goes to ",[415,562,563],{},"stdout"," while exiting 1, ",[135,566,567],{},"map\u002Findex.ts"," calls\n",[135,570,571],{},"process.exit(0)"," immediately after a stdout write that a pipe can truncate, and ",[135,574,575],{},"shared\u002Fadapters\u002Fcache.ts","\nreads ",[135,578,579],{},"--refresh"," from ",[135,582,583],{},"argv"," at module load, so its behaviour depends on module-registry state.",[132,586,587,588,591,592,595,598,599,606,607,610,611,614,615,617],{},"One finding is independent of the layout question: ",[135,589,590],{},"src\u002Fcoverage\u002F"," ",[230,593,594],{},"has never been linted.",[135,596,597],{},"**\u002Fcoverage"," is in ",[600,601,603],"a",{"href":602},"repo:packages\u002Fconfigs\u002Fsrc\u002Feslint\u002Flib\u002Fignores.ts",[135,604,605],{},"baseIgnores",", which is why\nthat folder is the only one using ",[135,608,609],{},"interface"," and semicolon delimiters. The folder is renamed to\n",[135,612,613],{},"coverage-report\u002F","; the ",[135,616,552],{}," script name stays, so nothing outside this package moves.",[127,619,621],{"id":620},"options-considered","Options considered",[267,623,624,634],{},[270,625,626],{},[273,627,628,631],{},[276,629,630],{},"Option",[276,632,633],{},"Why not",[289,635,636,644,654,680,710,739,771,790,799,811],{},[273,637,638,641],{},[294,639,640],{},"The same four layers as a naming convention on a flat tree",[294,642,643],{},"Adopted first, then reversed — see the last paragraph of the Result. It leaves the directory listing saying nothing, which was the original complaint",[273,645,646,651],{},[294,647,648,650],{},[135,649,189],{}," per script",[294,652,653],{},"Three of the four scripts have exactly one command, so it would be a directory holding one file three times. The command sits at the folder root instead, which reads the same and costs nothing: root = what you can run, subdirectories = support",[273,655,656,663],{},[294,657,658,659,662],{},"A ",[135,660,661],{},"commands\u002Findex.ts"," barrel",[294,664,665,666,669,670,672,673,676,677],{},"Buys nothing ",[135,667,668],{},"run({ add, pick })"," doesn't: it renames the dispatch constant rather than removing it, and ",[135,671,421],{}," importing the barrel instead of ",[135,674,675],{},".\u002Fpick.ts"," is a cycle in a graph whose entry uses top-level ",[135,678,679],{},"await",[273,681,682,687],{},[294,683,684,686],{},[135,685,193],{}," folder",[294,688,689,598,692,694,695,697,698,700,701,703,704,706,707,709],{},[135,690,691],{},"**\u002Ftypes",[135,693,605],{}," too, so it would be silently unlinted repo-wide — the exact failure ",[135,696,590],{}," demonstrates, re-created deliberately. It's why the pure layer is ",[135,699,254],{},". ",[135,702,691],{}," was dropped from ",[135,705,605],{}," in #234, so a ",[135,708,193],{}," folder is linted now",[273,711,712,716],{},[294,713,714,650],{},[135,715,197],{},[294,717,718,719,722,723,726,727,730,731,734,735,738],{},"All 14 exported types sit with the function that produces them. ",[135,720,721],{},"BranchType"," is ",[135,724,725],{},"typeof BRANCH_TYPES[number]"," from two lines above it; ",[135,728,729],{},"import type { Doc } from \".\u002Fcapabilities.ts\""," says ",[135,732,733],{},"Doc"," is what the capabilities layer speaks, where ",[135,736,737],{},"from \".\u002Ftypes.ts\""," says nothing",[273,740,741,745],{},[294,742,743],{},[135,744,200],{},[294,746,747,748,700,750,753,754,175,756,758,759,762,763,766,767,770],{},"Exactly one constant had two homes, and it moves to ",[135,749,489],{},[135,751,752],{},"CANCELLED"," exists in ",[135,755,421],{},[135,757,425],{}," with ",[415,760,761],{},"different"," values, so centralising invites merging them and making one message a lie; ",[135,764,765],{},"drift\u002FREADME.md"," cites three thresholds by file; ",[135,768,769],{},"SECTIONS"," is 30 lines of hard-wrapped prose",[273,772,773,777],{},[294,774,775],{},[135,776,203],{},[294,778,779,780,783,784,786,787,789],{},"Two env vars, read on adjacent lines of one file. Also confusing next to ",[135,781,782],{},"@joinery\u002Fconfigs",". The real defect was ",[135,785,358],{},"'s module-load ",[135,788,583],{}," read",[273,791,792,796],{},[294,793,794],{},[135,795,206],{},[294,797,798],{},"Every candidate is private to its file with one to three call sites. \"Helper\" isn't a role — it names the author's uncertainty, and the four layers classify every file without it",[273,800,801,808],{},[294,802,803,804,212,806],{},"Merging both ",[135,805,174],{},[135,807,155],{},[294,809,810],{},"Produces an eight-export module where each caller uses half — the junk drawer this package's CLAUDE.md warns about",[273,812,813,822],{},[294,814,815,816,818,819,821],{},"Unifying ",[135,817,163],{},"\u002F",[135,820,167],{},"'s project prompt",[294,823,824,825,827,828,831,832,834],{},"Different return types and different jobs: ",[135,826,163],{}," offers a ",[415,829,830],{},"none"," option, ",[135,833,167],{}," has the offline fallback. They share one string, which is what gets extracted",[127,836,838],{"id":837},"consequences","Consequences",[132,840,841,842,844,845,847,848,175,850,852,853,855],{},"Unlocks a shape a new script is written into rather than around, and one a stranger can read off a\ndirectory listing: the root says what you can run, ",[135,843,251],{}," is every side effect in the package,\n",[135,846,254],{}," is what a spec can call without a mock. ",[135,849,148],{},[135,851,613],{}," also become\nimportable without a git checkout once ",[135,854,474],{}," is lazy, which is what makes their entry points\ntestable at all.",[132,857,858,859,862,863,866,867,869,870,872,873,175,875,877,878,881,882,142,885,888,889,892,893,899],{},"The direction is still ",[230,860,861],{},"convention, not lint"," — but the folders change what enforcing it costs.\nThe rule was originally deferred because, on a flat tree, it needed a hand-maintained list of which\nfilenames are adapters, which meant a 40-line block in this package's own ",[135,864,865],{},"eslint.config.ts"," and no\npath into ",[135,868,782],{}," without ",[135,871,67],{}," learning the names ",[135,874,421],{},[135,876,425],{},". Against\ndirectories it is a generic glob — ",[135,879,880],{},"**\u002Fdomain\u002F**"," may not import ",[135,883,884],{},"node:fs",[135,886,887],{},"node:child_process"," or\n",[135,890,891],{},"@clack\u002Fprompts"," — which is the same shape as the existing\n",[600,894,896],{"href":895},"repo:packages\u002Fconfigs\u002Fsrc\u002Feslint\u002Flib\u002FcoreIsolation.ts",[135,897,898],{},"coreIsolation.ts"," rule and can live\nbeside it. That's the follow-up.",[132,901,902],{},"Forecloses the flat layout, and costs nine directories, three of which hold a single file. That is\nthe price of the listing being the documentation, and it is the right way round: the README's layer\ntable was deleted when the folders landed.",[127,904,906],{"id":905},"confirmation","Confirmation",[132,908,909,910,912,913,916,917,142,919,921,922,142,924,926,927,933],{},"No automated check — this is the \"convention, not lint\" half of the Consequences above, and stays\nthat way until the ",[135,911,865],{}," rule it names as a follow-up lands. Verified by the folder\nlisting under ",[135,914,915],{},"infrastructure\u002Fscripts\u002Fsrc\u002F"," matching the four-role shape (",[135,918,182],{},[135,920,326],{}," or\none file per subcommand, ",[135,923,251],{},[135,925,254],{},") for every script, and by\n",[600,928,930],{"href":929},"\u002Fwiki\u002F.claude\u002Fskills\u002Fscripts-new-script\u002Fskill",[135,931,932],{},"new-script","'s own verify steps\nrunning clean.",{"title":265,"searchDepth":935,"depth":935,"links":936},2,[937,938,939,940,941],{"id":129,"depth":935,"text":130},{"id":221,"depth":935,"text":222},{"id":620,"depth":935,"text":621},{"id":837,"depth":935,"text":838},{"id":905,"depth":935,"text":906},"md",null,{"issue":945,"status":946,"decision":947},48,"implemented","accepted",true,"\u002Fdocs\u002Fdecisions\u002F0004-scripts-architecture",{"title":118,"description":265},"docs\u002Fdecisions\u002F0004-scripts-architecture","arm5MWbbwYj6r9_ere27gVqdF4Pji4z746jfaK2fhA4",1795478398301]