@crossdelta/platform-sdk 0.3.33 → 0.3.35
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/README.md +1 -1
- package/bin/cli.js +20 -20
- package/bin/templates/workspace/package.json.hbs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -228,7 +228,7 @@ export default handleEvent(OrderCreatedSchema, async (data) => {
|
|
|
228
228
|
| `pf new` | Interactive creation wizard |
|
|
229
229
|
| `pf new workspace <name>` | Scaffold a complete platform monorepo |
|
|
230
230
|
| `pf setup --ai` | Configure AI provider (OpenAI or Anthropic) |
|
|
231
|
-
| `pf
|
|
231
|
+
| `pf dev` | Start development mode with auto-reload |
|
|
232
232
|
|
|
233
233
|
### Service Commands
|
|
234
234
|
|
package/bin/cli.js
CHANGED
|
@@ -240,43 +240,43 @@ ${Xe.default.bold(`cd ${r} && ${i} run dev`)}`).breakLine().log("Happy shipping
|
|
|
240
240
|
`)),process.exit(1))}catch(a){console.log(Qe.default.red.bold(`
|
|
241
241
|
\u274C Error: ${a.message}
|
|
242
242
|
`)),process.exit(1)}}var L1=xr({name:"nest-micro",description:"Create a new NestJS microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"]],exampleUsage:'platform new nest-micro my-service --ai -d "User authentication service"',buildContext:async(r,e)=>{if(e.ai)throw await jC(r.name,e),new Error("AI generation should have exited");let t=(r.name??"services/my-nest-service").trim(),s=de(t),i=e.packageManager??(e.yes&&Fe()),n=e.packageManager==="bun",o=gt(),a=e.yes?mi():[],c=!!r.name;return{cwd:s,projectName:t,shouldInstallBun:n,packageManager:i,availableIntegrations:o,selectedIntegrations:a,serviceType:"nest",elapsedTime:0,userConfirmed:!!e.yes||c,removeDir:!!e.yes}},prompts:[Ei,Ci,vi,ki,qa,yi],actions:[Si,Di,M1,Ua,j1,Ha,b1,Wa,Va],onComplete:({projectName:r,packageManager:e,selectedIntegrations:t,assignedPort:s})=>{O.breakLine().log(Qe.default.bold.green("NestJS Microservice created successfully!")),Pa(t),Ia((0,N1.basename)(r),s??3e3),O.breakLine().log(`To start the project, run:
|
|
243
|
-
${Qe.default.bold(`cd ${r} && ${e} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var _t=_(require("chalk"));var Pe=require("node:fs"),Br=require("node:path"),W1=_(require("handlebars")),NC=()=>{let r=[(0,Br.join)(__dirname,"templates","workspace"),(0,Br.join)(__dirname,"..","workspace","templates")];for(let e of r)if((0,Pe.existsSync)(e))return e;throw new Error(`Workspace templates directory not found. Searched in: ${r.join(", ")}`)},LC=(r,e)=>{let t=(0,Pe.readFileSync)(r,"utf-8");return W1.default.compile(t)(e)},U1=r=>{r.endsWith(".sh")&&(0,Pe.chmodSync)(r,493)},UC=[{template:"package.json.hbs",output:"package.json"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"infra/services/nats.ts.hbs",output:"infra/services/nats.ts"},{template:"services/nats/package.json.hbs",output:"services/nats/package.json"},{template:"services/nats/nats.conf",output:"services/nats/nats.conf",isStatic:!0},{template:"services/nats/nats.prod.conf",output:"services/nats/nats.prod.conf",isStatic:!0},{template:"services/nats/README.md",output:"services/nats/README.md",isStatic:!0},{template:"services/nats/scripts/start-dev.sh.hbs",output:"services/nats/scripts/start-dev.sh"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],q1={title:"Creating workspace structure",task:async(r,e)=>{if((0,Pe.existsSync)(r.cwd)){e.title="Workspace directory already exists, skipping...";return}let t=NC(),s=r.includeGitHubCI??!0,i={projectName:r.projectName,githubOwner:r.githubOwner||"",pulumiStackBase:r.pulumiStackBase||r.projectName},n=UC.filter(o=>!(o.isGitHubCI&&!s));for(let o of n){let a=(0,Br.join)(r.cwd,o.output),c=(0,Br.dirname)(a);if((0,Pe.existsSync)(c)||(0,Pe.mkdirSync)(c,{recursive:!0}),o.isStatic){let l=(0,Br.join)(t,o.template);(0,Pe.existsSync)(l)?(0,Pe.writeFileSync)(a,(0,Pe.readFileSync)(l)):(0,Pe.writeFileSync)(a,""),U1(a)}else{let l=(0,Br.join)(t,o.template),u=LC(l,i);(0,Pe.writeFileSync)(a,u),U1(a)}}e.title="Workspace structure created"}};var H1=xr({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(r,e)=>{let t=(r.name??"my-platform").trim(),s=de(t),i=e.packageManager??(e.yes?Fe():void 0),n=e.packageManager==="bun",o=!!e.yes,a=e.githubOwner??(o?"my-org":void 0),c=e.pulumiStack??(o?`${a}/${t}`:void 0),l=e.github!==void 0?e.github:o?!0:void 0,u=!!r.name;return{cwd:s,projectName:t,shouldInstallBun:n,packageManager:i,elapsedTime:0,userConfirmed:o||u,removeDir:o,githubOwner:a,pulumiStackBase:c,includeGitHubCI:l}},prompts:[Ei,Ci,w1,D1,v1,vi,ki,yi],actions:[Si,Di,q1,Ha,g1],onComplete:({projectName:r,includeGitHubCI:e})=>{O.breakLine().log(_t.default.bold.green("Workspace created successfully!")),O.breakLine().log(_t.default.bold("Next steps:")).log(` 1. ${_t.default.cyan(`cd ${r}`)}`).log(` 2. ${_t.default.cyan("bun pulumi login")}`).log(` 3. ${_t.default.cyan("bun pulumi up --stack dev")}`),e&&O.breakLine().log(_t.default.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${_t.default.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${_t.default.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${_t.default.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),O.breakLine().log(_t.default.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/ # Shared libraries").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),e&&O.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),O.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var $n=[{name:"Hono Microservice",value:"hono-micro",command:T1,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:L1,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:H1,supportsAi:!1}],V1=()=>{let r=xr({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, shopware-plugin)"]],exampleUsage:"platform new nest-micro test-project",buildContext:e=>({projectType:e.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:e=>!e.projectType,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"select",message:"Select Project type",choices:$n});e.projectType=$n.find(i=>i.name===s)?.value||"",t.title=`Using ${Pr.default.bold(s)}`}},{enabled:e=>!!e.projectType,task:async(e,t)=>{let i={"hono-micro":"services/my-hono-service","nest-micro":"services/my-nest-service",workspace:"my-platform"}[e.projectType]||"my-project",n=e.projectType==="workspace"?"\u{1F4E6} Workspace name:":"\u{1F4E6} Service path (e.g., services/my-service):",o=await t.prompt(oe).run({type:"input",message:n,initial:i});e.servicePath=o.trim(),t.title=`Path: ${Pr.default.dim(o)}`}},{enabled:e=>!!$n.find(s=>s.value===e.projectType)?.supportsAi&&ai().valid,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});e.useAi=s,t.title=s?Pr.default.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:e=>e.useAi,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"input",message:"Describe what this service should do:"});e.aiDescription=s,t.title=`Description: ${Pr.default.dim(s.slice(0,50))}${s.length>50?"...":""}`}},{enabled:e=>{if(!e.servicePath)return!1;let t=de(e.servicePath);return!ma(t)},task:async(e,t)=>{if(!await t.prompt(oe).run({type:"toggle",message:Pr.default.bold("\u26A0\uFE0F Overwrite existing directory?"),enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Project creation was canceled by the user.");e.shouldRemoveDir=!0,t.title=Pr.default.yellow("Will overwrite existing directory")}}],actions:[],onComplete:async e=>{if($n.find(n=>n.value===e.projectType)||r.error(Pr.default.red(`Project type ${e.projectType} is not supported.`)),e.shouldRemoveDir&&e.servicePath){let n=de(e.servicePath);ga(n)}let t=r.commands.find(n=>n.name()===e.projectType),s={},i=[];e.servicePath&&i.push("servicePath"),e.useAi&&(s.ai=!0,s.yes=!0,s.description=e.aiDescription),await f1(t,e,s,i)}});for(let e of $n)r.addCommand(e.command);return r};var K1=_(ih());var G1=require("fs-extra"),z1=require("globby");var WC=Q.record(Q.enum(["uuid","email","string","number","boolean","date","firstName","lastName","productName","productDescription","url","phoneNumber","address","companyName","streetAddress","city","state","country","zipCode","password"])),qC=Q.object({description:Q.string().optional(),eventName:Q.string(),faker:WC.optional(),data:Q.record(Q.any())});function Xa(r=process.cwd()){let e=(0,z1.globbySync)("**/*.mock.json",{cwd:r,absolute:!0,gitignore:!0}),t=[];for(let s of e){let i=(0,G1.readJSONSync)(s,{encoding:"utf8"}),n=qC.safeParse(i);if(!n.success){O.warn(`\u26A0\uFE0F Invalid schema in ${s}`),console.log(n.error.format());continue}t.push({eventName:n.data.eventName,path:s,schema:n.data})}return t}var Z1=new Ee("event:list").description("List all available event mocks").action(()=>{let r=Xa();if(r.length===0){O.error("No event schemas found.");return}let e=new K1.default({head:["name","description"],style:{head:["dim","bold"],compact:!0}});for(let{eventName:t,schema:s}of r)e.push([t,s.description]);console.log(e.toString())});var uh=null;async function J1(){if(!uh){let{faker:r}=await import("@faker-js/faker");uh=r}return uh}var Y1=new Ee("event:send").description("Send a raw Pub/Sub event based on an event schema").argument("<eventName>","The name of the event").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(async(r,e)=>{let t=await J1(),i=Xa().find(u=>u.eventName===r);if(!i){O.error(`Event "${r}" not found.`);return}let n=i.schema,o=e.fake?await HC(n):n.data,c={message:{data:Buffer.from(JSON.stringify({...o,type:n.eventName})).toString("base64"),messageId:t.string.uuid(),attributes:{source:"platform-sdk"}}};if(e.print){console.dir(c,{colors:!0});return}let l=await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let u=await l.text();throw new Error(`Request failed: ${l.status} \u2013 ${u}`)}O.success("Event sent successfully.")});async function HC(r){let e=structuredClone(r.data);if(r.faker)for(let[t,s]of Object.entries(r.faker)){let i=await VC(s);Kx(e,t,i)}return e}async function VC(r){let e=await J1();switch(r){case"uuid":return e.string.uuid();case"email":return e.internet.email();case"string":return e.lorem.word();case"number":return e.number.int();case"boolean":return e.datatype.boolean();case"date":return new Date().toISOString();case"productName":return e.commerce.productName();case"productDescription":return e.commerce.productDescription();case"firstName":return e.person.firstName();case"lastName":return e.person.lastName();case"url":return e.internet.url();case"phoneNumber":return e.phone.number();case"streetAddress":return e.location.streetAddress();case"city":return e.location.city();case"state":return e.location.state();case"country":return e.location.country();case"companyName":return e.company.name();case"zipCode":return e.location.zipCode();case"password":return e.internet.password();default:return null}}var X1=_(require("chalk"));var Q1=new Ee("generate").alias("g").description(X1.default.bold("Generate code (e.g. event-handlers, use-cases) using platform schematics")).argument("<schematic>","Name of schematic").argument("<name>","Name to generate").addHelpText("after",h1).showHelpAfterError().action(async(r,e)=>{try{await y2(r,e)}catch(t){O.error(t.message)}});var Ai=require("node:fs"),fh=_(require("node:path")),Qa=_(require("chalk"));var eb=_(require("os"));var{name:GC,publishConfig:zC}=Sr,KC=zC?.registry,ZC=GC?.split("/")[0],tb=new Ee("token:set").description(Qa.default.bold("Set a registry auth token in a .npmrc file")).argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @zooroyal)",ZC).option("--registry <registry>","Registry URL",KC).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action((r,e)=>QC(r,e.scope||"",e.registry||"",e.local,e.force)).addHelpText("after",()=>`${Qa.default.cyan(`
|
|
243
|
+
${Qe.default.bold(`cd ${r} && ${e} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var _t=_(require("chalk"));var Pe=require("node:fs"),Br=require("node:path"),W1=_(require("handlebars")),NC=()=>{let r=[(0,Br.join)(__dirname,"templates","workspace"),(0,Br.join)(__dirname,"..","workspace","templates")];for(let e of r)if((0,Pe.existsSync)(e))return e;throw new Error(`Workspace templates directory not found. Searched in: ${r.join(", ")}`)},LC=(r,e)=>{let t=(0,Pe.readFileSync)(r,"utf-8");return W1.default.compile(t)(e)},U1=r=>{r.endsWith(".sh")&&(0,Pe.chmodSync)(r,493)},UC=[{template:"package.json.hbs",output:"package.json"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"infra/services/nats.ts.hbs",output:"infra/services/nats.ts"},{template:"services/nats/package.json.hbs",output:"services/nats/package.json"},{template:"services/nats/nats.conf",output:"services/nats/nats.conf",isStatic:!0},{template:"services/nats/nats.prod.conf",output:"services/nats/nats.prod.conf",isStatic:!0},{template:"services/nats/README.md",output:"services/nats/README.md",isStatic:!0},{template:"services/nats/scripts/start-dev.sh.hbs",output:"services/nats/scripts/start-dev.sh"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],q1={title:"Creating workspace structure",task:async(r,e)=>{if((0,Pe.existsSync)(r.cwd)){e.title="Workspace directory already exists, skipping...";return}let t=NC(),s=r.includeGitHubCI??!0,i={projectName:r.projectName,githubOwner:r.githubOwner||"",pulumiStackBase:r.pulumiStackBase||r.projectName},n=UC.filter(o=>!(o.isGitHubCI&&!s));for(let o of n){let a=(0,Br.join)(r.cwd,o.output),c=(0,Br.dirname)(a);if((0,Pe.existsSync)(c)||(0,Pe.mkdirSync)(c,{recursive:!0}),o.isStatic){let l=(0,Br.join)(t,o.template);(0,Pe.existsSync)(l)?(0,Pe.writeFileSync)(a,(0,Pe.readFileSync)(l)):(0,Pe.writeFileSync)(a,""),U1(a)}else{let l=(0,Br.join)(t,o.template),u=LC(l,i);(0,Pe.writeFileSync)(a,u),U1(a)}}e.title="Workspace structure created"}};var H1=xr({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(r,e)=>{let t=(r.name??"my-platform").trim(),s=de(t),i=e.packageManager??(e.yes?Fe():void 0),n=e.packageManager==="bun",o=!!e.yes,a=e.githubOwner??(o?"my-org":void 0),c=e.pulumiStack??(o?`${a}/${t}`:void 0),l=e.github!==void 0?e.github:o?!0:void 0,u=!!r.name;return{cwd:s,projectName:t,shouldInstallBun:n,packageManager:i,elapsedTime:0,userConfirmed:o||u,removeDir:o,githubOwner:a,pulumiStackBase:c,includeGitHubCI:l}},prompts:[Ei,Ci,w1,D1,v1,vi,ki,yi],actions:[Si,Di,q1,Ha,g1],onComplete:({projectName:r,includeGitHubCI:e})=>{O.breakLine().log(_t.default.bold.green("Workspace created successfully!")),O.breakLine().log(_t.default.bold("Next steps:")).log(` 1. ${_t.default.cyan(`cd ${r}`)}`).log(` 2. ${_t.default.cyan("bun pulumi login")}`).log(` 3. ${_t.default.cyan("bun pulumi up --stack dev")}`),e&&O.breakLine().log(_t.default.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${_t.default.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${_t.default.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${_t.default.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),O.breakLine().log(_t.default.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/ # Shared libraries").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),e&&O.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),O.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var $n=[{name:"Hono Microservice",value:"hono-micro",command:T1,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:L1,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:H1,supportsAi:!1}],V1=()=>{let r=xr({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, shopware-plugin)"]],exampleUsage:"platform new nest-micro test-project",buildContext:e=>({projectType:e.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:e=>!e.projectType,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"select",message:"Select Project type",choices:$n});e.projectType=$n.find(i=>i.name===s)?.value||"",t.title=`Using ${Pr.default.bold(s)}`}},{enabled:e=>!!e.projectType,task:async(e,t)=>{let i={"hono-micro":"services/my-hono-service","nest-micro":"services/my-nest-service",workspace:"my-platform"}[e.projectType]||"my-project",n=e.projectType==="workspace"?"\u{1F4E6} Workspace name:":"\u{1F4E6} Service path (e.g., services/my-service):",o=await t.prompt(oe).run({type:"input",message:n,initial:i});e.servicePath=o.trim(),t.title=`Path: ${Pr.default.dim(o)}`}},{enabled:e=>!!$n.find(s=>s.value===e.projectType)?.supportsAi&&ai().valid,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});e.useAi=s,t.title=s?Pr.default.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:e=>e.useAi,task:async(e,t)=>{let s=await t.prompt(oe).run({type:"input",message:"Describe what this service should do:"});e.aiDescription=s,t.title=`Description: ${Pr.default.dim(s.slice(0,50))}${s.length>50?"...":""}`}},{enabled:e=>{if(!e.servicePath)return!1;let t=de(e.servicePath);return!ma(t)},task:async(e,t)=>{if(!await t.prompt(oe).run({type:"toggle",message:Pr.default.bold("\u26A0\uFE0F Overwrite existing directory?"),enabled:"Yes",disabled:"No",initial:!1}))throw new Error("Project creation was canceled by the user.");e.shouldRemoveDir=!0,t.title=Pr.default.yellow("Will overwrite existing directory")}}],actions:[],onComplete:async e=>{if($n.find(n=>n.value===e.projectType)||r.error(Pr.default.red(`Project type ${e.projectType} is not supported.`)),e.shouldRemoveDir&&e.servicePath){let n=de(e.servicePath);ga(n)}let t=r.commands.find(n=>n.name()===e.projectType),s={},i=[];e.servicePath&&i.push("servicePath"),e.useAi&&(s.ai=!0,s.yes=!0,s.description=e.aiDescription),await f1(t,e,s,i)}});for(let e of $n)r.addCommand(e.command);return r};var Vt=require("node:fs"),Xa=require("node:path"),K1=_(require("chalk"));var Z1=300,WC=1e3,G1=["infra/services"],z1=["services","apps"],jn=null,Nn=!1,Gt=r=>{process.stdout.write(`${r}
|
|
244
|
+
`)},qC=r=>new Promise(e=>setTimeout(e,r)),J1=(r,e)=>{let t=null;return(...s)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...s),e)}},HC=()=>{process.stdout.write("\x1B[2J\x1B[0f")},VC=r=>{let e=(0,Xa.join)(r,"package.json");try{let t=(0,Vt.readFileSync)(e,"utf-8"),s=JSON.parse(t);return{watchDirs:s.pf?.dev?.watchDirs??G1,watchPackages:s.pf?.dev?.watchPackages??z1}}catch{return{watchDirs:G1,watchPackages:z1}}},Y1=async()=>{if(!jn?.pid){Gt("\u26A0\uFE0F No running Turbo process to stop");return}Gt("\u23F9\uFE0F Stopping services...");try{process.kill(-jn.pid,"SIGTERM")}catch{try{jn.kill("SIGTERM")}catch{}}jn=null,await qC(WC)},X1=r=>{Gt("\u25B6\uFE0F Starting services..."),jn=Og("turbo",["run","start:dev","--continue"],{cwd:r,envFile:".env.local",onStderr:e=>{Nn||process.stderr.write(e)},onExit:e=>{Nn||(Gt(`
|
|
245
|
+
Turbo exited with code ${e}`),process.exit(e??0))}})},Q1=async r=>{Gt("\u{1F4DD} Generating .env.local..."),await Je("bun",["run","generate-env"],{cwd:r,quiet:!0})},GC=async r=>{Gt("\u{1F4E6} Installing dependencies..."),await Je("bun",["install"],{cwd:r,quiet:!0})},zC=r=>{for(let e of Object.keys(require.cache))r.some(t=>e.includes(t))&&delete require.cache[e]},eb=async(r,e,t,s=!1)=>{if(!Nn){Nn=!0;try{zC(t),await Y1(),HC(),Gt(`\u{1F504} Detected change in ${K1.default.cyan(r.replace(/ /g,""))}, restarting...`),s&&await GC(e),await Q1(e),X1(e)}catch(i){Gt(`\u274C Failed to restart: ${i}`)}finally{Nn=!1}}},KC=(r,e)=>{for(let t of r){let s=(0,Xa.join)(e,t),i=J1(n=>eb(n,e,r),Z1);(0,Vt.watch)(s,{recursive:!0},(n,o)=>{o?.endsWith(".ts")&&i(o)})}},ZC=(r,e,t)=>{for(let s of r){let i=(0,Xa.join)(e,s);if(!(0,Vt.existsSync)(i))continue;let n=new Set((0,Vt.readdirSync)(i,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name)),o=J1(async()=>{let a=new Set((0,Vt.readdirSync)(i,{withFileTypes:!0}).filter(u=>u.isDirectory()).map(u=>u.name)),c=[...a].filter(u=>!n.has(u)),l=[...n].filter(u=>!a.has(u));if(c.length>0||l.length>0){let u=[...c.map(d=>`+${d}`),...l.map(d=>`-${d}`)].join(", ");n=a;let h=l.length>0;await eb(`${s}/ [${u}]`,e,t,h)}},Z1);(0,Vt.watch)(i,{recursive:!1},()=>o())}},JC=()=>{let r=async()=>{Gt(`
|
|
246
|
+
\u{1F44B} Shutting down...`),await Y1(),process.exit(0)};process.on("SIGINT",r),process.on("SIGTERM",r)},tb=new Ee("dev").description("Start development mode with auto-reload").action(async()=>{let r=En(),e=VC(r);await Q1(r),X1(r);let t=e.watchDirs??[],s=e.watchPackages??[];Gt(`
|
|
247
|
+
\u{1F440} Watching: ${[...t,...s].join(", ")}`),KC(t,r),ZC(s,r,t),JC()});var ib=_(ih());var rb=require("fs-extra"),sb=require("globby");var YC=Q.record(Q.enum(["uuid","email","string","number","boolean","date","firstName","lastName","productName","productDescription","url","phoneNumber","address","companyName","streetAddress","city","state","country","zipCode","password"])),XC=Q.object({description:Q.string().optional(),eventName:Q.string(),faker:YC.optional(),data:Q.record(Q.any())});function Qa(r=process.cwd()){let e=(0,sb.globbySync)("**/*.mock.json",{cwd:r,absolute:!0,gitignore:!0}),t=[];for(let s of e){let i=(0,rb.readJSONSync)(s,{encoding:"utf8"}),n=XC.safeParse(i);if(!n.success){O.warn(`\u26A0\uFE0F Invalid schema in ${s}`),console.log(n.error.format());continue}t.push({eventName:n.data.eventName,path:s,schema:n.data})}return t}var nb=new Ee("event:list").description("List all available event mocks").action(()=>{let r=Qa();if(r.length===0){O.error("No event schemas found.");return}let e=new ib.default({head:["name","description"],style:{head:["dim","bold"],compact:!0}});for(let{eventName:t,schema:s}of r)e.push([t,s.description]);console.log(e.toString())});var uh=null;async function ob(){if(!uh){let{faker:r}=await import("@faker-js/faker");uh=r}return uh}var ab=new Ee("event:send").description("Send a raw Pub/Sub event based on an event schema").argument("<eventName>","The name of the event").option("--endpoint <url>","Target HTTP endpoint","http://localhost:3000").option("--fake","Apply fake values to fakeable fields").option("--print","Print the generated Pub/Sub event without sending").action(async(r,e)=>{let t=await ob(),i=Qa().find(u=>u.eventName===r);if(!i){O.error(`Event "${r}" not found.`);return}let n=i.schema,o=e.fake?await QC(n):n.data,c={message:{data:Buffer.from(JSON.stringify({...o,type:n.eventName})).toString("base64"),messageId:t.string.uuid(),attributes:{source:"platform-sdk"}}};if(e.print){console.dir(c,{colors:!0});return}let l=await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!l.ok){let u=await l.text();throw new Error(`Request failed: ${l.status} \u2013 ${u}`)}O.success("Event sent successfully.")});async function QC(r){let e=structuredClone(r.data);if(r.faker)for(let[t,s]of Object.entries(r.faker)){let i=await e7(s);Kx(e,t,i)}return e}async function e7(r){let e=await ob();switch(r){case"uuid":return e.string.uuid();case"email":return e.internet.email();case"string":return e.lorem.word();case"number":return e.number.int();case"boolean":return e.datatype.boolean();case"date":return new Date().toISOString();case"productName":return e.commerce.productName();case"productDescription":return e.commerce.productDescription();case"firstName":return e.person.firstName();case"lastName":return e.person.lastName();case"url":return e.internet.url();case"phoneNumber":return e.phone.number();case"streetAddress":return e.location.streetAddress();case"city":return e.location.city();case"state":return e.location.state();case"country":return e.location.country();case"companyName":return e.company.name();case"zipCode":return e.location.zipCode();case"password":return e.internet.password();default:return null}}var cb=_(require("chalk"));var lb=new Ee("generate").alias("g").description(cb.default.bold("Generate code (e.g. event-handlers, use-cases) using platform schematics")).argument("<schematic>","Name of schematic").argument("<name>","Name to generate").addHelpText("after",h1).showHelpAfterError().action(async(r,e)=>{try{await y2(r,e)}catch(t){O.error(t.message)}});var Ai=require("node:fs"),fh=_(require("node:path")),ec=_(require("chalk"));var ub=_(require("os"));var{name:t7,publishConfig:r7}=Sr,s7=r7?.registry,i7=t7?.split("/")[0],hb=new Ee("token:set").description(ec.default.bold("Set a registry auth token in a .npmrc file")).argument("<token>","Authentication token (e.g. GitHub or npm token)").option("--scope <scope>","Package scope (e.g. @zooroyal)",i7).option("--registry <registry>","Registry URL",s7).option("--local","Write token to a local .npmrc in the current directory",!1).option("--force","Force overwrite existing token if already present",!1).action((r,e)=>c7(r,e.scope||"",e.registry||"",e.local,e.force)).addHelpText("after",()=>`${ec.default.cyan(`
|
|
244
248
|
Example:`)}
|
|
245
|
-
${
|
|
246
|
-
`),
|
|
247
|
-
//${s}/:_authToken=${r}`:`//${s}/:_authToken=${r}`},
|
|
249
|
+
${ec.default.bold("platform token:set <token> --scope @zooroyal --registry https://npm.pkg.github.com")}
|
|
250
|
+
`),n7=r=>r?fh.default.join(process.cwd(),".npmrc"):fh.default.join(ub.default.homedir(),".npmrc"),o7=(r,e,t)=>{let s=new URL(t).host;return e?`${e}:registry=https://${s}
|
|
251
|
+
//${s}/:_authToken=${r}`:`//${s}/:_authToken=${r}`},a7=r=>(0,Ai.existsSync)(r)?(0,Ai.readFileSync)(r,"utf8"):"",hh=(r,e)=>(0,Ai.writeFileSync)(r,e),c7=(r,e,t,s=!1,i=!1)=>{let n=n7(s),o=o7(r,e,t),a=new URL(t).host,c=a7(n),l=new RegExp(`//${a}/:_authToken=\\S+`);if(!c){hh(n,`${o}
|
|
248
252
|
`),O.success(`Created new .npmrc and set token for ${a}`);return}if(l.test(c)){if(!i){O.warn(`Token for ${a} already exists in ${n}. Use --force to overwrite.`);return}c=c.replace(l,o),hh(n,c),O.success(`Overwrote existing token for ${a} in ${n}`);return}c+=`
|
|
249
253
|
${o}
|
|
250
|
-
`,hh(n,c),O.success(`Appended token for ${a} to ${n}`)};var ne=_(require("chalk"));var
|
|
254
|
+
`,hh(n,c),O.success(`Appended token for ${a} to ${n}`)};var ne=_(require("chalk"));var l7=[/embed/i,/whisper/i,/tts/i,/dall-e/i,/davinci/i,/babbage/i,/curie/i,/ada(?!-)/i,/moderation/i,/realtime/i,/audio/i,/transcription/i,/search/i];async function u7(r,e,t=1e4){let s=new AbortController,i=setTimeout(()=>s.abort(),t);try{return await fetch(r,{...e,signal:s.signal})}finally{clearTimeout(i)}}function h7(r){return r.replace(/-(\d{8})$/," ($1)").replace(/^claude-/,"Claude ").replace(/^gpt-/,"GPT-").replace(/-/g," ").replace(/(\d)\.(\d)/g,"$1.$2").replace(/\s+/g," ").split(" ").map(e=>/^\d/.test(e)||/^\(\d+\)$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ").trim()}async function f7(r,e){let t=ji(r),s=await u7(t.modelsApiUrl,{headers:t.buildHeaders(e)});if(!s.ok)throw new Error(`${t.name} API error: ${s.status}`);let i=await s.json(),n=t.parseModelsResponse(i);if(!Array.isArray(n)||n.length===0)throw new Error(`No models returned from ${t.name} API`);let o=n.filter(a=>{let c=t.modelFilters.some(u=>u.test(a.id)),l=l7.some(u=>u.test(a.id));return c&&!l}).sort((a,c)=>{let l=typeof a.created=="number"?a.created:new Date(a.created).getTime();return(typeof c.created=="number"?c.created:new Date(c.created).getTime())-l}).map(a=>({name:h7(a.id),value:a.id}));if(o.length===0)throw new Error(`No chat models found from ${t.name} API`);return o}async function fb(r,e){if(!e)throw new Error("API key is required to fetch available models");return{models:await f7(r,e),fromApi:!0}}function d7(){if(!Ni())return null;try{let r=ro();return console.log(ne.default.dim(`Found existing configuration at ${Lr}
|
|
251
255
|
`)),r}catch{return console.log(ne.default.yellow(`Found corrupted configuration, starting fresh.
|
|
252
|
-
`)),null}}async function
|
|
256
|
+
`)),null}}async function p7(r,e){return console.log(ne.default.dim(`
|
|
253
257
|
\u{1F4CB} Get your ${r} API key here:`)),console.log(ne.default.cyan(` ${e}
|
|
254
|
-
`)),n0({message:`Enter your ${r} API key:`,mask:"*",validate:t=>t.trim()?t.length<10?"API key seems too short":!0:"API key cannot be empty"})}async function
|
|
258
|
+
`)),n0({message:`Enter your ${r} API key:`,mask:"*",validate:t=>t.trim()?t.length<10?"API key seems too short":!0:"API key cannot be empty"})}async function x7(r,e,t){let s=await No({message:"Select model:",choices:r,default:e?.provider===t?e.model:void 0});return await jo({message:"Enter a custom model ID instead?",default:!1})?Qi({message:"Enter custom model ID:",default:s,validate:n=>n.trim()?!0:"Model ID cannot be empty"}):s}function db(r){return r.length<=12?"****":`${r.slice(0,4)}...${r.slice(-4)}`}function m7(r,e){console.log(ne.default.green.bold(`
|
|
255
259
|
\u2705 AI configuration saved successfully!
|
|
256
|
-
`)),console.log(ne.default.dim(`Configuration file: ${Lr}`)),console.log(ne.default.dim("API Key: Stored securely in system keychain")),console.log(ne.default.dim(`Provider: ${r.provider}`)),console.log(ne.default.dim(`Model: ${r.model}`)),console.log(ne.default.dim(`API Key: ${
|
|
260
|
+
`)),console.log(ne.default.dim(`Configuration file: ${Lr}`)),console.log(ne.default.dim("API Key: Stored securely in system keychain")),console.log(ne.default.dim(`Provider: ${r.provider}`)),console.log(ne.default.dim(`Model: ${r.model}`)),console.log(ne.default.dim(`API Key: ${db(e)}
|
|
257
261
|
`)),console.log(ne.default.cyan("You can now use AI-powered service generation:")),console.log(ne.default.dim(` pf new hono-micro services/my-service --ai
|
|
258
|
-
`))}async function
|
|
262
|
+
`))}async function g7(r){let e=await to(r);if(e)return e;let t=ji(r);return process.env[t.defaultApiKeyEnvVar]??null}async function b7(){console.log(ne.default.cyan.bold(`
|
|
259
263
|
\u{1F916} AI Configuration Setup
|
|
260
|
-
`));let r=
|
|
261
|
-
\u2713 Found existing API key: ${
|
|
262
|
-
Fetching available models...`));let n;try{n=(await
|
|
264
|
+
`));let r=d7();try{let e=await No({message:"Select AI provider:",choices:jd(),default:r?.provider??gl.provider}),t=ji(e),s,i=await g7(e);i&&(console.log(ne.default.green(`
|
|
265
|
+
\u2713 Found existing API key: ${db(i)}`)),await jo({message:"Use this existing API key?",default:!0})&&(s=i)),s||(s=await p7(t.name,t.apiKeyUrl)),console.log(ne.default.dim(`
|
|
266
|
+
Fetching available models...`));let n;try{n=(await fb(e,s)).models,console.log(ne.default.green(`\u2713 Loaded ${n.length} models from ${t.name} API
|
|
263
267
|
`))}catch(c){console.error(ne.default.red(`
|
|
264
268
|
\u274C Failed to fetch models: ${c.message}`)),console.log(ne.default.yellow(`
|
|
265
269
|
Please check your API key and try again.
|
|
266
|
-
`)),process.exit(1)}let o=await
|
|
270
|
+
`)),process.exit(1)}let o=await x7(n,r,e),a={provider:e,model:o.trim()};Ud(a),await Wd(e,s),m7(a,s)}catch(e){throw e.name==="ExitPromptError"&&(console.log(ne.default.yellow(`
|
|
267
271
|
Setup cancelled.
|
|
268
272
|
`)),process.exit(0)),e}}var dh=new Ee("setup").description("Configure platform settings").option("--ai","Configure AI provider and API key for code generation").addHelpText("after",`
|
|
269
273
|
Examples:
|
|
270
274
|
# Configure AI provider (OpenAI, Anthropic)
|
|
271
275
|
$ pf setup --ai
|
|
272
|
-
`).action(async r=>{if(r.ai){await
|
|
276
|
+
`).action(async r=>{if(r.ai){await b7();return}console.log(ne.default.cyan.bold(`
|
|
273
277
|
\u2699\uFE0F Platform Setup
|
|
274
278
|
`)),console.log(`Available setup options:
|
|
275
|
-
`),console.log(ne.default.dim(" --ai Configure AI provider for code generation")),console.log(),console.log(ne.default.dim("Example: pf setup --ai")),console.log()});
|
|
276
|
-
|
|
277
|
-
Turbo exited with code ${e}`),process.exit(e??0))}})},hb=async r=>{Gt("\u{1F4DD} Generating .env.local..."),await Je("bun",["run","generate-env"],{cwd:r,quiet:!0})},p7=async r=>{Gt("\u{1F4E6} Installing dependencies..."),await Je("bun",["install"],{cwd:r,quiet:!0})},x7=r=>{for(let e of Object.keys(require.cache))r.some(t=>e.includes(t))&&delete require.cache[e]},fb=async(r,e,t,s=!1)=>{if(!Nn){Nn=!0;try{x7(t),await lb(),f7(),Gt(`\u{1F504} Detected change in ${ob.default.cyan(r.replace(/ /g,""))}, restarting...`),s&&await p7(e),await hb(e),ub(e)}catch(i){Gt(`\u274C Failed to restart: ${i}`)}finally{Nn=!1}}},m7=(r,e)=>{for(let t of r){let s=(0,ec.join)(e,t),i=cb(n=>fb(n,e,r),ab);(0,Vt.watch)(s,{recursive:!0},(n,o)=>{o?.endsWith(".ts")&&i(o)})}},g7=(r,e,t)=>{for(let s of r){let i=(0,ec.join)(e,s);if(!(0,Vt.existsSync)(i))continue;let n=new Set((0,Vt.readdirSync)(i,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name)),o=cb(async()=>{let a=new Set((0,Vt.readdirSync)(i,{withFileTypes:!0}).filter(u=>u.isDirectory()).map(u=>u.name)),c=[...a].filter(u=>!n.has(u)),l=[...n].filter(u=>!a.has(u));if(c.length>0||l.length>0){let u=[...c.map(d=>`+${d}`),...l.map(d=>`-${d}`)].join(", ");n=a;let h=l.length>0;await fb(`${s}/ [${u}]`,e,t,h)}},ab);(0,Vt.watch)(i,{recursive:!1},()=>o())}},b7=()=>{let r=async()=>{Gt(`
|
|
278
|
-
\u{1F44B} Shutting down...`),await lb(),process.exit(0)};process.on("SIGINT",r),process.on("SIGTERM",r)},db=new Ee("watch").description("Watch infrastructure and services with auto-reload").action(async()=>{let r=En(),e=d7(r);await hb(r),ub(r);let t=e.watchDirs??[],s=e.watchPackages??[];Gt(`
|
|
279
|
-
\u{1F440} Watching: ${[...t,...s].join(", ")}`),m7(t,r),g7(s,r,t),b7()});process.on("SIGINT",()=>{process.exit(0)});process.on("unhandledRejection",r=>{throw(r.name==="ExitPromptError"||r.message?.includes("ERR_USE_AFTER_CLOSE"))&&process.exit(0),r});process.on("uncaughtException",r=>{(r.name==="ExitPromptError"||r.message?.includes("ERR_USE_AFTER_CLOSE"))&&process.exit(0),console.error(Ln.default.red(`
|
|
280
|
-
\u2716 An unexpected error occurred:`)),console.error(r),process.exit(1)});var tc=new Ee,pb=Object.keys(Sr.bin||{}),[gb="pf",ph]=pb.length>0?pb:["pf"],{description:y7,version:w7,repository:xb}=Sr,D7=xb?.url?`https://${xb.url.replace(/^(git\+|git@)/,"").replace(/\.git$/,"").replace(":","/")}`:"Repository URL not available",v7=[dh,V1(),db,Q1,Z1,Y1,tb];tc.name(gb).description([Ln.default.bold(y7),`
|
|
279
|
+
`),console.log(ne.default.dim(" --ai Configure AI provider for code generation")),console.log(),console.log(ne.default.dim("Example: pf setup --ai")),console.log()});process.on("SIGINT",()=>{process.exit(0)});process.on("unhandledRejection",r=>{throw(r.name==="ExitPromptError"||r.message?.includes("ERR_USE_AFTER_CLOSE"))&&process.exit(0),r});process.on("uncaughtException",r=>{(r.name==="ExitPromptError"||r.message?.includes("ERR_USE_AFTER_CLOSE"))&&process.exit(0),console.error(Ln.default.red(`
|
|
280
|
+
\u2716 An unexpected error occurred:`)),console.error(r),process.exit(1)});var tc=new Ee,pb=Object.keys(Sr.bin||{}),[gb="pf",ph]=pb.length>0?pb:["pf"],{description:y7,version:w7,repository:xb}=Sr,D7=xb?.url?`https://${xb.url.replace(/^(git\+|git@)/,"").replace(/\.git$/,"").replace(":","/")}`:"Repository URL not available",v7=[dh,V1(),tb,lb,nb,ab,hb];tc.name(gb).description([Ln.default.bold(y7),`
|
|
281
281
|
|
|
282
282
|
`,Ln.default.cyan("See more at: "),Ln.default.bold(Kt("GitHub",D7))].join("")).version(w7||"0.0.1").helpCommand(!1);ph&&ph!==gb&&tc.alias(ph);v7.forEach(r=>{tc.addCommand(r)});tc.parse(mb.argv);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
3
|
"private": true,
|
|
4
4
|
"scripts": {
|
|
5
|
-
"dev": "pf
|
|
5
|
+
"dev": "pf dev",
|
|
6
6
|
"generate-env": "turbo run generate-env --ui=stream",
|
|
7
7
|
"build": "bun --env-file .env.local turbo run build",
|
|
8
8
|
"preview": "bun --env-file .env.local turbo run preview",
|