@stacksjs/buddy 0.75.241 → 0.75.243
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import process from"node:process";import{runTool}from"./run-tool";export function desktopProbeFlags(options){const flags=[];if(options.browser===!0)flags.push("--browser");else if(typeof options.browser==="string"&&options.browser.length>0)flags.push(`--browser=${options.browser}`);if(options.open===!1)flags.push("--no-open");if(options.record)flags.push("--record");const valued=[["out","out"],["craftBin","craft-bin"],["interactionWindow","interaction-window"],["idle","idle"],["load","load"],["cpuLoad","cpu-load"],["instances","instances"],["timeout","timeout"]];for(const[key,flag]of valued){const value=options[key];if(value!==void 0&&value!==""&&typeof value!=="boolean")flags.push(`--${flag}=${value}`)}return flags}export function desktopProbe(buddy){buddy.command("desktop:probe","Measure WebGL2/WebGPU, frame pacing, input and audio latency, gamepad, fullscreen and pointer lock in a Craft window").option("--browser [name]","Run the same page in a browser instead (default browser, or a named one on macOS)").option("--no-open","With --browser, print the URL instead of opening it").option("--record","Write the record into the framework repository's probe results (framework checkout only)").option("--out <file>","Also write the record as JSON to this file").option("--craft-bin <path>","Craft binary to use (defaults to CRAFT_BIN, then craft on PATH)").option("--interaction-window <seconds>","How long to wait for real clicks and key presses; 0 skips them (default 20)").option("--idle <seconds>","Idle frame-pacing sample length (default 3)").option("--load <seconds>","Loaded frame-pacing sample length (default 6)").option("--cpu-load <ms>","Busy-wait added to each loaded frame (default 6)").option("--instances <count>","Instanced cubes drawn per loaded frame, 12 triangles each (default 40000)").option("--timeout <seconds>","Give up after this long").example("buddy desktop:probe --record").example("buddy desktop:probe --browser=Safari --record").action(async(options)=>{try{const{run}=await import("
|
|
1
|
+
import process from"node:process";import{runTool}from"./run-tool";export function desktopProbeFlags(options){const flags=[];if(options.browser===!0)flags.push("--browser");else if(typeof options.browser==="string"&&options.browser.length>0)flags.push(`--browser=${options.browser}`);if(options.open===!1)flags.push("--no-open");if(options.record)flags.push("--record");const valued=[["out","out"],["craftBin","craft-bin"],["interactionWindow","interaction-window"],["idle","idle"],["load","load"],["cpuLoad","cpu-load"],["instances","instances"],["timeout","timeout"]];for(const[key,flag]of valued){const value=options[key];if(value!==void 0&&value!==""&&typeof value!=="boolean")flags.push(`--${flag}=${value}`)}return flags}export function desktopProbe(buddy){buddy.command("desktop:probe","Measure WebGL2/WebGPU, frame pacing, input and audio latency, gamepad, fullscreen and pointer lock in a Craft window").option("--browser [name]","Run the same page in a browser instead (default browser, or a named one on macOS)").option("--no-open","With --browser, print the URL instead of opening it").option("--record","Write the record into the framework repository's probe results (framework checkout only)").option("--out <file>","Also write the record as JSON to this file").option("--craft-bin <path>","Craft binary to use (defaults to CRAFT_BIN, then craft on PATH)").option("--interaction-window <seconds>","How long to wait for real clicks and key presses; 0 skips them (default 20)").option("--idle <seconds>","Idle frame-pacing sample length (default 3)").option("--load <seconds>","Loaded frame-pacing sample length (default 6)").option("--cpu-load <ms>","Busy-wait added to each loaded frame (default 6)").option("--instances <count>","Instanced cubes drawn per loaded frame, 12 triangles each (default 40000)").option("--timeout <seconds>","Give up after this long").example("buddy desktop:probe --record").example("buddy desktop:probe --browser=Safari --record").action(async(options)=>{try{const{run}=await import("@stacksjs/desktop-build/probe/runner");await runTool(run,...desktopProbeFlags(options))}catch(error){process.stderr.write(`${error instanceof Error?error.message:String(error)}
|
|
2
2
|
`);process.exit(1)}})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFileSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{capabilityRegistry}from"
|
|
1
|
+
import{readFileSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{capabilityRegistry}from"@stacksjs/config/capabilities";import{INTERACTIVE_BEGIN,INTERACTIVE_END,loadProbeRecords,renderInteractiveCapabilities}from"@stacksjs/desktop-build/probe";import{assertFrameworkRepo}from"./framework-repo";const root=new URL("../../../../../../../",import.meta.url).pathname,page=join(root,"docs/features/capabilities.md"),BEGIN="<!-- capability-matrix:begin -->",END="<!-- capability-matrix:end -->",CATEGORIES=[["database","Database"],["queue","Queue"],["cache","Cache"],["storage","Storage"],["mail","Mail"],["realtime","Realtime"],["deploy","Deploy"]],STATUS_NOTE={supported:"Contract evidence runs in CI.",partial:"Works, with the gaps named below.",experimental:"Usable, but without retained evidence.",unsupported:"Cannot be selected; configuring it fails loudly."};function row(driver){const evidence=driver.testEvidence.length===0?"none retained":driver.testEvidence.map((path)=>`\`${path.split("/").pop()}\``).join("<br>"),live=driver.liveServiceContract?`${driver.liveServiceContract.service} ${driver.liveServiceContract.version}`:"-";return`| \`${driver.name}\` | **${driver.status}** | ${driver.topology} | ${live} | ${evidence} |`}function section(category,heading){const drivers=capabilityRegistry.filter((driver)=>driver.category===category);if(drivers.length===0)return[];const limitations=drivers.flatMap((driver)=>driver.limitations.map((limitation)=>`- **\`${driver.name}\`** - ${limitation}`));return[`### ${heading}`,"","| Driver | Status | Topology | Live service | Evidence |","|---|---|---|---|---|",...drivers.map(row),"",...limitations.length>0?["**Limitations**","",...limitations,""]:[]]}function verifiedLine(){return["> **How current is this?** This table is generated from `capabilityRegistry`","> in `@stacksjs/config`, and `docs:capabilities:check` fails CI when the two","> disagree - so it is verified at every commit, not as of some date.",">","> The claims themselves are checked by `capabilities.test.ts`: every cited","> file must exist, anything short of `supported` must give a reason, and a","> `supported` driver on a remote topology must name the provider version it","> was proven against.",""]}export function render(){const statuses=Object.entries(STATUS_NOTE).map(([status,note])=>`- **${status}** - ${note}`);return[BEGIN,"","<!-- Generated by `buddy docs:capabilities` from `@stacksjs/config`'s"," `capabilityRegistry`. Edit that, not this. -->","",...statuses,"",...verifiedLine(),...CATEGORIES.flatMap(([category,heading])=>section(category,heading)),END].join(`
|
|
2
2
|
`)}export const blocks=[{begin:BEGIN,end:END,render},{begin:INTERACTIVE_BEGIN,end:INTERACTIVE_END,render:()=>renderInteractiveCapabilities(loadProbeRecords())}];function current(block){let contents;try{contents=readFileSync(page,"utf8")}catch{return null}const start=contents.indexOf(block.begin),end=contents.indexOf(block.end);if(start===-1||end===-1)return null;return contents.slice(start,end+block.end.length)}function write(){const original=readFileSync(page,"utf8");let contents=original;for(const block of blocks){const start=contents.indexOf(block.begin),end=contents.indexOf(block.end);if(start===-1||end===-1)throw Error(`[docs:capabilities] ${page} is missing the ${block.begin} / ${block.end} markers`);contents=contents.slice(0,start)+block.render()+contents.slice(end+block.end.length)}if(contents===original)return!1;writeFileSync(page,contents);return!0}export async function run(){assertFrameworkRepo(root,"docs:capabilities");if(process.argv.includes("--write")){console.log(write()?"\u2713 rewrote the generated sections of docs/features/capabilities.md":"\u2713 the capability matrix was already current");return}const stale=blocks.filter((block)=>current(block)!==block.render());if(stale.length===0){console.log(`\u2713 the capability matrix is current (${capabilityRegistry.length} drivers, ${loadProbeRecords().length} desktop probe records)`);return}for(const block of stale){const source=block.begin===BEGIN?"capabilityRegistry":"the desktop probe records";console.error(current(block)===null?`\u2717 docs/features/capabilities.md is missing its ${block.begin} section`:`\u2717 docs/features/capabilities.md no longer matches ${source}`)}console.error("\nRun `buddy docs:capabilities` to rewrite it from its sources.");if(process.argv.includes("--check"))process.exit(1)}if(import.meta.main)await run();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFileSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{desktopSupportMatrix}from"
|
|
1
|
+
import{readFileSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{desktopSupportMatrix}from"@stacksjs/desktop-build/support";import{assertFrameworkRepo}from"./framework-repo";const root=new URL("../../../../../../../",import.meta.url).pathname,page=join(root,"docs/packages/desktop.md"),BEGIN="<!-- desktop-support-matrix:begin -->",END="<!-- desktop-support-matrix:end -->",PLATFORM_NAMES={darwin:"macOS",linux:"Linux",win32:"Windows"};function link(url){const issue=url.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);if(issue)return`[${issue[1]}#${issue[2]}](${url})`;const run=url.match(/actions\/runs\/(\d+)/);if(run)return`[run ${run[1]}](${url})`;return`[evidence](${url})`}function row(entry){return`| ${[`${PLATFORM_NAMES[entry.platform]} ${entry.architecture}`,`**${entry.status}**`,entry.osVersions.join(", "),entry.packageFormat,entry.signing,entry.notarization,entry.installLaunchEvidence?link(entry.installLaunchEvidence):"none",entry.blockingIssues.map(link).join(", ")||"none"].join(" | ")} |`}export function render(){const header=["| Target | Status | Tested on | Package | Signing | Notarization | Install + launch | Blocked by |","|---|---|---|---|---|---|---|---|"],limitations=desktopSupportMatrix.flatMap((entry)=>entry.limitations.map((limitation)=>`- **${PLATFORM_NAMES[entry.platform]} ${entry.architecture}** - ${limitation}`)),unique=[...new Set(limitations)];return[BEGIN,"","<!-- Generated by `buddy docs:desktop-matrix` from `@stacksjs/desktop`'s"," `desktopSupportMatrix`. Edit that, not this. -->","",...header,...desktopSupportMatrix.map(row),"","### Known limitations","",...unique,"",END].join(`
|
|
2
2
|
`)}function current(){let contents;try{contents=readFileSync(page,"utf8")}catch{return null}const start=contents.indexOf(BEGIN),end=contents.indexOf(END);if(start===-1||end===-1)return null;return contents.slice(start,end+END.length)}function write(){const contents=readFileSync(page,"utf8"),start=contents.indexOf(BEGIN),end=contents.indexOf(END);if(start===-1||end===-1)throw Error(`[docs:desktop-matrix] ${page} is missing the ${BEGIN} / ${END} markers`);const next=contents.slice(0,start)+render()+contents.slice(end+END.length);if(next===contents)return!1;writeFileSync(page,next);return!0}export async function run(){assertFrameworkRepo(root,"docs:desktop-matrix");if(process.argv.includes("--write")){console.log(write()?"\u2713 rewrote the desktop support matrix in docs/packages/desktop.md":"\u2713 the desktop support matrix was already current");return}const published=current();if(published===render()){console.log(`\u2713 the desktop support matrix is current (${desktopSupportMatrix.length} targets)`);return}console.error(published===null?"\u2717 docs/packages/desktop.md is missing its generated support-matrix section":"\u2717 docs/packages/desktop.md no longer matches desktopSupportMatrix");console.error("\nRun `buddy docs:desktop-matrix` to rewrite it from the source.");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"
|
|
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,core="storage/framework/core",destination="storage/framework/defaults/ai/skills/stacks-native",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),stem=path.replace(/\.js$/,""),resolved=[path,`${stem}.ts`,`${stem}.tsx`,join(path,"index.ts")].find((candidate)=>existsSync(join(projectRoot,candidate))&&statSync(join(projectRoot,candidate)).isFile());if(!resolved)throw 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),manifest=JSON.parse(readFileSync(join(projectRoot,directory,"package.json"),"utf8")),skill=PACKAGE_SKILLS[slug]??`stacks-${slug}`;if(!existsSync(join(projectRoot,"storage/framework/defaults/ai/skills",skill,"SKILL.md")))throw Error(`Native package ${manifest.name} needs a skill or an explicit package-to-skill mapping`);const source=join(directory,"src/index.ts"),entry=existsSync(join(projectRoot,source))?source:join(directory,"package.json"),scan=entry.endsWith(".ts")?scanner.scan(readFileSync(join(projectRoot,entry),"utf8")):void 0,tests=existsSync(join(projectRoot,directory,"tests"))?[...new Bun.Glob("**/*.{test,spec}.{ts,tsx,js}").scanSync({cwd:join(projectRoot,directory,"tests"),onlyFiles:!0})].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 stale=[{path:join(root,destination,"CATALOG.md"),body:renderNativeCatalog()},{path:join(root,destination,"CAPABILITIES.md"),body:renderDriverCapabilities()}].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();
|
|
@@ -127,4 +127,4 @@ export default {
|
|
|
127
127
|
},
|
|
128
128
|
} satisfies QueueConfig
|
|
129
129
|
`};function withoutComments(src){return src.replace(/\/\*[\s\S]*?\*\//g,(m)=>" ".repeat(m.length)).replace(/\/\/[^\n]*/g,(m)=>" ".repeat(m.length))}function findTopLevelEnabled(src){const scan=withoutComments(src),start=scan.search(/export default\s*\{/);if(start===-1)return null;const open=scan.indexOf("{",start);let depth=0;for(let i=open;i<scan.length;i++){const char=scan[i];if(char==="{"){depth++;continue}if(char==="}"){depth--;if(depth===0)return null;continue}if(depth!==1||char!=="e")continue;const match=/^enabled\s*:\s*(true|false)/.exec(scan.slice(i));if(!match)continue;if(i>0&&/[\w$]/.test(scan[i-1]))continue;return{index:i,length:match[0].length,value:match[1]==="true"}}return null}export function readFeatureFlag(feature,root=projectPath()){const path=join(root,`config/${feature}.ts`);if(!existsSync(path))return"absent";const found=findTopLevelEnabled(readFileSync(path,"utf8"));if(!found)return"unset";return found.value}export function featureMigrationCounts(feature,root=projectPath()){const counts={active:0,hidden:0},base=join(root,"database/migrations");if(!existsSync(base))return counts;const dirs=[base];for(const entry of readdirSync(base,{withFileTypes:!0}))if(entry.isDirectory())dirs.push(join(base,entry.name));for(const dir of dirs)for(const file of readdirSync(dir)){const hidden=file.endsWith(".sql.disabled");if(!hidden&&!file.endsWith(".sql"))continue;const sqlName=hidden?file.slice(0,-9):file;if(migrationFeature(sqlName)!==feature)continue;if(hidden)counts.hidden++;else counts.active++}return counts}export async function setFeatureEnabled(feature,enabled,options){const write=async(target,contents)=>{if(options.dryRun!==!0)await Bun.write(target,contents)},path=options.root?join(options.root,`config/${feature}.ts`):projectPath(`config/${feature}.ts`),file=Bun.file(path);if(!await file.exists()){if(!options.createIfMissing)return"missing";await write(path,STARTER_TEMPLATES[feature]);return"created"}const src=await file.text(),found=findTopLevelEnabled(src);if(found){if(found.value===enabled)return"unchanged";const replaced=src.slice(0,found.index)+`enabled: ${enabled}`+src.slice(found.index+found.length);await write(path,replaced);return"flipped"}const insertRegex=/(export default\s*\{)/;if(!insertRegex.test(src))throw Error(`Could not locate \`export default {\` in ${path} - please add \`enabled: ${enabled}\` manually.`);const next=src.replace(insertRegex,`$1
|
|
130
|
-
enabled: ${enabled},`);await write(path,next);return"flipped"}export async function uninstallAllFeatures(options={}){const root=options.root??projectPath(),results=[];for(const feature of FEATURE_NAMES){const configOutcome=await setFeatureEnabled(feature,!1,{createIfMissing:!1,root}),{removed:filesRemoved}=await deleteFeatureFiles(feature,root,{force:!0});results.push({feature,configOutcome,filesRemoved})}return results}function isDryRun(options){return options.dryRun===!0||process.argv.includes("--dry-run")}async function offerMigrate(feature){const{active,hidden}=featureMigrationCounts(feature),total=active+hidden;if(total===0)return;console.log(` \u2192 ${feature} owns ${total} ${total===1?"migration":"migrations"}; its tables do not exist until they run.`);const answer=await confirmOrNull({message:"Run ./buddy migrate now?",initial:!1});if(answer!==!0){console.log(answer===null?" \u2192 Not asking (non-interactive). Run ./buddy migrate when ready.":" \u2192 Skipped. Run ./buddy migrate when ready.");return}const result=await runCommand("./buddy migrate",{cwd:projectPath()});if(resultFailed(result)){console.error(`\u2717 ./buddy migrate failed: ${resultError(result)}`);console.error(` \u2192 ${feature} is installed; re-run ./buddy migrate once that is resolved.`);return}console.log("\u2713 Migrated.")}function registerInstallPair(buddy,feature){const desc=FEATURE_DESCRIPTIONS[feature],configRel=`config/${feature}.ts`;buddy.command(`${feature}:install`,`Activate the ${feature} feature bundle. ${desc}`).option("--
|
|
130
|
+
enabled: ${enabled},`);await write(path,next);return"flipped"}export async function uninstallAllFeatures(options={}){const root=options.root??projectPath(),results=[];for(const feature of FEATURE_NAMES){const configOutcome=await setFeatureEnabled(feature,!1,{createIfMissing:!1,root}),{removed:filesRemoved}=await deleteFeatureFiles(feature,root,{force:!0});results.push({feature,configOutcome,filesRemoved})}return results}function isDryRun(options){return options.dryRun===!0||process.argv.includes("--dry-run")}async function offerMigrate(feature){const{active,hidden}=featureMigrationCounts(feature),total=active+hidden;if(total===0)return;console.log(` \u2192 ${feature} owns ${total} ${total===1?"migration":"migrations"}; its tables do not exist until they run.`);const answer=await confirmOrNull({message:"Run ./buddy migrate now?",initial:!1});if(answer!==!0){console.log(answer===null?" \u2192 Not asking (non-interactive). Run ./buddy migrate when ready.":" \u2192 Skipped. Run ./buddy migrate when ready.");return}const result=await runCommand("./buddy migrate",{cwd:projectPath()});if(resultFailed(result)){console.error(`\u2717 ./buddy migrate failed: ${resultError(result)}`);console.error(` \u2192 ${feature} is installed; re-run ./buddy migrate once that is resolved.`);return}console.log("\u2713 Migrated.")}function registerInstallPair(buddy,feature){const desc=FEATURE_DESCRIPTIONS[feature],configRel=`config/${feature}.ts`;buddy.command(`${feature}:install`,`Activate the ${feature} feature bundle. ${desc}`).option("--publish-all",`Also copy every ${feature} file into the project so you can edit it in place. Not needed to run the feature - see \`publish:action\`/\`publish:model\` to take ownership of one file at a time.`).option("--force",`With --publish-all, overwrite existing ${feature} files (default skips existing paths so the copy is idempotent).`).option("--dry-run",`Say what ${feature}:install would change, and change nothing.`,{default:!1}).action(async(options)=>{try{const dryRun=isDryRun(options),mark=dryRun?"\xB7":"\u2713";switch(await setFeatureEnabled(feature,!0,{createIfMissing:!0,dryRun})){case"created":console.log(dryRun?`${mark} Would create ${configRel} with '${feature}' enabled.`:`${mark} Created ${configRel} with '${feature}' enabled.`);break;case"flipped":console.log(dryRun?`${mark} Would enable '${feature}' in ${configRel}.`:`${mark} Enabled '${feature}' in ${configRel}.`);break;case"unchanged":console.log(`${mark} '${feature}' is already enabled in ${configRel}.`);break}if(options.publishAll===!0){const{copied}=await copyFeatureFiles(feature,{force:options.force===!0,dryRun});if(copied.length>0){console.log(dryRun?`${mark} Would copy ${copied.length} stamped path(s) from framework defaults:`:`${mark} Copied ${copied.length} stamped path(s) from framework defaults:`);for(const path of copied)console.log(` - ${path}`);console.log(" \u2192 These now shadow storage/framework/defaults/; `buddy upgrade` will not update them.")}else if(featurePathsPresent(feature).length>0)console.log(` \u2192 ${feature} files already in the project - use --force to overwrite.`)}else{const present=featurePathsPresent(feature).length;if(present>0)console.log(` \u2192 ${present} ${feature} path(s) already in the project; those shadow the framework defaults.`);else console.log(" \u2192 Runs from the framework defaults. `publish:action`/`publish:model` copies one file into app/ when you want to change it.")}if(dryRun){console.log(` \u2192 Dry run: nothing was written. Run it without --dry-run to install ${feature}.`);process.exit(ExitCode.Success)}await offerMigrate(feature);console.log(` \u2192 next ./buddy dev will boot with ${feature} loaded.`);process.exit(ExitCode.Success)}catch(err){console.error(`\u2717 Failed to install ${feature}:`,err);process.exit(ExitCode.FatalError)}});buddy.command(`${feature}:uninstall`,`Deactivate the ${feature} feature bundle.`).option("--keep-files",`Don't delete the ${feature} scaffolding (action/model/view files). Flip the flag only.`).option("--force",`Delete the ${feature} scaffolding even where you have edited it. Without this, changed files are kept.`).option("--dry-run",`Say what ${feature}:uninstall would change, and change nothing.`,{default:!1}).action(async(options)=>{try{const dryRun=isDryRun(options),mark=dryRun?"\xB7":"\u2713";switch(await setFeatureEnabled(feature,!1,{createIfMissing:!1,dryRun})){case"missing":console.log(`${mark} '${feature}' is already disabled (${configRel} is absent).`);break;case"flipped":console.log(dryRun?`${mark} Would disable '${feature}' in ${configRel}.`:`${mark} Disabled '${feature}' in ${configRel}. Custom config preserved.`);break;case"unchanged":console.log(`${mark} '${feature}' is already disabled in ${configRel}.`);break;case"created":console.log(`\u2717 Unexpected create on uninstall for ${feature}; please re-run with --force or report this bug.`);break}if(options.keepFiles){const stillPresent=featurePathsPresent(feature);if(stillPresent.length>0)console.log(` \u2192 ${stillPresent.length} stamped path(s) preserved (--keep-files).`)}else{const{removed,preserved}=await deleteFeatureFiles(feature,projectPath(),{force:options.force,dryRun});if(removed.length>0){console.log(dryRun?`${mark} Would remove ${removed.length} stamped path(s):`:`${mark} Removed ${removed.length} stamped path(s):`);for(const path of removed)console.log(` - ${path}`)}if(preserved.length>0){console.log(dryRun?` \u2192 Would keep ${preserved.length} path(s) you have edited (--force would remove them):`:` \u2192 Kept ${preserved.length} path(s) you have edited (re-run with --force to remove):`);for(const path of preserved)console.log(` - ${path}`)}}console.log(dryRun?` \u2192 Dry run: nothing was written or removed. Run it without --dry-run to uninstall ${feature}.`:` \u2192 next ./buddy dev will boot without ${feature}.`);process.exit(ExitCode.Success)}catch(err){console.error(`\u2717 Failed to uninstall ${feature}:`,err);process.exit(ExitCode.FatalError)}})}function registerStatus(buddy){buddy.command("features","Show which framework feature bundles are active.").action(async()=>{try{const{feature,overridesReady}=await import("@stacksjs/config");await overridesReady;const rows=FEATURE_NAMES.map((name)=>{const declared=readFeatureFlag(name),active=feature(name),migrations=featureMigrationCounts(name);return{name,declared,active,migrations,scaffolded:featurePathsPresent(name).length}}),enabled=rows.filter((r)=>r.active).length;console.log("");console.log(`Feature bundles (${enabled} of ${rows.length} active)`);console.log("");for(const row of rows){const mark=row.active?"\u2713":"\xB7",declared=row.declared==="absent"?"no config":row.declared==="unset"?"flag unset":`enabled: ${row.declared}`,parts=[`${mark} ${row.name.padEnd(11)}`,declared.padEnd(14)],total=row.migrations.active+row.migrations.hidden,plural=total===1?"migration":"migrations";if(total>0)parts.push(row.migrations.hidden>0?`${total} ${plural} (${row.migrations.hidden} hidden)`:`${total} ${plural}`);else parts.push("");console.log(` ${parts.join(" ")}`);if(row.declared===!0&&!row.active)console.log(` declared on but reading off - check \`env\` in config/${row.name}.ts against config.app.env`);if(row.declared===!1&&row.active)console.log(" declared off but reading on - a runtime override is in play");if(!row.active&&row.scaffolded>0)console.log(` ${row.scaffolded} scaffolded path(s) still present - \`./buddy ${row.name}:uninstall\` removes them`);if(row.active&&row.migrations.hidden>0)console.log(` ${row.migrations.hidden} migration(s) still hidden from a previous run - \`./buddy migrate\` restores them`)}console.log("");console.log(" ./buddy <feature>:install activates one, <feature>:uninstall turns it off.");console.log("");console.log("Config gates (switched by `enabled` in their config file)");console.log("");for(const[name,description]of Object.entries(CONFIG_GATES)){const declared=readFeatureFlag(name),label=declared==="absent"?"no config":declared==="unset"?"flag unset":`enabled: ${declared}`;console.log(` ${feature(name)?"\u2713":"\xB7"} ${name.padEnd(11)} ${label.padEnd(14)} ${description}`)}console.log("");process.exit(ExitCode.Success)}catch(err){console.error("\u2717 Failed to read feature status:",err);process.exit(ExitCode.FatalError)}})}export function features(buddy){registerStatus(buddy);for(const feature of FEATURE_NAMES)registerInstallPair(buddy,feature)}
|
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.243",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -96,68 +96,68 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@stacksjs/bumpx": "^0.2.25",
|
|
99
|
-
"@stacksjs/actions": "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.
|
|
108
|
-
"@stacksjs/cache": "0.75.
|
|
109
|
-
"@stacksjs/chat": "0.75.
|
|
99
|
+
"@stacksjs/actions": "0.75.243",
|
|
100
|
+
"@stacksjs/ai": "0.75.243",
|
|
101
|
+
"@stacksjs/alias": "0.75.243",
|
|
102
|
+
"@stacksjs/analytics": "0.75.243",
|
|
103
|
+
"@stacksjs/api": "0.75.243",
|
|
104
|
+
"@stacksjs/arrays": "0.75.243",
|
|
105
|
+
"@stacksjs/auth": "0.75.243",
|
|
106
|
+
"@stacksjs/browser-extension": "0.75.243",
|
|
107
|
+
"@stacksjs/build": "0.75.243",
|
|
108
|
+
"@stacksjs/cache": "0.75.243",
|
|
109
|
+
"@stacksjs/chat": "0.75.243",
|
|
110
110
|
"@stacksjs/clapp": "^0.2.16",
|
|
111
|
-
"@stacksjs/cli": "0.75.
|
|
112
|
-
"@stacksjs/cloud": "0.75.
|
|
113
|
-
"@stacksjs/cms": "0.75.
|
|
114
|
-
"@stacksjs/collections": "0.75.
|
|
115
|
-
"@stacksjs/commerce": "0.75.
|
|
116
|
-
"@stacksjs/config": "0.75.
|
|
117
|
-
"@stacksjs/database": "0.75.
|
|
118
|
-
"@stacksjs/desktop-build": "0.75.
|
|
119
|
-
"@stacksjs/dns": "0.75.
|
|
111
|
+
"@stacksjs/cli": "0.75.243",
|
|
112
|
+
"@stacksjs/cloud": "0.75.243",
|
|
113
|
+
"@stacksjs/cms": "0.75.243",
|
|
114
|
+
"@stacksjs/collections": "0.75.243",
|
|
115
|
+
"@stacksjs/commerce": "0.75.243",
|
|
116
|
+
"@stacksjs/config": "0.75.243",
|
|
117
|
+
"@stacksjs/database": "0.75.243",
|
|
118
|
+
"@stacksjs/desktop-build": "0.75.243",
|
|
119
|
+
"@stacksjs/dns": "0.75.243",
|
|
120
120
|
"@stacksjs/dnsx": "^0.2.3",
|
|
121
|
-
"@stacksjs/email": "0.75.
|
|
122
|
-
"@stacksjs/enums": "0.75.
|
|
123
|
-
"@stacksjs/env": "0.75.
|
|
124
|
-
"@stacksjs/error-handling": "0.75.
|
|
125
|
-
"@stacksjs/events": "0.75.
|
|
126
|
-
"@stacksjs/features": "0.75.
|
|
127
|
-
"@stacksjs/git": "0.75.
|
|
121
|
+
"@stacksjs/email": "0.75.243",
|
|
122
|
+
"@stacksjs/enums": "0.75.243",
|
|
123
|
+
"@stacksjs/env": "0.75.243",
|
|
124
|
+
"@stacksjs/error-handling": "0.75.243",
|
|
125
|
+
"@stacksjs/events": "0.75.243",
|
|
126
|
+
"@stacksjs/features": "0.75.243",
|
|
127
|
+
"@stacksjs/git": "0.75.243",
|
|
128
128
|
"@stacksjs/gitit": "^0.2.5",
|
|
129
|
-
"@stacksjs/health": "0.75.
|
|
129
|
+
"@stacksjs/health": "0.75.243",
|
|
130
130
|
"@stacksjs/httx": "^0.1.10",
|
|
131
|
-
"@stacksjs/image": "0.75.
|
|
132
|
-
"@stacksjs/lint": "0.75.
|
|
133
|
-
"@stacksjs/logging": "0.75.
|
|
134
|
-
"@stacksjs/notifications": "0.75.
|
|
135
|
-
"@stacksjs/objects": "0.75.
|
|
136
|
-
"@stacksjs/orm": "0.75.
|
|
137
|
-
"@stacksjs/path": "0.75.
|
|
138
|
-
"@stacksjs/payments": "0.75.
|
|
139
|
-
"@stacksjs/realtime": "0.75.
|
|
140
|
-
"@stacksjs/router": "0.75.
|
|
131
|
+
"@stacksjs/image": "0.75.243",
|
|
132
|
+
"@stacksjs/lint": "0.75.243",
|
|
133
|
+
"@stacksjs/logging": "0.75.243",
|
|
134
|
+
"@stacksjs/notifications": "0.75.243",
|
|
135
|
+
"@stacksjs/objects": "0.75.243",
|
|
136
|
+
"@stacksjs/orm": "0.75.243",
|
|
137
|
+
"@stacksjs/path": "0.75.243",
|
|
138
|
+
"@stacksjs/payments": "0.75.243",
|
|
139
|
+
"@stacksjs/realtime": "0.75.243",
|
|
140
|
+
"@stacksjs/router": "0.75.243",
|
|
141
141
|
"@stacksjs/rpx": "^0.11.54",
|
|
142
|
-
"@stacksjs/scheduler": "0.75.
|
|
143
|
-
"@stacksjs/search-engine": "0.75.
|
|
144
|
-
"@stacksjs/security": "0.75.
|
|
145
|
-
"@stacksjs/server": "0.75.
|
|
146
|
-
"@stacksjs/sites": "0.75.
|
|
147
|
-
"@stacksjs/skills": "0.75.
|
|
148
|
-
"@stacksjs/socials": "0.75.
|
|
149
|
-
"@stacksjs/storage": "0.75.
|
|
150
|
-
"@stacksjs/strings": "0.75.
|
|
142
|
+
"@stacksjs/scheduler": "0.75.243",
|
|
143
|
+
"@stacksjs/search-engine": "0.75.243",
|
|
144
|
+
"@stacksjs/security": "0.75.243",
|
|
145
|
+
"@stacksjs/server": "0.75.243",
|
|
146
|
+
"@stacksjs/sites": "0.75.243",
|
|
147
|
+
"@stacksjs/skills": "0.75.243",
|
|
148
|
+
"@stacksjs/socials": "0.75.243",
|
|
149
|
+
"@stacksjs/storage": "0.75.243",
|
|
150
|
+
"@stacksjs/strings": "0.75.243",
|
|
151
151
|
"@stacksjs/stx": "^0.2.604",
|
|
152
|
-
"@stacksjs/testing": "0.75.
|
|
153
|
-
"@stacksjs/tinker": "0.75.
|
|
152
|
+
"@stacksjs/testing": "0.75.243",
|
|
153
|
+
"@stacksjs/tinker": "0.75.243",
|
|
154
154
|
"@stacksjs/tlsx": "^0.13.19",
|
|
155
155
|
"@stacksjs/ts-cloud": "^0.16.58",
|
|
156
|
-
"@stacksjs/tunnel": "0.75.
|
|
157
|
-
"@stacksjs/types": "0.75.
|
|
158
|
-
"@stacksjs/ui": "0.75.
|
|
159
|
-
"@stacksjs/utils": "0.75.
|
|
160
|
-
"@stacksjs/validation": "0.75.
|
|
156
|
+
"@stacksjs/tunnel": "0.75.243",
|
|
157
|
+
"@stacksjs/types": "0.75.243",
|
|
158
|
+
"@stacksjs/ui": "0.75.243",
|
|
159
|
+
"@stacksjs/utils": "0.75.243",
|
|
160
|
+
"@stacksjs/validation": "0.75.243",
|
|
161
161
|
"ajv": "^8.20.0",
|
|
162
162
|
"ajv-formats": "^3.0.1",
|
|
163
163
|
"bun-plugin-stx": "^0.2.604",
|