@stacksjs/buddy 0.75.635 → 0.75.636
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.
- package/dist/cli.js +1 -1
- package/dist/commands/daemon.js +2 -2
- package/dist/commands/docs/agent-counts.d.ts +1 -1
- package/dist/commands/docs/agent-counts.js +2 -2
- package/dist/commands/docs/native-skills.js +1 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/make.js +1 -1
- package/dist/commands/publish.d.ts +23 -1
- package/dist/commands/publish.js +2 -2
- package/dist/make-auth.d.ts +26 -0
- package/dist/make-auth.js +1 -0
- package/dist/project-generation.d.ts +2 -0
- package/dist/project-generation.js +2 -0
- package/dist/runtime-flags.d.ts +1 -1
- package/dist/runtime-flags.js +1 -1
- package/package.json +57 -57
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun --config=/dev/null --no-install
|
|
1
|
+
#!/usr/bin/env -S bun --config=/dev/null --no-install --no-env-file
|
|
2
2
|
import{writeSync}from"node:fs";import process from"node:process";import{registerGlobalOptions}from"./global-options";import{shouldSkipAppKeyCheck}from"./project-setup";import{resultFailed}from"./result";import{versionLine}from"./version-info";if(import.meta.main)await runCli();async function runCli(){const typedArgs=process.argv.slice(2);const isVersionOnly=typedArgs.length===1&&["--version","-V","version"].includes(typedArgs[0]);if(isVersionOnly){writeSync(process.stdout.fd,`${versionLine} ${process.platform}-${process.arch} bun-v${Bun.version}
|
|
3
3
|
`);process.exit(0)}const[{HANDED_ROOT_ENV,launch},{getCommandNames}]=await Promise.all([import("./launcher"),import("./lazy-commands")]);const{projectInstalled}=launch({args:typedArgs,cwd:process.cwd(),main:Bun.main,execArgv:process.execArgv,handedRoot:process.env[HANDED_ROOT_ENV],builtInCommands:new Set(getCommandNames())});const args=process.argv.slice(2);const requestedCommand=args[0]||"help";const{isNativeProject,runNativeProjectCommand}=await import("./native-project");if(isNativeProject(process.cwd())){try{if(await runNativeProjectCommand(process.cwd(),args))process.exit(0)}catch(error){console.error(`[buddy] ${error instanceof Error?error.message:String(error)}`);process.exit(1)}}const[{cli,log},{path:p}]=await Promise.all([import("@stacksjs/cli"),import("@stacksjs/path")]);try{const{isSupportedBunVersion,minimumBunVersion}=await import("@stacksjs/utils");const currentBunVersion=typeof Bun!=="undefined"?Bun.version:process.versions.bun;if(currentBunVersion&&!isSupportedBunVersion(currentBunVersion)){console.error(`[buddy] Bun v${minimumBunVersion} or later is required (current: v${currentBunVersion}). Run: bun upgrade`);process.exit(1)}}catch{}const isHelpFlag=args.includes("--help")||args.includes("-h");const isHelpMode=requestedCommand==="help"||isHelpFlag&&args.length<=2;const skipAppKeyCheck=shouldSkipAppKeyCheck(requestedCommand,{isHelpFlag,isHelpMode});const needsFullSetup=!isVersionOnly;if(!process.env.LOG_LEVEL){if(args.includes("--quiet")||args.includes("-q"))process.env.LOG_LEVEL="warn";else if(args.includes("--verbose")||args.includes("-v"))process.env.LOG_LEVEL="debug"}if(needsFullSetup){const reportFatal=(label,error)=>{log.debug(`Buddy ${label}`);try{process.stderr.write(`
|
|
4
4
|
[buddy] ${label}: ${error?.stack??String(error)}
|
package/dist/commands/daemon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{existsSync,readFileSync}from"node:fs";import process from"node:process";import{bold,dim,green,onUnknownSubcommand}from"@stacksjs/cli";import{ExitCode}from"@stacksjs/types";function uptime(since){const minutes=Math.max(0,Math.round((Date.now()-Date.parse(since))/60000));if(minutes<1)return"just now";if(minutes<60)return`${minutes}m`;return`${Math.floor(minutes/60)}h ${minutes%60}m`}function memoryMb(pid){const result=Bun.spawnSync(["ps","-o","rss=","-p",String(pid)],{stdout:"pipe",stderr:"ignore"});const kilobytes=Number(result.stdout.toString().trim());return result.exitCode===0&&kilobytes>0?Math.round(kilobytes/1024):null}export function daemon(buddy){const descriptions={status:"Show whether buddy is running in the background and what it is running",start:"Start buddy in the background",stop:"Stop
|
|
2
|
-
`);return}if(!running){console.log(`buddy is not running in the background. ${dim("It starts when something needs it: buddy dashboard")}`);return}const memory=memoryMb(running.pid);console.log(`${green("●")} buddy is running in the background ${dim(`(pid ${running.pid}, up ${uptime(running.startedAt)}${memory?`, ${memory} MB`:""})`)}`);if(running.dashboards.length===0){console.log(dim(" No dashboards running.
|
|
1
|
+
import{existsSync,readFileSync}from"node:fs";import process from"node:process";import{bold,dim,green,onUnknownSubcommand}from"@stacksjs/cli";import{ExitCode}from"@stacksjs/types";function uptime(since){const minutes=Math.max(0,Math.round((Date.now()-Date.parse(since))/60000));if(minutes<1)return"just now";if(minutes<60)return`${minutes}m`;return`${Math.floor(minutes/60)}h ${minutes%60}m`}function memoryMb(pid){const result=Bun.spawnSync(["ps","-o","rss=","-p",String(pid)],{stdout:"pipe",stderr:"ignore"});const kilobytes=Number(result.stdout.toString().trim());return result.exitCode===0&&kilobytes>0?Math.round(kilobytes/1024):null}export function daemon(buddy){const descriptions={status:"Show whether buddy is running in the background and what it is running",start:"Start buddy in the background",stop:"Stop background generation and the dashboards buddy started",restart:"Restart the background buddy",logs:"Print the background buddy's log",json:"Print the status as JSON"};async function status(options){const{daemonStatus}=await import("@stacksjs/actions/daemon/client");const running=await daemonStatus();if(options.json){process.stdout.write(`${JSON.stringify(running,null,2)}
|
|
2
|
+
`);return}if(!running){console.log(`buddy is not running in the background. ${dim("It starts when something needs it: buddy dashboard")}`);return}const memory=memoryMb(running.pid);console.log(`${green("●")} buddy is running in the background ${dim(`(pid ${running.pid}, up ${uptime(running.startedAt)}${memory?`, ${memory} MB`:""})`)}`);if(running.generation){const{watched,queued,running:active,failures}=running.generation;console.log(` Generation ${watched} watched, ${queued} queued${active?`, running for ${active}`:""}`);for(const failure of failures)console.log(` ${failure.path} ${failure.error}`)}if(running.dashboards.length===0){console.log(dim(" No dashboards running."));return}const width=Math.max(...running.dashboards.map((dashboard)=>dashboard.name.length));for(const dashboard of running.dashboards){const state=dashboard.state==="ready"?dashboard.url:dim("starting");console.log(` ${bold(dashboard.name.padEnd(width))} ${state} ${dim(`up ${uptime(dashboard.startedAt)}`)}`)}}for(const name of["daemon","daemon:status"]){buddy.command(name,descriptions.status).option("--json",descriptions.json,{default:false}).action(async(options)=>{await status(options);process.exit(ExitCode.Success)})}buddy.command("daemon:start",descriptions.start).action(async()=>{const{startDaemon}=await import("@stacksjs/actions/daemon/client");const{status:running,started}=await startDaemon();console.log(started?`${green("●")} buddy is now running in the background ${dim(`(pid ${running.pid})`)}`:`buddy is already running in the background ${dim(`(pid ${running.pid})`)}`);process.exit(ExitCode.Success)});buddy.command("daemon:stop",descriptions.stop).action(async()=>{const{stopDaemon}=await import("@stacksjs/actions/daemon/client");console.log(await stopDaemon()?"Stopped the background buddy.":"buddy was not running in the background.");process.exit(ExitCode.Success)});buddy.command("daemon:restart",descriptions.restart).action(async()=>{const{startDaemon,stopDaemon}=await import("@stacksjs/actions/daemon/client");await stopDaemon();const{status:running}=await startDaemon();console.log(`${green("●")} buddy is running in the background ${dim(`(pid ${running.pid})`)}`);process.exit(ExitCode.Success)});buddy.command("daemon:logs",descriptions.logs).option("--lines <count>","How many lines from the end to print",{default:50}).action(async(options)=>{const{daemonLogFile}=await import("@stacksjs/actions/daemon/paths");const file=daemonLogFile();if(!existsSync(file)){console.log("The background buddy has not written a log yet.");process.exit(ExitCode.Success)}const lines=readFileSync(file,"utf8").trimEnd().split(`
|
|
3
3
|
`);process.stdout.write(`${lines.slice(-(Number(options.lines)||50)).join(`
|
|
4
4
|
`)}
|
|
5
5
|
`);process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"daemon")}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Every file with `extension` under `dir` that git would carry, ignoring barrels. */
|
|
2
|
-
export declare function countFiles(dir: string, extension: string): number;
|
|
2
|
+
export declare function countFiles(dir: string, extension: string, options?: { recursive?: boolean }): number;
|
|
3
3
|
export declare function run(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{execFileSync}from"node:child_process";import{readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{assertFrameworkRepo}from"./framework-repo";const root=new URL("../../../../../../../",import.meta.url).pathname;function abs(relative){return join(root,relative)}function ignoredPaths(paths){if(!paths.length)return new Set;try{const output=execFileSync("git",["check-ignore","--stdin"],{cwd:root,input:paths.join(`
|
|
2
2
|
`),encoding:"utf8",stdio:["pipe","pipe","ignore"]});return new Set(output.split(`
|
|
3
|
-
`).map((line)=>line.trim()).filter(Boolean))}catch{return new Set}}function walkFiles(dir,extension){let entries;try{entries=readdirSync(abs(dir))}catch{return[]}return entries.flatMap((entry)=>{const full=join(abs(dir),entry);if(statSync(full).isDirectory())return walkFiles(join(dir,entry),extension);if(!entry.endsWith(extension)||entry==="index.ts")return[];return[join(dir,entry)]})}export function countFiles(dir,extension){const files=walkFiles(dir,extension);const ignored=ignoredPaths(files);return files.filter((file)=>!ignored.has(file)).length}function countDirs(dir){return readdirSync(abs(dir)).filter((entry)=>statSync(join(abs(dir),entry)).isDirectory()).length}const SKILLS="storage/framework/defaults/ai/skills";const AGENTS="AGENTS.md";const CLAIMS=[{what:"built-in models",measure:()=>countFiles("storage/framework/defaults/app/Models",".ts"),sites:[{file:AGENTS,pattern:/(\d+) built-in models you can use or override/},{file:AGENTS,pattern:/All (\d+) models \(`User`/},{file:`${SKILLS}/stacks-orm/SKILL.md`,pattern:/(\d+) models/},{file:`${SKILLS}/stacks-auto-imports/SKILL.md`,pattern:/\((\d+) models\)/},{file:AGENTS,pattern:/including the (\d+) built-in `Models\/`/},{file:AGENTS,pattern:/\((\d+) built-ins, grouped into/},{file:`${SKILLS}/stacks-models/SKILL.md`,pattern:/holds (\d+), and that/},{file:`${SKILLS}/stacks-models/SKILL.md`,pattern:/the (\d+) built-in framework models/},{file:`${SKILLS}/stacks-orm/SKILL.md`,pattern:/(\d+) built-in models/}]},{what:"commerce models",measure:()=>countFiles("storage/framework/defaults/app/Models/commerce",".ts"),sites:[{file:`${SKILLS}/stacks-commerce/SKILL.md`,pattern:/and (\d+) models/}]},{what:"components",measure:()=>countFiles("storage/framework/defaults/resources/components",".stx"),sites:[{file:AGENTS,pattern:/widgets \((\d+) components\)/},{file:`${SKILLS}/stacks-dashboard/SKILL.md`,pattern:/(\d+) built-in dashboard components/},{file:`${SKILLS}/stacks-dashboard/SKILL.md`,pattern:/route views, (\d+) components,/}]},{what:"default actions",measure:()=>readFileSync(abs("storage/framework/auto-imports/actions.ts"),"utf-8").split(`
|
|
4
|
-
`).filter((line)=>/^\s+'/.test(line)).length,sites:[{file:AGENTS,pattern:/(\d+) default actions/},{file:`${SKILLS}/stacks-actions/SKILL.md`,pattern:/(\d+) default framework actions/}]},{what:"migrations",measure:()=>countFiles("database/migrations",".sql"),sites:[{file:AGENTS,pattern:/(\d+) migrations ship for/},{file:`${SKILLS}/stacks-migrations/SKILL.md`,pattern:/(\d+) built-in migration files/},{file:`${SKILLS}/stacks-migrations/SKILL.md`,pattern:/(\d+) migration files exist by default/},{file:`${SKILLS}/stacks-database/SKILL.md`,pattern:/\((\d+) migration files/}]},{what:"config files",measure:()=>countFiles("config",".ts"),sites:[{file:AGENTS,pattern:/~(\d+) typed config files/}]},{what:"skills",measure:()=>countDirs(SKILLS),sites:[{file:`${SKILLS}/stacks-writing-for-agents/SKILL.md`,pattern:/ships (\d+) skills/},{file:`docs/skills.md`,pattern:/The (\d+) agent skills Stacks ships/},{file:`docs/skills.md`,pattern:/ships \*\*(\d+) agent skills\*\*/}]}];function inspect(){const drift=[];let checked=0;for(const claim of CLAIMS){const actual=claim.measure();for(const site of claim.sites){checked++;const match=readFileSync(abs(site.file),"utf-8").match(site.pattern);const stated=match?Number(match[1]):null;if(stated!==actual)drift.push({what:claim.what,file:site.file,stated,actual})}}return{drift,checked}}function write(){let rewritten=0;for(const claim of CLAIMS){const actual=claim.measure();for(const site of claim.sites){const source=readFileSync(abs(site.file),"utf-8");const match=source.match(site.pattern);if(!match||Number(match[1])===actual)continue;const updated=match[0].replace(String(match[1]),String(actual));writeFileSync(abs(site.file),source.replace(match[0],updated),"utf-8");rewritten++}}return rewritten}export async function run(){assertFrameworkRepo(root,"docs:agent-counts");if(process.argv.includes("--write")){const rewritten=write();console.log(rewritten===0?"✓ agent-facing counts were already current":`✓ updated ${rewritten} count(s); run \`buddy setup:ai\` to refresh the installed copies`);return}const{drift,checked}=inspect();if(drift.length===0){console.log(`✓ agent-facing counts are current (${checked} checked)`);return}console.error(`✗ ${drift.length} of ${checked} agent-facing count(s) no longer match the tree:`);for(const entry of drift){console.error(entry.stated===null?` ${entry.file}: the ${entry.what} claim is gone - reword the check, or restore the sentence`:` ${entry.file}: says ${entry.stated} ${entry.what}, tree has ${entry.actual}`)}console.error("\nRun `buddy docs:agent-counts` to rewrite them from the tree.");if(process.argv.includes("--check"))process.exit(1)}if(import.meta.main)await run();
|
|
3
|
+
`).map((line)=>line.trim()).filter(Boolean))}catch{return new Set}}function walkFiles(dir,extension,recursive=true){let entries;try{entries=readdirSync(abs(dir))}catch{return[]}return entries.flatMap((entry)=>{const full=join(abs(dir),entry);if(statSync(full).isDirectory())return recursive?walkFiles(join(dir,entry),extension):[];if(!entry.endsWith(extension)||entry==="index.ts")return[];return[join(dir,entry)]})}export function countFiles(dir,extension,options={}){const files=walkFiles(dir,extension,options.recursive??true);const ignored=ignoredPaths(files);return files.filter((file)=>!ignored.has(file)).length}function countDirs(dir){return readdirSync(abs(dir)).filter((entry)=>statSync(join(abs(dir),entry)).isDirectory()).length}const SKILLS="storage/framework/defaults/ai/skills";const AGENTS="AGENTS.md";const CLAIMS=[{what:"built-in models",measure:()=>countFiles("storage/framework/defaults/app/Models",".ts"),sites:[{file:AGENTS,pattern:/(\d+) built-in models you can use or override/},{file:AGENTS,pattern:/All (\d+) models \(`User`/},{file:`${SKILLS}/stacks-orm/SKILL.md`,pattern:/(\d+) models/},{file:`${SKILLS}/stacks-auto-imports/SKILL.md`,pattern:/\((\d+) models\)/},{file:AGENTS,pattern:/including the (\d+) built-in `Models\/`/},{file:AGENTS,pattern:/\((\d+) built-ins, grouped into/},{file:`${SKILLS}/stacks-models/SKILL.md`,pattern:/holds (\d+), and that/},{file:`${SKILLS}/stacks-models/SKILL.md`,pattern:/the (\d+) built-in framework models/},{file:`${SKILLS}/stacks-orm/SKILL.md`,pattern:/(\d+) built-in models/}]},{what:"commerce models",measure:()=>countFiles("storage/framework/defaults/app/Models/commerce",".ts"),sites:[{file:`${SKILLS}/stacks-commerce/SKILL.md`,pattern:/and (\d+) models/}]},{what:"components",measure:()=>countFiles("storage/framework/defaults/resources/components",".stx"),sites:[{file:AGENTS,pattern:/widgets \((\d+) components\)/},{file:`${SKILLS}/stacks-dashboard/SKILL.md`,pattern:/(\d+) built-in dashboard components/},{file:`${SKILLS}/stacks-dashboard/SKILL.md`,pattern:/route views, (\d+) components,/}]},{what:"default actions",measure:()=>readFileSync(abs("storage/framework/auto-imports/actions.ts"),"utf-8").split(`
|
|
4
|
+
`).filter((line)=>/^\s+'/.test(line)).length,sites:[{file:AGENTS,pattern:/(\d+) default actions/},{file:`${SKILLS}/stacks-actions/SKILL.md`,pattern:/(\d+) default framework actions/}]},{what:"migrations",measure:()=>countFiles("database/migrations",".sql",{recursive:false}),sites:[{file:AGENTS,pattern:/(\d+) migrations ship for/},{file:`${SKILLS}/stacks-migrations/SKILL.md`,pattern:/(\d+) built-in migration files/},{file:`${SKILLS}/stacks-migrations/SKILL.md`,pattern:/(\d+) migration files exist by default/},{file:`${SKILLS}/stacks-database/SKILL.md`,pattern:/\((\d+) migration files/}]},{what:"config files",measure:()=>countFiles("config",".ts"),sites:[{file:AGENTS,pattern:/~(\d+) typed config files/}]},{what:"skills",measure:()=>countDirs(SKILLS),sites:[{file:`${SKILLS}/stacks-writing-for-agents/SKILL.md`,pattern:/ships (\d+) skills/},{file:`docs/skills.md`,pattern:/The (\d+) agent skills Stacks ships/},{file:`docs/skills.md`,pattern:/ships \*\*(\d+) agent skills\*\*/}]}];function inspect(){const drift=[];let checked=0;for(const claim of CLAIMS){const actual=claim.measure();for(const site of claim.sites){checked++;const match=readFileSync(abs(site.file),"utf-8").match(site.pattern);const stated=match?Number(match[1]):null;if(stated!==actual)drift.push({what:claim.what,file:site.file,stated,actual})}}return{drift,checked}}function write(){let rewritten=0;for(const claim of CLAIMS){const actual=claim.measure();for(const site of claim.sites){const source=readFileSync(abs(site.file),"utf-8");const match=source.match(site.pattern);if(!match||Number(match[1])===actual)continue;const updated=match[0].replace(String(match[1]),String(actual));writeFileSync(abs(site.file),source.replace(match[0],updated),"utf-8");rewritten++}}return rewritten}export async function run(){assertFrameworkRepo(root,"docs:agent-counts");if(process.argv.includes("--write")){const rewritten=write();console.log(rewritten===0?"✓ agent-facing counts were already current":`✓ updated ${rewritten} count(s); run \`buddy setup:ai\` to refresh the installed copies`);return}const{drift,checked}=inspect();if(drift.length===0){console.log(`✓ agent-facing counts are current (${checked} checked)`);return}console.error(`✗ ${drift.length} of ${checked} agent-facing count(s) no longer match the tree:`);for(const entry of drift){console.error(entry.stated===null?` ${entry.file}: the ${entry.what} claim is gone - reword the check, or restore the sentence`:` ${entry.file}: says ${entry.stated} ${entry.what}, tree has ${entry.actual}`)}console.error("\nRun `buddy docs:agent-counts` to rewrite them from the tree.");if(process.argv.includes("--check"))process.exit(1)}if(import.meta.main)await run();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{existsSync,readFileSync,readdirSync,statSync,writeFileSync}from"node:fs";import{dirname,join,relative}from"node:path";import process from"node:process";import{capabilityRegistry}from"@stacksjs/config/capabilities";import{FEATURE_NAMES}from"@stacksjs/features/names";import{assertFrameworkRepo}from"./framework-repo";const root=new URL("../../../../../../../",import.meta.url).pathname;const core="storage/framework/core";const destination="storage/framework/defaults/ai/skills/stacks-native";const PACKAGE_SKILLS={"action-runner":"stacks-actions","calendar-api":"stacks-calendar",defaults:"stacks-build",github:"stacks-git","model-meta":"stacks-models",tinker:"stacks-repl"};function localSource(projectRoot,entry,specifier){const path=join(dirname(entry),specifier);const stem=path.replace(/\.js$/,"");const candidates=[path,`${stem}.ts`,`${stem}.tsx`,join(path,"index.ts")];const resolved=candidates.find((candidate)=>existsSync(join(projectRoot,candidate))&&statSync(join(projectRoot,candidate)).isFile());if(!resolved)throw new Error(`Native catalog cannot resolve ${specifier} from ${entry}`);return resolved}export function nativePackageCatalog(projectRoot=root){const scanner=new Bun.Transpiler({loader:"ts"});return readdirSync(join(projectRoot,core)).filter((slug)=>existsSync(join(projectRoot,core,slug,"package.json"))).sort().map((slug)=>{const directory=join(core,slug);const manifest=JSON.parse(readFileSync(join(projectRoot,directory,"package.json"),"utf8"));const skill=PACKAGE_SKILLS[slug]??`stacks-${slug}`;if(!existsSync(join(projectRoot,"storage/framework/defaults/ai/skills",skill,"SKILL.md")))throw new Error(`Native package ${manifest.name} needs a skill or an explicit package-to-skill mapping`);const source=join(directory,"src/index.ts");const entry=existsSync(join(projectRoot,source))?source:join(directory,"package.json");const scan=entry.endsWith(".ts")?scanner.scan(readFileSync(join(projectRoot,entry),"utf8")):undefined;const tests=existsSync(join(projectRoot,directory,"tests"))?[...new Bun.Glob("**/*.{test,spec}.{ts,tsx,js}").scanSync({cwd:join(projectRoot,directory,"tests"),onlyFiles:true})].sort().map((file)=>join(directory,"tests",file)):[];return{name:manifest.name,directory,skill,entry,exports:scan?.exports.sort()??[],dependencies:[...new Set(scan?.imports.map((item)=>item.path).filter((path)=>path.startsWith("."))??[])].map((path)=>localSource(projectRoot,entry,path)).sort(),tests}})}function sourceLink(path,label=path){return`[${label}](https://github.com/stacksjs/stacks/blob/main/${path})`}export function renderNativeCatalog(projectRoot=root){const packages=nativePackageCatalog(projectRoot);return["# Native Stacks package catalog","","<!-- Generated by buddy docs:native-skills. Edit source packages or the mapping, then regenerate. -->","","This indexes every current core package. It describes source surfaces and","retained tests, not a promise that every export or remote provider is fully","supported. Read the selected skill and implementation before choosing an API.","Wildcard re-exports and type-only exports are not expanded by the source scan.","Browser runtime bindings are documented separately in `stacks-auto-imports`.","","| Package | Task guidance | Source entry | Retained tests |","|---|---|---|---|",...packages.map((entry)=>`| \`${entry.name}\` | [\`${entry.skill}\`](../${entry.skill}/SKILL.md) | ${sourceLink(entry.entry,"entrypoint")} | ${entry.tests.length} |`),"","## Source surfaces","","Use these pointers to discover the current implementation and exact signatures.","An exported name is not evidence that an operation supports every driver.","",...packages.flatMap((entry)=>[`### ${entry.name}`,"",`Guidance: [\`${entry.skill}\`](../${entry.skill}/SKILL.md). Source: ${sourceLink(entry.entry)}.`,"",entry.exports.length?`Declared runtime exports: ${entry.exports.map((name)=>`\`${name}\``).join(", ")}.`:"Read the entrypoint and package export map for re-exported or type-only surfaces.","",...entry.dependencies.length?[`Local source modules: ${entry.dependencies.map((path)=>sourceLink(path,relative(entry.directory,path))).join(", ")}.`,""]:[],...entry.tests.length?[`Evidence directory: ${sourceLink(`${entry.directory}/tests`,`${entry.tests.length} retained tests`)}. These files are evidence pointers, not a claim that all tests were run for this catalog.`,""]:[]])].join(`
|
|
1
|
+
import{existsSync,readFileSync,readdirSync,statSync,writeFileSync}from"node:fs";import{dirname,join,relative}from"node:path";import process from"node:process";import{capabilityRegistry}from"@stacksjs/config/capabilities";import{FEATURE_NAMES}from"@stacksjs/features/names";import{assertFrameworkRepo}from"./framework-repo";const root=new URL("../../../../../../../",import.meta.url).pathname;const core="storage/framework/core";const destination="storage/framework/defaults/ai/skills/stacks-native";const PACKAGE_SKILLS={"action-runner":"stacks-actions","calendar-api":"stacks-calendar",defaults:"stacks-build",github:"stacks-git","model-meta":"stacks-models",tinker:"stacks-repl",waf:"stacks-security"};function localSource(projectRoot,entry,specifier){const path=join(dirname(entry),specifier);const stem=path.replace(/\.js$/,"");const candidates=[path,`${stem}.ts`,`${stem}.tsx`,join(path,"index.ts")];const resolved=candidates.find((candidate)=>existsSync(join(projectRoot,candidate))&&statSync(join(projectRoot,candidate)).isFile());if(!resolved)throw new Error(`Native catalog cannot resolve ${specifier} from ${entry}`);return resolved}export function nativePackageCatalog(projectRoot=root){const scanner=new Bun.Transpiler({loader:"ts"});return readdirSync(join(projectRoot,core)).filter((slug)=>existsSync(join(projectRoot,core,slug,"package.json"))).sort().map((slug)=>{const directory=join(core,slug);const manifest=JSON.parse(readFileSync(join(projectRoot,directory,"package.json"),"utf8"));const skill=PACKAGE_SKILLS[slug]??`stacks-${slug}`;if(!existsSync(join(projectRoot,"storage/framework/defaults/ai/skills",skill,"SKILL.md")))throw new Error(`Native package ${manifest.name} needs a skill or an explicit package-to-skill mapping`);const source=join(directory,"src/index.ts");const entry=existsSync(join(projectRoot,source))?source:join(directory,"package.json");const scan=entry.endsWith(".ts")?scanner.scan(readFileSync(join(projectRoot,entry),"utf8")):undefined;const tests=existsSync(join(projectRoot,directory,"tests"))?[...new Bun.Glob("**/*.{test,spec}.{ts,tsx,js}").scanSync({cwd:join(projectRoot,directory,"tests"),onlyFiles:true})].sort().map((file)=>join(directory,"tests",file)):[];return{name:manifest.name,directory,skill,entry,exports:scan?.exports.sort()??[],dependencies:[...new Set(scan?.imports.map((item)=>item.path).filter((path)=>path.startsWith("."))??[])].map((path)=>localSource(projectRoot,entry,path)).sort(),tests}})}function sourceLink(path,label=path){return`[${label}](https://github.com/stacksjs/stacks/blob/main/${path})`}export function renderNativeCatalog(projectRoot=root){const packages=nativePackageCatalog(projectRoot);return["# Native Stacks package catalog","","<!-- Generated by buddy docs:native-skills. Edit source packages or the mapping, then regenerate. -->","","This indexes every current core package. It describes source surfaces and","retained tests, not a promise that every export or remote provider is fully","supported. Read the selected skill and implementation before choosing an API.","Wildcard re-exports and type-only exports are not expanded by the source scan.","Browser runtime bindings are documented separately in `stacks-auto-imports`.","","| Package | Task guidance | Source entry | Retained tests |","|---|---|---|---|",...packages.map((entry)=>`| \`${entry.name}\` | [\`${entry.skill}\`](../${entry.skill}/SKILL.md) | ${sourceLink(entry.entry,"entrypoint")} | ${entry.tests.length} |`),"","## Source surfaces","","Use these pointers to discover the current implementation and exact signatures.","An exported name is not evidence that an operation supports every driver.","",...packages.flatMap((entry)=>[`### ${entry.name}`,"",`Guidance: [\`${entry.skill}\`](../${entry.skill}/SKILL.md). Source: ${sourceLink(entry.entry)}.`,"",entry.exports.length?`Declared runtime exports: ${entry.exports.map((name)=>`\`${name}\``).join(", ")}.`:"Read the entrypoint and package export map for re-exported or type-only surfaces.","",...entry.dependencies.length?[`Local source modules: ${entry.dependencies.map((path)=>sourceLink(path,relative(entry.directory,path))).join(", ")}.`,""]:[],...entry.tests.length?[`Evidence directory: ${sourceLink(`${entry.directory}/tests`,`${entry.tests.length} retained tests`)}. These files are evidence pointers, not a claim that all tests were run for this catalog.`,""]:[]])].join(`
|
|
2
2
|
`)}export function renderDriverCapabilities(){return["# Driver evidence and limitations","","<!-- Generated by buddy docs:native-skills from capabilityRegistry. -->","","The registry distinguishes supported, partial, experimental, and unsupported","drivers. Unknown and unsupported selections fail. Partial and experimental","drivers remain subject to the limitations below. Read prerequisites before","deploying; a configuration type does not establish an implemented transport.","",...capabilityRegistry.flatMap((driver)=>[`## ${driver.category}: ${driver.name}`,"",`Status: **${driver.status}**. Topology: ${driver.topology}.`,"",...driver.implementation?[`Implementation: ${sourceLink(driver.implementation)}.`,""]:[],...driver.prerequisites.length?["Prerequisites:","",...driver.prerequisites.map((value)=>`- ${value}`),""]:[],...driver.limitations.length?["Limitations:","",...driver.limitations.map((value)=>`- ${value}`),""]:[],...driver.testEvidence.length?["Retained evidence:","",...driver.testEvidence.map((path)=>`- ${sourceLink(path)}`),""]:[]]),"## Optional application bundles","",`Installable bundle names: ${FEATURE_NAMES.map((name)=>`\`${name}\``).join(", ")}.`,"","Read `stacks-features` for installation, config gates, route bundles, and","migration selection. These are distinct from user-targeted feature flags.",""].join(`
|
|
3
3
|
`).replace(/[\u2014\u2013]/g,"-")}export async function run(){assertFrameworkRepo(root,"docs:native-skills");const outputs=[{path:join(root,destination,"CATALOG.md"),body:renderNativeCatalog()},{path:join(root,destination,"CAPABILITIES.md"),body:renderDriverCapabilities()}];const stale=outputs.filter((file)=>!existsSync(file.path)||readFileSync(file.path,"utf8")!==file.body);if(process.argv.includes("--write")){for(const file of stale)writeFileSync(file.path,file.body,"utf8");console.log(`Native skill references refreshed: ${stale.length} file(s).`)}else if(stale.length){console.error(`Native skill references are stale: ${stale.map((file)=>relative(root,file.path)).join(", ")}. Run ./buddy docs:native-skills.`);process.exitCode=1}else{console.log("Native skill package coverage and driver evidence are current.")}}if(import.meta.main)await run();
|
|
@@ -2,4 +2,4 @@ import process from"node:process";import{generateComponentMeta,generateCoreSymli
|
|
|
2
2
|
❌ ${result.error}
|
|
3
3
|
`);process.exit(ExitCode.FatalError)}console.log(result.report);if(options.dryRun)console.log(JSON.stringify(result.vschema,null,2));else log.success(`Wrote ${result.path} (${result.tableCount} tables)`)});buddy.command("generate:erd-diagram","Derive an entity-relationship diagram from your models (writes docs/erd.md)").alias("generate:erd").option("--dry-run","Print the diagram without writing it",{default:false}).option("--out [path]","Where to write the diagram; a .md target gets a fenced mermaid block",{default:"docs/erd.md"}).option("--no-columns","Relationships only, without the column lists",{default:true}).option("--only [tables]","Comma-separated tables or model names to include",{default:""}).action(async(options)=>{const{generateErd}=await import("@stacksjs/actions");const only=(options.only??"").split(",").map((entry)=>entry.trim()).filter(Boolean);const result=await generateErd({dryRun:options.dryRun,out:options.out,noColumns:options.columns===false,only});if(!result.ok){console.error(`
|
|
4
4
|
❌ ${result.error}
|
|
5
|
-
`);process.exit(ExitCode.FatalError)}if(options.dryRun){console.log(result.diagram);return}log.success(`Wrote ${result.path} (${result.modelCount} models)`);if(result.skipped.length>0)log.warn(`${result.skipped.length} model(s) could not be read and are missing from the diagram`)});buddy.command("generate:entries",descriptions.entries).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:entries` ...",options);await generateLibEntries(options)});buddy.command("generate:web-types",descriptions.webTypes).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:web-types` ...",options);await generateWebTypes()});buddy.command("generate:vscode-custom-data",descriptions.customData).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:vscode-custom-data` ...",options);await generateVsCodeCustomData()});buddy.command("generate:ide-helpers",descriptions.ideHelpers).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:ide-helpers` ...",options);await generateIdeHelpers()});buddy.command("generate:component-meta",descriptions.componentMeta).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:component-meta` ...",options);await generateComponentMeta()});buddy.command("generate:pantry-config",descriptions.pantry).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:pantry-config` ...",options);await generatePantryConfig()});buddy.command("generate:openapi-spec",descriptions.openApi).alias("generate:openapi").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:openapi-spec` ...",options);const perf=await intro("buddy generate:openapi-spec");await generateOpenApiSpec();await outro("Generated OpenAPI specification",{startTime:perf,useSeconds:true})});buddy.command("generate:migrations","Generate Migrations").option("--dialect <dialect>","Generate into this dialect's corpus instead of the connected one (sqlite, mysql, singlestore, vitess, postgres), or `all` for the connected dialect and every other one that keeps a corpus. No database of that dialect is needed").action(async(options)=>{log.debug("Running `buddy generate:migrations` ...",options);const{dialectsBehindModels,generateMigrations,siblingMigrationDialects}=await import("@stacksjs/database");const targets=options.dialect==="all"?[undefined,...await siblingMigrationDialects()]:[options.dialect];for(const dialect of targets){const result=await generateMigrations(dialect?{dialect}:{});if(resultFailed(result))reportFailure(result,"generateMigrations failed")}if(!options.dialect){for(const dialect of await dialectsBehindModels())log.warn(`The ${dialect} migrations are behind these models. Run \`./buddy generate:migrations --dialect ${dialect}\` (or \`--dialect all\`) and commit the result.`)}});buddy.command("generate:auto-imports","Regenerate the auto-import barrels and name registries in storage/framework/auto-imports").action(async(options)=>{log.debug("Running `buddy generate:auto-imports` ...",options);const perf=await intro("buddy generate:auto-imports");const{generateAutoImportFiles}=await import("@stacksjs/server");await generateAutoImportFiles();await outro("Regenerated storage/framework/auto-imports",{startTime:perf,useSeconds:true})});buddy.command("generate:core-symlink","Symlink `.framework` -> storage/framework. A shortcut for core developers.").action(async(options)=>{log.debug("Running `buddy generate:core-symlink` ...",options);await generateCoreSymlink()});buddy.command("generate:images",descriptions.images).alias("images:generate").option("--social","Only build the social cards").option("--app-store","Only build the App Store screenshots").option("--app-icons","Only build the app icons and favicons").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:images` ...",options);const perf=await intro("buddy generate:images");const only=[];if(options.social)only.push("social");if(options.appStore)only.push("app-store");if(options.appIcons)only.push("app-icons");await generateProjectImages({only,verbose:options.verbose});await outro("Generated images",{startTime:perf,useSeconds:true})});buddy.command("generate:og",descriptions.og).alias("generate:social").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:og` ...",options);const perf=await intro("buddy generate:og");await generateProjectImages({only:["social"],verbose:options.verbose});await outro("Generated social cards",{startTime:perf,useSeconds:true})});buddy.command("generate:app-store",descriptions.appStore).alias("generate:screenshots").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:app-store` ...",options);const perf=await intro("buddy generate:app-store");await generateProjectImages({only:["app-store"],verbose:options.verbose});await outro("Generated App Store screenshots",{startTime:perf,useSeconds:true})});buddy.command("generate:app-icons",descriptions.appIcons).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:app-icons` ...",options);const perf=await intro("buddy generate:app-icons");await generateProjectImages({only:["app-icons"],verbose:options.verbose});await outro("Generated app icons",{startTime:perf,useSeconds:true})});onUnknownSubcommand(buddy,"generate")}
|
|
5
|
+
`);process.exit(ExitCode.FatalError)}if(options.dryRun){console.log(result.diagram);return}log.success(`Wrote ${result.path} (${result.modelCount} models)`);if(result.skipped.length>0)log.warn(`${result.skipped.length} model(s) could not be read and are missing from the diagram`)});buddy.command("generate:entries",descriptions.entries).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:entries` ...",options);await generateLibEntries(options)});buddy.command("generate:web-types",descriptions.webTypes).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:web-types` ...",options);await generateWebTypes()});buddy.command("generate:vscode-custom-data",descriptions.customData).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:vscode-custom-data` ...",options);await generateVsCodeCustomData()});buddy.command("generate:ide-helpers",descriptions.ideHelpers).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:ide-helpers` ...",options);await generateIdeHelpers()});buddy.command("generate:component-meta",descriptions.componentMeta).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:component-meta` ...",options);await generateComponentMeta()});buddy.command("generate:pantry-config",descriptions.pantry).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:pantry-config` ...",options);await generatePantryConfig()});buddy.command("generate:openapi-spec",descriptions.openApi).alias("generate:openapi").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:openapi-spec` ...",options);const perf=await intro("buddy generate:openapi-spec");await generateOpenApiSpec();await outro("Generated OpenAPI specification",{startTime:perf,useSeconds:true})});buddy.command("generate:migrations","Generate Migrations").option("--dialect <dialect>","Generate into this dialect's corpus instead of the connected one (sqlite, mysql, singlestore, vitess, postgres), or `all` for the connected dialect and every other one that keeps a corpus. No database of that dialect is needed").action(async(options)=>{log.debug("Running `buddy generate:migrations` ...",options);const{dialectsBehindModels,generateMigrations,siblingMigrationDialects}=await import("@stacksjs/database");const targets=options.dialect==="all"?[undefined,...await siblingMigrationDialects()]:[options.dialect];for(const dialect of targets){const result=await generateMigrations(dialect?{dialect}:{});if(resultFailed(result))reportFailure(result,"generateMigrations failed")}if(!options.dialect){for(const dialect of await dialectsBehindModels())log.warn(`The ${dialect} migrations are behind these models. Run \`./buddy generate:migrations --dialect ${dialect}\` (or \`--dialect all\`) and commit the result.`)}});buddy.command("generate:auto-imports","Regenerate the auto-import barrels and name registries in storage/framework/auto-imports").action(async(options)=>{log.debug("Running `buddy generate:auto-imports` ...",options);const perf=await intro("buddy generate:auto-imports");const{generateAutoImportFiles}=await import("@stacksjs/server");await generateAutoImportFiles();await outro("Regenerated storage/framework/auto-imports",{startTime:perf,useSeconds:true})});buddy.command("generate:project","Refresh the generated files enabled in config/buddy.json").option("--tasks <tasks>","Comma-separated generators to run: imports,migrations,types",{default:"imports,migrations,types"}).action(async(options)=>{const{generateProject}=await import("../project-generation");try{await generateProject(projectPath(),options.tasks)}catch(error){reportFailure({error})}});buddy.command("generate:core-symlink","Symlink `.framework` -> storage/framework. A shortcut for core developers.").action(async(options)=>{log.debug("Running `buddy generate:core-symlink` ...",options);await generateCoreSymlink()});buddy.command("generate:images",descriptions.images).alias("images:generate").option("--social","Only build the social cards").option("--app-store","Only build the App Store screenshots").option("--app-icons","Only build the app icons and favicons").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:images` ...",options);const perf=await intro("buddy generate:images");const only=[];if(options.social)only.push("social");if(options.appStore)only.push("app-store");if(options.appIcons)only.push("app-icons");await generateProjectImages({only,verbose:options.verbose});await outro("Generated images",{startTime:perf,useSeconds:true})});buddy.command("generate:og",descriptions.og).alias("generate:social").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:og` ...",options);const perf=await intro("buddy generate:og");await generateProjectImages({only:["social"],verbose:options.verbose});await outro("Generated social cards",{startTime:perf,useSeconds:true})});buddy.command("generate:app-store",descriptions.appStore).alias("generate:screenshots").option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:app-store` ...",options);const perf=await intro("buddy generate:app-store");await generateProjectImages({only:["app-store"],verbose:options.verbose});await outro("Generated App Store screenshots",{startTime:perf,useSeconds:true})});buddy.command("generate:app-icons",descriptions.appIcons).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy generate:app-icons` ...",options);const perf=await intro("buddy generate:app-icons");await generateProjectImages({only:["app-icons"],verbose:options.verbose});await outro("Generated app icons",{startTime:perf,useSeconds:true})});onUnknownSubcommand(buddy,"generate")}
|
package/dist/commands/make.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{createFactory,createMiddleware,createMigration,createModel,createNotification,createPage,invoke,makeAction,makeCertificate,makeCommand,makeComponent,makeDatabase,makeFunction,makeJob,makeLanguage,makeMail,makePage,makePolicy,makeQueueTable,makeResource,makeStack,setDryRun}from"@stacksjs/actions";import{intro,italic,onUnknownSubcommand,outro}from"@stacksjs/cli";import{log}from"@stacksjs/logging";import{ExitCode}from"@stacksjs/types";export function make(buddy){const descriptions={action:"Create a new action",command:"Create a new CLI command",model:"Create a new model",middleware:"Create a new middleware",component:"Create a new component",page:"Create a new page",function:"Create a new function",job:"Create a new job",language:"Create a new language",database:"Create a new database",migration:"Create a new migration",factory:"Create a new factory",notification:"Create a new notification",mail:"Create a new Mailable + companion stx template",policy:"Create a new authorization policy",resource:"Create a new API resource",name:"The name of the action",queue:"Make queue migration",queueTable:"Create the queue jobs table migration",stack:"Create a new stack",certificate:"Create a new SSL Certificate",select:"What are you trying to make?",project:"Target a specific project",verbose:"Enable verbose output"};buddy.command("make [make]","The make command").option("-a, --action [action]",descriptions.action,{default:false}).option("-c, --component [component]",descriptions.component,{default:false}).option("-d, --database [database]",descriptions.database,{default:false}).option("-f, --factory [factory]",descriptions.factory,{default:false}).option("-fn, --function [function]",descriptions.function,{default:false}).option("-l, --language [language]",descriptions.language,{default:false}).option("-m, --model [model]",descriptions.model,{default:false}).option("-mw, --middleware [middleware]",descriptions.middleware,{default:false}).option("-p, --page [page]",descriptions.page,{default:false}).option("-mg, --migration [migration]",descriptions.migration,{default:false}).option("-n, --notification [notification]",descriptions.notification,{default:false}).option("-qt, --queue-table",descriptions.queue,{default:false}).option("-s, --stack [stack]",descriptions.stack,{default:false}).option("--dry-run","Preview the files that would be generated without writing",{default:false}).option("--with-validation","Include a validation rules block in the generated stub",{default:false}).option("--with-auth","Include auth-aware boilerplate in the generated stub",{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(make,options)=>{log.debug("Running `buddy make` ...",options);const name=buddy.args[0];if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}setDryRun(Boolean(options.dryRun||options["dry-run"]));if(make){options.name=buddy.args[1]??make;switch(make){case"action":await makeAction(options);break;case"certificate":await makeCertificate();break;case"command":await makeCommand(options);break;case"component":await makeComponent(options);break;case"database":makeDatabase(options);break;case"function":await makeFunction(options);break;case"job":await makeJob(options);break;case"language":await makeLanguage(options);break;case"mail":await makeMail(options);break;case"migration":await createMigration(options);break;case"middleware":await createMiddleware(options);break;case"model":await createModel(options);break;case"page":await createPage(options);break;case"notification":await createNotification(options);break;case"policy":await makePolicy({name:options.name,model:typeof options.model==="string"?options.model:undefined,register:options.register});break;case"resource":await makeResource({name:options.name,model:typeof options.model==="string"?options.model:undefined});break;case"queue-table":await makeQueueTable();break;case"stack":await makeStack(options);break;case"factory":await createFactory(options);break;default:{console.error(`Unknown make subcommand: ${make}`);console.error("Valid subcommands: action, certificate, command, component, database, factory, function, job, language, mail, middleware, migration, model, notification, page, policy, queue-table, resource, stack");process.exit(ExitCode.InvalidArgument)}}}await invoke(options);process.exit(ExitCode.Success)});buddy.command("make:action [name]",descriptions.action).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--dry-run","Preview the file without writing",{default:false}).option("--with-validation","Generate a stub that calls validate()",{default:false}).option("--with-auth","Generate a stub that requires an authenticated user",{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.info("Running `buddy make:action` ...");log.debug("Running `buddy make:action` ...",name,options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");await log.flush();process.exit(ExitCode.FatalError)}setDryRun(Boolean(options.dryRun||options["dry-run"]));await makeAction(options)});buddy.command("make:certificate",descriptions.certificate).alias("make:cert").example("buddy make:certificate").action(async(options)=>{log.debug("Running `buddy make:certificate` ...",options);await makeCertificate()});buddy.command("scaffold:crud [name]","Generate model, migration, and CRUD actions").alias("make:crud").alias("make:scaffold").option("-n, --name [name]","Resource name (PascalCase)",{default:false}).option("-f, --fields [fields]","Comma-separated field list, e.g. title:string,body:text,published:boolean",{default:""}).option("--dry-run","Preview the generated files without writing",{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy scaffold:crud Post --fields=title:string,body:text,published:boolean").action(async(name,options)=>{name=name??options.name;if(!name){console.error("scaffold:crud requires a resource name. Example: buddy scaffold:crud Post --fields=title:string,body:text");process.exit(ExitCode.FatalError)}const{scaffoldCrud}=await import("@stacksjs/actions");setDryRun(Boolean(options.dryRun||options["dry-run"]));try{await scaffoldCrud(name,options)}catch(err){console.error("scaffold:crud failed:",err);process.exit(ExitCode.FatalError)}});buddy.command("make:command [name]",descriptions.command).option("-n, --name [name]",descriptions.name,{default:false}).option("-s, --signature [signature]","The command signature (CLI name)",{default:false}).option("-d, --description [description]","The command description",{default:false}).option("--register","Also add an entry to app/Commands.ts (optional - commands are auto-discovered)",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:command SendEmails").example("buddy make:command SendEmails --signature=send-emails").action(async(name,options)=>{log.debug("Running `buddy make:command` ...",options);const perf=await intro("buddy make:command");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a command name.");console.error("Example: buddy make:command SendEmails");process.exit(ExitCode.FatalError)}const result=await makeCommand(options);if(!result){await outro("While running the make:command command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} command.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:component [name]",descriptions.component).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:component` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeComponent(options)});buddy.command("make:database [name]",descriptions.database).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action((name,options)=>{log.debug("Running `buddy make:database` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a database name via the `--name` option, or as the command’s argument.");console.error("Example: `buddy make:database my-cool-database`");console.error("Or: `buddy make:database --name=my-cool-database`");console.error("Read more about the documentation here: https://stacksjs.com/docs/make/database");process.exit(ExitCode.FatalError)}makeDatabase(options)});buddy.command("make:factory [name]",descriptions.factory).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:factory` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await createFactory(options)});buddy.command("make:function [name]",descriptions.function).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:function` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeFunction(options)});buddy.command("make:lang [name]",descriptions.language).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:lang` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeLanguage(options)});buddy.command("make:migration [name]",descriptions.migration).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:migration` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a migration name");process.exit(ExitCode.FatalError)}await createMigration(options)});buddy.command("make:model [name]",descriptions.model).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:model` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a model name");process.exit(ExitCode.FatalError)}await createModel(options)});buddy.command("make:mail [name]",descriptions.mail).option("-n, --name [name]",descriptions.name,{default:false}).option("-f, --force","Overwrite existing files",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:mail OrderShipped").example("buddy make:mail welcome-back // PascalCases to WelcomeBack, kebab-cases to welcome-back").example("buddy make:mail Welcome --force // overwrite existing files").action(async(name,options)=>{log.debug("Running `buddy make:mail` ...",options);const perf=await intro("buddy make:mail");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name (e.g. `buddy make:mail OrderShipped`).");process.exit(ExitCode.FatalError)}await makeMail(options);await outro(`Created your ${italic(name)} mailable.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:notification [name]",descriptions.notification).option("-n, --name [name]",descriptions.name,{default:false}).option("-e, --email","Is it an email notification?",{default:true}).option("-c, --chat","Is it a chat notification?",{default:false}).option("-s, --sms","Is it a SMS notification?",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:notification` ...",options);const perf=await intro("buddy make:notification");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}const result=await createNotification(options);if(!result){await outro("While running the make:notification command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} notification.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:policy [name]",descriptions.policy).option("-n, --name [name]",descriptions.name,{default:false}).option("-m, --model [model]","The model this policy is for",{default:false}).option("--no-register","Do not register in Gates.ts").option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:policy PostPolicy").example("buddy make:policy CommentPolicy --model=Comment").action(async(name,options)=>{log.debug("Running `buddy make:policy` ...",options);const perf=await intro("buddy make:policy");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a policy name.");console.error("Example: buddy make:policy PostPolicy");process.exit(ExitCode.FatalError)}const result=await makePolicy(options);if(!result){await outro("While running the make:policy command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} policy.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:resource [name]",descriptions.resource).option("-n, --name [name]",descriptions.name,{default:false}).option("-m, --model [model]","The model this resource is for",{default:false}).option("-c, --collection","Create a collection resource",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:resource UserResource").example("buddy make:resource PostResource --model=Post").example("buddy make:resource PostCollection --collection").action(async(name,options)=>{log.debug("Running `buddy make:resource` ...",options);const perf=await intro("buddy make:resource");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a resource name.");console.error("Example: buddy make:resource UserResource");process.exit(ExitCode.FatalError)}const result=await makeResource(options);if(!result){await outro("While running the make:resource command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} resource.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:queue-table",descriptions.queueTable).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy make queue:table` ...",options);await makeQueueTable()});buddy.command("make:stack [name]",descriptions.stack).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:stack` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeStack(options)});buddy.command("make:view [name]",descriptions.page).alias("make:page [name]").option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:view` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makePage(options)});buddy.command("make:middleware [name]",descriptions.middleware).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:middleware` ...",options);const perf=await intro("buddy make:middleware");name=name??options.name;options.name=name;if(!name){await outro("A middleware name is required (e.g. `buddy make:middleware EnsureSubscribed`).",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await createMiddleware(options);await outro(`Created your ${italic(name)} middleware.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:page [name]",descriptions.page).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:page` ...",options);const perf=await intro("buddy make:page");name=name??options.name;options.name=name;if(!name){await outro("A page name is required (e.g. `buddy make:page Pricing`).",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await createPage(options);await outro(`Created your ${italic(name)} page.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:job [name]",descriptions.job).option("-n, --name [name]",descriptions.name,{default:false}).option("-q, --queue [queue]","The queue to dispatch to",{default:"default"}).option("-c, --class","Create a class-based job",{default:false}).option("-t, --tries [tries]","Number of retry attempts",{default:3}).option("-b, --backoff [backoff]","Backoff delay in seconds",{default:3}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:job` ...",options);const perf=await intro("buddy make:job");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a job name.");console.error("Example: buddy make:job SendWelcomeEmail");process.exit(ExitCode.FatalError)}const result=await makeJob(options);if(!result){await outro("While running the make:job command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} job.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"make")}
|
|
1
|
+
import process from"node:process";import{createFactory,createMiddleware,createMigration,createModel,createNotification,createPage,invoke,makeAction,makeCertificate,makeCommand,makeComponent,makeDatabase,makeFunction,makeJob,makeLanguage,makeMail,makePage,makePolicy,makeQueueTable,makeResource,makeStack,setDryRun}from"@stacksjs/actions";import{intro,italic,onUnknownSubcommand,outro}from"@stacksjs/cli";import{log}from"@stacksjs/logging";import{path}from"@stacksjs/path";import{ExitCode}from"@stacksjs/types";import{makeAuth}from"../make-auth";export function make(buddy){const descriptions={action:"Create a new action",command:"Create a new CLI command",model:"Create a new model",middleware:"Create a new middleware",component:"Create a new component",page:"Create a new page",function:"Create a new function",job:"Create a new job",language:"Create a new language",database:"Create a new database",migration:"Create a new migration",factory:"Create a new factory",notification:"Create a new notification",mail:"Create a new Mailable + companion stx template",auth:"Copy the sign-in pages and actions into your app so you can change them",policy:"Create a new authorization policy",resource:"Create a new API resource",name:"The name of the action",queue:"Make queue migration",queueTable:"Create the queue jobs table migration",stack:"Create a new stack",certificate:"Create a new SSL Certificate",select:"What are you trying to make?",project:"Target a specific project",verbose:"Enable verbose output"};buddy.command("make [make]","The make command").option("-a, --action [action]",descriptions.action,{default:false}).option("-c, --component [component]",descriptions.component,{default:false}).option("-d, --database [database]",descriptions.database,{default:false}).option("-f, --factory [factory]",descriptions.factory,{default:false}).option("-fn, --function [function]",descriptions.function,{default:false}).option("-l, --language [language]",descriptions.language,{default:false}).option("-m, --model [model]",descriptions.model,{default:false}).option("-mw, --middleware [middleware]",descriptions.middleware,{default:false}).option("-p, --page [page]",descriptions.page,{default:false}).option("-mg, --migration [migration]",descriptions.migration,{default:false}).option("-n, --notification [notification]",descriptions.notification,{default:false}).option("-qt, --queue-table",descriptions.queue,{default:false}).option("-s, --stack [stack]",descriptions.stack,{default:false}).option("--dry-run","Preview the files that would be generated without writing",{default:false}).option("--with-validation","Include a validation rules block in the generated stub",{default:false}).option("--with-auth","Include auth-aware boilerplate in the generated stub",{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(make,options)=>{log.debug("Running `buddy make` ...",options);const name=buddy.args[0];if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}setDryRun(Boolean(options.dryRun||options["dry-run"]));if(make){options.name=buddy.args[1]??make;switch(make){case"action":await makeAction(options);break;case"certificate":await makeCertificate();break;case"command":await makeCommand(options);break;case"component":await makeComponent(options);break;case"database":makeDatabase(options);break;case"function":await makeFunction(options);break;case"job":await makeJob(options);break;case"language":await makeLanguage(options);break;case"mail":await makeMail(options);break;case"migration":await createMigration(options);break;case"middleware":await createMiddleware(options);break;case"model":await createModel(options);break;case"page":await createPage(options);break;case"notification":await createNotification(options);break;case"policy":await makePolicy({name:options.name,model:typeof options.model==="string"?options.model:undefined,register:options.register});break;case"resource":await makeResource({name:options.name,model:typeof options.model==="string"?options.model:undefined});break;case"queue-table":await makeQueueTable();break;case"stack":await makeStack(options);break;case"factory":await createFactory(options);break;default:{console.error(`Unknown make subcommand: ${make}`);console.error("Valid subcommands: action, certificate, command, component, database, factory, function, job, language, mail, middleware, migration, model, notification, page, policy, queue-table, resource, stack");process.exit(ExitCode.InvalidArgument)}}}await invoke(options);process.exit(ExitCode.Success)});buddy.command("make:action [name]",descriptions.action).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--dry-run","Preview the file without writing",{default:false}).option("--with-validation","Generate a stub that calls validate()",{default:false}).option("--with-auth","Generate a stub that requires an authenticated user",{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.info("Running `buddy make:action` ...");log.debug("Running `buddy make:action` ...",name,options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");await log.flush();process.exit(ExitCode.FatalError)}setDryRun(Boolean(options.dryRun||options["dry-run"]));await makeAction(options)});buddy.command("make:certificate",descriptions.certificate).alias("make:cert").example("buddy make:certificate").action(async(options)=>{log.debug("Running `buddy make:certificate` ...",options);await makeCertificate()});buddy.command("scaffold:crud [name]","Generate model, migration, and CRUD actions").alias("make:crud").alias("make:scaffold").option("-n, --name [name]","Resource name (PascalCase)",{default:false}).option("-f, --fields [fields]","Comma-separated field list, e.g. title:string,body:text,published:boolean",{default:""}).option("--dry-run","Preview the generated files without writing",{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy scaffold:crud Post --fields=title:string,body:text,published:boolean").action(async(name,options)=>{name=name??options.name;if(!name){console.error("scaffold:crud requires a resource name. Example: buddy scaffold:crud Post --fields=title:string,body:text");process.exit(ExitCode.FatalError)}const{scaffoldCrud}=await import("@stacksjs/actions");setDryRun(Boolean(options.dryRun||options["dry-run"]));try{await scaffoldCrud(name,options)}catch(err){console.error("scaffold:crud failed:",err);process.exit(ExitCode.FatalError)}});buddy.command("make:command [name]",descriptions.command).option("-n, --name [name]",descriptions.name,{default:false}).option("-s, --signature [signature]","The command signature (CLI name)",{default:false}).option("-d, --description [description]","The command description",{default:false}).option("--register","Also add an entry to app/Commands.ts (optional - commands are auto-discovered)",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:command SendEmails").example("buddy make:command SendEmails --signature=send-emails").action(async(name,options)=>{log.debug("Running `buddy make:command` ...",options);const perf=await intro("buddy make:command");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a command name.");console.error("Example: buddy make:command SendEmails");process.exit(ExitCode.FatalError)}const result=await makeCommand(options);if(!result){await outro("While running the make:command command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} command.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:component [name]",descriptions.component).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:component` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeComponent(options)});buddy.command("make:database [name]",descriptions.database).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action((name,options)=>{log.debug("Running `buddy make:database` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a database name via the `--name` option, or as the command’s argument.");console.error("Example: `buddy make:database my-cool-database`");console.error("Or: `buddy make:database --name=my-cool-database`");console.error("Read more about the documentation here: https://stacksjs.com/docs/make/database");process.exit(ExitCode.FatalError)}makeDatabase(options)});buddy.command("make:factory [name]",descriptions.factory).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:factory` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await createFactory(options)});buddy.command("make:function [name]",descriptions.function).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:function` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeFunction(options)});buddy.command("make:lang [name]",descriptions.language).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:lang` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeLanguage(options)});buddy.command("make:migration [name]",descriptions.migration).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:migration` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a migration name");process.exit(ExitCode.FatalError)}await createMigration(options)});buddy.command("make:model [name]",descriptions.model).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:model` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a model name");process.exit(ExitCode.FatalError)}await createModel(options)});buddy.command("make:auth",descriptions.auth).option("--api","Copy the actions only, for an app with its own front end",{default:false}).option("-f, --force","Overwrite the copies your app already has",{default:false}).option("--dry-run","List the files it would copy, and copy nothing",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:auth").example("buddy make:auth --api // actions only, no pages").action(async(options)=>{log.debug("Running `buddy make:auth` ...",options);const dryRun=options.dryRun===true;const result=await makeAuth({projectRoot:path.projectPath(),defaultsRoot:path.frameworkPath("defaults"),api:options.api===true,force:options.force===true,dryRun});if(result.written.length>0){console.log(dryRun?`Would copy ${result.written.length} files into your app:`:`✓ Copied ${result.written.length} files into your app:`);for(const file of result.written)console.log(` ${file}`);for(const file of result.carried)console.log(` ${file} (imported by them)`)}if(result.kept.length>0){console.log(`Kept ${result.kept.length} files your app already has (--force overwrites them):`);for(const file of result.kept)console.log(` ${file}`)}if(result.missing.length>0){console.log(`This version of the framework does not ship ${result.missing.length} of them:`);for(const file of result.missing)console.log(` ${file}`)}if(dryRun){console.log(" Dry run: nothing was written.");process.exit(ExitCode.Success)}if(result.written.length>0){const{generateAutoImportFiles}=await import("@stacksjs/server");await generateAutoImportFiles();console.log(" The auth routes now run these copies. `buddy upgrade` no longer updates them.")}console.log("");console.log("Next:");console.log(" ./buddy migrate creates the users, password reset and token tables if they are missing");console.log(" ./buddy dev then open /login");process.exit(ExitCode.Success)});buddy.command("make:mail [name]",descriptions.mail).option("-n, --name [name]",descriptions.name,{default:false}).option("-f, --force","Overwrite existing files",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:mail OrderShipped").example("buddy make:mail welcome-back // PascalCases to WelcomeBack, kebab-cases to welcome-back").example("buddy make:mail Welcome --force // overwrite existing files").action(async(name,options)=>{log.debug("Running `buddy make:mail` ...",options);const perf=await intro("buddy make:mail");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name (e.g. `buddy make:mail OrderShipped`).");process.exit(ExitCode.FatalError)}await makeMail(options);await outro(`Created your ${italic(name)} mailable.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:notification [name]",descriptions.notification).option("-n, --name [name]",descriptions.name,{default:false}).option("-e, --email","Is it an email notification?",{default:true}).option("-c, --chat","Is it a chat notification?",{default:false}).option("-s, --sms","Is it a SMS notification?",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:notification` ...",options);const perf=await intro("buddy make:notification");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}const result=await createNotification(options);if(!result){await outro("While running the make:notification command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} notification.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:policy [name]",descriptions.policy).option("-n, --name [name]",descriptions.name,{default:false}).option("-m, --model [model]","The model this policy is for",{default:false}).option("--no-register","Do not register in Gates.ts").option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:policy PostPolicy").example("buddy make:policy CommentPolicy --model=Comment").action(async(name,options)=>{log.debug("Running `buddy make:policy` ...",options);const perf=await intro("buddy make:policy");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a policy name.");console.error("Example: buddy make:policy PostPolicy");process.exit(ExitCode.FatalError)}const result=await makePolicy(options);if(!result){await outro("While running the make:policy command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} policy.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:resource [name]",descriptions.resource).option("-n, --name [name]",descriptions.name,{default:false}).option("-m, --model [model]","The model this resource is for",{default:false}).option("-c, --collection","Create a collection resource",{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy make:resource UserResource").example("buddy make:resource PostResource --model=Post").example("buddy make:resource PostCollection --collection").action(async(name,options)=>{log.debug("Running `buddy make:resource` ...",options);const perf=await intro("buddy make:resource");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a resource name.");console.error("Example: buddy make:resource UserResource");process.exit(ExitCode.FatalError)}const result=await makeResource(options);if(!result){await outro("While running the make:resource command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} resource.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:queue-table",descriptions.queueTable).option("--verbose",descriptions.verbose,{default:false}).action(async(options)=>{log.debug("Running `buddy make queue:table` ...",options);await makeQueueTable()});buddy.command("make:stack [name]",descriptions.stack).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:stack` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makeStack(options)});buddy.command("make:view [name]",descriptions.page).alias("make:page [name]").option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:view` ...",options);name=name??options.name;options.name=name;if(!name){console.error("You need to specify a name. Read more about the documentation here.");process.exit(ExitCode.FatalError)}await makePage(options)});buddy.command("make:middleware [name]",descriptions.middleware).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:middleware` ...",options);const perf=await intro("buddy make:middleware");name=name??options.name;options.name=name;if(!name){await outro("A middleware name is required (e.g. `buddy make:middleware EnsureSubscribed`).",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await createMiddleware(options);await outro(`Created your ${italic(name)} middleware.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:page [name]",descriptions.page).option("-n, --name [name]",descriptions.name,{default:false}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:page` ...",options);const perf=await intro("buddy make:page");name=name??options.name;options.name=name;if(!name){await outro("A page name is required (e.g. `buddy make:page Pricing`).",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await createPage(options);await outro(`Created your ${italic(name)} page.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});buddy.command("make:job [name]",descriptions.job).option("-n, --name [name]",descriptions.name,{default:false}).option("-q, --queue [queue]","The queue to dispatch to",{default:"default"}).option("-c, --class","Create a class-based job",{default:false}).option("-t, --tries [tries]","Number of retry attempts",{default:3}).option("-b, --backoff [backoff]","Backoff delay in seconds",{default:3}).option("-p, --project [project]",descriptions.project,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{log.debug("Running `buddy make:job` ...",options);const perf=await intro("buddy make:job");name=name??options.name;options.name=name;if(!name){console.error("You need to specify a job name.");console.error("Example: buddy make:job SendWelcomeEmail");process.exit(ExitCode.FatalError)}const result=await makeJob(options);if(!result){await outro("While running the make:job command, there was an issue",{startTime:perf,useSeconds:true,type:"error"});process.exit(ExitCode.FatalError)}await outro(`Created your ${italic(name)} job.`,{startTime:perf,useSeconds:true});process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"make")}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type { CLI } from '@stacksjs/types';
|
|
2
2
|
export declare function publish(buddy: CLI): void;
|
|
3
|
+
/**
|
|
4
|
+
* Where the app's copy of a default goes.
|
|
5
|
+
*
|
|
6
|
+
* An action is addressed by its path: the default routes name
|
|
7
|
+
* `Actions/Auth/LoginAction`, and the router reads
|
|
8
|
+
* `app/Actions/Auth/LoginAction.ts` before the default. So its copy keeps the
|
|
9
|
+
* folders it sits in under the defaults tree. `publish:action LoginAction`
|
|
10
|
+
* used to write `app/Actions/LoginAction.ts`, a file no route reaches, so
|
|
11
|
+
* edits to it did nothing and nothing said so.
|
|
12
|
+
*
|
|
13
|
+
* Models, controllers and middleware keep the flat layout they have always
|
|
14
|
+
* been published to.
|
|
15
|
+
*/
|
|
16
|
+
export declare function publishedPath(kind: PublishContext['kind'], defaultsDir: string, userDir: string, sourcePath: string, fileName: string): string;
|
|
3
17
|
/**
|
|
4
18
|
* Copy the modules a published file imports by relative path.
|
|
5
19
|
*
|
|
@@ -19,7 +33,7 @@ export declare function publish(buddy: CLI): void;
|
|
|
19
33
|
* Recurses, so a dependency's own siblings come too, and refuses to write
|
|
20
34
|
* outside the project root.
|
|
21
35
|
*/
|
|
22
|
-
export declare function carryRelativeImports(sourcePath: string, targetPath: string, seen?: unknown): Promise<string[]>;
|
|
36
|
+
export declare function carryRelativeImports(sourcePath: string, targetPath: string, seen?: unknown, projectRoot?: string): Promise<string[]>;
|
|
23
37
|
/*` export maps the specifier onto its build
|
|
24
38
|
* output. The names come back because a preloaded specifier has to be a DIRECT
|
|
25
39
|
* dependency of the app - see the caller (stacksjs/stacks#2433 neighbours).
|
|
@@ -43,3 +57,11 @@ export declare function carryRelativeImports(sourcePath: string, targetPath: str
|
|
|
43
57
|
*/
|
|
44
58
|
export declare function packagesPreloadFilesFallBackTo(source: string): Set<string>;
|
|
45
59
|
export declare function rewriteBunfigPreloads(bunfig: string): { next: string, packages: Set<string>, rewritten: number };
|
|
60
|
+
declare interface PublishContext {
|
|
61
|
+
kind: 'model' | 'controller' | 'middleware' | 'action'
|
|
62
|
+
name: string
|
|
63
|
+
defaultsDir: string
|
|
64
|
+
userDir: string
|
|
65
|
+
force: boolean
|
|
66
|
+
}
|
|
67
|
+
export {};
|
package/dist/commands/publish.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{existsSync,lstatSync,mkdirSync,realpathSync,unlinkSync}from"node:fs";import{cp,readdir,stat}from"node:fs/promises";import{homedir}from"node:os";import{dirname,join,resolve}from"node:path";import process from"node:process";import{italic,log,onUnknownSubcommand}from"@stacksjs/cli";import{syncPackageProjectFiles,vendorDefaultsTree}from"@stacksjs/actions/upgrade/package-project";import{installedDefaultsVersion,linkPackagedDefaults,packagedDefaultsRoot,path,usesVendoredDefaults}from"@stacksjs/path";import{fs,globSync}from"@stacksjs/storage";import{pruneVendoredCoreFromWorkflows,splitFrameworkTypecheckScript}from"../workflow-prune";import{chooseInstaller,findCoreReferences,INSTALL_RETRY_DELAYS_MS,installWithRetry,isDanglingLink,isUnvendorInstaller,rewriteCoreCommandPaths,rewriteCoreSourceImports,rewriteSurvivingFrameworkManifests,UNVENDOR_INSTALLERS}from"../unvendor-rewrite";import{fetchPublishedVersions}from"../registry";import{locateDefaultStx,pointImportsAtDefaults}from"../publish-stx";import{adoptPackagedDefaults,unignoreDefaults,VENDORED_DEFAULTS}from"../scaffold-package-app";import{ExitCode}from"@stacksjs/types";export function publish(buddy){const descriptions={command:"Publish a Stacks default into your userland (app/) directory so you can customize it",model:"Publish a default model from storage/framework/defaults/app/Models/ to app/Models/",controller:"Publish a default controller from storage/framework/defaults/app/Controllers/ to app/Controllers/",middleware:"Publish a default middleware from storage/framework/defaults/app/Middleware/ to app/Middleware/",action:"Publish a default action from storage/framework/defaults/app/Actions/ to app/Actions/",component:"Publish a default component to the same path under resources/components/, by name or by its path there",view:"Publish a default view to resources/views/<path>, e.g. dashboard/commerce/orders or login",core:"Publish a framework package source from node_modules/@stacksjs/<pkg>/ into storage/framework/core/<pkg>/ for editing",unpublishCore:"Drop a vendored storage/framework/core/<pkg>/ and go back to the installed @stacksjs/<pkg>",all:"Unvendor the whole framework: remove storage/framework/core and resolve every @stacksjs package from the `stacks` dependency in package.json",publishAll:"Vendor the whole framework: copy storage/framework/core out of a local Stacks checkout and wire it up as a Bun workspace",frameworkPath:"The Stacks checkout to vendor from (defaults to $STACKS_FRAMEWORK_PATH, ../stacks, then ~/Code/stacks)",coreStatus:"Report whether this project runs on a vendored storage/framework/core or on the published packages",publishDefaults:"Commit a copy of the framework defaults in storage/framework/defaults instead of linking it to node_modules/@stacksjs/defaults",unpublishDefaults:"Drop the vendored storage/framework/defaults and run the installed @stacksjs/defaults through a gitignored link",forceDefaults:"Drop the vendored tree even where it differs from the installed package",name:"The name of the resource to publish (e.g. Cart, User)",pkg:"The name of the framework package (e.g. router, orm, faker - without @stacksjs/ prefix)",force:"Overwrite an existing userland file",forceUnpublish:"Delete the vendored source even when it has uncommitted changes",installer:"Install the published packages with `bun` or `pantry` instead of detecting which one the project uses",verbose:"Enable verbose output"};buddy.command("publish:model <name>",descriptions.model).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"model",name,defaultsDir:path.frameworkPath("defaults/app/Models"),userDir:path.userModelsPath(),force:!!options.force})});buddy.command("publish:controller <name>",descriptions.controller).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"controller",name,defaultsDir:path.frameworkPath("defaults/app/Controllers"),userDir:path.userControllersPath(),force:!!options.force})});buddy.command("publish:middleware <name>",descriptions.middleware).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"middleware",name,defaultsDir:path.frameworkPath("defaults/app/Middleware"),userDir:path.userMiddlewarePath(),force:!!options.force})});buddy.command("publish:action <name>",descriptions.action).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"action",name,defaultsDir:path.frameworkPath("defaults/app/Actions"),userDir:path.userActionsPath(),force:!!options.force})});buddy.command("publish:component <name>",descriptions.component).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:component Pagination").example("buddy publish:component Storefront/ProductCard").action(async(name,options)=>{await publishStx("component",name,!!options.force)});buddy.command("publish:view <path>",descriptions.view).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:view login").example("buddy publish:view dashboard/commerce/orders").action(async(name,options)=>{await publishStx("view",name,!!options.force)});buddy.command("publish:core [pkg]",descriptions.core).option("--all",descriptions.publishAll,{default:false}).option("--path <path>",descriptions.frameworkPath).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:core router").example("buddy publish:core --all").example("buddy publish:core --all --path ../stacks").action(async(pkg,options)=>{if(options.all){await vendorFramework(options.path,!!options.force);return}if(!pkg){await log.error("Usage: buddy publish:core <pkg> (or --all to vendor the whole framework as a workspace)");process.exit(ExitCode.FatalError)}await publishCorePackage(pkg,!!options.force)});buddy.command("core:status",descriptions.coreStatus).alias("publish:core:status").option("--verbose",descriptions.verbose,{default:false}).example("buddy core:status").action(async()=>{await reportCoreStatus()});buddy.command("unpublish:core [pkg]",descriptions.unpublishCore).option("--all",descriptions.all,{default:false}).option("--force",descriptions.forceUnpublish,{default:false}).option("--installer <installer>",descriptions.installer).option("--verbose",descriptions.verbose,{default:false}).action(async(pkg,options)=>{if(options.installer!==undefined&&!isUnvendorInstaller(options.installer)){await log.error(`--installer must be one of ${UNVENDOR_INSTALLERS.join(", ")}, not "${String(options.installer)}".`);process.exit(ExitCode.InvalidArgument)}if(options.all){await unvendorFramework(!!options.force,options.installer);return}if(!pkg){await log.error("Usage: buddy unpublish:core <pkg> (or --all to move the whole framework to node_modules)");process.exit(ExitCode.FatalError)}await unpublishCorePackage(pkg,!!options.force)});buddy.command("publish:defaults",descriptions.publishDefaults).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:defaults").action(async()=>{await vendorDefaults()});buddy.command("unpublish:defaults",descriptions.unpublishDefaults).option("--force",descriptions.forceDefaults,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy unpublish:defaults").action(async(options)=>{await unvendorDefaults(!!options.force)});buddy.command("publish [resource] [name]",descriptions.command).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(resource,name,options)=>{if(!resource||!name){await log.error("Usage: buddy publish:<resource> <Name> (e.g. buddy publish:model Cart)");process.exit(ExitCode.FatalError)}const dispatch={model:()=>publishResource({kind:"model",name,defaultsDir:path.frameworkPath("defaults/app/Models"),userDir:path.userModelsPath(),force:!!options.force}),controller:()=>publishResource({kind:"controller",name,defaultsDir:path.frameworkPath("defaults/app/Controllers"),userDir:path.userControllersPath(),force:!!options.force}),middleware:()=>publishResource({kind:"middleware",name,defaultsDir:path.frameworkPath("defaults/app/Middleware"),userDir:path.userMiddlewarePath(),force:!!options.force}),action:()=>publishResource({kind:"action",name,defaultsDir:path.frameworkPath("defaults/app/Actions"),userDir:path.userActionsPath(),force:!!options.force}),component:()=>publishStx("component",name,!!options.force),view:()=>publishStx("view",name,!!options.force),core:()=>publishCorePackage(name,!!options.force)};const handler=dispatch[resource.toLowerCase()];if(!handler){await log.error(`Unknown publishable resource: ${italic(resource)}`);log.info("Available: model, controller, middleware, action, component, view, core");await log.flush();process.exit(ExitCode.FatalError)}await handler()});onUnknownSubcommand(buddy,"publish")}async function publishCorePackage(pkg,force){const shortName=pkg.replace(/^@stacksjs\//,"").replace(/^core\//,"");const fail=(msg,hint)=>{process.stderr.write(`${msg}
|
|
1
|
+
import{existsSync,lstatSync,mkdirSync,realpathSync,unlinkSync}from"node:fs";import{cp,readdir,stat}from"node:fs/promises";import{homedir}from"node:os";import{dirname,join,relative,resolve}from"node:path";import process from"node:process";import{italic,log,onUnknownSubcommand}from"@stacksjs/cli";import{syncPackageProjectFiles,vendorDefaultsTree}from"@stacksjs/actions/upgrade/package-project";import{installedDefaultsVersion,linkPackagedDefaults,packagedDefaultsRoot,path,usesVendoredDefaults}from"@stacksjs/path";import{fs,globSync}from"@stacksjs/storage";import{pruneVendoredCoreFromWorkflows,splitFrameworkTypecheckScript}from"../workflow-prune";import{chooseInstaller,findCoreReferences,INSTALL_RETRY_DELAYS_MS,installWithRetry,isDanglingLink,isUnvendorInstaller,rewriteCoreCommandPaths,rewriteCoreSourceImports,rewriteSurvivingFrameworkManifests,UNVENDOR_INSTALLERS}from"../unvendor-rewrite";import{fetchPublishedVersions}from"../registry";import{locateDefaultStx,pointImportsAtDefaults}from"../publish-stx";import{adoptPackagedDefaults,unignoreDefaults,VENDORED_DEFAULTS}from"../scaffold-package-app";import{ExitCode}from"@stacksjs/types";export function publish(buddy){const descriptions={command:"Publish a Stacks default into your userland (app/) directory so you can customize it",model:"Publish a default model from storage/framework/defaults/app/Models/ to app/Models/",controller:"Publish a default controller from storage/framework/defaults/app/Controllers/ to app/Controllers/",middleware:"Publish a default middleware from storage/framework/defaults/app/Middleware/ to app/Middleware/",action:"Publish a default action from storage/framework/defaults/app/Actions/ to app/Actions/",component:"Publish a default component to the same path under resources/components/, by name or by its path there",view:"Publish a default view to resources/views/<path>, e.g. dashboard/commerce/orders or login",core:"Publish a framework package source from node_modules/@stacksjs/<pkg>/ into storage/framework/core/<pkg>/ for editing",unpublishCore:"Drop a vendored storage/framework/core/<pkg>/ and go back to the installed @stacksjs/<pkg>",all:"Unvendor the whole framework: remove storage/framework/core and resolve every @stacksjs package from the `stacks` dependency in package.json",publishAll:"Vendor the whole framework: copy storage/framework/core out of a local Stacks checkout and wire it up as a Bun workspace",frameworkPath:"The Stacks checkout to vendor from (defaults to $STACKS_FRAMEWORK_PATH, ../stacks, then ~/Code/stacks)",coreStatus:"Report whether this project runs on a vendored storage/framework/core or on the published packages",publishDefaults:"Commit a copy of the framework defaults in storage/framework/defaults instead of linking it to node_modules/@stacksjs/defaults",unpublishDefaults:"Drop the vendored storage/framework/defaults and run the installed @stacksjs/defaults through a gitignored link",forceDefaults:"Drop the vendored tree even where it differs from the installed package",name:"The name of the resource to publish (e.g. Cart, User)",pkg:"The name of the framework package (e.g. router, orm, faker - without @stacksjs/ prefix)",force:"Overwrite an existing userland file",forceUnpublish:"Delete the vendored source even when it has uncommitted changes",installer:"Install the published packages with `bun` or `pantry` instead of detecting which one the project uses",verbose:"Enable verbose output"};buddy.command("publish:model <name>",descriptions.model).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"model",name,defaultsDir:path.frameworkPath("defaults/app/Models"),userDir:path.userModelsPath(),force:!!options.force})});buddy.command("publish:controller <name>",descriptions.controller).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"controller",name,defaultsDir:path.frameworkPath("defaults/app/Controllers"),userDir:path.userControllersPath(),force:!!options.force})});buddy.command("publish:middleware <name>",descriptions.middleware).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"middleware",name,defaultsDir:path.frameworkPath("defaults/app/Middleware"),userDir:path.userMiddlewarePath(),force:!!options.force})});buddy.command("publish:action <name>",descriptions.action).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(name,options)=>{await publishResource({kind:"action",name,defaultsDir:path.frameworkPath("defaults/app/Actions"),userDir:path.userActionsPath(),force:!!options.force})});buddy.command("publish:component <name>",descriptions.component).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:component Pagination").example("buddy publish:component Storefront/ProductCard").action(async(name,options)=>{await publishStx("component",name,!!options.force)});buddy.command("publish:view <path>",descriptions.view).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:view login").example("buddy publish:view dashboard/commerce/orders").action(async(name,options)=>{await publishStx("view",name,!!options.force)});buddy.command("publish:core [pkg]",descriptions.core).option("--all",descriptions.publishAll,{default:false}).option("--path <path>",descriptions.frameworkPath).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:core router").example("buddy publish:core --all").example("buddy publish:core --all --path ../stacks").action(async(pkg,options)=>{if(options.all){await vendorFramework(options.path,!!options.force);return}if(!pkg){await log.error("Usage: buddy publish:core <pkg> (or --all to vendor the whole framework as a workspace)");process.exit(ExitCode.FatalError)}await publishCorePackage(pkg,!!options.force)});buddy.command("core:status",descriptions.coreStatus).alias("publish:core:status").option("--verbose",descriptions.verbose,{default:false}).example("buddy core:status").action(async()=>{await reportCoreStatus()});buddy.command("unpublish:core [pkg]",descriptions.unpublishCore).option("--all",descriptions.all,{default:false}).option("--force",descriptions.forceUnpublish,{default:false}).option("--installer <installer>",descriptions.installer).option("--verbose",descriptions.verbose,{default:false}).action(async(pkg,options)=>{if(options.installer!==undefined&&!isUnvendorInstaller(options.installer)){await log.error(`--installer must be one of ${UNVENDOR_INSTALLERS.join(", ")}, not "${String(options.installer)}".`);process.exit(ExitCode.InvalidArgument)}if(options.all){await unvendorFramework(!!options.force,options.installer);return}if(!pkg){await log.error("Usage: buddy unpublish:core <pkg> (or --all to move the whole framework to node_modules)");process.exit(ExitCode.FatalError)}await unpublishCorePackage(pkg,!!options.force)});buddy.command("publish:defaults",descriptions.publishDefaults).option("--verbose",descriptions.verbose,{default:false}).example("buddy publish:defaults").action(async()=>{await vendorDefaults()});buddy.command("unpublish:defaults",descriptions.unpublishDefaults).option("--force",descriptions.forceDefaults,{default:false}).option("--verbose",descriptions.verbose,{default:false}).example("buddy unpublish:defaults").action(async(options)=>{await unvendorDefaults(!!options.force)});buddy.command("publish [resource] [name]",descriptions.command).option("--force",descriptions.force,{default:false}).option("--verbose",descriptions.verbose,{default:false}).action(async(resource,name,options)=>{if(!resource||!name){await log.error("Usage: buddy publish:<resource> <Name> (e.g. buddy publish:model Cart)");process.exit(ExitCode.FatalError)}const dispatch={model:()=>publishResource({kind:"model",name,defaultsDir:path.frameworkPath("defaults/app/Models"),userDir:path.userModelsPath(),force:!!options.force}),controller:()=>publishResource({kind:"controller",name,defaultsDir:path.frameworkPath("defaults/app/Controllers"),userDir:path.userControllersPath(),force:!!options.force}),middleware:()=>publishResource({kind:"middleware",name,defaultsDir:path.frameworkPath("defaults/app/Middleware"),userDir:path.userMiddlewarePath(),force:!!options.force}),action:()=>publishResource({kind:"action",name,defaultsDir:path.frameworkPath("defaults/app/Actions"),userDir:path.userActionsPath(),force:!!options.force}),component:()=>publishStx("component",name,!!options.force),view:()=>publishStx("view",name,!!options.force),core:()=>publishCorePackage(name,!!options.force)};const handler=dispatch[resource.toLowerCase()];if(!handler){await log.error(`Unknown publishable resource: ${italic(resource)}`);log.info("Available: model, controller, middleware, action, component, view, core");await log.flush();process.exit(ExitCode.FatalError)}await handler()});onUnknownSubcommand(buddy,"publish")}async function publishCorePackage(pkg,force){const shortName=pkg.replace(/^@stacksjs\//,"").replace(/^core\//,"");const fail=(msg,hint)=>{process.stderr.write(`${msg}
|
|
2
2
|
`);if(hint)process.stderr.write(` ${hint}
|
|
3
|
-
`);process.exit(ExitCode.FatalError)};if(!shortName||shortName.includes("/")||shortName.includes("..")){fail(`Invalid package name: ${pkg}`,"Use a short name like `router` or the fully qualified `@stacksjs/router`.")}const sourceDir=resolve(process.cwd(),"node_modules","@stacksjs",shortName);const targetDir=path.frameworkPath(`core/${shortName}`);try{const info=await stat(sourceDir);if(!info.isDirectory()){fail(`${sourceDir} is not a directory.`)}}catch{fail(`Could not find @stacksjs/${shortName} in node_modules.`,"Run `bun install` first, or check the package name.")}if(existsSync(targetDir)&&!force){fail(`Already published: ${targetDir.replace(`${process.cwd()}/`,"")}`,"Pass --force to overwrite.")}mkdirSync(dirname(targetDir),{recursive:true});const SKIP=new Set(["node_modules","dist",".bun",".cache","tsconfig.tsbuildinfo"]);let copied=0;await copyTreeFiltered(sourceDir,targetDir,SKIP,()=>copied++);log.success(`Published @stacksjs/${shortName} → ${italic(targetDir.replace(`${process.cwd()}/`,""))} (${copied} files)`);log.info("Edit freely - local changes win over the installed package.")}async function copyTreeFiltered(sourceDir,targetDir,skip,onFile){mkdirSync(targetDir,{recursive:true});const entries=await readdir(sourceDir,{withFileTypes:true});for(const entry of entries){if(skip.has(entry.name))continue;const src=`${sourceDir}/${entry.name}`;const dst=`${targetDir}/${entry.name}`;if(entry.isDirectory()){await copyTreeFiltered(src,dst,skip,onFile);continue}await cp(src,dst,{force:true,dereference:true});onFile()}}async function publishResource(ctx){const{kind,name,defaultsDir,userDir,force}=ctx;const fileName=name.endsWith(".ts")?name:`${name}.ts`;const matches=globSync([`${defaultsDir}/**/${fileName}`],{absolute:true});if(!matches.length){await log.error(`Could not find default ${kind}: ${italic(fileName)}`);log.info(`Looked under: ${italic(defaultsDir)}`);await log.flush();process.exit(ExitCode.FatalError)}if(matches.length>1){log.warn(`Multiple defaults match ${italic(fileName)}; using the first:`);for(const m of matches)log.info(` ${m}`)}const sourcePath=matches[0];if(!sourcePath)throw new Error(`Could not resolve default ${kind}: ${fileName}`);const targetPath
|
|
3
|
+
`);process.exit(ExitCode.FatalError)};if(!shortName||shortName.includes("/")||shortName.includes("..")){fail(`Invalid package name: ${pkg}`,"Use a short name like `router` or the fully qualified `@stacksjs/router`.")}const sourceDir=resolve(process.cwd(),"node_modules","@stacksjs",shortName);const targetDir=path.frameworkPath(`core/${shortName}`);try{const info=await stat(sourceDir);if(!info.isDirectory()){fail(`${sourceDir} is not a directory.`)}}catch{fail(`Could not find @stacksjs/${shortName} in node_modules.`,"Run `bun install` first, or check the package name.")}if(existsSync(targetDir)&&!force){fail(`Already published: ${targetDir.replace(`${process.cwd()}/`,"")}`,"Pass --force to overwrite.")}mkdirSync(dirname(targetDir),{recursive:true});const SKIP=new Set(["node_modules","dist",".bun",".cache","tsconfig.tsbuildinfo"]);let copied=0;await copyTreeFiltered(sourceDir,targetDir,SKIP,()=>copied++);log.success(`Published @stacksjs/${shortName} → ${italic(targetDir.replace(`${process.cwd()}/`,""))} (${copied} files)`);log.info("Edit freely - local changes win over the installed package.")}async function copyTreeFiltered(sourceDir,targetDir,skip,onFile){mkdirSync(targetDir,{recursive:true});const entries=await readdir(sourceDir,{withFileTypes:true});for(const entry of entries){if(skip.has(entry.name))continue;const src=`${sourceDir}/${entry.name}`;const dst=`${targetDir}/${entry.name}`;if(entry.isDirectory()){await copyTreeFiltered(src,dst,skip,onFile);continue}await cp(src,dst,{force:true,dereference:true});onFile()}}async function publishResource(ctx){const{kind,name,defaultsDir,userDir,force}=ctx;const fileName=name.endsWith(".ts")?name:`${name}.ts`;const matches=globSync([`${defaultsDir}/**/${fileName}`],{absolute:true});if(!matches.length){await log.error(`Could not find default ${kind}: ${italic(fileName)}`);log.info(`Looked under: ${italic(defaultsDir)}`);await log.flush();process.exit(ExitCode.FatalError)}if(matches.length>1){log.warn(`Multiple defaults match ${italic(fileName)}; using the first:`);for(const m of matches)log.info(` ${m}`)}const sourcePath=matches[0];if(!sourcePath)throw new Error(`Could not resolve default ${kind}: ${fileName}`);const targetPath=publishedPath(kind,defaultsDir,userDir,sourcePath,fileName);if(existsSync(targetPath)&&!force){await log.error(`Already exists: ${italic(targetPath)}`);log.info("Pass --force to overwrite.");await log.flush();process.exit(ExitCode.FatalError)}mkdirSync(dirname(targetPath),{recursive:true});await fs.promises.copyFile(sourcePath,targetPath);const carried=await carryRelativeImports(sourcePath,targetPath);log.success(`Published ${kind} ${italic(name)} → ${italic(targetPath.replace(`${process.cwd()}/`,""))}`);for(const file of carried)log.info(` + ${italic(file.replace(`${process.cwd()}/`,""))} (imported by it)`)}export function publishedPath(kind,defaultsDir,userDir,sourcePath,fileName){const base=userDir.replace(/\/$/,"");return kind==="action"?join(base,relative(defaultsDir,sourcePath)):`${base}/${fileName}`}async function publishStx(kind,name,force){const root=path.projectPath();const defaultsRoot=path.frameworkPath("defaults");const found=locateDefaultStx(kind,name,defaultsRoot,root);if(!found.ok){await log.error(found.message);for(const line of found.details)log.info(` ${line}`);await log.flush();process.exit(ExitCode.FatalError)}if(existsSync(found.target)&&!force){await log.error(`Already exists: ${italic(found.target.replace(`${root}/`,""))}`);log.info("Pass --force to overwrite.");await log.flush();process.exit(ExitCode.FatalError)}const source=await fs.promises.readFile(found.source,"utf-8");const{code,rewritten}=pointImportsAtDefaults(source,found.source,defaultsRoot);mkdirSync(dirname(found.target),{recursive:true});await fs.promises.writeFile(found.target,code);log.success(`Published ${kind} ${italic(name)} → ${italic(found.target.replace(`${root}/`,""))}`);if(rewritten>0)log.info(` ${rewritten} import${rewritten===1?"":"s"} of the framework's own files now read from @stacksjs/defaults`)}export async function carryRelativeImports(sourcePath,targetPath,seen=new Set,projectRoot=process.cwd()){if(seen.has(sourcePath))return[];seen.add(sourcePath);const source=await fs.promises.readFile(sourcePath,"utf-8");const written=[];const root=realpathSync(projectRoot);const targetDir=realpathSync(dirname(targetPath));const specifiers=[...source.matchAll(/from\s+['"](\.[^'"]+)['"]/g)].map((match)=>match[1]);for(const specifier of new Set(specifiers)){if(!specifier)continue;const candidates=specifier.endsWith(".ts")?[specifier]:[`${specifier}.ts`,`${specifier}/index.ts`];for(const candidate of candidates){const from=resolve(dirname(sourcePath),candidate);const to=resolve(targetDir,candidate);if(!existsSync(from))continue;if(!to.startsWith(`${root}/`))break;if(!existsSync(to)){mkdirSync(dirname(to),{recursive:true});await fs.promises.copyFile(from,to);written.push(to)}written.push(...await carryRelativeImports(from,to,seen,projectRoot));break}}return written}async function vendorFramework(explicitPath,force){const coreDir=path.frameworkPath("core");const rel=(p)=>p.replace(`${process.cwd()}/`,"");if(existsSync(coreDir)&&!force){log.info(`Already vendored: ${italic(rel(coreDir))}`);log.info("Pass --force to replace it with a fresh copy of the checkout.");return}const framework=resolveFrameworkCheckout(explicitPath);if(!framework){await log.error("No Stacks checkout found to vendor from.");log.info("Pass one with `--path <dir>`, or set STACKS_FRAMEWORK_PATH.");log.info("A checkout is required: the published packages ship `dist` only, so a copy of them would not be editable.");await log.flush();process.exit(ExitCode.FatalError)}const sourceCore=join(framework,"storage/framework/core");const corePkgPath=resolve(sourceCore,"package.json");if(!existsSync(corePkgPath)){await log.error(`${sourceCore} has no package.json - that does not look like a Stacks checkout.`);process.exit(ExitCode.FatalError)}const corePkg=JSON.parse(await fs.promises.readFile(corePkgPath,"utf-8"));const depName=corePkg.name??"stacks";log.info(`Vendoring the framework from ${italic(framework)}...`);if(existsSync(coreDir))await fs.promises.rm(coreDir,{recursive:true,force:true});const SKIP=new Set(["node_modules",".bun",".cache","tsconfig.tsbuildinfo"]);let copied=0;await copyTreeFiltered(sourceCore,coreDir,SKIP,()=>copied++);const rootPkgPath=resolve(process.cwd(),"package.json");const rootPkg=JSON.parse(await fs.promises.readFile(rootPkgPath,"utf-8"));const provided=new Set([depName]);for(const entry of await readdir(coreDir,{withFileTypes:true})){if(!entry.isDirectory())continue;if(existsSync(resolve(coreDir,entry.name,"package.json")))provided.add(`@stacksjs/${entry.name}`)}let repointed=0;for(const field of["dependencies","devDependencies"]){const deps=rootPkg[field];if(!deps)continue;for(const name of Object.keys(deps)){if(!provided.has(name)||deps[name].startsWith("workspace:"))continue;deps[name]="workspace:*";repointed++}}if(!rootPkg.dependencies?.[depName]&&!rootPkg.devDependencies?.[depName])rootPkg.dependencies={...rootPkg.dependencies,[depName]:"workspace:*"};const workspaces=rootPkg.workspaces??[];let addedGlobs=0;for(const glob of["storage/framework/core","storage/framework/core/*"]){if(workspaces.some((existing)=>existing.replace(/^\.\//,"").replace(/\/$/,"")===glob))continue;workspaces.push(glob);addedGlobs++}rootPkg.workspaces=workspaces;await fs.promises.writeFile(rootPkgPath,`${JSON.stringify(rootPkg,null,2)}
|
|
4
4
|
`);const bunfigPath=resolve(process.cwd(),"bunfig.toml");let rewrittenPreloads=0;if(existsSync(bunfigPath)){const bunfig=await fs.promises.readFile(bunfigPath,"utf-8");const next=bunfig.replace(/(["'])@stacksjs\/([\w-]+)\/([^"']+?)\.js\1/g,(match,quote,pkgName,subpath)=>{if(!provided.has(`@stacksjs/${pkgName}`))return match;rewrittenPreloads++;return`${quote}./storage/framework/core/${pkgName}/${subpath}.ts${quote}`});if(next!==bunfig)await fs.promises.writeFile(bunfigPath,next)}const tsconfigPath=resolve(process.cwd(),"tsconfig.json");let rewroteTsconfig=false;if(existsSync(tsconfigPath)){const raw=await fs.promises.readFile(tsconfigPath,"utf-8");const next=raw.replace(/"extends"\s*:\s*"\.\/storage\/framework\/tsconfig\.app\.json"/,'"extends": "./storage/framework/core/tsconfig.json"');if(next!==raw){await fs.promises.writeFile(tsconfigPath,next);rewroteTsconfig=true}}log.success(`Vendored ${copied} files into ${italic(rel(coreDir))}`);log.info(`package.json now depends on ${depName}@workspace:*`);if(repointed>0)log.info(`Repointed ${repointed} version range${repointed===1?"":"s"} to workspace:*`);if(addedGlobs>0)log.info(`Added ${addedGlobs} workspace glob${addedGlobs===1?"":"s"} for the vendored packages`);if(rewrittenPreloads>0)log.info(`Rewrote ${rewrittenPreloads} bunfig.toml preload path${rewrittenPreloads===1?"":"s"} to the vendored source`);if(rewroteTsconfig)log.info("tsconfig.json now extends storage/framework/core/tsconfig.json");log.info("Linking the workspace...");const install=Bun.spawn(["bun","install"],{cwd:process.cwd(),stdout:"inherit",stderr:"inherit"});const code=await install.exited;if(code!==0){await log.error("`bun install` failed. The files are in place; re-run the install once the failure is resolved.");process.exit(ExitCode.FatalError)}log.success("This project now runs on the vendored framework - edits under storage/framework/core are live.");log.info("Go back to the published packages any time with `buddy unpublish:core --all`.")}function resolveFrameworkCheckout(explicit){const candidates=[explicit,process.env.STACKS_FRAMEWORK_PATH,resolve(process.cwd(),"../stacks"),join(homedir(),"Code/stacks")].filter(Boolean);for(const candidate of candidates){const full=resolve(candidate);if(full===resolve(process.cwd()))continue;if(existsSync(join(full,"storage/framework/core/package.json")))return full}return null}async function reportCoreStatus(){const coreDir=path.frameworkPath("core");const rel=(p)=>p.replace(`${process.cwd()}/`,"");const vendored=existsSync(resolve(coreDir,"package.json"));const rootPkgPath=resolve(process.cwd(),"package.json");const rootPkg=existsSync(rootPkgPath)?JSON.parse(await fs.promises.readFile(rootPkgPath,"utf-8")):{};const declared=rootPkg.dependencies?.stacks??rootPkg.devDependencies?.stacks;if(vendored){const corePkg=JSON.parse(await fs.promises.readFile(resolve(coreDir,"package.json"),"utf-8"));const packages=(await readdir(coreDir,{withFileTypes:true})).filter((entry)=>entry.isDirectory()&&existsSync(resolve(coreDir,entry.name,"package.json")));log.info(`Layout: vendored - ${italic(rel(coreDir))} (${packages.length} packages, v${corePkg.version??"unknown"})`);log.info(`Declared: stacks@${declared??"(not declared)"}`);if(declared&&!declared.startsWith("workspace:"))log.warn(`The vendored copy is not linked: stacks is declared as ${declared}, not workspace:*. Run \`buddy publish:core --all --force\` to relink, or \`buddy unpublish:core --all\` to remove it.`);log.info("Move to the published packages with `buddy unpublish:core --all`.");return}const installed=resolve(process.cwd(),"node_modules/@stacksjs/buddy/package.json");const installedVersion=existsSync(installed)?JSON.parse(await fs.promises.readFile(installed,"utf-8")).version:undefined;log.info("Layout: published packages - no storage/framework/core in this project");log.info(`Declared: stacks@${declared??"(not declared)"}`);log.info(`Installed: ${installedVersion?`v${installedVersion}`:"(run bun install)"}`);log.info("Vendor the framework for local development with `buddy publish:core --all`.")}async function unpublishCorePackage(pkg,force){const shortName=normalizeCoreName(pkg);const targetDir=path.frameworkPath(`core/${shortName}`);const rel=(p)=>p.replace(`${process.cwd()}/`,"");if(!existsSync(targetDir)){log.info(`Not vendored: ${italic(rel(targetDir))} - nothing to do.`);return}const installed=resolve(process.cwd(),"node_modules","@stacksjs",shortName);if(!existsSync(installed)&&!force){await log.error(`@stacksjs/${shortName} is not installed, so removing the vendored copy would leave nothing to resolve.`);log.info(`Run \`bun add @stacksjs/${shortName}\` first, or pass --force to remove it anyway.`);await log.flush();process.exit(ExitCode.FatalError)}await assertNoUncommittedChanges(targetDir,force);await fs.promises.rm(targetDir,{recursive:true,force:true});log.success(`Unpublished ${italic(rel(targetDir))} - @stacksjs/${shortName} now resolves from node_modules.`)}export function packagesPreloadFilesFallBackTo(source){const found=new Set;for(const match of source.matchAll(/'@stacksjs\/'\s*\+\s*'([a-z0-9-]+)'/g))found.add(`@stacksjs/${match[1]}`);return found}export function rewriteBunfigPreloads(bunfig){const packages=new Set;let rewritten=0;const next=bunfig.replace(/(["'])\.?\/?storage\/framework\/core\/([\w-]+)\/([^"']+?)\.ts\1/g,(_match,quote,pkgName,subpath)=>{rewritten++;packages.add(`@stacksjs/${pkgName}`);return`${quote}@stacksjs/${pkgName}/${subpath}.js${quote}`});return{next,packages,rewritten}}async function vendorDefaults(){const root=path.projectPath();if(usesVendoredDefaults(root)){log.info(`${VENDORED_DEFAULTS} is already a vendored copy.`);return}const packageRoot=packagedDefaultsRoot(root);if(!packageRoot){await log.error("@stacksjs/defaults is not installed, so there is nothing to copy. Install the project's dependencies first.");process.exit(ExitCode.FatalError)}const tree=resolve(root,VENDORED_DEFAULTS);try{if(lstatSync(tree).isSymbolicLink())unlinkSync(tree)}catch{}mkdirSync(tree,{recursive:true});const changes=vendorDefaultsTree(root,packageRoot);unignoreDefaults(root);log.success(`Copied @stacksjs/defaults ${installedDefaultsVersion(root)??""} into ${VENDORED_DEFAULTS} (${changes.length} files). Commit it; \`buddy upgrade\` keeps it current.`);log.info("Go back to the link any time with `buddy unpublish:defaults`.")}async function unvendorDefaults(force){const root=path.projectPath();if(!usesVendoredDefaults(root)){linkPackagedDefaults(root);log.info(`${VENDORED_DEFAULTS} already runs from node_modules/@stacksjs/defaults.`);return}if(existsSync(resolve(root,"storage/framework/core/buddy/package.json"))){await log.error("This project vendors the framework itself (storage/framework/core), and its defaults tree is the source the package is built from. Run `buddy unpublish:core --all` first.");process.exit(ExitCode.FatalError)}const packageRoot=packagedDefaultsRoot(root);if(!packageRoot){await log.error("@stacksjs/defaults is not installed, so there is nothing to run the defaults from. Install the project's dependencies first.");process.exit(ExitCode.FatalError)}const differs=syncPackageProjectFiles(root,packageRoot,{dryRun:true,vendorDefaults:true}).filter((change)=>change.path.startsWith(`${VENDORED_DEFAULTS}/`)&&change.action!=="add");if(differs.length>0&&!force){await log.error(`${VENDORED_DEFAULTS} differs from the installed @stacksjs/defaults ${installedDefaultsVersion(root)??""} in ${differs.length} place${differs.length===1?"":"s"}:`);for(const change of differs.slice(0,15))log.error(` ${change.action==="remove"?"only here":"changed "} ${change.path}`);if(differs.length>15)log.error(` ... and ${differs.length-15} more`);log.info("A tree from another release: run `buddy upgrade` first. A file you edited: move it to the same path under app/, which wins over the defaults. Then run this again, or pass --force to drop the differences.");await log.flush();process.exit(ExitCode.FatalError)}const adopted=adoptPackagedDefaults(root);log.success(`Removed ${VENDORED_DEFAULTS}; it now links to ${adopted.packageRoot.replace(`${root}/`,"")} and is gitignored.`);for(const file of[...adopted.rewrittenImports,...adopted.rewrittenModulePaths])log.info(` repointed ${file} at @stacksjs/defaults`);log.info("Commit the removal. Go back to a vendored copy any time with `buddy publish:defaults`.")}async function unvendorFramework(force,requestedInstaller){const coreDir=path.frameworkPath("core");const rel=(p)=>p.replace(`${process.cwd()}/`,"");if(!existsSync(coreDir)){log.info("No storage/framework/core in this project - already on the installed packages.");return}const corePkgPath=resolve(coreDir,"package.json");if(!existsSync(corePkgPath)){await log.error(`${rel(coreDir)} has no package.json, so its version cannot be determined.`);log.info("Unvendor the packages individually with `buddy unpublish:core <pkg>` instead.");await log.flush();process.exit(ExitCode.FatalError)}const corePkg=JSON.parse(await fs.promises.readFile(corePkgPath,"utf-8"));const version=corePkg.version;if(!version){await log.error(`${rel(corePkgPath)} has no version field.`);process.exit(ExitCode.FatalError)}await assertNoUncommittedChanges(coreDir,force);const depName=corePkg.name??"stacks";const range=`^${await resolvePublishedVersion(depName,version)}`;const rootPkgPath=resolve(process.cwd(),"package.json");const rootPkgRaw=await fs.promises.readFile(rootPkgPath,"utf-8");const rootPkg=JSON.parse(rootPkgRaw);const provided=new Set([depName,...Object.keys(corePkg.dependencies??{}).filter((name)=>name.startsWith("@stacksjs/"))]);for(const entry of await readdir(coreDir,{withFileTypes:true})){if(entry.isDirectory())provided.add(`@stacksjs/${entry.name}`)}let repointed=0;const repointWorkspaceRanges=(pkg)=>{let touched=false;for(const field of["dependencies","devDependencies","peerDependencies"]){const deps=pkg[field];if(!deps)continue;for(const[name,spec]of Object.entries(deps)){if(!spec.startsWith("workspace:")||!provided.has(name))continue;deps[name]=range;touched=true;repointed++}}return touched};repointWorkspaceRanges(rootPkg);if(!rootPkg.dependencies?.[depName]&&!rootPkg.devDependencies?.[depName])rootPkg.dependencies={...rootPkg.dependencies,[depName]:range};let rewrittenScripts=0;for(const[name,script]of Object.entries(rootPkg.scripts??{})){if(!/storage\/framework\/core\/buddy\/src\/cli\.ts/.test(script))continue;rootPkg.scripts[name]=script.replace(/\bbunx?\s+(?:--bun\s+)?\.?\/?storage\/framework\/core\/buddy\/src\/cli\.ts/g,"./buddy");rewrittenScripts++}if(Array.isArray(rootPkg.workspaces)){rootPkg.workspaces=rootPkg.workspaces.filter((glob)=>!isCoreWorkspaceGlob(glob));if(rootPkg.workspaces.length===0)delete rootPkg.workspaces}await fs.promises.writeFile(rootPkgPath,`${JSON.stringify(rootPkg,null,2)}
|
|
5
5
|
`);for(const glob of rootPkg.workspaces??[]){for(const memberPkgPath of globSync(`${glob.replace(/\/$/,"")}/package.json`,{cwd:process.cwd(),absolute:true})){const raw=await fs.promises.readFile(memberPkgPath,"utf-8");const memberPkg=JSON.parse(raw);if(repointWorkspaceRanges(memberPkg))await fs.promises.writeFile(memberPkgPath,`${JSON.stringify(memberPkg,null,2)}
|
|
6
6
|
`)}}const survivingManifests=await rewriteSurvivingFrameworkManifests(process.cwd(),provided,range);const bunfigPath=resolve(process.cwd(),"bunfig.toml");let rewrittenPreloads=0;if(existsSync(bunfigPath)){const bunfig=await fs.promises.readFile(bunfigPath,"utf-8");const{next,packages:preloadedPackages,rewritten}=rewriteBunfigPreloads(bunfig);rewrittenPreloads+=rewritten;if(next!==bunfig)await fs.promises.writeFile(bunfigPath,next);for(const match of next.matchAll(/["'](\.\/[^"']+\.ts)["']/g)){const preloadPath=resolve(process.cwd(),match[1]);if(!existsSync(preloadPath))continue;for(const pkgName of packagesPreloadFilesFallBackTo(await fs.promises.readFile(preloadPath,"utf-8")))preloadedPackages.add(pkgName)}let declaredForPreload=0;for(const pkgName of preloadedPackages){if(rootPkg.dependencies?.[pkgName]||rootPkg.devDependencies?.[pkgName])continue;rootPkg.dependencies={...rootPkg.dependencies,[pkgName]:range};declaredForPreload++}if(declaredForPreload>0)await fs.promises.writeFile(rootPkgPath,`${JSON.stringify(rootPkg,null,2)}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare function makeAuth(options: MakeAuthOptions): Promise<MakeAuthResult>;
|
|
2
|
+
/** The sign-in pages, by their path under `resources/views`. */
|
|
3
|
+
export declare const AUTH_PAGES: readonly ['login', 'register', 'forgot-password', 'password/reset/[token]'];
|
|
4
|
+
/**
|
|
5
|
+
* The components those pages render, by their path under
|
|
6
|
+
* `resources/components`. Each page is a thin wrapper: `login.stx` renders
|
|
7
|
+
* `LoginDashboard`, which signs in and redirects, around `Login`, the form
|
|
8
|
+
* itself, inside the shared `AuthCard`. Copying the pages alone would leave
|
|
9
|
+
* nothing that changes the form.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AUTH_COMPONENTS: readonly ['Dashboard/Auth/AuthCard', 'Dashboard/Auth/Login', 'Dashboard/Auth/TwoFactorLogin', 'Dashboard/Auth/LoginDashboard', 'Dashboard/Auth/Register', 'Dashboard/Auth/RegisterDashboard', 'Dashboard/Auth/ForgotPassword', 'Dashboard/Auth/ForgotPasswordDashboard', 'Dashboard/Auth/ResetPassword', 'Dashboard/Auth/ResetPasswordDashboard'];
|
|
12
|
+
/** The actions those pages post to, by the path the default routes name. */
|
|
13
|
+
export declare const AUTH_ACTIONS: readonly ['Auth/LoginAction', 'Auth/VerifyTwoFactorLoginAction', 'Auth/RegisterAction', 'Auth/LogoutAction', 'Password/SendPasswordResetEmailAction', 'Password/VerifyResetTokenAction', 'Password/PasswordResetAction'];
|
|
14
|
+
export declare interface MakeAuthOptions {
|
|
15
|
+
projectRoot: string
|
|
16
|
+
defaultsRoot: string
|
|
17
|
+
api?: boolean
|
|
18
|
+
force?: boolean
|
|
19
|
+
dryRun?: boolean
|
|
20
|
+
}
|
|
21
|
+
export declare interface MakeAuthResult {
|
|
22
|
+
written: string[]
|
|
23
|
+
kept: string[]
|
|
24
|
+
carried: string[]
|
|
25
|
+
missing: string[]
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync,mkdirSync,realpathSync}from"node:fs";import{copyFile,readFile,writeFile}from"node:fs/promises";import{dirname,join,relative}from"node:path";import{carryRelativeImports}from"./commands/publish";import{locateDefaultStx,pointImportsAtDefaults}from"./publish-stx";export const AUTH_PAGES=["login","register","forgot-password","password/reset/[token]"];export const AUTH_COMPONENTS=["Dashboard/Auth/AuthCard","Dashboard/Auth/Login","Dashboard/Auth/TwoFactorLogin","Dashboard/Auth/LoginDashboard","Dashboard/Auth/Register","Dashboard/Auth/RegisterDashboard","Dashboard/Auth/ForgotPassword","Dashboard/Auth/ForgotPasswordDashboard","Dashboard/Auth/ResetPassword","Dashboard/Auth/ResetPasswordDashboard"];export const AUTH_ACTIONS=["Auth/LoginAction","Auth/VerifyTwoFactorLoginAction","Auth/RegisterAction","Auth/LogoutAction","Password/SendPasswordResetEmailAction","Password/VerifyResetTokenAction","Password/PasswordResetAction"];export async function makeAuth(options){const projectRoot=realpathSync(options.projectRoot);const{defaultsRoot}=options;const result={written:[],kept:[],carried:[],missing:[]};const rel=(file)=>relative(projectRoot,file);const seen=new Set;if(!options.api){const templates=[...AUTH_PAGES.map((name)=>({kind:"view",name,expected:`resources/views/${name}.stx`})),...AUTH_COMPONENTS.map((name)=>({kind:"component",name,expected:`resources/components/${name}.stx`}))];for(const{kind,name,expected}of templates){const found=locateDefaultStx(kind,name,defaultsRoot,projectRoot);if(!found.ok){result.missing.push(expected);continue}if(existsSync(found.target)&&!options.force){result.kept.push(rel(found.target));continue}result.written.push(rel(found.target));if(options.dryRun)continue;const{code}=pointImportsAtDefaults(await readFile(found.source,"utf-8"),found.source,defaultsRoot);mkdirSync(dirname(found.target),{recursive:true});await writeFile(found.target,code)}}for(const action of AUTH_ACTIONS){const source=join(defaultsRoot,"app/Actions",`${action}.ts`);const target=join(projectRoot,"app/Actions",`${action}.ts`);if(!existsSync(source)){result.missing.push(rel(target));continue}if(existsSync(target)&&!options.force){result.kept.push(rel(target));continue}result.written.push(rel(target));if(options.dryRun)continue;mkdirSync(dirname(target),{recursive:true});await copyFile(source,target);for(const file of await carryRelativeImports(source,target,seen,projectRoot)){if(!result.carried.includes(rel(file)))result.carried.push(rel(file))}}return result}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{spawnSync}from"node:child_process";import{lstatSync}from"node:fs";import{basename,dirname,join}from"node:path";import{generationTasks,readGenerationConfig}from"@stacksjs/actions/daemon/generation-config";import{resultError,resultFailed}from"./result";const importFiles=["RUNTIME.md","actions.ts","controllers.ts","emails.ts","functions.ts","globals.ts","index.ts","jobs.ts","listeners.ts","middleware.ts","models.ts","policies.ts","sources.json"].map((file)=>`storage/framework/auto-imports/${file}`).concat(["storage/framework/types/browser-auto-imports.d.ts","storage/framework/types/server-auto-imports.d.ts","storage/framework/browser-auto-imports.json","storage/framework/server-auto-imports.json"]);const typeFiles=["storage/framework/auto-imports/routes.ts","database/types.d.ts"];const migrationDirectories=["database/migrations","storage/framework/database"];function git(root,...args){const result=spawnSync("git",["--literal-pathspecs",...args],{cwd:root,encoding:"utf8",timeout:15000});if(result.status!==0)throw new Error(result.error?.message??(result.stderr.trim()||`git ${args[0]} failed`));return result.stdout}function generatedChanges(root,files){const status=git(root,"status","--porcelain=v1","-z","--no-renames","--untracked-files=all","--",...files);return new Map(status.split("\x00").filter(Boolean).map((entry)=>[entry.slice(3),entry.slice(0,2)]))}function gitRevision(root){return git(root,"rev-parse","HEAD","--symbolic-full-name","HEAD")}async function prepareCommit(root,tasks){let revision;try{if(git(root,"rev-parse","--show-prefix").trim())return;revision=gitRevision(root)}catch{return}const files=[...tasks.includes("imports")?importFiles:[],...tasks.includes("types")?typeFiles:[]];const migrations=tasks.includes("migrations");const scope=[...files,...migrations?migrationDirectories:[]];const before=generatedChanges(root,scope);return async()=>{if(gitRevision(root)!==revision)return;const changed=[];const newFiles=[];const{isGeneratedMigration}=migrations?await import("@stacksjs/database"):{isGeneratedMigration:undefined};for(const[file,status]of generatedChanges(root,scope)){if(before.has(file)||status!==" M"&&status!=="??")continue;const fullPath=join(root,file);if(!lstatSync(fullPath).isFile())continue;const snapshot=/^storage\/framework\/database\/model-snapshot\.(?:sqlite|mysql|postgres|singlestore|vitess)\.json$/.test(file);const generatedSql=/^database\/migrations\/(?:[^/]+\/)?\d{10}-.+\.sql$/.test(file)&&isGeneratedMigration?.(dirname(fullPath),basename(fullPath));if(!files.includes(file)&&!snapshot&&!generatedSql)continue;changed.push(file);if(status==="??")newFiles.push(file)}if(changed.length===0)return;if(newFiles.length>0)git(root,"add","--intent-to-add","--",...newFiles);git(root,"commit","--only","-m","chore: regenerate Stacks artifacts","--",...changed)}}export async function generateProject(root,selection){const config=readGenerationConfig(root);if(!config)return;const requested=new Set(selection.split(","));const tasks=generationTasks.filter((task)=>requested.has(task)&&config.tasks.includes(task));if(tasks.length===0)return;const commit=config.autoCommit?await prepareCommit(root,tasks):undefined;const failures=[];for(const task of tasks){try{if(task==="imports"){const{generateAutoImportFiles}=await import("@stacksjs/server");await generateAutoImportFiles()}else if(task==="migrations"){const{generateMigrations,siblingMigrationDialects}=await import("@stacksjs/database");for(const dialect of[undefined,...await siblingMigrationDialects()]){const result=await generateMigrations({dialect,fromDb:false,allowDestructive:false,trackIgnored:false});if(resultFailed(result))failures.push(`${dialect??"configured dialect"} migrations: ${resultError(result)}`)}}else{const{generateRouteNames}=await import("@stacksjs/actions/generate/action-types");const{buildDatabaseSchema}=await import("@stacksjs/orm");await generateRouteNames({strict:true});const{errors}=await buildDatabaseSchema({strict:true});failures.push(...errors.map((error)=>`${error.file}: ${error.error}`))}}catch(error){failures.push(`${task}: ${error instanceof Error?error.message:String(error)}`)}}if(failures.length>0)throw new Error(failures.join(`
|
|
2
|
+
`));if(readGenerationConfig(root)?.autoCommit)await commit?.()}
|
package/dist/runtime-flags.d.ts
CHANGED
|
@@ -24,6 +24,6 @@ export declare function withoutIsolation(execArgv: readonly string[]): string[];
|
|
|
24
24
|
*
|
|
25
25
|
* No imports: the build reads this too.
|
|
26
26
|
*/
|
|
27
|
-
export declare const ISOLATED_RUNTIME_FLAGS: readonly ['--config=/dev/null', '--no-install'];
|
|
27
|
+
export declare const ISOLATED_RUNTIME_FLAGS: readonly ['--config=/dev/null', '--no-install', '--no-env-file'];
|
|
28
28
|
/** `env -S` splits the line into arguments, on macOS and on Linux alike. */
|
|
29
29
|
export declare const CLI_SHEBANG: string;
|
package/dist/runtime-flags.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ISOLATED_RUNTIME_FLAGS=["--config=/dev/null","--no-install"];export const CLI_SHEBANG=`#!/usr/bin/env -S bun ${ISOLATED_RUNTIME_FLAGS.join(" ")}`;export function isIsolatedRuntime(execArgv){return ISOLATED_RUNTIME_FLAGS.every((flag)=>execArgv.includes(flag))}export function withoutIsolation(execArgv){return execArgv.filter((flag)=>!ISOLATED_RUNTIME_FLAGS.includes(flag))}
|
|
1
|
+
export const ISOLATED_RUNTIME_FLAGS=["--config=/dev/null","--no-install","--no-env-file"];export const CLI_SHEBANG=`#!/usr/bin/env -S bun ${ISOLATED_RUNTIME_FLAGS.join(" ")}`;export function isIsolatedRuntime(execArgv){return ISOLATED_RUNTIME_FLAGS.every((flag)=>execArgv.includes(flag))}export function withoutIsolation(execArgv){return execArgv.filter((flag)=>!ISOLATED_RUNTIME_FLAGS.includes(flag))}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.636",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -95,71 +95,71 @@
|
|
|
95
95
|
"prepublishOnly": "bun run build"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@stacksjs/actions": "0.75.
|
|
99
|
-
"@stacksjs/docs": "0.75.
|
|
100
|
-
"@stacksjs/ai": "0.75.
|
|
101
|
-
"@stacksjs/alias": "0.75.
|
|
102
|
-
"@stacksjs/analytics": "0.75.
|
|
103
|
-
"@stacksjs/api": "0.75.
|
|
104
|
-
"@stacksjs/arrays": "0.75.
|
|
105
|
-
"@stacksjs/auth": "0.75.
|
|
106
|
-
"@stacksjs/browser-extension": "0.75.
|
|
107
|
-
"@stacksjs/build": "0.75.
|
|
98
|
+
"@stacksjs/actions": "0.75.636",
|
|
99
|
+
"@stacksjs/docs": "0.75.636",
|
|
100
|
+
"@stacksjs/ai": "0.75.636",
|
|
101
|
+
"@stacksjs/alias": "0.75.636",
|
|
102
|
+
"@stacksjs/analytics": "0.75.636",
|
|
103
|
+
"@stacksjs/api": "0.75.636",
|
|
104
|
+
"@stacksjs/arrays": "0.75.636",
|
|
105
|
+
"@stacksjs/auth": "0.75.636",
|
|
106
|
+
"@stacksjs/browser-extension": "0.75.636",
|
|
107
|
+
"@stacksjs/build": "0.75.636",
|
|
108
108
|
"@stacksjs/bumpx": "^0.2.32",
|
|
109
|
-
"@stacksjs/cache": "0.75.
|
|
110
|
-
"@stacksjs/chat": "0.75.
|
|
109
|
+
"@stacksjs/cache": "0.75.636",
|
|
110
|
+
"@stacksjs/chat": "0.75.636",
|
|
111
111
|
"@stacksjs/clapp": "^0.2.17",
|
|
112
|
-
"@stacksjs/cli": "0.75.
|
|
113
|
-
"@stacksjs/cloud": "0.75.
|
|
114
|
-
"@stacksjs/cms": "0.75.
|
|
115
|
-
"@stacksjs/collections": "0.75.
|
|
116
|
-
"@stacksjs/commerce": "0.75.
|
|
117
|
-
"@stacksjs/config": "0.75.
|
|
118
|
-
"@stacksjs/database": "0.75.
|
|
119
|
-
"@stacksjs/desktop-build": "0.75.
|
|
120
|
-
"@stacksjs/dns": "0.75.
|
|
112
|
+
"@stacksjs/cli": "0.75.636",
|
|
113
|
+
"@stacksjs/cloud": "0.75.636",
|
|
114
|
+
"@stacksjs/cms": "0.75.636",
|
|
115
|
+
"@stacksjs/collections": "0.75.636",
|
|
116
|
+
"@stacksjs/commerce": "0.75.636",
|
|
117
|
+
"@stacksjs/config": "0.75.636",
|
|
118
|
+
"@stacksjs/database": "0.75.636",
|
|
119
|
+
"@stacksjs/desktop-build": "0.75.636",
|
|
120
|
+
"@stacksjs/dns": "0.75.636",
|
|
121
121
|
"@stacksjs/dnsx": "^0.2.3",
|
|
122
|
-
"@stacksjs/email": "0.75.
|
|
123
|
-
"@stacksjs/enums": "0.75.
|
|
124
|
-
"@stacksjs/env": "0.75.
|
|
125
|
-
"@stacksjs/error-handling": "0.75.
|
|
126
|
-
"@stacksjs/events": "0.75.
|
|
127
|
-
"@stacksjs/features": "0.75.
|
|
128
|
-
"@stacksjs/git": "0.75.
|
|
122
|
+
"@stacksjs/email": "0.75.636",
|
|
123
|
+
"@stacksjs/enums": "0.75.636",
|
|
124
|
+
"@stacksjs/env": "0.75.636",
|
|
125
|
+
"@stacksjs/error-handling": "0.75.636",
|
|
126
|
+
"@stacksjs/events": "0.75.636",
|
|
127
|
+
"@stacksjs/features": "0.75.636",
|
|
128
|
+
"@stacksjs/git": "0.75.636",
|
|
129
129
|
"@stacksjs/gitit": "^0.2.5",
|
|
130
|
-
"@stacksjs/health": "0.75.
|
|
131
|
-
"@stacksjs/hq": "0.75.
|
|
130
|
+
"@stacksjs/health": "0.75.636",
|
|
131
|
+
"@stacksjs/hq": "0.75.636",
|
|
132
132
|
"@stacksjs/httx": "^0.1.10",
|
|
133
|
-
"@stacksjs/image": "0.75.
|
|
134
|
-
"@stacksjs/lint": "0.75.
|
|
135
|
-
"@stacksjs/logging": "0.75.
|
|
136
|
-
"@stacksjs/notifications": "0.75.
|
|
137
|
-
"@stacksjs/objects": "0.75.
|
|
138
|
-
"@stacksjs/orm": "0.75.
|
|
139
|
-
"@stacksjs/path": "0.75.
|
|
140
|
-
"@stacksjs/payments": "0.75.
|
|
141
|
-
"@stacksjs/realtime": "0.75.
|
|
142
|
-
"@stacksjs/router": "0.75.
|
|
133
|
+
"@stacksjs/image": "0.75.636",
|
|
134
|
+
"@stacksjs/lint": "0.75.636",
|
|
135
|
+
"@stacksjs/logging": "0.75.636",
|
|
136
|
+
"@stacksjs/notifications": "0.75.636",
|
|
137
|
+
"@stacksjs/objects": "0.75.636",
|
|
138
|
+
"@stacksjs/orm": "0.75.636",
|
|
139
|
+
"@stacksjs/path": "0.75.636",
|
|
140
|
+
"@stacksjs/payments": "0.75.636",
|
|
141
|
+
"@stacksjs/realtime": "0.75.636",
|
|
142
|
+
"@stacksjs/router": "0.75.636",
|
|
143
143
|
"@stacksjs/rpx": "^0.11.54",
|
|
144
|
-
"@stacksjs/scheduler": "0.75.
|
|
145
|
-
"@stacksjs/search-engine": "0.75.
|
|
146
|
-
"@stacksjs/security": "0.75.
|
|
147
|
-
"@stacksjs/server": "0.75.
|
|
148
|
-
"@stacksjs/sites": "0.75.
|
|
149
|
-
"@stacksjs/skills": "0.75.
|
|
150
|
-
"@stacksjs/socials": "0.75.
|
|
151
|
-
"@stacksjs/storage": "0.75.
|
|
152
|
-
"@stacksjs/strings": "0.75.
|
|
144
|
+
"@stacksjs/scheduler": "0.75.636",
|
|
145
|
+
"@stacksjs/search-engine": "0.75.636",
|
|
146
|
+
"@stacksjs/security": "0.75.636",
|
|
147
|
+
"@stacksjs/server": "0.75.636",
|
|
148
|
+
"@stacksjs/sites": "0.75.636",
|
|
149
|
+
"@stacksjs/skills": "0.75.636",
|
|
150
|
+
"@stacksjs/socials": "0.75.636",
|
|
151
|
+
"@stacksjs/storage": "0.75.636",
|
|
152
|
+
"@stacksjs/strings": "0.75.636",
|
|
153
153
|
"@stacksjs/stx": "^0.2.908",
|
|
154
|
-
"@stacksjs/testing": "0.75.
|
|
155
|
-
"@stacksjs/tinker": "0.75.
|
|
154
|
+
"@stacksjs/testing": "0.75.636",
|
|
155
|
+
"@stacksjs/tinker": "0.75.636",
|
|
156
156
|
"@stacksjs/tlsx": "^0.13.19",
|
|
157
157
|
"@stacksjs/ts-cloud": "^0.16.144",
|
|
158
|
-
"@stacksjs/tunnel": "0.75.
|
|
159
|
-
"@stacksjs/types": "0.75.
|
|
160
|
-
"@stacksjs/ui": "0.75.
|
|
161
|
-
"@stacksjs/utils": "0.75.
|
|
162
|
-
"@stacksjs/validation": "0.75.
|
|
158
|
+
"@stacksjs/tunnel": "0.75.636",
|
|
159
|
+
"@stacksjs/types": "0.75.636",
|
|
160
|
+
"@stacksjs/ui": "0.75.636",
|
|
161
|
+
"@stacksjs/utils": "0.75.636",
|
|
162
|
+
"@stacksjs/validation": "0.75.636",
|
|
163
163
|
"ajv": "^8.20.0",
|
|
164
164
|
"ajv-formats": "^3.0.1",
|
|
165
165
|
"bun-plugin-stx": "^0.2.908",
|