@stacksjs/buddy 0.75.90 → 0.75.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/feedback.d.ts +2 -0
- package/dist/commands/feedback.js +5 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +1 -1
- package/dist/commands/socials.d.ts +2 -0
- package/dist/commands/socials.js +12 -0
- package/dist/feedback-links.d.ts +88 -0
- package/dist/feedback-links.js +2 -0
- package/dist/lazy-commands.js +1 -1
- package/package.json +55 -54
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import process from"node:process";import{log,onUnknownSubcommand}from"@stacksjs/cli";import{ExitCode}from"@stacksjs/types";import{FEEDBACK_BOARD_COLUMNS,FEEDBACK_BOARD_NAME,feedbackSubmitUrl,parseBoardRef,parseExpiryDays,parseRowRef,renderFeedbackTokens,toStoredTimestamp}from"../feedback-links";async function loadFeedbackToken(){const{existsSync}=await import("node:fs"),{join}=await import("node:path"),relative="Actions/Dashboard/Feedback/feedback-token.ts",candidates=[join(process.cwd(),"app",relative),join(process.cwd(),"storage/framework/defaults/app",relative),join(process.cwd(),"node_modules/@stacksjs/defaults/app",relative)];for(const candidate of candidates){if(!existsSync(candidate))continue;const loaded=await import(candidate);if(typeof loaded?.mintFeedbackToken==="function")return loaded}await log.error(`Could not find ${relative}. Looked in app/, the framework defaults and @stacksjs/defaults.`);await log.flush();process.exit(ExitCode.FatalError)}async function appUrl(){const{config,overridesReady}=await import("@stacksjs/config");await overridesReady.catch(()=>{});return config?.app?.url}async function database(){const{db}=await import("@stacksjs/database/runtime");return db}async function reportDatabaseError(err){const message=err instanceof Error?err.message:String(err);if(/feedback_tokens/.test(message)&&/no such table|does not exist|doesn't exist/i.test(message)){await log.error("There is no `feedback_tokens` table yet.");log.info("Run `buddy migrate` (the table ships with the dashboard feature).")}else await log.error(message);await log.flush();process.exit(ExitCode.FatalError)}async function resolveBoard(db,ref,create){const query=db.selectFrom("boards").select(["id","name"]),found=ref.kind==="id"?await query.where("id","=",ref.id).executeTakeFirst():await query.where("name","=",ref.name).orderBy("id","asc").executeTakeFirst();if(found)return Number(found.id);if(ref.kind==="id"){await log.error(`There is no board ${ref.id}.`);await log.flush();process.exit(ExitCode.FatalError)}if(!create){await log.error(`There is no board called \`${ref.name}\`.`);log.info("Pass --create-board to make one, or --board <id> to pick an existing board.");await log.flush();process.exit(ExitCode.FatalError)}const position=await db.selectFrom("boards").select(["id"]).execute();await db.insertInto("boards").values({name:ref.name,description:"Feedback from external reviewers.",icon:"bubble.left.and.text.bubble.right.fill",color:"violet",position:position.length,archived:!1}).execute();const created=await db.selectFrom("boards").select(["id"]).where("name","=",ref.name).orderBy("id","desc").executeTakeFirst(),boardId=Number(created?.id);if(!Number.isInteger(boardId)||boardId<=0){await log.error(`Created the \`${ref.name}\` board but could not read its id back.`);await log.flush();process.exit(ExitCode.FatalError)}for(const[index,name]of FEEDBACK_BOARD_COLUMNS.entries())await db.insertInto("board_columns").values({board_id:boardId,name,position:index}).execute();log.success(`Created the \`${ref.name}\` board with ${FEEDBACK_BOARD_COLUMNS.length} columns`);return boardId}export function feedback(buddy){buddy.command("feedback:invite <label>","Mint a revocable link an external reviewer files feedback through").option("--board <board>",`Board id or name to file into. Defaults to \`${FEEDBACK_BOARD_NAME}\`.`).option("--expires <days>","Expire the link after this many days. Omitted, it lasts until revoked.").option("--create-board","Create the board, with columns, if it does not exist",{default:!1}).example("buddy feedback:invite Pawel").example("buddy feedback:invite Pawel --expires 30 --create-board").example('buddy feedback:invite "Design review" --board 3').action(async(label,options)=>{const name=String(label||"").trim();if(!name||name.length>120){await log.error("A label of 1 to 120 characters is required. It is who the link is for, and it is how you revoke the right one.");await log.flush();process.exit(ExitCode.FatalError)}const expiry=parseExpiryDays(options.expires,new Date);if(!expiry.ok){await log.error(expiry.message);await log.flush();process.exit(ExitCode.FatalError)}const url=await appUrl();if(!url?.trim()){await log.error("No app URL configured, so there is no link to hand out. Set APP_URL or config.app.url.");await log.flush();process.exit(ExitCode.FatalError)}const{mintFeedbackToken}=await loadFeedbackToken(),db=await database();try{const boardId=await resolveBoard(db,parseBoardRef(options.board),options.createBoard===!0),{raw,hash}=mintFeedbackToken();await db.insertInto("feedback_tokens").values({token:hash,label:name,board_id:boardId,expires_at:expiry.at?toStoredTimestamp(expiry.at):null}).execute();const row=await db.selectFrom("feedback_tokens").select(["id"]).where("token","=",hash).executeTakeFirst();process.stdout.write(`
|
|
2
|
+
${feedbackSubmitUrl(url,raw)}
|
|
3
|
+
|
|
4
|
+
`);log.info(`Link ${row?.id??"?"} for ${name}, filing into board ${boardId}${expiry.at?`, expires ${toStoredTimestamp(expiry.at)} UTC`:""}.`);log.info("That link is shown once; only its hash is stored. Revoke it with `buddy feedback:revoke`.")}catch(err){await reportDatabaseError(err)}await log.flush();process.exit(ExitCode.Success)});buddy.command("feedback:tokens","List the feedback links and whether they still work").option("--board <board>","Only links filing into this board id or name").example("buddy feedback:tokens").example("buddy feedback:tokens --board Feedback").action(async(options)=>{const{authorizeFeedbackToken}=await loadFeedbackToken(),db=await database();try{let query=db.selectFrom("feedback_tokens").select(["id","label","board_id","revoked_at","expires_at","last_used_at"]);if(options.board){const ref=parseRowRef(options.board);if(!ref){await log.error(`\`${options.board}\` is not a board id or name.`);await log.flush();process.exit(ExitCode.FatalError)}let ids=[ref.kind==="id"?ref.id:0];if(ref.kind==="name"){const boards=await db.selectFrom("boards").select(["id"]).where("name","=",ref.name).execute();if(boards.length===0){await log.error(`There is no board called \`${ref.name}\`.`);await log.flush();process.exit(ExitCode.FatalError)}ids=boards.map((board)=>Number(board.id))}query=query.where("board_id","in",ids)}const rows=await query.orderBy("id","desc").execute();process.stdout.write(`${renderFeedbackTokens(rows.map((row)=>{const verdict=authorizeFeedbackToken(row);return{id:Number(row.id),label:String(row.label??""),boardId:Number(row.board_id??0),status:verdict.ok?"active":verdict.reason,lastUsedAt:row.last_used_at??null,expiresAt:row.expires_at??null}}))}
|
|
5
|
+
`)}catch(err){await reportDatabaseError(err)}await log.flush();process.exit(ExitCode.Success)});buddy.command("feedback:revoke <link>","Stop a feedback link, by id or by the label it was minted with").example("buddy feedback:revoke 3").example("buddy feedback:revoke Pawel").action(async(link)=>{const ref=parseRowRef(link);if(!ref){await log.error("Name the link to revoke, by id or by label. `buddy feedback:tokens` lists them.");await log.flush();process.exit(ExitCode.FatalError)}const db=await database();try{const query=db.selectFrom("feedback_tokens").select(["id","label","revoked_at"]),matches=await(ref.kind==="id"?query.where("id","=",ref.id):query.where("label","=",ref.name)).orderBy("id","asc").execute();if(matches.length===0){await log.error(ref.kind==="id"?`There is no feedback link ${ref.id}.`:`No feedback link is labelled \`${ref.name}\`.`);await log.flush();process.exit(ExitCode.FatalError)}const row=matches[0];if(matches.length>1){await log.error(`${matches.length} links are labelled \`${row.label}\`. Revoke one by id: ${matches.map((match)=>match.id).join(", ")}.`);await log.flush();process.exit(ExitCode.FatalError)}if(row.revoked_at){log.info(`Link ${row.id} (${row.label}) was already revoked at ${row.revoked_at} UTC.`);await log.flush();process.exit(ExitCode.Success)}const at=toStoredTimestamp(new Date);await db.updateTable("feedback_tokens").set({revoked_at:at}).where("id","=",Number(row.id)).execute();log.success(`Revoked link ${row.id} (${row.label}). Submissions through it are refused from now on.`)}catch(err){await reportDatabaseError(err)}await log.flush();process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"feedback")}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './domains';
|
|
|
24
24
|
export * from './email';
|
|
25
25
|
export * from './env';
|
|
26
26
|
export * from './features';
|
|
27
|
+
export * from './feedback';
|
|
27
28
|
export * from './fresh';
|
|
28
29
|
export * from './gdpr';
|
|
29
30
|
export * from './generate';
|
|
@@ -56,6 +57,7 @@ export * from './seed';
|
|
|
56
57
|
export * from './serve';
|
|
57
58
|
export * from './setup';
|
|
58
59
|
export * from './sms';
|
|
60
|
+
export * from './socials';
|
|
59
61
|
export * from './telemetry';
|
|
60
62
|
export * from './test';
|
|
61
63
|
export * from './tinker';
|
package/dist/commands/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./about";export*from"./auth";export*from"./build";export*from"./cd";export*from"./changelog";export*from"./clean";export*from"./cloud";export*from"./comments";export*from"./commerce-import";export*from"./commit";export*from"./completion";export*from"./config-migrate";export*from"./configure";export*from"./create";export*from"./db";export*from"./storage-backup";export*from"./deploy";export*from"./deploy-preview";export*from"./dev";export*from"./dns";export*from"./docs";export*from"./doctor";export*from"./domains";export*from"./email";export*from"./env";export*from"./features";export*from"./fresh";export*from"./gdpr";export*from"./generate";export*from"./http";export*from"./install";export*from"./key";export*from"./libs";export*from"./lint";export*from"./list";export*from"./mail";export*from"./make";export*from"./migrate";export*from"./migrate-project";export*from"./outdated";export*from"./phone";export*from"./ports";export*from"./server";export*from"./link";export*from"./user";export*from"./prepublish";export*from"./projects";export*from"./publish";export*from"./queue";export*from"./release";export*from"./route";export*from"./saas";export*from"./schedule";export*from"./search";export*from"./seed";export*from"./serve";export*from"./setup";export*from"./sms";export*from"./telemetry";export*from"./test";export*from"./tinker";export*from"./types";export*from"./upgrade";export*from"./version";
|
|
1
|
+
export*from"./about";export*from"./auth";export*from"./build";export*from"./cd";export*from"./changelog";export*from"./clean";export*from"./cloud";export*from"./comments";export*from"./commerce-import";export*from"./commit";export*from"./completion";export*from"./config-migrate";export*from"./configure";export*from"./create";export*from"./db";export*from"./storage-backup";export*from"./deploy";export*from"./deploy-preview";export*from"./dev";export*from"./dns";export*from"./docs";export*from"./doctor";export*from"./domains";export*from"./email";export*from"./env";export*from"./features";export*from"./feedback";export*from"./fresh";export*from"./gdpr";export*from"./generate";export*from"./http";export*from"./install";export*from"./key";export*from"./libs";export*from"./lint";export*from"./list";export*from"./mail";export*from"./make";export*from"./migrate";export*from"./migrate-project";export*from"./outdated";export*from"./phone";export*from"./ports";export*from"./server";export*from"./link";export*from"./user";export*from"./prepublish";export*from"./projects";export*from"./publish";export*from"./queue";export*from"./release";export*from"./route";export*from"./saas";export*from"./schedule";export*from"./search";export*from"./seed";export*from"./serve";export*from"./setup";export*from"./sms";export*from"./socials";export*from"./telemetry";export*from"./test";export*from"./tinker";export*from"./types";export*from"./upgrade";export*from"./version";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import process from"node:process";import{log,onUnknownSubcommand}from"@stacksjs/cli";import{ExitCode}from"@stacksjs/types";const DEFAULT_PORT=7731,DEFAULT_TIMEOUT_SECONDS=300;async function socialsModule(){return import("@stacksjs/socials")}async function fail(message,hint){await log.error(message);if(hint)log.info(hint);await log.flush();process.exit(ExitCode.FatalError)}export function socials(buddy){buddy.command("socials:identities","List the social identities and whether each platform is ready to post").example("buddy socials:identities").action(async()=>{const{pickIdentity,readCredentials,REQUIRED_SOCIAL_CREDENTIALS,socialsConfig}=await socialsModule(),config=await socialsConfig(),names=Object.keys(config.identities??{});if(names.length===0){log.info("config/socials.ts declares no identities, so there is no account to post as.");await log.flush();process.exit(ExitCode.Success)}let fallback="";try{fallback=pickIdentity(config)}catch{}const out=[""];for(const name of names){const declared=config.identities?.[name]??{},platforms=declared.platforms??[],marker=name===fallback?"*":" ";out.push(` ${marker} ${name}${declared.handle?` (${declared.handle})`:""}`);if(platforms.length===0){out.push(" no platforms declared");continue}for(const platform of platforms){const resolved=readCredentials(config,platform,name),missing=REQUIRED_SOCIAL_CREDENTIALS[platform].filter((field)=>!resolved[field]);out.push(missing.length===0?` ok ${platform}`:` MISSING ${platform} ${missing.join(", ")}`)}}if(fallback)out.push(""," * is the identity a call with no name uses.");else if(names.length>1)out.push(""," No default, so a call has to name its identity.");console.log(out.join(`
|
|
2
|
+
`));await log.flush();process.exit(ExitCode.Success)});buddy.command("socials:authorize [identity]","Run a platform consent flow and print the tokens for .env").option("--platform <platform>","Which platform to authorize. Only `twitter` needs a consent flow today.",{default:"twitter"}).option("--port <port>","Loopback port the redirect comes back on. Must match the registered redirect URI.",{default:String(DEFAULT_PORT)}).option("--timeout <seconds>","How long to wait at the browser",{default:String(DEFAULT_TIMEOUT_SECONDS)}).example("buddy socials:authorize home-lang").example("buddy socials:authorize stacks --platform twitter --port 7731").action(async(identity,options)=>{const{callbackPage,callbackUri,completeTwitterAuthorization,envLines,isAuthorizablePlatform,newState,readCallback,readCredentials,resolveIdentityName,socialsConfig,startTwitterAuthorization,TWITTER_PUBLISH_SCOPES}=await socialsModule(),platform=String(options.platform||"twitter").toLowerCase();if(!isAuthorizablePlatform(platform))return fail(`There is no consent flow for '${platform}'.`,"Bluesky uses an app password and Mastodon a manually generated token, so both go straight into .env. Only `twitter` needs this.");const port=Number(options.port),timeoutMs=Math.max(10,Number(options.timeout)||DEFAULT_TIMEOUT_SECONDS)*1000;let name,redirectUrl;try{name=await resolveIdentityName(identity);redirectUrl=callbackUri(port)}catch(error){return fail(error instanceof Error?error.message:String(error))}const config=await socialsConfig(),credentials=readCredentials(config,"twitter",name);if(!credentials.clientId)return fail(`Identity '${name}' has no X client id, so there is nothing to start a consent flow with.`,"Set SOCIALS_"+name.toUpperCase().replace(/[^A-Z0-9]/g,"")+"_TWITTER_CLIENT_ID (and _CLIENT_SECRET for a confidential app) first.");const state=newState(),{url,codeVerifier}=await startTwitterAuthorization({clientId:credentials.clientId,redirectUrl,state});log.info(`Authorizing '${name}' on X, asking for: ${TWITTER_PUBLISH_SCOPES.join(" ")}`);log.info(`The app's registered redirect URI must be exactly ${redirectUrl}`);await log.flush();process.stdout.write(`
|
|
3
|
+
Open this and approve:
|
|
4
|
+
|
|
5
|
+
${url}
|
|
6
|
+
|
|
7
|
+
Waiting for the redirect...
|
|
8
|
+
`);const outcome=await new Promise((resolve)=>{const timer=setTimeout(()=>{resolve({ok:!1,message:`Nothing came back within ${Math.round(timeoutMs/1000)}s.`})},timeoutMs);let server;const settle=(value)=>{clearTimeout(timer);resolve(value);setTimeout(()=>server?.stop(!0),500).unref()};try{server=Bun.serve({port,hostname:"127.0.0.1",fetch(request){const reading=readCallback(request.url,state);if(!reading.ok&&reading.reason==="not-the-callback")return new Response("Not found",{status:404});if(!reading.ok){settle({ok:!1,message:reading.message});return new Response(callbackPage("Could not authorize",reading.message),{status:400,headers:{"content-type":"text/html; charset=utf-8"}})}settle({ok:!0,code:reading.code});return new Response(callbackPage("Authorized","You can close this tab and go back to the terminal."),{headers:{"content-type":"text/html; charset=utf-8"}})}})}catch(error){const message=error instanceof Error?error.message:String(error);clearTimeout(timer);resolve({ok:!1,message:`Could not listen on ${port}: ${message}`})}});if(!outcome.ok)return fail(outcome.message,"Run it again when you are ready; nothing was changed.");let authorized;try{authorized=await completeTwitterAuthorization({clientId:credentials.clientId,clientSecret:credentials.clientSecret,redirectUrl,code:outcome.code,codeVerifier})}catch(error){return fail(`X refused the exchange: ${error instanceof Error?error.message:String(error)}`,"The authorization code is single-use, so start over rather than retrying.")}log.success(`Authorized @${authorized.handle} (${authorized.accountId}) for identity '${name}'`);if(!authorized.renewable){log.warn("X returned no refresh token, so this access token cannot be renewed.");log.info("Add `offline.access` to the app's scopes and run this again, or the identity stops posting in a couple of hours.")}await log.flush();const lines=envLines(name,"twitter",{accessToken:authorized.accessToken,refreshToken:authorized.refreshToken});process.stdout.write(`
|
|
9
|
+
${lines.map((line)=>` ${line}`).join(`
|
|
10
|
+
`)}
|
|
11
|
+
|
|
12
|
+
`);log.info("Put those in .env. They are shown once and are not stored anywhere by this command.");if(authorized.expiresIn)log.info(`The access token expires in ${authorized.expiresIn}s; the refresh token is what renews it.`);await log.flush();process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"socials")}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an argument that may be an id or a name.
|
|
3
|
+
*
|
|
4
|
+
* All digits reads as an id, because that is what the listing prints and what
|
|
5
|
+
* an operator copies out of it. A board named `42` is therefore reachable
|
|
6
|
+
* only by its id, which is the right way round: ids are unique and names are
|
|
7
|
+
* not.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseRowRef(value: string | undefined): RowRef | null;
|
|
10
|
+
/** `--board`, defaulting to the conventional feedback board. */
|
|
11
|
+
export declare function parseBoardRef(value: string | undefined): RowRef;
|
|
12
|
+
/**
|
|
13
|
+
* `--expires <days>`, as an absolute instant.
|
|
14
|
+
*
|
|
15
|
+
* Days rather than a date because an invite is written in terms of how long
|
|
16
|
+
* the reviewer needs it, and because a bare date has no timezone. Omitted
|
|
17
|
+
* means the link does not expire on its own; revocation still stops it.
|
|
18
|
+
*
|
|
19
|
+
* `0` is refused rather than read as "never": an operator who means never
|
|
20
|
+
* leaves the flag off, and one who types `0` expecting that would otherwise
|
|
21
|
+
* mint a link that is already dead and only find out from the reviewer.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseExpiryDays(value: string | undefined, now: Date): ExpiryChoice;
|
|
24
|
+
/**
|
|
25
|
+
* A timestamp in the `YYYY-MM-DD HH:MM:SS` shape the columns hold, in UTC.
|
|
26
|
+
*
|
|
27
|
+
* Matches what the intake action writes to `last_used_at` and what
|
|
28
|
+
* `parseTokenTime` reads back as UTC. Writing a local-time string here would
|
|
29
|
+
* expire a link hours early or late depending on where it was minted.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toStoredTimestamp(at: Date): string;
|
|
32
|
+
/**
|
|
33
|
+
* The URL to hand the reviewer: the form, not the endpoint behind it.
|
|
34
|
+
*
|
|
35
|
+
* `/feedback/{token}` is the page; it posts to `/api/feedback/{token}` itself.
|
|
36
|
+
* Handing out the endpoint would hand out something only a developer with a
|
|
37
|
+
* terminal could use.
|
|
38
|
+
*
|
|
39
|
+
* `config.app.url` is a bare host in a default app (`stacks.localhost`), so
|
|
40
|
+
* the scheme is added when it is missing, the way the dev server and the
|
|
41
|
+
* mobile build already do. Any path, query or fragment on the configured URL
|
|
42
|
+
* is dropped: the page is registered at an absolute path.
|
|
43
|
+
*/
|
|
44
|
+
export declare function feedbackSubmitUrl(appUrl: string | undefined, rawToken: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* The `feedback:tokens` table.
|
|
47
|
+
*
|
|
48
|
+
* The status column comes from the same `authorizeFeedbackToken` the intake
|
|
49
|
+
* action uses, so the listing cannot claim a link works when a submission
|
|
50
|
+
* through it would be refused.
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderFeedbackTokens(rows: FeedbackTokenSummary[]): string;
|
|
53
|
+
/**
|
|
54
|
+
* The decisions behind `buddy feedback:invite`, `feedback:tokens` and
|
|
55
|
+
* `feedback:revoke`, kept out of the command so they can be tested.
|
|
56
|
+
*
|
|
57
|
+
* A feedback link is a capability: it may add one card to one board and can
|
|
58
|
+
* authenticate nothing (see the `FeedbackToken` model and
|
|
59
|
+
* stacksjs/stacks#2872). Until these commands existed the only way to mint
|
|
60
|
+
* one was to insert a row by hand and hash the token yourself, which meant
|
|
61
|
+
* the feature could not be exercised at all.
|
|
62
|
+
*/
|
|
63
|
+
/** The board a link files into when `--board` is not given. */
|
|
64
|
+
export declare const FEEDBACK_BOARD_NAME: 'Feedback';
|
|
65
|
+
/**
|
|
66
|
+
* The columns a board created by `feedback:invite --create-board` gets.
|
|
67
|
+
*
|
|
68
|
+
* The intake action files into the board's first column by position, so the
|
|
69
|
+
* first entry is where submissions land and the rest are where they go next.
|
|
70
|
+
* A board with no columns admits a valid token and then has nowhere to put
|
|
71
|
+
* the card, which the action reports as an invalid link, so creating the
|
|
72
|
+
* board without columns would be worse than not creating it.
|
|
73
|
+
*/
|
|
74
|
+
export declare const FEEDBACK_BOARD_COLUMNS: readonly ['Inbox', 'Triaged', 'In Progress', 'Done'];
|
|
75
|
+
export declare interface FeedbackTokenSummary {
|
|
76
|
+
id: number
|
|
77
|
+
label: string
|
|
78
|
+
boardId: number
|
|
79
|
+
status: FeedbackTokenStatus
|
|
80
|
+
lastUsedAt: string | null
|
|
81
|
+
expiresAt: string | null
|
|
82
|
+
}
|
|
83
|
+
/** Either a row id or a name, whichever the operator typed. */
|
|
84
|
+
export type RowRef = { kind: 'id', id: number } | { kind: 'name', name: string }
|
|
85
|
+
export type ExpiryChoice = | { ok: true, at: Date | null }
|
|
86
|
+
| { ok: false, message: string }
|
|
87
|
+
/** Why a listed link would be refused, or that it would not be. */
|
|
88
|
+
export type FeedbackTokenStatus = 'active' | 'revoked' | 'expired' | 'unbound';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const FEEDBACK_BOARD_NAME="Feedback",FEEDBACK_BOARD_COLUMNS=["Inbox","Triaged","In Progress","Done"];export function parseRowRef(value){const input=(value??"").trim();if(!input)return null;if(/^\d+$/.test(input)){const id=Number(input);return Number.isSafeInteger(id)&&id>0?{kind:"id",id}:null}return{kind:"name",name:input}}export function parseBoardRef(value){return parseRowRef(value)??{kind:"name",name:FEEDBACK_BOARD_NAME}}export function parseExpiryDays(value,now){if(value===void 0)return{ok:!0,at:null};const input=String(value).trim();if(!input)return{ok:!1,message:"--expires needs a number of days, for example --expires 30."};if(!/^\d+$/.test(input))return{ok:!1,message:`--expires takes a whole number of days, not \`${input}\`.`};const days=Number(input);if(days<1)return{ok:!1,message:"--expires must be at least 1 day. To stop a link now, use `buddy feedback:revoke`."};return{ok:!0,at:new Date(now.getTime()+days*86400000)}}export function toStoredTimestamp(at){return at.toISOString().slice(0,19).replace("T"," ")}export function feedbackSubmitUrl(appUrl,rawToken){const base=(appUrl??"").trim();if(!base)throw Error("No app URL configured. Set APP_URL or config.app.url.");const url=new URL(/^https?:\/\//i.test(base)?base:`https://${base}`);url.pathname=`/feedback/${rawToken}`;url.search="";url.hash="";return url.toString()}export function renderFeedbackTokens(rows){if(rows.length===0)return" No feedback links. Create one with `buddy feedback:invite <label>`.";const widest=(pick,header)=>Math.max(header.length,...rows.map((row)=>pick(row).length)),label=widest((row)=>row.label,"LABEL"),status=widest((row)=>row.status,"STATUS"),used=widest((row)=>row.lastUsedAt??"never","LAST USED"),lines=[` ${"ID".padStart(4)} ${"LABEL".padEnd(label)} ${"BOARD".padStart(5)} ${"STATUS".padEnd(status)} ${"LAST USED".padEnd(used)} EXPIRES`];for(const row of rows)lines.push([` ${String(row.id).padStart(4)}`,row.label.padEnd(label),String(row.boardId).padStart(5),row.status.padEnd(status),(row.lastUsedAt??"never").padEnd(used),row.expiresAt??"never"].join(" "));return lines.join(`
|
|
2
|
+
`)}
|
package/dist/lazy-commands.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export async function withTimeout(work,ms){let timeoutId;const deadline=new Promise((_,reject)=>{timeoutId=setTimeout(()=>reject(Error("timeout")),ms)});try{return await Promise.race([work,deadline])}finally{if(timeoutId!==void 0)clearTimeout(timeoutId)}}const commandRegistry={about:{path:"./commands/about.js",exportName:"about"},add:{path:"./commands/add.js",exportName:"add"},"ai:access":{path:"./commands/ai-access.js",exportName:"aiAccess"},"ai:context":{path:"./commands/ai-context.js",exportName:"aiContext"},auth:{path:"./commands/auth.js",exportName:"auth"},build:{path:"./commands/build.js",exportName:"build"},cd:{path:"./commands/cd.js",exportName:"cd"},changelog:{path:"./commands/changelog.js",exportName:"changelog"},clean:{path:"./commands/clean.js",exportName:"clean"},cloud:{path:"./commands/cloud.js",exportName:"cloud"},commit:{path:"./commands/commit.js",exportName:"commit"},completion:{path:"./commands/completion.js",exportName:"completion"},"config:migrate":{path:"./commands/config-migrate.js",exportName:"configMigrate"},configure:{path:"./commands/configure.js",exportName:"configure"},create:{path:"./commands/create.js",exportName:"create"},new:{path:"./commands/create.js",exportName:"create"},deploy:{path:"./commands/deploy.js",exportName:"deploy"},"deploy:rollback":{path:"./commands/deploy.js",exportName:"deploy"},dev:{path:"./commands/dev.js",exportName:"dev"},"desktop:apple:doctor":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:csr":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:init":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:package":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:provision":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:publish":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:probe":{path:"./commands/desktop-probe.js",exportName:"desktopProbe"},dns:{path:"./commands/dns.js",exportName:"dns"},"dns:pull":{path:"./commands/dns.js",exportName:"dns"},"dns:diff":{path:"./commands/dns.js",exportName:"dns"},"dns:sync":{path:"./commands/dns.js",exportName:"dns"},doctor:{path:"./commands/doctor.js",exportName:"doctor"},domains:{path:"./commands/domains.js",exportName:"domains"},email:{path:"./commands/email.js",exportName:"email"},env:{path:"./commands/env.js",exportName:"env"},"extension:init":{path:"./commands/extension.js",exportName:"extension"},"extension:build":{path:"./commands/extension.js",exportName:"extension"},"extension:package":{path:"./commands/extension.js",exportName:"extension"},"extension:chrome:publish":{path:"./commands/extension.js",exportName:"extension"},"extension:chrome:status":{path:"./commands/extension.js",exportName:"extension"},"extension:firefox:publish":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:init":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:provision":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:app":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:publish":{path:"./commands/extension.js",exportName:"extension"},"dashboard:install":{path:"./commands/features.js",exportName:"features"},"dashboard:uninstall":{path:"./commands/features.js",exportName:"features"},"commerce:install":{path:"./commands/features.js",exportName:"features"},"commerce:uninstall":{path:"./commands/features.js",exportName:"features"},"commerce:import":{path:"./commands/commerce-import.js",exportName:"commerceImport"},"cms:install":{path:"./commands/features.js",exportName:"features"},"cms:uninstall":{path:"./commands/features.js",exportName:"features"},"marketing:install":{path:"./commands/features.js",exportName:"features"},"marketing:uninstall":{path:"./commands/features.js",exportName:"features"},"monitoring:install":{path:"./commands/features.js",exportName:"features"},"monitoring:uninstall":{path:"./commands/features.js",exportName:"features"},"realtime:install":{path:"./commands/features.js",exportName:"features"},"realtime:uninstall":{path:"./commands/features.js",exportName:"features"},"queue:install":{path:"./commands/features.js",exportName:"features"},"queue:uninstall":{path:"./commands/features.js",exportName:"features"},"db:backup":{path:"./commands/db.js",exportName:"db"},"db:backups":{path:"./commands/db.js",exportName:"db"},"db:restore":{path:"./commands/db.js",exportName:"db"},"storage:backup":{path:"./commands/storage-backup.js",exportName:"storageBackup"},"storage:backups":{path:"./commands/storage-backup.js",exportName:"storageBackup"},"storage:restore":{path:"./commands/storage-backup.js",exportName:"storageBackup"},fresh:{path:"./commands/fresh.js",exportName:"fresh"},generate:{path:"./commands/generate.js",exportName:"generate"},"gdpr:export":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:erase":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:prune":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:register":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:register:check":{path:"./commands/gdpr.js",exportName:"gdpr"},http:{path:"./commands/http.js",exportName:"http"},install:{path:"./commands/install.js",exportName:"install"},key:{path:"./commands/key.js",exportName:"key"},lint:{path:"./commands/lint.js",exportName:"lint"},format:{path:"./commands/lint.js",exportName:"lint"},"format:check":{path:"./commands/lint.js",exportName:"lint"},libs:{path:"./commands/libs.js",exportName:"libs"},libraries:{path:"./commands/libs.js",exportName:"libs"},list:{path:"./commands/list.js",exportName:"list"},mail:{path:"./commands/mail.js",exportName:"mailCommands"},"mail:preview":{path:"./commands/mail.js",exportName:"mailCommands"},maintenance:{path:"./commands/maintenance.js",exportName:"maintenance"},down:{path:"./commands/maintenance.js",exportName:"maintenance"},up:{path:"./commands/maintenance.js",exportName:"maintenance"},status:{path:"./commands/maintenance.js",exportName:"maintenance"},"coming-soon":{path:"./commands/maintenance.js",exportName:"maintenance"},"coming-soon:status":{path:"./commands/maintenance.js",exportName:"maintenance"},launch:{path:"./commands/maintenance.js",exportName:"maintenance"},make:{path:"./commands/make.js",exportName:"make"},"scaffold:crud":{path:"./commands/make.js",exportName:"make"},migrate:{path:"./commands/migrate.js",exportName:"migrate"},"migrate:fresh":{path:"./commands/migrate.js",exportName:"migrate"},"migrate:switch":{path:"./commands/migrate.js",exportName:"migrate"},"migrate:project":{path:"./commands/migrate-project.js",exportName:"migrateProject"},outdated:{path:"./commands/outdated.js",exportName:"outdated"},package:{path:"./commands/package.js",exportName:"packageCommands"},phone:{path:"./commands/phone.js",exportName:"phone"},ports:{path:"./commands/ports.js",exportName:"ports"},"server:flash":{path:"./commands/server.js",exportName:"server"},"server:first-boot":{path:"./commands/server.js",exportName:"server"},"server:doctor":{path:"./commands/server.js",exportName:"server"},"server:setup":{path:"./commands/server.js",exportName:"server"},"server:trust":{path:"./commands/server.js",exportName:"server"},"link:core":{path:"./commands/link.js",exportName:"link"},"comments:list":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:approve":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:reject":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:delete":{path:"./commands/comments.js",exportName:"commentsCommands"},"user:add":{path:"./commands/user.js",exportName:"user"},"user:list":{path:"./commands/user.js",exportName:"user"},"unlink:core":{path:"./commands/link.js",exportName:"link"},prepublish:{path:"./commands/prepublish.js",exportName:"prepublish"},projects:{path:"./commands/projects.js",exportName:"projects"},publish:{path:"./commands/publish.js",exportName:"publish"},"publish:model":{path:"./commands/publish.js",exportName:"publish"},"publish:controller":{path:"./commands/publish.js",exportName:"publish"},"publish:middleware":{path:"./commands/publish.js",exportName:"publish"},"publish:action":{path:"./commands/publish.js",exportName:"publish"},"publish:core":{path:"./commands/publish.js",exportName:"publish"},"core:status":{path:"./commands/publish.js",exportName:"publish"},queue:{path:"./commands/queue.js",exportName:"queue"},release:{path:"./commands/release.js",exportName:"release"},route:{path:"./commands/route.js",exportName:"route"},saas:{path:"./commands/saas.js",exportName:"saas"},"stripe:setup":{path:"./commands/saas.js",exportName:"saas"},schedule:{path:"./commands/schedule.js",exportName:"schedule"},search:{path:"./commands/search.js",exportName:"search"},"search-engine:update":{path:"./commands/search.js",exportName:"search"},"search-engine:settings":{path:"./commands/search.js",exportName:"search"},seed:{path:"./commands/seed.js",exportName:"seed"},"seed:roles":{path:"./commands/seed.js",exportName:"seed"},"roles:seed":{path:"./commands/seed.js",exportName:"seed"},preview:{path:"./commands/serve.js",exportName:"preview"},serve:{path:"./commands/serve.js",exportName:"serve"},"serve:api":{path:"./commands/serve.js",exportName:"serveApi"},setup:{path:"./commands/setup.js",exportName:"setup"},"setup:ai":{path:"./commands/setup.js",exportName:"setup"},"setup:ssl":{path:"./commands/setup.js",exportName:"setup"},"setup:oh-my-zsh":{path:"./commands/setup.js",exportName:"setup"},"ai:setup":{path:"./commands/setup.js",exportName:"setup"},share:{path:"./commands/share.js",exportName:"share"},"simulator:doctor":{path:"./commands/simulator.js",exportName:"simulator"},"simulator:open":{path:"./commands/simulator.js",exportName:"simulator"},stack:{path:"./commands/stacks.js",exportName:"stacks"},sms:{path:"./commands/sms.js",exportName:"sms"},telemetry:{path:"./commands/telemetry.js",exportName:"telemetryCommand"},test:{path:"./commands/test.js",exportName:"test"},tinker:{path:"./commands/tinker.js",exportName:"tinker"},types:{path:"./commands/types.js",exportName:"types"},undeploy:{path:"./commands/cloud.js",exportName:"cloud"},upgrade:{path:"./commands/upgrade.js",exportName:"upgrade"},version:{path:"./commands/version.js",exportName:"version"},"docs:buddy":{path:"./commands/docs.js",exportName:"docs"},"docs:buddy:check":{path:"./commands/docs.js",exportName:"docs"},"docs:artifacts":{path:"./commands/docs.js",exportName:"docs"},"docs:artifacts:check":{path:"./commands/docs.js",exportName:"docs"},"docs:links":{path:"./commands/docs.js",exportName:"docs"},"docs:links:check":{path:"./commands/docs.js",exportName:"docs"}},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"]},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!1;let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}const key=loaderKey(loader);if(set.has(key))return!0;set.add(key);try{const commandFunction=(await import(loader.path))[loader.exportName];if(typeof commandFunction==="function"){commandFunction(buddy);return!0}else return!1}catch{return!1}}export async function loadCommands(commandNames,buddy){const seen=new Set,unique=[];for(const name of commandNames){const loader=commandRegistry[name],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],isVersionFlag=requestedCommand==="--version"||requestedCommand==="-v",isHelpFlag=requestedCommand==="--help"||requestedCommand==="-h",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(Error("timeout")),ms)});try{return await Promise.race([work,deadline])}finally{if(timeoutId!==void 0)clearTimeout(timeoutId)}}const commandRegistry={about:{path:"./commands/about.js",exportName:"about"},add:{path:"./commands/add.js",exportName:"add"},"ai:access":{path:"./commands/ai-access.js",exportName:"aiAccess"},"ai:context":{path:"./commands/ai-context.js",exportName:"aiContext"},auth:{path:"./commands/auth.js",exportName:"auth"},build:{path:"./commands/build.js",exportName:"build"},cd:{path:"./commands/cd.js",exportName:"cd"},changelog:{path:"./commands/changelog.js",exportName:"changelog"},clean:{path:"./commands/clean.js",exportName:"clean"},cloud:{path:"./commands/cloud.js",exportName:"cloud"},commit:{path:"./commands/commit.js",exportName:"commit"},completion:{path:"./commands/completion.js",exportName:"completion"},"config:migrate":{path:"./commands/config-migrate.js",exportName:"configMigrate"},configure:{path:"./commands/configure.js",exportName:"configure"},create:{path:"./commands/create.js",exportName:"create"},new:{path:"./commands/create.js",exportName:"create"},deploy:{path:"./commands/deploy.js",exportName:"deploy"},"deploy:rollback":{path:"./commands/deploy.js",exportName:"deploy"},dev:{path:"./commands/dev.js",exportName:"dev"},"desktop:apple:doctor":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:csr":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:init":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:package":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:provision":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:apple:publish":{path:"./commands/desktop-apple.js",exportName:"desktopApple"},"desktop:probe":{path:"./commands/desktop-probe.js",exportName:"desktopProbe"},dns:{path:"./commands/dns.js",exportName:"dns"},"dns:pull":{path:"./commands/dns.js",exportName:"dns"},"dns:diff":{path:"./commands/dns.js",exportName:"dns"},"dns:sync":{path:"./commands/dns.js",exportName:"dns"},doctor:{path:"./commands/doctor.js",exportName:"doctor"},domains:{path:"./commands/domains.js",exportName:"domains"},email:{path:"./commands/email.js",exportName:"email"},env:{path:"./commands/env.js",exportName:"env"},"extension:init":{path:"./commands/extension.js",exportName:"extension"},"extension:build":{path:"./commands/extension.js",exportName:"extension"},"extension:package":{path:"./commands/extension.js",exportName:"extension"},"extension:chrome:publish":{path:"./commands/extension.js",exportName:"extension"},"extension:chrome:status":{path:"./commands/extension.js",exportName:"extension"},"extension:firefox:publish":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:init":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:provision":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:app":{path:"./commands/extension.js",exportName:"extension"},"extension:safari:publish":{path:"./commands/extension.js",exportName:"extension"},"dashboard:install":{path:"./commands/features.js",exportName:"features"},"dashboard:uninstall":{path:"./commands/features.js",exportName:"features"},"commerce:install":{path:"./commands/features.js",exportName:"features"},"commerce:uninstall":{path:"./commands/features.js",exportName:"features"},"commerce:import":{path:"./commands/commerce-import.js",exportName:"commerceImport"},"cms:install":{path:"./commands/features.js",exportName:"features"},"cms:uninstall":{path:"./commands/features.js",exportName:"features"},"marketing:install":{path:"./commands/features.js",exportName:"features"},"marketing:uninstall":{path:"./commands/features.js",exportName:"features"},"monitoring:install":{path:"./commands/features.js",exportName:"features"},"monitoring:uninstall":{path:"./commands/features.js",exportName:"features"},"realtime:install":{path:"./commands/features.js",exportName:"features"},"realtime:uninstall":{path:"./commands/features.js",exportName:"features"},"queue:install":{path:"./commands/features.js",exportName:"features"},"queue:uninstall":{path:"./commands/features.js",exportName:"features"},"db:backup":{path:"./commands/db.js",exportName:"db"},"db:backups":{path:"./commands/db.js",exportName:"db"},"db:restore":{path:"./commands/db.js",exportName:"db"},"storage:backup":{path:"./commands/storage-backup.js",exportName:"storageBackup"},"storage:backups":{path:"./commands/storage-backup.js",exportName:"storageBackup"},"storage:restore":{path:"./commands/storage-backup.js",exportName:"storageBackup"},"feedback:invite":{path:"./commands/feedback.js",exportName:"feedback"},"feedback:tokens":{path:"./commands/feedback.js",exportName:"feedback"},"feedback:revoke":{path:"./commands/feedback.js",exportName:"feedback"},"socials:identities":{path:"./commands/socials.js",exportName:"socials"},"socials:authorize":{path:"./commands/socials.js",exportName:"socials"},fresh:{path:"./commands/fresh.js",exportName:"fresh"},generate:{path:"./commands/generate.js",exportName:"generate"},"gdpr:export":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:erase":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:prune":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:register":{path:"./commands/gdpr.js",exportName:"gdpr"},"gdpr:register:check":{path:"./commands/gdpr.js",exportName:"gdpr"},http:{path:"./commands/http.js",exportName:"http"},install:{path:"./commands/install.js",exportName:"install"},key:{path:"./commands/key.js",exportName:"key"},lint:{path:"./commands/lint.js",exportName:"lint"},format:{path:"./commands/lint.js",exportName:"lint"},"format:check":{path:"./commands/lint.js",exportName:"lint"},libs:{path:"./commands/libs.js",exportName:"libs"},libraries:{path:"./commands/libs.js",exportName:"libs"},list:{path:"./commands/list.js",exportName:"list"},mail:{path:"./commands/mail.js",exportName:"mailCommands"},"mail:preview":{path:"./commands/mail.js",exportName:"mailCommands"},maintenance:{path:"./commands/maintenance.js",exportName:"maintenance"},down:{path:"./commands/maintenance.js",exportName:"maintenance"},up:{path:"./commands/maintenance.js",exportName:"maintenance"},status:{path:"./commands/maintenance.js",exportName:"maintenance"},"coming-soon":{path:"./commands/maintenance.js",exportName:"maintenance"},"coming-soon:status":{path:"./commands/maintenance.js",exportName:"maintenance"},launch:{path:"./commands/maintenance.js",exportName:"maintenance"},make:{path:"./commands/make.js",exportName:"make"},"scaffold:crud":{path:"./commands/make.js",exportName:"make"},migrate:{path:"./commands/migrate.js",exportName:"migrate"},"migrate:fresh":{path:"./commands/migrate.js",exportName:"migrate"},"migrate:switch":{path:"./commands/migrate.js",exportName:"migrate"},"migrate:project":{path:"./commands/migrate-project.js",exportName:"migrateProject"},outdated:{path:"./commands/outdated.js",exportName:"outdated"},package:{path:"./commands/package.js",exportName:"packageCommands"},phone:{path:"./commands/phone.js",exportName:"phone"},ports:{path:"./commands/ports.js",exportName:"ports"},"server:flash":{path:"./commands/server.js",exportName:"server"},"server:first-boot":{path:"./commands/server.js",exportName:"server"},"server:doctor":{path:"./commands/server.js",exportName:"server"},"server:setup":{path:"./commands/server.js",exportName:"server"},"server:trust":{path:"./commands/server.js",exportName:"server"},"link:core":{path:"./commands/link.js",exportName:"link"},"comments:list":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:approve":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:reject":{path:"./commands/comments.js",exportName:"commentsCommands"},"comments:delete":{path:"./commands/comments.js",exportName:"commentsCommands"},"user:add":{path:"./commands/user.js",exportName:"user"},"user:list":{path:"./commands/user.js",exportName:"user"},"unlink:core":{path:"./commands/link.js",exportName:"link"},prepublish:{path:"./commands/prepublish.js",exportName:"prepublish"},projects:{path:"./commands/projects.js",exportName:"projects"},publish:{path:"./commands/publish.js",exportName:"publish"},"publish:model":{path:"./commands/publish.js",exportName:"publish"},"publish:controller":{path:"./commands/publish.js",exportName:"publish"},"publish:middleware":{path:"./commands/publish.js",exportName:"publish"},"publish:action":{path:"./commands/publish.js",exportName:"publish"},"publish:core":{path:"./commands/publish.js",exportName:"publish"},"core:status":{path:"./commands/publish.js",exportName:"publish"},queue:{path:"./commands/queue.js",exportName:"queue"},release:{path:"./commands/release.js",exportName:"release"},route:{path:"./commands/route.js",exportName:"route"},saas:{path:"./commands/saas.js",exportName:"saas"},"stripe:setup":{path:"./commands/saas.js",exportName:"saas"},schedule:{path:"./commands/schedule.js",exportName:"schedule"},search:{path:"./commands/search.js",exportName:"search"},"search-engine:update":{path:"./commands/search.js",exportName:"search"},"search-engine:settings":{path:"./commands/search.js",exportName:"search"},seed:{path:"./commands/seed.js",exportName:"seed"},"seed:roles":{path:"./commands/seed.js",exportName:"seed"},"roles:seed":{path:"./commands/seed.js",exportName:"seed"},preview:{path:"./commands/serve.js",exportName:"preview"},serve:{path:"./commands/serve.js",exportName:"serve"},"serve:api":{path:"./commands/serve.js",exportName:"serveApi"},setup:{path:"./commands/setup.js",exportName:"setup"},"setup:ai":{path:"./commands/setup.js",exportName:"setup"},"setup:ssl":{path:"./commands/setup.js",exportName:"setup"},"setup:oh-my-zsh":{path:"./commands/setup.js",exportName:"setup"},"ai:setup":{path:"./commands/setup.js",exportName:"setup"},share:{path:"./commands/share.js",exportName:"share"},"simulator:doctor":{path:"./commands/simulator.js",exportName:"simulator"},"simulator:open":{path:"./commands/simulator.js",exportName:"simulator"},stack:{path:"./commands/stacks.js",exportName:"stacks"},sms:{path:"./commands/sms.js",exportName:"sms"},telemetry:{path:"./commands/telemetry.js",exportName:"telemetryCommand"},test:{path:"./commands/test.js",exportName:"test"},tinker:{path:"./commands/tinker.js",exportName:"tinker"},types:{path:"./commands/types.js",exportName:"types"},undeploy:{path:"./commands/cloud.js",exportName:"cloud"},upgrade:{path:"./commands/upgrade.js",exportName:"upgrade"},version:{path:"./commands/version.js",exportName:"version"},"docs:buddy":{path:"./commands/docs.js",exportName:"docs"},"docs:buddy:check":{path:"./commands/docs.js",exportName:"docs"},"docs:artifacts":{path:"./commands/docs.js",exportName:"docs"},"docs:artifacts:check":{path:"./commands/docs.js",exportName:"docs"},"docs:links":{path:"./commands/docs.js",exportName:"docs"},"docs:links:check":{path:"./commands/docs.js",exportName:"docs"}},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"]},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!1;let set=loadedRegistrars.get(buddy);if(!set){set=new Set;loadedRegistrars.set(buddy,set)}const key=loaderKey(loader);if(set.has(key))return!0;set.add(key);try{const commandFunction=(await import(loader.path))[loader.exportName];if(typeof commandFunction==="function"){commandFunction(buddy);return!0}else return!1}catch{return!1}}export async function loadCommands(commandNames,buddy){const seen=new Set,unique=[];for(const name of commandNames){const loader=commandRegistry[name],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],isVersionFlag=requestedCommand==="--version"||requestedCommand==="-v",isHelpFlag=requestedCommand==="--help"||requestedCommand==="-h",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)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.91",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -95,67 +95,68 @@
|
|
|
95
95
|
"prepublishOnly": "bun run build"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@stacksjs/actions": "^0.75.
|
|
99
|
-
"@stacksjs/ai": "^0.75.
|
|
100
|
-
"@stacksjs/alias": "^0.75.
|
|
101
|
-
"@stacksjs/analytics": "^0.75.
|
|
102
|
-
"@stacksjs/api": "^0.75.
|
|
103
|
-
"@stacksjs/arrays": "^0.75.
|
|
104
|
-
"@stacksjs/auth": "^0.75.
|
|
105
|
-
"@stacksjs/browser-extension": "^0.75.
|
|
106
|
-
"@stacksjs/build": "^0.75.
|
|
107
|
-
"@stacksjs/cache": "^0.75.
|
|
108
|
-
"@stacksjs/chat": "^0.75.
|
|
98
|
+
"@stacksjs/actions": "^0.75.91",
|
|
99
|
+
"@stacksjs/ai": "^0.75.91",
|
|
100
|
+
"@stacksjs/alias": "^0.75.91",
|
|
101
|
+
"@stacksjs/analytics": "^0.75.91",
|
|
102
|
+
"@stacksjs/api": "^0.75.91",
|
|
103
|
+
"@stacksjs/arrays": "^0.75.91",
|
|
104
|
+
"@stacksjs/auth": "^0.75.91",
|
|
105
|
+
"@stacksjs/browser-extension": "^0.75.91",
|
|
106
|
+
"@stacksjs/build": "^0.75.91",
|
|
107
|
+
"@stacksjs/cache": "^0.75.91",
|
|
108
|
+
"@stacksjs/chat": "^0.75.91",
|
|
109
109
|
"@stacksjs/clapp": "^0.2.16",
|
|
110
|
-
"@stacksjs/cli": "^0.75.
|
|
111
|
-
"@stacksjs/cloud": "^0.75.
|
|
112
|
-
"@stacksjs/cms": "^0.75.
|
|
113
|
-
"@stacksjs/collections": "^0.75.
|
|
114
|
-
"@stacksjs/commerce": "^0.75.
|
|
115
|
-
"@stacksjs/config": "^0.75.
|
|
116
|
-
"@stacksjs/database": "^0.75.
|
|
117
|
-
"@stacksjs/desktop-build": "^0.75.
|
|
118
|
-
"@stacksjs/dns": "^0.75.
|
|
110
|
+
"@stacksjs/cli": "^0.75.91",
|
|
111
|
+
"@stacksjs/cloud": "^0.75.91",
|
|
112
|
+
"@stacksjs/cms": "^0.75.91",
|
|
113
|
+
"@stacksjs/collections": "^0.75.91",
|
|
114
|
+
"@stacksjs/commerce": "^0.75.91",
|
|
115
|
+
"@stacksjs/config": "^0.75.91",
|
|
116
|
+
"@stacksjs/database": "^0.75.91",
|
|
117
|
+
"@stacksjs/desktop-build": "^0.75.91",
|
|
118
|
+
"@stacksjs/dns": "^0.75.91",
|
|
119
119
|
"@stacksjs/dnsx": "^0.2.3",
|
|
120
|
-
"@stacksjs/email": "^0.75.
|
|
121
|
-
"@stacksjs/enums": "^0.75.
|
|
122
|
-
"@stacksjs/env": "^0.75.
|
|
123
|
-
"@stacksjs/error-handling": "^0.75.
|
|
124
|
-
"@stacksjs/events": "^0.75.
|
|
125
|
-
"@stacksjs/features": "^0.75.
|
|
126
|
-
"@stacksjs/git": "^0.75.
|
|
120
|
+
"@stacksjs/email": "^0.75.91",
|
|
121
|
+
"@stacksjs/enums": "^0.75.91",
|
|
122
|
+
"@stacksjs/env": "^0.75.91",
|
|
123
|
+
"@stacksjs/error-handling": "^0.75.91",
|
|
124
|
+
"@stacksjs/events": "^0.75.91",
|
|
125
|
+
"@stacksjs/features": "^0.75.91",
|
|
126
|
+
"@stacksjs/git": "^0.75.91",
|
|
127
127
|
"@stacksjs/gitit": "^0.2.5",
|
|
128
|
-
"@stacksjs/health": "^0.75.
|
|
128
|
+
"@stacksjs/health": "^0.75.91",
|
|
129
129
|
"@stacksjs/httx": "^0.1.10",
|
|
130
|
-
"@stacksjs/image": "^0.75.
|
|
131
|
-
"@stacksjs/lint": "^0.75.
|
|
132
|
-
"@stacksjs/logging": "^0.75.
|
|
133
|
-
"@stacksjs/notifications": "^0.75.
|
|
134
|
-
"@stacksjs/objects": "^0.75.
|
|
135
|
-
"@stacksjs/orm": "^0.75.
|
|
136
|
-
"@stacksjs/path": "^0.75.
|
|
137
|
-
"@stacksjs/payments": "^0.75.
|
|
138
|
-
"@stacksjs/realtime": "^0.75.
|
|
139
|
-
"@stacksjs/router": "^0.75.
|
|
130
|
+
"@stacksjs/image": "^0.75.91",
|
|
131
|
+
"@stacksjs/lint": "^0.75.91",
|
|
132
|
+
"@stacksjs/logging": "^0.75.91",
|
|
133
|
+
"@stacksjs/notifications": "^0.75.91",
|
|
134
|
+
"@stacksjs/objects": "^0.75.91",
|
|
135
|
+
"@stacksjs/orm": "^0.75.91",
|
|
136
|
+
"@stacksjs/path": "^0.75.91",
|
|
137
|
+
"@stacksjs/payments": "^0.75.91",
|
|
138
|
+
"@stacksjs/realtime": "^0.75.91",
|
|
139
|
+
"@stacksjs/router": "^0.75.91",
|
|
140
140
|
"@stacksjs/rpx": "^0.11.54",
|
|
141
|
-
"@stacksjs/scheduler": "^0.75.
|
|
142
|
-
"@stacksjs/search-engine": "^0.75.
|
|
143
|
-
"@stacksjs/security": "^0.75.
|
|
144
|
-
"@stacksjs/server": "^0.75.
|
|
145
|
-
"@stacksjs/sites": "^0.75.
|
|
146
|
-
"@stacksjs/skills": "^0.75.
|
|
147
|
-
"@stacksjs/
|
|
148
|
-
"@stacksjs/
|
|
141
|
+
"@stacksjs/scheduler": "^0.75.91",
|
|
142
|
+
"@stacksjs/search-engine": "^0.75.91",
|
|
143
|
+
"@stacksjs/security": "^0.75.91",
|
|
144
|
+
"@stacksjs/server": "^0.75.91",
|
|
145
|
+
"@stacksjs/sites": "^0.75.91",
|
|
146
|
+
"@stacksjs/skills": "^0.75.91",
|
|
147
|
+
"@stacksjs/socials": "^0.75.91",
|
|
148
|
+
"@stacksjs/storage": "^0.75.91",
|
|
149
|
+
"@stacksjs/strings": "^0.75.91",
|
|
149
150
|
"@stacksjs/stx": "^0.2.395",
|
|
150
|
-
"@stacksjs/testing": "^0.75.
|
|
151
|
-
"@stacksjs/tinker": "^0.75.
|
|
151
|
+
"@stacksjs/testing": "^0.75.91",
|
|
152
|
+
"@stacksjs/tinker": "^0.75.91",
|
|
152
153
|
"@stacksjs/tlsx": "^0.13.19",
|
|
153
154
|
"@stacksjs/ts-cloud": "^0.16.47",
|
|
154
|
-
"@stacksjs/tunnel": "^0.75.
|
|
155
|
-
"@stacksjs/types": "^0.75.
|
|
156
|
-
"@stacksjs/ui": "^0.75.
|
|
157
|
-
"@stacksjs/utils": "^0.75.
|
|
158
|
-
"@stacksjs/validation": "^0.75.
|
|
155
|
+
"@stacksjs/tunnel": "^0.75.91",
|
|
156
|
+
"@stacksjs/types": "^0.75.91",
|
|
157
|
+
"@stacksjs/ui": "^0.75.91",
|
|
158
|
+
"@stacksjs/utils": "^0.75.91",
|
|
159
|
+
"@stacksjs/validation": "^0.75.91",
|
|
159
160
|
"ajv": "^8.20.0",
|
|
160
161
|
"ajv-formats": "^3.0.1",
|
|
161
162
|
"bun-plugin-stx": "^0.2.395",
|