Skip to content

Commit

Permalink
Merge pull request #125 from elsoul/ai
Browse files Browse the repository at this point in the history
update init config
  • Loading branch information
POPPIN-FUMI authored Sep 11, 2023
2 parents 5ef14bf + f3c9705 commit dbb4987
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/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(`
Expand Down
2 changes: 1 addition & 1 deletion src/cli/ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const validateAiConfig = async () => {
const skeetConfig: SkeetCloudConfig = JSON.parse(String(config))
if (!skeetConfig.ai) {
skeetConfig.ai = defaultAiConfig
writeFileSync(SKEET_CONFIG_PATH, JSON.stringify(skeetConfig, null, 2))
}
writeFileSync(SKEET_CONFIG_PATH, JSON.stringify(skeetConfig, null, 2))
} catch (error) {
const skeetConfig = {
ai: defaultAiConfig,
Expand Down
2 changes: 2 additions & 0 deletions src/cli/ai/locales/en/skeetAi.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"common": {
"you": "You",
"option": "Option",
"value": "Value",
"start": "What can I do for you?",
"aiType": "AI Type",
"model": "Model",
Expand Down
2 changes: 2 additions & 0 deletions src/cli/ai/locales/ja/skeetAi.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"common": {
"you": "あなた",
"option": "オプション",
"value": "",
"start": "何をお手伝いしましょうか?",
"aiType": "AIの種類",
"model": "モデル",
Expand Down
4 changes: 2 additions & 2 deletions src/templates/init/skeet-cloud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export const skeetCloudConfigGen = async (
},
{
"priority": "2147483647",
"description": "Deny All IP addresses",
"description": "Allow/Deny All IP addresses. default: allow",
"options": {
"action": "deny-403"
"action": "allow"
}
}
]
Expand Down

0 comments on commit dbb4987

Please sign in to comment.