UNPKG

shippie

Version:
3 lines (2 loc) 2.25 kB
#!/usr/bin/env node import{a as o}from"./chunk-MMWUM7UL.mjs";import c from"dotenv";import n from"dotenv";import a from"yargs";import{hideBin as s}from"yargs/helpers";n.config();var i=async()=>a(s(process.argv)).command("configure","Configure the tool",e=>e.option("platform",{description:"Specifies for which platform ('github', 'gitlab' or 'azdev') the project should be configured for. Defaults to 'github'.",choices:["github","gitlab","azdev"],type:"string",default:"github"})).command("review","Review code changes",e=>e.option("modelString",{description:'The model to use for generating the review. Defaults to "openai:gpt-4o-mini".',type:"string",default:"openai:gpt-4.1-mini"}).option("reviewLanguage",{description:"Specifies the target natural language for translation",type:"string",default:"English"}).option("platform",{description:"Platform type",choices:["github","gitlab","azdev","local"],type:"string",default:"local"}).option("maxSteps",{description:"Maximum number of agentic steps to take",type:"number",default:50}).option("baseUrl",{description:"Base URL for the platform",type:"string"}).option("ignore",{description:"Array of globs which shippie ignores. If you don't provide any, sensible default will be used",type:"array"}).option("customInstructions",{description:"Custom instructions to be added to the review prompt",type:"string"})).demandCommand(1,"Please specify a command: configure or review").option("debug",{description:"Enables debug logging.",type:"boolean",default:!1}).option("telemetry",{description:"Enables anonymous telemetry.",type:"boolean",default:!0}).help().parse();c.config();var p=async()=>{let e=await i();o.settings.minLevel=e.debug?2:3,o.debug(`Args: ${JSON.stringify(e)}`);try{switch(e._?.[0]){case"configure":{let{configure:t}=await import("./configure-JXZOMLTG.mjs");await t(e);break}case"review":{let{review:t}=await import("./review-MYJHB6DI.mjs");await t(e);break}default:o.error("Unknown command"),process.exit(1)}process.exit(0)}catch(t){o.error(`Error: ${t}`),process.exit(1)}};p().catch(e=>{let t=e instanceof Error?e.message:"An unknown error occurred",r=e instanceof Error?e.stack:"No stack trace available";o.error(`Error: ${t}`),r&&o.debug(`Stack trace: ${r}`),process.exit(1)});