jsrepo 1.28.3 → 1.28.4

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.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js CHANGED
@@ -73,4 +73,5 @@ ${t.content}
73
73
  ${ft?.()??""}
74
74
  `}});if(process.stdout.write(F),(pe.length>1||R==="")&&(W=t.yes,!t.yes&&!t.no)){let Y=await select({message:"Accept changes?",options:[{label:"Accept",value:"accept"},{label:"Reject",value:"reject"},{label:`\u2728 ${I.yellow("Update with AI")} \u2728`,value:"update"}]});if(isCancel(Y)&&(cancel("Canceled!"),process.exit(0)),Y==="update"){let _=await select({message:"Select a model",options:Object.keys(Sr).map(ke=>({label:ke,value:ke}))});isCancel(_)&&(cancel("Canceled!"),process.exit(0)),A=_;try{O=await Sr[A].updateFile({originalFile:{content:R,path:L},newFile:{content:S,path:q},loading:o,verbose:t.verbose?r:void 0});}catch(ke){o.stop(),log.error(I.red(`Error getting completions: ${ke}`)),process.stdout.write(`${M}
75
75
  `);continue}O=await io({file:{content:O,destPath:y.destPath},biomeOptions:w,prettierOptions:E,config:n}),process.stdout.write(`${M}
76
- `);continue}W=Y==="accept";break}break}}W&&await Tt([{loadingMessage:`Writing changes to ${I.cyan(y.destPath)}`,completedMessage:`Wrote changes to ${I.cyan(y.destPath)}.`,run:async()=>Fe.writeFileSync(y.destPath,O)}],{verbose:t.verbose?r:undefined});}if(n.includeTests&&g.tests){r("Trying to include tests");let{devDependencies:y}=JSON.parse(Fe.readFileSync(X.join(t.cwd,"package.json")).toString());(y===undefined||y.vitest===undefined)&&h.add("vitest");}for(let y of g.devDependencies)h.add(y);for(let y of g.dependencies)b.add(y);}await Tt(l,{verbose:t.verbose?r:undefined});let z=Vt(b,h,{cwd:t.cwd});if(b=z.dependencies,h=z.devDependencies,b.size>0||h.size>0){let g=t.yes;if(!t.yes&&!t.no){let C=await confirm({message:"Would you like to install dependencies?",initialValue:true});isCancel(C)&&(cancel("Canceled!"),process.exit(0)),g=C;}g&&(b.size>0&&(t.verbose||o.start(`Installing dependencies with ${I.cyan(u)}`),(await Ne({pm:u,deps:Array.from(b),dev:false,cwd:t.cwd})).match(C=>{t.verbose||o.stop(`Installed ${I.cyan(C.join(", "))}`);},C=>{t.verbose||o.stop("Failed to install dependencies"),program.error(C);})),h.size>0&&(t.verbose||o.start(`Installing dependencies with ${I.cyan(u)}`),(await Ne({pm:u,deps:Array.from(h),dev:true,cwd:t.cwd})).match(C=>{t.verbose||o.stop(`Installed ${I.cyan(C.join(", "))}`);},C=>{t.verbose||o.stop("Failed to install dev dependencies"),program.error(C);})));let $=[];if(!g){if(b.size>0){let C=resolveCommand(u,"add",[...b]);$.push(`Install dependencies \`${I.cyan(`${C?.command} ${C?.args.join(" ")}`)}\``);}if(h.size>0){let C=resolveCommand(u,"add",[...h,"-D"]);$.push(`Install dev dependencies \`${I.cyan(`${C?.command} ${C?.args.join(" ")}`)}\``);}}$=$.map((C,K)=>`${K+1}. ${C}`),g||$.push(""),$.push("Import and use the blocks!");let T=kt($);process.stdout.write(T);}};var Ir="latest-version",Qs=60*60*1e3,Io=async()=>{try{let e=oe(),t,r=e.get(Ir);if(r){if(r.expiration>Date.now())return t=r.version,x(t);e.delete(Ir);}let o=new AbortController,n=setTimeout(()=>{o.abort();},1e3),s=await fetch("https://raw.githubusercontent.com/ieedan/jsrepo/refs/heads/main/packages/cli/package.json",{signal:o.signal});if(clearTimeout(n),!s.ok)return j("Error getting version");let{version:i}=await s.json();return t=i,e.set(Ir,{expiration:Date.now()+Qs,version:t}),x(t)}catch(e){return j(`Error getting version: ${e}`)}};var Po=e=>{let t=fileURLToPath(import.meta.url);return X.join(t,"../..",e)},{version:To,name:Oo,description:No,repository:ni}=JSON.parse(Fe.readFileSync(Po("package.json"),"utf-8")),si=(await Io()).match(e=>e,()=>{}),ne={package:{name:Oo,description:No,version:To,repository:ni,latestVersion:si},resolveRelativeToRoot:Po},Do=program.name(Oo).description(No).version(To).addCommand(mr).addCommand(hr).addCommand(yr).addCommand($r).addCommand(Cr).addCommand(xr).addCommand(Er);Do.parse();
76
+ `);continue}W=Y==="accept";break}break}}W&&await Tt([{loadingMessage:`Writing changes to ${I.cyan(y.destPath)}`,completedMessage:`Wrote changes to ${I.cyan(y.destPath)}.`,run:async()=>Fe.writeFileSync(y.destPath,O)}],{verbose:t.verbose?r:undefined});}if(n.includeTests&&g.tests){r("Trying to include tests");let{devDependencies:y}=JSON.parse(Fe.readFileSync(X.join(t.cwd,"package.json")).toString());(y===undefined||y.vitest===undefined)&&h.add("vitest");}for(let y of g.devDependencies)h.add(y);for(let y of g.dependencies)b.add(y);}await Tt(l,{verbose:t.verbose?r:undefined});let z=Vt(b,h,{cwd:t.cwd});if(b=z.dependencies,h=z.devDependencies,b.size>0||h.size>0){let g=t.yes;if(!t.yes&&!t.no){let C=await confirm({message:"Would you like to install dependencies?",initialValue:true});isCancel(C)&&(cancel("Canceled!"),process.exit(0)),g=C;}g&&(b.size>0&&(t.verbose||o.start(`Installing dependencies with ${I.cyan(u)}`),(await Ne({pm:u,deps:Array.from(b),dev:false,cwd:t.cwd})).match(C=>{t.verbose||o.stop(`Installed ${I.cyan(C.join(", "))}`);},C=>{t.verbose||o.stop("Failed to install dependencies"),program.error(C);})),h.size>0&&(t.verbose||o.start(`Installing dependencies with ${I.cyan(u)}`),(await Ne({pm:u,deps:Array.from(h),dev:true,cwd:t.cwd})).match(C=>{t.verbose||o.stop(`Installed ${I.cyan(C.join(", "))}`);},C=>{t.verbose||o.stop("Failed to install dev dependencies"),program.error(C);})));let $=[];if(!g){if(b.size>0){let C=resolveCommand(u,"add",[...b]);$.push(`Install dependencies \`${I.cyan(`${C?.command} ${C?.args.join(" ")}`)}\``);}if(h.size>0){let C=resolveCommand(u,"add",[...h,"-D"]);$.push(`Install dev dependencies \`${I.cyan(`${C?.command} ${C?.args.join(" ")}`)}\``);}}$=$.map((C,K)=>`${K+1}. ${C}`),g||$.push(""),$.push("Import and use the blocks!");let T=kt($);process.stdout.write(T);}};var Ir="latest-version",Qs=60*60*1e3,Io=async()=>{try{let e=oe(),t,r=e.get(Ir);if(r){if(r.expiration>Date.now())return t=r.version,x(t);e.delete(Ir);}let o=new AbortController,n=setTimeout(()=>{o.abort();},1e3),s=await fetch("https://raw.githubusercontent.com/ieedan/jsrepo/refs/heads/main/packages/cli/package.json",{signal:o.signal});if(clearTimeout(n),!s.ok)return j("Error getting version");let{version:i}=await s.json();return t=i,e.set(Ir,{expiration:Date.now()+Qs,version:t}),x(t)}catch(e){return j(`Error getting version: ${e}`)}};var Po=e=>{let t=fileURLToPath(import.meta.url);return X.join(t,"../..",e)},{version:To,name:Oo,description:No,repository:ni}=JSON.parse(Fe.readFileSync(Po("package.json"),"utf-8")),si=(await Io()).match(e=>e,()=>{}),ne={package:{name:Oo,description:No,version:To,repository:ni,latestVersion:si},resolveRelativeToRoot:Po},Do=program.name(Oo).description(No).version(To).addCommand(mr).addCommand(hr).addCommand(yr).addCommand($r).addCommand(Cr).addCommand(xr).addCommand(Er);Do.parse();//# sourceMappingURL=index.js.map
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/ascii.ts","../src/utils/blocks/types/result.ts","../src/utils/blocks/utils/map-to-array.ts","../src/utils/blocks/utils/url.ts","../src/utils/config.ts","../src/utils/parse-package-name.ts","../src/utils/build/check.ts","../src/utils/providers.ts","../src/utils/blocks/utils/strip-ansi.ts","../src/utils/blocks/utils/pad.ts","../src/utils/blocks/utils/lines.ts","../src/utils/package.ts","../src/utils/language-support.ts","../src/utils/build/index.ts","../src/utils/context.ts","../src/utils/persisted.ts","../src/utils/blocks.ts","../src/utils/blocks/package-managers/flags.ts","../src/utils/dependencies.ts","../src/utils/files.ts","../src/utils/format.ts","../src/utils/get-watermark.ts","../src/utils/prompts.ts","../src/commands/add.ts","../src/commands/auth.ts","../src/commands/build.ts","../src/commands/exec.ts","../src/commands/init.ts","../src/commands/test.ts","../src/utils/ai.ts","../src/utils/blocks/utils/array-sum.ts","../src/utils/diff.ts","../src/commands/update.ts","../src/utils/get-latest-version.ts","../src/cli.ts","../src/index.ts"],"names":["VERTICAL_LINE","color","HORIZONTAL_LINE","TOP_RIGHT_CORNER","BOTTOM_RIGHT_CORNER","JUNCTION_RIGHT","BOTTOM_LEFT_CORNER","WARN","INFO","ERROR","JSREPO","Result","result","success","failure","fn","val","Ok","err","Err","defaultVal","_","def","message","mapToArray","map","items","key","value","join","segments","s","removeLeadingAndTrailingSlash","segment","newSegment","removeLeadingSlash","removeTrailingSlash","addTrailingSlash","RE_SCOPED","RE_NON_SCOPED","parsePackageName","input","m","ruleLevelSchema","G","rules","block","errors","dep","categories","depCategoryName","depBlockName","depCategory","cat","error","b","categoryName","name","category","options","limit","specifier","chain","searchForDep","listedBlocks","FRAMEWORKS","frameworkDeps","d","frameworkDep","ruleKeySchema","ruleConfigSchema","DEFAULT_CONFIG","runRules","config","ruleConfig","warnings","rule","conf","level","ruleErrors","search","newChain","blockName","depBlock","found","isDependedOn","PROJECT_CONFIG_NAME","REGISTRY_CONFIG_NAME","formatterSchema","pathsSchema","projectConfigSchema","getProjectConfig","cwd","fs","path","registryConfigSchema","getRegistryConfig","resolvePaths","paths","getTsconfig","matcher","createPathsMatcher","newPaths","resolvePath","p","unresolvedPath","getPathForBlock","resolvedPaths","directory","stripAsni","str","ansiRegex","leftPadMin","length","padWith","NEW_LINE_REGEX","get","lines","lineNumbers","prefix","transformed","line","i","os","findNearestPackageJson","startDir","until","packagePath","getPackage","contents","cleanVersion","version","returnShouldInstall","dependencies","devDependencies","tempDeps","tempDevDeps","packageResult","pkg","foundDep","semver","css","fileName","content","code","formatter","prettierOptions","biomeOptions","filePath","biome","Biome","Distribution","html","isSubDir","excludeDeps","dirs","sourceCode","ast","imports","walk","node","enter","n","attr","resolveResult","resolveImports","formatError","json","jsonc","sass","svelte","root","modules","plugin","svg","typescript","blockFile","Project","imp","exps","vue","parsed","compiled","yaml","l","moduleSpecifiers","doNotInstall","deps","localDeps","localDep","resolveLocalImport","tryResolveLocalAlias","resolveRemoteDeps","mod","dropExtension","alias","categoryDir","modPath","fullDir","parsePath","dir","containingPath","absPath","localPath","rest","trimmedBlock","blockSpecifier","template","foundMod","searchForModule","pathResolved","shouldDropExtension","resolutionEquality","pathA","pathB","validExtensions","parsedA","parsedB","pathAWithoutExtension","pathBWithoutExtension","containing","modParsed","newPath","files","file","fileParsed","prettyPath","exemptDeps","filteredDeps","builtinModules","pkgPath","packageDevDependencies","packageDependencies","depInfo","validatePackageName","languages","blockSchema","J","categorySchema","TEST_SUFFIXES","isTestFile","suffix","buildBlocksDirectory","blocksPath","ignore","includeBlocks","includeCategories","excludeBlocks","excludeCategories","doNotListBlocks","doNotListCategories","listBlocks","listCategories","program","categoryPath","ignorable","shouldListCategory","blockDir","transformBlockName","shouldListBlock","lang","resolver","testsPath","f","local","blockFiles","hasTests","localDepsSet","depsSet","devDepsSet","imps","k","v","pruneUnused","pruned","catBlocks","OUTPUT_FILE","Conf","gitProviderErrorMessage","info","github","repoPath","owner","repoName","repo","resourcePath","verbose","url","token","headers","response","fetch","manifest","xe","ref","octokit","Octokit","refs","tags","tag","gitlab","tempRef","last","bitbucket","azure","providerName","project","versionType","httpErrorMessage","http","providers","getProviderInfo","provider","fetchBlocks","repos","blocksMap","getManifestResult","repoIdent","getProviderResult","providerInfo","resolveTree","blockSpecifiers","repoPaths","installed","blocks","tempBlock","subDeps","getInstalled","installedBlocks","resolvedPathsResult","baseDir","blockPath","bun","deno","npm","pnpm","yarn","flags","installDependencies","pm","dev","ignoreWorkspace","args","noWorkspace","add","resolveCommand","execa","templatePattern","resolveLocalDependencyTemplate","destPath","destDir","relative","transformRemoteContent","watermark","literal","resolvedImport","literalRegex","escapeStringRegexp","formatFile","newContent","loadFormatterConfig","lo","configPath","getWatermark","repoUrl","runTasks","tasks","loading","spinner","task","runTasksConcurrently","startMessage","stopMessage","msg","t","boxenDefaultOptions","nextSteps","steps","box","boxen","truncatedList","maxLength","truncated","remaining","newerVersionAvailable","oldVersion","newVersion","detectSync","installCommand","text","_intro","intro","schema","de","Command","blockNames","opts","context","_add","outro","configResult","noConfig","shouldContinue","confirm","isCancel","cancel","mustResolveRepos","resolveAllRepos","resolvedRepos","installingBlockNames","promptResult","multiselect","shortName","blockExists","label","installingBlocks","detect","devDeps","store","zeroConfigKey","zeroConfigParsed","zeroConfig","includeTests","addWatermark","defaultFormatter","select","addedBlocks","overwriteAll","fullSpecifier","shortSpecifier","overwriteBlocks","installing","spec","log","overwrite","getSourceFile","sourceFile","sourcePath","pathFolder","requiredDependencies","install","cmd","step","next","Se","authProviders","auth","Option","_auth","storage","tokenKey","password","IGNORED_DIRS","P","build","_build","mergedVal","outDir","manifestOut","oldCategories","newDirPath","ig","ignoreFile","dirPath","builtCategories","warning","prunedCategories","count","originalPath","we","exec","Argument","script","command","_exec","tempDirBase","tempDirectoryRelative","tempDirectory","packageContent","startIndex","arg","passthroughArgs","runningBlock","Z","init","registries","_initProject","_initRegistry","initialConfig","defaultPathResult","r","confirmResult","promptForProviderConfig","configContent","manifestResult","configurePaths","configuredValue","alreadyInstalled","installAsDevDependency","jsonConfig","buildScript","shouldInstall","runScript","$e","test","_test","tempTestDirectory","cleanUp","testingBlocks","testingBlocksMapped","parsedRepo","testFiles","testFile","tempFile","importDeclaration","moduleSpecifier","newModuleSpecifier","resolved","testCommand","models","originalFile","newFile","apiKey","getApiKey","prompt","createUpdatePrompt","getNextCompletionAnthropic","unwrapCodeFromQuotes","getNextCompletionOpenAI","getNextCompletionOllama","maxTokens","model","first","OpenAI","Anthropic","ollama","quoted","KEY","arraySum","arr","total","item","isWhitespace","trimSingleNewLine","formatDiff","from","to","changes","expand","maxUnchanged","colorRemoved","colorAdded","colorCharsRemoved","colorCharsAdded","onUnchanged","change","lineOffset","linePrefix","hasPreviousChange","hasNextChange","prevLineOffset","ls","shownLines","colorLineChange","colorCharChange","sentence","diffChars","chg","se","update","_update","updatingBlockNames","updatingBlocks","remoteContentResult","originalRemoteContent","remoteContent","acceptedChanges","localContent","diffLines","formattedDiff","totalChanges","a","modelResult","LATEST_VERSION_KEY","EXPIRATION_TIME","getLatestVersion","latestVersion","controller","timeout","ver","resolveRelativeToRoot","dirname","fileURLToPath","description","repository","cli"],"mappings":";yvCAEaA,IAAAA,CAAAA,CAAgBC,EAAM,IAAK,CAAA,QAAG,CAC9BC,CAAAA,EAAAA,CAAkBD,EAAM,IAAK,CAAA,QAAG,CAChCE,CAAAA,EAAAA,CAAmBF,CAAM,CAAA,IAAA,CAAK,QAAG,CAAA,CACjCG,GAAsBH,CAAM,CAAA,IAAA,CAAK,QAAG,CAAA,CACpCI,EAAiBJ,CAAAA,CAAAA,CAAM,IAAK,CAAA,QAAG,EACbA,CAAAA,CAAM,IAAK,CAAA,QAAG,CAChCK,CAAqBL,CAAM,CAAA,IAAA,CAAK,QAAG,CAEnCM,KAAAA,EAAAA,CAAON,CAAM,CAAA,KAAA,CAAM,IAAK,GAAK,CAAA,EAAE,CAAE,CAAA,KAAA,CAAM,QAAQ,CAC/CO,CAAAA,EAAAA,CAAOP,CAAM,CAAA,YAAA,CAAa,KAAM,CAAA,QAAQ,CACxCQ,CAAAA,EAAAA,CAAQR,EAAM,WAAY,CAAA,KAAA,CAAM,SAAS,CAAA,CAEzCS,EAAST,CAAAA,CAAAA,CAAM,GAAI,CAAA,SAAS,EAAE,QAAQ,ECiBnD,IAAMU,EAAN,CAAA,KAAmB,CACD,OAEjB,CAAA,WAAA,CAAYC,CAAuB,CAAA,CAClC,IAAK,CAAA,OAAA,CAAUA,EAChB,CAoCA,MAAgBC,CAAwBC,CAAAA,CAAAA,CAA+B,CACtE,OAAK,IAAK,CAAA,OAAA,CAAQ,EAIXD,CAAAA,CAAAA,CAAQ,KAAK,OAAQ,CAAA,GAAG,CAHvBC,CAAAA,CAAAA,CAAQ,IAAK,CAAA,OAAA,CAAQ,GAAG,CAIjC,CAyBA,GAAOC,CA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AAMD,EAAAA,EAAoB,EAAA,KAAA,CAC/CzjB,GAAQA,CACT,CAAA,IAAG,EACJ,CAAA,CAEM6X,GAAsB,CAC3B,OAAA,CAAS,CACR,IAAA,CAAApV,GACA,WAAAwhB,CAAAA,EAAAA,CACA,OAAA9c,CAAAA,EAAAA,CACA,WAAA+c,EACA,CAAA,aAAA,CAAAR,EACD,CAAA,CACA,sBAAAI,EACD,CAAA,CAEMK,EAAMtV,CAAAA,OAAAA,CACV,KAAKpM,EAAI,CAAA,CACT,WAAYwhB,CAAAA,EAAW,EACvB,OAAQ9c,CAAAA,EAAO,CACf,CAAA,UAAA,CAAoBqN,EAAG,CACvB,CAAA,UAAA,CAAoBsG,EAAI,CAAA,CACxB,WAAoBQ,EAAK,CAAA,CACzB,UAAoBgB,CAAAA,EAAI,EACxB,UAAoBc,CAAAA,EAAI,CACxB,CAAA,UAAA,CAAoBoB,EAAI,CACxB,CAAA,UAAA,CAAoBiE,EAAM,CAAA,CC1C5B0B,GAAI,KAAM,EAAA","file":"index.js","sourcesContent":["import color from 'chalk';\n\nexport const VERTICAL_LINE = color.gray('│');\nexport const HORIZONTAL_LINE = color.gray('─');\nexport const TOP_RIGHT_CORNER = color.gray('┐');\nexport const BOTTOM_RIGHT_CORNER = color.gray('┘');\nexport const JUNCTION_RIGHT = color.gray('├');\nexport const TOP_LEFT_CORNER = color.gray('┌');\nexport const BOTTOM_LEFT_CORNER = color.gray('└');\n\nexport const WARN = color.bgRgb(245, 149, 66).black(' WARN ');\nexport const INFO = color.bgBlueBright.white(' INFO ');\nexport const ERROR = color.bgRedBright.white(' ERROR ');\n\nexport const JSREPO = color.hex('#f7df1e')('jsrepo');\n","/*\n\tjsrepo 1.2.4\n\tInstalled from github/ieedan/std\n\t11-21-2024\n*/\n\n/** This is just a helper type used only within this file */\ntype _Result<T, E> = { ok: true; val: T } | { ok: false; err: E };\n\n/** Result allows you to show to a consumer that a function might throw and force them to handle it.\n *\n * `T` Value type\n *\n * `E` Error type\n *\n * ## Usage\n *\n * ```ts\n * function functionThatMightFail(): Result<T, E>;\n * ```\n *\n * ## Examples\n *\n * ```ts\n * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello, World!\");\n *\n * const result = functionThatMightFail();\n *\n * console.log(result.unwrap()); // \"Hello, World!\"\n * ```\n */\nclass Result<T, E> {\n\tprivate readonly _result: _Result<T, E>;\n\n\tconstructor(result: _Result<T, E>) {\n\t\tthis._result = result;\n\t}\n\n\t/** Allows you to run callbacks based on the result.\n\t *\n\t * @param success callback to be run when result is success\n\t * @param failure callback to be run when result is failure\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.match(\n\t * \t(val) => val,\n\t * \t() => {\n\t * \t\tthrow new Error('oops!')\n\t * \t}\n\t * );\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello, World!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const val = result.match(\n\t * \t(val) => val,\n\t * \t() => {\n\t * \t\tthrow new Error('oops!')\n\t * \t}\n\t * );\n\t *\n\t * console.log(val); // \"Hello, World!\"\n\t * ```\n\t */\n\tmatch<A, B = A>(success: (val: T) => A, failure: (err: E) => B): A | B {\n\t\tif (!this._result.ok) {\n\t\t\treturn failure(this._result.err);\n\t\t}\n\n\t\treturn success(this._result.val);\n\t}\n\n\t/** Maps `Result<T, E>` to `Result<A, E>` using the passed mapping function\n\t *\n\t * @param fn Mapping function\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.map((val) => val.length);\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello, World!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const hello = result.map((val) => val.slice(0, 5));\n\t *\n\t * console.log(hello.unwrap()); // \"Hello\"\n\t * ```\n\t */\n\tmap<A>(fn: (val: T) => A): Result<A, E> {\n\t\treturn this.match(\n\t\t\t(val) => Ok(fn(val)),\n\t\t\t(err) => Err(err)\n\t\t);\n\t}\n\n\t/** In the `Ok` case returns the mapped value using the function else returns `defaultVal`\n\t *\n\t * @param defaultVal Value to be returned when `Err`\n\t * @param fn Mapping function to map in case of `Ok`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.mapOr(1, (val) => val.length);\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"foo\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapOr(1, (val) => val.length);\n\t *\n\t * console.log(length); // 3\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapOr(1, (val) => val.length);\n\t *\n\t * console.log(length); // 1\n\t * ```\n\t */\n\tmapOr<A>(defaultVal: A, fn: (val: T) => A): A {\n\t\treturn this.match(\n\t\t\t(val) => fn(val),\n\t\t\t(_) => defaultVal\n\t\t);\n\t}\n\n\t/** In the `Ok` case returns the mapped value using `fn` else returns value of `def`\n\t *\n\t * @param def Mapping function called when `Err`\n\t * @param fn Mapping function called when `Ok`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.mapOrElse(() => 1, (val) => val.length);\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"foo\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapOrElse(() => 1, (val) => val.length);\n\t *\n\t * console.log(length); // 3\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapOr(() => 1, (val) => val.length);\n\t *\n\t * console.log(length); // 1\n\t * ```\n\t */\n\tmapOrElse<A>(def: (err: E) => A, fn: (val: T) => A): A {\n\t\treturn this.match(\n\t\t\t(val) => fn(val),\n\t\t\t(err) => def(err)\n\t\t);\n\t}\n\n\t/** Maps `Result<T, E>` to `Result<T, A>` using the passed mapping function\n\t *\n\t * @param fn Mapping function\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.mapErr((err) => getCodeMsg(err));\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(10);\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const message = result.mapErr(() => \"Error\");\n\t *\n\t * console.log(message); // \"Error\"\n\t * ```\n\t */\n\tmapErr<A>(fn: (err: E) => A): Result<T, A> {\n\t\treturn this.match(\n\t\t\t(val) => Ok(val),\n\t\t\t(err) => Err(fn(err))\n\t\t);\n\t}\n\n\t/** In the `Err` case returns the mapped value using the function else returns `defaultVal`\n\t *\n\t * @param defaultVal Value to be returned when `Ok`\n\t * @param fn Mapping function to map in case of `Err`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.mapErrOr(\"Should've been error\", (err) => getCodeMsg(err));\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"foo\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const message = result.mapErrOr(\"Should've been error\", () => \"Error\");\n\t *\n\t * console.log(message); // \"Should've been error\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(10);\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const message = result.mapErrOr(\"Should've been error\", () => \"Error\");\n\t *\n\t * console.log(message); // \"Error\"\n\t * ```\n\t */\n\tmapErrOr<A>(defaultVal: A, fn: (err: E) => A): A {\n\t\treturn this.match(\n\t\t\t(_) => defaultVal,\n\t\t\t(err) => fn(err)\n\t\t);\n\t}\n\n\t/** In the `Err` case returns the mapped value using the function else returns value of `def`\n\t *\n\t * @param def Mapping function called when `Ok`\n\t * @param fn Mapping function called when `Err`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.mapErrOrElse(() => \"Value\", (_) => \"Error!\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"foo\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapErrOrElse(() => 1, (val) => val.length);\n\t *\n\t * console.log(length); // 1\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * const length = result.mapOr(() => 1, (val) => val.length);\n\t *\n\t * console.log(length); // 4\n\t * ```\n\t */\n\tmapErrOrElse<A>(def: (val: T) => A, fn: (err: E) => A): A {\n\t\treturn this.match(\n\t\t\t(val) => def(val),\n\t\t\t(err) => fn(err)\n\t\t);\n\t}\n\n\t/** Returns true if result is `Ok`\n\t *\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.isOk();\n\t * ```\n\t */\n\tisOk(): boolean {\n\t\treturn this.match(\n\t\t\t() => true,\n\t\t\t() => false\n\t\t);\n\t}\n\n\t/** Returns true if result is `Err`\n\t *\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.isErr();\n\t * ```\n\t */\n\tisErr(): boolean {\n\t\treturn this.match(\n\t\t\t() => false,\n\t\t\t() => true\n\t\t);\n\t}\n\n\t/** Tries to return value if value is `Err` throws generic error message.\n\t *\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrap();\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrap()); // \"Hello!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * result.unwrap(); // Error: Attempted to call `.unwrap()` on a non `Ok` value.\n\t * ```\n\t */\n\tunwrap(): T {\n\t\treturn this.match(\n\t\t\t(val) => val,\n\t\t\t() => {\n\t\t\t\tthrow new Error('Attempted to call `.unwrap()` on a non `Ok` value.');\n\t\t\t}\n\t\t);\n\t}\n\n\t/** Tries to return err if value is `Ok` throws generic error message.\n\t *\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrapErr();\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * result.unwrapErr(); // Error: Attempted to call `.unwrapErr()` on a non `Err` value.\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapErr()); // \"oops!\"\n\t * ```\n\t */\n\tunwrapErr(): E {\n\t\treturn this.match(\n\t\t\t() => {\n\t\t\t\tthrow new Error('Attempted to call `.unwrapErr()` on a non `Err` value.');\n\t\t\t},\n\t\t\t(err) => err\n\t\t);\n\t}\n\n\t/** Tries to unwrap the value if value is `Err` returns `defaultVal`\n\t *\n\t * @param defaultVal Value to be returned if `Err`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrapOr(7);\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapOr(\"Yellow!\")); // \"Hello!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapOr(\"Yellow!\")); // \"Yellow!\"\n\t * ```\n\t */\n\tunwrapOr(defaultVal: T): T {\n\t\treturn this.match(\n\t\t\t(val) => val,\n\t\t\t(_) => defaultVal\n\t\t);\n\t}\n\n\t/** Tries to unwrap the error if vale is `Ok` returns `defaultVal`\n\t *\n\t * @param defaultVal\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrapErrOr(\"Error\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapErrOr(\"Yellow!\")); // \"Yellow!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapErrOr(\"Yellow!\")); // \"oops!\"\n\t * ```\n\t */\n\tunwrapErrOr(defaultVal: E): E {\n\t\treturn this.match(\n\t\t\t() => defaultVal,\n\t\t\t(err) => err\n\t\t);\n\t}\n\n\t/** Tries to return the value if value is `Err` calls `fn`\n\t *\n\t * @param fn Function called if `Err`\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrapOrElse(() => \"Hello!\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapOrElse(() => \"oops!\")); // \"Hello!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapOrElse(() => \"Hello!\")); // \"Hello!\"\n\t * ```\n\t *\n\t */\n\tunwrapOrElse(fn: (err: E) => T): T {\n\t\treturn this.match(\n\t\t\t(val) => val,\n\t\t\t(err) => fn(err)\n\t\t);\n\t}\n\n\t/** Tries to return the error if value is `Ok` calls `fn`\n\t *\n\t * @param fn Function called if `Ok`\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.unwrapErrOrElse(() => \"Error!\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapErrOrElse(() => \"oops!\")); // \"oops!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.unwrapErrOrElse(() => \"Hello!\")); // \"oops!\"\n\t * ```\n\t *\n\t */\n\tunwrapErrOrElse(fn: (val: T) => E): E {\n\t\treturn this.match(\n\t\t\t(val) => fn(val),\n\t\t\t(err) => err\n\t\t);\n\t}\n\n\t/** Tries to return value if value is `Err` throws custom error message.\n\t *\n\t * @param message Message to show when value is `Err`\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.expect(\"Custom message\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.expect(\"I failed!\")); // \"Hello!\"\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * result.expect(\"I failed!\"); // Error: I failed!\n\t * ```\n\t */\n\texpect(message: string): T {\n\t\treturn this.match(\n\t\t\t(val) => val,\n\t\t\t() => {\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t);\n\t}\n\n\t/** Tries to return error value if value is `Ok` throws custom error message\n\t *\n\t * @param message\n\t * @returns\n\t *\n\t * ## Usage\n\t *\n\t * ```ts\n\t * result.expectErr(\"Custom message\");\n\t * ```\n\t *\n\t * ## Examples\n\t *\n\t * ### When `Ok`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Ok(\"Hello!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.expectErr(\"I failed!\")); // Error: I failed!\n\t * ```\n\t *\n\t * ### When `Err`\n\t *\n\t * ```ts\n\t * const functionThatMightFail = (): Result<string, string> => Err(\"oops!\");\n\t *\n\t * const result = functionThatMightFail();\n\t *\n\t * console.log(result.expectErr(\"I failed!\")); // \"oops!\"\n\t * ```\n\t */\n\texpectErr(message: string): E {\n\t\treturn this.match(\n\t\t\t() => {\n\t\t\t\tthrow new Error(message);\n\t\t\t},\n\t\t\t(err) => err\n\t\t);\n\t}\n}\n\n/** Returns a new `Ok` result type with the provided value\n *\n * @param val Value of the result\n * @returns\n *\n * ## Usage\n *\n * ```ts\n * Ok(true);\n * ```\n *\n * ## Examples\n *\n * ```ts\n * const functionThatCanFail = (condition) => {\n * \tif (condition) {\n * \t\tOk(\"Success\")\n * \t}\n *\n * \treturn Err(\"Failure\");\n * }\n * ```\n */\nconst Ok = <T>(val: T): Result<T, never> => {\n\treturn new Result<T, never>({ ok: true, val });\n};\n\n/** Returns a new `Err` result type with the provided error\n *\n * @param err Error of the result\n * @returns\n *\n * ## Usage\n *\n * ```ts\n * Err(\"I failed!\");\n * ```\n *\n * ## Examples\n *\n * ```ts\n * const functionThatCanFail = (condition) => {\n * \tif (condition) {\n * \t\tOk(\"Success\")\n * \t}\n *\n * \treturn Err(\"Failure\");\n * }\n * ```\n */\nconst Err = <E>(err: E): Result<never, E> => {\n\treturn new Result<never, E>({ ok: false, err });\n};\n\nexport { type Result, Ok, Err };\n","/*\n\tjsrepo 1.2.4\n\tInstalled from github/ieedan/std\n\t11-21-2024\n*/\n\n/** Maps the provided map into an array using the provided mapping function.\n *\n * @param map Map to be entered into an array\n * @param fn A mapping function to transform each pair into an item\n * @returns\n *\n * ## Example\n * ```ts\n * console.log(map); // Map(5) { 0 => 5, 1 => 4, 2 => 3, 3 => 2, 4 => 1 }\n *\n * const arr = mapToArray(map, (_, value) => value);\n *\n * console.log(arr); // [5, 4, 3, 2, 1]\n * ```\n */\nconst mapToArray = <K, V, T>(map: Map<K, V>, fn: (key: K, value: V) => T): T[] => {\n\tconst items: T[] = [];\n\n\tfor (const [key, value] of map) {\n\t\titems.push(fn(key, value));\n\t}\n\n\treturn items;\n};\n\nexport { mapToArray };\n","/*\n\tjsrepo 1.28.2\n\tInstalled from github/ieedan/std\n\t1-23-2025\n*/\n\n/** Joins the segments into a single url correctly handling leading and trailing slashes in each segment.\n *\n * ## Usage\n * ```ts\n * const url = join('https://example.com', '', 'api/', '/examples/');\n *\n * console.log(url); // https://example.com/api/examples\n * ```\n *\n * @param segments\n * @returns\n */\nconst join = (...segments: string[]) => {\n\treturn segments\n\t\t.map((s) => removeLeadingAndTrailingSlash(s))\n\t\t.filter(Boolean)\n\t\t.join('/');\n};\n\n/** Removes the leading and trailing slash from the segment (if they exist)\n * ## Usage\n * ```ts\n * const segment = removeLeadingAndTrailingSlash('/example/');\n *\n * console.log(segment); // 'example'\n * ```\n *\n * @param segment\n * @returns\n */\nconst removeLeadingAndTrailingSlash = (segment: string) => {\n\tconst newSegment = removeLeadingSlash(segment);\n\treturn removeTrailingSlash(newSegment);\n};\n\n/** Adds a leading and trailing to the beginning and end of the segment (if it doesn't already exist)\n *\n * ## Usage\n * ```ts\n * const segment = addLeadingAndTrailingSlash('example');\n *\n * console.log(segment); // '/example/'\n * ```\n *\n * @param segment\n * @returns\n */\nconst addLeadingAndTrailingSlash = (segment: string) => {\n\t// this is a weird case so feel free to handle it however you think it makes the most sense\n\tif (segment === '') return '//';\n\n\tconst newSegment = addLeadingSlash(segment);\n\treturn addTrailingSlash(newSegment);\n};\n\n/** Removes the leading slash from the beginning of the segment (if it exists)\n *\n * ## Usage\n * ```ts\n * const segment = removeLeadingSlash('/example');\n *\n * console.log(segment); // 'example'\n * ```\n *\n * @param segment\n * @returns\n */\nconst removeLeadingSlash = (segment: string): string => {\n\tlet newSegment = segment;\n\tif (newSegment.startsWith('/')) {\n\t\tnewSegment = newSegment.slice(1);\n\t}\n\n\treturn newSegment;\n};\n\n/** Adds a leading slash to the beginning of the segment (if it doesn't already exist)\n *\n * ## Usage\n * ```ts\n * const segment = addLeadingSlash('example');\n *\n * console.log(segment); // '/example'\n * ```\n *\n * @param segment\n * @returns\n */\nconst addLeadingSlash = (segment: string): string => {\n\tlet newSegment = segment;\n\tif (!newSegment.startsWith('/')) {\n\t\tnewSegment = `/${newSegment}`;\n\t}\n\n\treturn newSegment;\n};\n\n/** Removes the trailing slash from the end of the segment (if it exists)\n *\n * ## Usage\n * ```ts\n * const segment = removeTrailingSlash('example/');\n *\n * console.log(segment); // 'example'\n * ```\n * @param segment\n * @returns\n */\nconst removeTrailingSlash = (segment: string): string => {\n\tlet newSegment = segment;\n\tif (newSegment.endsWith('/')) {\n\t\tnewSegment = newSegment.slice(0, newSegment.length - 1);\n\t}\n\n\treturn newSegment;\n};\n\n/** Adds a trailing slash to the end of the segment (if it doesn't already exist)\n *\n * ## Usage\n * ```ts\n * const segment = addTrailingSlash('example');\n *\n * console.log(segment); // 'example/'\n * ```\n *\n * @param segment\n * @returns\n */\nconst addTrailingSlash = (segment: string): string => {\n\tlet newSegment = segment;\n\tif (!newSegment.endsWith('/')) {\n\t\tnewSegment = `${newSegment}/`;\n\t}\n\n\treturn newSegment;\n};\n\n/** Removes the last segment of the url.\n *\n * ## Usage\n * ```ts\n * const url = upOneLevel('/first/second');\n *\n * console.log(url); // '/first'\n * ```\n *\n * @param url\n */\nconst upOneLevel = (url: string): string => {\n\tif (url === '/') return url;\n\n\tconst lastIndex = removeTrailingSlash(url).lastIndexOf('/');\n\n\treturn url.slice(0, url.length - lastIndex - 1);\n};\n\nexport {\n\tjoin,\n\tremoveLeadingSlash,\n\tremoveTrailingSlash,\n\taddTrailingSlash,\n\taddLeadingSlash,\n\taddLeadingAndTrailingSlash,\n\tremoveLeadingAndTrailingSlash,\n\tupOneLevel,\n};\n","import fs from 'node:fs';\nimport { createPathsMatcher, getTsconfig } from 'get-tsconfig';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport type { Block } from './build';\nimport { ruleConfigSchema } from './build/check';\n\nconst PROJECT_CONFIG_NAME = 'jsrepo.json';\nconst REGISTRY_CONFIG_NAME = 'jsrepo-build-config.json';\n\nconst formatterSchema = v.union([v.literal('prettier'), v.literal('biome')]);\n\nconst pathsSchema = v.objectWithRest(\n\t{\n\t\t'*': v.string(),\n\t},\n\tv.string()\n);\n\nexport type Paths = v.InferInput<typeof pathsSchema>;\n\nconst projectConfigSchema = v.object({\n\t$schema: v.string(),\n\trepos: v.optional(v.array(v.string()), []),\n\tincludeTests: v.boolean(),\n\tpaths: pathsSchema,\n\twatermark: v.optional(v.boolean(), true),\n\tformatter: v.optional(formatterSchema),\n});\n\nconst getProjectConfig = (cwd: string): Result<ProjectConfig, string> => {\n\tif (!fs.existsSync(path.join(cwd, PROJECT_CONFIG_NAME))) {\n\t\treturn Err('Could not find your configuration file! Please run `init`.');\n\t}\n\n\tconst config = v.safeParse(\n\t\tprojectConfigSchema,\n\t\tJSON.parse(fs.readFileSync(path.join(cwd, PROJECT_CONFIG_NAME)).toString())\n\t);\n\n\tif (!config.success) {\n\t\treturn Err(`There was an error reading your \\`${PROJECT_CONFIG_NAME}\\` file!`);\n\t}\n\n\treturn Ok(config.output);\n};\n\nexport type ProjectConfig = v.InferOutput<typeof projectConfigSchema>;\n\nexport type Formatter = v.InferOutput<typeof formatterSchema>;\n\nconst registryConfigSchema = v.object({\n\t$schema: v.string(),\n\tdirs: v.array(v.string()),\n\toutputDir: v.optional(v.string()),\n\tincludeBlocks: v.optional(v.array(v.string()), []),\n\tincludeCategories: v.optional(v.array(v.string()), []),\n\texcludeBlocks: v.optional(v.array(v.string()), []),\n\texcludeCategories: v.optional(v.array(v.string()), []),\n\tdoNotListBlocks: v.optional(v.array(v.string()), []),\n\tdoNotListCategories: v.optional(v.array(v.string()), []),\n\tlistBlocks: v.optional(v.array(v.string()), []),\n\tlistCategories: v.optional(v.array(v.string()), []),\n\texcludeDeps: v.optional(v.array(v.string()), []),\n\tpreview: v.optional(v.boolean()),\n\trules: v.optional(ruleConfigSchema),\n});\n\nconst getRegistryConfig = (cwd: string): Result<RegistryConfig | null, string> => {\n\tif (!fs.existsSync(path.join(cwd, REGISTRY_CONFIG_NAME))) {\n\t\treturn Ok(null);\n\t}\n\n\tconst config = v.safeParse(\n\t\tregistryConfigSchema,\n\t\tJSON.parse(fs.readFileSync(path.join(cwd, REGISTRY_CONFIG_NAME)).toString())\n\t);\n\n\tif (!config.success) {\n\t\treturn Err(`There was an error reading your \\`${REGISTRY_CONFIG_NAME}\\` file!`);\n\t}\n\n\treturn Ok(config.output);\n};\n\nexport type RegistryConfig = v.InferOutput<typeof registryConfigSchema>;\n\n/** Resolves the paths relative to the cwd */\nconst resolvePaths = (paths: Paths, cwd: string): Result<Paths, string> => {\n\tlet config = getTsconfig(cwd, 'tsconfig.json');\n\tlet matcher: ((specifier: string) => string[]) | null = null;\n\n\tif (!config) {\n\t\t// if we don't find the config at first check for a jsconfig\n\t\tconfig = getTsconfig(cwd, 'jsconfig.json');\n\t}\n\n\tif (config) {\n\t\tmatcher = createPathsMatcher(config);\n\t}\n\n\tlet newPaths: Paths;\n\n\tif (!paths['*'].startsWith('.')) {\n\t\tif (matcher === null) {\n\t\t\treturn Err(\"Cannot resolve aliases because we couldn't find a tsconfig!\");\n\t\t}\n\n\t\tnewPaths = {\n\t\t\t'*': resolvePath(paths['*'], matcher, cwd),\n\t\t};\n\t} else {\n\t\tnewPaths = {\n\t\t\t'*': path.relative(cwd, path.join(path.resolve(cwd), paths['*'])),\n\t\t};\n\t}\n\n\tfor (const [category, p] of Object.entries(paths)) {\n\t\tif (category === '*') continue; // we already resolved this one\n\n\t\tif (p.startsWith('.')) {\n\t\t\tnewPaths[category] = path.relative(cwd, path.join(path.resolve(cwd), p));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (matcher === null) {\n\t\t\treturn Err(\"Cannot resolve aliases because we couldn't find a tsconfig!\");\n\t\t}\n\n\t\tnewPaths[category] = resolvePath(p, matcher, cwd);\n\t}\n\n\treturn Ok(newPaths);\n};\n\nconst resolvePath = (\n\tunresolvedPath: string,\n\tmatcher: (specifier: string) => string[],\n\tcwd: string\n): string => {\n\tconst paths = matcher(unresolvedPath);\n\n\treturn path.relative(cwd, paths[0]);\n};\n\n/** Gets the path where the block should be installed.\n *\n * @param block\n * @param resolvedPaths\n * @param cwd\n * @returns\n */\nconst getPathForBlock = (block: Block, resolvedPaths: Paths, cwd: string): string => {\n\tlet directory: string;\n\n\tif (resolvedPaths[block.category] !== undefined) {\n\t\tdirectory = path.join(cwd, resolvedPaths[block.category]);\n\t} else {\n\t\tdirectory = path.join(cwd, resolvedPaths['*'], block.category);\n\t}\n\n\treturn directory;\n};\n\nexport {\n\tPROJECT_CONFIG_NAME,\n\tREGISTRY_CONFIG_NAME,\n\tgetProjectConfig,\n\tgetRegistryConfig,\n\tprojectConfigSchema,\n\tregistryConfigSchema,\n\tformatterSchema,\n\tresolvePaths,\n\tgetPathForBlock,\n};\n","/**\n * Adapted from https://github.com/egoist/parse-package-name/blob/main/src/index.ts\n * @module\n */\n\nimport { Err, Ok, type Result } from './blocks/types/result';\n\n// Parsed a scoped package name into name, version, and path.\nconst RE_SCOPED = /^(@[^\\/]+\\/[^@\\/]+)(?:@([^\\/]+))?(\\/.*)?$/;\n// Parsed a non-scoped package name into name, version, path\nconst RE_NON_SCOPED = /^([^@\\/]+)(?:@([^\\/]+))?(\\/.*)?$/;\n\nexport type Package = {\n\t/** Name of the package as it would be installed from npm */\n\tname: string;\n\t/** Version of the package */\n\tversion: string;\n\tpath: string;\n};\n\nconst parsePackageName = (input: string): Result<Package, string> => {\n\tconst m = RE_SCOPED.exec(input) || RE_NON_SCOPED.exec(input);\n\n\tif (!m) return Err(`invalid package name: ${input}`);\n\n\treturn Ok({\n\t\tname: m[1] || '',\n\t\tversion: m[2] || 'latest',\n\t\tpath: m[3] || '',\n\t});\n};\n\nexport { parsePackageName };\n","import color from 'chalk';\nimport * as v from 'valibot';\nimport type { Block, Category } from '.';\nimport * as ascii from '../ascii';\nimport type { RegistryConfig } from '../config';\nimport { parsePackageName } from '../parse-package-name';\n\nconst ruleLevelSchema = v.union([v.literal('off'), v.literal('warn'), v.literal('error')]);\n\nexport type RuleLevel = v.InferInput<typeof ruleLevelSchema>;\n\nexport type CheckOptions = {\n\tcategories: Category[];\n\toptions: (string | number)[];\n\tconfig: RegistryConfig;\n};\n\nexport type Rule = {\n\tdescription: string;\n\tcheck: (block: Block, { categories }: CheckOptions) => string[] | undefined;\n};\n\nconst rules = {\n\t'no-unpinned-dependency': {\n\t\tdescription: 'Require all dependencies to have a pinned version.',\n\t\tcheck: (block) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\tfor (const dep of [...block.dependencies, ...block.devDependencies]) {\n\t\t\t\tif (!dep.includes('@')) {\n\t\t\t\t\terrors.push(`Couldn't find a version to use for ${color.bold(dep)}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n\t'require-local-dependency-exists': {\n\t\tdescription: 'Require all local dependencies to exist.',\n\t\tcheck: (block, { categories }) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\tfor (const dep of block.localDependencies) {\n\t\t\t\tconst [depCategoryName, depBlockName] = dep.split('/');\n\n\t\t\t\tconst depCategory = categories.find(\n\t\t\t\t\t(cat) => cat.name.trim() === depCategoryName.trim()\n\t\t\t\t);\n\n\t\t\t\tconst error = `${color.bold(`${block.category}/${block.name}`)} depends on local dependency ${color.bold(dep)} which doesn't exist`;\n\n\t\t\t\tif (!depCategory) {\n\t\t\t\t\terrors.push(error);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (depCategory.blocks.find((b) => b.name === depBlockName) === undefined) {\n\t\t\t\t\terrors.push(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n\t'no-category-index-file-dependency': {\n\t\tdescription: 'Disallow depending on the index file of a category.',\n\t\tcheck: (block, { categories }) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\tfor (const dep of block.localDependencies) {\n\t\t\t\tconst [categoryName, name] = dep.split('/');\n\n\t\t\t\tif (name !== 'index') continue;\n\n\t\t\t\tconst category = categories.find((cat) => cat.name === categoryName);\n\n\t\t\t\tif (!category) continue;\n\n\t\t\t\tconst depBlock = category.blocks.find((b) => b.name === name);\n\n\t\t\t\tif (!depBlock) continue;\n\n\t\t\t\terrors.push(\n\t\t\t\t\t`${color.bold(`${block.category}/${block.name}`)} depends on ${color.bold(`${categoryName}/${name}`)}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n\t'max-local-dependencies': {\n\t\tdescription: 'Enforces a limit on the amount of local dependencies a block can have.',\n\t\tcheck: (block, { options }) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\tlet limit: number;\n\n\t\t\tif (typeof options[0] !== 'number') {\n\t\t\t\tlimit = 5;\n\t\t\t} else {\n\t\t\t\tlimit = options[0];\n\t\t\t}\n\n\t\t\tif (block.localDependencies.length > limit) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`${color.bold(`${block.category}/${block.name}`)} has too many local dependencies (${color.bold(block.localDependencies.length)}) limit (${color.bold(limit)})`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n\t'no-circular-dependency': {\n\t\tdescription: 'Disallow circular dependencies.',\n\t\tcheck: (block, { categories }) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\tconst specifier = `${block.category}/${block.name}`;\n\n\t\t\tconst chain = searchForDep(specifier, block, categories);\n\n\t\t\tif (chain) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`There is a circular dependency in ${color.bold(specifier)}: ${color.bold(chain.join(' -> '))}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n\t'no-unused-block': {\n\t\tdescription: 'Disallow unused blocks. (Not listed and not a dependency of another block)',\n\t\tcheck: (block, { categories }) => {\n\t\t\tif (block.list) return;\n\n\t\t\tconst specifier = `${block.category}/${block.name}`;\n\n\t\t\tconst listedBlocks = categories.flatMap((cat) => cat.blocks).filter((b) => b.list);\n\n\t\t\tfor (const block of listedBlocks) {\n\t\t\t\tconst chain = searchForDep(specifier, block, categories);\n\n\t\t\t\tif (chain) return;\n\t\t\t}\n\n\t\t\treturn [`${color.bold(specifier)} is unused and will be ${color.bold.red('removed')}`];\n\t\t},\n\t} satisfies Rule,\n\t'no-framework-dependency': {\n\t\tdescription: 'Disallow frameworks (Svelte, Vue, React) as dependencies.',\n\t\tcheck: (block) => {\n\t\t\tconst errors: string[] = [];\n\n\t\t\t// Update this list as needed\n\t\t\t// Use the name of the package not the framework\n\t\t\tconst FRAMEWORKS = new Set([\n\t\t\t\t// svelte\n\t\t\t\t'svelte',\n\t\t\t\t'@sveltejs/kit',\n\n\t\t\t\t// vue\n\t\t\t\t'vue',\n\t\t\t\t'nuxt',\n\n\t\t\t\t// react\n\t\t\t\t'react',\n\t\t\t\t'react-dom',\n\t\t\t\t'next',\n\t\t\t\t'@remix-run/react',\n\n\t\t\t\t// angular\n\t\t\t\t'@angular/core',\n\t\t\t\t'@angular/common',\n\t\t\t\t'@angular/forms',\n\t\t\t\t'@angular/platform-browser',\n\t\t\t\t'@angular/platform-browser-dynamic',\n\t\t\t\t'@angular/router',\n\n\t\t\t\t// misc\n\t\t\t\t'@builder.io/qwik',\n\t\t\t\t'astro',\n\t\t\t\t'solid-js',\n\t\t\t]);\n\n\t\t\tconst frameworkDeps = [...block.devDependencies, ...block.dependencies]\n\t\t\t\t.map((d) => parsePackageName(d).unwrap().name)\n\t\t\t\t.filter((d) => FRAMEWORKS.has(d));\n\n\t\t\tif (frameworkDeps.length > 0) {\n\t\t\t\tfor (const frameworkDep of frameworkDeps) {\n\t\t\t\t\terrors.push(\n\t\t\t\t\t\t`${color.bold(`${block.category}/${block.name}`)} depends on ${color.bold(frameworkDep)} causing it to be installed when added`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn errors.length > 0 ? errors : undefined;\n\t\t},\n\t} satisfies Rule,\n} as const;\n\nconst ruleKeySchema = v.union([\n\tv.literal('no-category-index-file-dependency'),\n\tv.literal('no-unpinned-dependency'),\n\tv.literal('require-local-dependency-exists'),\n\tv.literal('max-local-dependencies'),\n\tv.literal('no-circular-dependency'),\n\tv.literal('no-unused-block'),\n\tv.literal('no-framework-dependency'),\n]);\n\nexport type RuleKey = v.InferInput<typeof ruleKeySchema>;\n\nconst ruleConfigSchema = v.record(\n\truleKeySchema,\n\tv.union([\n\t\truleLevelSchema,\n\t\tv.tupleWithRest(\n\t\t\t[ruleLevelSchema, v.union([v.string(), v.number()])],\n\t\t\tv.union([v.string(), v.number()])\n\t\t),\n\t])\n);\n\nexport type RuleConfig = v.InferInput<typeof ruleConfigSchema>;\n\nconst DEFAULT_CONFIG: RuleConfig = {\n\t'no-category-index-file-dependency': 'warn',\n\t'no-unpinned-dependency': 'warn',\n\t'require-local-dependency-exists': 'error',\n\t'max-local-dependencies': ['warn', 10],\n\t'no-circular-dependency': 'error',\n\t'no-unused-block': 'warn',\n\t'no-framework-dependency': 'warn',\n} as const;\n\nconst runRules = (\n\tcategories: Category[],\n\tconfig: RegistryConfig,\n\truleConfig: RuleConfig = DEFAULT_CONFIG\n): { warnings: string[]; errors: string[] } => {\n\tconst warnings: string[] = [];\n\tconst errors: string[] = [];\n\n\tfor (const category of categories) {\n\t\tfor (const block of category.blocks) {\n\t\t\tfor (const [name, rule] of Object.entries(rules)) {\n\t\t\t\tconst conf = ruleConfig[name as RuleKey]!;\n\n\t\t\t\tlet level: RuleLevel;\n\t\t\t\tconst options: (string | number)[] = [];\n\t\t\t\tif (Array.isArray(conf)) {\n\t\t\t\t\tlevel = conf[0];\n\t\t\t\t\toptions.push(...conf.slice(1));\n\t\t\t\t} else {\n\t\t\t\t\tlevel = conf;\n\t\t\t\t}\n\n\t\t\t\tif (level === 'off') continue;\n\n\t\t\t\tconst ruleErrors = rule.check(block, { categories, options, config });\n\n\t\t\t\tif (!ruleErrors) continue;\n\n\t\t\t\tif (level === 'error') {\n\t\t\t\t\terrors.push(\n\t\t\t\t\t\t...ruleErrors.map(\n\t\t\t\t\t\t\t(err) =>\n\t\t\t\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.ERROR} ${color.red(err)} ${color.gray(name)}`\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\twarnings.push(\n\t\t\t\t\t...ruleErrors.map(\n\t\t\t\t\t\t(err) => `${ascii.VERTICAL_LINE} ${ascii.WARN} ${err} ${color.gray(name)}`\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { warnings, errors };\n};\n\n/** Searches for the local dependency tree for the provided specifier returns the path it took to find the dependency */\nconst searchForDep = (\n\tsearch: string,\n\tblock: Block,\n\tcategories: Category[],\n\tchain: string[] = []\n): string[] | undefined => {\n\tconst newChain = [...chain, `${block.category}/${block.name}`];\n\n\tfor (const dep of block.localDependencies) {\n\t\tif (dep === search) return newChain;\n\n\t\t// it will be found in another pass but we don't want to get a stack overflow\n\t\tif (chain.includes(dep)) return undefined;\n\n\t\tconst [categoryName, blockName] = dep.split('/');\n\n\t\tconst depBlock = categories\n\t\t\t.find((cat) => cat.name === categoryName)\n\t\t\t?.blocks.find((b) => b.name === blockName);\n\n\t\tif (!depBlock) continue;\n\n\t\tconst found = searchForDep(search, depBlock, categories, newChain);\n\n\t\tif (found) return [...found, search];\n\t}\n\n\treturn undefined;\n};\n\n/** Checks if the provided block is depended on anywhere */\nconst isDependedOn = (specifier: string, categories: Category[]): boolean => {\n\tfor (const category of categories) {\n\t\tfor (const block of category.blocks) {\n\t\t\tif (!block.list) continue;\n\n\t\t\tconst chain = searchForDep(specifier, block, categories);\n\n\t\t\tif (chain) return true;\n\t\t}\n\t}\n\n\treturn false;\n};\n\nexport {\n\trules,\n\trunRules,\n\tDEFAULT_CONFIG,\n\truleLevelSchema,\n\truleConfigSchema,\n\truleKeySchema,\n\tsearchForDep,\n\tisDependedOn,\n};\n","import color from 'chalk';\nimport fetch from 'node-fetch';\nimport { Octokit } from 'octokit';\nimport * as v from 'valibot';\nimport type { RemoteBlock } from './blocks';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport * as u from './blocks/utils/url';\nimport { type Category, categorySchema } from './build';\nimport { OUTPUT_FILE } from './context';\nimport * as persisted from './persisted';\n\nexport type Info = {\n\trefs: 'tags' | 'heads';\n\turl: string;\n\tname: string;\n\towner: string;\n\t/** Valid only for azure provider */\n\tprojectName?: string;\n\trepoName: string;\n\tref: string;\n\tprovider: Provider;\n};\n\nexport type FetchOptions = {\n\tverbose: (str: string) => void;\n};\n\nexport interface Provider {\n\t/** Get the name of the provider\n\t *\n\t * @returns the name of the provider\n\t */\n\tname: () => string;\n\t/** Get the name of the default branch\n\t *\n\t * @returns\n\t */\n\tdefaultBranch: () => string;\n\t/** Provides an example of what a ref formatted url should look like.\n\t *\n\t * @returns\n\t */\n\trefSpecifierExample: () => string;\n\t/** Returns a normalized URL for the provider.\n\t *\n\t * ```ts\n\t * // https://github.com/ieedan/std -> github/ieedan/std\n\t * // https://github.com/ieedan/std/tree/v2.0.0 -> github/ieedan/std\n\t * // https://example.com/new-york -> https://example.com/new-york\n\t * ```\n\t *\n\t * @param repoPath\n\t * @returns\n\t */\n\tbaseUrl: (repoPath: string | Info) => Promise<string>;\n\tparseBlockSpecifier: (blockSpecifier: string) => [string, string];\n\t/** Returns a URL to the raw path of the resource provided in the resourcePath\n\t *\n\t * @param repoPath\n\t * @param resourcePath\n\t * @returns\n\t */\n\tresolveRaw: (repoPath: string | Info, resourcePath: string) => Promise<URL>;\n\t/** Returns the content of the requested resource\n\t *\n\t * @param repoPath\n\t * @param resourcePath\n\t * @returns\n\t */\n\tfetchRaw: (\n\t\trepoPath: string | Info,\n\t\tresourcePath: string,\n\t\topts?: Partial<FetchOptions>\n\t) => Promise<Result<string, string>>;\n\t/** Returns the manifest for the provided repoPath\n\t *\n\t * @param repoPath\n\t * @param resourcePath\n\t * @returns\n\t */\n\tfetchManifest: (repoPath: string | Info) => Promise<Result<Category[], string>>;\n\t/** Parses the url and gives info about the repo\n\t *\n\t * @param repoPath\n\t * @returns\n\t */\n\tinfo: (repoPath: string | Info) => Promise<Info>;\n\t/** Returns true if this provider matches the provided url\n\t *\n\t * @param repoPath\n\t * @returns\n\t */\n\tmatches: (repoPath: string) => boolean;\n}\n\nconst gitProviderErrorMessage = (info: Info, filePath: string) => {\n\treturn Err(\n\t\t`There was an error fetching the \\`${color.bold(filePath)}\\` from ${color.bold(info.url)}.\n\n${color.bold('This may be for one of the following reasons:')}\n1. The \\`${color.bold(filePath)}\\` or containing repository doesn't exist\n2. Your repository path is incorrect (wrong branch, wrong tag) default branches other than ${color.bold('default')} must be specified \\`${color.bold(info.provider.refSpecifierExample())}\\`\n3. You are using an expired access token or a token that doesn't have access to this repository\n`\n\t);\n};\n\n/** Valid paths\n *\n * `https://github.com/<owner>/<repo>/[tree]/[ref]`\n *\n * `github/<owner>/<repo>/[tree]/[ref]`\n */\nconst github: Provider = {\n\tname: () => 'github',\n\tdefaultBranch: () => 'main',\n\trefSpecifierExample: () => 'github/<owner>/<repo>/tree/<ref>',\n\tbaseUrl: async (repoPath) => {\n\t\tconst info = await github.info(repoPath);\n\n\t\treturn `github/${info.owner}/${info.repoName}`;\n\t},\n\tparseBlockSpecifier: (blockSpecifier) => {\n\t\tconst [_, owner, repoName, ...rest] = blockSpecifier.split('/');\n\n\t\tlet repo: string;\n\t\t// if rest is greater than 2 it isn't the block specifier so it is part of the path\n\t\tif (rest.length > 2) {\n\t\t\trepo = `github/${owner}/${repoName}/${rest.slice(0, rest.length - 2).join('/')}`;\n\t\t} else {\n\t\t\trepo = `github/${owner}/${repoName}`;\n\t\t}\n\n\t\treturn [repo, rest.slice(rest.length - 2).join('/')];\n\t},\n\tresolveRaw: async (repoPath, resourcePath) => {\n\t\tconst info = await github.info(repoPath);\n\n\t\treturn new URL(\n\t\t\tresourcePath,\n\t\t\t`https://raw.githubusercontent.com/${info.owner}/${info.repoName}/refs/${info.refs}/${info.ref}/`\n\t\t);\n\t},\n\tfetchRaw: async (repoPath, resourcePath, { verbose } = {}) => {\n\t\tconst info = await github.info(repoPath);\n\n\t\tconst url = await github.resolveRaw(info, resourcePath);\n\n\t\tverbose?.(`Trying to fetch from ${url}`);\n\n\t\ttry {\n\t\t\tconst token = persisted.get().get(`${github.name()}-token`);\n\n\t\t\tconst headers = new Headers();\n\n\t\t\tif (token !== undefined) {\n\t\t\t\theaders.append('Authorization', `token ${token}`);\n\t\t\t}\n\n\t\t\tconst response = await fetch(url, { headers });\n\n\t\t\tverbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);\n\n\t\t\tif (!response.ok) {\n\t\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t\t}\n\n\t\t\treturn Ok(await response.text());\n\t\t} catch (err) {\n\t\t\tverbose?.(`error in response ${err} `);\n\n\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t}\n\t},\n\tfetchManifest: async (repoPath) => {\n\t\tconst manifest = await github.fetchRaw(repoPath, OUTPUT_FILE);\n\n\t\tif (manifest.isErr()) return Err(manifest.unwrapErr());\n\n\t\tconst categories = v.safeParse(v.array(categorySchema), JSON.parse(manifest.unwrap()));\n\n\t\tif (!categories.success) {\n\t\t\treturn Err(`Error parsing categories: ${categories.issues}`);\n\t\t}\n\n\t\treturn Ok(categories.output);\n\t},\n\tinfo: async (repoPath) => {\n\t\tif (typeof repoPath !== 'string') return repoPath;\n\n\t\tconst repo = repoPath.replaceAll(/(https:\\/\\/github.com\\/)|(github\\/)/g, '');\n\n\t\tconst [owner, repoName, ...rest] = repo.split('/');\n\n\t\tlet ref = github.defaultBranch();\n\n\t\tconst token = persisted.get().get(`${github.name()}-token`);\n\n\t\tconst octokit = new Octokit({ auth: token });\n\n\t\tif (rest[0] === 'tree') {\n\t\t\tref = rest[1];\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst { data: repo } = await octokit.rest.repos.get({ owner, repo: repoName });\n\n\t\t\t\tref = repo.default_branch;\n\t\t\t} catch {\n\t\t\t\t// we just want to continue on blissfully unaware the user will get an error later\n\t\t\t}\n\t\t}\n\n\t\t// checks if the type of the ref is tags or heads\n\t\tlet refs: 'heads' | 'tags' = 'heads';\n\t\t// no need to check if ref is main\n\t\tif (ref !== github.defaultBranch()) {\n\t\t\ttry {\n\t\t\t\tconst { data: tags } = await octokit.rest.git.listMatchingRefs({\n\t\t\t\t\towner,\n\t\t\t\t\trepo: repoName,\n\t\t\t\t\tref: 'tags',\n\t\t\t\t});\n\n\t\t\t\tif (tags.some((tag) => tag.ref === `refs/tags/${ref}`)) {\n\t\t\t\t\trefs = 'tags';\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\trefs = 'heads';\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trefs,\n\t\t\turl: repoPath,\n\t\t\tname: github.name(),\n\t\t\trepoName,\n\t\t\towner,\n\t\t\tref: ref,\n\t\t\tprovider: github,\n\t\t};\n\t},\n\tmatches: (repoPath) =>\n\t\trepoPath.toLowerCase().startsWith('https://github.com') ||\n\t\trepoPath.toLowerCase().startsWith('github'),\n};\n\n/** Valid paths\n *\n * `https://gitlab.com/ieedan/std`\n *\n * `https://gitlab.com/ieedan/std/-/tree/next`\n *\n * `https://gitlab.com/ieedan/std/-/tree/v2.0.0`\n *\n * `https://gitlab.com/ieedan/std/-/raw/v2.0.0/jsrepo-manifest.json?ref_type=tags`\n */\nconst gitlab: Provider = {\n\tname: () => 'gitlab',\n\tdefaultBranch: () => 'main',\n\trefSpecifierExample: () => 'gitlab/<owner>/<repo>/-/tree/<ref>',\n\tbaseUrl: async (repoPath) => {\n\t\tconst info = await gitlab.info(repoPath);\n\n\t\treturn `gitlab/${info.owner}/${info.repoName}`;\n\t},\n\tparseBlockSpecifier: (blockSpecifier) => {\n\t\tconst [_, owner, repoName, ...rest] = blockSpecifier.split('/');\n\n\t\tlet repo: string;\n\t\t// if rest is greater than 2 it isn't the block specifier so it is part of the path\n\t\tif (rest.length > 2) {\n\t\t\trepo = `gitlab/${owner}/${repoName}/${rest.slice(0, rest.length - 2).join('/')}`;\n\t\t} else {\n\t\t\trepo = `gitlab/${owner}/${repoName}`;\n\t\t}\n\n\t\treturn [repo, rest.slice(rest.length - 2).join('/')];\n\t},\n\tresolveRaw: async (repoPath, resourcePath) => {\n\t\tconst info = await gitlab.info(repoPath);\n\n\t\treturn new URL(\n\t\t\t`${encodeURIComponent(resourcePath)}/raw?ref=${info.ref}`,\n\t\t\t`https://gitlab.com/api/v4/projects/${encodeURIComponent(`${info.owner}/${info.repoName}`)}/repository/files/`\n\t\t);\n\t},\n\tfetchRaw: async (repoPath, resourcePath, { verbose } = {}) => {\n\t\tconst info = await github.info(repoPath);\n\n\t\tconst url = await gitlab.resolveRaw(info, resourcePath);\n\n\t\tverbose?.(`Trying to fetch from ${url}`);\n\n\t\ttry {\n\t\t\tconst token = persisted.get().get(`${gitlab.name()}-token`);\n\n\t\t\tconst headers = new Headers();\n\n\t\t\tif (token !== undefined) {\n\t\t\t\theaders.append('PRIVATE-TOKEN', `${token}`);\n\t\t\t}\n\n\t\t\tconst response = await fetch(url, { headers });\n\n\t\t\tverbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);\n\n\t\t\tif (!response.ok) {\n\t\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t\t}\n\n\t\t\treturn Ok(await response.text());\n\t\t} catch {\n\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t}\n\t},\n\tfetchManifest: async (repoPath) => {\n\t\tconst manifest = await gitlab.fetchRaw(repoPath, OUTPUT_FILE);\n\n\t\tif (manifest.isErr()) return Err(manifest.unwrapErr());\n\n\t\tconst categories = v.safeParse(v.array(categorySchema), JSON.parse(manifest.unwrap()));\n\n\t\tif (!categories.success) {\n\t\t\treturn Err(`Error parsing categories: ${categories.issues}`);\n\t\t}\n\n\t\treturn Ok(categories.output);\n\t},\n\tinfo: async (repoPath) => {\n\t\tif (typeof repoPath !== 'string') return repoPath;\n\n\t\tconst repo = repoPath.replaceAll(/(https:\\/\\/gitlab.com\\/)|(gitlab\\/)/g, '');\n\n\t\tconst [owner, repoName, ...rest] = repo.split('/');\n\n\t\tlet ref = gitlab.defaultBranch();\n\t\tlet refs: Info['refs'] = 'heads';\n\n\t\tif (rest[0] === '-' && rest[1] === 'tree') {\n\t\t\tif (rest[2].includes('?')) {\n\t\t\t\tconst [tempRef, last] = rest[2].split('?');\n\n\t\t\t\tref = tempRef;\n\n\t\t\t\tif (last.startsWith('ref_type=')) {\n\t\t\t\t\tif (last.slice(10) === 'tags') {\n\t\t\t\t\t\trefs = 'tags';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tref = rest[2];\n\t\t\t}\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst token = persisted.get().get(`${gitlab.name()}-token`);\n\n\t\t\t\tconst headers = new Headers();\n\n\t\t\t\tif (token !== undefined) {\n\t\t\t\t\theaders.append('Authorization', `Bearer ${token}`);\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\t`https://gitlab.com/api/v4/projects/${encodeURIComponent(`${owner}/${repoName}`)}`,\n\t\t\t\t\t{\n\t\t\t\t\t\theaders,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json();\n\n\t\t\t\t\t// @ts-ignore yes but we know\n\t\t\t\t\tref = data.default_branch;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// well find out it isn't correct later with a better error\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trefs,\n\t\t\turl: repoPath,\n\t\t\tname: gitlab.name(),\n\t\t\trepoName,\n\t\t\towner,\n\t\t\tref: ref,\n\t\t\tprovider: gitlab,\n\t\t};\n\t},\n\tmatches: (repoPath) =>\n\t\trepoPath.toLowerCase().startsWith('https://gitlab.com') ||\n\t\trepoPath.toLowerCase().startsWith('gitlab'),\n};\n\n/** Valid paths\n *\n * `https://bitbucket.org/ieedan/std/src/main/`\n *\n * `https://bitbucket.org/ieedan/std/src/next/`\n *\n * `https://bitbucket.org/ieedan/std/src/v2.0.0/`\n *\n */\nconst bitbucket: Provider = {\n\tname: () => 'bitbucket',\n\tdefaultBranch: () => 'master',\n\trefSpecifierExample: () => 'bitbucket/<owner>/<repo>/src/<ref>',\n\tbaseUrl: async (repoPath) => {\n\t\tconst info = await bitbucket.info(repoPath);\n\n\t\treturn `bitbucket/${info.owner}/${info.repoName}`;\n\t},\n\tparseBlockSpecifier: (blockSpecifier) => {\n\t\tconst [_, owner, repoName, ...rest] = blockSpecifier.split('/');\n\n\t\tlet repo: string;\n\t\t// if rest is greater than 2 it isn't the block specifier so it is part of the path\n\t\tif (rest.length > 2) {\n\t\t\trepo = `azure/${owner}/${repoName}/${rest.slice(0, rest.length - 2).join('/')}`;\n\t\t} else {\n\t\t\trepo = `azure/${owner}/${repoName}`;\n\t\t}\n\n\t\treturn [repo, rest.slice(rest.length - 2).join('/')];\n\t},\n\tresolveRaw: async (repoPath, resourcePath) => {\n\t\tconst info = await bitbucket.info(repoPath);\n\n\t\treturn new URL(\n\t\t\tresourcePath,\n\t\t\t`https://api.bitbucket.org/2.0/repositories/${info.owner}/${info.repoName}/src/${info.ref}/`\n\t\t);\n\t},\n\tfetchRaw: async (repoPath, resourcePath, { verbose } = {}) => {\n\t\tconst info = await bitbucket.info(repoPath);\n\n\t\tconst url = await bitbucket.resolveRaw(info, resourcePath);\n\n\t\tverbose?.(`Trying to fetch from ${url}`);\n\n\t\ttry {\n\t\t\tconst token = persisted.get().get(`${bitbucket.name()}-token`);\n\n\t\t\tconst headers = new Headers();\n\n\t\t\tif (token !== undefined) {\n\t\t\t\theaders.append('Authorization', `Bearer ${token}`);\n\t\t\t}\n\n\t\t\tconst response = await fetch(url, { headers });\n\n\t\t\tverbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);\n\n\t\t\tif (!response.ok) {\n\t\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t\t}\n\n\t\t\treturn Ok(await response.text());\n\t\t} catch {\n\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t}\n\t},\n\tfetchManifest: async (repoPath) => {\n\t\tconst manifest = await bitbucket.fetchRaw(repoPath, OUTPUT_FILE);\n\n\t\tif (manifest.isErr()) return Err(manifest.unwrapErr());\n\n\t\tconst categories = v.safeParse(v.array(categorySchema), JSON.parse(manifest.unwrap()));\n\n\t\tif (!categories.success) {\n\t\t\treturn Err(`Error parsing categories: ${categories.issues}`);\n\t\t}\n\n\t\treturn Ok(categories.output);\n\t},\n\tinfo: async (repoPath) => {\n\t\tif (typeof repoPath !== 'string') return repoPath;\n\n\t\tconst repo = repoPath.replaceAll(/(https:\\/\\/bitbucket.org\\/)|(bitbucket\\/)/g, '');\n\n\t\tconst [owner, repoName, ...rest] = repo.split('/');\n\n\t\t// pretty sure this just auto detects\n\t\tconst refs = 'heads';\n\n\t\tlet ref = bitbucket.defaultBranch();\n\n\t\tif (rest[0] === 'src') {\n\t\t\tref = rest[1];\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tconst token = persisted.get().get(`${bitbucket.name()}-token`);\n\n\t\t\t\tconst headers = new Headers();\n\n\t\t\t\tif (token !== undefined) {\n\t\t\t\t\theaders.append('Authorization', `Bearer ${token}`);\n\t\t\t\t}\n\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\t`https://api.bitbucket.org/2.0/repositories/${owner}/${repoName}`,\n\t\t\t\t\t{\n\t\t\t\t\t\theaders,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json();\n\n\t\t\t\t\t// @ts-ignore yes but we know\n\t\t\t\t\tref = data.mainbranch.name;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// well find out it isn't correct later with a better error\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trefs,\n\t\t\turl: repoPath,\n\t\t\tname: bitbucket.name(),\n\t\t\trepoName,\n\t\t\towner,\n\t\t\tref: ref,\n\t\t\tprovider: bitbucket,\n\t\t};\n\t},\n\tmatches: (repoPath) =>\n\t\trepoPath.toLowerCase().startsWith('https://bitbucket.org') ||\n\t\trepoPath.toLowerCase().startsWith('bitbucket'),\n};\n\n/** Valid paths\n *\n * `azure/<org>/<project>/<repo>/(tags|heads)/<ref>`\n */\nconst azure: Provider = {\n\tname: () => 'azure',\n\tdefaultBranch: () => 'main',\n\trefSpecifierExample: () => 'azure/<org>/<project>/<repo>/(tags|heads)/<ref>',\n\tbaseUrl: async (repoPath) => {\n\t\tconst info = await bitbucket.info(repoPath);\n\n\t\treturn `azure/${info.owner}/${info.projectName}/${info.repoName}`;\n\t},\n\tparseBlockSpecifier: (blockSpecifier) => {\n\t\tconst [providerName, owner, project, repoName, ...rest] = blockSpecifier.split('/');\n\n\t\tlet repo: string;\n\t\t// if rest is greater than 2 it isn't the block specifier so it is part of the path\n\t\tif (rest.length > 2) {\n\t\t\trepo = `${providerName}/${owner}/${project}/${repoName}${rest.slice(0, rest.length - 2).join('/')}`;\n\t\t} else {\n\t\t\trepo = `${providerName}/${owner}/${project}/${repoName}`;\n\t\t}\n\n\t\treturn [repo, rest.slice(rest.length - 2).join('/')];\n\t},\n\tresolveRaw: async (repoPath, resourcePath) => {\n\t\tconst info = await azure.info(repoPath);\n\n\t\tconst versionType = info.refs === 'tags' ? 'tag' : 'branch';\n\n\t\treturn new URL(\n\t\t\t`https://dev.azure.com/${info.owner}/${info.projectName}/_apis/git/repositories/${info.repoName}/items?path=${resourcePath}&api-version=7.2-preview.1&versionDescriptor.version=${info.ref}&versionDescriptor.versionType=${versionType}`\n\t\t);\n\t},\n\tfetchRaw: async (repoPath, resourcePath, { verbose } = {}) => {\n\t\tconst info = await azure.info(repoPath);\n\n\t\tconst url = await azure.resolveRaw(info, resourcePath);\n\n\t\tverbose?.(`Trying to fetch from ${url}`);\n\n\t\ttry {\n\t\t\tconst token = persisted.get().get(`${azure.name()}-token`);\n\n\t\t\tconst headers = new Headers();\n\n\t\t\tif (token !== undefined) {\n\t\t\t\theaders.append('Authorization', `Bearer ${token}`);\n\t\t\t}\n\n\t\t\tconst response = await fetch(url, { headers });\n\n\t\t\tverbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);\n\n\t\t\tif (!response.ok) {\n\t\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t\t}\n\n\t\t\treturn Ok(await response.text());\n\t\t} catch (err) {\n\t\t\tverbose?.(`error in response ${err} `);\n\n\t\t\treturn gitProviderErrorMessage(info, resourcePath);\n\t\t}\n\t},\n\tfetchManifest: async (repoPath) => {\n\t\tconst manifest = await azure.fetchRaw(repoPath, OUTPUT_FILE);\n\n\t\tif (manifest.isErr()) return Err(manifest.unwrapErr());\n\n\t\tconst categories = v.safeParse(v.array(categorySchema), JSON.parse(manifest.unwrap()));\n\n\t\tif (!categories.success) {\n\t\t\treturn Err(`Error parsing categories: ${categories.issues}`);\n\t\t}\n\n\t\treturn Ok(categories.output);\n\t},\n\tinfo: async (repoPath) => {\n\t\tif (typeof repoPath !== 'string') return repoPath;\n\n\t\tconst repo = repoPath.replaceAll(/(azure\\/)/g, '');\n\n\t\tconst [owner, project, repoName, ...rest] = repo.split('/');\n\n\t\t// azure/aidanbleser/std/std/heads/main\n\n\t\tlet ref = azure.defaultBranch();\n\n\t\t// checks if the type of the ref is tags or heads\n\t\tlet refs: 'heads' | 'tags' = 'heads';\n\n\t\tif (['tags', 'heads'].includes(rest[0])) {\n\t\t\trefs = rest[0] as 'heads' | 'tags';\n\n\t\t\tif (rest[1] && rest[1] !== '') {\n\t\t\t\tref = rest[1];\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trefs,\n\t\t\turl: repoPath,\n\t\t\tname: azure.name(),\n\t\t\tprojectName: project,\n\t\t\trepoName,\n\t\t\towner,\n\t\t\tref: ref,\n\t\t\tprovider: azure,\n\t\t};\n\t},\n\tmatches: (repoPath) => repoPath.toLowerCase().startsWith('azure'),\n};\n\nconst httpErrorMessage = (url: string, filePath: string, error: string) => {\n\treturn Err(\n\t\t`There was an error fetching ${color.bold(new URL(filePath, url).toString())}\n\t\n${color.bold(error)}`\n\t);\n};\n\nconst http: Provider = {\n\tname: () => 'http',\n\tdefaultBranch: () => '',\n\trefSpecifierExample: () => '',\n\tbaseUrl: async (repoPath) => {\n\t\tconst info = await http.info(repoPath);\n\n\t\treturn info.url;\n\t},\n\tparseBlockSpecifier: (blockSpecifier) => {\n\t\tconst url = new URL(blockSpecifier);\n\n\t\tconst segments = url.pathname.split('/');\n\n\t\treturn [\n\t\t\tnew URL(segments.slice(0, segments.length - 2).join('/'), url.origin).toString(),\n\t\t\tsegments.slice(segments.length - 2).join('/'),\n\t\t];\n\t},\n\tinfo: async (path: string | Info) => {\n\t\tif (typeof path !== 'string') return path;\n\n\t\treturn {\n\t\t\tname: http.name(),\n\t\t\turl: u.addTrailingSlash(path),\n\t\t\tprovider: http,\n\n\t\t\t// nothing else is important\n\t\t\towner: '',\n\t\t\tref: '',\n\t\t\trefs: 'heads',\n\t\t\trepoName: '',\n\t\t\tprojectName: '',\n\t\t} satisfies Info;\n\t},\n\tresolveRaw: async (repoPath, resourcePath) => {\n\t\tconst info = await http.info(repoPath);\n\n\t\treturn new URL(resourcePath, info.url);\n\t},\n\tfetchRaw: async (repoPath, resourcePath, { verbose } = {}) => {\n\t\tconst info = await http.info(repoPath);\n\n\t\tconst url = await http.resolveRaw(info, resourcePath);\n\n\t\tverbose?.(`Trying to fetch from ${url}`);\n\n\t\ttry {\n\t\t\tconst response = await fetch(url);\n\n\t\t\tverbose?.(`Got a response from ${url} ${response.status} ${response.statusText}`);\n\n\t\t\tif (!response.ok) {\n\t\t\t\treturn httpErrorMessage(\n\t\t\t\t\tinfo.url,\n\t\t\t\t\tresourcePath,\n\t\t\t\t\t`The server responded with: ${response.status}: ${response.statusText}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn Ok(await response.text());\n\t\t} catch (err) {\n\t\t\tverbose?.(`error in response ${err} `);\n\n\t\t\treturn httpErrorMessage(info.url, resourcePath, String(err));\n\t\t}\n\t},\n\tfetchManifest: async (repoPath) => {\n\t\tconst manifest = await http.fetchRaw(repoPath, OUTPUT_FILE);\n\n\t\tif (manifest.isErr()) return Err(manifest.unwrapErr());\n\n\t\tconst categories = v.safeParse(v.array(categorySchema), JSON.parse(manifest.unwrap()));\n\n\t\tif (!categories.success) {\n\t\t\treturn Err(`Error parsing categories: ${categories.issues}`);\n\t\t}\n\n\t\treturn Ok(categories.output);\n\t},\n\tmatches: (url) => url.startsWith('http'),\n};\n\nconst providers = [github, gitlab, bitbucket, azure, http];\n\nconst getProviderInfo = async (repo: string): Promise<Result<Info, string>> => {\n\tconst provider = providers.find((provider) => provider.matches(repo));\n\tif (provider) {\n\t\treturn Ok(await provider.info(repo));\n\t}\n\n\treturn Err(\n\t\t`Only ${providers.map((p, i) => `${i === providers.length - 1 ? 'and ' : ''}${color.bold(p.name())}`).join(', ')} registries are supported at this time!`\n\t);\n};\n\nconst fetchBlocks = async (\n\t...repos: ResolvedRepo[]\n): Promise<Result<Map<string, RemoteBlock>, { message: string; repo: string }>> => {\n\tconst blocksMap = new Map<string, RemoteBlock>();\n\n\tconst errors = await Promise.all(\n\t\trepos.map(async ({ path: repo, info }) => {\n\t\t\tconst getManifestResult = await info.provider.fetchManifest(info);\n\n\t\t\tif (getManifestResult.isErr())\n\t\t\t\treturn Err({ message: getManifestResult.unwrapErr(), repo });\n\n\t\t\tconst categories = getManifestResult.unwrap();\n\n\t\t\tfor (const category of categories) {\n\t\t\t\tfor (const block of category.blocks) {\n\t\t\t\t\tconst [repoIdent, blockSpecifier] = info.provider.parseBlockSpecifier(\n\t\t\t\t\t\tu.join(info.url, block.category, block.name)\n\t\t\t\t\t);\n\n\t\t\t\t\tblocksMap.set(u.join(repoIdent, blockSpecifier), {\n\t\t\t\t\t\t...block,\n\t\t\t\t\t\tsourceRepo: info,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t);\n\n\tconst err = errors.find((err) => err !== undefined);\n\n\tif (err) return err;\n\n\treturn Ok(blocksMap);\n};\n\nexport type ResolvedRepo = {\n\tpath: string;\n\tinfo: Info;\n};\n\nconst resolvePaths = async (\n\t...repos: string[]\n): Promise<Result<ResolvedRepo[], { message: string; repo: string }>> => {\n\tconst resolvedPaths: ResolvedRepo[] = [];\n\n\tconst errors = await Promise.all(\n\t\trepos.map(async (repo) => {\n\t\t\tconst getProviderResult = await getProviderInfo(repo);\n\n\t\t\tif (getProviderResult.isErr())\n\t\t\t\treturn Err({ message: getProviderResult.unwrapErr(), repo });\n\n\t\t\tconst providerInfo = getProviderResult.unwrap();\n\n\t\t\tresolvedPaths.push({ path: repo, info: providerInfo });\n\t\t})\n\t);\n\n\tconst err = errors.find((err) => err !== undefined);\n\n\tif (err) return err;\n\n\treturn Ok(resolvedPaths);\n};\n\nexport {\n\tgithub,\n\tgitlab,\n\tbitbucket,\n\tazure,\n\thttp,\n\tgetProviderInfo,\n\tfetchBlocks,\n\tproviders,\n\tresolvePaths,\n};\n","/*\n\tjsrepo 1.22.1\n\tInstalled from github/ieedan/std\n\t1-4-2025\n*/\n\nimport ansiRegex from 'ansi-regex';\n\n/** Strips a string with ansi escape codes back to it's original form. Useful for when you need to get the actual length of a string.\n *\n * @param str\n * @returns\n *\n * ## Usage\n * ```ts\n * import color from \"chalk\";\n *\n * const redString = color.red(redString);\n *\n * stripAnsi(redString);\n * ```\n */\nconst stripAsni = (str: string) => str.replace(ansiRegex(), '');\n\nexport { stripAsni };\n","/*\n\tjsrepo 1.22.1\n\tInstalled from github/ieedan/std\n\t1-4-2025\n*/\n\nimport { stripAsni } from './strip-ansi';\n\n/** Adds the `padWith` (default `' '`) to the string the amount of times specified by the `space` argument\n *\n * @param str String to add padding to\n * @param space Whitespace to add\n * @param padWith Character to use to pad the string\n * @returns\n *\n * ## Usage\n * ```ts\n * const padded = leftPad(\"Hello\", 3, \".\");\n *\n * console.log(padded); // '...Hello'\n * ```\n */\nconst leftPad = (str: string, space: number, padWith = ' ') => {\n\treturn padWith.repeat(space) + str;\n};\n\n/** Adds the `padWith` until the string length matches the `length`\n *\n * @param str\n * @param length\n * @param padWith\n *\n * ## Usage\n * ```ts\n * const padded = leftPadMin(\"1\", 3, \".\");\n *\n * console.log(padded); // '..1'\n * ```\n */\nconst leftPadMin = (str: string, length: number, padWith = ' ') => {\n\tif (stripAsni(str).length > length)\n\t\tthrow new Error('String length is greater than the length provided.');\n\n\treturn padWith.repeat(length - stripAsni(str).length) + str;\n};\n\n/** Adds the `padWith` (default `' '`) to the string the amount of times specified by the `space` argument\n *\n * @param str String to add padding to\n * @param space Whitespace to add\n * @param padWith Character to use to pad the string\n * @returns\n *\n * ## Usage\n * ```ts\n * const padded = rightPad(\"Hello\", 3, \".\");\n *\n * console.log(padded); // 'Hello...'\n * ```\n */\nconst rightPad = (str: string, space: number, padWith = ' ') => {\n\treturn str + padWith.repeat(space);\n};\n\n/** Adds the `padWith` until the string length matches the `length`\n *\n * @param str\n * @param length\n * @param padWith\n *\n * ## Usage\n * ```ts\n * const padded = rightPadMin(\"1\", 3, \".\");\n *\n * console.log(padded); // '1..'\n * ```\n */\nconst rightPadMin = (str: string, length: number, padWith = ' ') => {\n\tif (stripAsni(str).length > length)\n\t\tthrow new Error('String length is greater than the length provided.');\n\n\treturn str + padWith.repeat(length - stripAsni(str).length);\n};\n\n/** Pads the string with the `padWith` so that it appears in the center of a new string with the provided length.\n *\n * @param str\n * @param length\n * @param padWith\n * @returns\n *\n * ## Usage\n * ```ts\n * const str = \"Hello, World!\";\n *\n * const padded = centerPad(str, str.length + 4);\n *\n * console.log(padded); // ' Hello, World! '\n * ```\n */\nconst centerPad = (str: string, length: number, padWith = ' ') => {\n\tif (stripAsni(str).length > length) {\n\t\tthrow new Error('String length is greater than the length provided.');\n\t}\n\n\tconst overflow = length - stripAsni(str).length;\n\n\tconst paddingLeft = Math.floor(overflow / 2);\n\n\tconst paddingRight = Math.ceil(overflow / 2);\n\n\treturn padWith.repeat(paddingLeft) + str + padWith.repeat(paddingRight);\n};\n\nexport { leftPad, leftPadMin, rightPad, rightPadMin, centerPad };\n","/*\n\tjsrepo 1.2.4\n\tInstalled from github/ieedan/std\n\t11-21-2024\n*/\n\nimport os from 'node:os';\nimport { leftPadMin } from './pad';\n\n/** Regex used to split on new lines\n *\n * ```\n * /\\n|\\r\\n/g\n * ```\n */\nexport const NEW_LINE_REGEX = /\\n|\\r\\n/g;\n\n/** Splits str into an array of lines.\n *\n * @param str\n * @returns\n *\n * ## Usage\n *\n * ```ts\n * lines.split(\"hello\\\\nhello\\nhello\"); // [\"hello\\\\nhello\", \"hello\"]\n * ```\n */\nconst get = (str: string): string[] => str.split(NEW_LINE_REGEX);\n\nexport type Options = {\n\tlineNumbers: boolean;\n\tprefix: (line: number, lineCount: number) => string;\n};\n\n/** Joins the array of lines back into a string using the platform specific EOL.\n *\n * @param lines\n * @returns\n *\n * ## Usage\n *\n * ```ts\n * lines.join([\"1\", \"2\", \"3\"]); // \"1\\n2\\n3\" or on windows \"1\\r\\n2\\r\\n3\"\n *\n * // add line numbers\n * lines.join([\"import { } from '.'\", \"console.log('test')\"], { lineNumbers: true });\n * // 1 import { } from '.'\n * // 2 console.log('test')\n *\n * // add a custom prefix\n * lines.join([\"import { } from '.'\", \"console.log('test')\"], { prefix: () => \" + \" });\n * // + import { } from '.'\n * // + console.log('test')\n * ```\n */\nconst join = (lines: string[], { lineNumbers = false, prefix }: Partial<Options> = {}): string => {\n\tlet transformed = lines;\n\n\tif (lineNumbers) {\n\t\tconst length = lines.length.toString().length + 1;\n\n\t\ttransformed = transformed.map((line, i) => `${leftPadMin(`${i + 1}`, length)} ${line}`);\n\t}\n\n\tif (prefix !== undefined) {\n\t\ttransformed = transformed.map((line, i) => `${prefix(i, lines.length)}${line}`);\n\t}\n\n\treturn transformed.join(os.EOL);\n};\n\nexport { get, join };\n","import fs from 'node:fs';\nimport path from 'pathe';\nimport semver from 'semver';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport { parsePackageName } from './parse-package-name';\n\nconst findNearestPackageJson = (startDir: string, until: string): string | undefined => {\n\tconst packagePath = path.join(startDir, 'package.json');\n\n\tif (fs.existsSync(packagePath)) return packagePath;\n\n\tif (startDir === until) return undefined;\n\n\tconst segments = startDir.split(/[\\/\\\\]/);\n\n\treturn findNearestPackageJson(segments.slice(0, segments.length - 1).join('/'), until);\n};\n\ntype PackageJson = {\n\tname: string;\n\tversion: string;\n\tdescription: string;\n\tscripts: Record<string, string>;\n\tdependencies: Record<string, string>;\n\tdevDependencies: Record<string, string>;\n};\n\nconst getPackage = (path: string): Result<Partial<PackageJson>, string> => {\n\tif (!fs.existsSync(path)) return Err(`${path} doesn't exist`);\n\n\tconst contents = fs.readFileSync(path).toString();\n\n\treturn Ok(JSON.parse(contents));\n};\n\nconst cleanVersion = (version: string) => {\n\tif (version[0] === '^') {\n\t\treturn version.slice(1);\n\t}\n\n\treturn version;\n};\n\n/** Returns only the dependencies that should be installed based on what is already in the package.json */\nconst returnShouldInstall = (\n\tdependencies: Set<string>,\n\tdevDependencies: Set<string>,\n\t{ cwd }: { cwd: string }\n): { devDependencies: Set<string>; dependencies: Set<string> } => {\n\t// don't mutate originals\n\tconst tempDeps = dependencies;\n\tconst tempDevDeps = devDependencies;\n\n\tconst packageResult = getPackage(path.join(cwd, 'package.json'));\n\n\tif (!packageResult.isErr()) {\n\t\tconst pkg = packageResult.unwrap();\n\n\t\tif (pkg.dependencies) {\n\t\t\tfor (const dep of tempDeps) {\n\t\t\t\t// this was already parsed when building\n\t\t\t\tconst { name, version } = parsePackageName(dep).unwrap();\n\n\t\t\t\tconst foundDep = pkg.dependencies[name];\n\n\t\t\t\t// if version isn't pinned and dep exists delete\n\t\t\t\tif (version === undefined && foundDep) {\n\t\t\t\t\ttempDeps.delete(dep);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// if the version installed satisfies the requested version remove the dep\n\t\t\t\tif (foundDep && semver.satisfies(cleanVersion(foundDep), version)) {\n\t\t\t\t\ttempDeps.delete(dep);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (pkg.devDependencies) {\n\t\t\tfor (const dep of tempDevDeps) {\n\t\t\t\t// this was already parsed when building\n\t\t\t\tconst { name, version } = parsePackageName(dep).unwrap();\n\n\t\t\t\tconst foundDep = pkg.devDependencies[name];\n\n\t\t\t\t// if version isn't pinned and dep exists delete\n\t\t\t\tif (version === undefined && foundDep) {\n\t\t\t\t\ttempDevDeps.delete(dep);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// if the version installed satisfies the requested version remove the dep\n\t\t\t\tif (foundDep && semver.satisfies(cleanVersion(foundDep), version)) {\n\t\t\t\t\ttempDevDeps.delete(dep);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { dependencies: tempDeps, devDependencies: tempDevDeps };\n};\n\nexport { findNearestPackageJson, getPackage, returnShouldInstall };\n","import fs from 'node:fs';\nimport { builtinModules } from 'node:module';\nimport { Biome, Distribution } from '@biomejs/js-api';\nimport type { PartialConfiguration } from '@biomejs/wasm-nodejs';\nimport color from 'chalk';\nimport { type Node, walk } from 'estree-walker';\nimport { type TsConfigResult, createPathsMatcher, getTsconfig } from 'get-tsconfig';\nimport * as parse5 from 'parse5';\nimport path from 'pathe';\nimport * as prettier from 'prettier';\nimport * as sv from 'svelte/compiler';\nimport { Project } from 'ts-morph';\nimport validatePackageName from 'validate-npm-package-name';\nimport * as v from 'vue/compiler-sfc';\nimport * as ascii from './ascii';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport * as lines from './blocks/utils/lines';\nimport type { Formatter } from './config';\nimport { findNearestPackageJson } from './package';\nimport { parsePackageName } from './parse-package-name';\n\nexport type ResolvedDependencies = {\n\tlocal: string[];\n\tdevDependencies: string[];\n\tdependencies: string[];\n\t/** Maps a literal import to a template import to be replaced during add/update */\n\timports: Record<string, string>;\n};\n\nexport type ResolveDependencyOptions = {\n\tfilePath: string;\n\tisSubDir: boolean;\n\texcludeDeps: string[];\n\tcwd: string;\n\tdirs: string[];\n};\n\nexport type FormatOptions = {\n\tformatter?: Formatter;\n\t/** Can be used to infer the prettier parser */\n\tfilePath: string;\n\tprettierOptions: prettier.Options | null;\n\tbiomeOptions: PartialConfiguration | null;\n};\n\nexport type Lang = {\n\t/** Matches the supported file types */\n\tmatches: (fileName: string) => boolean;\n\t/** Reads the file and gets any dependencies from its imports */\n\tresolveDependencies: (opts: ResolveDependencyOptions) => Result<ResolvedDependencies, string>;\n\t/** Returns a multiline comment containing the content */\n\tcomment: (content: string) => string;\n\tformat: (code: string, opts: FormatOptions) => Promise<string>;\n};\n\n/** Language support for `*.css` files. */\nconst css: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.css'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\tcomment: (content) => `/*\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n*/`,\n\tformat: async (code, { formatter, prettierOptions, biomeOptions, filePath }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { filepath: filePath, ...prettierOptions });\n\t\t}\n\n\t\tconst biome = await Biome.create({\n\t\t\tdistribution: Distribution.NODE,\n\t\t});\n\n\t\tif (biomeOptions) {\n\t\t\tbiome.applyConfiguration(biomeOptions);\n\t\t}\n\n\t\treturn biome.formatContent(code, { filePath }).content;\n\t},\n};\n\n/** Language support for `*.html` files. */\nconst html: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.html'),\n\tresolveDependencies: ({ filePath, isSubDir, excludeDeps, dirs, cwd }) => {\n\t\tconst sourceCode = fs.readFileSync(filePath).toString();\n\n\t\tconst ast = parse5.parse(sourceCode);\n\n\t\tconst imports: string[] = [];\n\n\t\t// @ts-ignore yeah I know\n\t\tconst walk = (node, enter: (node) => void) => {\n\t\t\tif (!node) return;\n\n\t\t\tenter(node);\n\n\t\t\tif (node.childNodes && node.childNodes.length > 0) {\n\t\t\t\tfor (const n of node.childNodes) {\n\t\t\t\t\twalk(n, enter);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const node of ast.childNodes) {\n\t\t\twalk(node, (n) => {\n\t\t\t\tif (n.tagName === 'script') {\n\t\t\t\t\tfor (const attr of n.attrs) {\n\t\t\t\t\t\tif (attr.name === 'src') {\n\t\t\t\t\t\t\timports.push(attr.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tn.tagName === 'link' &&\n\t\t\t\t\t// @ts-ignore yeah I know\n\t\t\t\t\tn.attrs.find((attr) => attr.name === 'rel' && attr.value === 'stylesheet')\n\t\t\t\t) {\n\t\t\t\t\tfor (const attr of n.attrs) {\n\t\t\t\t\t\tif (attr.name === 'href' && !attr.value.startsWith('http')) {\n\t\t\t\t\t\t\timports.push(attr.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst resolveResult = resolveImports({\n\t\t\tmoduleSpecifiers: imports,\n\t\t\tfilePath,\n\t\t\tisSubDir,\n\t\t\tdirs,\n\t\t\tcwd,\n\t\t\tdoNotInstall: ['svelte', '@sveltejs/kit', ...excludeDeps],\n\t\t});\n\n\t\tif (resolveResult.isErr()) {\n\t\t\treturn Err(\n\t\t\t\tresolveResult\n\t\t\t\t\t.unwrapErr()\n\t\t\t\t\t.map((err) => formatError(err))\n\t\t\t\t\t.join('\\n')\n\t\t\t);\n\t\t}\n\n\t\treturn Ok(resolveResult.unwrap());\n\t},\n\tcomment: (content) => `<!--\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n-->`,\n\tformat: async (code, { formatter, prettierOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { parser: 'html', ...prettierOptions });\n\t\t}\n\n\t\t// biome is in progress for formatting html\n\n\t\treturn code;\n\t},\n};\n\n/** Language support for `*.(json)` files. */\nconst json: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.json'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\t// json doesn't support comments\n\tcomment: (content: string) => content,\n\tformat: async (code, { formatter, prettierOptions, biomeOptions, filePath }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { filepath: filePath, ...prettierOptions });\n\t\t}\n\n\t\tconst biome = await Biome.create({\n\t\t\tdistribution: Distribution.NODE,\n\t\t});\n\n\t\tif (biomeOptions) {\n\t\t\tbiome.applyConfiguration(biomeOptions);\n\t\t}\n\n\t\treturn biome.formatContent(code, { filePath }).content;\n\t},\n};\n\n/** Language support for `*.(jsonc)` files. */\nconst jsonc: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.jsonc'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\tcomment: (content) => `/*\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n*/`,\n\tformat: async (code, { formatter, prettierOptions, biomeOptions, filePath }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { filepath: filePath, ...prettierOptions });\n\t\t}\n\n\t\tconst biome = await Biome.create({\n\t\t\tdistribution: Distribution.NODE,\n\t\t});\n\n\t\tif (biomeOptions) {\n\t\t\tbiome.applyConfiguration({\n\t\t\t\t...biomeOptions,\n\t\t\t\tjson: { parser: { allowComments: true } },\n\t\t\t});\n\t\t}\n\n\t\treturn biome.formatContent(code, { filePath }).content;\n\t},\n};\n\n/** Language support for `*.(sass|scss)` files. */\nconst sass: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.sass') || fileName.endsWith('.scss'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\tcomment: (content) => `/*\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n*/`,\n\tformat: async (code, { formatter, prettierOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { parser: 'scss', ...prettierOptions });\n\t\t}\n\n\t\treturn code;\n\t},\n};\n\n/** Language support for `*.svelte` files. */\nconst svelte: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.svelte'),\n\tresolveDependencies: ({ filePath, isSubDir, excludeDeps, dirs, cwd }) => {\n\t\tconst sourceCode = fs.readFileSync(filePath).toString();\n\n\t\tconst root = sv.parse(sourceCode, { modern: true, filename: filePath });\n\n\t\t// if no script tag then no dependencies\n\t\tif (!root.instance && !root.module)\n\t\t\treturn Ok({ dependencies: [], devDependencies: [], local: [], imports: {} });\n\n\t\tconst modules: string[] = [];\n\n\t\tconst enter = (node: Node) => {\n\t\t\tif (\n\t\t\t\tnode.type === 'ImportDeclaration' ||\n\t\t\t\tnode.type === 'ExportAllDeclaration' ||\n\t\t\t\tnode.type === 'ExportNamedDeclaration'\n\t\t\t) {\n\t\t\t\tif (typeof node.source?.value === 'string') {\n\t\t\t\t\tmodules.push(node.source.value);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (root.instance) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: The root instance is just missing the `id` prop\n\t\t\twalk(root.instance as any, { enter });\n\t\t}\n\n\t\tif (root.module) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: The root instance is just missing the `id` prop\n\t\t\twalk(root.module as any, { enter });\n\t\t}\n\n\t\tconst resolveResult = resolveImports({\n\t\t\tmoduleSpecifiers: modules,\n\t\t\tfilePath,\n\t\t\tisSubDir,\n\t\t\tdirs,\n\t\t\tcwd,\n\t\t\tdoNotInstall: ['svelte', '@sveltejs/kit', ...excludeDeps],\n\t\t});\n\n\t\tif (resolveResult.isErr()) {\n\t\t\treturn Err(\n\t\t\t\tresolveResult\n\t\t\t\t\t.unwrapErr()\n\t\t\t\t\t.map((err) => formatError(err))\n\t\t\t\t\t.join('\\n')\n\t\t\t);\n\t\t}\n\n\t\treturn Ok(resolveResult.unwrap());\n\t},\n\tcomment: (content) => `<!--\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n-->`,\n\tformat: async (code, { formatter, filePath, prettierOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\t// only attempt to format if svelte plugin is included in the config.\n\t\tif (\n\t\t\tformatter === 'prettier' &&\n\t\t\tprettierOptions &&\n\t\t\tprettierOptions.plugins?.find((plugin) => plugin === 'prettier-plugin-svelte')\n\t\t) {\n\t\t\treturn await prettier.format(code, { filepath: filePath, ...prettierOptions });\n\t\t}\n\n\t\treturn code;\n\t},\n};\n\n/** Language support for `*.svg` files. */\nconst svg: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.svg'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\tcomment: (content) => `<!--\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n-->`,\n\tformat: async (code) => code,\n};\n\n/** Language support for `*.(js|ts|jsx|tsx)` files. */\nconst typescript: Lang = {\n\tmatches: (fileName) =>\n\t\tfileName.endsWith('.ts') ||\n\t\tfileName.endsWith('.js') ||\n\t\tfileName.endsWith('.tsx') ||\n\t\tfileName.endsWith('.jsx'),\n\tresolveDependencies: ({ filePath, isSubDir, excludeDeps, dirs, cwd }) => {\n\t\tconst project = new Project();\n\n\t\tconst blockFile = project.addSourceFileAtPath(filePath);\n\n\t\t// get import specifiers\n\t\tconst modules = blockFile\n\t\t\t.getImportDeclarations()\n\t\t\t.map((imp) => imp.getModuleSpecifierValue());\n\n\t\t// get `export x from` specifiers\n\t\tconst exps = blockFile\n\t\t\t.getExportDeclarations()\n\t\t\t.map((imp) => imp.getModuleSpecifierValue())\n\t\t\t.filter((imp) => imp !== undefined);\n\n\t\tmodules.push(...exps);\n\n\t\tconst resolveResult = resolveImports({\n\t\t\tmoduleSpecifiers: modules,\n\t\t\tfilePath,\n\t\t\tisSubDir,\n\t\t\tdirs,\n\t\t\tcwd,\n\t\t\tdoNotInstall: excludeDeps,\n\t\t});\n\n\t\tif (resolveResult.isErr()) {\n\t\t\treturn Err(\n\t\t\t\tresolveResult\n\t\t\t\t\t.unwrapErr()\n\t\t\t\t\t.map((err) => formatError(err))\n\t\t\t\t\t.join('\\n')\n\t\t\t);\n\t\t}\n\n\t\treturn Ok(resolveResult.unwrap());\n\t},\n\tcomment: (content) => `/*\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n*/`,\n\tformat: async (code, { formatter, filePath, prettierOptions, biomeOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { filepath: filePath, ...prettierOptions });\n\t\t}\n\n\t\tconst biome = await Biome.create({\n\t\t\tdistribution: Distribution.NODE,\n\t\t});\n\n\t\tif (biomeOptions) {\n\t\t\tbiome.applyConfiguration(biomeOptions);\n\t\t}\n\n\t\treturn biome.formatContent(code, { filePath }).content;\n\t},\n};\n\n/** Language support for `*.vue` files. */\nconst vue: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.vue'),\n\tresolveDependencies: ({ filePath, isSubDir, excludeDeps, dirs, cwd }) => {\n\t\tconst sourceCode = fs.readFileSync(filePath).toString();\n\n\t\tconst parsed = v.parse(sourceCode, { filename: filePath });\n\n\t\tif (!parsed.descriptor.script?.content && !parsed.descriptor.scriptSetup?.content)\n\t\t\treturn Ok({ dependencies: [], devDependencies: [], local: [], imports: {} });\n\n\t\tlet compiled: v.SFCScriptBlock;\n\t\ttry {\n\t\t\tcompiled = v.compileScript(parsed.descriptor, {\n\t\t\t\tid: 'shut-it',\n\t\t\t}); // you need this id to remove a warning\n\t\t} catch (err) {\n\t\t\treturn Err(`Compile error: ${err}`);\n\t\t}\n\n\t\tif (!compiled.imports)\n\t\t\treturn Ok({ dependencies: [], devDependencies: [], local: [], imports: {} });\n\n\t\tconst imports = Object.values(compiled.imports).map((imp) => imp.source);\n\n\t\tconst resolveResult = resolveImports({\n\t\t\tmoduleSpecifiers: imports,\n\t\t\tfilePath,\n\t\t\tisSubDir,\n\t\t\tdirs,\n\t\t\tcwd,\n\t\t\tdoNotInstall: ['vue', 'nuxt', ...excludeDeps],\n\t\t});\n\n\t\tif (resolveResult.isErr()) {\n\t\t\treturn Err(\n\t\t\t\tresolveResult\n\t\t\t\t\t.unwrapErr()\n\t\t\t\t\t.map((err) => formatError(err))\n\t\t\t\t\t.join('\\n')\n\t\t\t);\n\t\t}\n\n\t\treturn Ok(resolveResult.unwrap());\n\t},\n\tcomment: (content) => `<!--\\n${lines.join(lines.get(content), { prefix: () => '\\t' })}\\n-->`,\n\tformat: async (code, { formatter, prettierOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { parser: 'vue', ...prettierOptions });\n\t\t}\n\n\t\t// biome has issues with vue support\n\t\treturn code;\n\t},\n};\n\n/** Language support for `*.(yaml|yml)` files. */\nconst yaml: Lang = {\n\tmatches: (fileName) => fileName.endsWith('.yml') || fileName.endsWith('.yaml'),\n\tresolveDependencies: () =>\n\t\tOk({ dependencies: [], local: [], devDependencies: [], imports: {} }),\n\tcomment: (content: string) => lines.join(lines.get(content), { prefix: () => '# ' }),\n\tformat: async (code, { formatter, prettierOptions }) => {\n\t\tif (!formatter) return code;\n\n\t\tif (formatter === 'prettier') {\n\t\t\treturn await prettier.format(code, { parser: 'yaml', ...prettierOptions });\n\t\t}\n\n\t\treturn code;\n\t},\n};\n\nexport type ResolveImportOptions = {\n\tmoduleSpecifiers: string[];\n\tisSubDir: boolean;\n\tfilePath: string;\n\tdoNotInstall?: string[];\n\tdirs: string[];\n\tcwd: string;\n};\n\nconst formatError = (err: string) => {\n\treturn `${lines.join(lines.get(err), {\n\t\tprefix: (l) => {\n\t\t\tif (l === 0) return `${ascii.VERTICAL_LINE} ${ascii.ERROR} `;\n\n\t\t\treturn `${ascii.VERTICAL_LINE} `;\n\t\t},\n\t})}`;\n};\n\nconst resolveImports = ({\n\tmoduleSpecifiers,\n\tisSubDir,\n\tfilePath,\n\tdoNotInstall,\n\tdirs,\n\tcwd,\n}: ResolveImportOptions): Result<ResolvedDependencies, string[]> => {\n\tconst errors: string[] = [];\n\n\tconst deps = new Set<string>();\n\tconst localDeps = new Set<string>();\n\tconst imports: Record<string, string> = {};\n\n\tfor (const specifier of moduleSpecifiers) {\n\t\tif (specifier.startsWith('.')) {\n\t\t\tconst localDep = resolveLocalImport(specifier, isSubDir, {\n\t\t\t\tfilePath,\n\t\t\t\tdirs,\n\t\t\t\tcwd,\n\t\t\t});\n\n\t\t\tif (localDep.isErr()) {\n\t\t\t\terrors.push(localDep.unwrapErr());\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst dep = localDep.unwrap();\n\n\t\t\tif (dep) {\n\t\t\t\tlocalDeps.add(dep.dependency);\n\t\t\t\timports[specifier] = dep.template;\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst localDep = tryResolveLocalAlias(specifier, isSubDir, {\n\t\t\tfilePath,\n\t\t\tdirs,\n\t\t\tcwd,\n\t\t});\n\n\t\tif (localDep.isErr()) {\n\t\t\terrors.push(localDep.unwrapErr());\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst dep = localDep.unwrap();\n\n\t\tif (dep) {\n\t\t\tlocalDeps.add(dep.dependency);\n\t\t\timports[specifier] = dep.template;\n\t\t} else {\n\t\t\tdeps.add(specifier);\n\t\t}\n\t}\n\n\tif (errors.length > 0) {\n\t\treturn Err(errors);\n\t}\n\n\tconst { devDependencies, dependencies } = resolveRemoteDeps(Array.from(deps), filePath, {\n\t\tdoNotInstall: doNotInstall ? doNotInstall : [],\n\t});\n\n\treturn Ok({\n\t\tdependencies,\n\t\tdevDependencies,\n\t\tlocal: Array.from(localDeps),\n\t\timports,\n\t} satisfies ResolvedDependencies);\n};\n\ntype ResolveLocalImportResult = {\n\t/** The local block that is a dependency */\n\tdependency: string;\n\t/** A template used to resolve the import during add/update */\n\ttemplate: string;\n};\n\nconst resolveLocalImport = (\n\tmod: string,\n\tisSubDir: boolean,\n\t{\n\t\tfilePath,\n\t\tdropExtension = true,\n\t\talias,\n\t\tdirs,\n\t\tcwd,\n\t}: {\n\t\tfilePath: string;\n\t\tdirs: string[];\n\t\talias?: string;\n\t\tmodIsFile?: boolean;\n\t\tcwd: string;\n\t\tdropExtension?: boolean;\n\t}\n): Result<ResolveLocalImportResult | undefined, string> => {\n\tif (isSubDir && (mod.startsWith('./') || mod === '.')) return Ok(undefined);\n\n\t// get the path to the current category\n\tconst categoryDir = isSubDir ? path.join(filePath, '../../') : path.join(filePath, '../');\n\n\t// get the actual path to the module\n\tconst modPath = path.join(path.join(filePath, '../'), mod);\n\n\t// get the full path to the current category containing folder\n\tconst fullDir = path.join(categoryDir, '../');\n\n\tif (modPath.startsWith(fullDir)) {\n\t\treturn Ok(parsePath(modPath.slice(fullDir.length), dropExtension));\n\t}\n\n\tfor (const dir of dirs) {\n\t\tconst containingPath = path.resolve(path.join(cwd, dir));\n\t\tconst absPath = path.resolve(modPath);\n\n\t\tif (absPath.startsWith(containingPath)) {\n\t\t\treturn Ok(parsePath(absPath.slice(containingPath.length + 1), dropExtension));\n\t\t}\n\t}\n\n\treturn Err(\n\t\t`${filePath}:\\n${alias ? alias : mod} references code not contained in ${color.bold(dirs.join(', '))} and cannot be resolved.`\n\t);\n};\n\nconst parsePath = (localPath: string, dropExtension = true): ResolveLocalImportResult => {\n\tlet [category, block, ...rest] = localPath.split('/');\n\n\t// if undefined we assume we are pointing to the index file\n\tif (block === undefined) {\n\t\tblock = 'index';\n\t}\n\n\tlet trimmedBlock = block;\n\n\t// remove file extension\n\tif (dropExtension && trimmedBlock.includes('.')) {\n\t\ttrimmedBlock = trimmedBlock.slice(\n\t\t\t0,\n\t\t\ttrimmedBlock.length - path.parse(trimmedBlock).ext.length\n\t\t);\n\t}\n\n\tconst blockSpecifier = `${category}/${trimmedBlock}`;\n\n\tlet template = `{{${blockSpecifier}}}`;\n\n\tif (rest.length === 0) {\n\t\tif (trimmedBlock.length !== block.length) {\n\t\t\t// add extension to template\n\t\t\ttemplate += path.parse(block).ext;\n\t\t}\n\t} else {\n\t\ttemplate += `/${rest.join('/')}`;\n\t}\n\n\treturn { dependency: blockSpecifier, template };\n};\n\n/** Tries to resolve the modules as an alias using the tsconfig. */\nconst tryResolveLocalAlias = (\n\tmod: string,\n\tisSubDir: boolean,\n\t{ filePath, dirs, cwd }: { filePath: string; dirs: string[]; cwd: string }\n): Result<ResolveLocalImportResult | undefined, string> => {\n\tlet config: TsConfigResult | null;\n\n\ttry {\n\t\tconfig = getTsconfig(filePath, 'tsconfig.json');\n\n\t\tif (!config) {\n\t\t\t// if we don't find the config at first check for a jsconfig\n\t\t\tconfig = getTsconfig(filePath, 'jsconfig.json');\n\n\t\t\tif (!config) {\n\t\t\t\treturn Ok(undefined);\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\treturn Err(`Error while trying to get ${color.bold('tsconfig.json')}: ${err}`);\n\t}\n\n\tconst matcher = createPathsMatcher(config);\n\n\tif (matcher) {\n\t\t// if the mod is actually remote the returns paths will be empty\n\t\tconst paths = matcher(mod);\n\n\t\tfor (const modPath of paths) {\n\t\t\tconst foundMod = searchForModule(modPath);\n\n\t\t\tif (!foundMod) continue;\n\n\t\t\tconst pathResolved = path.relative(\n\t\t\t\tpath.resolve(path.join(filePath, '../')),\n\t\t\t\tfoundMod.prettyPath\n\t\t\t);\n\n\t\t\t// if it is not equal the extension has already been dropped\n\t\t\t// we omit the '' extension because it there is no extension there is nothing to be dropped\n\t\t\tconst shouldDropExtension = resolutionEquality(foundMod.prettyPath, foundMod.path, [\n\t\t\t\t'.js',\n\t\t\t\t'.ts',\n\t\t\t]);\n\n\t\t\tconst localDep = resolveLocalImport(pathResolved, isSubDir, {\n\t\t\t\tfilePath,\n\t\t\t\talias: mod,\n\t\t\t\tdropExtension: shouldDropExtension,\n\t\t\t\tdirs,\n\t\t\t\tcwd,\n\t\t\t\tmodIsFile: foundMod.type === 'file',\n\t\t\t});\n\n\t\t\tif (localDep.isErr()) return Err(localDep.unwrapErr());\n\n\t\t\tif (localDep.unwrap()) return Ok(localDep.unwrap()!);\n\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn Ok(undefined);\n};\n\n/** Node allows no extension or a .js extension or a .ts extension to all resolve to the same place because of this we employ a different method of equality.\n *\n * Basically we want to treat a path with a .js extension as equal to the same path with a .ts extension and vise versa.\n */\nconst resolutionEquality = (pathA: string, pathB: string, validExtensions = ['.ts', '.js', '']) => {\n\tif (pathA === pathB) return true;\n\n\tconst parsedA = path.parse(pathA);\n\tconst parsedB = path.parse(pathB);\n\n\tconst pathAWithoutExtension = path.join(parsedA.dir, parsedA.name);\n\tconst pathBWithoutExtension = path.join(parsedB.dir, parsedB.name);\n\n\t// if paths without extension aren't equal then return false\n\tif (pathAWithoutExtension !== pathBWithoutExtension) return false;\n\n\t// as long as both paths have a .js or .ts extension we can be sure that they are equal\n\tif (validExtensions.includes(parsedA.ext) && validExtensions.includes(parsedB.ext)) return true;\n\n\treturn false;\n};\n\n/** Searches around for the module\n *\n * @param path\n */\nconst searchForModule = (\n\tmodPath: string\n): { path: string; prettyPath: string; type: 'file' | 'directory' } | undefined => {\n\tif (fs.existsSync(modPath)) {\n\t\treturn {\n\t\t\tpath: modPath,\n\t\t\tprettyPath: modPath,\n\t\t\ttype: fs.statSync(modPath).isDirectory() ? 'directory' : 'file',\n\t\t};\n\t}\n\n\tconst containing = path.join(modPath, '../');\n\n\t// if containing folder doesn't exist this can't exist\n\tif (!fs.existsSync(containing)) return undefined;\n\n\tconst modParsed = path.parse(modPath);\n\n\t// sometimes it will point to .js because it will resolve in prod but not for us\n\tif (modParsed.ext === '.js') {\n\t\tconst newPath = `${modPath.slice(0, modPath.length - 3)}.ts`;\n\n\t\tif (fs.existsSync(newPath)) return { path: newPath, prettyPath: modPath, type: 'file' };\n\t}\n\n\tconst files = fs.readdirSync(containing);\n\n\tfor (const file of files) {\n\t\tconst fileParsed = path.parse(file);\n\n\t\t// this way the extension doesn't matter\n\t\tif (fileParsed.name === modParsed.base) {\n\t\t\tconst filePath = path.join(containing, file);\n\n\t\t\t// we remove the extension since it wasn't included by the user\n\t\t\tconst prettyPath = filePath.slice(0, filePath.length - fileParsed.ext.length);\n\n\t\t\treturn {\n\t\t\t\tpath: filePath,\n\t\t\t\tprettyPath: prettyPath,\n\t\t\t\ttype: fs.statSync(filePath).isDirectory() ? 'directory' : 'file',\n\t\t\t};\n\t\t}\n\t}\n\n\treturn undefined;\n};\n\n/** Iterates over the dependency and resolves each one using the nearest package.json file.\n * Strips node APIs and pins the version of each dependency based on what is in the package.json.\n *\n * @param deps\n * @param filePath\n * @returns\n */\nconst resolveRemoteDeps = (\n\tdeps: string[],\n\tfilePath: string,\n\t{ doNotInstall }: { doNotInstall: string[] } = {\n\t\tdoNotInstall: [],\n\t}\n) => {\n\tconst exemptDeps = new Set(doNotInstall);\n\n\tconst filteredDeps = deps.filter(\n\t\t(dep) => !builtinModules.includes(dep) && !dep.startsWith('node:')\n\t);\n\n\tconst pkgPath = findNearestPackageJson(path.dirname(filePath), '');\n\n\tconst dependencies = new Set<string>();\n\tconst devDependencies = new Set<string>();\n\n\tif (pkgPath) {\n\t\tconst { devDependencies: packageDevDependencies, dependencies: packageDependencies } =\n\t\t\tJSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\n\n\t\tfor (const dep of filteredDeps) {\n\t\t\tconst parsed = parsePackageName(dep);\n\n\t\t\tif (parsed.isErr()) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped adding import \\`${color.cyan(dep)}\\`. Reason: Couldn't parse package name`\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst depInfo = parsed.unwrap();\n\n\t\t\tif (!validatePackageName(depInfo.name).validForNewPackages) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped adding import \\`${color.cyan(dep)}\\`. Reason: Not a valid package name`\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (exemptDeps.has(depInfo.name)) continue;\n\n\t\t\tlet version: string | undefined = undefined;\n\t\t\tif (packageDependencies !== undefined) {\n\t\t\t\tversion = packageDependencies[depInfo.name];\n\t\t\t}\n\n\t\t\tif (version !== undefined) {\n\t\t\t\tdependencies.add(`${depInfo.name}@${version}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (packageDevDependencies !== undefined) {\n\t\t\t\tversion = packageDevDependencies[depInfo.name];\n\t\t\t}\n\n\t\t\tif (version !== undefined) {\n\t\t\t\tdevDependencies.add(`${depInfo.name}@${version}`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if no version found just add it without a version\n\t\t\tdependencies.add(depInfo.name);\n\t\t}\n\t}\n\n\treturn {\n\t\tdependencies: Array.from(dependencies),\n\t\tdevDependencies: Array.from(devDependencies),\n\t};\n};\n\nconst languages: Lang[] = [css, html, json, jsonc, sass, svelte, svg, typescript, vue, yaml];\n\nexport {\n\tcss,\n\thtml,\n\tjson,\n\tjsonc,\n\tsass,\n\tsvelte,\n\tsvg,\n\ttypescript,\n\tvue,\n\tyaml,\n\tlanguages,\n\tresolutionEquality,\n};\n","import fs from 'node:fs';\nimport color from 'chalk';\nimport { program } from 'commander';\nimport type { Ignore } from 'ignore';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport * as ascii from '../ascii';\nimport type { RegistryConfig } from '../config';\nimport { languages } from '../language-support';\nimport { isDependedOn } from './check';\n\nexport const blockSchema = v.object({\n\tname: v.string(),\n\tcategory: v.string(),\n\tlocalDependencies: v.array(v.string()),\n\tdependencies: v.array(v.string()),\n\tdevDependencies: v.array(v.string()),\n\ttests: v.boolean(),\n\tlist: v.optional(v.boolean(), true),\n\t/** Where to find the block relative to root */\n\tdirectory: v.string(),\n\tsubdirectory: v.boolean(),\n\tfiles: v.array(v.string()),\n\t_imports_: v.record(v.string(), v.string()),\n});\n\nexport const categorySchema = v.object({\n\tname: v.string(),\n\tblocks: v.array(blockSchema),\n});\n\nexport type Category = v.InferOutput<typeof categorySchema>;\n\nexport type Block = v.InferOutput<typeof blockSchema>;\n\nconst TEST_SUFFIXES = ['.test.ts', '_test.ts', '.test.js', '_test.js'] as const;\n\nconst isTestFile = (file: string): boolean =>\n\tTEST_SUFFIXES.find((suffix) => file.endsWith(suffix)) !== undefined;\n\ntype Options = {\n\tcwd: string;\n\tignore: Ignore;\n\tconfig: RegistryConfig;\n};\n\n/** Using the provided path to the blocks folder builds the blocks into categories and also resolves dependencies\n *\n * @param blocksPath\n * @returns\n */\nconst buildBlocksDirectory = (\n\tblocksPath: string,\n\t{\n\t\tcwd,\n\t\tignore,\n\t\tconfig: {\n\t\t\texcludeDeps,\n\t\t\tincludeBlocks,\n\t\t\tincludeCategories,\n\t\t\texcludeBlocks,\n\t\t\texcludeCategories,\n\t\t\tdirs,\n\t\t\tdoNotListBlocks,\n\t\t\tdoNotListCategories,\n\t\t\tlistBlocks,\n\t\t\tlistCategories,\n\t\t},\n\t}: Options\n): Category[] => {\n\tlet paths: string[];\n\n\ttry {\n\t\tpaths = fs.readdirSync(blocksPath);\n\t} catch {\n\t\tprogram.error(color.red(`Couldn't read the ${color.bold(blocksPath)} directory.`));\n\t}\n\n\tconst categories: Category[] = [];\n\n\tfor (const categoryPath of paths) {\n\t\tconst categoryDir = path.join(blocksPath, categoryPath);\n\n\t\tconst stat = fs.statSync(categoryDir);\n\n\t\tif (stat.isFile()) continue;\n\n\t\t// we append a '/' to tell ignore that this is a directory not a file\n\t\tconst ignorable = `${path.relative(cwd, categoryDir)}/`;\n\n\t\tif (ignore.ignores(ignorable)) continue;\n\n\t\tconst categoryName = path.basename(categoryPath);\n\n\t\t// if excludeCategories enabled and category is part of excludeCategories\n\t\tif (\n\t\t\texcludeCategories.length > 0 &&\n\t\t\texcludeCategories.find((val) => val.trim() === categoryName.trim())\n\t\t)\n\t\t\tcontinue;\n\n\t\t// if includeCategories enabled and category is not part of includeCategories skip adding it\n\t\tif (\n\t\t\tincludeCategories.length > 0 &&\n\t\t\t!includeCategories.find((val) => val.trim() === categoryName.trim())\n\t\t)\n\t\t\tcontinue;\n\n\t\tlet shouldListCategory = true;\n\n\t\tif (doNotListCategories.includes(categoryName)) {\n\t\t\tshouldListCategory = false;\n\t\t}\n\n\t\tif (listCategories.length > 0 && !listCategories.includes(categoryName)) {\n\t\t\tshouldListCategory = false;\n\t\t}\n\n\t\tconst category: Category = {\n\t\t\tname: categoryName,\n\t\t\tblocks: [],\n\t\t};\n\n\t\tconst files = fs.readdirSync(categoryDir);\n\n\t\tfor (const file of files) {\n\t\t\tconst blockDir = path.join(categoryDir, file);\n\n\t\t\tif (fs.statSync(blockDir).isFile()) {\n\t\t\t\tif (isTestFile(file)) continue;\n\n\t\t\t\tconst name = transformBlockName(file);\n\n\t\t\t\tlet shouldListBlock = true;\n\n\t\t\t\tif (doNotListBlocks.includes(name)) {\n\t\t\t\t\tshouldListBlock = false;\n\t\t\t\t}\n\n\t\t\t\tif (listBlocks.length > 0 && !listBlocks.includes(name)) {\n\t\t\t\t\tshouldListBlock = false;\n\t\t\t\t}\n\n\t\t\t\t// if excludeBlocks enabled and block is part of excludeBlocks skip adding it\n\t\t\t\tif (\n\t\t\t\t\texcludeBlocks.length > 0 &&\n\t\t\t\t\texcludeBlocks.find((val) => val.trim() === name.trim())\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\t// if includeBlocks enabled and block is not part of includeBlocks skip adding it\n\t\t\t\tif (\n\t\t\t\t\tincludeBlocks.length > 0 &&\n\t\t\t\t\t!includeBlocks.find((val) => val.trim() === name.trim())\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tconst lang = languages.find((resolver) => resolver.matches(file));\n\n\t\t\t\tif (!lang) {\n\t\t\t\t\tconst error = 'files are not currently supported!';\n\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped \\`${color.bold(blockDir)}\\` \\`*${color.bold(\n\t\t\t\t\t\t\tpath.parse(file).ext\n\t\t\t\t\t\t)}\\` ${error}`\n\t\t\t\t\t);\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// tries to find a test file with the same name as the file\n\t\t\t\tconst testsPath = files.find((f) =>\n\t\t\t\t\tTEST_SUFFIXES.find((suffix) => f === `${name}${suffix}`)\n\t\t\t\t);\n\n\t\t\t\tconst { dependencies, devDependencies, local, imports } = lang\n\t\t\t\t\t.resolveDependencies({\n\t\t\t\t\t\tfilePath: blockDir,\n\t\t\t\t\t\tisSubDir: false,\n\t\t\t\t\t\texcludeDeps,\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t\tdirs,\n\t\t\t\t\t})\n\t\t\t\t\t.match(\n\t\t\t\t\t\t(val) => val,\n\t\t\t\t\t\t(err) => {\n\t\t\t\t\t\t\tprogram.error(color.red(err));\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\tconst block: Block = {\n\t\t\t\t\tname,\n\t\t\t\t\tdirectory: path.relative(cwd, categoryDir),\n\t\t\t\t\tcategory: categoryName,\n\t\t\t\t\ttests: testsPath !== undefined,\n\t\t\t\t\tsubdirectory: false,\n\t\t\t\t\tlist: shouldListCategory ? shouldListBlock : false,\n\t\t\t\t\tfiles: [file],\n\t\t\t\t\tlocalDependencies: local,\n\t\t\t\t\t_imports_: imports,\n\t\t\t\t\tdependencies,\n\t\t\t\t\tdevDependencies,\n\t\t\t\t};\n\n\t\t\t\tif (testsPath !== undefined) {\n\t\t\t\t\tblock.files.push(testsPath);\n\t\t\t\t}\n\n\t\t\t\tcategory.blocks.push(block);\n\t\t\t} else {\n\t\t\t\tconst blockName = file;\n\n\t\t\t\tlet shouldListBlock = true;\n\n\t\t\t\tif (doNotListBlocks.includes(blockName)) {\n\t\t\t\t\tshouldListBlock = false;\n\t\t\t\t}\n\n\t\t\t\tif (listBlocks.length > 0 && !listBlocks.includes(blockName)) {\n\t\t\t\t\tshouldListBlock = false;\n\t\t\t\t}\n\n\t\t\t\t// if excludeBlocks enabled and block is part of excludeBlocks skip adding it\n\t\t\t\tif (\n\t\t\t\t\texcludeBlocks.length > 0 &&\n\t\t\t\t\texcludeBlocks.find((val) => val.trim() === blockName.trim())\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\t// if includeBlocks enabled and block is not part of includeBlocks skip adding it\n\t\t\t\tif (\n\t\t\t\t\tincludeBlocks.length > 0 &&\n\t\t\t\t\t!includeBlocks.find((val) => val.trim() === blockName.trim())\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tconst blockFiles = fs.readdirSync(blockDir);\n\n\t\t\t\tconst hasTests = blockFiles.findIndex((f) => isTestFile(f)) !== -1;\n\n\t\t\t\tconst localDepsSet = new Set<string>();\n\t\t\t\tconst depsSet = new Set<string>();\n\t\t\t\tconst devDepsSet = new Set<string>();\n\t\t\t\tconst imports: Record<string, string> = {};\n\n\t\t\t\t// if it is a directory\n\t\t\t\tfor (const f of blockFiles) {\n\t\t\t\t\tif (isTestFile(f)) continue;\n\n\t\t\t\t\tif (fs.statSync(path.join(blockDir, f)).isDirectory()) {\n\t\t\t\t\t\tconst error = 'subdirectories are not currently supported!';\n\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped \\`${color.bold(path.join(blockDir, f))}\\` ${error}`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst lang = languages.find((resolver) => resolver.matches(f));\n\n\t\t\t\t\tif (!lang) {\n\t\t\t\t\t\tconst error = 'files are not currently supported!';\n\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped \\`${path.join(blockDir, f)}\\` \\`*${color.bold(\n\t\t\t\t\t\t\t\tpath.parse(f).ext\n\t\t\t\t\t\t\t)}\\` ${error}`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst {\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\tdependencies,\n\t\t\t\t\t\tdevDependencies,\n\t\t\t\t\t\timports: imps,\n\t\t\t\t\t} = lang\n\t\t\t\t\t\t.resolveDependencies({\n\t\t\t\t\t\t\tfilePath: path.join(blockDir, f),\n\t\t\t\t\t\t\tisSubDir: true,\n\t\t\t\t\t\t\texcludeDeps,\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\tdirs,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.match(\n\t\t\t\t\t\t\t(val) => val,\n\t\t\t\t\t\t\t(err) => {\n\t\t\t\t\t\t\t\tprogram.error(color.red(err));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\tfor (const dep of local) {\n\t\t\t\t\t\t// don't add self\n\t\t\t\t\t\tif (dep === `${categoryName}/${blockName}`) continue;\n\n\t\t\t\t\t\tlocalDepsSet.add(dep);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const dep of dependencies) {\n\t\t\t\t\t\tdepsSet.add(dep);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const dep of devDependencies) {\n\t\t\t\t\t\tdevDepsSet.add(dep);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const [k, v] of Object.entries(imps)) {\n\t\t\t\t\t\timports[k] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst block: Block = {\n\t\t\t\t\tname: blockName,\n\t\t\t\t\tdirectory: path.relative(cwd, blockDir),\n\t\t\t\t\tcategory: categoryName,\n\t\t\t\t\ttests: hasTests,\n\t\t\t\t\tsubdirectory: true,\n\t\t\t\t\tlist: shouldListCategory ? shouldListBlock : false,\n\t\t\t\t\tfiles: [...blockFiles],\n\t\t\t\t\tlocalDependencies: Array.from(localDepsSet.keys()),\n\t\t\t\t\tdependencies: Array.from(depsSet.keys()),\n\t\t\t\t\tdevDependencies: Array.from(devDepsSet.keys()),\n\t\t\t\t\t_imports_: imports,\n\t\t\t\t};\n\n\t\t\t\tcategory.blocks.push(block);\n\t\t\t}\n\t\t}\n\n\t\tcategories.push(category);\n\t}\n\n\treturn categories;\n};\n\n/** Takes the given file and returns the block name */\nconst transformBlockName = (file: string) => {\n\t// DO NOT enable until resolution is fixed\n\t// custom transform for `.svelte.(js|ts)` files to drop the `.svelte` as well\n\t// if (file.endsWith('.svelte.ts') || file.endsWith('.svelte.js')) {\n\t// \treturn file.slice(0, file.length - 10);\n\t// }\n\n\treturn path.parse(path.basename(file)).name;\n};\n\nconst pruneUnused = (categories: Category[]): [Category[], number] => {\n\tconst pruned: Category[] = [];\n\tconst prunedCount = 0;\n\n\tfor (const category of categories) {\n\t\tconst catBlocks: Block[] = [];\n\n\t\tfor (const block of category.blocks) {\n\t\t\tconst specifier = `${block.category}/${block.name}`;\n\n\t\t\tif (!block.list) {\n\t\t\t\tconst dependedOn = isDependedOn(specifier, categories);\n\n\t\t\t\tif (!dependedOn) continue;\n\t\t\t}\n\n\t\t\tcatBlocks.push(block);\n\t\t}\n\n\t\tif (catBlocks.length > 0) pruned.push({ name: category.name, blocks: catBlocks });\n\t}\n\n\treturn [pruned, prunedCount];\n};\n\nconst readCategories = (outputFilePath: string): Category[] =>\n\tv.parse(v.array(categorySchema), JSON.parse(fs.readFileSync(outputFilePath).toString()));\n\nexport { buildBlocksDirectory, readCategories, isTestFile, pruneUnused };\n","export const OUTPUT_FILE = 'jsrepo-manifest.json';\n\nexport interface CLIContext {\n\t/** The package.json of the CLI */\n\tpackage: {\n\t\tname: string;\n\t\tversion: string;\n\t\tdescription: string;\n\t\trepository: {\n\t\t\turl: string;\n\t\t};\n\t\tlatestVersion?: string;\n\t};\n\t/** Resolves the path relative to the root of the application\n\t *\n\t * @param path\n\t * @returns\n\t */\n\tresolveRelativeToRoot: (path: string) => string;\n}\n","import Conf from 'conf';\n\nconst get = () => new Conf({ projectName: 'jsrepo' });\n\nexport { get };\n","import fs from 'node:fs';\nimport color from 'chalk';\nimport { program } from 'commander';\nimport path from 'pathe';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport { mapToArray } from './blocks/utils/map-to-array';\nimport * as url from './blocks/utils/url';\nimport type { Block } from './build';\nimport { type ProjectConfig, getPathForBlock, resolvePaths } from './config';\nimport * as providers from './providers';\n\nexport type RemoteBlock = Block & { sourceRepo: providers.Info };\n\nexport type InstallingBlock = {\n\tname: string;\n\tsubDependency: boolean;\n\tblock: RemoteBlock;\n};\n\nconst resolveTree = async (\n\tblockSpecifiers: string[],\n\tblocksMap: Map<string, RemoteBlock>,\n\trepoPaths: providers.ResolvedRepo[],\n\tinstalled: Map<string, InstallingBlock> = new Map()\n): Promise<Result<InstallingBlock[], string>> => {\n\tconst blocks = new Map<string, InstallingBlock>();\n\n\tfor (const blockSpecifier of blockSpecifiers) {\n\t\tlet block: RemoteBlock | undefined = undefined;\n\n\t\tconst provider = providers.providers.find((p) => blockSpecifier.startsWith(p.name()));\n\n\t\t// if the block starts with github (or another provider) we know it has been resolved\n\t\tif (!provider) {\n\t\t\tif (repoPaths.length === 0) {\n\t\t\t\treturn Err(\n\t\t\t\t\tcolor.red(\n\t\t\t\t\t\t`If your config doesn't contain repos then you must provide the repo in the block specifier ex: \\`${color.bold(\n\t\t\t\t\t\t\t`github/ieedan/std/${blockSpecifier}`\n\t\t\t\t\t\t)}\\`!`\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// check every repo for the block and return the first block found\n\t\t\tfor (const { info: providerInfo } of repoPaths) {\n\t\t\t\tconst [repoIdent, specifier] = providerInfo.provider.parseBlockSpecifier(\n\t\t\t\t\turl.join(providerInfo.url, blockSpecifier)\n\t\t\t\t);\n\n\t\t\t\tconst tempBlock = blocksMap.get(url.join(repoIdent, specifier));\n\n\t\t\t\tif (tempBlock === undefined) continue;\n\n\t\t\t\tblock = tempBlock;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\t// get shortened name\n\t\t\tconst [repoIdent, specifier] = provider.parseBlockSpecifier(blockSpecifier);\n\n\t\t\t// just beautifies name a bit\n\t\t\tblock = blocksMap.get(url.join(repoIdent, specifier));\n\t\t}\n\n\t\tif (!block) {\n\t\t\treturn Err(`Invalid block! ${color.bold(blockSpecifier)} does not exist!`);\n\t\t}\n\n\t\tconst specifier = `${block.category}/${block.name}`;\n\n\t\tblocks.set(specifier, { name: block.name, subDependency: false, block });\n\n\t\tif (block.localDependencies && block.localDependencies.length > 0) {\n\t\t\tconst subDeps = await resolveTree(\n\t\t\t\tblock.localDependencies.filter((dep) => !blocks.has(dep) && !installed.has(dep)),\n\t\t\t\tblocksMap,\n\t\t\t\trepoPaths,\n\t\t\t\tblocks\n\t\t\t);\n\n\t\t\tif (subDeps.isErr()) return Err(subDeps.unwrapErr());\n\n\t\t\tfor (const dep of subDeps.unwrap()) {\n\t\t\t\tblocks.set(`${dep.block.category}/${dep.block.name}`, dep);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Ok(mapToArray(blocks, (_, val) => val));\n};\n\ntype InstalledBlock = {\n\tspecifier: `${string}/${string}`;\n\tpath: string;\n\tblock: Block;\n};\n\n/** Finds installed blocks and returns them as `<category>/<name>`\n *\n * @param blocks\n * @param config\n * @returns\n */\nconst getInstalled = (\n\tblocks: Map<string, Block>,\n\tconfig: ProjectConfig,\n\tcwd: string\n): InstalledBlock[] => {\n\tconst installedBlocks: InstalledBlock[] = [];\n\n\tconst resolvedPathsResult = resolvePaths(config.paths, cwd);\n\n\tif (resolvedPathsResult.isErr()) {\n\t\tprogram.error(color.red(resolvedPathsResult.unwrapErr()));\n\t}\n\n\tconst resolvedPaths = resolvedPathsResult.unwrap();\n\n\tfor (const [_, block] of blocks) {\n\t\tconst baseDir = getPathForBlock(block, resolvedPaths, cwd);\n\n\t\tlet blockPath = path.join(baseDir, block.files[0]);\n\t\tif (block.subdirectory) {\n\t\t\tblockPath = path.join(baseDir, block.name);\n\t\t}\n\n\t\tif (fs.existsSync(blockPath))\n\t\t\tinstalledBlocks.push({\n\t\t\t\tspecifier: `${block.category}/${block.name}`,\n\t\t\t\tpath: blockPath,\n\t\t\t\tblock,\n\t\t\t});\n\t}\n\n\treturn installedBlocks;\n};\n\nexport { resolveTree, getInstalled };\n","import type { Agent } from 'package-manager-detector';\n\nexport type Flags = {\n\t'no-workspace'?: string;\n\t'install-as-dev-dependency': string;\n};\n\nexport const bun: Flags = {\n\t'no-workspace': '--no-workspace',\n\t'install-as-dev-dependency': '-D',\n};\n\nexport const deno: Flags = {\n\t'install-as-dev-dependency': '-D',\n};\n\nexport const npm: Flags = {\n\t'no-workspace': '--workspaces=false',\n\t'install-as-dev-dependency': '-D',\n};\n\nexport const pnpm: Flags = {\n\t'no-workspace': '--ignore-workspace',\n\t'install-as-dev-dependency': '-D',\n};\n\nexport const yarn: Flags = {\n\t'no-workspace': '--focus',\n\t'install-as-dev-dependency': '-D',\n};\n\nexport const flags: Record<Agent, Flags> = {\n\tbun,\n\tnpm,\n\tpnpm,\n\tdeno,\n\tyarn,\n\t'yarn@berry': yarn,\n\t'pnpm@6': pnpm,\n};\n","import color from 'chalk';\nimport { execa } from 'execa';\nimport { type Agent, resolveCommand } from 'package-manager-detector';\nimport path from 'pathe';\nimport { flags } from './blocks/package-managers/flags';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport type { ProjectConfig } from './config';\n\nexport type Options = {\n\tpm: Agent;\n\tdeps: string[];\n\t/** Install as devDependency */\n\tdev: boolean;\n\tcwd: string;\n\tignoreWorkspace?: boolean;\n};\n\n/** Installs the provided dependencies using the provided package manager\n *\n * @param param0\n * @returns\n */\nconst installDependencies = async ({\n\tpm,\n\tdeps,\n\tdev,\n\tcwd,\n\tignoreWorkspace = false,\n}: Options): Promise<Result<string[], string>> => {\n\tconst args = [...deps];\n\n\tif (dev) {\n\t\targs.push(flags[pm]['install-as-dev-dependency']);\n\t}\n\n\tconst noWorkspace = flags[pm]['no-workspace'];\n\n\tif (ignoreWorkspace && noWorkspace) {\n\t\targs.push(noWorkspace);\n\t}\n\n\tconst add = resolveCommand(pm, 'add', args);\n\n\tif (add == null) return Err(color.red(`Could not resolve add command for '${pm}'.`));\n\n\ttry {\n\t\tawait execa(add.command, [...add.args], { cwd });\n\n\t\treturn Ok(deps);\n\t} catch {\n\t\treturn Err(\n\t\t\tcolor.red(\n\t\t\t\t`Failed to install ${color.bold(deps.join(', '))}! Failed while running '${color.bold(\n\t\t\t\t\t`${add.command} ${add.args.join(' ')}`\n\t\t\t\t)}'`\n\t\t\t)\n\t\t);\n\t}\n};\n\nconst templatePattern = /\\{\\{([^\\/]+)\\/([^\\}]+)\\}\\}/g;\n\nexport type ResolveOptions = {\n\ttemplate: string;\n\tconfig: ProjectConfig;\n\tdestPath: string;\n\tcwd: string;\n};\n\n/** Takes a template and uses replaces it with an alias or relative path that resolves to the correct block\n *\n * @param param0\n * @returns\n */\nconst resolveLocalDependencyTemplate = ({ template, config, destPath, cwd }: ResolveOptions) => {\n\tconst destDir = path.join(destPath, '../');\n\n\treturn template.replace(templatePattern, (_, category, name) => {\n\t\tif (config.paths[category] === undefined) {\n\t\t\t// if relative make it relative\n\t\t\tif (config.paths['*'].startsWith('.')) {\n\t\t\t\tconst relative = path.relative(\n\t\t\t\t\tdestDir,\n\t\t\t\t\tpath.join(cwd, config.paths['*'], category, name)\n\t\t\t\t);\n\n\t\t\t\treturn relative.startsWith('.') ? relative : `./${relative}`;\n\t\t\t}\n\n\t\t\treturn path.join(config.paths['*'], category, name);\n\t\t}\n\n\t\t// if relative make it relative\n\t\tif (config.paths[category].startsWith('.')) {\n\t\t\tconst relative = path.relative(destDir, path.join(cwd, config.paths[category], name));\n\n\t\t\treturn relative.startsWith('.') ? relative : `./${relative}`;\n\t\t}\n\n\t\treturn path.join(config.paths[category], name);\n\t});\n};\n\nexport { installDependencies, resolveLocalDependencyTemplate };\n","import type { PartialConfiguration } from '@biomejs/wasm-nodejs';\nimport color from 'chalk';\nimport escapeStringRegexp from 'escape-string-regexp';\nimport type * as prettier from 'prettier';\nimport { Err, Ok, type Result } from './blocks/types/result';\nimport type { ProjectConfig } from './config';\nimport { resolveLocalDependencyTemplate } from './dependencies';\nimport { languages } from './language-support';\n\ntype TransformRemoteContentOptions = {\n\tfile: {\n\t\t/** The content of the file */\n\t\tcontent: string;\n\t\t/** The dest path of the file used to determine the language */\n\t\tdestPath: string;\n\t};\n\tconfig: ProjectConfig;\n\twatermark: string;\n\timports: Record<string, string>;\n\tprettierOptions: prettier.Options | null;\n\tbiomeOptions: PartialConfiguration | null;\n\tcwd: string;\n\tverbose?: (msg: string) => void;\n};\n\n/** Makes the necessary modifications to the content of the file to ensure it works properly in the users project\n *\n * @param param0\n * @returns\n */\nconst transformRemoteContent = async ({\n\tfile,\n\tconfig,\n\timports,\n\twatermark,\n\tprettierOptions,\n\tbiomeOptions,\n\tcwd,\n\tverbose,\n}: TransformRemoteContentOptions): Promise<Result<string, string>> => {\n\tconst lang = languages.find((lang) => lang.matches(file.destPath));\n\n\tlet content: string = file.content;\n\n\tif (lang) {\n\t\tif (config.watermark) {\n\t\t\tconst comment = lang.comment(watermark);\n\n\t\t\tcontent = `${comment}\\n\\n${content}`;\n\t\t}\n\n\t\tverbose?.(`Formatting ${color.bold(file.destPath)}`);\n\n\t\ttry {\n\t\t\tcontent = await lang.format(content, {\n\t\t\t\tfilePath: file.destPath,\n\t\t\t\tformatter: config.formatter,\n\t\t\t\tprettierOptions,\n\t\t\t\tbiomeOptions,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\treturn Err(`Error formatting ${color.bold(file.destPath)} ${err}`);\n\t\t}\n\t}\n\n\t// transform imports\n\tfor (const [literal, template] of Object.entries(imports)) {\n\t\tconst resolvedImport = resolveLocalDependencyTemplate({\n\t\t\ttemplate,\n\t\t\tconfig,\n\t\t\tdestPath: file.destPath,\n\t\t\tcwd,\n\t\t});\n\n\t\t// this way we only replace the exact import since it will be surrounded in quotes\n\t\tconst literalRegex = new RegExp(`(['\"])${escapeStringRegexp(literal)}\\\\1`, 'g');\n\n\t\tcontent = content.replaceAll(literalRegex, `$1${resolvedImport}$1`);\n\t}\n\n\treturn Ok(content);\n};\n\ntype FormatOptions = {\n\tfile: {\n\t\t/** The content of the file */\n\t\tcontent: string;\n\t\t/** The dest path of the file used to determine the language */\n\t\tdestPath: string;\n\t};\n\tconfig: ProjectConfig;\n\tprettierOptions: prettier.Options | null;\n\tbiomeOptions: PartialConfiguration | null;\n};\n\n/** Auto detects the language and formats the file content.\n *\n * @param param0\n * @returns\n */\nconst formatFile = async ({\n\tfile,\n\tconfig,\n\tprettierOptions,\n\tbiomeOptions,\n}: FormatOptions): Promise<string> => {\n\tconst lang = languages.find((lang) => lang.matches(file.destPath));\n\n\tlet newContent = file.content;\n\n\tif (lang) {\n\t\ttry {\n\t\t\tnewContent = await lang.format(file.content, {\n\t\t\t\tfilePath: file.destPath,\n\t\t\t\tformatter: config.formatter,\n\t\t\t\tprettierOptions,\n\t\t\t\tbiomeOptions,\n\t\t\t});\n\t\t} catch {\n\t\t\treturn newContent;\n\t\t}\n\t}\n\n\treturn newContent;\n};\n\nexport { transformRemoteContent, formatFile };\n","import fs from 'node:fs';\nimport type { PartialConfiguration } from '@biomejs/wasm-nodejs';\nimport path from 'pathe';\nimport * as prettier from 'prettier';\nimport type { Formatter } from './config';\n\ntype FormatterConfig = {\n\tprettierOptions: prettier.Options | null;\n\tbiomeOptions: PartialConfiguration | null;\n};\n\nconst loadFormatterConfig = async ({\n\tformatter,\n\tcwd,\n}: { formatter?: Formatter; cwd: string }): Promise<FormatterConfig> => {\n\tlet prettierOptions: prettier.Options | null = null;\n\tif (formatter === 'prettier') {\n\t\tprettierOptions = await prettier.resolveConfig(path.join(cwd, '.prettierrc'));\n\t}\n\n\tlet biomeOptions: PartialConfiguration | null = null;\n\tif (formatter === 'biome') {\n\t\tconst configPath = path.join(cwd, 'biome.json');\n\t\tif (fs.existsSync(configPath)) {\n\t\t\tbiomeOptions = JSON.parse(fs.readFileSync(configPath).toString());\n\t\t}\n\t}\n\n\treturn {\n\t\tbiomeOptions,\n\t\tprettierOptions,\n\t};\n};\n\nexport { type FormatterConfig, loadFormatterConfig };\n","const getWatermark = (version: string, repoUrl: string): string => {\n\treturn `jsrepo ${version}\\nInstalled from ${repoUrl}\\n${new Date()\n\t\t.toLocaleDateString()\n\t\t.replaceAll('/', '-')}`;\n};\n\nexport { getWatermark };\n","import { intro, spinner } from '@clack/prompts';\nimport boxen, { type Options as BoxenOptions } from 'boxen';\nimport color from 'chalk';\nimport { detectSync, resolveCommand } from 'package-manager-detector';\nimport semver from 'semver';\nimport * as ascii from './ascii';\nimport { stripAsni } from './blocks/utils/strip-ansi';\nimport type { CLIContext } from './context';\n\nexport type Task = {\n\tloadingMessage: string;\n\tcompletedMessage: string;\n\trun: () => Promise<void>;\n};\n\ntype TaskOptions = {\n\tverbose?: (msg: string) => void;\n};\n\nconst runTasks = async (tasks: Task[], { verbose = undefined }: TaskOptions) => {\n\tconst loading = spinner();\n\n\tfor (const task of tasks) {\n\t\tif (verbose) {\n\t\t\tverbose(task.loadingMessage);\n\t\t} else {\n\t\t\tloading.start(task.loadingMessage);\n\t\t}\n\n\t\ttry {\n\t\t\tawait task.run();\n\t\t} catch (err) {\n\t\t\tloading.stop(`Error while ${task.loadingMessage}`);\n\t\t\tconsole.error(err);\n\t\t}\n\n\t\tif (verbose) {\n\t\t\tverbose(task.completedMessage);\n\t\t} else {\n\t\t\tloading.stop(task.completedMessage);\n\t\t}\n\t}\n};\n\nexport type ConcurrentTask = {\n\trun: ({ message }: { message: (str: string) => void }) => Promise<void>;\n};\n\nexport type ConcurrentOptions = {\n\tstartMessage: string;\n\tstopMessage: string;\n\ttasks: ConcurrentTask[];\n\tverbose?: (msg: string) => void;\n};\n\nconst runTasksConcurrently = async ({\n\ttasks,\n\tstartMessage,\n\tstopMessage,\n\tverbose,\n}: ConcurrentOptions) => {\n\tconst loading = spinner();\n\n\tconst message = (msg: string) => {\n\t\tif (verbose) {\n\t\t\tverbose(msg);\n\t\t} else {\n\t\t\tloading.message(msg);\n\t\t}\n\t};\n\n\tif (verbose) {\n\t\tverbose(startMessage);\n\t} else {\n\t\tloading.start(startMessage);\n\t}\n\n\tawait Promise.all([...tasks.map((t) => t.run({ message }))]);\n\n\tif (verbose) {\n\t\tverbose(stopMessage);\n\t} else {\n\t\tloading.stop(stopMessage);\n\t}\n};\n\nexport const boxenDefaultOptions: BoxenOptions = {\n\tpadding: 1,\n\tborderColor: 'gray',\n\tborderStyle: {\n\t\ttopLeft: stripAsni(ascii.JUNCTION_RIGHT),\n\t\tbottomLeft: stripAsni(ascii.JUNCTION_RIGHT),\n\t\ttopRight: stripAsni(ascii.TOP_RIGHT_CORNER),\n\t\ttop: stripAsni(ascii.HORIZONTAL_LINE),\n\t\tbottom: stripAsni(ascii.HORIZONTAL_LINE),\n\t\tbottomRight: stripAsni(ascii.BOTTOM_RIGHT_CORNER),\n\t\tleft: stripAsni(ascii.VERTICAL_LINE),\n\t\tright: stripAsni(ascii.VERTICAL_LINE),\n\t},\n};\n\nconst nextSteps = (steps: string[]): string => {\n\tconst box = boxen(steps.join('\\n'), {\n\t\t...boxenDefaultOptions,\n\t\ttitle: 'Next Steps',\n\t\ttextAlignment: 'left',\n\t});\n\n\treturn `${ascii.VERTICAL_LINE}\\n${box}\\n`;\n};\n\nconst truncatedList = (items: string[], maxLength = 3) => {\n\tconst truncated = items.slice(0, maxLength);\n\n\tconst remaining = items.length - truncated.length;\n\n\treturn `${truncated.join(', ')}${remaining > 0 ? ` and ${remaining} other(s)` : ''}`;\n};\n\nconst newerVersionAvailable = (name: string, oldVersion: string, newVersion: string) => {\n\tconst pm = detectSync({ cwd: process.cwd() })?.agent ?? 'npm';\n\n\tconst installCommand = resolveCommand(pm, 'global', ['jsrepo@latest']);\n\n\tconst text: string[] = [\n\t\t`Update available! ${color.redBright(oldVersion)} -> ${color.greenBright(newVersion)}`,\n\t\t`${color.cyan('Changelog')}: https://github.com/ieedan/jsrepo/releases/tag/${name}@${newVersion}`,\n\t\t`Run ${color.cyan(`${installCommand?.command} ${installCommand?.args.join(' ')}`)} to update!`,\n\t\t'',\n\t\t`${color.yellowBright('Star')} on GitHub for updates: https://github.com/ieedan/jsrepo`,\n\t];\n\n\tconst box = boxen(text.join('\\n'), {\n\t\tborderColor: 'gray',\n\t\tpadding: 1,\n\t\tmargin: 1,\n\t\ttextAlignment: 'center',\n\t});\n\n\treturn box;\n};\n\nconst _intro = ({ package: pkg }: CLIContext) => {\n\tconsole.clear();\n\n\tif (pkg.latestVersion) {\n\t\tif (semver.lt(pkg.version, pkg.latestVersion)) {\n\t\t\tconsole.info(newerVersionAvailable(pkg.name, pkg.version, pkg.latestVersion));\n\t\t}\n\t}\n\n\tintro(`${color.bgHex('#f7df1e').black(` ${pkg.name} `)}${color.gray(` v${pkg.version} `)}`);\n};\n\nexport { runTasks, nextSteps, _intro as intro, runTasksConcurrently, truncatedList };\n","import fs from 'node:fs';\nimport {\n\tcancel,\n\tconfirm,\n\tisCancel,\n\tlog,\n\tmultiselect,\n\toutro,\n\tselect,\n\tspinner,\n\ttext,\n} from '@clack/prompts';\nimport color from 'chalk';\nimport { Command, program } from 'commander';\nimport { resolveCommand } from 'package-manager-detector/commands';\nimport { detect } from 'package-manager-detector/detect';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport { getInstalled, resolveTree } from '../utils/blocks';\nimport * as url from '../utils/blocks/utils/url';\nimport { type Block, isTestFile } from '../utils/build';\nimport {\n\ttype Formatter,\n\ttype ProjectConfig,\n\tgetPathForBlock,\n\tgetProjectConfig,\n\tprojectConfigSchema,\n\tresolvePaths,\n} from '../utils/config';\nimport { installDependencies } from '../utils/dependencies';\nimport { transformRemoteContent } from '../utils/files';\nimport { loadFormatterConfig } from '../utils/format';\nimport { getWatermark } from '../utils/get-watermark';\nimport { returnShouldInstall } from '../utils/package';\nimport * as persisted from '../utils/persisted';\nimport {\n\ttype ConcurrentTask,\n\tintro,\n\tnextSteps,\n\trunTasksConcurrently,\n\ttruncatedList,\n} from '../utils/prompts';\nimport * as providers from '../utils/providers';\n\nconst schema = v.object({\n\trepo: v.optional(v.string()),\n\tallow: v.boolean(),\n\tyes: v.boolean(),\n\tverbose: v.boolean(),\n\tcwd: v.string(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst add = new Command('add')\n\t.description('Add blocks to your project.')\n\t.argument(\n\t\t'[blocks...]',\n\t\t'Names of the blocks you want to add to your project. ex: (utils/math, github/ieedan/std/utils/math)'\n\t)\n\t.option('--repo <repo>', 'Repository to download the blocks from.')\n\t.option('-A, --allow', 'Allow jsrepo to download code from the provided repo.', false)\n\t.option('-y, --yes', 'Skip confirmation prompt.', false)\n\t.option('--verbose', 'Include debug logs.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.action(async (blockNames, opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _add(blockNames, options);\n\n\t\toutro(color.green('All done!'));\n\t});\n\ntype RemoteBlock = Block & { sourceRepo: providers.Info };\n\nconst _add = async (blockNames: string[], options: Options) => {\n\tconst verbose = (msg: string) => {\n\t\tif (options.verbose) {\n\t\t\tconsole.info(`${ascii.INFO} ${msg}`);\n\t\t}\n\t};\n\n\tverbose(`Attempting to add ${JSON.stringify(blockNames)}`);\n\n\tconst loading = spinner();\n\n\tconst configResult = getProjectConfig(options.cwd);\n\n\t/** The user has opted for no config */\n\tconst noConfig = configResult.isErr();\n\n\tlet config: ProjectConfig;\n\n\tif (configResult.isErr()) {\n\t\tlet shouldContinue = options.yes;\n\n\t\tif (!options.yes) {\n\t\t\tconst response = await confirm({\n\t\t\t\tmessage: `You don't have ${ascii.JSREPO} initialized in your project. Do you want to continue?`,\n\t\t\t\tinitialValue: false,\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tshouldContinue = response;\n\t\t}\n\n\t\tif (!shouldContinue) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// add default config used for default values in prompts\n\t\tconfig = {\n\t\t\t$schema: '',\n\t\t\tincludeTests: false,\n\t\t\twatermark: true,\n\t\t\tpaths: {\n\t\t\t\t'*': './src/blocks',\n\t\t\t},\n\t\t\trepos: [],\n\t\t};\n\t} else {\n\t\tconfig = configResult.unwrap();\n\t}\n\n\tlet repoPaths = config.repos;\n\tconst mustResolveRepos = new Set<string>();\n\tlet resolveAllRepos = false;\n\n\t// we just want to override all others if supplied via the CLI\n\tif (options.repo) {\n\t\trepoPaths = [options.repo];\n\t}\n\n\t// resolve repos for blocks\n\tfor (const blockSpecifier of blockNames) {\n\t\tconst provider = providers.providers.find((p) => blockSpecifier.startsWith(p.name()));\n\n\t\t// we are only getting repos for blocks that specified repos\n\t\tif (!provider) {\n\t\t\t// if a block doesn't specify a repo we must resolve all\n\t\t\tresolveAllRepos = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [repo] = provider.parseBlockSpecifier(blockSpecifier);\n\n\t\tconst alreadyExists =\n\t\t\t!config.repos.find((repoPath) => repoPath === repo) && !mustResolveRepos.has(repo);\n\n\t\tif (!alreadyExists) {\n\t\t\tif (!options.allow) {\n\t\t\t\tconst result = await confirm({\n\t\t\t\t\tmessage: `Allow ${ascii.JSREPO} to download and run code from ${color.cyan(repo)}?`,\n\t\t\t\t\tinitialValue: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(result) || !result) {\n\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// only add if it doesn't exist\n\t\t\trepoPaths.push(repo);\n\t\t}\n\n\t\t// this way we add the config.repos as well\n\t\tmustResolveRepos.add(repo);\n\t}\n\n\tif (!resolveAllRepos && blockNames.length > 0) {\n\t\trepoPaths = Array.from(mustResolveRepos);\n\t}\n\n\tif (!options.allow && options.repo) {\n\t\tconst result = await confirm({\n\t\t\tmessage: `Allow ${ascii.JSREPO} to download and run code from ${color.cyan(options.repo)}?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(result) || !result) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\tif (repoPaths.length === 0) {\n\t\tif (noConfig) {\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(\n\t\t\t\t\t`Fully quality blocks ex: (github/ieedan/std/utils/math) or provide the \\`${color.bold(\n\t\t\t\t\t\t'--repo'\n\t\t\t\t\t)}\\` flag to specify a registry.`\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tprogram.error(\n\t\t\tcolor.red(\n\t\t\t\t`There were no repos present in your config and you didn't provide the \\`${color.bold(\n\t\t\t\t\t'--repo'\n\t\t\t\t)}\\` flag with a repo.`\n\t\t\t)\n\t\t);\n\t}\n\n\tverbose(`Resolving ${color.cyan(repoPaths.join(', '))}`);\n\n\tif (!options.verbose) loading.start(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst resolvedRepos: providers.ResolvedRepo[] = (\n\t\tawait providers.resolvePaths(...repoPaths)\n\t).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed to get info for ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tverbose(`Resolved ${color.cyan(repoPaths.join(', '))}`);\n\n\tverbose(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst blocksMap: Map<string, RemoteBlock> = (\n\t\tawait providers.fetchBlocks(...resolvedRepos)\n\t).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed fetching blocks from ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tif (!options.verbose) loading.stop(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tverbose(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tlet installedBlocks = getInstalled(blocksMap, config, options.cwd).map((val) => val.specifier);\n\n\tlet installingBlockNames = blockNames;\n\n\t// if no blocks are provided prompt the user for what blocks they want\n\tif (installingBlockNames.length === 0) {\n\t\tconst promptResult = await multiselect({\n\t\t\tmessage: 'Select which blocks to add.',\n\t\t\toptions: Array.from(blocksMap.entries())\n\t\t\t\t.filter(([_, value]) => value.list)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tconst shortName = `${value.category}/${value.name}`;\n\n\t\t\t\t\tconst blockExists =\n\t\t\t\t\t\tinstalledBlocks.findIndex((block) => block === shortName) !== -1;\n\n\t\t\t\t\tlet label: string;\n\n\t\t\t\t\t// show the full repo if there are multiple repos\n\t\t\t\t\tif (repoPaths.length > 1) {\n\t\t\t\t\t\tlabel = `${color.cyan(\n\t\t\t\t\t\t\t`${value.sourceRepo.name}/${value.sourceRepo.owner}/${value.sourceRepo.repoName}/${value.category}`\n\t\t\t\t\t\t)}/${value.name}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlabel = `${color.cyan(value.category)}/${value.name}`;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlabel: blockExists ? color.gray(label) : label,\n\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t// show hint for `Installed` if block is already installed\n\t\t\t\t\t\thint: blockExists ? 'Installed' : undefined,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\trequired: true,\n\t\t});\n\n\t\tif (isCancel(promptResult)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tinstallingBlockNames = promptResult as string[];\n\t}\n\n\tverbose(`Installing blocks ${color.cyan(installingBlockNames.join(', '))}`);\n\n\tconst installingBlocks = (\n\t\tawait resolveTree(installingBlockNames, blocksMap, resolvedRepos)\n\t).match(\n\t\t(val) => val,\n\t\t(err) => program.error(err)\n\t);\n\n\tconst pm = (await detect({ cwd: options.cwd }))?.agent ?? 'npm';\n\n\tconst tasks: ConcurrentTask[] = [];\n\n\tlet devDeps: Set<string> = new Set<string>();\n\tlet deps: Set<string> = new Set<string>();\n\n\tconst store = persisted.get();\n\n\tif (noConfig) {\n\t\tconst zeroConfigKey = `${options.cwd}-zero-config`;\n\n\t\tconst zeroConfigParsed = v.safeParse(projectConfigSchema, store.get(zeroConfigKey));\n\n\t\tconst zeroConfig = zeroConfigParsed.success ? zeroConfigParsed.output : config;\n\n\t\tconst categories = Array.from(new Set(installingBlocks.map((b) => b.block.category)));\n\n\t\tfor (const cat of categories) {\n\t\t\tconst blocksPath = await text({\n\t\t\t\tmessage: `Where would you like to add ${color.cyan(cat)}?`,\n\t\t\t\tplaceholder: zeroConfig ? zeroConfig.paths[cat] : `./src/${cat}`,\n\t\t\t\tinitialValue: zeroConfig ? zeroConfig.paths[cat] : `./src/${cat}`,\n\t\t\t\tdefaultValue: zeroConfig ? zeroConfig.paths[cat] : `./src/${cat}`,\n\t\t\t\tvalidate(value) {\n\t\t\t\t\tif (value.trim() === '') return 'Please provide a value';\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (isCancel(blocksPath)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tconfig.paths[cat] = blocksPath;\n\t\t}\n\n\t\tif (!options.yes) {\n\t\t\tconst includeTests = await confirm({\n\t\t\t\tmessage: 'Include tests?',\n\t\t\t\tinitialValue: zeroConfig.includeTests,\n\t\t\t});\n\n\t\t\tif (isCancel(includeTests)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tconfig.includeTests = includeTests;\n\n\t\t\tconst addWatermark = await confirm({\n\t\t\t\tmessage: 'Add watermark?',\n\t\t\t\tinitialValue: zeroConfig.watermark,\n\t\t\t});\n\n\t\t\tif (isCancel(addWatermark)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tconfig.watermark = addWatermark;\n\t\t}\n\n\t\tlet defaultFormatter = 'none';\n\n\t\tif (fs.existsSync(path.join(options.cwd, '.prettierrc'))) {\n\t\t\tdefaultFormatter = 'prettier';\n\t\t}\n\n\t\tif (fs.existsSync(path.join(options.cwd, 'biome.json'))) {\n\t\t\tdefaultFormatter = 'biome';\n\t\t}\n\n\t\tconst response = await select({\n\t\t\tmessage: 'What formatter would you like to use?',\n\t\t\toptions: ['Prettier', 'Biome', 'None'].map((val) => ({\n\t\t\t\tvalue: val.toLowerCase(),\n\t\t\t\tlabel: val,\n\t\t\t})),\n\t\t\tinitialValue:\n\t\t\t\tdefaultFormatter === 'none'\n\t\t\t\t\t? zeroConfig.formatter\n\t\t\t\t\t\t? zeroConfig.formatter\n\t\t\t\t\t\t: 'none'\n\t\t\t\t\t: defaultFormatter,\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (response !== 'none') {\n\t\t\tconfig.formatter = response as Formatter;\n\t\t}\n\n\t\tstore.set(zeroConfigKey, config);\n\n\t\t// re-run to get installed blocks at the provided path\n\t\tinstalledBlocks = getInstalled(blocksMap, config, options.cwd).map((val) => val.specifier);\n\t}\n\n\tconst { prettierOptions, biomeOptions } = await loadFormatterConfig({\n\t\tformatter: config.formatter,\n\t\tcwd: options.cwd,\n\t});\n\n\tconst resolvedPathsResult = resolvePaths(config.paths, options.cwd);\n\n\tif (resolvedPathsResult.isErr()) {\n\t\tprogram.error(color.red(resolvedPathsResult.unwrapErr()));\n\t}\n\n\tconst resolvedPaths = resolvedPathsResult.unwrap();\n\n\tconst addedBlocks: string[] = [];\n\n\tlet overwriteAll: boolean | undefined;\n\n\tfor (const { block } of installingBlocks) {\n\t\tconst fullSpecifier = url.join(block.sourceRepo.url, block.category, block.name);\n\t\tconst shortSpecifier = `${block.category}/${block.name}`;\n\t\tconst watermark = getWatermark(context.package.version, block.sourceRepo.url);\n\n\t\tconst providerInfo = block.sourceRepo;\n\n\t\tverbose(`Setting up ${fullSpecifier}`);\n\n\t\tconst directory = getPathForBlock(block, resolvedPaths, options.cwd);\n\n\t\tconst blockExists = installedBlocks.find((b) => shortSpecifier === b);\n\n\t\tif (blockExists && !options.yes && !overwriteAll) {\n\t\t\tif (overwriteAll === undefined) {\n\t\t\t\tconst overwriteBlocks = installingBlocks\n\t\t\t\t\t.map((installing) => `${installing.block.category}/${installing.block.name}`)\n\t\t\t\t\t.filter((spec) => installedBlocks.find((b) => b === spec));\n\n\t\t\t\tlog.warn(\n\t\t\t\t\t`The following components ${color.bold.yellow('already exist')}: ${color.cyan(truncatedList(overwriteBlocks))}`\n\t\t\t\t);\n\n\t\t\t\tconst overwrite = await confirm({\n\t\t\t\t\tmessage: `Would you like to ${color.bold.red('overwrite')} all existing components?`,\n\t\t\t\t\tactive: 'Yes, overwrite everything',\n\t\t\t\t\tinactive: 'No, let me decide individually',\n\t\t\t\t\tinitialValue: false,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(overwrite)) {\n\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\toverwriteAll = overwrite;\n\t\t\t}\n\n\t\t\tif (!overwriteAll) {\n\t\t\t\tconst result = await confirm({\n\t\t\t\t\tmessage: `${color.cyan(shortSpecifier)} already exists in your project would you like to overwrite it?`,\n\t\t\t\t\tinitialValue: false,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(result)) {\n\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\t// just skip this block if they don't want to overwrite it\n\t\t\t\tif (!result) continue;\n\t\t\t}\n\t\t}\n\n\t\taddedBlocks.push(shortSpecifier);\n\n\t\ttasks.push({\n\t\t\trun: async ({ message }) => {\n\t\t\t\tmessage(`Adding ${color.cyan(fullSpecifier)}`);\n\n\t\t\t\tverbose(`Creating directory ${color.bold(directory)}`);\n\n\t\t\t\t// in case the directory didn't already exist\n\t\t\t\tfs.mkdirSync(directory, { recursive: true });\n\n\t\t\t\tverbose(`Created directory ${color.bold(directory)}`);\n\n\t\t\t\tconst files: { content: string; destPath: string }[] = [];\n\n\t\t\t\tconst getSourceFile = async (filePath: string) => {\n\t\t\t\t\tconst content = await providerInfo.provider.fetchRaw(providerInfo, filePath, {\n\t\t\t\t\t\tverbose,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (content.isErr()) {\n\t\t\t\t\t\tloading.stop(color.red(`Error fetching ${color.bold(filePath)}`));\n\t\t\t\t\t\tprogram.error(\n\t\t\t\t\t\t\tcolor.red(`There was an error trying to get ${fullSpecifier}`)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn content.unwrap();\n\t\t\t\t};\n\n\t\t\t\tfor (const sourceFile of block.files) {\n\t\t\t\t\tif (!config.includeTests && isTestFile(sourceFile)) continue;\n\n\t\t\t\t\tconst sourcePath = path.join(block.directory, sourceFile);\n\n\t\t\t\t\tlet destPath: string;\n\t\t\t\t\tif (block.subdirectory) {\n\t\t\t\t\t\tdestPath = path.join(directory, block.name, sourceFile);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdestPath = path.join(directory, sourceFile);\n\t\t\t\t\t}\n\n\t\t\t\t\tverbose(`Adding ${color.bold(sourcePath)}`);\n\n\t\t\t\t\tconst content = await getSourceFile(sourcePath);\n\n\t\t\t\t\tconst pathFolder = destPath.slice(0, destPath.length - sourceFile.length);\n\n\t\t\t\t\tverbose(`Creating directory ${color.bold(pathFolder)}`);\n\n\t\t\t\t\tfs.mkdirSync(pathFolder, {\n\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t});\n\n\t\t\t\t\tverbose(`Created directory ${color.bold(pathFolder)}`);\n\n\t\t\t\t\tfiles.push({ content, destPath });\n\n\t\t\t\t\tverbose(`Got ${color.bold(sourcePath)}`);\n\t\t\t\t}\n\n\t\t\t\tfor (const file of files) {\n\t\t\t\t\tconst content = await transformRemoteContent({\n\t\t\t\t\t\tfile,\n\t\t\t\t\t\tbiomeOptions,\n\t\t\t\t\t\tprettierOptions,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\timports: block._imports_,\n\t\t\t\t\t\twatermark,\n\t\t\t\t\t\tverbose,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (content.isErr()) {\n\t\t\t\t\t\tprogram.error(color.red(content.unwrapErr()));\n\t\t\t\t\t}\n\n\t\t\t\t\tverbose(`Writing to ${color.bold(file.destPath)}`);\n\n\t\t\t\t\tfs.writeFileSync(file.destPath, content.unwrap());\n\t\t\t\t}\n\n\t\t\t\tif (config.includeTests && block.tests) {\n\t\t\t\t\tverbose('Trying to include tests');\n\n\t\t\t\t\tconst { devDependencies } = JSON.parse(\n\t\t\t\t\t\tfs.readFileSync(path.join(options.cwd, 'package.json')).toString()\n\t\t\t\t\t);\n\n\t\t\t\t\tif (devDependencies === undefined || devDependencies.vitest === undefined) {\n\t\t\t\t\t\tdevDeps.add('vitest');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const dep of block.devDependencies) {\n\t\t\t\t\tdevDeps.add(dep);\n\t\t\t\t}\n\n\t\t\t\tfor (const dep of block.dependencies) {\n\t\t\t\t\tdeps.add(dep);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\tawait runTasksConcurrently({\n\t\tstartMessage: 'Adding blocks',\n\t\tstopMessage: `Added ${color.cyan(addedBlocks.join(', '))}`,\n\t\ttasks,\n\t\tverbose: options.verbose ? verbose : undefined,\n\t});\n\n\t// check if dependencies are already installed\n\tconst requiredDependencies = returnShouldInstall(deps, devDeps, { cwd: options.cwd });\n\n\tdeps = requiredDependencies.dependencies;\n\tdevDeps = requiredDependencies.devDependencies;\n\n\tconst hasDependencies = deps.size > 0 || devDeps.size > 0;\n\n\tif (hasDependencies) {\n\t\tlet install = options.yes;\n\t\tif (!options.yes) {\n\t\t\tconst result = await confirm({\n\t\t\t\tmessage: 'Would you like to install dependencies?',\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (isCancel(result)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tinstall = result;\n\t\t}\n\n\t\tif (install) {\n\t\t\tif (deps.size > 0) {\n\t\t\t\tif (!options.verbose)\n\t\t\t\t\tloading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t\t(\n\t\t\t\t\tawait installDependencies({\n\t\t\t\t\t\tpm,\n\t\t\t\t\t\tdeps: Array.from(deps),\n\t\t\t\t\t\tdev: false,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t})\n\t\t\t\t).match(\n\t\t\t\t\t(installed) => {\n\t\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dependencies');\n\n\t\t\t\t\t\tprogram.error(err);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (devDeps.size > 0) {\n\t\t\t\tif (!options.verbose)\n\t\t\t\t\tloading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t\t(\n\t\t\t\t\tawait installDependencies({\n\t\t\t\t\t\tpm,\n\t\t\t\t\t\tdeps: Array.from(devDeps),\n\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t})\n\t\t\t\t).match(\n\t\t\t\t\t(installed) => {\n\t\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dev dependencies');\n\n\t\t\t\t\t\tprogram.error(err);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// next steps if they didn't install dependencies\n\t\tlet steps = [];\n\n\t\tif (!install) {\n\t\t\tif (deps.size > 0) {\n\t\t\t\tconst cmd = resolveCommand(pm, 'add', [...deps]);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\t`Install dependencies \\`${color.cyan(`${cmd?.command} ${cmd?.args.join(' ')}`)}\\``\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (devDeps.size > 0) {\n\t\t\t\tconst cmd = resolveCommand(pm, 'add', [...devDeps, '-D']);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\t`Install dev dependencies \\`${color.cyan(`${cmd?.command} ${cmd?.args.join(' ')}`)}\\``\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// put steps with numbers above here\n\t\tsteps = steps.map((step, i) => `${i + 1}. ${step}`);\n\n\t\tif (!install) {\n\t\t\tsteps.push('');\n\t\t}\n\n\t\tsteps.push('Import and use the blocks!');\n\n\t\tconst next = nextSteps(steps);\n\n\t\tprocess.stdout.write(next);\n\t}\n};\n\nexport { add };\n","import { cancel, confirm, isCancel, outro, password, select } from '@clack/prompts';\nimport color from 'chalk';\nimport { Command, Option } from 'commander';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport * as persisted from '../utils/persisted';\nimport { intro } from '../utils/prompts';\nimport { http, providers } from '../utils/providers';\n\nconst schema = v.object({\n\ttoken: v.optional(v.string()),\n\tprovider: v.optional(v.string()),\n\tlogout: v.boolean(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst authProviders = providers.filter((p) => p.name() !== http.name());\n\nconst auth = new Command('auth')\n\t.description('Provide a token for access to private repositories.')\n\t.option('--token <token>', 'The token to use for authenticating to your provider.')\n\t.addOption(\n\t\tnew Option('--provider <name>', 'The provider this token belongs to.').choices(\n\t\t\tauthProviders.map((provider) => provider.name())\n\t\t)\n\t)\n\t.option('--logout', 'Erase tokens from each provider from storage.', false)\n\t.action(async (opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _auth(options);\n\n\t\toutro(color.green('All done!'));\n\t});\n\nconst _auth = async (options: Options) => {\n\tconst storage = persisted.get();\n\n\tif (options.logout) {\n\t\tfor (const provider of authProviders) {\n\t\t\tconst tokenKey = `${provider.name()}-token`;\n\n\t\t\tif (storage.get(tokenKey) === undefined) {\n\t\t\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE}\\n`);\n\t\t\t\tprocess.stdout.write(\n\t\t\t\t\tcolor.gray(\n\t\t\t\t\t\t`${ascii.VERTICAL_LINE} Already logged out of ${provider.name()}.\\n`\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst response = await confirm({\n\t\t\t\tmessage: `Remove ${provider.name()} token?`,\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tif (!response) continue;\n\n\t\t\tstorage.delete(tokenKey);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (authProviders.length > 1) {\n\t\tconst response = await select({\n\t\t\tmessage: 'Which provider is this token for?',\n\t\t\toptions: authProviders.map((provider) => ({\n\t\t\t\tlabel: provider.name(),\n\t\t\t\tvalue: provider.name(),\n\t\t\t})),\n\t\t\tinitialValue: authProviders[0].name(),\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\toptions.provider = response;\n\t} else {\n\t\toptions.provider = authProviders[0].name();\n\t}\n\n\tif (options.token === undefined) {\n\t\tconst response = await password({\n\t\t\tmessage: 'Paste your token',\n\t\t\tvalidate(value) {\n\t\t\t\tif (value.trim() === '') return 'Please provide a value';\n\t\t\t},\n\t\t});\n\n\t\tif (isCancel(response) || !response) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\toptions.token = response;\n\t}\n\n\tstorage.set(`${options.provider}-token`, options.token);\n};\n\nexport { auth };\n","import fs from 'node:fs';\nimport { log, outro, spinner } from '@clack/prompts';\nimport color from 'chalk';\nimport { Command, program } from 'commander';\nimport ignore from 'ignore';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport { type Category, buildBlocksDirectory, pruneUnused } from '../utils/build';\nimport { DEFAULT_CONFIG, runRules } from '../utils/build/check';\nimport { type RegistryConfig, getRegistryConfig } from '../utils/config';\nimport { OUTPUT_FILE } from '../utils/context';\nimport { intro } from '../utils/prompts';\n\n// sensible defaults for ignored directories\nconst IGNORED_DIRS = ['.git', 'node_modules'] as const;\n\nconst schema = v.object({\n\tdirs: v.optional(v.array(v.string())),\n\toutputDir: v.optional(v.string()),\n\tincludeBlocks: v.optional(v.array(v.string())),\n\tincludeCategories: v.optional(v.array(v.string())),\n\texcludeBlocks: v.optional(v.array(v.string())),\n\texcludeCategories: v.optional(v.array(v.string())),\n\texcludeDeps: v.optional(v.array(v.string())),\n\tlistBlocks: v.optional(v.array(v.string())),\n\tlistCategories: v.optional(v.array(v.string())),\n\tdoNotListBlocks: v.optional(v.array(v.string())),\n\tdoNotListCategories: v.optional(v.array(v.string())),\n\tpreview: v.optional(v.boolean()),\n\toutput: v.boolean(),\n\tverbose: v.boolean(),\n\tcwd: v.string(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst build = new Command('build')\n\t.description(`Builds the provided --dirs in the project root into a \\`${OUTPUT_FILE}\\` file.`)\n\t.option('--dirs [dirs...]', 'The directories containing the blocks.')\n\t.option(\n\t\t'--output-dir <dir>',\n\t\t'The directory to output the registry to. (Copies jsrepo-manifest.json + all required files)'\n\t)\n\t.option('--include-blocks [blockNames...]', 'Include only the blocks with these names.')\n\t.option(\n\t\t'--include-categories [categoryNames...]',\n\t\t'Include only the categories with these names.'\n\t)\n\t.option('--exclude-blocks [blockNames...]', 'Do not include the blocks with these names.')\n\t.option(\n\t\t'--exclude-categories [categoryNames...]',\n\t\t'Do not include the categories with these names.'\n\t)\n\t.option('--list-blocks [blockNames...]', 'List only the blocks with these names.')\n\t.option('--list-categories [categoryNames...]', 'List only the categories with these names.')\n\t.option('--do-not-list-blocks [blockNames...]', 'Do not list the blocks with these names.')\n\t.option(\n\t\t'--do-not-list-categories [categoryNames...]',\n\t\t'Do not list the categories with these names.'\n\t)\n\t.option('--exclude-deps [deps...]', 'Dependencies that should not be added.')\n\t.option('--preview', 'Display a preview of the blocks list.')\n\t.option('--no-output', `Do not output a \\`${OUTPUT_FILE}\\` file.`)\n\t.option('--verbose', 'Include debug logs.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.action(async (opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _build(options);\n\n\t\toutro(color.green('All done!'));\n\t});\n\nconst _build = async (options: Options) => {\n\tconst loading = spinner();\n\n\tlet categories: Category[] = [];\n\n\tconst config: RegistryConfig = getRegistryConfig(options.cwd).match(\n\t\t(val) => {\n\t\t\tif (val === null) {\n\t\t\t\treturn {\n\t\t\t\t\t$schema: '',\n\t\t\t\t\tdirs: options.dirs ?? [],\n\t\t\t\t\toutputDir: options.outputDir,\n\t\t\t\t\tdoNotListBlocks: options.doNotListBlocks ?? [],\n\t\t\t\t\tdoNotListCategories: options.doNotListCategories ?? [],\n\t\t\t\t\tlistBlocks: options.listBlocks ?? [],\n\t\t\t\t\tlistCategories: options.listCategories ?? [],\n\t\t\t\t\texcludeDeps: options.excludeDeps ?? [],\n\t\t\t\t\tincludeBlocks: options.includeBlocks ?? [],\n\t\t\t\t\tincludeCategories: options.includeCategories ?? [],\n\t\t\t\t\texcludeBlocks: options.excludeBlocks ?? [],\n\t\t\t\t\texcludeCategories: options.excludeCategories ?? [],\n\t\t\t\t\tpreview: options.preview,\n\t\t\t\t} satisfies RegistryConfig;\n\t\t\t}\n\n\t\t\tconst mergedVal = val;\n\n\t\t\t// overwrites config with flag values\n\n\t\t\tif (options.dirs) mergedVal.dirs = options.dirs;\n\t\t\tif (options.outputDir) mergedVal.outputDir = options.outputDir;\n\t\t\tif (options.doNotListBlocks) mergedVal.doNotListBlocks = options.doNotListBlocks;\n\t\t\tif (options.doNotListCategories)\n\t\t\t\tmergedVal.doNotListCategories = options.doNotListCategories;\n\t\t\tif (options.listBlocks) mergedVal.listBlocks = options.listBlocks;\n\t\t\tif (options.listCategories) mergedVal.listCategories = options.listCategories;\n\t\t\tif (options.includeBlocks) mergedVal.includeBlocks = options.includeBlocks;\n\t\t\tif (options.includeCategories) mergedVal.includeCategories = options.includeCategories;\n\t\t\tif (options.excludeBlocks) mergedVal.excludeBlocks = options.excludeBlocks;\n\t\t\tif (options.excludeCategories) mergedVal.excludeCategories = options.excludeCategories;\n\t\t\tif (options.excludeDeps) mergedVal.excludeDeps = options.excludeDeps;\n\t\t\tif (options.preview !== undefined) mergedVal.preview = options.preview;\n\n\t\t\tmergedVal.rules = { ...DEFAULT_CONFIG, ...mergedVal.rules };\n\n\t\t\treturn mergedVal;\n\t\t},\n\t\t(err) => program.error(color.red(err))\n\t);\n\n\tlet outDir: string;\n\n\tif (config.outputDir) {\n\t\toutDir = path.join(options.cwd, config.outputDir);\n\t} else {\n\t\toutDir = options.cwd;\n\t}\n\n\tconst manifestOut = path.join(outDir, OUTPUT_FILE);\n\n\tif (options.output && fs.existsSync(manifestOut)) {\n\t\t// we need to remove all previously copied directories\n\t\tif (config.outputDir) {\n\t\t\t// read old manifest to determine where the unwanted files are\n\t\t\t// we can't just rm -rf because other static files could be hosted out of the same directory\n\t\t\tconst oldCategories = JSON.parse(fs.readFileSync(manifestOut).toString()) as Category[];\n\n\t\t\t// first just remove all the files\n\t\t\tfor (const category of oldCategories) {\n\t\t\t\tfor (const block of category.blocks) {\n\t\t\t\t\tconst newDirPath = path.join(outDir, block.directory);\n\n\t\t\t\t\tif (fs.existsSync(newDirPath)) {\n\t\t\t\t\t\tfs.rmSync(newDirPath, { recursive: true });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfs.rmSync(manifestOut);\n\t}\n\n\tconst ig = ignore();\n\n\ttry {\n\t\tconst ignoreFile = fs.readFileSync(path.join(options.cwd, '.gitignore')).toString();\n\n\t\tig.add(ignoreFile);\n\t} catch {\n\t\t// just continue on\n\t}\n\n\tig.add(IGNORED_DIRS);\n\n\tfor (const dir of config.dirs) {\n\t\tconst dirPath = path.join(options.cwd, dir);\n\n\t\tloading.start(`Building ${color.cyan(dirPath)}`);\n\n\t\tconst builtCategories = buildBlocksDirectory(dirPath, {\n\t\t\tcwd: options.cwd,\n\t\t\tignore: ig,\n\t\t\tconfig,\n\t\t});\n\n\t\tfor (const category of builtCategories) {\n\t\t\tif (categories.find((cat) => cat.name === category.name) !== undefined) {\n\t\t\t\tconst error = 'a category with the same name already exists!';\n\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${ascii.VERTICAL_LINE} ${ascii.WARN} Skipped adding \\`${color.cyan(`${dir}/${category.name}`)}\\` because ${error}`\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcategories.push(category);\n\t\t}\n\n\t\tloading.stop(`Built ${color.cyan(dirPath)}`);\n\t}\n\n\tloading.start('Checking manifest');\n\n\tconst { warnings, errors } = runRules(categories, config, config.rules);\n\n\tloading.stop('Completed checking manifest.');\n\n\t// add gap for errors\n\tif (warnings.length > 0 || errors.length > 0) {\n\t\tconsole.log(ascii.VERTICAL_LINE);\n\t}\n\n\tfor (const warning of warnings) {\n\t\tconsole.log(warning);\n\t}\n\n\tif (errors.length > 0) {\n\t\tfor (const error of errors) {\n\t\t\tconsole.log(error);\n\t\t}\n\n\t\tprogram.error(\n\t\t\tcolor.red(\n\t\t\t\t`Completed checking manifest with ${color.bold(`${errors.length} error(s)`)} and ${color.bold(`${warnings.length} warning(s)`)}`\n\t\t\t)\n\t\t);\n\t}\n\n\t// removes any unused blocks or categories\n\tconst [prunedCategories, count] = pruneUnused(categories);\n\n\tcategories = prunedCategories;\n\n\tif (count > 0) {\n\t\tlog.step(`Removed ${count} unused block${count > 1 ? 's' : ''}.`);\n\t}\n\n\tif (config.preview) {\n\t\tconst blocks = categories.flatMap((cat) =>\n\t\t\tcat.blocks.filter((b) => b.list).map((b) => `${color.cyan(b.category)}/${b.name}`)\n\t\t);\n\n\t\tlog.message(`${color.yellow('Preview')}:`);\n\n\t\tfor (const block of blocks) {\n\t\t\tconsole.log(`${ascii.VERTICAL_LINE} ◻ ${block}`);\n\t\t}\n\t}\n\n\tif (options.output) {\n\t\tif (config.outputDir) {\n\t\t\tloading.start(`Copying registry files to \\`${color.cyan(outDir)}\\``);\n\n\t\t\t// copy the files for each block in each category\n\t\t\tfor (const category of categories) {\n\t\t\t\tfor (const block of category.blocks) {\n\t\t\t\t\tconst originalPath = path.join(options.cwd, block.directory);\n\t\t\t\t\tconst newDirPath = path.join(outDir, block.directory);\n\n\t\t\t\t\tif (!fs.existsSync(newDirPath)) {\n\t\t\t\t\t\tfs.mkdirSync(newDirPath, { recursive: true });\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const file of block.files) {\n\t\t\t\t\t\tfs.copyFileSync(path.join(originalPath, file), path.join(newDirPath, file));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tloading.stop(`Copied registry files to \\`${color.cyan(outDir)}\\``);\n\t\t}\n\n\t\tloading.start(`Writing output to \\`${color.cyan(manifestOut)}\\``);\n\n\t\t// write the manifest\n\t\tfs.writeFileSync(manifestOut, JSON.stringify(categories, null, '\\t'));\n\n\t\tloading.stop(`Wrote output to \\`${color.cyan(manifestOut)}\\``);\n\t}\n};\n\nexport { build };\n","import fs from 'node:fs';\nimport { cancel, confirm, isCancel, select, spinner } from '@clack/prompts';\nimport color from 'chalk';\nimport { Argument, Command, program } from 'commander';\nimport { execa } from 'execa';\nimport { resolveCommand } from 'package-manager-detector/commands';\nimport { detect } from 'package-manager-detector/detect';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport { resolveTree } from '../utils/blocks';\nimport { isTestFile } from '../utils/build';\nimport { type ProjectConfig, getProjectConfig, resolvePaths } from '../utils/config';\nimport { installDependencies } from '../utils/dependencies';\nimport { type ConcurrentTask, intro, runTasksConcurrently } from '../utils/prompts';\nimport * as providers from '../utils/providers';\n\nconst schema = v.objectWithRest(\n\t{\n\t\trepo: v.optional(v.string()),\n\t\tallow: v.boolean(),\n\t\tcwd: v.string(),\n\t},\n\tv.unknown()\n);\n\ntype Options = v.InferInput<typeof schema>;\n\nconst exec = new Command('exec')\n\t.alias('x')\n\t.description('Execute a block as a script.')\n\t.addArgument(\n\t\tnew Argument(\n\t\t\t'script',\n\t\t\t'Name of the script you want to execute. ex: (general/hello, github/ieedan/std/general/hello)'\n\t\t).argOptional()\n\t)\n\t.option('--repo <repo>', 'Repository to download and run the script from.')\n\t.option('-A, --allow', 'Allow jsrepo to download code from the provided repo.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.allowExcessArguments()\n\t.allowUnknownOption()\n\t.action(async (script, opts, command) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _exec(script, options, command);\n\t});\n\n// biome-ignore lint/suspicious/noExplicitAny: we don't have a type for command\nconst _exec = async (s: string | undefined, options: Options, command: any) => {\n\tlet script = s;\n\n\tconst loading = spinner();\n\n\tconst configResult = getProjectConfig(options.cwd);\n\n\t/** The user has opted for no config */\n\tconst noConfig = configResult.isErr();\n\n\tlet config: ProjectConfig;\n\n\tif (configResult.isErr()) {\n\t\t// add default config used for default values in prompts\n\t\tconfig = {\n\t\t\t$schema: '',\n\t\t\tincludeTests: false,\n\t\t\twatermark: true,\n\t\t\tpaths: {\n\t\t\t\t'*': './',\n\t\t\t},\n\t\t\trepos: [],\n\t\t};\n\t} else {\n\t\tconfig = configResult.unwrap();\n\t}\n\n\tlet repoPaths = config.repos;\n\n\t// we just want to override all others if supplied via the CLI\n\tif (options.repo) repoPaths = [options.repo];\n\n\t// we are only getting repos for blocks that specified repos\n\tif (script && providers.providers.find((p) => script?.startsWith(p.name()))) {\n\t\tconst [providerName, owner, repoName, ...rest] = script.split('/');\n\n\t\tlet repo: string;\n\t\t// if rest is greater than 2 it isn't the block specifier so it is part of the path\n\t\tif (rest.length > 2) {\n\t\t\trepo = `${providerName}/${owner}/${repoName}/${rest.slice(0, rest.length - 2).join('/')}`;\n\t\t} else {\n\t\t\trepo = `${providerName}/${owner}/${repoName}`;\n\t\t}\n\n\t\tif (!repoPaths.find((repoPath) => repoPath === repo)) {\n\t\t\tif (!options.allow) {\n\t\t\t\tconst result = await confirm({\n\t\t\t\t\tmessage: `Allow ${ascii.JSREPO} to download and run code from ${color.cyan(repo)}?`,\n\t\t\t\t\tinitialValue: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(result) || !result) {\n\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trepoPaths = [repo];\n\t\t}\n\t}\n\n\tif (!options.allow && options.repo) {\n\t\tconst result = await confirm({\n\t\t\tmessage: `Allow ${ascii.JSREPO} to download and run code from ${color.cyan(options.repo)}?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(result) || !result) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\tif (repoPaths.length === 0) {\n\t\tif (noConfig) {\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(\n\t\t\t\t\t`Fully quality your script ex: (github/ieedan/std/scripts/build) or provide the \\`${color.bold(\n\t\t\t\t\t\t'--repo'\n\t\t\t\t\t)}\\` flag to specify a registry.`\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tprogram.error(\n\t\t\tcolor.red(\n\t\t\t\t`There were no repos present in your config and you didn't provide the \\`${color.bold(\n\t\t\t\t\t'--repo'\n\t\t\t\t)}\\` flag with a repo.`\n\t\t\t)\n\t\t);\n\t}\n\n\tloading.start(`Fetching scripts from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst resolvedRepos: providers.ResolvedRepo[] = (\n\t\tawait providers.resolvePaths(...repoPaths)\n\t).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed to get info for ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tconst blocksMap = (await providers.fetchBlocks(...resolvedRepos)).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed fetching scripts from ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tloading.stop(`Retrieved scripts from ${color.cyan(repoPaths.join(', '))}`);\n\n\t// if no blocks are provided prompt the user for what blocks they want\n\tif (!script) {\n\t\tconst promptResult = await select({\n\t\t\tmessage: 'Select which script to run.',\n\t\t\toptions: Array.from(blocksMap.entries())\n\t\t\t\t.filter(([_, value]) => value.list)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tlet label: string;\n\n\t\t\t\t\t// show the full repo if there are multiple repos\n\t\t\t\t\tif (repoPaths.length > 1) {\n\t\t\t\t\t\tlabel = `${color.cyan(\n\t\t\t\t\t\t\t`${value.sourceRepo.name}/${value.sourceRepo.owner}/${value.sourceRepo.repoName}/${value.category}`\n\t\t\t\t\t\t)}/${value.name}`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlabel = `${color.cyan(value.category)}/${value.name}`;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlabel: label,\n\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t});\n\n\t\tif (isCancel(promptResult)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tscript = promptResult as string;\n\t}\n\n\tconst installingBlocks = (await resolveTree([script], blocksMap, resolvedRepos)).match(\n\t\t(val) => val,\n\t\t(err) => program.error(err)\n\t);\n\n\tconst tempDirBase = 'temp-jsrepo-exec';\n\n\tconst tempDirectoryRelative = `./${tempDirBase}/${encodeURIComponent(script)}`;\n\n\tconst tempDirectory = path.join(process.cwd(), tempDirectoryRelative);\n\n\tconfig.paths['*'] = tempDirectoryRelative;\n\n\tfs.mkdirSync(tempDirectory, { recursive: true });\n\n\tconst pm = (await detect({ cwd: process.cwd() }))?.agent ?? 'npm';\n\n\tconst tasks: ConcurrentTask[] = [];\n\n\tconst devDeps: Set<string> = new Set<string>();\n\tconst deps: Set<string> = new Set<string>();\n\n\tconst resolvedPathsResult = resolvePaths(config.paths, options.cwd);\n\n\tif (resolvedPathsResult.isErr()) {\n\t\tprogram.error(color.red(resolvedPathsResult.unwrapErr()));\n\t}\n\n\tconst resolvedPaths = resolvedPathsResult.unwrap();\n\n\tconst addedBlocks: string[] = [];\n\n\tfor (const { block } of installingBlocks) {\n\t\tconst fullSpecifier = `${block.sourceRepo.url}/${block.category}/${block.name}`;\n\t\tconst shortSpecifier = `${block.category}/${block.name}`;\n\n\t\tconst providerInfo = block.sourceRepo;\n\n\t\tconst directory = path.join(options.cwd, resolvedPaths['*'], block.category);\n\n\t\taddedBlocks.push(shortSpecifier);\n\n\t\ttasks.push({\n\t\t\trun: async ({ message }) => {\n\t\t\t\tmessage(`Adding ${color.cyan(fullSpecifier)}`);\n\n\t\t\t\t// in case the directory didn't already exist\n\t\t\t\tfs.mkdirSync(directory, { recursive: true });\n\n\t\t\t\tconst files: { content: string; destPath: string }[] = [];\n\n\t\t\t\tconst getSourceFile = async (filePath: string) => {\n\t\t\t\t\tconst content = await providerInfo.provider.fetchRaw(providerInfo, filePath);\n\n\t\t\t\t\tif (content.isErr()) {\n\t\t\t\t\t\tloading.stop(color.red(`Error fetching ${color.bold(filePath)}`));\n\t\t\t\t\t\tprogram.error(\n\t\t\t\t\t\t\tcolor.red(`There was an error trying to get ${fullSpecifier}`)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn content.unwrap();\n\t\t\t\t};\n\n\t\t\t\tfor (const sourceFile of block.files) {\n\t\t\t\t\tif (!config.includeTests && isTestFile(sourceFile)) continue;\n\n\t\t\t\t\tconst sourcePath = path.join(block.directory, sourceFile);\n\n\t\t\t\t\tlet destPath: string;\n\t\t\t\t\tif (block.subdirectory) {\n\t\t\t\t\t\tdestPath = path.join(directory, block.name, sourceFile);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdestPath = path.join(directory, sourceFile);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst content = await getSourceFile(sourcePath);\n\n\t\t\t\t\tconst pathFolder = destPath.slice(0, destPath.length - sourceFile.length);\n\n\t\t\t\t\tfs.mkdirSync(pathFolder, {\n\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t});\n\n\t\t\t\t\tfiles.push({ content, destPath });\n\t\t\t\t}\n\n\t\t\t\tfor (const file of files) {\n\t\t\t\t\tfs.writeFileSync(file.destPath, file.content);\n\t\t\t\t}\n\n\t\t\t\tif (config.includeTests && block.tests) {\n\t\t\t\t\tconst { devDependencies } = JSON.parse(\n\t\t\t\t\t\tfs.readFileSync(path.join(options.cwd, 'package.json')).toString()\n\t\t\t\t\t);\n\n\t\t\t\t\tif (devDependencies === undefined || devDependencies.vitest === undefined) {\n\t\t\t\t\t\tdevDeps.add('vitest');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const dep of block.devDependencies) {\n\t\t\t\t\tdevDeps.add(dep);\n\t\t\t\t}\n\n\t\t\t\tfor (const dep of block.dependencies) {\n\t\t\t\t\tdeps.add(dep);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\tawait runTasksConcurrently({\n\t\tstartMessage: 'Adding blocks',\n\t\tstopMessage: `Added ${color.cyan(addedBlocks.join(', '))}`,\n\t\ttasks,\n\t});\n\n\tconst hasDependencies = deps.size > 0 || devDeps.size > 0;\n\n\tif (hasDependencies) {\n\t\t// add package.json\n\t\tconst packageContent = {\n\t\t\tname: 'temp-package',\n\t\t\ttype: 'module',\n\t\t\tversion: '0.0.1',\n\t\t};\n\n\t\tconst packagePath = path.join(tempDirectory, 'package.json');\n\n\t\tfs.writeFileSync(packagePath, JSON.stringify(packageContent, null, '\\t'));\n\n\t\tif (deps.size > 0) {\n\t\t\tif (!options.verbose) loading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t(\n\t\t\t\tawait installDependencies({\n\t\t\t\t\tpm,\n\t\t\t\t\tdeps: Array.from(deps),\n\t\t\t\t\tdev: false,\n\t\t\t\t\tcwd: tempDirectory,\n\t\t\t\t\tignoreWorkspace: true,\n\t\t\t\t})\n\t\t\t).match(\n\t\t\t\t(installed) => {\n\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t},\n\t\t\t\t(err) => {\n\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dependencies');\n\n\t\t\t\t\tprogram.error(err);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif (devDeps.size > 0) {\n\t\t\tif (!options.verbose) loading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t(\n\t\t\t\tawait installDependencies({\n\t\t\t\t\tpm,\n\t\t\t\t\tdeps: Array.from(devDeps),\n\t\t\t\t\tdev: true,\n\t\t\t\t\tcwd: tempDirectory,\n\t\t\t\t\tignoreWorkspace: true,\n\t\t\t\t})\n\t\t\t).match(\n\t\t\t\t(installed) => {\n\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t},\n\t\t\t\t(err) => {\n\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dev dependencies');\n\n\t\t\t\t\tprogram.error(err);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tconst startIndex = (command.parent.rawArgs as string[]).findIndex((arg) => arg === '--');\n\n\tlet passthroughArgs: string[] = [];\n\n\tif (startIndex !== -1) {\n\t\tpassthroughArgs = command.parent.rawArgs.slice(startIndex + 1);\n\t}\n\n\t// run the cli\n\n\tconsole.clear();\n\n\tconst runningBlock = installingBlocks[0];\n\n\tlet file: string;\n\n\t// tsx seems to be smart enough to figure out if it is a .ts file\n\tif (runningBlock.block.subdirectory) {\n\t\tfile = path.join(\n\t\t\ttempDirectory,\n\t\t\t`${runningBlock.block.category}/${runningBlock.block.name}/index.js`\n\t\t);\n\t} else {\n\t\tfile = path.join(\n\t\t\ttempDirectory,\n\t\t\t`${runningBlock.block.category}/${runningBlock.block.name}.js`\n\t\t);\n\t}\n\n\tconst cmd = resolveCommand(pm, 'execute', ['tsx', file, ...passthroughArgs]);\n\n\tif (!cmd) {\n\t\tprogram.error(color.red('Error resolving run command!'));\n\t}\n\n\ttry {\n\t\tawait execa(cmd.command, cmd.args, {\n\t\t\tcwd: process.cwd(),\n\t\t\tstdin: process.stdin,\n\t\t\tstdout: process.stdout,\n\t\t});\n\t} finally {\n\t\tfs.rmSync(path.join(process.cwd(), tempDirBase), { recursive: true, force: true });\n\t}\n};\n\nexport { exec };\n","import fs from 'node:fs';\nimport {\n\tcancel,\n\tconfirm,\n\tisCancel,\n\tlog,\n\tmultiselect,\n\toutro,\n\tpassword,\n\tselect,\n\tspinner,\n\ttext,\n} from '@clack/prompts';\nimport color from 'chalk';\nimport { Command, Option, program } from 'commander';\nimport { detect, resolveCommand } from 'package-manager-detector';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport {\n\ttype Formatter,\n\tPROJECT_CONFIG_NAME,\n\ttype Paths,\n\ttype ProjectConfig,\n\tREGISTRY_CONFIG_NAME,\n\tformatterSchema,\n\tgetProjectConfig,\n\tgetRegistryConfig,\n} from '../utils/config';\nimport { installDependencies } from '../utils/dependencies';\nimport { loadFormatterConfig } from '../utils/format';\nimport { json } from '../utils/language-support';\nimport * as persisted from '../utils/persisted';\nimport { type Task, intro, nextSteps, runTasks } from '../utils/prompts';\nimport { http, providers } from '../utils/providers';\n\nconst schema = v.object({\n\trepos: v.optional(v.array(v.string())),\n\twatermark: v.boolean(),\n\ttests: v.optional(v.boolean()),\n\tformatter: v.optional(formatterSchema),\n\tproject: v.optional(v.boolean()),\n\tregistry: v.optional(v.boolean()),\n\tscript: v.string(),\n\tyes: v.boolean(),\n\tcwd: v.string(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst init = new Command('init')\n\t.description('Initializes your project with a configuration file.')\n\t.argument('[registries...]', 'Registries to install the blocks from.', [])\n\t.option('--repos [repos...]', 'Repository to install the blocks from. (DEPRECATED)')\n\t.option(\n\t\t'--no-watermark',\n\t\t'Will not add a watermark to each file upon adding it to your project.'\n\t)\n\t.option('--tests', 'Will include tests with the blocks.')\n\t.addOption(\n\t\tnew Option(\n\t\t\t'--formatter <formatter>',\n\t\t\t'What formatter to use when adding or updating blocks.'\n\t\t).choices(['prettier', 'biome'])\n\t)\n\t.option('-P, --project', 'Takes you through the steps to initialize a project.')\n\t.option('-R, --registry', 'Takes you through the steps to initialize a registry.')\n\t.option(\n\t\t'--script <name>',\n\t\t'The name of the build script. (For Registry setup)',\n\t\t'build:registry'\n\t)\n\t.option('-y, --yes', 'Skip confirmation prompt.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.action(async (registries, opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tif (options.registry !== undefined && options.project !== undefined) {\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(\n\t\t\t\t\t`You cannot provide both ${color.bold('--project')} and ${color.bold('--registry')} at the same time.`\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tif (options.repos !== undefined) {\n\t\t\tlog.warn(\n\t\t\t\t`The ${color.gray('`--repos`')} flag is deprecated! Instead supply registries as arguments. ${color.cyan(`\\`jsrepo init ${options.repos.join(' ')}\\``)}`\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\toptions.registry === undefined &&\n\t\t\toptions.project === undefined &&\n\t\t\tregistries.length === 0\n\t\t) {\n\t\t\tconst response = await select({\n\t\t\t\tmessage: 'Initialize a project or registry?',\n\t\t\t\toptions: [\n\t\t\t\t\t{ value: 'project', label: 'project' },\n\t\t\t\t\t{ value: 'registry', label: 'registry' },\n\t\t\t\t],\n\t\t\t\tinitialValue: 'project',\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\toptions.project = response === 'project';\n\t\t}\n\n\t\tif (options.project || registries.length > 0) {\n\t\t\tawait _initProject(registries, options);\n\t\t} else {\n\t\t\tawait _initRegistry(options);\n\t\t}\n\n\t\toutro(color.green('All done!'));\n\t});\n\nconst _initProject = async (registries: string[], options: Options) => {\n\tconst initialConfig = getProjectConfig(options.cwd);\n\n\tconst loading = spinner();\n\n\tlet paths: Paths;\n\n\tconst defaultPathResult = await text({\n\t\tmessage: 'Please enter a default path to install the blocks',\n\t\tvalidate(value) {\n\t\t\tif (value.trim() === '') return 'Please provide a value';\n\t\t},\n\t\tplaceholder: './src/blocks',\n\t\tinitialValue: initialConfig.isOk() ? initialConfig.unwrap().paths['*'] : undefined,\n\t});\n\n\tif (isCancel(defaultPathResult)) {\n\t\tcancel('Canceled!');\n\t\tprocess.exit(0);\n\t}\n\n\tif (initialConfig.isOk()) {\n\t\tpaths = { ...initialConfig.unwrap().paths, '*': defaultPathResult };\n\t} else {\n\t\tpaths = { '*': defaultPathResult };\n\t}\n\n\tconst repos = [\n\t\t...(initialConfig.isOk() ? initialConfig.unwrap().repos : []),\n\t\t...registries,\n\t\t...(options.repos ?? []),\n\t];\n\n\tif (repos.length > 0) {\n\t\tfor (const repo of repos) {\n\t\t\t// if already present in config ask if you would like to set it up\n\t\t\tif (initialConfig.isOk() && initialConfig.unwrap().repos.find((r) => r === repo)) {\n\t\t\t\tconst confirmResult = await confirm({\n\t\t\t\t\tmessage: `Configure ${repo}?`,\n\t\t\t\t\tinitialValue: options.yes,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(confirmResult)) {\n\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tif (!confirmResult) continue;\n\t\t\t}\n\n\t\t\tlog.info(`Configuring ${color.cyan(repo)}`);\n\n\t\t\tpaths = await promptForProviderConfig(repo, paths);\n\t\t}\n\t}\n\n\twhile (true) {\n\t\tconst confirmResult = await confirm({\n\t\t\tmessage: `Add ${repos.length > 0 ? 'another' : 'a'} repo?`,\n\t\t\tinitialValue: repos.length === 0, // default to yes for first repo\n\t\t});\n\n\t\tif (isCancel(confirmResult)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (!confirmResult) break;\n\n\t\tconst result = await text({\n\t\t\tmessage: 'Where should we download the blocks from?',\n\t\t\tplaceholder: 'github/ieedan/std',\n\t\t\tvalidate: (val) => {\n\t\t\t\tif (val.trim().length === 0) return 'Please provide a value';\n\n\t\t\t\tif (!providers.find((provider) => provider.matches(val))) {\n\t\t\t\t\treturn `Invalid provider! Valid providers (${providers.map((provider) => provider.name()).join(', ')})`;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tif (isCancel(result)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tpaths = await promptForProviderConfig(result, paths);\n\n\t\trepos.push(result);\n\t}\n\n\t// configure formatter\n\tif (!options.formatter) {\n\t\tlet defaultFormatter = initialConfig.isErr()\n\t\t\t? 'none'\n\t\t\t: (initialConfig.unwrap().formatter ?? 'none');\n\n\t\tif (fs.existsSync(path.join(options.cwd, '.prettierrc'))) {\n\t\t\tdefaultFormatter = 'prettier';\n\t\t}\n\n\t\tif (fs.existsSync(path.join(options.cwd, 'biome.json'))) {\n\t\t\tdefaultFormatter = 'biome';\n\t\t}\n\n\t\tconst response = await select({\n\t\t\tmessage: 'What formatter would you like to use?',\n\t\t\toptions: ['Prettier', 'Biome', 'None'].map((val) => ({\n\t\t\t\tvalue: val.toLowerCase(),\n\t\t\t\tlabel: val,\n\t\t\t})),\n\t\t\tinitialValue: defaultFormatter,\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (response !== 'none') {\n\t\t\toptions.formatter = response as Formatter;\n\t\t}\n\t}\n\n\tconst config: ProjectConfig = {\n\t\t$schema: `https://unpkg.com/jsrepo@${context.package.version}/schemas/project-config.json`,\n\t\trepos,\n\t\tincludeTests:\n\t\t\tinitialConfig.isOk() && options.tests === undefined\n\t\t\t\t? initialConfig.unwrap().includeTests\n\t\t\t\t: (options.tests ?? false),\n\t\twatermark: options.watermark,\n\t\tformatter: options.formatter,\n\t\tpaths,\n\t};\n\n\tloading.start(`Writing config to \\`${PROJECT_CONFIG_NAME}\\``);\n\n\tconst { prettierOptions, biomeOptions } = await loadFormatterConfig({\n\t\tformatter: config.formatter,\n\t\tcwd: options.cwd,\n\t});\n\n\tconst configPath = path.join(options.cwd, PROJECT_CONFIG_NAME);\n\n\tconst configContent = await json.format(JSON.stringify(config, null, '\\t'), {\n\t\tbiomeOptions,\n\t\tprettierOptions,\n\t\tfilePath: configPath,\n\t\tformatter: config.formatter,\n\t});\n\n\tif (!fs.existsSync(options.cwd)) {\n\t\tfs.mkdirSync(options.cwd, { recursive: true });\n\t}\n\n\tfs.writeFileSync(configPath, configContent);\n\n\tloading.stop(`Wrote config to \\`${PROJECT_CONFIG_NAME}\\`.`);\n};\n\nconst promptForProviderConfig = async (repo: string, paths: Paths): Promise<Paths> => {\n\tconst loading = spinner();\n\n\tconst storage = persisted.get();\n\n\tconst provider = providers.find((p) => p.matches(repo));\n\n\tif (!provider) {\n\t\tprogram.error(\n\t\t\tcolor.red(\n\t\t\t\t`Invalid provider! Valid providers (${providers.map((provider) => provider.name()).join(', ')})`\n\t\t\t)\n\t\t);\n\t}\n\n\tconst tokenKey = `${provider.name()}-token`;\n\n\tconst token = storage.get(tokenKey);\n\n\t// don't ask if the provider is a custom domain\n\tif (!token && provider.name() !== http.name()) {\n\t\tconst result = await confirm({\n\t\t\tmessage: 'Would you like to add an auth token?',\n\t\t\tinitialValue: false,\n\t\t});\n\n\t\tif (isCancel(result)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (result) {\n\t\t\tconst response = await password({\n\t\t\t\tmessage: 'Paste your token',\n\t\t\t\tvalidate(value) {\n\t\t\t\t\tif (value.trim() === '') return 'Please provide a value';\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tstorage.set(tokenKey, response);\n\t\t}\n\t}\n\n\tloading.start(`Fetching categories from ${color.cyan(repo)}`);\n\n\tconst manifestResult = await provider.fetchManifest(repo);\n\n\tloading.stop(`Fetched categories from ${color.cyan(repo)}`);\n\n\tif (manifestResult.isErr()) {\n\t\tprogram.error(color.red(manifestResult.unwrapErr()));\n\t}\n\n\tconst categories = manifestResult.unwrap();\n\n\tconst configurePaths = await multiselect({\n\t\tmessage: 'Which category paths would you like to configure?',\n\t\toptions: categories.map((cat) => ({ label: cat.name, value: cat.name })),\n\t\trequired: false,\n\t});\n\n\tif (isCancel(configurePaths)) {\n\t\tcancel('Canceled!');\n\t\tprocess.exit(0);\n\t}\n\n\tif (configurePaths.length > 0) {\n\t\tfor (const category of configurePaths) {\n\t\t\tconst configuredValue = paths[category];\n\n\t\t\tconst categoryPath = await text({\n\t\t\t\tmessage: `Where should ${category} be added in your project?`,\n\t\t\t\tvalidate(value) {\n\t\t\t\t\tif (value.trim() === '') return 'Please provide a value';\n\t\t\t\t},\n\t\t\t\tplaceholder: configuredValue ? configuredValue : `./src/${category}`,\n\t\t\t\tdefaultValue: configuredValue,\n\t\t\t\tinitialValue: configuredValue,\n\t\t\t});\n\n\t\t\tif (isCancel(categoryPath)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tpaths[category] = categoryPath;\n\t\t}\n\t}\n\n\treturn paths;\n};\n\nconst _initRegistry = async (options: Options) => {\n\tconst loading = spinner();\n\n\tconst packagePath = path.join(options.cwd, 'package.json');\n\n\tif (!fs.existsSync(packagePath)) {\n\t\tprogram.error(color.red(`Couldn't find your ${color.bold('package.json')}!`));\n\t}\n\n\tlet config = getRegistryConfig(options.cwd).match(\n\t\t(val) => val,\n\t\t(err) => program.error(color.red(err))\n\t);\n\n\tconst noConfig = config === null;\n\n\tif (!config) {\n\t\tconfig = {\n\t\t\t$schema: '',\n\t\t\tdirs: [],\n\t\t\tdoNotListBlocks: [],\n\t\t\tdoNotListCategories: [],\n\t\t\tlistBlocks: [],\n\t\t\tlistCategories: [],\n\t\t\texcludeDeps: [],\n\t\t\tincludeBlocks: [],\n\t\t\tincludeCategories: [],\n\t\t\texcludeBlocks: [],\n\t\t\texcludeCategories: [],\n\t\t\tpreview: false,\n\t\t};\n\t}\n\n\tconfig.$schema = `https://unpkg.com/jsrepo@${context.package.version}/schemas/registry-config.json`;\n\n\twhile (true) {\n\t\tif (config.dirs.length > 0) {\n\t\t\tconst confirmResult = await confirm({\n\t\t\t\tmessage: 'Add another blocks directory?',\n\t\t\t\tinitialValue: false,\n\t\t\t});\n\n\t\t\tif (isCancel(confirmResult)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tif (!confirmResult) break;\n\t\t}\n\n\t\tconst response = await text({\n\t\t\tmessage: 'Where are your blocks located?',\n\t\t\tplaceholder: './src',\n\t\t\tdefaultValue: './src',\n\t\t\tinitialValue: './src',\n\t\t\tvalidate: (val) => {\n\t\t\t\tif (val.trim().length === 0) return 'Please provide a value!';\n\t\t\t},\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tconfig.dirs.push(response);\n\t}\n\n\tconst pkg = JSON.parse(fs.readFileSync(packagePath).toString());\n\n\t// continue asking until the user either chooses to overwrite or inputs a script that doesn't exist yet\n\twhile (!options.yes && pkg.scripts && pkg.scripts[options.script]) {\n\t\tconst response = await confirm({\n\t\t\tmessage: `The \\`${color.cyan(options.script)}\\` already exists overwrite?`,\n\t\t\tinitialValue: false,\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (!response) {\n\t\t\tconst response = await text({\n\t\t\t\tmessage: 'What would you like to call the script?',\n\t\t\t\tplaceholder: 'build:registry',\n\t\t\t\tvalidate: (val) => {\n\t\t\t\t\tif (val.trim().length === 0) return 'Please provide a value!';\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\toptions.script = response;\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst alreadyInstalled = pkg.devDependencies && pkg.devDependencies.jsrepo !== undefined;\n\n\tlet installAsDevDependency = options.yes || alreadyInstalled;\n\n\tif (!options.yes && !alreadyInstalled) {\n\t\tconst response = await confirm({\n\t\t\tmessage: `Add ${ascii.JSREPO} as a dev dependency?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tinstallAsDevDependency = response;\n\t}\n\n\tlet jsonConfig = !noConfig;\n\n\tif (!options.yes && noConfig) {\n\t\tconst response = await confirm({\n\t\t\tmessage: `Create a \\`${color.cyan(REGISTRY_CONFIG_NAME)}\\` file?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(response)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tjsonConfig = response;\n\t}\n\n\tconst pm = (await detect({ cwd: 'cwd' }))?.agent ?? 'npm';\n\n\tlet buildScript = '';\n\n\tif (installAsDevDependency) {\n\t\tbuildScript += 'jsrepo build';\n\t} else {\n\t\tconst command = resolveCommand(pm, 'execute', ['jsrepo', 'build']);\n\n\t\tif (!command) program.error(color.red(`Error resolving execute command for ${pm}`));\n\n\t\tbuildScript += `${command.command} ${command.args.join(' ')} `;\n\t}\n\n\t// if we aren't using a config file configure the command with the correct flags\n\tif (!jsonConfig) {\n\t\tbuildScript += ` --dirs ${config.dirs.join(' ')} `;\n\t}\n\n\t// ensure we are adding to an object that exists\n\tif (pkg.scripts === undefined) {\n\t\tpkg.scripts = {};\n\t}\n\n\tpkg.scripts[options.script] = buildScript;\n\n\tconst tasks: Task[] = [];\n\n\ttasks.push({\n\t\tloadingMessage: `Adding \\`${color.cyan(options.script)}\\` to scripts in package.json`,\n\t\tcompletedMessage: `Added \\`${color.cyan(options.script)}\\` to scripts in package.json`,\n\t\trun: async () => {\n\t\t\ttry {\n\t\t\t\tfs.writeFileSync(packagePath, JSON.stringify(pkg, null, '\\t'));\n\t\t\t} catch (err) {\n\t\t\t\tprogram.error(\n\t\t\t\t\tcolor.red(`Error writing to \\`${color.bold(packagePath)}\\`. Error: ${err}`)\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n\n\tif (jsonConfig) {\n\t\ttasks.push({\n\t\t\tloadingMessage: `Writing config to \\`${color.cyan(REGISTRY_CONFIG_NAME)}\\``,\n\t\t\tcompletedMessage: `Wrote config to \\`${color.cyan(REGISTRY_CONFIG_NAME)}\\``,\n\t\t\trun: async () => {\n\t\t\t\tconst configPath = path.join(options.cwd, REGISTRY_CONFIG_NAME);\n\n\t\t\t\ttry {\n\t\t\t\t\tfs.writeFileSync(path.join(configPath), JSON.stringify(config, null, '\\t'));\n\t\t\t\t} catch (err) {\n\t\t\t\t\tprogram.error(\n\t\t\t\t\t\tcolor.red(`Error writing to \\`${color.bold(configPath)}\\`. Error: ${err}`)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\tawait runTasks(tasks, {});\n\n\tlet installed = alreadyInstalled;\n\n\tif (installAsDevDependency && !alreadyInstalled) {\n\t\tlet shouldInstall = options.yes;\n\t\tif (!options.yes) {\n\t\t\tconst response = await confirm({\n\t\t\t\tmessage: 'Install dependencies?',\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (isCancel(response)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tshouldInstall = response;\n\t\t}\n\n\t\tif (shouldInstall) {\n\t\t\tloading.start(`Installing ${ascii.JSREPO}`);\n\n\t\t\tconst installedResult = await installDependencies({\n\t\t\t\tpm,\n\t\t\t\tdeps: ['jsrepo'],\n\t\t\t\tdev: true,\n\t\t\t\tcwd: options.cwd,\n\t\t\t});\n\n\t\t\tinstalledResult.match(\n\t\t\t\t() => loading.stop(`Installed ${ascii.JSREPO}.`),\n\t\t\t\t(err) => {\n\t\t\t\t\tloading.stop(`Failed to install ${ascii.JSREPO}.`);\n\t\t\t\t\tprogram.error(err);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tinstalled = true;\n\t\t}\n\t}\n\n\tlet steps: string[] = [];\n\n\tif (!installed && installAsDevDependency) {\n\t\tconst cmd = resolveCommand(pm, 'add', ['jsrepo', '-D']);\n\n\t\tsteps.push(\n\t\t\t`Install ${ascii.JSREPO} as a dev dependency \\`${color.cyan(`${cmd?.command} ${cmd?.args.join(' ')}`)}\\``\n\t\t);\n\t}\n\n\tsteps.push(`Add categories to \\`${color.cyan(config.dirs.join(', '))}\\`.`);\n\n\tconst runScript = resolveCommand(pm, 'run', [options.script]);\n\n\tsteps.push(\n\t\t`Run \\`${color.cyan(`${runScript?.command} ${runScript?.args.join(' ')}`)}\\` to build the registry.`\n\t);\n\n\t// put steps with numbers above here\n\tsteps = steps.map((step, i) => `${i + 1}. ${step}`);\n\n\tconst next = nextSteps(steps);\n\n\tprocess.stdout.write(next);\n};\n\nexport { init };\n","import fs from 'node:fs';\nimport { cancel, confirm, isCancel, outro, spinner } from '@clack/prompts';\nimport color from 'chalk';\nimport { Argument, Command, program } from 'commander';\nimport { execa } from 'execa';\nimport { resolveCommand } from 'package-manager-detector/commands';\nimport { detect } from 'package-manager-detector/detect';\nimport path from 'pathe';\nimport { Project } from 'ts-morph';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport * as ascii from '../utils/ascii';\nimport { getInstalled } from '../utils/blocks';\nimport * as url from '../utils/blocks/utils/url';\nimport { type Block, isTestFile } from '../utils/build';\nimport { getPathForBlock, getProjectConfig, resolvePaths } from '../utils/config';\nimport { OUTPUT_FILE } from '../utils/context';\nimport { intro } from '../utils/prompts';\nimport * as providers from '../utils/providers';\n\nconst schema = v.object({\n\trepo: v.optional(v.string()),\n\tallow: v.boolean(),\n\tdebug: v.boolean(),\n\tverbose: v.boolean(),\n\tcwd: v.string(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst test = new Command('test')\n\t.description('Tests local blocks against most recent remote tests.')\n\t.addArgument(new Argument('[blocks...]', 'The blocks you want to test.').default([]))\n\t.option('--repo <repo>', 'Repository to download the blocks from.')\n\t.option('-A, --allow', 'Allow jsrepo to download code from the provided repo.', false)\n\t.option('--debug', 'Leaves the temp test file around for debugging upon failure.', false)\n\t.option('--verbose', 'Include debug logs.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.action(async (blockNames, opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _test(blockNames, options);\n\n\t\toutro(color.green('All done!'));\n\t});\n\ntype RemoteBlock = Block & { sourceRepo: providers.Info };\n\nconst _test = async (blockNames: string[], options: Options) => {\n\tconst verbose = (msg: string) => {\n\t\tif (options.verbose) {\n\t\t\tconsole.info(`${ascii.INFO} ${msg}`);\n\t\t}\n\t};\n\n\tverbose(`Attempting to test ${JSON.stringify(blockNames)}`);\n\n\tconst config = getProjectConfig(options.cwd).match(\n\t\t(val) => val,\n\t\t(err) => program.error(color.red(err))\n\t);\n\n\tconst loading = spinner();\n\n\tconst blocksMap: Map<string, RemoteBlock> = new Map();\n\n\tlet repoPaths = config.repos;\n\n\t// we just want to override all others if supplied via the CLI\n\tif (options.repo) repoPaths = [options.repo];\n\n\tif (!options.allow && options.repo) {\n\t\tconst result = await confirm({\n\t\t\tmessage: `Allow ${color.cyan('jsrepo')} to download and run code from ${color.cyan(options.repo)}?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(result) || !result) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\tverbose(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tif (!options.verbose) loading.start(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tfor (const repo of repoPaths) {\n\t\tconst providerInfo: providers.Info = (await providers.getProviderInfo(repo)).match(\n\t\t\t(info) => info,\n\t\t\t(err) => program.error(color.red(err))\n\t\t);\n\n\t\tconst manifest = await providerInfo.provider.fetchManifest(providerInfo);\n\n\t\tverbose(`Got info for provider ${color.cyan(providerInfo.name)}`);\n\n\t\tif (manifest.isErr()) {\n\t\t\tif (!options.verbose) loading.stop(`Error fetching ${color.cyan(repo)}`);\n\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(\n\t\t\t\t\t`There was an error fetching the \\`${OUTPUT_FILE}\\` from the repository ${color.cyan(\n\t\t\t\t\t\trepo\n\t\t\t\t\t)} make sure the target repository has a \\`${OUTPUT_FILE}\\` in its root?`\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tconst categories = manifest.unwrap();\n\n\t\tfor (const category of categories) {\n\t\t\tfor (const block of category.blocks) {\n\t\t\t\t// blocks will override each other\n\t\t\t\tblocksMap.set(url.join(providerInfo.url, category.name, block.name), {\n\t\t\t\t\t...block,\n\t\t\t\t\tsourceRepo: providerInfo,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tverbose(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tif (!options.verbose) loading.stop(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst tempTestDirectory = path.resolve(\n\t\tpath.join(options.cwd, `blocks-tests-temp-${Date.now()}`)\n\t);\n\n\tverbose(`Trying to create the temp directory ${color.bold(tempTestDirectory)}.`);\n\n\tfs.mkdirSync(tempTestDirectory, { recursive: true });\n\n\tconst cleanUp = () => {\n\t\tfs.rmSync(tempTestDirectory, { recursive: true, force: true });\n\t};\n\n\tconst installedBlocks = getInstalled(blocksMap, config, options.cwd).map(\n\t\t(val) => val.specifier\n\t);\n\n\tlet testingBlocks = blockNames;\n\n\t// in the case that we want to test all files\n\tif (blockNames.length === 0) {\n\t\ttestingBlocks = installedBlocks;\n\t}\n\n\tif (testingBlocks.length === 0) {\n\t\tcleanUp();\n\t\tprogram.error(color.red('There were no blocks found in your project!'));\n\t}\n\n\tconst testingBlocksMapped: { name: string; block: RemoteBlock }[] = [];\n\n\tfor (const blockSpecifier of testingBlocks) {\n\t\tlet block: RemoteBlock | undefined = undefined;\n\n\t\tconst provider = providers.providers.find((p) => blockSpecifier.startsWith(p.name()));\n\n\t\t// if the block starts with github (or another provider) we know it has been resolved\n\t\tif (!provider) {\n\t\t\tfor (const repo of repoPaths) {\n\t\t\t\t// we unwrap because we already checked this\n\t\t\t\tconst providerInfo = (await providers.getProviderInfo(repo)).unwrap();\n\n\t\t\t\tconst [parsedRepo] = providerInfo.provider.parseBlockSpecifier(providerInfo.url);\n\n\t\t\t\tconst [category, blockName] = blockSpecifier.split('/');\n\n\t\t\t\tconst tempBlock = blocksMap.get(url.join(parsedRepo, category, blockName));\n\n\t\t\t\tif (tempBlock === undefined) continue;\n\n\t\t\t\tblock = tempBlock;\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tconst [repo] = provider.parseBlockSpecifier(blockSpecifier);\n\n\t\t\tconst providerInfo = (await providers.getProviderInfo(repo)).match(\n\t\t\t\t(val) => val,\n\t\t\t\t(err) => program.error(color.red(err))\n\t\t\t);\n\n\t\t\tconst categories = (await providerInfo.provider.fetchManifest(providerInfo)).match(\n\t\t\t\t(val) => val,\n\t\t\t\t(err) => program.error(color.red(err))\n\t\t\t);\n\n\t\t\tfor (const category of categories) {\n\t\t\t\tfor (const block of category.blocks) {\n\t\t\t\t\tblocksMap.set(url.join(repo, block.category, block.name), {\n\t\t\t\t\t\t...block,\n\t\t\t\t\t\tsourceRepo: providerInfo,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tblock = blocksMap.get(blockSpecifier);\n\t\t}\n\n\t\tif (!block) {\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(`Invalid block! ${color.bold(blockSpecifier)} does not exist!`)\n\t\t\t);\n\t\t}\n\n\t\ttestingBlocksMapped.push({ name: blockSpecifier, block });\n\t}\n\n\tconst resolvedPathsResult = resolvePaths(config.paths, options.cwd);\n\n\tif (resolvedPathsResult.isErr()) {\n\t\tprogram.error(color.red(resolvedPathsResult.unwrapErr()));\n\t}\n\n\tconst resolvedPaths = resolvedPathsResult.unwrap();\n\n\tfor (const { block } of testingBlocksMapped) {\n\t\tconst providerInfo = block.sourceRepo;\n\n\t\tconst fullSpecifier = url.join(block.sourceRepo.url, block.category, block.name);\n\n\t\tif (!options.verbose) {\n\t\t\tloading.start(`Setting up test file for ${color.cyan(fullSpecifier)}`);\n\t\t}\n\n\t\tif (!block.tests) {\n\t\t\tloading.stop(`No tests found for ${color.cyan(fullSpecifier)}`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet directory = getPathForBlock(block, resolvedPaths, options.cwd);\n\n\t\tdirectory = path.relative(tempTestDirectory, directory);\n\n\t\tconst getSourceFile = async (filePath: string) => {\n\t\t\tconst content = await providerInfo.provider.fetchRaw(providerInfo, filePath);\n\n\t\t\tif (content.isErr()) {\n\t\t\t\tloading.stop(color.red(`Error fetching ${color.bold(filePath)}`));\n\t\t\t\tprogram.error(color.red(`There was an error trying to get ${fullSpecifier}`));\n\t\t\t}\n\n\t\t\treturn content.unwrap();\n\t\t};\n\n\t\tverbose(`Downloading and copying test files for ${fullSpecifier}`);\n\n\t\tconst testFiles: string[] = [];\n\n\t\tfor (const testFile of block.files.filter((file) => isTestFile(file))) {\n\t\t\tconst content = await getSourceFile(path.join(block.directory, testFile));\n\n\t\t\tconst destPath = path.join(tempTestDirectory, testFile);\n\n\t\t\tfs.writeFileSync(destPath, content);\n\n\t\t\ttestFiles.push(destPath);\n\t\t}\n\n\t\tconst project = new Project();\n\n\t\t// resolve imports for the block\n\t\tfor (const file of testFiles) {\n\t\t\tverbose(`Opening test file ${file}`);\n\n\t\t\tconst tempFile = project.addSourceFileAtPath(file);\n\n\t\t\tfor (const importDeclaration of tempFile.getImportDeclarations()) {\n\t\t\t\tconst moduleSpecifier = importDeclaration.getModuleSpecifierValue();\n\n\t\t\t\tlet newModuleSpecifier: string | undefined = undefined;\n\n\t\t\t\t// if the module is relative resolve it relative to the new path of the tests\n\t\t\t\tif (moduleSpecifier.startsWith('.')) {\n\t\t\t\t\tif (block.subdirectory) {\n\t\t\t\t\t\tnewModuleSpecifier = path.join(directory, block.name, moduleSpecifier);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewModuleSpecifier = path.join(directory, moduleSpecifier);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (newModuleSpecifier) {\n\t\t\t\t\t// we need to add the replace so that paths are correctly translated on windows\n\t\t\t\t\timportDeclaration.setModuleSpecifier(newModuleSpecifier.replaceAll(/\\\\/g, '/'));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tproject.saveSync();\n\n\t\tverbose(`Completed ${color.cyan.bold(fullSpecifier)} test file`);\n\n\t\tif (!options.verbose) {\n\t\t\tloading.stop(`Completed setup for ${color.bold(fullSpecifier)}`);\n\t\t}\n\t}\n\n\tverbose('Beginning testing');\n\n\tconst pm = await detect({ cwd: options.cwd });\n\n\tif (pm == null) {\n\t\tprogram.error(color.red('Could not detect package manager'));\n\t}\n\n\tconst resolved = resolveCommand(pm.agent, 'execute', ['vitest', 'run', tempTestDirectory]);\n\n\tif (resolved == null) {\n\t\tprogram.error(color.red(`Could not resolve add command for '${pm.agent}'.`));\n\t}\n\n\tconst testCommand = `${resolved.command} ${resolved.args.join(' ')}`;\n\n\tverbose(`Running ${color.cyan(testCommand)} on ${color.cyan(options.cwd)}`);\n\n\ttry {\n\t\tawait execa(resolved.command, resolved.args, {\n\t\t\tcwd: options.cwd,\n\t\t\tstdin: process.stdin,\n\t\t\tstdout: process.stdout,\n\t\t});\n\n\t\tcleanUp();\n\t} catch (err) {\n\t\tif (options.debug) {\n\t\t\tconsole.info(\n\t\t\t\t`${color.bold('--debug')} flag provided. Skipping cleanup. Run '${color.bold(\n\t\t\t\t\ttestCommand\n\t\t\t\t)}' to retry tests.\\n`\n\t\t\t);\n\t\t} else {\n\t\t\tcleanUp();\n\t\t}\n\n\t\tprogram.error(color.red(`Tests failed! Error ${err}`));\n\t}\n};\n\nexport { test };\n","import Anthropic from '@anthropic-ai/sdk';\nimport { cancel, isCancel, password, type spinner } from '@clack/prompts';\nimport ollama from 'ollama';\nimport OpenAI from 'openai';\nimport * as lines from './blocks/utils/lines';\nimport * as persisted from './persisted';\n\ntype File = {\n\tpath: string;\n\tcontent: string;\n};\n\nexport interface Model {\n\tupdateFile: (opts: {\n\t\toriginalFile: File;\n\t\tnewFile: File;\n\t\tloading: ReturnType<typeof spinner>;\n\t\tverbose?: (msg: string) => void;\n\t}) => Promise<string>;\n}\n\nexport type ModelName = 'Claude 3.5 Sonnet' | 'ChatGPT 4o-mini' | 'ChatGPT 4o' | 'Phi4';\n\ntype Prompt = {\n\tsystem: string;\n\tmessage: string;\n};\n\nconst models: Record<ModelName, Model> = {\n\t'Claude 3.5 Sonnet': {\n\t\tupdateFile: async ({ originalFile, newFile, loading, verbose }) => {\n\t\t\tconst apiKey = await getApiKey('Anthropic');\n\n\t\t\tif (!verbose) loading.start(`Asking ${'Claude 3.5 Sonnet'}`);\n\n\t\t\tconst prompt = createUpdatePrompt({ originalFile, newFile });\n\n\t\t\tverbose?.(\n\t\t\t\t`Prompting ${'Claude 3.5 Sonnet'} with:\\n${JSON.stringify(prompt, null, '\\t')}`\n\t\t\t);\n\n\t\t\tconst text = await getNextCompletionAnthropic({\n\t\t\t\tmodel: 'claude-3-5-sonnet-latest',\n\t\t\t\tprompt,\n\t\t\t\tapiKey,\n\t\t\t\tmaxTokens: (originalFile.content.length + newFile.content.length) * 2,\n\t\t\t});\n\n\t\t\tif (!verbose) loading.stop(`${'Claude 3.5 Sonnet'} updated the file`);\n\n\t\t\tif (!text) return newFile.content;\n\n\t\t\treturn unwrapCodeFromQuotes(text);\n\t\t},\n\t},\n\t'ChatGPT 4o': {\n\t\tupdateFile: async ({ originalFile, newFile, loading, verbose }) => {\n\t\t\tconst apiKey = await getApiKey('OpenAI');\n\n\t\t\tif (!verbose) loading.start(`Asking ${'ChatGPT 4o'}`);\n\n\t\t\tconst prompt = createUpdatePrompt({ originalFile, newFile });\n\n\t\t\tverbose?.(`Prompting ${'ChatGPT 4o'} with:\\n${JSON.stringify(prompt, null, '\\t')}`);\n\n\t\t\tconst text = await getNextCompletionOpenAI({\n\t\t\t\tmodel: 'gpt-4o',\n\t\t\t\tprompt,\n\t\t\t\tapiKey,\n\t\t\t\tmaxTokens: (originalFile.content.length + newFile.content.length) * 2,\n\t\t\t});\n\n\t\t\tif (!verbose) loading.stop(`${'ChatGPT 4o'} updated the file`);\n\n\t\t\tif (!text) return newFile.content;\n\n\t\t\treturn unwrapCodeFromQuotes(text);\n\t\t},\n\t},\n\t'ChatGPT 4o-mini': {\n\t\tupdateFile: async ({ originalFile, newFile, loading, verbose }) => {\n\t\t\tconst apiKey = await getApiKey('OpenAI');\n\n\t\t\tif (!verbose) loading.start(`Asking ${'ChatGPT 4o-mini'}`);\n\n\t\t\tconst prompt = createUpdatePrompt({ originalFile, newFile });\n\n\t\t\tverbose?.(`Prompting ${'ChatGPT 4o'} with:\\n${JSON.stringify(prompt, null, '\\t')}`);\n\n\t\t\tconst text = await getNextCompletionOpenAI({\n\t\t\t\tmodel: 'gpt-4o-mini',\n\t\t\t\tprompt,\n\t\t\t\tapiKey,\n\t\t\t\tmaxTokens: (originalFile.content.length + newFile.content.length) * 2,\n\t\t\t});\n\n\t\t\tif (!verbose) loading.stop(`${'ChatGPT 4o-mini'} updated the file`);\n\n\t\t\tif (!text) return newFile.content;\n\n\t\t\treturn unwrapCodeFromQuotes(text);\n\t\t},\n\t},\n\tPhi4: {\n\t\tupdateFile: async ({ originalFile, newFile, loading, verbose }) => {\n\t\t\tif (!verbose) loading.start(`Asking ${'Phi4'}`);\n\n\t\t\tconst prompt = createUpdatePrompt({ originalFile, newFile });\n\n\t\t\tverbose?.(`Prompting ${'Phi4'} with:\\n${JSON.stringify(prompt, null, '\\t')}`);\n\n\t\t\tconst text = await getNextCompletionOllama({ model: 'phi4', prompt });\n\n\t\t\tif (!verbose) loading.stop(`${'Phi4'} updated the file`);\n\n\t\t\tif (!text) return newFile.content;\n\n\t\t\treturn unwrapCodeFromQuotes(text);\n\t\t},\n\t},\n};\n\nconst getNextCompletionOpenAI = async ({\n\tprompt,\n\tmaxTokens,\n\tmodel,\n\tapiKey,\n}: {\n\tprompt: Prompt;\n\tmaxTokens: number;\n\tmodel: OpenAI.Chat.ChatModel;\n\tapiKey: string;\n}): Promise<string | null> => {\n\tconst openai = new OpenAI({ apiKey });\n\n\tconst msg = await openai.chat.completions.create({\n\t\tmodel,\n\t\tmax_completion_tokens: maxTokens,\n\t\tmessages: [\n\t\t\t{\n\t\t\t\trole: 'system',\n\t\t\t\tcontent: prompt.system,\n\t\t\t},\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tcontent: prompt.message,\n\t\t\t},\n\t\t],\n\t});\n\n\tconst first = msg.choices[0];\n\n\tif (first.message.content === null) return null;\n\n\treturn first.message.content;\n};\n\nconst getNextCompletionAnthropic = async ({\n\tprompt,\n\tmaxTokens,\n\tmodel,\n\tapiKey,\n}: {\n\tprompt: Prompt;\n\tmaxTokens: number;\n\tmodel: Anthropic.Messages.Model;\n\tapiKey: string;\n}): Promise<string | null> => {\n\tconst anthropic = new Anthropic({ apiKey });\n\n\tconst msg = await anthropic.messages.create({\n\t\tmodel,\n\t\tmax_tokens: Math.min(maxTokens, 8192),\n\t\ttemperature: 0.5,\n\t\tsystem: prompt.system,\n\t\tmessages: [\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\ttext: prompt.message,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t});\n\n\tconst first = msg.content[0];\n\n\t// if we don't get it in the format you want just return the new file\n\tif (first.type !== 'text') return null;\n\n\treturn first.text;\n};\n\nconst getNextCompletionOllama = async ({\n\tprompt,\n\tmodel,\n}: {\n\tprompt: Prompt;\n\tmodel: string;\n}): Promise<string | null> => {\n\tconst resp = await ollama.chat({\n\t\tmodel,\n\t\tmessages: [\n\t\t\t{\n\t\t\t\trole: 'system',\n\t\t\t\tcontent: prompt.system,\n\t\t\t},\n\t\t\t{\n\t\t\t\trole: 'user',\n\t\t\t\tcontent: prompt.message,\n\t\t\t},\n\t\t],\n\t});\n\n\treturn resp.message.content;\n};\n\nconst createUpdatePrompt = ({\n\toriginalFile,\n\tnewFile,\n}: { originalFile: File; newFile: File }): Prompt => {\n\treturn {\n\t\tsystem: 'You will respond only with the resulting code. DO NOT format the code with markdown, DO NOT put the code inside of triple quotes, only return the code as a raw string.',\n\t\tmessage: `Help me merge these two files. DO NOT make unnecessary changes. \nI expect the original code to maintain the same behavior as it currently has while including any added functionality from the new file.\nThis means stuff like defaults or configuration should normally stay intact unless the new behaviors in the new file depend on those defaults or configuration.\nThis is my current file ${originalFile.path}:\n\\`\\`\\`\n${originalFile.content}\n\\`\\`\\`\n\t\nThis is the file that has changes I want to update with ${newFile.path}:\n\\`\\`\\`\n${newFile.content}\n\\`\\`\\`\n\t`,\n\t};\n};\n\n/** The AI isn't always that smart and likes to wrap the code in quotes even though I beg it not to.\n * This function attempts to remove the quotes.\n */\nexport const unwrapCodeFromQuotes = (quoted: string): string => {\n\tlet code = quoted.trim();\n\n\tif (code.startsWith('```')) {\n\t\t// takes out the entire first line\n\t\t// this is because often a language will come after the triple quotes\n\t\tcode = lines.get(code).slice(1).join('\\n').trim();\n\t}\n\n\tif (code.endsWith('```')) {\n\t\tconst l = lines.get(code);\n\t\tcode = l\n\t\t\t.slice(0, l.length - 1)\n\t\t\t.join('\\n')\n\t\t\t.trim();\n\t}\n\n\treturn code;\n};\n\n/** Attempts to get the cached api key if it can't it will prompt the user\n *\n * @param name\n * @returns\n */\nconst getApiKey = async (name: 'OpenAI' | 'Anthropic'): Promise<string> => {\n\tconst KEY = `${name}-api-key`;\n\n\tconst storage = persisted.get();\n\n\tlet apiKey = storage.get(KEY, null) as string | null;\n\n\tif (!apiKey) {\n\t\t// prompt for api key\n\t\tconst result = await password({\n\t\t\tmessage: `Paste your ${name} API key:`,\n\t\t\tvalidate(value) {\n\t\t\t\tif (value.trim() === '') return 'Please provide an API key';\n\t\t\t},\n\t\t});\n\n\t\tif (isCancel(result) || !result) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tapiKey = result;\n\t}\n\n\tstorage.set(KEY, apiKey);\n\n\treturn apiKey;\n};\n\nexport { models };\n","/*\n\tjsrepo 1.2.4\n\tInstalled from github/ieedan/std\n\t11-21-2024\n*/\n\n/** Calculates the sum of all elements in the array based on the provided function.\n *\n * @param arr Array of items to be summed.\n * @param fn Summing function\n * @returns\n *\n * ## Examples\n *\n * ```ts\n * const total = arraySum([1, 2, 3, 4, 5], (num) => num);\n *\n * console.log(total); // 15\n * ```\n */\nconst arraySum = <T>(arr: T[], fn: (item: T) => number): number => {\n\tlet total = 0;\n\n\tfor (const item of arr) {\n\t\ttotal = total + fn(item);\n\t}\n\n\treturn total;\n};\n\nexport { arraySum };\n","import color from 'chalk';\nimport { type Change, diffChars } from 'diff';\nimport { arraySum } from './blocks/utils/array-sum';\nimport * as lines from './blocks/utils/lines';\nimport { leftPadMin } from './blocks/utils/pad';\n\ntype Options = {\n\t/** The source file */\n\tfrom: string;\n\t/** The destination file */\n\tto: string;\n\t/** The changes to the file */\n\tchanges: Change[];\n\t/** Expands all lines to show the entire file */\n\texpand: boolean;\n\t/** Maximum lines to show before collapsing */\n\tmaxUnchanged: number;\n\t/** Color the removed lines */\n\tcolorRemoved?: (line: string) => string;\n\t/** Color the added lines */\n\tcolorAdded?: (line: string) => string;\n\t/** Color the removed chars */\n\tcolorCharsRemoved?: (line: string) => string;\n\t/** Color the added chars */\n\tcolorCharsAdded?: (line: string) => string;\n\t/** Prefixes each line with the string returned from this function. */\n\tprefix: () => string;\n\tintro: (options: Options) => string;\n\tonUnchanged: (options: Options) => string;\n};\n\n/** Check if a character is whitespace\n *\n * @param str\n * @returns\n */\nconst isWhitespace = (str: string) => /^\\s+$/g.test(str);\n\n/** We need to add a newline at the end of each change to make sure\n * the next change can start correctly. So we take off just 1.\n *\n * @param str\n * @returns\n */\nconst trimSingleNewLine = (str: string): string => {\n\tlet i = str.length - 1;\n\twhile (isWhitespace(str[i]) && i >= 0) {\n\t\tif (str[i] === '\\n') {\n\t\t\tif (str[i - 1] === '\\r') {\n\t\t\t\treturn str.slice(0, i - 1);\n\t\t\t}\n\n\t\t\treturn str.slice(0, i);\n\t\t}\n\n\t\ti--;\n\t}\n\n\treturn str;\n};\n\nconst formatDiff = ({\n\tfrom,\n\tto,\n\tchanges,\n\texpand = false,\n\tmaxUnchanged = 5,\n\tcolorRemoved = color.redBright,\n\tcolorAdded = color.greenBright,\n\tcolorCharsRemoved = color.bgRedBright,\n\tcolorCharsAdded = color.bgGreenBright,\n\tprefix,\n\tonUnchanged,\n\tintro,\n}: Options): string => {\n\tlet result = '';\n\n\tconst length = arraySum(changes, (change) => change.count ?? 0).toString().length + 1;\n\n\tlet lineOffset = 0;\n\n\tif (changes.length === 1 && !changes[0].added && !changes[0].removed) {\n\t\treturn onUnchanged({\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tchanges,\n\t\t\texpand,\n\t\t\tmaxUnchanged,\n\t\t\tcolorAdded,\n\t\t\tcolorRemoved,\n\t\t\tprefix,\n\t\t\tonUnchanged,\n\t\t\tintro,\n\t\t});\n\t}\n\n\tresult += intro({\n\t\tfrom,\n\t\tto,\n\t\tchanges,\n\t\texpand,\n\t\tmaxUnchanged,\n\t\tcolorAdded,\n\t\tcolorRemoved,\n\t\tprefix,\n\t\tonUnchanged,\n\t\tintro,\n\t});\n\n\t/** Provides the line number prefix */\n\tconst linePrefix = (line: number): string =>\n\t\tcolor.gray(`${prefix?.() ?? ''}${leftPadMin(`${line + 1 + lineOffset} `, length)} `);\n\n\tfor (let i = 0; i < changes.length; i++) {\n\t\tconst change = changes[i];\n\n\t\tconst hasPreviousChange = changes[i - 1]?.added || changes[i - 1]?.removed;\n\t\tconst hasNextChange = changes[i + 1]?.added || changes[i + 1]?.removed;\n\n\t\tif (!change.added && !change.removed) {\n\t\t\t// show collapsed\n\t\t\tif (!expand && change.count !== undefined && change.count > maxUnchanged) {\n\t\t\t\tconst prevLineOffset = lineOffset;\n\t\t\t\tconst ls = lines.get(trimSingleNewLine(change.value));\n\n\t\t\t\tlet shownLines = 0;\n\n\t\t\t\tif (hasNextChange) shownLines += maxUnchanged;\n\t\t\t\tif (hasPreviousChange) shownLines += maxUnchanged;\n\n\t\t\t\t// just show all if we are going to show more than we have\n\t\t\t\tif (shownLines >= ls.length) {\n\t\t\t\t\tresult += `${lines.join(ls, {\n\t\t\t\t\t\tprefix: linePrefix,\n\t\t\t\t\t})}\\n`;\n\t\t\t\t\tlineOffset += ls.length;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// this writes the top few lines\n\t\t\t\tif (hasPreviousChange) {\n\t\t\t\t\tresult += `${lines.join(ls.slice(0, maxUnchanged), {\n\t\t\t\t\t\tprefix: linePrefix,\n\t\t\t\t\t})}\\n`;\n\t\t\t\t}\n\n\t\t\t\tif (ls.length > shownLines) {\n\t\t\t\t\tconst count = ls.length - shownLines;\n\t\t\t\t\tresult += `${lines.join(\n\t\t\t\t\t\tlines.get(\n\t\t\t\t\t\t\tcolor.gray(\n\t\t\t\t\t\t\t\t`+ ${count} more unchanged (${color.italic('-E to expand')})`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprefix: () => `${prefix?.() ?? ''}${leftPadMin(' ', length)} `,\n\t\t\t\t\t\t}\n\t\t\t\t\t)}\\n`;\n\t\t\t\t}\n\n\t\t\t\tif (hasNextChange) {\n\t\t\t\t\tlineOffset = lineOffset + ls.length - maxUnchanged;\n\t\t\t\t\tresult += `${lines.join(ls.slice(ls.length - maxUnchanged), {\n\t\t\t\t\t\tprefix: linePrefix,\n\t\t\t\t\t})}\\n`;\n\t\t\t\t}\n\n\t\t\t\t// resets the line offset\n\t\t\t\tlineOffset = prevLineOffset + change.count;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// show expanded\n\n\t\t\tresult += `${lines.join(lines.get(trimSingleNewLine(change.value)), {\n\t\t\t\tprefix: linePrefix,\n\t\t\t})}\\n`;\n\t\t\tlineOffset += change.count ?? 0;\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst colorLineChange = (change: Change) => {\n\t\t\tif (change.added) {\n\t\t\t\treturn colorAdded(trimSingleNewLine(change.value));\n\t\t\t}\n\n\t\t\tif (change.removed) {\n\t\t\t\treturn colorRemoved(trimSingleNewLine(change.value));\n\t\t\t}\n\n\t\t\treturn change.value;\n\t\t};\n\n\t\tconst colorCharChange = (change: Change) => {\n\t\t\tif (change.added) {\n\t\t\t\treturn colorCharsAdded(trimSingleNewLine(change.value));\n\t\t\t}\n\n\t\t\tif (change.removed) {\n\t\t\t\treturn colorCharsRemoved(trimSingleNewLine(change.value));\n\t\t\t}\n\n\t\t\treturn change.value;\n\t\t};\n\n\t\tif (\n\t\t\tchange.removed &&\n\t\t\tchange.count === 1 &&\n\t\t\tchanges[i + 1]?.added &&\n\t\t\tchanges[i + 1]?.count === 1\n\t\t) {\n\t\t\t// single line change\n\t\t\tconst diffedChars = diffChars(change.value, changes[i + 1].value);\n\n\t\t\tconst sentence = diffedChars.map((chg) => colorCharChange(chg)).join('');\n\n\t\t\tresult += `${linePrefix(0)}${sentence}`;\n\n\t\t\tlineOffset += 1;\n\n\t\t\ti++;\n\t\t} else {\n\t\t\tif (isWhitespace(change.value)) {\n\t\t\t\t// adds some spaces to make sure that you can see the change\n\t\t\t\tresult += `${lines.join(lines.get(colorCharChange(change)), {\n\t\t\t\t\tprefix: (line) =>\n\t\t\t\t\t\t`${linePrefix(line)}${colorCharChange({ removed: true, value: ' ', added: false })}`,\n\t\t\t\t})}\\n`;\n\n\t\t\t\tif (!change.removed) {\n\t\t\t\t\tlineOffset += change.count ?? 0;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult += `${lines.join(lines.get(colorLineChange(change)), {\n\t\t\t\t\tprefix: linePrefix,\n\t\t\t\t})}\\n`;\n\n\t\t\t\tif (!change.removed) {\n\t\t\t\t\tlineOffset += change.count ?? 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n};\n\nexport { formatDiff };\n","import fs from 'node:fs';\nimport {\n\tcancel,\n\tconfirm,\n\tisCancel,\n\tlog,\n\tmultiselect,\n\toutro,\n\tselect,\n\tspinner,\n} from '@clack/prompts';\nimport color from 'chalk';\nimport { Command, program } from 'commander';\nimport { diffLines } from 'diff';\nimport { resolveCommand } from 'package-manager-detector/commands';\nimport { detect } from 'package-manager-detector/detect';\nimport path from 'pathe';\nimport * as v from 'valibot';\nimport { context } from '../cli';\nimport { type ModelName, models } from '../utils/ai';\nimport * as ascii from '../utils/ascii';\nimport { type RemoteBlock, getInstalled, resolveTree } from '../utils/blocks';\nimport * as url from '../utils/blocks/utils/url';\nimport { isTestFile } from '../utils/build';\nimport { getPathForBlock, getProjectConfig, resolvePaths } from '../utils/config';\nimport { installDependencies } from '../utils/dependencies';\nimport { formatDiff } from '../utils/diff';\nimport { formatFile, transformRemoteContent } from '../utils/files';\nimport { loadFormatterConfig } from '../utils/format';\nimport { getWatermark } from '../utils/get-watermark';\nimport { returnShouldInstall } from '../utils/package';\nimport { type Task, intro, nextSteps, runTasks } from '../utils/prompts';\nimport * as providers from '../utils/providers';\n\nconst schema = v.object({\n\tall: v.boolean(),\n\texpand: v.boolean(),\n\tmaxUnchanged: v.number(),\n\tno: v.boolean(),\n\trepo: v.optional(v.string()),\n\tallow: v.boolean(),\n\tyes: v.boolean(),\n\tverbose: v.boolean(),\n\tcwd: v.string(),\n});\n\ntype Options = v.InferInput<typeof schema>;\n\nconst update = new Command('update')\n\t.description('Update blocks to the code in the remote repository.')\n\t.argument('[blocks...]', 'Names of the blocks you want to update. ex: (utils/math)')\n\t.option('--all', 'Update all installed components.', false)\n\t.option('-E, --expand', 'Expands the diff so you see everything.', false)\n\t.option(\n\t\t'--max-unchanged <number>',\n\t\t'Maximum unchanged lines that will show without being collapsed.',\n\t\t(val) => Number.parseInt(val), // this is such a dumb api thing\n\t\t3\n\t)\n\t.option('-n, --no', 'Do update any blocks.', false)\n\t.option('--repo <repo>', 'Repository to download the blocks from.')\n\t.option('-A, --allow', 'Allow jsrepo to download code from the provided repo.', false)\n\t.option('-y, --yes', 'Skip confirmation prompt.', false)\n\t.option('--verbose', 'Include debug logs.', false)\n\t.option('--cwd <path>', 'The current working directory.', process.cwd())\n\t.action(async (blockNames, opts) => {\n\t\tconst options = v.parse(schema, opts);\n\n\t\tintro(context);\n\n\t\tawait _update(blockNames, options);\n\n\t\toutro(color.green('All done!'));\n\t});\n\nconst _update = async (blockNames: string[], options: Options) => {\n\tconst verbose = (msg: string) => {\n\t\tif (options.verbose) {\n\t\t\tconsole.info(`${ascii.INFO} ${msg}`);\n\t\t}\n\t};\n\n\tverbose(`Attempting to update ${JSON.stringify(blockNames)}`);\n\n\tconst loading = spinner();\n\n\tconst config = getProjectConfig(options.cwd).match(\n\t\t(val) => val,\n\t\t(err) => program.error(color.red(err))\n\t);\n\n\tlet repoPaths = config.repos;\n\n\t// we just want to override all others if supplied via the CLI\n\tif (options.repo) repoPaths = [options.repo];\n\n\t// ensure blocks do not provide repos\n\tfor (const blockSpecifier of blockNames) {\n\t\tif (providers.providers.find((p) => blockSpecifier.startsWith(p.name()))) {\n\t\t\tprogram.error(\n\t\t\t\tcolor.red(\n\t\t\t\t\t`Invalid value provided for block names \\`${color.bold(blockSpecifier)}\\`. Block names are expected to be provided in the format of \\`${color.bold('<category>/<name>')}\\``\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!options.allow && options.repo) {\n\t\tconst result = await confirm({\n\t\t\tmessage: `Allow ${color.cyan('jsrepo')} to download and run code from ${color.cyan(options.repo)}?`,\n\t\t\tinitialValue: true,\n\t\t});\n\n\t\tif (isCancel(result) || !result) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\t}\n\n\tverbose(`Resolving ${color.cyan(repoPaths.join(', '))}`);\n\n\tif (!options.verbose) loading.start(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst resolvedRepos: providers.ResolvedRepo[] = (\n\t\tawait providers.resolvePaths(...repoPaths)\n\t).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed to get info for ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tverbose(`Resolved ${color.cyan(repoPaths.join(', '))}`);\n\n\tverbose(`Fetching blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst blocksMap: Map<string, RemoteBlock> = (\n\t\tawait providers.fetchBlocks(...resolvedRepos)\n\t).match(\n\t\t(val) => val,\n\t\t({ repo, message }) => {\n\t\t\tloading.stop(`Failed fetching blocks from ${color.cyan(repo)}`);\n\t\t\tprogram.error(color.red(message));\n\t\t}\n\t);\n\n\tif (!options.verbose) loading.stop(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tverbose(`Retrieved blocks from ${color.cyan(repoPaths.join(', '))}`);\n\n\tconst installedBlocks = getInstalled(blocksMap, config, options.cwd);\n\n\tif (installedBlocks.length === 0) {\n\t\tprogram.error(\n\t\t\tcolor.red(\n\t\t\t\t`You haven't installed any blocks yet. Did you mean to \\`${color.bold('add')}\\`?`\n\t\t\t)\n\t\t);\n\t}\n\n\tlet updatingBlockNames = blockNames;\n\n\tif (options.all) {\n\t\tupdatingBlockNames = installedBlocks.map((block) => block.specifier);\n\t}\n\n\t// if no blocks are provided prompt the user for what blocks they want\n\tif (updatingBlockNames.length === 0) {\n\t\tconst promptResult = await multiselect({\n\t\t\tmessage: `Which blocks would you like to ${options.no ? 'diff' : 'update'}?`,\n\t\t\toptions: installedBlocks\n\t\t\t\t.filter((b) => b.block.list)\n\t\t\t\t.map((block) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlabel: `${color.cyan(block.block.category)}/${block.block.name}`,\n\t\t\t\t\t\tvalue: block.specifier,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\trequired: true,\n\t\t});\n\n\t\tif (isCancel(promptResult)) {\n\t\t\tcancel('Canceled!');\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tupdatingBlockNames = promptResult as string[];\n\t}\n\n\tverbose(`Preparing to update ${color.cyan(updatingBlockNames.join(', '))}`);\n\n\tconst updatingBlocks = (await resolveTree(updatingBlockNames, blocksMap, resolvedRepos)).match(\n\t\t(val) => val,\n\t\tprogram.error\n\t);\n\n\tconst pm = (await detect({ cwd: options.cwd }))?.agent ?? 'npm';\n\n\tconst tasks: Task[] = [];\n\n\tlet devDeps: Set<string> = new Set<string>();\n\tlet deps: Set<string> = new Set<string>();\n\n\tconst { prettierOptions, biomeOptions } = await loadFormatterConfig({\n\t\tformatter: config.formatter,\n\t\tcwd: options.cwd,\n\t});\n\n\tconst resolvedPathsResult = resolvePaths(config.paths, options.cwd);\n\n\tif (resolvedPathsResult.isErr()) {\n\t\tprogram.error(color.red(resolvedPathsResult.unwrapErr()));\n\t}\n\n\tconst resolvedPaths = resolvedPathsResult.unwrap();\n\n\tlet model: ModelName = 'Claude 3.5 Sonnet';\n\n\tfor (const { block } of updatingBlocks) {\n\t\tconst fullSpecifier = url.join(block.sourceRepo.url, block.category, block.name);\n\n\t\tconst watermark = getWatermark(context.package.version, block.sourceRepo.url);\n\n\t\tconst providerInfo = block.sourceRepo;\n\n\t\tverbose(`Attempting to add ${fullSpecifier}`);\n\n\t\tconst directory = getPathForBlock(block, resolvedPaths, options.cwd);\n\n\t\tconst files: { content: string; destPath: string; fileName: string }[] = [];\n\n\t\tconst getSourceFile = async (filePath: string) => {\n\t\t\tconst content = await providerInfo.provider.fetchRaw(providerInfo, filePath, {\n\t\t\t\tverbose,\n\t\t\t});\n\n\t\t\tif (content.isErr()) {\n\t\t\t\tloading.stop(color.red(`Error fetching ${color.bold(filePath)}`));\n\t\t\t\tprogram.error(color.red(`There was an error trying to get ${fullSpecifier}`));\n\t\t\t}\n\n\t\t\treturn content.unwrap();\n\t\t};\n\n\t\tfor (const sourceFile of block.files) {\n\t\t\tif (!config.includeTests && isTestFile(sourceFile)) continue;\n\n\t\t\tconst sourcePath = path.join(block.directory, sourceFile);\n\n\t\t\tlet destPath: string;\n\t\t\tif (block.subdirectory) {\n\t\t\t\tdestPath = path.join(directory, block.name, sourceFile);\n\t\t\t} else {\n\t\t\t\tdestPath = path.join(directory, sourceFile);\n\t\t\t}\n\n\t\t\tconst content = await getSourceFile(sourcePath);\n\n\t\t\tfs.mkdirSync(destPath.slice(0, destPath.length - sourceFile.length), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\n\t\t\tfiles.push({ content, destPath, fileName: sourceFile });\n\t\t}\n\n\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE}\\n`);\n\n\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE} ${fullSpecifier}\\n`);\n\n\t\tfor (const file of files) {\n\t\t\tconst remoteContentResult = await transformRemoteContent({\n\t\t\t\tfile,\n\t\t\t\tbiomeOptions,\n\t\t\t\tprettierOptions,\n\t\t\t\tconfig,\n\t\t\t\timports: block._imports_,\n\t\t\t\twatermark,\n\t\t\t\tverbose,\n\t\t\t\tcwd: options.cwd,\n\t\t\t});\n\n\t\t\tif (remoteContentResult.isErr()) {\n\t\t\t\tprogram.error(color.red(remoteContentResult.unwrapErr()));\n\t\t\t}\n\n\t\t\tconst originalRemoteContent = remoteContentResult.unwrap();\n\n\t\t\tlet remoteContent = remoteContentResult.unwrap();\n\n\t\t\tlet acceptedChanges = options.yes;\n\n\t\t\tif (!options.yes) {\n\t\t\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE}\\n`);\n\n\t\t\t\tlet localContent = '';\n\t\t\t\tif (fs.existsSync(file.destPath)) {\n\t\t\t\t\tlocalContent = fs.readFileSync(file.destPath).toString();\n\t\t\t\t}\n\n\t\t\t\tconst from = url.join(providerInfo.url, file.fileName);\n\n\t\t\t\tconst to = path.relative(options.cwd, file.destPath);\n\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst changes = diffLines(localContent, remoteContent);\n\n\t\t\t\t\t// print diff\n\t\t\t\t\tconst formattedDiff = formatDiff({\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\tchanges,\n\t\t\t\t\t\texpand: options.expand,\n\t\t\t\t\t\tmaxUnchanged: options.maxUnchanged,\n\t\t\t\t\t\tprefix: () => `${ascii.VERTICAL_LINE} `,\n\t\t\t\t\t\tonUnchanged: ({ from, to, prefix }) =>\n\t\t\t\t\t\t\t`${prefix?.() ?? ''}${color.cyan(from)} → ${color.gray(to)} ${color.gray('(unchanged)')}\\n`,\n\t\t\t\t\t\tintro: ({ from, to, changes, prefix }) => {\n\t\t\t\t\t\t\tconst totalChanges = changes.filter((a) => a.added || a.removed).length;\n\n\t\t\t\t\t\t\treturn `${prefix?.() ?? ''}${color.cyan(from)} → ${color.gray(to)} (${totalChanges} change${\n\t\t\t\t\t\t\t\ttotalChanges === 1 ? '' : 's'\n\t\t\t\t\t\t\t})\\n${prefix?.() ?? ''}\\n`;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\n\t\t\t\t\tprocess.stdout.write(formattedDiff);\n\n\t\t\t\t\t// if there are no changes then don't ask\n\t\t\t\t\tif (changes.length > 1 || localContent === '') {\n\t\t\t\t\t\tacceptedChanges = options.yes;\n\n\t\t\t\t\t\tif (!options.yes && !options.no) {\n\t\t\t\t\t\t\t// prompt the user\n\t\t\t\t\t\t\tconst confirmResult = await select({\n\t\t\t\t\t\t\t\tmessage: 'Accept changes?',\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: 'Accept',\n\t\t\t\t\t\t\t\t\t\tvalue: 'accept',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: 'Reject',\n\t\t\t\t\t\t\t\t\t\tvalue: 'reject',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: `✨ ${color.yellow('Update with AI')} ✨`,\n\t\t\t\t\t\t\t\t\t\tvalue: 'update',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tif (isCancel(confirmResult)) {\n\t\t\t\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (confirmResult === 'update') {\n\t\t\t\t\t\t\t\t// prompt for model\n\t\t\t\t\t\t\t\tconst modelResult = await select({\n\t\t\t\t\t\t\t\t\tmessage: 'Select a model',\n\t\t\t\t\t\t\t\t\toptions: Object.keys(models).map((key) => ({\n\t\t\t\t\t\t\t\t\t\tlabel: key,\n\t\t\t\t\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (isCancel(modelResult)) {\n\t\t\t\t\t\t\t\t\tcancel('Canceled!');\n\t\t\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tmodel = modelResult as ModelName;\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tremoteContent = await models[model].updateFile({\n\t\t\t\t\t\t\t\t\t\toriginalFile: {\n\t\t\t\t\t\t\t\t\t\t\tcontent: localContent,\n\t\t\t\t\t\t\t\t\t\t\tpath: to,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tnewFile: {\n\t\t\t\t\t\t\t\t\t\t\tcontent: originalRemoteContent,\n\t\t\t\t\t\t\t\t\t\t\tpath: from,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tloading,\n\t\t\t\t\t\t\t\t\t\tverbose: options.verbose ? verbose : undefined,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\tloading.stop();\n\t\t\t\t\t\t\t\t\tlog.error(color.red(`Error getting completions: ${err}`));\n\t\t\t\t\t\t\t\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE}\\n`);\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tremoteContent = await formatFile({\n\t\t\t\t\t\t\t\t\tfile: {\n\t\t\t\t\t\t\t\t\t\tcontent: remoteContent,\n\t\t\t\t\t\t\t\t\t\tdestPath: file.destPath,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tbiomeOptions,\n\t\t\t\t\t\t\t\t\tprettierOptions,\n\t\t\t\t\t\t\t\t\tconfig,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tprocess.stdout.write(`${ascii.VERTICAL_LINE}\\n`);\n\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tacceptedChanges = confirmResult === 'accept';\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak; // there were no changes or changes were automatically accepted\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (acceptedChanges) {\n\t\t\t\tawait runTasks(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tloadingMessage: `Writing changes to ${color.cyan(file.destPath)}`,\n\t\t\t\t\t\t\tcompletedMessage: `Wrote changes to ${color.cyan(file.destPath)}.`,\n\t\t\t\t\t\t\trun: async () => fs.writeFileSync(file.destPath, remoteContent),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tverbose: options.verbose ? verbose : undefined,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (config.includeTests && block.tests) {\n\t\t\tverbose('Trying to include tests');\n\n\t\t\tconst { devDependencies } = JSON.parse(\n\t\t\t\tfs.readFileSync(path.join(options.cwd, 'package.json')).toString()\n\t\t\t);\n\n\t\t\tif (devDependencies === undefined || devDependencies.vitest === undefined) {\n\t\t\t\tdevDeps.add('vitest');\n\t\t\t}\n\t\t}\n\n\t\tfor (const dep of block.devDependencies) {\n\t\t\tdevDeps.add(dep);\n\t\t}\n\n\t\tfor (const dep of block.dependencies) {\n\t\t\tdeps.add(dep);\n\t\t}\n\t}\n\n\tawait runTasks(tasks, { verbose: options.verbose ? verbose : undefined });\n\n\t// check if dependencies are already installed\n\tconst requiredDependencies = returnShouldInstall(deps, devDeps, { cwd: options.cwd });\n\n\tdeps = requiredDependencies.dependencies;\n\tdevDeps = requiredDependencies.devDependencies;\n\n\tconst hasDependencies = deps.size > 0 || devDeps.size > 0;\n\n\tif (hasDependencies) {\n\t\tlet install = options.yes;\n\t\tif (!options.yes && !options.no) {\n\t\t\tconst result = await confirm({\n\t\t\t\tmessage: 'Would you like to install dependencies?',\n\t\t\t\tinitialValue: true,\n\t\t\t});\n\n\t\t\tif (isCancel(result)) {\n\t\t\t\tcancel('Canceled!');\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\tinstall = result;\n\t\t}\n\n\t\tif (install) {\n\t\t\tif (deps.size > 0) {\n\t\t\t\tif (!options.verbose)\n\t\t\t\t\tloading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t\t(\n\t\t\t\t\tawait installDependencies({\n\t\t\t\t\t\tpm,\n\t\t\t\t\t\tdeps: Array.from(deps),\n\t\t\t\t\t\tdev: false,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t})\n\t\t\t\t).match(\n\t\t\t\t\t(installed) => {\n\t\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dependencies');\n\n\t\t\t\t\t\tprogram.error(err);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (devDeps.size > 0) {\n\t\t\t\tif (!options.verbose)\n\t\t\t\t\tloading.start(`Installing dependencies with ${color.cyan(pm)}`);\n\n\t\t\t\t(\n\t\t\t\t\tawait installDependencies({\n\t\t\t\t\t\tpm,\n\t\t\t\t\t\tdeps: Array.from(devDeps),\n\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\t})\n\t\t\t\t).match(\n\t\t\t\t\t(installed) => {\n\t\t\t\t\t\tif (!options.verbose)\n\t\t\t\t\t\t\tloading.stop(`Installed ${color.cyan(installed.join(', '))}`);\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!options.verbose) loading.stop('Failed to install dev dependencies');\n\n\t\t\t\t\t\tprogram.error(err);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// next steps if they didn't install dependencies\n\t\tlet steps = [];\n\n\t\tif (!install) {\n\t\t\tif (deps.size > 0) {\n\t\t\t\tconst cmd = resolveCommand(pm, 'add', [...deps]);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\t`Install dependencies \\`${color.cyan(`${cmd?.command} ${cmd?.args.join(' ')}`)}\\``\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (devDeps.size > 0) {\n\t\t\t\tconst cmd = resolveCommand(pm, 'add', [...devDeps, '-D']);\n\n\t\t\t\tsteps.push(\n\t\t\t\t\t`Install dev dependencies \\`${color.cyan(`${cmd?.command} ${cmd?.args.join(' ')}`)}\\``\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// put steps with numbers above here\n\t\tsteps = steps.map((step, i) => `${i + 1}. ${step}`);\n\n\t\tif (!install) {\n\t\t\tsteps.push('');\n\t\t}\n\n\t\tsteps.push('Import and use the blocks!');\n\n\t\tconst next = nextSteps(steps);\n\n\t\tprocess.stdout.write(next);\n\t}\n};\n\nexport { update };\n","import { Err, Ok, type Result } from './blocks/types/result';\nimport * as persisted from './persisted';\n\nconst LATEST_VERSION_KEY = 'latest-version';\nconst EXPIRATION_TIME = 60 * 60 * 1000; // 1 hour\n\ntype LatestVersion = {\n\texpiration: number;\n\tversion: string;\n};\n\n/** Checks for the latest version from the github repository. Will cache results for up to 1 hour. */\nexport const getLatestVersion = async (): Promise<Result<string, string>> => {\n\ttry {\n\t\t// handle caching\n\t\tconst storage = persisted.get();\n\n\t\tlet version: string;\n\n\t\tconst latestVersion = storage.get(LATEST_VERSION_KEY) as LatestVersion | null;\n\n\t\tif (latestVersion) {\n\t\t\tif (latestVersion.expiration > Date.now()) {\n\t\t\t\tversion = latestVersion.version;\n\n\t\t\t\treturn Ok(version);\n\t\t\t}\n\n\t\t\tstorage.delete(LATEST_VERSION_KEY);\n\t\t}\n\n\t\t// we abort the request after a second\n\t\t// because it really just isn't worth it if it's going to take that long\n\t\tconst controller = new AbortController();\n\n\t\tconst timeout = setTimeout(() => {\n\t\t\tcontroller.abort();\n\t\t}, 1000);\n\n\t\tconst response = await fetch(\n\t\t\t'https://raw.githubusercontent.com/ieedan/jsrepo/refs/heads/main/packages/cli/package.json',\n\t\t\t{\n\t\t\t\tsignal: controller.signal,\n\t\t\t}\n\t\t);\n\n\t\tclearTimeout(timeout);\n\n\t\tif (!response.ok) {\n\t\t\treturn Err('Error getting version');\n\t\t}\n\n\t\tconst { version: ver } = await response.json();\n\n\t\tversion = ver;\n\n\t\tstorage.set(LATEST_VERSION_KEY, {\n\t\t\texpiration: Date.now() + EXPIRATION_TIME,\n\t\t\tversion,\n\t\t} satisfies LatestVersion);\n\n\t\treturn Ok(version);\n\t} catch (err) {\n\t\treturn Err(`Error getting version: ${err}`);\n\t}\n};\n","import fs from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { program } from 'commander';\nimport path from 'pathe';\nimport * as commands from './commands';\nimport type { CLIContext } from './utils/context';\nimport { getLatestVersion } from './utils/get-latest-version';\n\nconst resolveRelativeToRoot = (p: string): string => {\n\tconst dirname = fileURLToPath(import.meta.url);\n\treturn path.join(dirname, '../..', p);\n};\n\n// get version from package.json\nconst { version, name, description, repository } = JSON.parse(\n\tfs.readFileSync(resolveRelativeToRoot('package.json'), 'utf-8')\n);\n\nconst latestVersion = (await getLatestVersion()).match(\n\t(val) => val,\n\t() => undefined\n);\n\nconst context: CLIContext = {\n\tpackage: {\n\t\tname,\n\t\tdescription,\n\t\tversion,\n\t\trepository,\n\t\tlatestVersion,\n\t},\n\tresolveRelativeToRoot,\n};\n\nconst cli = program\n\t.name(name)\n\t.description(description)\n\t.version(version)\n\t.addCommand(commands.add)\n\t.addCommand(commands.auth)\n\t.addCommand(commands.build)\n\t.addCommand(commands.exec)\n\t.addCommand(commands.init)\n\t.addCommand(commands.test)\n\t.addCommand(commands.update);\n\nexport { cli, context };\n","import { cli } from './cli';\n\ncli.parse();\n"]}
@@ -0,0 +1,68 @@
1
+ import * as v from 'valibot';
2
+
3
+ declare const projectConfigSchema: v.ObjectSchema<{
4
+ readonly $schema: v.StringSchema<undefined>;
5
+ readonly repos: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
6
+ readonly includeTests: v.BooleanSchema<undefined>;
7
+ readonly paths: v.ObjectWithRestSchema<{
8
+ readonly '*': v.StringSchema<undefined>;
9
+ }, v.StringSchema<undefined>, undefined>;
10
+ readonly watermark: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
11
+ readonly formatter: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"prettier", undefined>, v.LiteralSchema<"biome", undefined>], undefined>, undefined>;
12
+ }, undefined>;
13
+ type ProjectConfig = v.InferOutput<typeof projectConfigSchema>;
14
+ declare const registryConfigSchema: v.ObjectSchema<{
15
+ readonly $schema: v.StringSchema<undefined>;
16
+ readonly dirs: v.ArraySchema<v.StringSchema<undefined>, undefined>;
17
+ readonly outputDir: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
18
+ readonly includeBlocks: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
19
+ readonly includeCategories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
20
+ readonly excludeBlocks: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
21
+ readonly excludeCategories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
22
+ readonly doNotListBlocks: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
23
+ readonly doNotListCategories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
24
+ readonly listBlocks: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
25
+ readonly listCategories: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
26
+ readonly excludeDeps: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
27
+ readonly preview: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
28
+ readonly rules: v.OptionalSchema<v.RecordSchema<v.UnionSchema<[v.LiteralSchema<"no-category-index-file-dependency", undefined>, v.LiteralSchema<"no-unpinned-dependency", undefined>, v.LiteralSchema<"require-local-dependency-exists", undefined>, v.LiteralSchema<"max-local-dependencies", undefined>, v.LiteralSchema<"no-circular-dependency", undefined>, v.LiteralSchema<"no-unused-block", undefined>, v.LiteralSchema<"no-framework-dependency", undefined>], undefined>, v.UnionSchema<[v.UnionSchema<[v.LiteralSchema<"off", undefined>, v.LiteralSchema<"warn", undefined>, v.LiteralSchema<"error", undefined>], undefined>, v.TupleWithRestSchema<[v.UnionSchema<[v.LiteralSchema<"off", undefined>, v.LiteralSchema<"warn", undefined>, v.LiteralSchema<"error", undefined>], undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>], v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>], undefined>, undefined>, undefined>;
29
+ }, undefined>;
30
+ type RegistryConfig = v.InferOutput<typeof registryConfigSchema>;
31
+
32
+ declare const blockSchema: v.ObjectSchema<{
33
+ readonly name: v.StringSchema<undefined>;
34
+ readonly category: v.StringSchema<undefined>;
35
+ readonly localDependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
36
+ readonly dependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
37
+ readonly devDependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
38
+ readonly tests: v.BooleanSchema<undefined>;
39
+ readonly list: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
40
+ /** Where to find the block relative to root */
41
+ readonly directory: v.StringSchema<undefined>;
42
+ readonly subdirectory: v.BooleanSchema<undefined>;
43
+ readonly files: v.ArraySchema<v.StringSchema<undefined>, undefined>;
44
+ readonly _imports_: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
45
+ }, undefined>;
46
+ declare const categorySchema: v.ObjectSchema<{
47
+ readonly name: v.StringSchema<undefined>;
48
+ readonly blocks: v.ArraySchema<v.ObjectSchema<{
49
+ readonly name: v.StringSchema<undefined>;
50
+ readonly category: v.StringSchema<undefined>;
51
+ readonly localDependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
52
+ readonly dependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
53
+ readonly devDependencies: v.ArraySchema<v.StringSchema<undefined>, undefined>;
54
+ readonly tests: v.BooleanSchema<undefined>;
55
+ readonly list: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
56
+ /** Where to find the block relative to root */
57
+ readonly directory: v.StringSchema<undefined>;
58
+ readonly subdirectory: v.BooleanSchema<undefined>;
59
+ readonly files: v.ArraySchema<v.StringSchema<undefined>, undefined>;
60
+ readonly _imports_: v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>;
61
+ }, undefined>, undefined>;
62
+ }, undefined>;
63
+ type Category = v.InferOutput<typeof categorySchema>;
64
+ type Block = v.InferOutput<typeof blockSchema>;
65
+
66
+ type Manifest = Category[];
67
+
68
+ export type { Block, Category, Manifest, ProjectConfig, RegistryConfig };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jsrepo",
3
3
  "description": "A CLI to add shared code from remote repositories.",
4
- "version": "1.28.3",
4
+ "version": "1.28.4",
5
5
  "license": "MIT",
6
6
  "homepage": "https://jsrepo.dev",
7
7
  "author": {
@@ -26,12 +26,21 @@
26
26
  "registry"
27
27
  ],
28
28
  "type": "module",
29
- "exports": "./dist/index.js",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./registry": {
35
+ "types": "./dist/registry/index.d.ts",
36
+ "default": "./dist/registry/index.js"
37
+ }
38
+ },
30
39
  "bin": "./dist/index.js",
31
40
  "main": "./dist/index.js",
32
41
  "files": [
33
42
  "./schemas/**/*",
34
- "dist"
43
+ "dist/**/*"
35
44
  ],
36
45
  "devDependencies": {
37
46
  "@biomejs/biome": "1.9.4",