@coreframe/scripts 0.1.38 → 0.1.39
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/coreframe.js +2 -2
- package/package.json +1 -1
package/dist/coreframe.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{assertAssetCredentialProfile as e,configureAssetCredentials as t}from"./assets/credentials.js";import{addAsset as n,buildAssets as r,checkAssets as i,printAssetResult as a,publishAssets as o}from"./assets/workflows.js";import"./assets.js";import{runDrizzleKitCommand as s}from"./db/drizzle-kit.js";import{seedLocalDb as c}from"./db/seed.js";import{migrateLocalDb as l}from"./db/migrate.js";import{resetLocalDb as u}from"./db/reset.js";import{setupLocalDb as d}from"./db/setup.js";import{ensureLocalDb as f}from"./db/ensure.js";import{formatDbErrorMessage as p}from"./db/error.js";import{migrateHeldMigrations as m}from"./db/migrate-held.js";import{checkSchemaPush as h}from"./db/schema-check.js";import{rotateAccessTokenSigningSecret as g}from"./deploy/access-token-secret.js";import{deployEnvironments as _,tauriReleasePlatforms as v}from"./deploy/config.js";import{discoverStagingUrl as y,reassignStagingHostname as b}from"./staging.js";import{discardPendingWorkerSecret as x,inspectWorkerEnvironment as S,queueWorkerSecret as C}from"./worker-environment.js";import{deployProject as w}from"./deploy.js";import{checkDeployMigrations as T}from"./deploy/check-migrations.js";import{devPlatforms as E,runDevServer as ee}from"./dev.js";import{validateRecipeName as D}from"./recipes/manifest.js";import{ensureTemplateRemote as O}from"./upgrade/ensure-template-remote.js";import{applyRecipe as k,printAppliedRecipe as A}from"./recipes/apply.js";import{listRecipes as j,printRecipeCatalog as M}from"./recipes/list.js";import{run as N}from"./runner.js";import{typecheckProject as P}from"./typecheck.js";import{checkUpgradeSkillCurrent as F}from"./upgrade/check-skill-current.js";import{fastForwardTemplateFiles as I}from"./upgrade/fast-forward-template-files.js";import{syncCoreframePackages as L}from"./upgrade/sync-coreframe-packages.js";import*as R from"@clack/prompts";import{array as z,command as B,extendType as V,flag as H,multioption as U,number as W,oneOf as G,option as K,optional as q,positional as J,rest as Y,string as X,subcommands as Z}from"cmd-ts";const Q=[`Cookies and sessions are origin-scoped.`,`Exact-host passkeys may require re-registration unless a stable eligible parent RP ID was configured in advance.`,`External OAuth callbacks such as Google may need updating.`,`Database data and private backend resources are unchanged.`],te=V(X,{displayName:`widths`,description:`Comma-separated responsive variant widths.`,async from(e){let t=e.split(`,`).map(e=>Number(e));if(t.length===0||t.some(e=>!Number.isInteger(e)||e<=0)||t.some((e,n)=>n>0&&e<=t[n-1]))throw Error(`Widths must be positive, unique, strictly ascending integers.`);return t}}),ne=V(X,{displayName:`recipe`,description:`Coreframe recipe name, such as yam-db.`,async from(e){return D(e)}}),$=Z({name:`coreframe`,cmds:{assets:Z({name:`assets`,cmds:{configure:B({name:`configure`,description:`Store a Backblaze B2 asset key in the operating system credential store.`,args:{profile:J({type:V(X,{displayName:`profile`,async from(t){return e(t)}}),displayName:`profile`,description:`Credential profile named by coreframe.config.ts.`})},handler:async({profile:e})=>{let n=await R.text({message:`Backblaze B2 application key ID`,validate:e=>e?.trim()?void 0:`The application key ID is required.`});if(R.isCancel(n))throw Error(`Asset credential configuration was cancelled.`);let r=await R.password({message:`Backblaze B2 application key`,validate:e=>e?void 0:`The application key is required.`});if(R.isCancel(r))throw Error(`Asset credential configuration was cancelled.`);await t({applicationKey:r,applicationKeyId:n.trim(),profile:e}),console.log(`Stored Coreframe asset credential profile "${e}".`)}}),add:B({name:`add`,args:{file:J({type:X,displayName:`file`,description:`Source image to add to the asset library.`}),id:K({long:`id`,type:X,description:`Logical asset ID, such as blog/my-post/hero.`}),alt:K({long:`alt`,type:X,description:`Required alt text for the asset.`}),variantWidths:K({long:`widths`,type:q(te),description:`Generate exactly these comma-separated widths instead of the default ladder.`}),json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({alt:e,file:t,id:r,json:i,variantWidths:o})=>a(await n({alt:e,file:t,id:r,variantWidths:o}),i)}),build:B({name:`build`,args:{id:K({long:`id`,type:q(X),description:`Build only one logical asset ID.`}),json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({id:e,json:t})=>a(await r({id:e}),t)}),check:B({name:`check`,args:{fix:H({long:`fix`,description:`Build missing generated variants when possible.`,defaultValue:()=>!1}),json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({fix:e,json:t})=>{let n=await i({fix:e});a(n,t),n.ok||(process.exitCode=1)}}),publish:B({name:`publish`,args:{json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await o();a(t,e),t.ok||(process.exitCode=1)}}),status:B({name:`status`,args:{json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await i();a(t,e),t.ok||(process.exitCode=1)}})}}),deploy:B({name:`deploy`,args:{environment:J({type:G(_),displayName:`environment`,description:`Deploy to the staging or production environment.`}),runMigrations:H({long:`run-migrations`,description:`Run pending deploy-safe database migrations before deploying.`,defaultValue:()=>!1}),skipMigrations:H({long:`skip-migrations`,description:`Deploy without running pending deploy-safe database migrations.`,defaultValue:()=>!1}),skipPostDeployChecks:H({long:`skip-post-deploy-checks`,description:`Skip post-deploy checks after Cloudflare deployment.`,defaultValue:()=>!1}),tauriLocalPlatforms:U({long:`tauri-local-platform`,type:z(G(v)),description:`Build one Tauri release platform locally. Repeat for multiple platforms.`,defaultValue:()=>[]}),tauriWorkflowName:K({long:`tauri-workflow-name`,type:q(X),description:`GitHub Actions workflow file or name for remote Tauri release builds.`}),tauriWorkflowPlatforms:U({long:`tauri-workflow-platform`,type:z(G(v)),description:`Build one Tauri release platform with GitHub Actions. Repeat for multiple platforms.`,defaultValue:()=>[]}),tauriWorkflowRef:K({long:`tauri-workflow-ref`,type:q(X),description:`Git ref used when dispatching remote Tauri release builds.`}),yes:H({long:`yes`,short:`y`,description:`Approve the production deployment confirmation.`,defaultValue:()=>!1})},handler:({environment:e,runMigrations:t,skipMigrations:n,skipPostDeployChecks:r,tauriLocalPlatforms:i,tauriWorkflowName:a,tauriWorkflowPlatforms:o,tauriWorkflowRef:s,yes:c})=>w([e,...t?[`--run-migrations`]:[],...n?[`--skip-migrations`]:[],...r?[`--skip-post-deploy-checks`]:[],...i.flatMap(e=>[`--tauri-local-platform`,e]),...a?[`--tauri-workflow-name`,a]:[],...o.flatMap(e=>[`--tauri-workflow-platform`,e]),...s?[`--tauri-workflow-ref`,s]:[],...c?[`--yes`]:[]])}),staging:Z({name:`staging`,cmds:{reassign:B({name:`reassign`,args:{json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await b();if(e){console.log(JSON.stringify({...t,notices:Q}));return}console.log(t.url),console.error(`Staging hostname reassigned. ${Q.join(` `)}`)}}),url:B({name:`url`,args:{json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await y();console.log(e?JSON.stringify({url:t}):t)}})}}),secrets:Z({name:`secrets`,cmds:{"rotate-access-token":B({name:`rotate-access-token`,args:{environment:J({type:G(_),displayName:`environment`,description:`Worker environment whose access JWTs should be invalidated.`}),yes:H({long:`yes`,short:`y`,description:`Confirm immediate signing-secret replacement and invalidation of outstanding access JWTs.`,defaultValue:()=>!1})},handler:async({environment:e,yes:t})=>{if(!t)throw Error(`Access-token signing-secret rotation requires --yes because it immediately invalidates outstanding access JWTs.`);await g({environment:e}),console.log(`Rotated Coreframe access-token signing material for ${e}. Clients must remint outstanding access JWTs.`)}}),status:B({name:`status`,args:{environment:J({type:q(G(_)),displayName:`environment`,description:`Inspect staging, production, or both when omitted.`}),json:H({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({environment:e,json:t})=>{let n=await S({environment:e});console.log(t?JSON.stringify(n):re(n))}}),set:B({name:`set`,args:{environment:J({type:G(_),displayName:`environment`,description:`Worker environment to update on its next deploy.`}),name:J({type:X,displayName:`name`,description:`Declared Worker secret name.`})},handler:async({environment:e,name:t})=>{await C({environment:e,name:t,value:await ie(t)}),console.log(`Queued ${t} for ${e}. Run coreframe deploy ${e} to apply.`)}}),discard:B({name:`discard`,args:{environment:J({type:G(_),displayName:`environment`,description:`Worker environment with a queued secret update.`}),name:J({type:X,displayName:`name`,description:`Declared Worker secret name.`})},handler:async({environment:e,name:t})=>{let n=await x({environment:e,name:t});console.log(n?`Discarded the queued ${t} update for ${e}.`:`No ${t} update is queued for ${e}.`)}})}}),typecheck:B({name:`typecheck`,args:{},handler:P}),dev:B({name:`dev`,args:{https:H({long:`https`,description:`Serve the web app over locally trusted HTTPS.`,defaultValue:()=>!1}),host:K({long:`host`,type:q(X),description:`Host address for the web development server.`}),managed:H({long:`managed`,description:`Run managed checkout synchronization even without an interactive terminal.`,defaultValue:()=>!1}),noManaged:H({long:`no-managed`,description:`Run without managed checkout synchronization for this invocation.`,defaultValue:()=>!1}),platform:J({type:q(G(E)),displayName:`platform`,description:`Development target platform. Defaults to web.`}),device:J({type:q(X),displayName:`device`,description:`Device name or ID for iOS or Android development.`}),port:K({long:`port`,type:q(W),description:`Port for the web development server.`}),verbose:H({long:`verbose`,description:`Show the full native development output.`,defaultValue:()=>!1})},handler:({device:e,host:t,https:n,managed:r,noManaged:i,platform:a,port:o,verbose:s})=>ee({device:e,host:t,https:n,managed:r,noManaged:i,platform:a??`web`,verbose:s,webPort:o})}),upgrade:Z({name:`upgrade`,cmds:{"ensure-template-remote":B({name:`ensure-template-remote`,args:{remote:K({long:`remote`,type:X,defaultValue:()=>`template`,description:`Remote name to ensure.`}),noFetch:H({long:`no-fetch`,description:`Do not fetch the remote after ensuring it exists.`,defaultValue:()=>!1})},handler:({noFetch:e,remote:t})=>O({fetch:!e,remote:t})}),"check-skill-current":B({name:`check-skill-current`,args:{target:K({long:`target`,type:X,description:`Target Coreframe template git ref.`}),apply:H({long:`apply`,description:`Replace the local upgrade skill with the target version when it differs.`,defaultValue:()=>!1})},handler:({apply:e,target:t})=>{process.exitCode=F({apply:e,target:t})}}),"fast-forward-template-files":B({name:`fast-forward-template-files`,args:{target:K({long:`target`,type:X,description:`Target Coreframe template git ref.`}),base:K({long:`base`,type:q(X),description:`Previous Coreframe template git ref. Defaults to package.json engines.coreframe.`}),apply:H({long:`apply`,description:`Write clean fast-forwards to the worktree.`,defaultValue:()=>!1})},handler:({apply:e,base:t,target:n})=>I({apply:e,base:t,target:n})}),"sync-coreframe-packages":B({name:`sync-coreframe-packages`,args:{target:K({long:`target`,type:X,description:`Target Coreframe template git ref.`}),apply:H({long:`apply`,description:`Update existing published Coreframe dependency specifications.`,defaultValue:()=>!1})},handler:({apply:e,target:t})=>L({apply:e,target:t})})}}),recipes:Z({name:`recipes`,cmds:{apply:B({name:`apply`,args:{recipe:J({type:ne,displayName:`recipe`,description:`Recipe to prepare and apply.`}),target:K({long:`target`,type:q(X),description:`Coreframe Git ref. Defaults to package.json engines.coreframe.`}),remote:K({long:`remote`,type:X,defaultValue:()=>`template`,description:`Coreframe Git remote name.`}),noFetch:H({long:`no-fetch`,description:`Use already-fetched recipe refs without fetching the remote.`,defaultValue:()=>!1})},handler:({noFetch:e,recipe:t,remote:n,target:r})=>A(k({fetch:!e,name:t,remote:n,target:r}))}),list:B({name:`list`,args:{target:K({long:`target`,type:q(X),description:`Coreframe Git ref. Defaults to package.json engines.coreframe.`}),remote:K({long:`remote`,type:X,defaultValue:()=>`template`,description:`Coreframe Git remote name.`}),noFetch:H({long:`no-fetch`,description:`Use already-fetched recipe refs without fetching the remote.`,defaultValue:()=>!1})},handler:({noFetch:e,remote:t,target:n})=>M(j({fetch:!e,remote:t,target:n}))})}}),db:Z({name:`db`,cmds:{ensure:B({name:`ensure`,args:{},handler:f}),generate:B({name:`generate`,args:{args:Y({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit generate.`})},handler:({args:e})=>s(`generate`,e)}),migrate:B({name:`migrate`,args:{args:Y({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit migrate.`})},handler:({args:e})=>s(`migrate`,e)}),"migrate-held":B({name:`migrate-held`,args:{confirm:K({long:`confirm`,type:q(G([`run-held-migrations`])),description:`Required confirmation value for held migrations.`})},handler:({confirm:e})=>m({argv:e?[`--confirm=${e}`]:[]})}),"migrate-local":B({name:`migrate-local`,args:{},handler:l}),"migrations-check":B({name:`migrations-check`,args:{},handler:T}),reset:B({name:`reset`,args:{},handler:u}),seed:B({name:`seed`,args:{},handler:()=>c()}),"schema-check":B({name:`schema-check`,args:{seed:H({long:`seed`,description:`Run the configured project seed against the throwaway database.`,defaultValue:()=>!1})},handler:({seed:e})=>h({seed:e})}),setup:B({name:`setup`,args:{},handler:()=>d()}),studio:B({name:`studio`,args:{args:Y({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit studio.`})},handler:({args:e})=>s(`studio`,e)})}})}});import.meta.main&&N($,{formatMessage:process.argv[2]===`db`?p:void 0});function re(e){if(e.entries.length===0)return`No Worker environment values are declared in coreframe.config.ts.`;let t=e.entries.map(e=>[e.name,e.kind,e.local===`override`?`override`:`built-in default`,e.deployed.staging.replaceAll(`_`,` `),e.deployed.production.replaceAll(`_`,` `)]),n=[`Name`,`Kind`,`Local`,`Staging`,`Production`],r=n.map((e,n)=>Math.max(e.length,...t.map(e=>e[n].length))),i=e=>e.map((e,t)=>e.padEnd(r[t])).join(` `).trimEnd();return[i(n),i(r.map(e=>`-`.repeat(e))),...t].join(`
|
|
3
|
-
`)}async function
|
|
2
|
+
import{assertAssetCredentialProfile as e,configureAssetCredentials as t}from"./assets/credentials.js";import{addAsset as n,buildAssets as r,checkAssets as i,printAssetResult as a,publishAssets as o}from"./assets/workflows.js";import"./assets.js";import{runDrizzleKitCommand as s}from"./db/drizzle-kit.js";import{seedLocalDb as c}from"./db/seed.js";import{migrateLocalDb as l}from"./db/migrate.js";import{resetLocalDb as u}from"./db/reset.js";import{setupLocalDb as d}from"./db/setup.js";import{ensureLocalDb as ee}from"./db/ensure.js";import{formatDbErrorMessage as f}from"./db/error.js";import{migrateHeldMigrations as p}from"./db/migrate-held.js";import{checkSchemaPush as m}from"./db/schema-check.js";import{rotateAccessTokenSigningSecret as h}from"./deploy/access-token-secret.js";import{deployEnvironments as g,tauriReleasePlatforms as _}from"./deploy/config.js";import{discoverStagingUrl as v,reassignStagingHostname as y}from"./staging.js";import{discardPendingWorkerSecret as b,inspectWorkerEnvironment as x,queueWorkerSecret as S}from"./worker-environment.js";import{deployProject as C}from"./deploy.js";import{checkDeployMigrations as w}from"./deploy/check-migrations.js";import{devPlatforms as T,runDevServer as E}from"./dev.js";import{validateRecipeName as te}from"./recipes/manifest.js";import{ensureTemplateRemote as D}from"./upgrade/ensure-template-remote.js";import{applyRecipe as O,printAppliedRecipe as k}from"./recipes/apply.js";import{listRecipes as A,printRecipeCatalog as j}from"./recipes/list.js";import{run as M}from"./runner.js";import{typecheckProject as N}from"./typecheck.js";import{checkUpgradeSkillCurrent as P}from"./upgrade/check-skill-current.js";import{fastForwardTemplateFiles as F}from"./upgrade/fast-forward-template-files.js";import{syncCoreframePackages as I}from"./upgrade/sync-coreframe-packages.js";import*as L from"@clack/prompts";import{array as R,command as z,extendType as B,flag as V,multioption as H,number as U,oneOf as W,option as G,optional as K,positional as q,rest as J,string as Y,subcommands as X}from"cmd-ts";const Z=[`Cookies and sessions are origin-scoped.`,`Exact-host passkeys may require re-registration unless a stable eligible parent RP ID was configured in advance.`,`External OAuth callbacks such as Google may need updating.`,`Database data and private backend resources are unchanged.`],Q=[`Use a B2 Multi-Bucket Application Key restricted to the configured private source and public generated-assets buckets.`,`Required capabilities: listAllBucketNames, readFiles, and writeFiles.`,`Deletion, bucket-management, and key-management capabilities are not needed.`].join(` `),ne=B(Y,{displayName:`widths`,description:`Comma-separated responsive variant widths.`,async from(e){let t=e.split(`,`).map(e=>Number(e));if(t.length===0||t.some(e=>!Number.isInteger(e)||e<=0)||t.some((e,n)=>n>0&&e<=t[n-1]))throw Error(`Widths must be positive, unique, strictly ascending integers.`);return t}}),re=B(Y,{displayName:`recipe`,description:`Coreframe recipe name, such as yam-db.`,async from(e){return te(e)}}),ie=B(Y,{displayName:`profile`,async from(t){return e(t)}}),$=X({name:`coreframe`,cmds:{assets:X({name:`assets`,cmds:{configure:z({name:`configure`,description:`Store a Backblaze B2 asset key in the operating system credential store. ${Q}`,args:{profile:q({type:ie,displayName:`profile`,description:`Credential profile named by coreframe.config.ts.`})},handler:async({profile:e})=>{L.note(Q,`Required B2 key access`);let n=await L.text({message:`Backblaze B2 application key ID`,validate:e=>e?.trim()?void 0:`The application key ID is required.`});if(L.isCancel(n))throw Error(`Asset credential configuration was cancelled.`);let r=await L.password({message:`Backblaze B2 application key`,validate:e=>e?void 0:`The application key is required.`});if(L.isCancel(r))throw Error(`Asset credential configuration was cancelled.`);await t({applicationKey:r,applicationKeyId:n.trim(),profile:e}),console.log(`Stored Coreframe asset credential profile "${e}".`)}}),add:z({name:`add`,args:{file:q({type:Y,displayName:`file`,description:`Source image to add to the asset library.`}),id:G({long:`id`,type:Y,description:`Logical asset ID, such as blog/my-post/hero.`}),alt:G({long:`alt`,type:Y,description:`Required alt text for the asset.`}),variantWidths:G({long:`widths`,type:K(ne),description:`Generate exactly these comma-separated widths instead of the default ladder.`}),json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({alt:e,file:t,id:r,json:i,variantWidths:o})=>a(await n({alt:e,file:t,id:r,variantWidths:o}),i)}),build:z({name:`build`,args:{id:G({long:`id`,type:K(Y),description:`Build only one logical asset ID.`}),json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({id:e,json:t})=>a(await r({id:e}),t)}),check:z({name:`check`,args:{fix:V({long:`fix`,description:`Build missing generated variants when possible.`,defaultValue:()=>!1}),json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({fix:e,json:t})=>{let n=await i({fix:e});a(n,t),n.ok||(process.exitCode=1)}}),publish:z({name:`publish`,args:{json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await o();a(t,e),t.ok||(process.exitCode=1)}}),status:z({name:`status`,args:{json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await i();a(t,e),t.ok||(process.exitCode=1)}})}}),deploy:z({name:`deploy`,args:{environment:q({type:W(g),displayName:`environment`,description:`Deploy to the staging or production environment.`}),runMigrations:V({long:`run-migrations`,description:`Run pending deploy-safe database migrations before deploying.`,defaultValue:()=>!1}),skipMigrations:V({long:`skip-migrations`,description:`Deploy without running pending deploy-safe database migrations.`,defaultValue:()=>!1}),skipPostDeployChecks:V({long:`skip-post-deploy-checks`,description:`Skip post-deploy checks after Cloudflare deployment.`,defaultValue:()=>!1}),tauriLocalPlatforms:H({long:`tauri-local-platform`,type:R(W(_)),description:`Build one Tauri release platform locally. Repeat for multiple platforms.`,defaultValue:()=>[]}),tauriWorkflowName:G({long:`tauri-workflow-name`,type:K(Y),description:`GitHub Actions workflow file or name for remote Tauri release builds.`}),tauriWorkflowPlatforms:H({long:`tauri-workflow-platform`,type:R(W(_)),description:`Build one Tauri release platform with GitHub Actions. Repeat for multiple platforms.`,defaultValue:()=>[]}),tauriWorkflowRef:G({long:`tauri-workflow-ref`,type:K(Y),description:`Git ref used when dispatching remote Tauri release builds.`}),yes:V({long:`yes`,short:`y`,description:`Approve the production deployment confirmation.`,defaultValue:()=>!1})},handler:({environment:e,runMigrations:t,skipMigrations:n,skipPostDeployChecks:r,tauriLocalPlatforms:i,tauriWorkflowName:a,tauriWorkflowPlatforms:o,tauriWorkflowRef:s,yes:c})=>C([e,...t?[`--run-migrations`]:[],...n?[`--skip-migrations`]:[],...r?[`--skip-post-deploy-checks`]:[],...i.flatMap(e=>[`--tauri-local-platform`,e]),...a?[`--tauri-workflow-name`,a]:[],...o.flatMap(e=>[`--tauri-workflow-platform`,e]),...s?[`--tauri-workflow-ref`,s]:[],...c?[`--yes`]:[]])}),staging:X({name:`staging`,cmds:{reassign:z({name:`reassign`,args:{json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await y();if(e){console.log(JSON.stringify({...t,notices:Z}));return}console.log(t.url),console.error(`Staging hostname reassigned. ${Z.join(` `)}`)}}),url:z({name:`url`,args:{json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({json:e})=>{let t=await v();console.log(e?JSON.stringify({url:t}):t)}})}}),secrets:X({name:`secrets`,cmds:{"rotate-access-token":z({name:`rotate-access-token`,args:{environment:q({type:W(g),displayName:`environment`,description:`Worker environment whose access JWTs should be invalidated.`}),yes:V({long:`yes`,short:`y`,description:`Confirm immediate signing-secret replacement and invalidation of outstanding access JWTs.`,defaultValue:()=>!1})},handler:async({environment:e,yes:t})=>{if(!t)throw Error(`Access-token signing-secret rotation requires --yes because it immediately invalidates outstanding access JWTs.`);await h({environment:e}),console.log(`Rotated Coreframe access-token signing material for ${e}. Clients must remint outstanding access JWTs.`)}}),status:z({name:`status`,args:{environment:q({type:K(W(g)),displayName:`environment`,description:`Inspect staging, production, or both when omitted.`}),json:V({long:`json`,description:`Print machine-readable JSON.`,defaultValue:()=>!1})},handler:async({environment:e,json:t})=>{let n=await x({environment:e});console.log(t?JSON.stringify(n):ae(n))}}),set:z({name:`set`,args:{environment:q({type:W(g),displayName:`environment`,description:`Worker environment to update on its next deploy.`}),name:q({type:Y,displayName:`name`,description:`Declared Worker secret name.`})},handler:async({environment:e,name:t})=>{await S({environment:e,name:t,value:await oe(t)}),console.log(`Queued ${t} for ${e}. Run coreframe deploy ${e} to apply.`)}}),discard:z({name:`discard`,args:{environment:q({type:W(g),displayName:`environment`,description:`Worker environment with a queued secret update.`}),name:q({type:Y,displayName:`name`,description:`Declared Worker secret name.`})},handler:async({environment:e,name:t})=>{let n=await b({environment:e,name:t});console.log(n?`Discarded the queued ${t} update for ${e}.`:`No ${t} update is queued for ${e}.`)}})}}),typecheck:z({name:`typecheck`,args:{},handler:N}),dev:z({name:`dev`,args:{https:V({long:`https`,description:`Serve the web app over locally trusted HTTPS.`,defaultValue:()=>!1}),host:G({long:`host`,type:K(Y),description:`Host address for the web development server.`}),managed:V({long:`managed`,description:`Run managed checkout synchronization even without an interactive terminal.`,defaultValue:()=>!1}),noManaged:V({long:`no-managed`,description:`Run without managed checkout synchronization for this invocation.`,defaultValue:()=>!1}),platform:q({type:K(W(T)),displayName:`platform`,description:`Development target platform. Defaults to web.`}),device:q({type:K(Y),displayName:`device`,description:`Device name or ID for iOS or Android development.`}),port:G({long:`port`,type:K(U),description:`Port for the web development server.`}),verbose:V({long:`verbose`,description:`Show the full native development output.`,defaultValue:()=>!1})},handler:({device:e,host:t,https:n,managed:r,noManaged:i,platform:a,port:o,verbose:s})=>E({device:e,host:t,https:n,managed:r,noManaged:i,platform:a??`web`,verbose:s,webPort:o})}),upgrade:X({name:`upgrade`,cmds:{"ensure-template-remote":z({name:`ensure-template-remote`,args:{remote:G({long:`remote`,type:Y,defaultValue:()=>`template`,description:`Remote name to ensure.`}),noFetch:V({long:`no-fetch`,description:`Do not fetch the remote after ensuring it exists.`,defaultValue:()=>!1})},handler:({noFetch:e,remote:t})=>D({fetch:!e,remote:t})}),"check-skill-current":z({name:`check-skill-current`,args:{target:G({long:`target`,type:Y,description:`Target Coreframe template git ref.`}),apply:V({long:`apply`,description:`Replace the local upgrade skill with the target version when it differs.`,defaultValue:()=>!1})},handler:({apply:e,target:t})=>{process.exitCode=P({apply:e,target:t})}}),"fast-forward-template-files":z({name:`fast-forward-template-files`,args:{target:G({long:`target`,type:Y,description:`Target Coreframe template git ref.`}),base:G({long:`base`,type:K(Y),description:`Previous Coreframe template git ref. Defaults to package.json engines.coreframe.`}),apply:V({long:`apply`,description:`Write clean fast-forwards to the worktree.`,defaultValue:()=>!1})},handler:({apply:e,base:t,target:n})=>F({apply:e,base:t,target:n})}),"sync-coreframe-packages":z({name:`sync-coreframe-packages`,args:{target:G({long:`target`,type:Y,description:`Target Coreframe template git ref.`}),apply:V({long:`apply`,description:`Update existing published Coreframe dependency specifications.`,defaultValue:()=>!1})},handler:({apply:e,target:t})=>I({apply:e,target:t})})}}),recipes:X({name:`recipes`,cmds:{apply:z({name:`apply`,args:{recipe:q({type:re,displayName:`recipe`,description:`Recipe to prepare and apply.`}),target:G({long:`target`,type:K(Y),description:`Coreframe Git ref. Defaults to package.json engines.coreframe.`}),remote:G({long:`remote`,type:Y,defaultValue:()=>`template`,description:`Coreframe Git remote name.`}),noFetch:V({long:`no-fetch`,description:`Use already-fetched recipe refs without fetching the remote.`,defaultValue:()=>!1})},handler:({noFetch:e,recipe:t,remote:n,target:r})=>k(O({fetch:!e,name:t,remote:n,target:r}))}),list:z({name:`list`,args:{target:G({long:`target`,type:K(Y),description:`Coreframe Git ref. Defaults to package.json engines.coreframe.`}),remote:G({long:`remote`,type:Y,defaultValue:()=>`template`,description:`Coreframe Git remote name.`}),noFetch:V({long:`no-fetch`,description:`Use already-fetched recipe refs without fetching the remote.`,defaultValue:()=>!1})},handler:({noFetch:e,remote:t,target:n})=>j(A({fetch:!e,remote:t,target:n}))})}}),db:X({name:`db`,cmds:{ensure:z({name:`ensure`,args:{},handler:ee}),generate:z({name:`generate`,args:{args:J({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit generate.`})},handler:({args:e})=>s(`generate`,e)}),migrate:z({name:`migrate`,args:{args:J({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit migrate.`})},handler:({args:e})=>s(`migrate`,e)}),"migrate-held":z({name:`migrate-held`,args:{confirm:G({long:`confirm`,type:K(W([`run-held-migrations`])),description:`Required confirmation value for held migrations.`})},handler:({confirm:e})=>p({argv:e?[`--confirm=${e}`]:[]})}),"migrate-local":z({name:`migrate-local`,args:{},handler:l}),"migrations-check":z({name:`migrations-check`,args:{},handler:w}),reset:z({name:`reset`,args:{},handler:u}),seed:z({name:`seed`,args:{},handler:()=>c()}),"schema-check":z({name:`schema-check`,args:{seed:V({long:`seed`,description:`Run the configured project seed against the throwaway database.`,defaultValue:()=>!1})},handler:({seed:e})=>m({seed:e})}),setup:z({name:`setup`,args:{},handler:()=>d()}),studio:z({name:`studio`,args:{args:J({displayName:`drizzle-kit args`,description:`Additional arguments passed to drizzle-kit studio.`})},handler:({args:e})=>s(`studio`,e)})}})}});import.meta.main&&M($,{formatMessage:process.argv[2]===`db`?f:void 0});function ae(e){if(e.entries.length===0)return`No Worker environment values are declared in coreframe.config.ts.`;let t=e.entries.map(e=>[e.name,e.kind,e.local===`override`?`override`:`built-in default`,e.deployed.staging.replaceAll(`_`,` `),e.deployed.production.replaceAll(`_`,` `)]),n=[`Name`,`Kind`,`Local`,`Staging`,`Production`],r=n.map((e,n)=>Math.max(e.length,...t.map(e=>e[n].length))),i=e=>e.map((e,t)=>e.padEnd(r[t])).join(` `).trimEnd();return[i(n),i(r.map(e=>`-`.repeat(e))),...t].join(`
|
|
3
|
+
`)}async function oe(e){if(!process.stdin.isTTY){let e=``;for await(let t of process.stdin)e+=t.toString();return e.replace(/\r?\n$/,``)}let t=await L.password({message:`Enter the new value for ${e}`});if(L.isCancel(t))throw L.cancel(`Secret update cancelled.`),Error(`Secret update cancelled.`);return t}export{$ as coreframeCli};
|