@stacksjs/buddy 0.75.575 → 0.75.580

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 +1 @@
1
- import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{defineCommand}from"@stacksjs/cli";import{HQ_SERVICE_NAMES,resolveHqServices,runHqConnect,runHqStatus}from"../hq";async function hqConfig(){const{config,overridesReady}=await import("@stacksjs/config");await overridesReady.catch(()=>{});return{config:config.services??{},app:String(config.app?.name||"app")}}function browserCommand(url){if(process.platform==="darwin")return["open",url];if(process.platform==="win32")return["cmd","/c","start","",url];return["xdg-open",url]}function openBrowser(url){if(!process.stdout.isTTY||process.env.CI)return;Bun.spawn(browserCommand(url),{stdin:"ignore",stdout:"ignore",stderr:"ignore"}).unref()}function sleep(ms,signal){return new Promise((resolve)=>{if(signal?.aborted)return resolve();const done=()=>{clearTimeout(timer);signal?.removeEventListener("abort",done);resolve()};const timer=setTimeout(done,ms);signal?.addEventListener("abort",done,{once:true})})}export async function writeEnvEntries(entries,directory){const{envHasCiphertext,setEnv}=await import("@stacksjs/env");const file=join(directory,".env");const content=existsSync(file)?readFileSync(file,"utf8"):"";const plain=!envHasCiphertext(content);for(const[key,value]of Object.entries(entries)){const result=setEnv(key,value,{cwd:directory,plain});if(!result.success)throw new Error(result.error??`could not set ${key}`);process.env[key]=value}}function deps(signal){return{fetch:(input,init)=>fetch(input,init),print:(line)=>console.log(line),open:openBrowser,sleep,now:()=>Date.now(),writeEnv:async(entries)=>{const{projectPath}=await import("@stacksjs/path");await writeEnvEntries(entries,projectPath())},signal}}const connect=defineCommand({name:"hq:connect [...services]",description:"Connect this app to HQ services (BugHQ and LogHQ by default) and write their keys to .env",options:{"--no-open":"Print the approve link without opening the browser","--no-verify":"Skip sending a test log and a test error and reading them back","--timeout <seconds>":{description:"How long to wait for each approval",default:600}},examples:["buddy hq:connect","buddy hq:connect loghq","buddy hq:connect bughq loghq --no-open"],handle:async(options,...args)=>{const requested=args.flat().filter((value)=>typeof value==="string");const resolved=resolveHqServices(requested);if("error"in resolved){console.error(resolved.error);process.exit(1)}const flags=options;const seconds=Number(flags.timeout);const{config,app}=await hqConfig();const controller=new AbortController;const cancel=()=>controller.abort();process.once("SIGINT",cancel);try{const result=await runHqConnect(resolved.services,config,{app,open:flags.open!==false,verify:flags.verify!==false,timeoutMs:(Number.isFinite(seconds)&&seconds>0?seconds:600)*1000},deps(controller.signal));process.exit(controller.signal.aborted?130:result.ok?0:1)}finally{process.off("SIGINT",cancel)}}});const status=defineCommand({name:"hq:status",description:"Show usage against the allowance of each connected HQ service",examples:["buddy hq:status"],handle:async()=>{const{config}=await hqConfig();await runHqStatus(config,deps(),HQ_SERVICE_NAMES);process.exit(0)}});export function hq(buddy){connect(buddy);status(buddy)}
1
+ import{existsSync,readFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{defineCommand}from"@stacksjs/cli";import{HQ_SERVICE_NAMES,resolveHqServices,runHqConnect,runHqStatus,runSupportDoctor}from"../hq";import{runSupportVerification}from"../support-verification";import{runSupportDocsSync,selectSupportDocuments}from"../support-documentation";import{runSupportImport}from"../support-import";import{installSupportMessenger}from"../support-installation";import{version as frameworkVersion}from"../../package.json";async function hqConfig(){const{config,overridesReady}=await import("@stacksjs/config");await overridesReady.catch(()=>{});return{config:config.services??{},app:String(config.app?.name||"app")}}function browserCommand(url){if(process.platform==="darwin")return["open",url];if(process.platform==="win32")return["cmd","/c","start","",url];return["xdg-open",url]}function openBrowser(url){if(!process.stdout.isTTY||process.env.CI)return;Bun.spawn(browserCommand(url),{stdin:"ignore",stdout:"ignore",stderr:"ignore"}).unref()}function sleep(ms,signal){return new Promise((resolve)=>{if(signal?.aborted)return resolve();const done=()=>{clearTimeout(timer);signal?.removeEventListener("abort",done);resolve()};const timer=setTimeout(done,ms);signal?.addEventListener("abort",done,{once:true})})}export async function writeEnvEntries(entries,directory){const{envHasCiphertext,setEnv}=await import("@stacksjs/env");const file=join(directory,".env");const content=existsSync(file)?readFileSync(file,"utf8"):"";const plain=!envHasCiphertext(content);for(const[key,value]of Object.entries(entries)){const result=setEnv(key,value,{cwd:directory,plain});if(!result.success)throw new Error(result.error??`could not set ${key}`);process.env[key]=value}}function deps(signal){return{fetch:(input,init)=>fetch(input,init),print:(line)=>console.log(line),open:openBrowser,sleep,now:()=>Date.now(),writeEnv:async(entries)=>{const{projectPath}=await import("@stacksjs/path");await writeEnvEntries(entries,projectPath())},signal}}function connectCommand(supportOnly=false){return defineCommand({name:supportOnly?"support:install":"hq:connect [...services]",description:supportOnly?"Connect HQ.support and write its server keys to .env":"Connect this app to HQ services (BugHQ and LogHQ by default) and write their keys to .env",options:{"--no-open":"Print the approve link without opening the browser","--no-verify":"Skip service read checks and test log/error delivery","--timeout <seconds>":{description:"How long to wait for each approval",default:600},"--messenger":{description:"Explicitly mount the identified HQ.support messenger in the app layout",default:false},"--layout <path>":"App-local stx layout to mount the opt-in messenger in"},examples:supportOnly?["buddy support:install","buddy support:install --no-open"]:["buddy hq:connect","buddy hq:connect loghq","buddy hq:connect bughq loghq --no-open"],handle:async(options,...args)=>{const requested=args.flat().filter((value)=>typeof value==="string");const resolved=resolveHqServices(supportOnly?["supporthq"]:requested);if("error"in resolved){console.error(resolved.error);process.exit(1)}const flags=options;const seconds=Number(flags.timeout);const{config,app}=await hqConfig();const controller=new AbortController;const cancel=()=>controller.abort();process.once("SIGINT",cancel);try{const result=await runHqConnect(resolved.services,config,{app,open:flags.open!==false,verify:flags.verify!==false,timeoutMs:(Number.isFinite(seconds)&&seconds>0?seconds:600)*1000},deps(controller.signal));if(result.ok&&flags.messenger&&resolved.services.includes("supporthq")){const{projectPath,frameworkPath}=await import("@stacksjs/path");const{config:fullConfig}=await import("@stacksjs/config");const installed=await installSupportMessenger({...config,supporthq:{...config.supporthq,key:process.env.SUPPORTHQ_KEY||config.supporthq?.key,project:process.env.SUPPORTHQ_PROJECT_ID||config.supporthq?.project}},{directory:projectPath(),origin:String(fullConfig.app.url||""),frameworkVersion,componentSource:await Bun.file(frameworkPath("defaults/resources/components/HqSupport.stx")).text(),layout:flags.layout},deps(controller.signal));if(!installed){process.exitCode=1;return}}process.exit(controller.signal.aborted?130:result.ok?0:1)}finally{process.off("SIGINT",cancel)}}})}const connect=connectCommand();const install=connectCommand(true);const doctor=defineCommand({name:"support:doctor",description:"Check HQ.support configuration and read access without creating a conversation",handle:async()=>{const{config}=await hqConfig();const{config:fullConfig}=await import("@stacksjs/config");const result=await runSupportDoctor(config,deps(),{origin:fullConfig.app.url});process.exit(result.ok?0:1)}});const status=defineCommand({name:"hq:status [...services]",description:"Show usage against the allowance of each connected HQ service",examples:["buddy hq:status"],handle:async(...args)=>{const{config}=await hqConfig();const requested=args.flat().filter((value)=>typeof value==="string");const resolved=resolveHqServices(requested,HQ_SERVICE_NAMES);if("error"in resolved){console.error(resolved.error);process.exitCode=1;return}await runHqStatus(config,deps(),resolved.services);process.exit(0)}});const syncDocs=defineCommand({name:"support:sync-docs [...files]",description:"Synchronize explicitly selected Markdown documents as private draft support knowledge",options:{"--dry-run":{description:"Show selected sources without sending content",default:false},"--public":{description:"Explicitly make selected articles customer-visible",default:false},"--publish":{description:"Publish selected articles instead of keeping drafts",default:false},"--locale <locale>":{description:"Knowledge locale",default:"en"}},examples:["buddy support:sync-docs docs/getting-started.md --dry-run","buddy support:sync-docs docs/getting-started.md --public --publish"],async handle(options,...args){try{const{projectPath}=await import("@stacksjs/path");const files=args.flat().filter((value)=>typeof value==="string");const documents=await selectSupportDocuments(projectPath(),files,options);const{config}=await hqConfig();const ok=await runSupportDocsSync(config,documents,options,{fetch:(input,init)=>fetch(input,init),print:(line)=>console.log(line)});process.exitCode=ok?0:1}catch{console.error("Select one to twenty Markdown files inside this app, each up to 100 KB. No data was sent.");process.exitCode=1}}});const verify=defineCommand({name:"support:verify <origin>",description:"Publish a Stacks deployment challenge and confirm the permanent HQ.support free tier",options:{"--confirm":{description:"Confirm the public challenge after deployment",default:false}},examples:["buddy support:verify https://my-app.example","buddy support:verify https://my-app.example --confirm"],async handle(options,origin){const{config}=await hqConfig();const{projectPath}=await import("@stacksjs/path");const statePath=projectPath("storage/framework/runtime/support-verification.json");const ok=await runSupportVerification(config,String(origin||""),{confirm:options.confirm,frameworkVersion},{fetch:(input,init)=>fetch(input,init),print:(line)=>console.log(line),writeDocument:async(document)=>{await Bun.write(projectPath("public/.well-known/hq-support"),JSON.stringify(document))},readState:async()=>{try{return await Bun.file(statePath).json()}catch{return null}},writeState:async(state)=>{await Bun.write(statePath,JSON.stringify(state))}});process.exitCode=ok?0:1}});const importSupport=defineCommand({name:"support:import <provider> [file]",description:"Preview or resume a private Intercom migration using the connected support project",options:{"--dry-run":{description:"Run the server compatibility rehearsal without importing data",default:false},"--resume <id>":"Resume a saved migration run","--status <id>":"Read counts and status without reading customer transcripts"},examples:["buddy support:import intercom export.json --dry-run","buddy support:import intercom export.json","buddy support:import intercom --resume 1"],async handle(options,provider,file){if(provider!=="intercom"){console.error("The supported migration provider is intercom.");process.exitCode=1;return}const{config}=await hqConfig();const ok=await runSupportImport(config,{file:typeof file==="string"?file:undefined,...options},{fetch:(input,init)=>fetch(input,init),print:(line)=>console.log(line)});process.exitCode=ok?0:1}});export function hq(buddy){connect(buddy);status(buddy);install(buddy);doctor(buddy);verify(buddy);syncDocs(buddy);importSupport(buddy)}
@@ -1,2 +1,2 @@
1
- import process from"node:process";export const PROBE_TARGETS=[{name:"FCM HTTP v1",url:"https://fcm.googleapis.com/v1/projects/stacks-probe/messages:send",method:"POST",observed:401},{name:"OpenAI",url:"https://api.openai.com/v1/models",method:"GET",observed:401},{name:"Anthropic",url:"https://api.anthropic.com/v1/messages",method:"POST",observed:401},{name:"SendGrid",url:"https://api.sendgrid.com/v3/mail/send",method:"POST",observed:401},{name:"Twilio",url:"https://api.twilio.com/2010-04-01/Accounts",method:"GET",observed:401},{name:"Twilio Lookups v2",url:"https://lookups.twilio.com/v2/PhoneNumbers/+15005550006",method:"GET",observed:401},{name:"Twilio Verify v2",url:"https://verify.twilio.com/v2/Services",method:"GET",observed:401},{name:"Google id_token signing keys",url:"https://www.googleapis.com/oauth2/v3/certs",method:"GET",observed:200},{name:"Google tokeninfo",url:"https://oauth2.googleapis.com/tokeninfo",method:"GET",observed:400},{name:"Apple id_token signing keys",url:"https://appleid.apple.com/auth/keys",method:"GET",observed:200},{name:"Discord",url:"https://discord.com/api/v10/users/@me",method:"GET",observed:401},{name:"Mozilla add-ons v5",url:"https://addons.mozilla.org/api/v5/addons/search/?q=test",method:"GET",observed:200},{name:"Hetzner Cloud",url:"https://api.hetzner.cloud/v1/servers",method:"GET",observed:401},{name:"fiskaly SIGN DE v2",url:"https://kassensichv-middleware.fiskaly.com/api/v2/tss",method:"GET",observed:401},{name:"Lemon Squeezy",url:"https://api.lemonsqueezy.com/v1/products",method:"GET",observed:401},{name:"Vonage Messages v1",url:"https://api.nexmo.com/v1/messages",method:"POST",observed:401},{name:"Vonage Verify v2",url:"https://api.nexmo.com/v2/verify",method:"POST",observed:422},{name:"Expo push",url:"https://exp.host/--/api/v2/push/send",method:"POST",observed:400},{name:"Threads",url:"https://graph.threads.net/v1.0/me",method:"GET",observed:400},{name:"Meta Graph",url:"https://graph.facebook.com/v24.0/me",method:"GET",observed:400},{name:"LinkedIn",url:"https://api.linkedin.com/rest/me",method:"GET",observed:401},{name:"GitHub",url:"https://api.github.com/user",method:"GET",observed:401}];export const PROBE_CONTROLS=[{name:"FCM legacy send (decommissioned 2024-06-20)",url:"https://fcm.googleapis.com/fcm/send",method:"POST",observed:404},{name:"GitHub, a path that cannot exist",url:"https://api.github.com/stacks-probe-control-does-not-exist",method:"GET",observed:404},{name:"OpenAI, a path that cannot exist",url:"https://api.openai.com/v1/stacks-probe-control-does-not-exist",method:"GET",observed:404}];export function classifyStatus(status){if(status===null)return"inconclusive";if(status===404||status===410)return"gone";if(status>=500)return"inconclusive";return"alive"}export function concludeProbe(targets,controls){if(controls.length===0)return"untrustworthy";if(controls.some((result)=>result.verdict!=="gone"))return"untrustworthy";if(targets.some((result)=>result.verdict==="gone"))return"withdrawn";if(targets.some((result)=>result.verdict==="inconclusive"))return"inconclusive";return"ok"}export function exitCodeFor(conclusion){if(conclusion==="withdrawn")return 1;if(conclusion==="ok")return 0;return 2}export function renderReport(targets,controls,conclusion){const row=(result)=>{const status=result.status===null?"no answer":String(result.status);const moved=result.status!==null&&result.status!==result.target.observed?` (was ${result.target.observed})`:"";return`| ${result.target.name} | ${result.target.method} | ${status}${moved} | ${result.verdict} |`};const headline={ok:"Every endpoint this framework calls is still answering.",withdrawn:"An endpoint this framework calls has been withdrawn.",untrustworthy:"This run proves nothing: a control that must read as gone did not, so something is answering for the network.",inconclusive:"No conclusion: something did not answer. The controls were sound, so this is likely a transient failure."}[conclusion];return[`## Integration sunset probe`,"",headline,"","| Endpoint | Method | Status | Verdict |","| --- | --- | --- | --- |",...targets.map(row),"","### Controls","","Paths that must read as gone. If any does not, the table above says nothing.","","| Control | Method | Status | Verdict |","| --- | --- | --- | --- |",...controls.map(row),"","No credential is sent by any request here, which is what makes the signal readable: an endpoint that exists rejects an unauthenticated request, and one that is gone answers 404."].join(`
1
+ import process from"node:process";export const PROBE_TARGETS=[{name:"FCM HTTP v1",url:"https://fcm.googleapis.com/v1/projects/stacks-probe/messages:send",method:"POST",observed:401},{name:"OpenAI",url:"https://api.openai.com/v1/models",method:"GET",observed:401},{name:"Anthropic",url:"https://api.anthropic.com/v1/messages",method:"POST",observed:401},{name:"SendGrid",url:"https://api.sendgrid.com/v3/mail/send",method:"POST",observed:401},{name:"Twilio",url:"https://api.twilio.com/2010-04-01/Accounts",method:"GET",observed:401},{name:"Twilio Lookups v2",url:"https://lookups.twilio.com/v2/PhoneNumbers/+15005550006",method:"GET",observed:401},{name:"Twilio Verify v2",url:"https://verify.twilio.com/v2/Services",method:"GET",observed:401},{name:"Twilio WhatsApp Senders v2",url:"https://messaging.twilio.com/v2/Channels/Senders",method:"GET",observed:401},{name:"Twilio Content v1",url:"https://content.twilio.com/v1/Content",method:"GET",observed:401},{name:"Google id_token signing keys",url:"https://www.googleapis.com/oauth2/v3/certs",method:"GET",observed:200},{name:"Google tokeninfo",url:"https://oauth2.googleapis.com/tokeninfo",method:"GET",observed:400},{name:"Apple id_token signing keys",url:"https://appleid.apple.com/auth/keys",method:"GET",observed:200},{name:"Discord",url:"https://discord.com/api/v10/users/@me",method:"GET",observed:401},{name:"Mozilla add-ons v5",url:"https://addons.mozilla.org/api/v5/addons/search/?q=test",method:"GET",observed:200},{name:"Hetzner Cloud",url:"https://api.hetzner.cloud/v1/servers",method:"GET",observed:401},{name:"fiskaly SIGN DE v2",url:"https://kassensichv-middleware.fiskaly.com/api/v2/tss",method:"GET",observed:401},{name:"Lemon Squeezy",url:"https://api.lemonsqueezy.com/v1/products",method:"GET",observed:401},{name:"Vonage Messages v1",url:"https://api.nexmo.com/v1/messages",method:"POST",observed:401},{name:"Vonage Verify v2",url:"https://api.nexmo.com/v2/verify",method:"POST",observed:422},{name:"Expo push",url:"https://exp.host/--/api/v2/push/send",method:"POST",observed:400},{name:"Threads",url:"https://graph.threads.net/v1.0/me",method:"GET",observed:400},{name:"Meta Graph",url:"https://graph.facebook.com/v24.0/me",method:"GET",observed:400},{name:"LinkedIn",url:"https://api.linkedin.com/rest/me",method:"GET",observed:401},{name:"GitHub",url:"https://api.github.com/user",method:"GET",observed:401}];export const PROBE_CONTROLS=[{name:"FCM legacy send (decommissioned 2024-06-20)",url:"https://fcm.googleapis.com/fcm/send",method:"POST",observed:404},{name:"GitHub, a path that cannot exist",url:"https://api.github.com/stacks-probe-control-does-not-exist",method:"GET",observed:404},{name:"OpenAI, a path that cannot exist",url:"https://api.openai.com/v1/stacks-probe-control-does-not-exist",method:"GET",observed:404}];export function classifyStatus(status){if(status===null)return"inconclusive";if(status===404||status===410)return"gone";if(status>=500)return"inconclusive";return"alive"}export function concludeProbe(targets,controls){if(controls.length===0)return"untrustworthy";if(controls.some((result)=>result.verdict!=="gone"))return"untrustworthy";if(targets.some((result)=>result.verdict==="gone"))return"withdrawn";if(targets.some((result)=>result.verdict==="inconclusive"))return"inconclusive";return"ok"}export function exitCodeFor(conclusion){if(conclusion==="withdrawn")return 1;if(conclusion==="ok")return 0;return 2}export function renderReport(targets,controls,conclusion){const row=(result)=>{const status=result.status===null?"no answer":String(result.status);const moved=result.status!==null&&result.status!==result.target.observed?` (was ${result.target.observed})`:"";return`| ${result.target.name} | ${result.target.method} | ${status}${moved} | ${result.verdict} |`};const headline={ok:"Every endpoint this framework calls is still answering.",withdrawn:"An endpoint this framework calls has been withdrawn.",untrustworthy:"This run proves nothing: a control that must read as gone did not, so something is answering for the network.",inconclusive:"No conclusion: something did not answer. The controls were sound, so this is likely a transient failure."}[conclusion];return[`## Integration sunset probe`,"",headline,"","| Endpoint | Method | Status | Verdict |","| --- | --- | --- | --- |",...targets.map(row),"","### Controls","","Paths that must read as gone. If any does not, the table above says nothing.","","| Control | Method | Status | Verdict |","| --- | --- | --- | --- |",...controls.map(row),"","No credential is sent by any request here, which is what makes the signal readable: an endpoint that exists rejects an unauthenticated request, and one that is gone answers 404."].join(`
2
2
  `)}async function probe(target,timeoutMs){try{const response=await fetch(target.url,{method:target.method,redirect:"manual",signal:AbortSignal.timeout(timeoutMs)});return{target,status:response.status,verdict:classifyStatus(response.status)}}catch{return{target,status:null,verdict:"inconclusive"}}}async function probeAll(targets,timeoutMs,concurrency=4){const results=[];for(let index=0;index<targets.length;index+=concurrency)results.push(...await Promise.all(targets.slice(index,index+concurrency).map((target)=>probe(target,timeoutMs))));return results}export function integrationsProbe(buddy){buddy.command("integrations:probe","Check whether the third-party endpoints this framework calls still exist (sends no credentials)").option("--timeout <ms>","How long to wait for each endpoint",{default:"12000"}).option("--json","Print the results as JSON instead of a report",{default:false}).action(async(options)=>{const timeoutMs=Number.parseInt(String(options.timeout??"12000"),10)||12000;const controls=await probeAll(PROBE_CONTROLS,timeoutMs);const targets=await probeAll(PROBE_TARGETS,timeoutMs);const conclusion=concludeProbe(targets,controls);if(options.json)console.log(JSON.stringify({conclusion,targets,controls},null,2));else console.log(renderReport(targets,controls,conclusion));process.exit(exitCodeFor(conclusion))})}
package/dist/hq.d.ts CHANGED
@@ -19,6 +19,8 @@ export declare function runHqConnect(services: HqServiceName[], config: HqServic
19
19
  export declare function describeReportsHqLicense(license: string | undefined): string;
20
20
  /** Usage against each connected service's allowance. A service with no read key is not connected and is left out. */
21
21
  export declare function runHqStatus(config: HqServicesConfig, deps: Pick<HqCliDeps, 'fetch' | 'print'>, services?: HqServiceName[]): Promise<HqStatusRow[]>;
22
+ /** Read-only checks. A doctor never sends a test customer conversation. */
23
+ export declare function runSupportDoctor(config: HqServicesConfig, deps: Pick<HqCliDeps, 'fetch' | 'print'>, options?: { origin?: string }): Promise<SupportDoctorResult>;
22
24
  /**
23
25
  * @defaultValue
24
26
  * ```ts
@@ -41,6 +43,15 @@ export declare function runHqStatus(config: HqServicesConfig, deps: Pick<HqCliDe
41
43
  * label: 'StatusHQ',
42
44
  * env: { key: 'STATUSHQ_KEY', readKey: 'STATUSHQ_READ_KEY' }
43
45
  * },
46
+ * supporthq: {
47
+ * label: 'HQ.support',
48
+ * env: {
49
+ * key: 'SUPPORTHQ_KEY',
50
+ * readKey: 'SUPPORTHQ_READ_KEY',
51
+ * project: 'SUPPORTHQ_PROJECT_ID'
52
+ * },
53
+ * verify: 'support'
54
+ * },
44
55
  * commshq: { label: 'CommsHQ', env: { key: 'COMMSHQ_KEY', readKey: 'COMMSHQ_READ_KEY' } },
45
56
  * reportshq: { label: 'ReportsHQ', env: { license: 'REPORTSHQ_LICENSE' } }
46
57
  * }
@@ -62,7 +73,7 @@ export declare const HQ_DEFAULT_SERVICES: HqServiceName[];
62
73
  export declare interface HqServiceDescriptor {
63
74
  label: string
64
75
  env: { key?: string, readKey?: string, project?: string, license?: string }
65
- verify?: 'log' | 'error'
76
+ verify?: 'log' | 'error' | 'support'
66
77
  }
67
78
  export declare interface HqCliDeps {
68
79
  fetch: (input: string, init?: RequestInit) => Promise<Response>
@@ -104,6 +115,10 @@ export declare interface HqStatusRow {
104
115
  upgradeUrl?: string
105
116
  unavailable?: string
106
117
  }
118
+ export declare interface SupportDoctorResult {
119
+ ok: boolean
120
+ checks: { name: 'configuration' | 'usage' | 'conversations' | 'installation' | 'widget', ok: boolean, detail: string }[]
121
+ }
107
122
  export type HqConnectStatus = | 'connected'
108
123
  /** The service answered 404 on the connect route: it has not shipped the contract. */
109
124
  | 'unavailable'
package/dist/hq.js CHANGED
@@ -1 +1 @@
1
- import{createHqClient}from"@stacksjs/hq/client";export const HQ_SERVICES={bughq:{label:"BugHQ",env:{key:"BUGHQ_KEY",readKey:"BUGHQ_READ_KEY",project:"BUGHQ_PROJECT_ID"},verify:"error"},loghq:{label:"LogHQ",env:{key:"LOGHQ_KEY",readKey:"LOGHQ_READ_KEY",project:"LOGHQ_PROJECT_ID"},verify:"log"},analyticshq:{label:"AnalyticsHQ",env:{readKey:"ANALYTICSHQ_READ_KEY",project:"ANALYTICSHQ_SITE_ID"}},statushq:{label:"StatusHQ",env:{key:"STATUSHQ_KEY",readKey:"STATUSHQ_READ_KEY"}},commshq:{label:"CommsHQ",env:{key:"COMMSHQ_KEY",readKey:"COMMSHQ_READ_KEY"}},reportshq:{label:"ReportsHQ",env:{license:"REPORTSHQ_LICENSE"}}};export const HQ_SERVICE_NAMES=Object.keys(HQ_SERVICES);export const HQ_DEFAULT_SERVICES=["bughq","loghq"];const REQUEST_TIMEOUT_MS=1e4;function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function origin(url){return url.replace(/\/+$/,"")}function httpUrl(value,base){if(typeof value!=="string"||!value)return null;try{const url=new URL(value,base);return url.protocol==="https:"||url.protocol==="http:"?url.toString():null}catch{return null}}function toGrant(body,base,licensed){const project=body.project;if(!isRecord(project)||project.id==null)return null;if(licensed){if(typeof body.licenseKey!=="string"||!body.licenseKey)return null;return{project:{id:String(project.id),name:String(project.name??project.id)},ingestKey:"",readKey:"",licenseKey:body.licenseKey,dashboardUrl:httpUrl(body.dashboardUrl,base)??""}}if(typeof body.ingestKey!=="string"||typeof body.readKey!=="string")return null;if(!body.ingestKey||!body.readKey)return null;return{project:{id:String(project.id),name:String(project.name??project.id)},ingestKey:body.ingestKey,readKey:body.readKey,dashboardUrl:httpUrl(body.dashboardUrl,base)??""}}async function request(deps,url,init={}){const signals=[AbortSignal.timeout(REQUEST_TIMEOUT_MS),...deps.signal?[deps.signal]:[]];try{return await deps.fetch(url,{...init,signal:AbortSignal.any(signals)})}catch{return null}}function retryAfterMs(response,fallback){const seconds=Number(response.headers.get("retry-after"));return Number.isFinite(seconds)&&seconds>0?Math.min(seconds,60)*1000:fallback}export function resolveHqServices(requested,fallback=HQ_DEFAULT_SERVICES){const names=requested.map((name)=>name.trim().toLowerCase()).filter(Boolean);if(!names.length)return{services:[...fallback]};const unknown=names.filter((name)=>!(name in HQ_SERVICES));if(unknown.length)return{error:`Unknown service: ${unknown.join(", ")}. Choose from ${HQ_SERVICE_NAMES.join(", ")}.`};return{services:[...new Set(names)]}}async function connectOne(service,url,options,deps){const{label}=HQ_SERVICES[service];const base=origin(url);const outcome=(status,detail)=>({outcome:{service,status,detail,send:"skipped",read:"skipped"}});const started=await request(deps,`${base}/api/cli/connect`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({app:options.app})});if(deps.signal?.aborted)return outcome("cancelled","cancelled");if(!started)return outcome("unreachable",`could not reach ${base}`);if(started.status===404||started.status===405)return outcome("unavailable","not available yet");if(started.status===429)return outcome("failed","too many requests, try again in a minute");if(!started.ok)return outcome("failed",`the service answered ${started.status}`);const body=await started.json().catch(()=>null);const code=isRecord(body)&&typeof body.code==="string"&&/^[\w-]{16,128}$/.test(body.code)?body.code:null;const approveUrl=isRecord(body)?httpUrl(body.approveUrl,base):null;if(!code||!approveUrl)return outcome("failed","the service answered something that is not a connect code");const confirmCode=isRecord(body)&&typeof body.confirmCode==="string"&&/^[\w-]{1,32}$/.test(body.confirmCode)?body.confirmCode:null;deps.print("");deps.print(`${label}: approve this connection in your browser`);deps.print(` ${approveUrl}`);if(confirmCode)deps.print(` Confirmation code: ${confirmCode} (type it on that page)`);deps.print(" If the page asks you to sign in, sign in and open the link again.");deps.print(" Waiting for approval. Press Ctrl+C to cancel.");if(options.open!==false){try{await deps.open(approveUrl)}catch{}}const interval=options.pollIntervalMs??2000;const deadline=deps.now()+(options.timeoutMs??10*60*1000);const pollUrl=`${base}/api/cli/connect/${encodeURIComponent(code)}`;while(true){if(deps.signal?.aborted)return outcome("cancelled","cancelled");if(deps.now()>=deadline)return outcome("timeout","nobody approved it in time");await deps.sleep(Math.min(interval,Math.max(0,deadline-deps.now())),deps.signal);if(deps.signal?.aborted)return outcome("cancelled","cancelled");const polled=await request(deps,pollUrl,{headers:{Accept:"application/json"}});if(!polled)continue;if(polled.status===429){await deps.sleep(retryAfterMs(polled,interval),deps.signal);continue}if(polled.status===404)return outcome("expired","the request expired, run the command again");if(!polled.ok)return outcome("failed",`the service answered ${polled.status}`);const answer=await polled.json().catch(()=>null);if(!isRecord(answer)||answer.status==="pending")continue;if(answer.status==="expired")return outcome("expired","the request expired, run the command again");const grant=toGrant(answer,base,Boolean(HQ_SERVICES[service].env.license));if(!grant)return outcome("failed","the service approved the request without sending keys");return{grant,outcome:{service,status:"connected",project:grant.project.name,dashboardUrl:grant.dashboardUrl||undefined,send:"skipped",read:"skipped"}}}}function envEntries(service,grant){const names=HQ_SERVICES[service].env;const entries={};if(names.license&&grant.licenseKey)return{[names.license]:grant.licenseKey};if(names.key)entries[names.key]=grant.ingestKey;if(names.readKey)entries[names.readKey]=grant.readKey;if(names.project)entries[names.project]=grant.project.id;return entries}async function verify(service,url,grant,options,deps){const kind=HQ_SERVICES[service].verify;if(!kind)return{send:"skipped",read:"skipped"};const base=origin(url);const marker=`hq-connect-${crypto.randomUUID().slice(0,8)}`;const message=`buddy hq:connect test ${marker}`;const timestamp=new Date(deps.now()).toISOString();const sent=kind==="log"?await request(deps,`${base}/logs`,{method:"POST",headers:{"Content-Type":"application/json","X-LogHQ-Key":grant.ingestKey},body:JSON.stringify({logs:[{level:"info",message,timestamp,context:{source:"buddy hq:connect"}}]})}):await request(deps,`${base}/errors`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:grant.ingestKey,type:"HqConnectTest",message,level:"info",environment:"hq-connect",timestamp,sdk:{name:"buddy.hq-connect"}})});if(!sent?.ok)return{send:"fail",read:"skipped",detail:sent?`sending the test ${kind} answered ${sent.status}`:`sending the test ${kind} did not get through`};const receipt=await sent.json().catch(()=>null);if(isRecord(receipt)&&(receipt.sampled===true||receipt.stored===0))return{send:"pass",read:"skipped",detail:`the plan allowance is used up, so the test ${kind} was not kept`};const client=createHqClient({services:{[service]:{url:base,readKey:grant.readKey,project:grant.project.id}},timeoutMs:REQUEST_TIMEOUT_MS,fetch:(input,init)=>deps.fetch(input,init)});let reason=`the test ${kind} was accepted but did not show up`;const attempts=options.readAttempts??5;for(let attempt=0;attempt<attempts;attempt++){if(attempt>0)await deps.sleep(1000,deps.signal);if(deps.signal?.aborted)return{send:"pass",read:"fail",detail:"cancelled"};if(kind==="log"){const page=await client.logs.list({search:marker,limit:5});if(page.ok&&page.data.logs.some((log)=>log.message.includes(marker)))return{send:"pass",read:"pass"};if(!page.ok)reason=describeUnavailable(page)}else{const list=await client.issues.list();if(list.ok&&list.data.some((issue)=>issue.title.includes(marker)))return{send:"pass",read:"pass"};if(!list.ok)reason=describeUnavailable(list)}}return{send:"pass",read:"fail",detail:reason}}export function describeUnavailable(result){switch(result.reason){case"not_configured":return"not connected";case"unauthorized":return"the read key was refused";case"timeout":return"the service did not answer in time";case"network":return"the service could not be reached";case"http":return result.status===404?"not available yet":`the service answered ${result.status}`;case"bad_response":return"the service answered something unexpected"}}export function renderTable(headers,rows){const widths=headers.map((header,column)=>Math.max(header.length,...rows.map((row)=>(row[column]??"").length)));const line=(cells)=>cells.map((cell,column)=>(cell??"").padEnd(widths[column])).join(" ").trimEnd();return[line(headers),line(widths.map((width)=>"-".repeat(width))),...rows.map(line)]}const CONNECT_WORDS={connected:"pass",unavailable:"not available yet",unreachable:"fail",expired:"fail",timeout:"fail",cancelled:"cancelled",failed:"fail"};const CHECK_WORDS={pass:"pass",fail:"fail",skipped:"-"};export function connectTable(outcomes){return renderTable(["Service","Connect","Send","Read back","Note"],outcomes.map((outcome)=>[HQ_SERVICES[outcome.service].label,CONNECT_WORDS[outcome.status],CHECK_WORDS[outcome.send],CHECK_WORDS[outcome.read],outcome.status==="unavailable"?"":outcome.detail??""]))}export async function runHqConnect(services,config,options,deps){const outcomes=[];for(const service of services){const{label}=HQ_SERVICES[service];if(deps.signal?.aborted){outcomes.push({service,status:"cancelled",detail:"cancelled",send:"skipped",read:"skipped"});continue}const url=config[service]?.url;if(!url){outcomes.push({service,status:"failed",detail:"no URL is configured in config/services.ts",send:"skipped",read:"skipped"});continue}const{outcome,grant}=await connectOne(service,url,options,deps);if(!grant){if(outcome.status==="unavailable")deps.print(`${label}: not available yet`);else if(outcome.status!=="cancelled")deps.print(`${label}: not connected (${outcome.detail})`);outcomes.push(outcome);continue}try{await deps.writeEnv(envEntries(service,grant))}catch(error){const why=error instanceof Error?error.message:"unknown error";deps.print(`${label}: approved, but the keys could not be written to .env (${why})`);outcomes.push({...outcome,status:"failed",detail:"the keys could not be written to .env"});continue}deps.print(grant.licenseKey?`${label}: licensed "${grant.project.name}". Licence written to .env.`:`${label}: connected to project "${grant.project.name}". Keys written to .env.`);if(grant.dashboardUrl)deps.print(` Dashboard: ${grant.dashboardUrl}`);if(options.verify===false){outcomes.push(outcome);continue}outcomes.push({...outcome,...await verify(service,url,grant,options,deps)})}if(deps.signal?.aborted)deps.print("Cancelled. Services already connected keep their keys.");deps.print("");for(const line of connectTable(outcomes))deps.print(line);const ok=outcomes.every((outcome)=>outcome.status==="unavailable"||outcome.status==="connected"&&outcome.send!=="fail"&&outcome.read!=="fail");return{outcomes,ok}}const count=(value)=>value.toLocaleString("en-US");const REPORTSHQ_LICENSE=/^rhq_lic_[0-9a-f]{32}$/;export function describeReportsHqLicense(license){if(!license)return"unlicensed. Reports work in full; set REPORTSHQ_LICENSE to remove the notice";return REPORTSHQ_LICENSE.test(license)?"licensed (checked offline, nothing is metered)":"the licence key is not in the expected format. Reports are unaffected"}export async function runHqStatus(config,deps,services=HQ_SERVICE_NAMES){const connected=services.filter((service)=>config[service]?.url&&config[service]?.readKey);const license=services.includes("reportshq")?config.reportshq?.license:undefined;if(!connected.length&&!license){deps.print("No HQ service is connected yet. Run `buddy hq:connect` to connect one.");return[]}const client=createHqClient({services:Object.fromEntries(connected.map((service)=>[service,{url:config[service].url,readKey:config[service].readKey}])),timeoutMs:REQUEST_TIMEOUT_MS,fetch:(input,init)=>deps.fetch(input,init)});const rows=[];for(const[index,usage]of(await Promise.all(connected.map((service)=>client.getUsage(service)))).entries()){const service=connected[index];if(!usage.ok){rows.push({service,unavailable:describeUnavailable(usage)});continue}if(!usage.data.length)rows.push({service,unavailable:"no meters reported"});for(const report of usage.data){const over=report.limit!==null&&report.limit>0&&report.used/report.limit>=0.8;rows.push({service,meter:report.meter,used:report.used,limit:report.limit,period:report.period,state:report.state,...over?{upgradeUrl:report.upgradeUrl}:{}})}}if(license)rows.push({service:"reportshq",unavailable:describeReportsHqLicense(license)});const table=renderTable(["Service","Meter","Used","Limit","Period","State"],rows.map((row)=>row.unavailable?[HQ_SERVICES[row.service].label,row.unavailable]:[HQ_SERVICES[row.service].label,row.meter,count(row.used),row.limit===null?"unlimited":count(row.limit),row.period,row.state]));for(const line of table)deps.print(line);const upgrades=rows.filter((row)=>row.upgradeUrl);if(upgrades.length)deps.print("");for(const row of upgrades){const percent=Math.round(row.used/row.limit*100);deps.print(`${HQ_SERVICES[row.service].label} ${row.meter} is at ${percent}% of its allowance. Upgrade: ${row.upgradeUrl}`)}return rows}
1
+ import{createHqClient}from"@stacksjs/hq/client";export const HQ_SERVICES={bughq:{label:"BugHQ",env:{key:"BUGHQ_KEY",readKey:"BUGHQ_READ_KEY",project:"BUGHQ_PROJECT_ID"},verify:"error"},loghq:{label:"LogHQ",env:{key:"LOGHQ_KEY",readKey:"LOGHQ_READ_KEY",project:"LOGHQ_PROJECT_ID"},verify:"log"},analyticshq:{label:"AnalyticsHQ",env:{readKey:"ANALYTICSHQ_READ_KEY",project:"ANALYTICSHQ_SITE_ID"}},statushq:{label:"StatusHQ",env:{key:"STATUSHQ_KEY",readKey:"STATUSHQ_READ_KEY"}},supporthq:{label:"HQ.support",env:{key:"SUPPORTHQ_KEY",readKey:"SUPPORTHQ_READ_KEY",project:"SUPPORTHQ_PROJECT_ID"},verify:"support"},commshq:{label:"CommsHQ",env:{key:"COMMSHQ_KEY",readKey:"COMMSHQ_READ_KEY"}},reportshq:{label:"ReportsHQ",env:{license:"REPORTSHQ_LICENSE"}}};export const HQ_SERVICE_NAMES=Object.keys(HQ_SERVICES);export const HQ_DEFAULT_SERVICES=["bughq","loghq"];const REQUEST_TIMEOUT_MS=1e4;function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}function origin(url){return url.replace(/\/+$/,"")}function httpUrl(value,base){if(typeof value!=="string"||!value)return null;try{const url=new URL(value,base);return url.protocol==="https:"||url.protocol==="http:"?url.toString():null}catch{return null}}function toGrant(body,base,licensed){const project=body.project;if(!isRecord(project)||project.id==null)return null;if(licensed){if(typeof body.licenseKey!=="string"||!body.licenseKey)return null;return{project:{id:String(project.id),name:String(project.name??project.id)},ingestKey:"",readKey:"",licenseKey:body.licenseKey,dashboardUrl:httpUrl(body.dashboardUrl,base)??""}}if(typeof body.ingestKey!=="string"||typeof body.readKey!=="string")return null;if(!body.ingestKey||!body.readKey)return null;return{project:{id:String(project.id),name:String(project.name??project.id)},ingestKey:body.ingestKey,readKey:body.readKey,dashboardUrl:httpUrl(body.dashboardUrl,base)??""}}async function request(deps,url,init={}){const signals=[AbortSignal.timeout(REQUEST_TIMEOUT_MS),...deps.signal?[deps.signal]:[]];try{return await deps.fetch(url,{...init,signal:AbortSignal.any(signals)})}catch{return null}}function retryAfterMs(response,fallback){const seconds=Number(response.headers.get("retry-after"));return Number.isFinite(seconds)&&seconds>0?Math.min(seconds,60)*1000:fallback}export function resolveHqServices(requested,fallback=HQ_DEFAULT_SERVICES){const names=requested.map((name)=>name.trim().toLowerCase()).filter(Boolean);if(!names.length)return{services:[...fallback]};const unknown=names.filter((name)=>!(name in HQ_SERVICES));if(unknown.length)return{error:`Unknown service: ${unknown.join(", ")}. Choose from ${HQ_SERVICE_NAMES.join(", ")}.`};return{services:[...new Set(names)]}}async function connectOne(service,url,options,deps){const{label}=HQ_SERVICES[service];const base=origin(url);const outcome=(status,detail)=>({outcome:{service,status,detail,send:"skipped",read:"skipped"}});const started=await request(deps,`${base}/api/cli/connect`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({app:options.app})});if(deps.signal?.aborted)return outcome("cancelled","cancelled");if(!started)return outcome("unreachable",`could not reach ${base}`);if(started.status===404||started.status===405)return outcome("unavailable","not available yet");if(started.status===429)return outcome("failed","too many requests, try again in a minute");if(!started.ok)return outcome("failed",`the service answered ${started.status}`);const body=await started.json().catch(()=>null);const code=isRecord(body)&&typeof body.code==="string"&&/^[\w-]{16,128}$/.test(body.code)?body.code:null;const approveUrl=isRecord(body)?httpUrl(body.approveUrl,base):null;if(!code||!approveUrl)return outcome("failed","the service answered something that is not a connect code");const confirmCode=isRecord(body)&&typeof body.confirmCode==="string"&&/^[\w-]{1,32}$/.test(body.confirmCode)?body.confirmCode:null;deps.print("");deps.print(`${label}: approve this connection in your browser`);deps.print(` ${approveUrl}`);if(confirmCode)deps.print(` Confirmation code: ${confirmCode} (type it on that page)`);deps.print(" If the page asks you to sign in, sign in and open the link again.");deps.print(" Waiting for approval. Press Ctrl+C to cancel.");if(options.open!==false){try{await deps.open(approveUrl)}catch{}}const interval=options.pollIntervalMs??2000;const deadline=deps.now()+(options.timeoutMs??10*60*1000);const pollUrl=`${base}/api/cli/connect/${encodeURIComponent(code)}`;while(true){if(deps.signal?.aborted)return outcome("cancelled","cancelled");if(deps.now()>=deadline)return outcome("timeout","nobody approved it in time");await deps.sleep(Math.min(interval,Math.max(0,deadline-deps.now())),deps.signal);if(deps.signal?.aborted)return outcome("cancelled","cancelled");const polled=await request(deps,pollUrl,{headers:{Accept:"application/json"}});if(!polled)continue;if(polled.status===429){await deps.sleep(retryAfterMs(polled,interval),deps.signal);continue}if(polled.status===404)return outcome("expired","the request expired, run the command again");if(!polled.ok)return outcome("failed",`the service answered ${polled.status}`);const answer=await polled.json().catch(()=>null);if(!isRecord(answer)||answer.status==="pending")continue;if(answer.status==="expired")return outcome("expired","the request expired, run the command again");const grant=toGrant(answer,base,Boolean(HQ_SERVICES[service].env.license));if(!grant)return outcome("failed","the service approved the request without sending keys");return{grant,outcome:{service,status:"connected",project:grant.project.name,dashboardUrl:grant.dashboardUrl||undefined,send:"skipped",read:"skipped"}}}}function envEntries(service,grant){const names=HQ_SERVICES[service].env;const entries={};if(names.license&&grant.licenseKey)return{[names.license]:grant.licenseKey};if(names.key)entries[names.key]=grant.ingestKey;if(names.readKey)entries[names.readKey]=grant.readKey;if(names.project)entries[names.project]=grant.project.id;return entries}async function verify(service,url,grant,options,deps){const kind=HQ_SERVICES[service].verify;if(!kind)return{send:"skipped",read:"skipped"};const base=origin(url);if(kind==="support"){const client=createHqClient({services:{supporthq:{url:base,readKey:grant.readKey,project:grant.project.id}},fetch:deps.fetch});const result=await client.support.conversations({limit:1});return result.ok?{send:"skipped",read:"pass"}:{send:"skipped",read:"fail",detail:describeUnavailable(result)}}const marker=`hq-connect-${crypto.randomUUID().slice(0,8)}`;const message=`buddy hq:connect test ${marker}`;const timestamp=new Date(deps.now()).toISOString();const sent=kind==="log"?await request(deps,`${base}/logs`,{method:"POST",headers:{"Content-Type":"application/json","X-LogHQ-Key":grant.ingestKey},body:JSON.stringify({logs:[{level:"info",message,timestamp,context:{source:"buddy hq:connect"}}]})}):await request(deps,`${base}/errors`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:grant.ingestKey,type:"HqConnectTest",message,level:"info",environment:"hq-connect",timestamp,sdk:{name:"buddy.hq-connect"}})});if(!sent?.ok)return{send:"fail",read:"skipped",detail:sent?`sending the test ${kind} answered ${sent.status}`:`sending the test ${kind} did not get through`};const receipt=await sent.json().catch(()=>null);if(isRecord(receipt)&&(receipt.sampled===true||receipt.stored===0))return{send:"pass",read:"skipped",detail:`the plan allowance is used up, so the test ${kind} was not kept`};const client=createHqClient({services:{[service]:{url:base,readKey:grant.readKey,project:grant.project.id}},timeoutMs:REQUEST_TIMEOUT_MS,fetch:(input,init)=>deps.fetch(input,init)});let reason=`the test ${kind} was accepted but did not show up`;const attempts=options.readAttempts??5;for(let attempt=0;attempt<attempts;attempt++){if(attempt>0)await deps.sleep(1000,deps.signal);if(deps.signal?.aborted)return{send:"pass",read:"fail",detail:"cancelled"};if(kind==="log"){const page=await client.logs.list({search:marker,limit:5});if(page.ok&&page.data.logs.some((log)=>log.message.includes(marker)))return{send:"pass",read:"pass"};if(!page.ok)reason=describeUnavailable(page)}else{const list=await client.issues.list();if(list.ok&&list.data.some((issue)=>issue.title.includes(marker)))return{send:"pass",read:"pass"};if(!list.ok)reason=describeUnavailable(list)}}return{send:"pass",read:"fail",detail:reason}}export function describeUnavailable(result){switch(result.reason){case"not_configured":return"not connected";case"unauthorized":return"the read key was refused";case"timeout":return"the service did not answer in time";case"network":return"the service could not be reached";case"http":return result.status===404?"not available yet":`the service answered ${result.status}`;case"bad_response":return"the service answered something unexpected"}}export function renderTable(headers,rows){const widths=headers.map((header,column)=>Math.max(header.length,...rows.map((row)=>(row[column]??"").length)));const line=(cells)=>cells.map((cell,column)=>(cell??"").padEnd(widths[column])).join(" ").trimEnd();return[line(headers),line(widths.map((width)=>"-".repeat(width))),...rows.map(line)]}const CONNECT_WORDS={connected:"pass",unavailable:"not available yet",unreachable:"fail",expired:"fail",timeout:"fail",cancelled:"cancelled",failed:"fail"};const CHECK_WORDS={pass:"pass",fail:"fail",skipped:"-"};export function connectTable(outcomes){return renderTable(["Service","Connect","Send","Read back","Note"],outcomes.map((outcome)=>[HQ_SERVICES[outcome.service].label,CONNECT_WORDS[outcome.status],CHECK_WORDS[outcome.send],CHECK_WORDS[outcome.read],outcome.status==="unavailable"?"":outcome.detail??""]))}export async function runHqConnect(services,config,options,deps){const outcomes=[];for(const service of services){const{label}=HQ_SERVICES[service];if(deps.signal?.aborted){outcomes.push({service,status:"cancelled",detail:"cancelled",send:"skipped",read:"skipped"});continue}const url=config[service]?.url;if(!url){outcomes.push({service,status:"failed",detail:"no URL is configured in config/services.ts",send:"skipped",read:"skipped"});continue}const{outcome,grant}=await connectOne(service,url,options,deps);if(!grant){if(outcome.status==="unavailable")deps.print(`${label}: not available yet`);else if(outcome.status!=="cancelled")deps.print(`${label}: not connected (${outcome.detail})`);outcomes.push(outcome);continue}try{await deps.writeEnv(envEntries(service,grant))}catch(error){const why=error instanceof Error?error.message:"unknown error";deps.print(`${label}: approved, but the keys could not be written to .env (${why})`);outcomes.push({...outcome,status:"failed",detail:"the keys could not be written to .env"});continue}deps.print(grant.licenseKey?`${label}: licensed "${grant.project.name}". Licence written to .env.`:`${label}: connected to project "${grant.project.name}". Keys written to .env.`);if(grant.dashboardUrl)deps.print(` Dashboard: ${grant.dashboardUrl}`);if(options.verify===false){outcomes.push(outcome);continue}outcomes.push({...outcome,...await verify(service,url,grant,options,deps)})}if(deps.signal?.aborted)deps.print("Cancelled. Services already connected keep their keys.");deps.print("");for(const line of connectTable(outcomes))deps.print(line);const ok=outcomes.every((outcome)=>outcome.status==="unavailable"||outcome.status==="connected"&&outcome.send!=="fail"&&outcome.read!=="fail");return{outcomes,ok}}const count=(value)=>value.toLocaleString("en-US");const REPORTSHQ_LICENSE=/^rhq_lic_[0-9a-f]{32}$/;export function describeReportsHqLicense(license){if(!license)return"unlicensed. Reports work in full; set REPORTSHQ_LICENSE to remove the notice";return REPORTSHQ_LICENSE.test(license)?"licensed (checked offline, nothing is metered)":"the licence key is not in the expected format. Reports are unaffected"}export async function runHqStatus(config,deps,services=HQ_SERVICE_NAMES){const connected=services.filter((service)=>config[service]?.url&&config[service]?.readKey);const license=services.includes("reportshq")?config.reportshq?.license:undefined;if(!connected.length&&!license){deps.print("No HQ service is connected yet. Run `buddy hq:connect` to connect one.");return[]}const client=createHqClient({services:Object.fromEntries(connected.map((service)=>[service,{url:config[service].url,readKey:config[service].readKey}])),timeoutMs:REQUEST_TIMEOUT_MS,fetch:(input,init)=>deps.fetch(input,init)});const rows=[];for(const[index,usage]of(await Promise.all(connected.map((service)=>client.getUsage(service)))).entries()){const service=connected[index];if(!usage.ok){rows.push({service,unavailable:describeUnavailable(usage)});continue}if(!usage.data.length)rows.push({service,unavailable:"no meters reported"});for(const report of usage.data){const over=report.limit!==null&&report.limit>0&&report.used/report.limit>=0.8;rows.push({service,meter:report.meter,used:report.used,limit:report.limit,period:report.period,state:report.state,...over?{upgradeUrl:report.upgradeUrl}:{}})}}if(license)rows.push({service:"reportshq",unavailable:describeReportsHqLicense(license)});const table=renderTable(["Service","Meter","Used","Limit","Period","State"],rows.map((row)=>row.unavailable?[HQ_SERVICES[row.service].label,row.unavailable]:[HQ_SERVICES[row.service].label,row.meter,count(row.used),row.limit===null?"unlimited":count(row.limit),row.period,row.state]));for(const line of table)deps.print(line);const upgrades=rows.filter((row)=>row.upgradeUrl);if(upgrades.length)deps.print("");for(const row of upgrades){const percent=Math.round(row.used/row.limit*100);deps.print(`${HQ_SERVICES[row.service].label} ${row.meter} is at ${percent}% of its allowance. Upgrade: ${row.upgradeUrl}`)}return rows}export async function runSupportDoctor(config,deps,options={}){const service=config.supporthq;const configured=Boolean(service?.url&&service.key&&service.readKey&&service.project);const checks=[{name:"configuration",ok:configured,detail:configured?"server key, read key and project configured":"missing configuration; run `buddy support:install`"}];if(configured){const client=createHqClient({services:{supporthq:{url:service.url,readKey:service.readKey,project:service.project}},fetch:deps.fetch});const usage=await client.getUsage("supporthq");checks.push({name:"usage",ok:usage.ok,detail:usage.ok?`${usage.data.length} usage meters readable`:describeUnavailable(usage)});const conversations=await client.support.conversations({limit:1});checks.push({name:"conversations",ok:conversations.ok,detail:conversations.ok?"project summaries readable":describeUnavailable(conversations)});if(service?.enabled===true){try{const target=new URL(service.url);if(target.username||target.password||target.search||target.hash||target.pathname!=="/"||target.protocol!=="https:"&&!(target.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(target.hostname)))throw new Error("Invalid support origin");const base=target.origin;const probe=await deps.fetch(`${base}/api/v1/projects/${encodeURIComponent(service.project)}/installation`,{headers:{Authorization:`Bearer ${service.key}`},redirect:"error",signal:AbortSignal.timeout(1e4)});const body=probe.ok?await probe.json():null;const current=new URL(options.origin||"").origin;const accepted=isRecord(body)&&body.service==="supporthq"&&body.protocol===1&&body.project===service.project&&body.buddyConnected===true&&Array.isArray(body.allowedOrigins)&&body.allowedOrigins.includes(current);checks.push({name:"installation",ok:accepted,detail:accepted?"approved project and exact app origin; no customer probe was created":"native installation or app origin is not approved"})}catch{checks.push({name:"installation",ok:false,detail:"native installation could not be read"})}if(service.messenger?.enabled){try{const loader=new URL(service.messenger.loaderUrl||"https://hq.support/support.js");if(loader.username||loader.password||loader.search||loader.hash||loader.protocol!=="https:"&&!(loader.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(loader.hostname)))throw new Error("Invalid loader");const response=await deps.fetch(new URL("/widgets/manifest.json",loader).href,{redirect:"error",signal:AbortSignal.timeout(1e4)});const manifest=response.ok?await response.json():null;const published=isRecord(manifest)&&manifest.schemaVersion===1&&Array.isArray(manifest.files)&&manifest.files.some((file)=>isRecord(file)&&typeof file.path==="string"&&file.path.endsWith("/bundle.js")&&typeof file.sha256==="string"&&/^[a-f0-9]{64}$/.test(file.sha256)&&typeof file.gzipBytes==="number"&&file.gzipBytes>0&&file.gzipBytes<=1e5);checks.push({name:"widget",ok:published,detail:published?"published manifest reports a versioned widget within the initial code budget":"published widget manifest or size budget is unavailable"})}catch{checks.push({name:"widget",ok:false,detail:"published widget could not be checked"})}}}}for(const check of checks)deps.print(`HQ.support ${check.name}: ${check.ok?"pass":"fail"} (${check.detail})`);return{ok:checks.every((check)=>check.ok),checks}}
@@ -1 +1 @@
1
- export async function withTimeout(work,ms){let timeoutId;const deadline=new Promise((_,reject)=>{timeoutId=setTimeout(()=>reject(new Error("timeout")),ms)});try{return await Promise.race([work,deadline])}finally{if(timeoutId!==undefined)clearTimeout(timeoutId)}}const commandRegistry={about:{path:"./commands/about.js",load:()=>import("./commands/about.js"),exportName:"about"},add:{path:"./commands/add.js",load:()=>import("./commands/add.js"),exportName:"add"},"ai:access":{path:"./commands/ai-access.js",load:()=>import("./commands/ai-access.js"),exportName:"aiAccess"},"ai:context":{path:"./commands/ai-context.js",load:()=>import("./commands/ai-context.js"),exportName:"aiContext"},auth:{path:"./commands/auth.js",load:()=>import("./commands/auth.js"),exportName:"auth"},build:{path:"./commands/build.js",load:()=>import("./commands/build.js"),exportName:"build"},cd:{path:"./commands/cd.js",load:()=>import("./commands/cd.js"),exportName:"cd"},changelog:{path:"./commands/changelog.js",load:()=>import("./commands/changelog.js"),exportName:"changelog"},clean:{path:"./commands/clean.js",load:()=>import("./commands/clean.js"),exportName:"clean"},cloud:{path:"./commands/cloud.js",load:()=>import("./commands/cloud.js"),exportName:"cloud"},commit:{path:"./commands/commit.js",load:()=>import("./commands/commit.js"),exportName:"commit"},completion:{path:"./commands/completion.js",load:()=>import("./commands/completion.js"),exportName:"completion"},"config:migrate":{path:"./commands/config-migrate.js",load:()=>import("./commands/config-migrate.js"),exportName:"configMigrate"},configure:{path:"./commands/configure.js",load:()=>import("./commands/configure.js"),exportName:"configure"},create:{path:"./commands/create.js",load:()=>import("./commands/create.js"),exportName:"create"},new:{path:"./commands/create.js",load:()=>import("./commands/create.js"),exportName:"create"},deploy:{path:"./commands/deploy.js",load:()=>import("./commands/deploy.js"),exportName:"deploy"},"deploy:rollback":{path:"./commands/deploy.js",load:()=>import("./commands/deploy.js"),exportName:"deploy"},dev:{path:"./commands/dev.js",load:()=>import("./commands/dev.js"),exportName:"dev"},"desktop:apple:doctor":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:csr":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:init":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:package":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:provision":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:publish":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:update:keypair":{path:"./commands/desktop-release.js",load:()=>import("./commands/desktop-release.js"),exportName:"desktopRelease"},"release:desktop":{path:"./commands/desktop-release.js",load:()=>import("./commands/desktop-release.js"),exportName:"desktopRelease"},"desktop:probe":{path:"./commands/desktop-probe.js",load:()=>import("./commands/desktop-probe.js"),exportName:"desktopProbe"},"integrations:probe":{path:"./commands/integrations-probe.js",load:()=>import("./commands/integrations-probe.js"),exportName:"integrationsProbe"},dns:{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:pull":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:diff":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:sync":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},doctor:{path:"./commands/doctor.js",load:()=>import("./commands/doctor.js"),exportName:"doctor"},domains:{path:"./commands/domains.js",load:()=>import("./commands/domains.js"),exportName:"domains"},email:{path:"./commands/email.js",load:()=>import("./commands/email.js"),exportName:"email"},env:{path:"./commands/env.js",load:()=>import("./commands/env.js"),exportName:"env"},"extension:init":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:build":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:package":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:chrome:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:chrome:status":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:firefox:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:init":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:provision":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:app":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"dashboard:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"dashboard:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:import":{path:"./commands/commerce-import.js",load:()=>import("./commands/commerce-import.js"),exportName:"commerceImport"},"cms:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"cms:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"marketing:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"marketing:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"monitoring:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"monitoring:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"realtime:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"realtime:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"queue:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"queue:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"db:backup":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"db:backups":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"db:restore":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"storage:backup":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"storage:backups":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"storage:restore":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"feedback:invite":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"feedback:tokens":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"feedback:revoke":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"socials:identities":{path:"./commands/socials.js",load:()=>import("./commands/socials.js"),exportName:"socials"},"socials:authorize":{path:"./commands/socials.js",load:()=>import("./commands/socials.js"),exportName:"socials"},fresh:{path:"./commands/fresh.js",load:()=>import("./commands/fresh.js"),exportName:"fresh"},generate:{path:"./commands/generate.js",load:()=>import("./commands/generate.js"),exportName:"generate"},"gdpr:export":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:erase":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:prune":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:register":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:register:check":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"hq:connect":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},"hq:status":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},http:{path:"./commands/http.js",load:()=>import("./commands/http.js"),exportName:"http"},install:{path:"./commands/install.js",load:()=>import("./commands/install.js"),exportName:"install"},key:{path:"./commands/key.js",load:()=>import("./commands/key.js"),exportName:"key"},license:{path:"./commands/license.js",load:()=>import("./commands/license.js"),exportName:"license"},"license:keygen":{path:"./commands/license.js",load:()=>import("./commands/license.js"),exportName:"license"},lint:{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},format:{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},"format:check":{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},libs:{path:"./commands/libs.js",load:()=>import("./commands/libs.js"),exportName:"libs"},libraries:{path:"./commands/libs.js",load:()=>import("./commands/libs.js"),exportName:"libs"},list:{path:"./commands/list.js",load:()=>import("./commands/list.js"),exportName:"list"},mail:{path:"./commands/mail.js",load:()=>import("./commands/mail.js"),exportName:"mailCommands"},"mail:preview":{path:"./commands/mail.js",load:()=>import("./commands/mail.js"),exportName:"mailCommands"},maintenance:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},down:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},up:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},status:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},"coming-soon":{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},"coming-soon:status":{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},launch:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},make:{path:"./commands/make.js",load:()=>import("./commands/make.js"),exportName:"make"},"scaffold:crud":{path:"./commands/make.js",load:()=>import("./commands/make.js"),exportName:"make"},migrate:{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:fresh":{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:switch":{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:project":{path:"./commands/migrate-project.js",load:()=>import("./commands/migrate-project.js"),exportName:"migrateProject"},outdated:{path:"./commands/outdated.js",load:()=>import("./commands/outdated.js"),exportName:"outdated"},package:{path:"./commands/package.js",load:()=>import("./commands/package.js"),exportName:"packageCommands"},phone:{path:"./commands/phone.js",load:()=>import("./commands/phone.js"),exportName:"phone"},ports:{path:"./commands/ports.js",load:()=>import("./commands/ports.js"),exportName:"ports"},"security:scan":{path:"./commands/security.js",load:()=>import("./commands/security.js"),exportName:"security"},audit:{path:"./commands/security.js",load:()=>import("./commands/security.js"),exportName:"security"},"server:flash":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:first-boot":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:doctor":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:setup":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:trust":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"link:core":{path:"./commands/link.js",load:()=>import("./commands/link.js"),exportName:"link"},"comments:list":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:approve":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:reject":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:delete":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"user:add":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"user:list":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"user:audit":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"unlink:core":{path:"./commands/link.js",load:()=>import("./commands/link.js"),exportName:"link"},prepublish:{path:"./commands/prepublish.js",load:()=>import("./commands/prepublish.js"),exportName:"prepublish"},projects:{path:"./commands/projects.js",load:()=>import("./commands/projects.js"),exportName:"projects"},publish:{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:model":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:controller":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:middleware":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:action":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:component":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:view":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:core":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"core:status":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:defaults":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},unpublish:{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},queue:{path:"./commands/queue.js",load:()=>import("./commands/queue.js"),exportName:"queue"},release:{path:"./commands/release.js",load:()=>import("./commands/release.js"),exportName:"release"},route:{path:"./commands/route.js",load:()=>import("./commands/route.js"),exportName:"route"},saas:{path:"./commands/saas.js",load:()=>import("./commands/saas.js"),exportName:"saas"},"stripe:setup":{path:"./commands/saas.js",load:()=>import("./commands/saas.js"),exportName:"saas"},schedule:{path:"./commands/schedule.js",load:()=>import("./commands/schedule.js"),exportName:"schedule"},search:{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},"search-engine:update":{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},"search-engine:settings":{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},screenshot:{path:"./commands/screenshot.js",load:()=>import("./commands/screenshot.js"),exportName:"screenshot"},seed:{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"seed:roles":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"roles:seed":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"seed:admins":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"admins:seed":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},preview:{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"preview"},serve:{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"serve"},"serve:api":{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"serveApi"},setup:{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},ensure:{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ai":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ssl":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ios":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:oh-my-zsh":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"ai:setup":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},share:{path:"./commands/share.js",load:()=>import("./commands/share.js"),exportName:"share"},"simulator:doctor":{path:"./commands/simulator.js",load:()=>import("./commands/simulator.js"),exportName:"simulator"},"simulator:open":{path:"./commands/simulator.js",load:()=>import("./commands/simulator.js"),exportName:"simulator"},stack:{path:"./commands/stacks.js",load:()=>import("./commands/stacks.js"),exportName:"stacks"},sms:{path:"./commands/sms.js",load:()=>import("./commands/sms.js"),exportName:"sms"},telemetry:{path:"./commands/telemetry.js",load:()=>import("./commands/telemetry.js"),exportName:"telemetryCommand"},test:{path:"./commands/test.js",load:()=>import("./commands/test.js"),exportName:"test"},tinker:{path:"./commands/tinker.js",load:()=>import("./commands/tinker.js"),exportName:"tinker"},types:{path:"./commands/types.js",load:()=>import("./commands/types.js"),exportName:"types"},undeploy:{path:"./commands/cloud.js",load:()=>import("./commands/cloud.js"),exportName:"cloud"},upgrade:{path:"./commands/upgrade.js",load:()=>import("./commands/upgrade.js"),exportName:"upgrade"},version:{path:"./commands/version.js",load:()=>import("./commands/version.js"),exportName:"version"},"docs:style-guide":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:style-guide:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:buddy":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:native-skills":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:native-skills:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:buddy:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:artifacts":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:artifacts:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:links":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:links:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"}};const commandGroups={minimal:["version","help"],development:["dev","build","test","lint"],database:["migrate","seed","fresh"],scaffolding:["make","generate"],deployment:["deploy","release","cloud","server"],info:["about","doctor","list"]};const loadedRegistrars=new WeakMap;function loaderKey(loader){return`${loader.path}#${loader.exportName}`}export function markLoaded(buddy,commandName){const loader=commandRegistry[commandName];if(!loader)return;let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}set.add(loaderKey(loader))}export async function loadCommand(commandName,buddy){const loader=commandRegistry[commandName];if(!loader){return false}let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}const key=loaderKey(loader);if(set.has(key))return true;set.add(key);try{const module=await loader.load();const commandFunction=module[loader.exportName];if(typeof commandFunction==="function"){commandFunction(buddy);return true}else{return false}}catch{return false}}export async function loadCommands(commandNames,buddy){const seen=new Set;const unique=[];for(const name of commandNames){const loader=commandRegistry[name];const key=loader?`${loader.path}#${loader.exportName}`:`name:${name}`;if(seen.has(key))continue;seen.add(key);unique.push(name)}await Promise.all(unique.map(async(name)=>{try{await withTimeout(loadCommand(name,buddy),5000)}catch{}}))}export async function loadCommandGroup(groupName,buddy){const commands=commandGroups[groupName];if(commands){await loadCommands(commands,buddy)}}export async function loadAllCommands(buddy){const allCommands=Object.keys(commandRegistry);await loadCommands(allCommands,buddy)}export function getCommandNames(){return Object.keys(commandRegistry)}export function getCommandsToLoad(args){const requestedCommand=args[0];const isVersionFlag=requestedCommand==="--version"||requestedCommand==="-v";const isHelpFlag=requestedCommand==="--help"||requestedCommand==="-h";const isHelpWord=requestedCommand==="help";if(isVersionFlag)return["version"];if(!requestedCommand||isHelpFlag||isHelpWord)return Object.keys(commandRegistry);const baseCommand=requestedCommand.split(":")[0];if(baseCommand==="list"){return["list",...Object.keys(commandRegistry).filter((k)=>k!=="list")]}if(commandRegistry[requestedCommand]){return[requestedCommand]}if(commandRegistry[baseCommand]){return[baseCommand]}return Object.keys(commandRegistry)}
1
+ export async function withTimeout(work,ms){let timeoutId;const deadline=new Promise((_,reject)=>{timeoutId=setTimeout(()=>reject(new Error("timeout")),ms)});try{return await Promise.race([work,deadline])}finally{if(timeoutId!==undefined)clearTimeout(timeoutId)}}const commandRegistry={about:{path:"./commands/about.js",load:()=>import("./commands/about.js"),exportName:"about"},add:{path:"./commands/add.js",load:()=>import("./commands/add.js"),exportName:"add"},"ai:access":{path:"./commands/ai-access.js",load:()=>import("./commands/ai-access.js"),exportName:"aiAccess"},"ai:context":{path:"./commands/ai-context.js",load:()=>import("./commands/ai-context.js"),exportName:"aiContext"},auth:{path:"./commands/auth.js",load:()=>import("./commands/auth.js"),exportName:"auth"},build:{path:"./commands/build.js",load:()=>import("./commands/build.js"),exportName:"build"},cd:{path:"./commands/cd.js",load:()=>import("./commands/cd.js"),exportName:"cd"},changelog:{path:"./commands/changelog.js",load:()=>import("./commands/changelog.js"),exportName:"changelog"},clean:{path:"./commands/clean.js",load:()=>import("./commands/clean.js"),exportName:"clean"},cloud:{path:"./commands/cloud.js",load:()=>import("./commands/cloud.js"),exportName:"cloud"},commit:{path:"./commands/commit.js",load:()=>import("./commands/commit.js"),exportName:"commit"},completion:{path:"./commands/completion.js",load:()=>import("./commands/completion.js"),exportName:"completion"},"config:migrate":{path:"./commands/config-migrate.js",load:()=>import("./commands/config-migrate.js"),exportName:"configMigrate"},configure:{path:"./commands/configure.js",load:()=>import("./commands/configure.js"),exportName:"configure"},create:{path:"./commands/create.js",load:()=>import("./commands/create.js"),exportName:"create"},new:{path:"./commands/create.js",load:()=>import("./commands/create.js"),exportName:"create"},deploy:{path:"./commands/deploy.js",load:()=>import("./commands/deploy.js"),exportName:"deploy"},"deploy:rollback":{path:"./commands/deploy.js",load:()=>import("./commands/deploy.js"),exportName:"deploy"},dev:{path:"./commands/dev.js",load:()=>import("./commands/dev.js"),exportName:"dev"},"desktop:apple:doctor":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:csr":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:init":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:package":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:provision":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:apple:publish":{path:"./commands/desktop-apple.js",load:()=>import("./commands/desktop-apple.js"),exportName:"desktopApple"},"desktop:update:keypair":{path:"./commands/desktop-release.js",load:()=>import("./commands/desktop-release.js"),exportName:"desktopRelease"},"release:desktop":{path:"./commands/desktop-release.js",load:()=>import("./commands/desktop-release.js"),exportName:"desktopRelease"},"desktop:probe":{path:"./commands/desktop-probe.js",load:()=>import("./commands/desktop-probe.js"),exportName:"desktopProbe"},"integrations:probe":{path:"./commands/integrations-probe.js",load:()=>import("./commands/integrations-probe.js"),exportName:"integrationsProbe"},dns:{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:pull":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:diff":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},"dns:sync":{path:"./commands/dns.js",load:()=>import("./commands/dns.js"),exportName:"dns"},doctor:{path:"./commands/doctor.js",load:()=>import("./commands/doctor.js"),exportName:"doctor"},domains:{path:"./commands/domains.js",load:()=>import("./commands/domains.js"),exportName:"domains"},email:{path:"./commands/email.js",load:()=>import("./commands/email.js"),exportName:"email"},env:{path:"./commands/env.js",load:()=>import("./commands/env.js"),exportName:"env"},"extension:init":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:build":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:package":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:chrome:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:chrome:status":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:firefox:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:init":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:provision":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:app":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"extension:safari:publish":{path:"./commands/extension.js",load:()=>import("./commands/extension.js"),exportName:"extension"},"dashboard:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"dashboard:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"commerce:import":{path:"./commands/commerce-import.js",load:()=>import("./commands/commerce-import.js"),exportName:"commerceImport"},"cms:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"cms:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"marketing:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"marketing:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"monitoring:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"monitoring:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"realtime:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"realtime:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"queue:install":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"queue:uninstall":{path:"./commands/features.js",load:()=>import("./commands/features.js"),exportName:"features"},"db:backup":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"db:backups":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"db:restore":{path:"./commands/db.js",load:()=>import("./commands/db.js"),exportName:"db"},"storage:backup":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"storage:backups":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"storage:restore":{path:"./commands/storage-backup.js",load:()=>import("./commands/storage-backup.js"),exportName:"storageBackup"},"feedback:invite":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"feedback:tokens":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"feedback:revoke":{path:"./commands/feedback.js",load:()=>import("./commands/feedback.js"),exportName:"feedback"},"socials:identities":{path:"./commands/socials.js",load:()=>import("./commands/socials.js"),exportName:"socials"},"socials:authorize":{path:"./commands/socials.js",load:()=>import("./commands/socials.js"),exportName:"socials"},fresh:{path:"./commands/fresh.js",load:()=>import("./commands/fresh.js"),exportName:"fresh"},generate:{path:"./commands/generate.js",load:()=>import("./commands/generate.js"),exportName:"generate"},"gdpr:export":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:erase":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:prune":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:register":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"gdpr:register:check":{path:"./commands/gdpr.js",load:()=>import("./commands/gdpr.js"),exportName:"gdpr"},"hq:connect":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},"support:install":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},"support:doctor":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},"hq:status":{path:"./commands/hq.js",load:()=>import("./commands/hq.js"),exportName:"hq"},http:{path:"./commands/http.js",load:()=>import("./commands/http.js"),exportName:"http"},install:{path:"./commands/install.js",load:()=>import("./commands/install.js"),exportName:"install"},key:{path:"./commands/key.js",load:()=>import("./commands/key.js"),exportName:"key"},license:{path:"./commands/license.js",load:()=>import("./commands/license.js"),exportName:"license"},"license:keygen":{path:"./commands/license.js",load:()=>import("./commands/license.js"),exportName:"license"},lint:{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},format:{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},"format:check":{path:"./commands/lint.js",load:()=>import("./commands/lint.js"),exportName:"lint"},libs:{path:"./commands/libs.js",load:()=>import("./commands/libs.js"),exportName:"libs"},libraries:{path:"./commands/libs.js",load:()=>import("./commands/libs.js"),exportName:"libs"},list:{path:"./commands/list.js",load:()=>import("./commands/list.js"),exportName:"list"},mail:{path:"./commands/mail.js",load:()=>import("./commands/mail.js"),exportName:"mailCommands"},"mail:preview":{path:"./commands/mail.js",load:()=>import("./commands/mail.js"),exportName:"mailCommands"},maintenance:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},down:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},up:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},status:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},"coming-soon":{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},"coming-soon:status":{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},launch:{path:"./commands/maintenance.js",load:()=>import("./commands/maintenance.js"),exportName:"maintenance"},make:{path:"./commands/make.js",load:()=>import("./commands/make.js"),exportName:"make"},"scaffold:crud":{path:"./commands/make.js",load:()=>import("./commands/make.js"),exportName:"make"},migrate:{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:fresh":{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:switch":{path:"./commands/migrate.js",load:()=>import("./commands/migrate.js"),exportName:"migrate"},"migrate:project":{path:"./commands/migrate-project.js",load:()=>import("./commands/migrate-project.js"),exportName:"migrateProject"},outdated:{path:"./commands/outdated.js",load:()=>import("./commands/outdated.js"),exportName:"outdated"},package:{path:"./commands/package.js",load:()=>import("./commands/package.js"),exportName:"packageCommands"},phone:{path:"./commands/phone.js",load:()=>import("./commands/phone.js"),exportName:"phone"},ports:{path:"./commands/ports.js",load:()=>import("./commands/ports.js"),exportName:"ports"},"security:scan":{path:"./commands/security.js",load:()=>import("./commands/security.js"),exportName:"security"},audit:{path:"./commands/security.js",load:()=>import("./commands/security.js"),exportName:"security"},"server:flash":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:first-boot":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:doctor":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:setup":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"server:trust":{path:"./commands/server.js",load:()=>import("./commands/server.js"),exportName:"server"},"link:core":{path:"./commands/link.js",load:()=>import("./commands/link.js"),exportName:"link"},"comments:list":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:approve":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:reject":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"comments:delete":{path:"./commands/comments.js",load:()=>import("./commands/comments.js"),exportName:"commentsCommands"},"user:add":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"user:list":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"user:audit":{path:"./commands/user.js",load:()=>import("./commands/user.js"),exportName:"user"},"unlink:core":{path:"./commands/link.js",load:()=>import("./commands/link.js"),exportName:"link"},prepublish:{path:"./commands/prepublish.js",load:()=>import("./commands/prepublish.js"),exportName:"prepublish"},projects:{path:"./commands/projects.js",load:()=>import("./commands/projects.js"),exportName:"projects"},publish:{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:model":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:controller":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:middleware":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:action":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:component":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:view":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:core":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"core:status":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},"publish:defaults":{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},unpublish:{path:"./commands/publish.js",load:()=>import("./commands/publish.js"),exportName:"publish"},queue:{path:"./commands/queue.js",load:()=>import("./commands/queue.js"),exportName:"queue"},release:{path:"./commands/release.js",load:()=>import("./commands/release.js"),exportName:"release"},route:{path:"./commands/route.js",load:()=>import("./commands/route.js"),exportName:"route"},saas:{path:"./commands/saas.js",load:()=>import("./commands/saas.js"),exportName:"saas"},"stripe:setup":{path:"./commands/saas.js",load:()=>import("./commands/saas.js"),exportName:"saas"},schedule:{path:"./commands/schedule.js",load:()=>import("./commands/schedule.js"),exportName:"schedule"},search:{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},"search-engine:update":{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},"search-engine:settings":{path:"./commands/search.js",load:()=>import("./commands/search.js"),exportName:"search"},screenshot:{path:"./commands/screenshot.js",load:()=>import("./commands/screenshot.js"),exportName:"screenshot"},seed:{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"seed:roles":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"roles:seed":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"seed:admins":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},"admins:seed":{path:"./commands/seed.js",load:()=>import("./commands/seed.js"),exportName:"seed"},preview:{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"preview"},serve:{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"serve"},"serve:api":{path:"./commands/serve.js",load:()=>import("./commands/serve.js"),exportName:"serveApi"},setup:{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},ensure:{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ai":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ssl":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:ios":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"setup:oh-my-zsh":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},"ai:setup":{path:"./commands/setup.js",load:()=>import("./commands/setup.js"),exportName:"setup"},share:{path:"./commands/share.js",load:()=>import("./commands/share.js"),exportName:"share"},"simulator:doctor":{path:"./commands/simulator.js",load:()=>import("./commands/simulator.js"),exportName:"simulator"},"simulator:open":{path:"./commands/simulator.js",load:()=>import("./commands/simulator.js"),exportName:"simulator"},stack:{path:"./commands/stacks.js",load:()=>import("./commands/stacks.js"),exportName:"stacks"},sms:{path:"./commands/sms.js",load:()=>import("./commands/sms.js"),exportName:"sms"},telemetry:{path:"./commands/telemetry.js",load:()=>import("./commands/telemetry.js"),exportName:"telemetryCommand"},test:{path:"./commands/test.js",load:()=>import("./commands/test.js"),exportName:"test"},tinker:{path:"./commands/tinker.js",load:()=>import("./commands/tinker.js"),exportName:"tinker"},types:{path:"./commands/types.js",load:()=>import("./commands/types.js"),exportName:"types"},undeploy:{path:"./commands/cloud.js",load:()=>import("./commands/cloud.js"),exportName:"cloud"},upgrade:{path:"./commands/upgrade.js",load:()=>import("./commands/upgrade.js"),exportName:"upgrade"},version:{path:"./commands/version.js",load:()=>import("./commands/version.js"),exportName:"version"},"docs:style-guide":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:style-guide:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:buddy":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:native-skills":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:native-skills:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:buddy:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:artifacts":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:artifacts:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:links":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"},"docs:links:check":{path:"./commands/docs.js",load:()=>import("./commands/docs.js"),exportName:"docs"}};const commandGroups={minimal:["version","help"],development:["dev","build","test","lint"],database:["migrate","seed","fresh"],scaffolding:["make","generate"],deployment:["deploy","release","cloud","server"],info:["about","doctor","list"]};const loadedRegistrars=new WeakMap;function loaderKey(loader){return`${loader.path}#${loader.exportName}`}export function markLoaded(buddy,commandName){const loader=commandRegistry[commandName];if(!loader)return;let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}set.add(loaderKey(loader))}export async function loadCommand(commandName,buddy){const loader=commandRegistry[commandName];if(!loader){return false}let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}const key=loaderKey(loader);if(set.has(key))return true;set.add(key);try{const module=await loader.load();const commandFunction=module[loader.exportName];if(typeof commandFunction==="function"){commandFunction(buddy);return true}else{return false}}catch{return false}}export async function loadCommands(commandNames,buddy){const seen=new Set;const unique=[];for(const name of commandNames){const loader=commandRegistry[name];const key=loader?`${loader.path}#${loader.exportName}`:`name:${name}`;if(seen.has(key))continue;seen.add(key);unique.push(name)}await Promise.all(unique.map(async(name)=>{try{await withTimeout(loadCommand(name,buddy),5000)}catch{}}))}export async function loadCommandGroup(groupName,buddy){const commands=commandGroups[groupName];if(commands){await loadCommands(commands,buddy)}}export async function loadAllCommands(buddy){const allCommands=Object.keys(commandRegistry);await loadCommands(allCommands,buddy)}export function getCommandNames(){return Object.keys(commandRegistry)}export function getCommandsToLoad(args){const requestedCommand=args[0];const isVersionFlag=requestedCommand==="--version"||requestedCommand==="-v";const isHelpFlag=requestedCommand==="--help"||requestedCommand==="-h";const isHelpWord=requestedCommand==="help";if(isVersionFlag)return["version"];if(!requestedCommand||isHelpFlag||isHelpWord)return Object.keys(commandRegistry);const baseCommand=requestedCommand.split(":")[0];if(baseCommand==="list"){return["list",...Object.keys(commandRegistry).filter((k)=>k!=="list")]}if(commandRegistry[requestedCommand]){return[requestedCommand]}if(commandRegistry[baseCommand]){return[baseCommand]}return Object.keys(commandRegistry)}
@@ -0,0 +1,5 @@
1
+ import type { HqServicesConfig } from '@stacksjs/types';
2
+ /** File selection is explicit and confined to the app, including symlink targets. */
3
+ export declare function selectSupportDocuments(directory: string, selected: readonly string[], options?: { locale?: string, public?: boolean, publish?: boolean }): Promise<SelectedDocument[]>;
4
+ export declare function runSupportDocsSync(config: HqServicesConfig, documents: readonly SelectedDocument[], options: { dryRun?: boolean }, deps: { fetch: (input: string, init?: RequestInit) => Promise<Response>, print: (line: string) => void }): Promise<boolean>;
5
+ export declare interface SelectedDocument { source: string, title: string, body: string, locale: string, visibility: 'internal' | 'public', publish: boolean }
@@ -0,0 +1 @@
1
+ import{readFile,realpath,stat}from"node:fs/promises";import{relative,resolve,sep}from"node:path";export async function selectSupportDocuments(directory,selected,options={}){if(!selected.length||selected.length>20)throw new Error("Select between one and twenty Markdown files.");const root=await realpath(directory);const documents=[],seen=new Set;const locale=options.locale??"en";if(!/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(locale))throw new Error("Select a valid documentation locale.");for(const selection of selected){const path=await realpath(resolve(root,selection)),source=relative(root,path).split(sep).join("/");if(!source||source.startsWith("../")||!source.toLowerCase().endsWith(".md"))throw new Error("Select Markdown files inside this application.");if(seen.has(source))throw new Error("Select each document once.");seen.add(source);const metadata=await stat(path);if(!metadata.isFile()||metadata.size<1||metadata.size>1e5)throw new Error("Each selected document must contain 1 to 100000 bytes.");const body=await readFile(path,"utf8");const title=/^#\s+(.+)$/m.exec(body)?.[1]?.trim()??source.replace(/\.md$/i,"").split("/").at(-1);if(!title||title.length>200)throw new Error("Document titles must contain 1 to 200 characters.");documents.push({source,title,body,locale,visibility:options.public?"public":"internal",publish:options.publish===true})}return documents}export async function runSupportDocsSync(config,documents,options,deps){if(options.dryRun){for(const document of documents)deps.print(`${document.source}: ${document.visibility}, ${document.publish?"published":"draft"}`);deps.print(`Preview only: ${documents.length} explicitly selected documents; no data sent.`);return true}const service=config.supporthq;if(!service?.key||!service.project){deps.print("Connect HQ.support with buddy support:install first.");return false}try{const base=new URL(service.url);if(base.username||base.password||base.search||base.hash||base.pathname!=="/"||base.protocol!=="https:"&&!(base.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(base.hostname)))throw new Error("Invalid origin");const response=await deps.fetch(`${base.origin}/api/v1/projects/${encodeURIComponent(service.project)}/knowledge/sync`,{method:"POST",headers:{Authorization:`Bearer ${service.key}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({documents}),redirect:"error",signal:AbortSignal.timeout(1e4)});if(!response.ok){deps.print(`HQ.support refused documentation sync (${response.status}). No selected article was overwritten.`);return false}const body=await response.json();if(!Array.isArray(body.documents)||body.documents.length!==documents.length)throw new Error("Invalid response");for(const[index,result]of body.documents.entries()){if(result.source!==documents[index].source||typeof result.revision!=="number"||!Number.isSafeInteger(result.revision)||result.revision<1||typeof result.changed!=="boolean")throw new Error("Invalid response");deps.print(`${documents[index].source}: revision ${result.revision}, ${result.changed?"updated":"unchanged"}`)}return true}catch{deps.print("Documentation sync could not be confirmed. Retry the same selected files; unchanged source is deduplicated.");return false}}
@@ -0,0 +1,4 @@
1
+ import type { HqServicesConfig } from '@stacksjs/types';
2
+ /** Full source data travels only to the selected service, never terminal output. */
3
+ export declare function runSupportImport(config: HqServicesConfig, options: SupportImportOptions, deps: { fetch: (input: string, init?: RequestInit) => Promise<Response>, print: (line: string) => void }): Promise<boolean>;
4
+ export declare interface SupportImportOptions { file?: string, dryRun?: boolean, resume?: string, status?: string }
@@ -0,0 +1 @@
1
+ import{stat,readFile}from"node:fs/promises";import{basename}from"node:path";function record(value){return value!==null&&typeof value==="object"&&!Array.isArray(value)}function count(value){return typeof value==="number"&&Number.isSafeInteger(value)&&value>=0}export async function runSupportImport(config,options,deps){const service=config.supporthq;if(!service?.key||!service.project){deps.print("Connect HQ.support with buddy support:install first.");return false}try{if([Boolean(options.file),Boolean(options.resume),Boolean(options.status)].filter(Boolean).length!==1||options.dryRun&&!options.file)throw new Error("Choose one operation");const base=new URL(service.url);if(base.username||base.password||base.search||base.hash||base.pathname!=="/"||base.protocol!=="https:"&&!(base.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(base.hostname)))throw new Error("Invalid service");const endpoint=`${base.origin}/api/v1/projects/${encodeURIComponent(service.project)}/imports`;let path,body,method="POST";if(options.file){const metadata=await stat(options.file);if(!metadata.isFile()||metadata.size<1||metadata.size>1e7||!/\.json$/i.test(options.file))throw new Error("Invalid bundle file");const bytes=await readFile(options.file);const form=new FormData;form.append("file",new File([bytes],basename(options.file),{type:"application/json"}));if(options.dryRun)form.append("dryRun","true");body=form;path=`${endpoint}/intercom`}else{const id=options.resume??options.status;if(!id||!/^\d+$/.test(id))throw new Error("Invalid run id");path=`${endpoint}/${id}${options.resume?"/resume":""}`;if(options.status)method="GET"}const response=await deps.fetch(path,{method,headers:{Authorization:`Bearer ${service.key}`,Accept:"application/json"},body,redirect:"error",signal:AbortSignal.timeout(120000)});if(!response.ok){deps.print(`HQ.support refused the migration operation (${response.status}). Review the bundle or saved run before retrying.`);return false}const result=await response.json();if(!record(result))throw new Error("Invalid result");if(options.dryRun){if(result.dryRun!==true||!["totalRecords","compatibleRecords","skippedRecords","reviewRecords"].every((key)=>count(result[key]))||!Array.isArray(result.reasons))throw new Error("Invalid preview");deps.print(`Preview: ${result.totalRecords} records; ${result.compatibleRecords} compatible, ${result.skippedRecords} unchanged, ${result.reviewRecords} require review. No customer data was imported.`);for(const reason of result.reasons){if(!record(reason)||typeof reason.code!=="string"||!/^[a-z0-9_]+$/.test(reason.code)||!count(reason.count))throw new Error("Invalid reason");deps.print(`${reason.code}: ${reason.count}`)}}else{const run=result.run;if(!record(run)||typeof run.id!=="string"||!/^\d+$/.test(run.id)||typeof run.status!=="string"||!/^[a-z_]+$/.test(run.status)||!["totalRecords","processed","imported","skipped","failed"].every((key)=>count(run[key])))throw new Error("Invalid run");deps.print(`Migration ${run.id}: ${run.status}; ${run.processed}/${run.totalRecords} processed, ${run.imported} imported, ${run.skipped} unchanged, ${run.failed} require review.`);deps.print(`Inspect: buddy support:import intercom --status ${run.id}`)}return true}catch{deps.print("Migration could not be confirmed. Use one JSON bundle up to 10 MB, or a saved run ID. Retry the same bundle to deduplicate; customer bodies and keys are not printed.");return false}}
@@ -0,0 +1,2 @@
1
+ import type { HqServicesConfig } from '@stacksjs/types';
2
+ export declare function installSupportMessenger(config: HqServicesConfig, input: { directory: string, origin: string, frameworkVersion: string, componentSource: string, layout?: string }, deps: { fetch: (input: string, init?: RequestInit) => Promise<Response>, print: (line: string) => void, writeEnv: (entries: Record<string, string>) => Promise<void> }): Promise<boolean>;
@@ -0,0 +1,5 @@
1
+ import{existsSync}from"node:fs";import{mkdir,readFile,realpath,writeFile}from"node:fs/promises";import{dirname,relative,resolve}from"node:path";export async function installSupportMessenger(config,input,deps){try{const service=config.supporthq;if(!service?.key||!service.project)throw new Error("Connect first");const endpoint=new URL(service.url),origin=new URL(input.origin);for(const url of[endpoint,origin]){if(url.username||url.password||url.search||url.hash||url.pathname!=="/"||url.protocol!=="https:"&&!(url.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(url.hostname)))throw new Error("Invalid origin")}const root=await realpath(input.directory);const inside=(path)=>{const result=relative(root,path);if(result.startsWith("..")||result.startsWith("/"))throw new Error("Path outside app");return result};const chosen=input.layout??(existsSync(resolve(root,"resources/views/layouts/default.stx"))?"resources/views/layouts/default.stx":"resources/layouts/default.stx");const layout=await realpath(resolve(root,chosen));if(!layout.endsWith(".stx"))throw new Error("Choose an stx layout");const layoutName=inside(layout),before=await readFile(layout,"utf8");const component=resolve(root,"resources/components/HqSupport.stx");await mkdir(dirname(component),{recursive:true});inside(await realpath(dirname(component)));if(existsSync(component)){inside(await realpath(component));if(await readFile(component,"utf8")!==input.componentSource)throw new Error("Existing customized support component")}const result=await deps.fetch(`${endpoint.origin}/api/v1/projects/${encodeURIComponent(service.project)}/installation`,{method:"POST",headers:{Authorization:`Bearer ${service.key}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({origin:origin.origin,frameworkVersion:input.frameworkVersion}),redirect:"error",signal:AbortSignal.timeout(1e4)});if(!result.ok){deps.print(`HQ.support refused the installation origin (${result.status}). No messenger was enabled.`);return false}const body=await result.json();if(body.project!==service.project||body.origin!==origin.origin||body.allowed!==true)throw new Error("Origin not confirmed");await writeFile(component,input.componentSource);if(!before.includes("<HqSupport")){const after=/<\/body\s*>/i.test(before)?before.replace(/<\/body\s*>/i,` <HqSupport />
2
+ </body>`):`${before.trimEnd()}
3
+
4
+ <HqSupport />
5
+ `;await writeFile(layout,after)}await deps.writeEnv({SUPPORTHQ_ENABLED:"true",SUPPORTHQ_MESSENGER:"true"});deps.print("Configured resources/components/HqSupport.stx.");deps.print(`Mounted <HqSupport /> in ${layoutName}.`);deps.print(`Approved exact messenger origin ${origin.origin}.`);deps.print("Enabled SUPPORTHQ_ENABLED and SUPPORTHQ_MESSENGER in .env. Optional name/email sharing remains off.");return true}catch{deps.print("Messenger installation did not complete. Use an app-local stx layout and a public HTTPS or local app origin; existing customized components are preserved.");return false}}
@@ -0,0 +1,12 @@
1
+ import type { HqServicesConfig } from '@stacksjs/types';
2
+ /** Publish an ownership challenge, then confirm it after the consumer is deployed. */
3
+ export declare function runSupportVerification(config: HqServicesConfig, originInput: string, options: { confirm?: boolean, frameworkVersion: string }, deps: SupportVerificationDeps): Promise<boolean>;
4
+ export declare interface SupportVerificationState { id: string, nonce: string, project: string, origin: string, expiresAt: number }
5
+ export declare interface SupportVerificationDeps {
6
+ fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>
7
+ print: (message: string) => void
8
+ writeDocument: (document: Record<string, string>) => Promise<void>
9
+ readState: () => Promise<unknown>
10
+ writeState: (state: SupportVerificationState) => Promise<void>
11
+ now?: () => number
12
+ }
@@ -0,0 +1 @@
1
+ class VerificationError extends Error{}function row(value){return value!==null&&typeof value==="object"&&!Array.isArray(value)}function state(value){return row(value)&&typeof value.id==="string"&&/^\d+$/.test(value.id)&&typeof value.nonce==="string"&&/^[a-f0-9]{64}$/.test(value.nonce)&&typeof value.project==="string"&&typeof value.origin==="string"&&Number.isSafeInteger(value.expiresAt)}export async function runSupportVerification(config,originInput,options,deps){try{const service=config.supporthq;if(!service?.key||!service.project)throw new VerificationError("Connect HQ.support first with `buddy support:install`.");const origin=new URL(originInput);if(origin.protocol!=="https:"||origin.username||origin.password||origin.port||origin.search||origin.hash||origin.pathname!=="/")throw new VerificationError("Use the public HTTPS origin of your deployed Stacks app.");const base=new URL(service.url);if(base.username||base.password||base.hash||base.search||base.protocol!=="https:"&&!(base.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(base.hostname)))throw new VerificationError("HQ.support needs HTTPS, except a local development service.");const endpoint=`${base.href.replace(/\/$/,"")}/api/v1/projects/${encodeURIComponent(service.project)}/verification/challenges`;async function post(url,body){const response=await deps.fetch(url,{method:"POST",headers:{Authorization:`Bearer ${service.key}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(body),redirect:"error",signal:AbortSignal.timeout(1e4)});if(!response.ok)throw new VerificationError(`HQ.support refused verification (${response.status}).`);return await response.json()}if(options.confirm){const current=await deps.readState();if(!state(current)||current.project!==service.project||current.origin!==origin.origin||current.expiresAt<=(deps.now??Date.now)())throw new VerificationError("Start a new challenge for this project and origin before confirming.");const answer=await post(`${endpoint}/${encodeURIComponent(current.id)}/confirm`,{nonce:current.nonce});if(!row(answer)||answer.verified!==true||answer.plan!=="free")throw new VerificationError("HQ.support did not confirm the free workspace.");deps.print("Stacks Free verified: 2 agents, 100 conversations + 20% grace, 10 text AI conversations, 300 MB attachments (10 MB/file).");return true}const answer=await post(endpoint,{origin:origin.origin,frameworkVersion:options.frameworkVersion});if(!row(answer)||!state(answer.challenge)||!row(answer.document))throw new VerificationError("HQ.support returned an invalid challenge.");const challenge=answer.challenge;const document=answer.document;if(challenge.project!==service.project||challenge.origin!==origin.origin||challenge.expiresAt<=(deps.now??Date.now)()||document.service!=="supporthq"||document.project!==service.project||document.nonce!==challenge.nonce||document.framework!=="stacks"||document.frameworkVersion!==options.frameworkVersion)throw new VerificationError("HQ.support returned a challenge for a different installation.");await deps.writeDocument({service:"supporthq",project:service.project,nonce:challenge.nonce,framework:"stacks",frameworkVersion:options.frameworkVersion});await deps.writeState({id:challenge.id,nonce:challenge.nonce,project:challenge.project,origin:challenge.origin,expiresAt:challenge.expiresAt});deps.print("Created public/.well-known/hq-support. Deploy this file with your app, then confirm before the ten-minute challenge expires:");deps.print(`buddy support:verify ${origin.origin} --confirm`);deps.print("The domain proves deployment ownership; the framework version is a self-reported eligibility signal.");return true}catch(error){deps.print(error instanceof VerificationError?error.message:"HQ.support verification could not complete. No free allowance was claimed.");return false}}
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.575",
5
+ "version": "0.75.580",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -95,74 +95,74 @@
95
95
  "prepublishOnly": "bun run build"
96
96
  },
97
97
  "dependencies": {
98
- "@stacksjs/actions": "0.75.575",
99
- "@stacksjs/docs": "0.75.575",
100
- "@stacksjs/ai": "0.75.575",
101
- "@stacksjs/alias": "0.75.575",
102
- "@stacksjs/analytics": "0.75.575",
103
- "@stacksjs/api": "0.75.575",
104
- "@stacksjs/arrays": "0.75.575",
105
- "@stacksjs/auth": "0.75.575",
106
- "@stacksjs/browser-extension": "0.75.575",
107
- "@stacksjs/build": "0.75.575",
98
+ "@stacksjs/actions": "0.75.580",
99
+ "@stacksjs/docs": "0.75.580",
100
+ "@stacksjs/ai": "0.75.580",
101
+ "@stacksjs/alias": "0.75.580",
102
+ "@stacksjs/analytics": "0.75.580",
103
+ "@stacksjs/api": "0.75.580",
104
+ "@stacksjs/arrays": "0.75.580",
105
+ "@stacksjs/auth": "0.75.580",
106
+ "@stacksjs/browser-extension": "0.75.580",
107
+ "@stacksjs/build": "0.75.580",
108
108
  "@stacksjs/bumpx": "^0.2.26",
109
- "@stacksjs/cache": "0.75.575",
110
- "@stacksjs/chat": "0.75.575",
109
+ "@stacksjs/cache": "0.75.580",
110
+ "@stacksjs/chat": "0.75.580",
111
111
  "@stacksjs/clapp": "^0.2.17",
112
- "@stacksjs/cli": "0.75.575",
113
- "@stacksjs/cloud": "0.75.575",
114
- "@stacksjs/cms": "0.75.575",
115
- "@stacksjs/collections": "0.75.575",
116
- "@stacksjs/commerce": "0.75.575",
117
- "@stacksjs/config": "0.75.575",
118
- "@stacksjs/database": "0.75.575",
119
- "@stacksjs/desktop-build": "0.75.575",
120
- "@stacksjs/dns": "0.75.575",
112
+ "@stacksjs/cli": "0.75.580",
113
+ "@stacksjs/cloud": "0.75.580",
114
+ "@stacksjs/cms": "0.75.580",
115
+ "@stacksjs/collections": "0.75.580",
116
+ "@stacksjs/commerce": "0.75.580",
117
+ "@stacksjs/config": "0.75.580",
118
+ "@stacksjs/database": "0.75.580",
119
+ "@stacksjs/desktop-build": "0.75.580",
120
+ "@stacksjs/dns": "0.75.580",
121
121
  "@stacksjs/dnsx": "^0.2.3",
122
- "@stacksjs/email": "0.75.575",
123
- "@stacksjs/enums": "0.75.575",
124
- "@stacksjs/env": "0.75.575",
125
- "@stacksjs/error-handling": "0.75.575",
126
- "@stacksjs/events": "0.75.575",
127
- "@stacksjs/features": "0.75.575",
128
- "@stacksjs/git": "0.75.575",
122
+ "@stacksjs/email": "0.75.580",
123
+ "@stacksjs/enums": "0.75.580",
124
+ "@stacksjs/env": "0.75.580",
125
+ "@stacksjs/error-handling": "0.75.580",
126
+ "@stacksjs/events": "0.75.580",
127
+ "@stacksjs/features": "0.75.580",
128
+ "@stacksjs/git": "0.75.580",
129
129
  "@stacksjs/gitit": "^0.2.5",
130
- "@stacksjs/health": "0.75.575",
131
- "@stacksjs/hq": "0.75.575",
130
+ "@stacksjs/health": "0.75.580",
131
+ "@stacksjs/hq": "0.75.580",
132
132
  "@stacksjs/httx": "^0.1.10",
133
- "@stacksjs/image": "0.75.575",
134
- "@stacksjs/lint": "0.75.575",
135
- "@stacksjs/logging": "0.75.575",
136
- "@stacksjs/notifications": "0.75.575",
137
- "@stacksjs/objects": "0.75.575",
138
- "@stacksjs/orm": "0.75.575",
139
- "@stacksjs/path": "0.75.575",
140
- "@stacksjs/payments": "0.75.575",
141
- "@stacksjs/realtime": "0.75.575",
142
- "@stacksjs/router": "0.75.575",
133
+ "@stacksjs/image": "0.75.580",
134
+ "@stacksjs/lint": "0.75.580",
135
+ "@stacksjs/logging": "0.75.580",
136
+ "@stacksjs/notifications": "0.75.580",
137
+ "@stacksjs/objects": "0.75.580",
138
+ "@stacksjs/orm": "0.75.580",
139
+ "@stacksjs/path": "0.75.580",
140
+ "@stacksjs/payments": "0.75.580",
141
+ "@stacksjs/realtime": "0.75.580",
142
+ "@stacksjs/router": "0.75.580",
143
143
  "@stacksjs/rpx": "^0.11.54",
144
- "@stacksjs/scheduler": "0.75.575",
145
- "@stacksjs/search-engine": "0.75.575",
146
- "@stacksjs/security": "0.75.575",
147
- "@stacksjs/server": "0.75.575",
148
- "@stacksjs/sites": "0.75.575",
149
- "@stacksjs/skills": "0.75.575",
150
- "@stacksjs/socials": "0.75.575",
151
- "@stacksjs/storage": "0.75.575",
152
- "@stacksjs/strings": "0.75.575",
153
- "@stacksjs/stx": "^0.2.864",
154
- "@stacksjs/testing": "0.75.575",
155
- "@stacksjs/tinker": "0.75.575",
144
+ "@stacksjs/scheduler": "0.75.580",
145
+ "@stacksjs/search-engine": "0.75.580",
146
+ "@stacksjs/security": "0.75.580",
147
+ "@stacksjs/server": "0.75.580",
148
+ "@stacksjs/sites": "0.75.580",
149
+ "@stacksjs/skills": "0.75.580",
150
+ "@stacksjs/socials": "0.75.580",
151
+ "@stacksjs/storage": "0.75.580",
152
+ "@stacksjs/strings": "0.75.580",
153
+ "@stacksjs/stx": "^0.2.872",
154
+ "@stacksjs/testing": "0.75.580",
155
+ "@stacksjs/tinker": "0.75.580",
156
156
  "@stacksjs/tlsx": "^0.13.19",
157
157
  "@stacksjs/ts-cloud": "^0.16.126",
158
- "@stacksjs/tunnel": "0.75.575",
159
- "@stacksjs/types": "0.75.575",
160
- "@stacksjs/ui": "0.75.575",
161
- "@stacksjs/utils": "0.75.575",
162
- "@stacksjs/validation": "0.75.575",
158
+ "@stacksjs/tunnel": "0.75.580",
159
+ "@stacksjs/types": "0.75.580",
160
+ "@stacksjs/ui": "0.75.580",
161
+ "@stacksjs/utils": "0.75.580",
162
+ "@stacksjs/validation": "0.75.580",
163
163
  "ajv": "^8.20.0",
164
164
  "ajv-formats": "^3.0.1",
165
- "bun-plugin-stx": "^0.2.864",
165
+ "bun-plugin-stx": "^0.2.872",
166
166
  "ts-pantry": "^0.11.205"
167
167
  },
168
168
  "devDependencies": {