From b8e92bb317361e422df056d0018810be3d181138 Mon Sep 17 00:00:00 2001 From: POPPIN-FUMI Date: Mon, 11 Sep 2023 09:11:47 +0200 Subject: [PATCH] update: release v1.8.1 --- dist/index.js | 9 +++++---- dist/locales/en/skeetAi.json | 2 ++ dist/locales/ja/skeetAi.json | 2 ++ package.json | 2 +- src/lib/version.ts | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6b779354..e41a89bd 100755 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,4 @@ +#!/usr/bin/env node "use strict";var X_e=Object.create;var Uf=Object.defineProperty;var Z_e=Object.getOwnPropertyDescriptor;var eke=Object.getOwnPropertyNames;var tke=Object.getPrototypeOf,oke=Object.prototype.hasOwnProperty;var rke=(c,g,d)=>g in c?Uf(c,g,{enumerable:!0,configurable:!0,writable:!0,value:d}):c[g]=d;var G=(c,g)=>()=>(g||c((g={exports:{}}).exports,g),g.exports),ake=(c,g)=>{for(var d in g)Uf(c,d,{get:g[d],enumerable:!0})},mY=(c,g,d,p)=>{if(g&&typeof g=="object"||typeof g=="function")for(let h of eke(g))!oke.call(c,h)&&h!==d&&Uf(c,h,{get:()=>g[h],enumerable:!(p=Z_e(g,h))||p.enumerable});return c};var st=(c,g,d)=>(d=c!=null?X_e(tke(c)):{},mY(g||!c||!c.__esModule?Uf(d,"default",{value:c,enumerable:!0}):d,c)),nke=c=>mY(Uf({},"__esModule",{value:!0}),c);var k0=(c,g,d)=>(rke(c,typeof g!="symbol"?g+"":g,d),d);var gY=G((Pzt,ike)=>{ike.exports={name:"dotenv",version:"16.0.3",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{require:"./lib/main.js",types:"./lib/main.d.ts",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^17.0.9",decache:"^4.6.1",dtslint:"^3.7.0",sinon:"^12.0.1",standard:"^16.0.4","standard-markdown":"^7.1.0","standard-version":"^9.3.2",tap:"^15.1.6",tar:"^6.1.11",typescript:"^4.5.4"},engines:{node:">=12"}}});var lA=G((jzt,B0)=>{var ske=require("fs"),fY=require("path"),lke=require("os"),uke=gY(),pke=uke.version,cke=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function dke(c){let g={},d=c.toString();d=d.replace(/\r\n?/mg,` `);let p;for(;(p=cke.exec(d))!=null;){let h=p[1],s=p[2]||"";s=s.trim();let a=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),a==='"'&&(s=s.replace(/\\n/g,` `),s=s.replace(/\\r/g,"\r")),g[h]=s}return g}function sA(c){console.log(`[dotenv@${pke}][DEBUG] ${c}`)}function mke(c){return c[0]==="~"?fY.join(lke.homedir(),c.slice(1)):c}function gke(c){let g=fY.resolve(process.cwd(),".env"),d="utf8",p=!!(c&&c.debug),h=!!(c&&c.override);c&&(c.path!=null&&(g=mke(c.path)),c.encoding!=null&&(d=c.encoding));try{let s=M0.parse(ske.readFileSync(g,{encoding:d}));return Object.keys(s).forEach(function(a){Object.prototype.hasOwnProperty.call(process.env,a)?(h===!0&&(process.env[a]=s[a]),p&&sA(h===!0?`"${a}" is already defined in \`process.env\` and WAS overwritten`:`"${a}" is already defined in \`process.env\` and was NOT overwritten`)):process.env[a]=s[a]}),{parsed:s}}catch(s){return p&&sA(`Failed to load ${g} ${s.message}`),{error:s}}}var M0={config:gke,parse:dke};B0.exports.config=M0.config;B0.exports.parse=M0.parse;B0.exports=M0});var Hf=G(pA=>{var I0=class extends Error{constructor(g,d,p){super(p),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=d,this.exitCode=g,this.nestedError=void 0}},uA=class extends I0{constructor(g){super(1,"commander.invalidArgument",g),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pA.CommanderError=I0;pA.InvalidArgumentError=uA});var L0=G(dA=>{var{InvalidArgumentError:fke}=Hf(),cA=class{constructor(g,d){switch(this.description=d||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,g[0]){case"<":this.required=!0,this._name=g.slice(1,-1);break;case"[":this.required=!1,this._name=g.slice(1,-1);break;default:this.required=!0,this._name=g;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(g,d){return d===this.defaultValue||!Array.isArray(d)?[g]:d.concat(g)}default(g,d){return this.defaultValue=g,this.defaultValueDescription=d,this}argParser(g){return this.parseArg=g,this}choices(g){return this.argChoices=g.slice(),this.parseArg=(d,p)=>{if(!this.argChoices.includes(d))throw new fke(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(d,p):d},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function hke(c){let g=c.name()+(c.variadic===!0?"...":"");return c.required?"<"+g+">":"["+g+"]"}dA.Argument=cA;dA.humanReadableArgName=hke});var gA=G(hY=>{var{humanReadableArgName:yke}=L0(),mA=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(g){let d=g.commands.filter(p=>!p._hidden);if(g._hasImplicitHelpCommand()){let[,p,h]=g._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=g.createCommand(p).helpOption(!1);s.description(g._helpCommandDescription),h&&s.arguments(h),d.push(s)}return this.sortSubcommands&&d.sort((p,h)=>p.name().localeCompare(h.name())),d}compareOptions(g,d){let p=h=>h.short?h.short.replace(/^-/,""):h.long.replace(/^--/,"");return p(g).localeCompare(p(d))}visibleOptions(g){let d=g.options.filter(s=>!s.hidden),p=g._hasHelpOption&&g._helpShortFlag&&!g._findOption(g._helpShortFlag),h=g._hasHelpOption&&!g._findOption(g._helpLongFlag);if(p||h){let s;p?h?s=g.createOption(g._helpFlags,g._helpDescription):s=g.createOption(g._helpShortFlag,g._helpDescription):s=g.createOption(g._helpLongFlag,g._helpDescription),d.push(s)}return this.sortOptions&&d.sort(this.compareOptions),d}visibleGlobalOptions(g){if(!this.showGlobalOptions)return[];let d=[];for(let p=g.parent;p;p=p.parent){let h=p.options.filter(s=>!s.hidden);d.push(...h)}return this.sortOptions&&d.sort(this.compareOptions),d}visibleArguments(g){return g._argsDescription&&g._args.forEach(d=>{d.description=d.description||g._argsDescription[d.name()]||""}),g._args.find(d=>d.description)?g._args:[]}subcommandTerm(g){let d=g._args.map(p=>yke(p)).join(" ");return g._name+(g._aliases[0]?"|"+g._aliases[0]:"")+(g.options.length?" [options]":"")+(d?" "+d:"")}optionTerm(g){return g.flags}argumentTerm(g){return g.name()}longestSubcommandTermLength(g,d){return d.visibleCommands(g).reduce((p,h)=>Math.max(p,d.subcommandTerm(h).length),0)}longestOptionTermLength(g,d){return d.visibleOptions(g).reduce((p,h)=>Math.max(p,d.optionTerm(h).length),0)}longestGlobalOptionTermLength(g,d){return d.visibleGlobalOptions(g).reduce((p,h)=>Math.max(p,d.optionTerm(h).length),0)}longestArgumentTermLength(g,d){return d.visibleArguments(g).reduce((p,h)=>Math.max(p,d.argumentTerm(h).length),0)}commandUsage(g){let d=g._name;g._aliases[0]&&(d=d+"|"+g._aliases[0]);let p="";for(let h=g.parent;h;h=h.parent)p=h.name()+" "+p;return p+d+" "+g.usage()}commandDescription(g){return g.description()}subcommandDescription(g){return g.summary()||g.description()}optionDescription(g){let d=[];return g.argChoices&&d.push(`choices: ${g.argChoices.map(p=>JSON.stringify(p)).join(", ")}`),g.defaultValue!==void 0&&(g.required||g.optional||g.isBoolean()&&typeof g.defaultValue=="boolean")&&d.push(`default: ${g.defaultValueDescription||JSON.stringify(g.defaultValue)}`),g.presetArg!==void 0&&g.optional&&d.push(`preset: ${JSON.stringify(g.presetArg)}`),g.envVar!==void 0&&d.push(`env: ${g.envVar}`),d.length>0?`${g.description} (${d.join(", ")})`:g.description}argumentDescription(g){let d=[];if(g.argChoices&&d.push(`choices: ${g.argChoices.map(p=>JSON.stringify(p)).join(", ")}`),g.defaultValue!==void 0&&d.push(`default: ${g.defaultValueDescription||JSON.stringify(g.defaultValue)}`),d.length>0){let p=`(${d.join(", ")})`;return g.description?`${g.description} ${p}`:p}return g.description}formatHelp(g,d){let p=d.padWidth(g,d),h=d.helpWidth||80,s=2,a=2;function f(o,r){if(r){let u=`${o.padEnd(p+a)}${r}`;return d.wrap(u,h-s,p+a)}return o}function b(o){return o.join(` @@ -983,7 +984,7 @@ You must use <@skeet-framework/firestore> to retrieve data from Firestore. catch (error) { throw new Error(\`findLargest: \${error}\`) } -}`}]}},sQ=async(c,g,d,p,h,s,a,f)=>{try{let b=uQ(d,p,h,s,a,f);return await fi(b,c,g.ai,g.aiInstance)}catch(b){throw new Error(`skeetNaming: ${b}`)}};dQ.config();var tl,kh=(tl=class{ai;model;maxTokens;temperature;_initOptions;aiInstance;functionConfigPaths=g=>({packageJson:`${tl.FUNCTION_ROOT}/${g}/package.json`,tsconfigJson:`${tl.FUNCTION_ROOT}/${g}/tsconfig.json`});constructor(g={}){this.ai=g.ai||"VertexAI",this.model=g.model||(this.ai==="VertexAI"?"chat-bison@001":"gpt-4"),this.maxTokens=g.maxTokens||1e3,this.temperature=g.temperature||0,this.ai==="VertexAI"?this.aiInstance=new Sd({model:this.model,maxOutputTokens:this.maxTokens}):this.aiInstance=new Od({model:this.model,maxTokens:this.maxTokens,apiKey:process.env.CHAT_GPT_KEY||"",organizationKey:process.env.CHAT_GPT_ORG||""}),this._initOptions=g}get initOptions(){return this._initOptions}async prisma(g){try{return await NH(g,this)}catch(d){this.handleError(d)}}async skeet(g){try{return await IH(g,this)}catch(d){throw new Error(`skeet: ${d}`)}}async uploadFile(g){try{return await xH(g,this.ai,this.aiInstance)}catch(d){this.handleError(d)}}async createFineTuningJob(g,d="gpt-3.5-turbo-0613"){try{return await EH(g,d,this.ai,this.aiInstance)}catch(p){this.handleError(p)}}async showFineTuningJob(g){try{return await MH(g,this.ai,this.aiInstance)}catch(d){this.handleError(d)}}async typedoc(g){try{return await UH(g,this)}catch(d){this.handleError(d)}}async naming(g,d="function"){try{return await zH(g,this,d)}catch(p){this.handleError(p)}}async translates(g,d="ja",p="en"){try{return await $H(g,d,p,this)}catch(h){this.handleError(h)}}async firestore(g){try{return await tQ(g,this)}catch(d){this.handleError(d)}}async function(g,d,p,h,s,a,f){try{return await sQ(g,this,d,p,h,s,a,f)}catch(b){this.handleError(b)}}async method(g,d,p,h,s,a){try{return await nQ(g,this,d,p,h,s,a)}catch(f){this.handleError(f)}}async run(g,d){try{let p=Ia(g.context,g.examples,d,this.ai);return this.ai==="VertexAI"?await this.aiInstance.prompt(p):await this.aiInstance.prompt(p)}catch(p){throw new Error(`run: ${p}`)}}handleError(g){console.error("Error:",g)}},k0(tl,"PRISMA_SCHEMA_PATH","./graphql/prisma/schema.prisma"),k0(tl,"MODEL_PATH","./functions/skeet/src/models"),k0(tl,"FUNCTION_ROOT","./functions"),tl),Cp=kh;});var Ozt={};ake(Ozt,{DEFAULT_FUNCTION_NAME:()=>Hr,FIREBASERC_PATH:()=>O5,GRAPHQL_ENV_BUILD_PATH:()=>WI,GRAPHQL_ENV_PRODUCTION_PATH:()=>ei,GRAPHQL_PATH:()=>ea,GRAPHQL_ROOT:()=>Xo,PRISMA_SCHEMA_PATH:()=>Ps,SKEET_CONFIG_PATH:()=>hp,TRANSLATE_PATH:()=>p$,program:()=>qt});module.exports=nke(Ozt);var o_e=st(lA());var AY=st(DY(),1),{program:Fzt,createCommand:_zt,createArgument:kzt,createOption:Mzt,CommanderError:Rzt,InvalidArgumentError:Nzt,InvalidOptionArgumentError:Bzt,Command:FY,Argument:Izt,Option:Lzt,Help:qzt}=AY.default;var _Y="1.8.0";var kY=(c=0)=>g=>`\x1B[${g+c}m`,MY=(c=0)=>g=>`\x1B[${38+c};5;${g}m`,RY=(c=0)=>(g,d,p)=>`\x1B[${38+c};2;${g};${d};${p}m`,Ao={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Vzt=Object.keys(Ao.modifier),_ke=Object.keys(Ao.color),kke=Object.keys(Ao.bgColor),Gzt=[..._ke,...kke];function Mke(){let c=new Map;for(let[g,d]of Object.entries(Ao)){for(let[p,h]of Object.entries(d))Ao[p]={open:`\x1B[${h[0]}m`,close:`\x1B[${h[1]}m`},d[p]=Ao[p],c.set(h[0],h[1]);Object.defineProperty(Ao,g,{value:d,enumerable:!1})}return Object.defineProperty(Ao,"codes",{value:c,enumerable:!1}),Ao.color.close="\x1B[39m",Ao.bgColor.close="\x1B[49m",Ao.color.ansi=kY(),Ao.color.ansi256=MY(),Ao.color.ansi16m=RY(),Ao.bgColor.ansi=kY(10),Ao.bgColor.ansi256=MY(10),Ao.bgColor.ansi16m=RY(10),Object.defineProperties(Ao,{rgbToAnsi256:{value(g,d,p){return g===d&&d===p?g<8?16:g>248?231:Math.round((g-8)/247*24)+232:16+36*Math.round(g/255*5)+6*Math.round(d/255*5)+Math.round(p/255*5)},enumerable:!1},hexToRgb:{value(g){let d=/[a-f\d]{6}|[a-f\d]{3}/i.exec(g.toString(16));if(!d)return[0,0,0];let[p]=d;p.length===3&&(p=[...p].map(s=>s+s).join(""));let h=Number.parseInt(p,16);return[h>>16&255,h>>8&255,h&255]},enumerable:!1},hexToAnsi256:{value:g=>Ao.rgbToAnsi256(...Ao.hexToRgb(g)),enumerable:!1},ansi256ToAnsi:{value(g){if(g<8)return 30+g;if(g<16)return 90+(g-8);let d,p,h;if(g>=232)d=((g-232)*10+8)/255,p=d,h=d;else{g-=16;let f=g%36;d=Math.floor(g/36)/5,p=Math.floor(f/6)/5,h=f%6/5}let s=Math.max(d,p,h)*2;if(s===0)return 30;let a=30+(Math.round(h)<<2|Math.round(p)<<1|Math.round(d));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(g,d,p)=>Ao.ansi256ToAnsi(Ao.rgbToAnsi256(g,d,p)),enumerable:!1},hexToAnsi:{value:g=>Ao.ansi256ToAnsi(Ao.hexToAnsi256(g)),enumerable:!1}}),Ao}var Rke=Mke(),Gn=Rke;var U0=st(require("node:process"),1),BY=st(require("node:os"),1),SA=st(require("node:tty"),1);function gn(c,g=globalThis.Deno?globalThis.Deno.args:U0.default.argv){let d=c.startsWith("-")?"":c.length===1?"-":"--",p=g.indexOf(d+c),h=g.indexOf("--");return p!==-1&&(h===-1||p=2,has16m:c>=3}}function Ike(c,{streamIsTTY:g,sniffFlags:d=!0}={}){let p=Nke();p!==void 0&&(J0=p);let h=d?J0:p;if(h===0)return 0;if(d){if(gn("color=16m")||gn("color=full")||gn("color=truecolor"))return 3;if(gn("color=256"))return 2}if("TF_BUILD"in Lo&&"AGENT_NAME"in Lo)return 1;if(c&&!g&&h===void 0)return 0;let s=h||0;if(Lo.TERM==="dumb")return s;if(U0.default.platform==="win32"){let a=BY.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Lo)return"GITHUB_ACTIONS"in Lo||"GITEA_ACTIONS"in Lo?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Lo)||Lo.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Lo)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Lo.TEAMCITY_VERSION)?1:0;if(Lo.COLORTERM==="truecolor"||Lo.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Lo){let a=Number.parseInt((Lo.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Lo.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Lo.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Lo.TERM)||"COLORTERM"in Lo?1:s}function NY(c,g={}){let d=Ike(c,{streamIsTTY:c&&c.isTTY,...g});return Bke(d)}var Lke={stdout:NY({isTTY:SA.default.isatty(1)}),stderr:NY({isTTY:SA.default.isatty(2)})},IY=Lke;function LY(c,g,d){let p=c.indexOf(g);if(p===-1)return c;let h=g.length,s=0,a="";do a+=c.slice(s,p)+g+d,s=p+h,p=c.indexOf(g,s);while(p!==-1);return a+=c.slice(s),a}function qY(c,g,d,p){let h=0,s="";do{let a=c[p-1]==="\r";s+=c.slice(h,a?p-1:p)+g+(a?`\r +}`}]}},sQ=async(c,g,d,p,h,s,a,f)=>{try{let b=uQ(d,p,h,s,a,f);return await fi(b,c,g.ai,g.aiInstance)}catch(b){throw new Error(`skeetNaming: ${b}`)}};dQ.config();var tl,kh=(tl=class{ai;model;maxTokens;temperature;_initOptions;aiInstance;functionConfigPaths=g=>({packageJson:`${tl.FUNCTION_ROOT}/${g}/package.json`,tsconfigJson:`${tl.FUNCTION_ROOT}/${g}/tsconfig.json`});constructor(g={}){this.ai=g.ai||"VertexAI",this.model=g.model||(this.ai==="VertexAI"?"chat-bison@001":"gpt-4"),this.maxTokens=g.maxTokens||1e3,this.temperature=g.temperature||0,this.ai==="VertexAI"?this.aiInstance=new Sd({model:this.model,maxOutputTokens:this.maxTokens}):this.aiInstance=new Od({model:this.model,maxTokens:this.maxTokens,apiKey:process.env.CHAT_GPT_KEY||"",organizationKey:process.env.CHAT_GPT_ORG||""}),this._initOptions=g}get initOptions(){return this._initOptions}async prisma(g){try{return await NH(g,this)}catch(d){this.handleError(d)}}async skeet(g){try{return await IH(g,this)}catch(d){throw new Error(`skeet: ${d}`)}}async uploadFile(g){try{return await xH(g,this.ai,this.aiInstance)}catch(d){this.handleError(d)}}async createFineTuningJob(g,d="gpt-3.5-turbo-0613"){try{return await EH(g,d,this.ai,this.aiInstance)}catch(p){this.handleError(p)}}async showFineTuningJob(g){try{return await MH(g,this.ai,this.aiInstance)}catch(d){this.handleError(d)}}async typedoc(g){try{return await UH(g,this)}catch(d){this.handleError(d)}}async naming(g,d="function"){try{return await zH(g,this,d)}catch(p){this.handleError(p)}}async translates(g,d="ja",p="en"){try{return await $H(g,d,p,this)}catch(h){this.handleError(h)}}async firestore(g){try{return await tQ(g,this)}catch(d){this.handleError(d)}}async function(g,d,p,h,s,a,f){try{return await sQ(g,this,d,p,h,s,a,f)}catch(b){this.handleError(b)}}async method(g,d,p,h,s,a){try{return await nQ(g,this,d,p,h,s,a)}catch(f){this.handleError(f)}}async run(g,d){try{let p=Ia(g.context,g.examples,d,this.ai);return this.ai==="VertexAI"?await this.aiInstance.prompt(p):await this.aiInstance.prompt(p)}catch(p){throw new Error(`run: ${p}`)}}handleError(g){console.error("Error:",g)}},k0(tl,"PRISMA_SCHEMA_PATH","./graphql/prisma/schema.prisma"),k0(tl,"MODEL_PATH","./functions/skeet/src/models"),k0(tl,"FUNCTION_ROOT","./functions"),tl),Cp=kh;});var Ozt={};ake(Ozt,{DEFAULT_FUNCTION_NAME:()=>Hr,FIREBASERC_PATH:()=>O5,GRAPHQL_ENV_BUILD_PATH:()=>WI,GRAPHQL_ENV_PRODUCTION_PATH:()=>ei,GRAPHQL_PATH:()=>ea,GRAPHQL_ROOT:()=>Xo,PRISMA_SCHEMA_PATH:()=>Ps,SKEET_CONFIG_PATH:()=>hp,TRANSLATE_PATH:()=>p$,program:()=>qt});module.exports=nke(Ozt);var o_e=st(lA());var AY=st(DY(),1),{program:Fzt,createCommand:_zt,createArgument:kzt,createOption:Mzt,CommanderError:Rzt,InvalidArgumentError:Nzt,InvalidOptionArgumentError:Bzt,Command:FY,Argument:Izt,Option:Lzt,Help:qzt}=AY.default;var _Y="1.8.1";var kY=(c=0)=>g=>`\x1B[${g+c}m`,MY=(c=0)=>g=>`\x1B[${38+c};5;${g}m`,RY=(c=0)=>(g,d,p)=>`\x1B[${38+c};2;${g};${d};${p}m`,Ao={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Vzt=Object.keys(Ao.modifier),_ke=Object.keys(Ao.color),kke=Object.keys(Ao.bgColor),Gzt=[..._ke,...kke];function Mke(){let c=new Map;for(let[g,d]of Object.entries(Ao)){for(let[p,h]of Object.entries(d))Ao[p]={open:`\x1B[${h[0]}m`,close:`\x1B[${h[1]}m`},d[p]=Ao[p],c.set(h[0],h[1]);Object.defineProperty(Ao,g,{value:d,enumerable:!1})}return Object.defineProperty(Ao,"codes",{value:c,enumerable:!1}),Ao.color.close="\x1B[39m",Ao.bgColor.close="\x1B[49m",Ao.color.ansi=kY(),Ao.color.ansi256=MY(),Ao.color.ansi16m=RY(),Ao.bgColor.ansi=kY(10),Ao.bgColor.ansi256=MY(10),Ao.bgColor.ansi16m=RY(10),Object.defineProperties(Ao,{rgbToAnsi256:{value(g,d,p){return g===d&&d===p?g<8?16:g>248?231:Math.round((g-8)/247*24)+232:16+36*Math.round(g/255*5)+6*Math.round(d/255*5)+Math.round(p/255*5)},enumerable:!1},hexToRgb:{value(g){let d=/[a-f\d]{6}|[a-f\d]{3}/i.exec(g.toString(16));if(!d)return[0,0,0];let[p]=d;p.length===3&&(p=[...p].map(s=>s+s).join(""));let h=Number.parseInt(p,16);return[h>>16&255,h>>8&255,h&255]},enumerable:!1},hexToAnsi256:{value:g=>Ao.rgbToAnsi256(...Ao.hexToRgb(g)),enumerable:!1},ansi256ToAnsi:{value(g){if(g<8)return 30+g;if(g<16)return 90+(g-8);let d,p,h;if(g>=232)d=((g-232)*10+8)/255,p=d,h=d;else{g-=16;let f=g%36;d=Math.floor(g/36)/5,p=Math.floor(f/6)/5,h=f%6/5}let s=Math.max(d,p,h)*2;if(s===0)return 30;let a=30+(Math.round(h)<<2|Math.round(p)<<1|Math.round(d));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(g,d,p)=>Ao.ansi256ToAnsi(Ao.rgbToAnsi256(g,d,p)),enumerable:!1},hexToAnsi:{value:g=>Ao.ansi256ToAnsi(Ao.hexToAnsi256(g)),enumerable:!1}}),Ao}var Rke=Mke(),Gn=Rke;var U0=st(require("node:process"),1),BY=st(require("node:os"),1),SA=st(require("node:tty"),1);function gn(c,g=globalThis.Deno?globalThis.Deno.args:U0.default.argv){let d=c.startsWith("-")?"":c.length===1?"-":"--",p=g.indexOf(d+c),h=g.indexOf("--");return p!==-1&&(h===-1||p=2,has16m:c>=3}}function Ike(c,{streamIsTTY:g,sniffFlags:d=!0}={}){let p=Nke();p!==void 0&&(J0=p);let h=d?J0:p;if(h===0)return 0;if(d){if(gn("color=16m")||gn("color=full")||gn("color=truecolor"))return 3;if(gn("color=256"))return 2}if("TF_BUILD"in Lo&&"AGENT_NAME"in Lo)return 1;if(c&&!g&&h===void 0)return 0;let s=h||0;if(Lo.TERM==="dumb")return s;if(U0.default.platform==="win32"){let a=BY.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Lo)return"GITHUB_ACTIONS"in Lo||"GITEA_ACTIONS"in Lo?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Lo)||Lo.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Lo)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Lo.TEAMCITY_VERSION)?1:0;if(Lo.COLORTERM==="truecolor"||Lo.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Lo){let a=Number.parseInt((Lo.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Lo.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Lo.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Lo.TERM)||"COLORTERM"in Lo?1:s}function NY(c,g={}){let d=Ike(c,{streamIsTTY:c&&c.isTTY,...g});return Bke(d)}var Lke={stdout:NY({isTTY:SA.default.isatty(1)}),stderr:NY({isTTY:SA.default.isatty(2)})},IY=Lke;function LY(c,g,d){let p=c.indexOf(g);if(p===-1)return c;let h=g.length,s=0,a="";do a+=c.slice(s,p)+g+d,s=p+h,p=c.indexOf(g,s);while(p!==-1);return a+=c.slice(s),a}function qY(c,g,d,p){let h=0,s="";do{let a=c[p-1]==="\r";s+=c.slice(h,a?p-1:p)+g+(a?`\r `:` `)+d,h=p+1,p=c.indexOf(` `,h)}while(p!==-1);return s+=c.slice(h),s}var{stdout:JY,stderr:UY}=IY,PA=Symbol("GENERATOR"),Rc=Symbol("STYLER"),Yf=Symbol("IS_EMPTY"),VY=["ansi","ansi","ansi256","ansi16m"],Nc=Object.create(null),qke=(c,g={})=>{if(g.level&&!(Number.isInteger(g.level)&&g.level>=0&&g.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let d=JY?JY.level:0;c.level=g.level===void 0?d:g.level};var Jke=c=>{let g=(...d)=>d.join(" ");return qke(g,c),Object.setPrototypeOf(g,Wf.prototype),g};function Wf(c){return Jke(c)}Object.setPrototypeOf(Wf.prototype,Function.prototype);for(let[c,g]of Object.entries(Gn))Nc[c]={get(){let d=V0(this,xA(g.open,g.close,this[Rc]),this[Yf]);return Object.defineProperty(this,c,{value:d}),d}};Nc.visible={get(){let c=V0(this,this[Rc],!0);return Object.defineProperty(this,"visible",{value:c}),c}};var jA=(c,g,d,...p)=>c==="rgb"?g==="ansi16m"?Gn[d].ansi16m(...p):g==="ansi256"?Gn[d].ansi256(Gn.rgbToAnsi256(...p)):Gn[d].ansi(Gn.rgbToAnsi(...p)):c==="hex"?jA("rgb",g,d,...Gn.hexToRgb(...p)):Gn[d][c](...p),Uke=["rgb","hex","ansi256"];for(let c of Uke){Nc[c]={get(){let{level:d}=this;return function(...p){let h=xA(jA(c,VY[d],"color",...p),Gn.color.close,this[Rc]);return V0(this,h,this[Yf])}}};let g="bg"+c[0].toUpperCase()+c.slice(1);Nc[g]={get(){let{level:d}=this;return function(...p){let h=xA(jA(c,VY[d],"bgColor",...p),Gn.bgColor.close,this[Rc]);return V0(this,h,this[Yf])}}}}var Vke=Object.defineProperties(()=>{},{...Nc,level:{enumerable:!0,get(){return this[PA].level},set(c){this[PA].level=c}}}),xA=(c,g,d)=>{let p,h;return d===void 0?(p=c,h=g):(p=d.openAll+c,h=g+d.closeAll),{open:c,close:g,openAll:p,closeAll:h,parent:d}},V0=(c,g,d)=>{let p=(...h)=>Gke(p,h.length===1?""+h[0]:h.join(" "));return Object.setPrototypeOf(p,Vke),p[PA]=c,p[Rc]=g,p[Yf]=d,p},Gke=(c,g)=>{if(c.level<=0||!g)return c[Yf]?"":g;let d=c[Rc];if(d===void 0)return g;let{openAll:p,closeAll:h}=d;if(g.includes("\x1B"))for(;d!==void 0;)g=LY(g,d.close,d.open),d=d.parent;let s=g.indexOf(` @@ -1581,9 +1582,9 @@ firebase-export-* }, { "priority": "2147483647", - "description": "Deny All IP addresses", + "description": "Allow/Deny All IP addresses. default: allow", "options": { - "action": "deny-403" + "action": "allow" } } ] @@ -2455,7 +2456,7 @@ $ method $ help $ q `))};aiOptionTable=g=>{let d=new ZFe.default({head:[tt.blue("Option"),tt.blue("Value")],chars:{top:"\u2550","top-mid":"\u2564","top-left":"\u2554","top-right":"\u2557",bottom:"\u2550","bottom-mid":"\u2567","bottom-left":"\u255A","bottom-right":"\u255D",left:"\u2502","left-mid":"\u255F",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2562",middle:"\u2502"}});d.push([this.text().common.aiType,g.ai],[this.text().common.model,g.model],[this.text().common.maxToken,g.maxTokens],[this.text().common.temperature,g.temperature]),console.log(d.toString())};addJson=(g,d,p,h)=>{let s=`tmp/ai/history-${this.lang}.jsonl`;(0,Xi.existsSync)("tmp/ai")||(0,Xi.mkdirSync)("tmp/ai",{recursive:!0});let a={role:g,content:d,mode:p,model:h,createdAt:(0,XFe.utcNow)()},f="";(0,Xi.existsSync)(s)===!1?((0,Xi.appendFileSync)(s,""),f=JSON.stringify(a)):f=`, -`+JSON.stringify(a),(0,Xi.appendFileSync)(s,f)}};var c0=require("fs"),t_e=()=>{qt.command("ai").description("AI Playground").option("-v, --vertex","Vertex AI").option("-o, --openai","OpenAI").option("-m, --model ","Model").option("-token, --token ","Max Tokens").option("-temp, --temperature ","Temperature").action(async c=>{await vzt();let{ai:g}=await lt(),d=g.lang||"en",p=new ED(d),h=c.openai?"OpenAI":"VertexAI";bzt(h,p);let s=c.openai?c.model||"gpt-4":c.model||"chat-bison@001",a=c.token||"1000",f=c.temperature||"0";(Number(f)>1||Number(f)<0)&&(console.log(tt.yellow(p.text().warning.temperature)),process.exit(1));let b={ai:h,maxTokens:a,model:s,temperature:f};p.aiOptionTable(b),p.help(),console.log(`${tt.white(`${tt.blue(h)} ${p.text().common.isSelected}`)}`),Eo(b,p)})},bzt=(c,g)=>{if(c==="OpenAI"){let d=process.env.CHAT_GPT_ORG,p=process.env.CHAT_GPT_KEY;(!d||!p)&&(console.log(tt.yellow(g.text().warning.gptKey)),process.exit(1))}else{let d=process.env.GCLOUD_PROJECT,p=process.env.REGION;(!d||!p)&&(console.log(tt.yellow(g.text().warning.gcpKey)),console.log(tt.yellow("\u26A0\uFE0F Did you run `$ skeet iam ai`? \u26A0\uFE0F")),process.exit(1))}},e_e={lang:"en",ais:[{name:"VertexAI",availableModels:["chat-bison@001"]}]},vzt=async()=>{try{let c=(0,c0.readFileSync)("./skeet-cloud.config.json"),g=JSON.parse(String(c));g.ai||(g.ai=e_e),(0,c0.writeFileSync)(pa,JSON.stringify(g,null,2))}catch{(0,c0.writeFileSync)(pa,JSON.stringify({ai:e_e},null,2))}};var Xo="./graphql",ei=Xo+"/.env.production",WI=Xo+"/.env.build",ea=Xo+"/src/graphql",Ps=Xo+"/prisma/schema.prisma",hp="./skeet-cloud.config.json",Hr="skeet",O5="./.firebaserc",p$="tmp/ai/translate.json",qt=new FY;qt.name("skeet").description("CLI for Skeet - Full-stack TypeScript Serverless framework").version(_Y);o_e.default.config();function Tzt(){try{J0e(),Q0e(),p0e(),B0e(),G0e(),K0e(),Z0e(),_0e(),rFe(),Pve(),_ve(),Rve(),oDe(),Vve(),Qve(),Ove(),t_e(),qt.parseAsync(process.argv)}catch(c){console.log(c)}}Tzt();0&&(module.exports={DEFAULT_FUNCTION_NAME,FIREBASERC_PATH,GRAPHQL_ENV_BUILD_PATH,GRAPHQL_ENV_PRODUCTION_PATH,GRAPHQL_PATH,GRAPHQL_ROOT,PRISMA_SCHEMA_PATH,SKEET_CONFIG_PATH,TRANSLATE_PATH,program}); +`+JSON.stringify(a),(0,Xi.appendFileSync)(s,f)}};var c0=require("fs"),t_e=()=>{qt.command("ai").description("AI Playground").option("-v, --vertex","Vertex AI").option("-o, --openai","OpenAI").option("-m, --model ","Model").option("-token, --token ","Max Tokens").option("-temp, --temperature ","Temperature").action(async c=>{await vzt();let{ai:g}=await lt(),d=g.lang||"en",p=new ED(d),h=c.openai?"OpenAI":"VertexAI";bzt(h,p);let s=c.openai?c.model||"gpt-4":c.model||"chat-bison@001",a=c.token||"1000",f=c.temperature||"0";(Number(f)>1||Number(f)<0)&&(console.log(tt.yellow(p.text().warning.temperature)),process.exit(1));let b={ai:h,maxTokens:a,model:s,temperature:f};p.aiOptionTable(b),p.help(),console.log(`${tt.white(`${tt.blue(h)} ${p.text().common.isSelected}`)}`),Eo(b,p)})},bzt=(c,g)=>{if(c==="OpenAI"){let d=process.env.CHAT_GPT_ORG,p=process.env.CHAT_GPT_KEY;(!d||!p)&&(console.log(tt.yellow(g.text().warning.gptKey)),process.exit(1))}else{let d=process.env.GCLOUD_PROJECT,p=process.env.REGION;(!d||!p)&&(console.log(tt.yellow(g.text().warning.gcpKey)),console.log(tt.yellow("\u26A0\uFE0F Did you run `$ skeet iam ai`? \u26A0\uFE0F")),process.exit(1))}},e_e={lang:"en",ais:[{name:"VertexAI",availableModels:["chat-bison@001"]}]},vzt=async()=>{try{let c=(0,c0.readFileSync)("./skeet-cloud.config.json"),g=JSON.parse(String(c));g.ai||(g.ai=e_e,(0,c0.writeFileSync)(pa,JSON.stringify(g,null,2)))}catch{(0,c0.writeFileSync)(pa,JSON.stringify({ai:e_e},null,2))}};var Xo="./graphql",ei=Xo+"/.env.production",WI=Xo+"/.env.build",ea=Xo+"/src/graphql",Ps=Xo+"/prisma/schema.prisma",hp="./skeet-cloud.config.json",Hr="skeet",O5="./.firebaserc",p$="tmp/ai/translate.json",qt=new FY;qt.name("skeet").description("CLI for Skeet - Full-stack TypeScript Serverless framework").version(_Y);o_e.default.config();function Tzt(){try{J0e(),Q0e(),p0e(),B0e(),G0e(),K0e(),Z0e(),_0e(),rFe(),Pve(),_ve(),Rve(),oDe(),Vve(),Qve(),Ove(),t_e(),qt.parseAsync(process.argv)}catch(c){console.log(c)}}Tzt();0&&(module.exports={DEFAULT_FUNCTION_NAME,FIREBASERC_PATH,GRAPHQL_ENV_BUILD_PATH,GRAPHQL_ENV_PRODUCTION_PATH,GRAPHQL_PATH,GRAPHQL_ROOT,PRISMA_SCHEMA_PATH,SKEET_CONFIG_PATH,TRANSLATE_PATH,program}); /*! Bundled license information: safe-buffer/index.js: diff --git a/dist/locales/en/skeetAi.json b/dist/locales/en/skeetAi.json index 5bbe5106..dd605722 100644 --- a/dist/locales/en/skeetAi.json +++ b/dist/locales/en/skeetAi.json @@ -1,6 +1,8 @@ { "common": { "you": "You", + "option": "Option", + "value": "Value", "start": "What can I do for you?", "aiType": "AI Type", "model": "Model", diff --git a/dist/locales/ja/skeetAi.json b/dist/locales/ja/skeetAi.json index 14d65587..c758b0d4 100644 --- a/dist/locales/ja/skeetAi.json +++ b/dist/locales/ja/skeetAi.json @@ -1,6 +1,8 @@ { "common": { "you": "あなた", + "option": "オプション", + "value": "値", "start": "何をお手伝いしましょうか?", "aiType": "AIの種類", "model": "モデル", diff --git a/package.json b/package.json index 8f29cc48..e94da381 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@skeet-framework/cli", - "version": "1.8.0", + "version": "1.8.1", "description": "Skeet CLI", "main": "dist/index.js", "repository": "https://github.com/elsoul/skeet-cli", diff --git a/src/lib/version.ts b/src/lib/version.ts index e440488f..701a39e4 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -1 +1 @@ -export const VERSION = '1.8.0' \ No newline at end of file +export const VERSION = '1.8.1' \ No newline at end of file