mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 05:50:50 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/arg/LICENSE.md
generated
vendored
Normal file
21
unified-ai-platform/node_modules/arg/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2019 Zeit, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
31
unified-ai-platform/node_modules/arg/index.d.ts
generated
vendored
Normal file
31
unified-ai-platform/node_modules/arg/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare const flagSymbol: unique symbol;
|
||||
|
||||
declare function arg<T extends arg.Spec>(spec: T, options?: arg.Options): arg.Result<T>;
|
||||
|
||||
declare namespace arg {
|
||||
export function flag<T>(fn: T): T & { [flagSymbol]: true };
|
||||
|
||||
export const COUNT: Handler<number> & { [flagSymbol]: true };
|
||||
|
||||
export type Handler <T = any> = (value: string, name: string, previousValue?: T) => T;
|
||||
|
||||
export interface Spec {
|
||||
[key: string]: string | Handler | [Handler];
|
||||
}
|
||||
|
||||
export type Result<T extends Spec> = { _: string[] } & {
|
||||
[K in keyof T]?: T[K] extends Handler
|
||||
? ReturnType<T[K]>
|
||||
: T[K] extends [Handler]
|
||||
? Array<ReturnType<T[K][0]>>
|
||||
: never
|
||||
};
|
||||
|
||||
export interface Options {
|
||||
argv?: string[];
|
||||
permissive?: boolean;
|
||||
stopAtPositional?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = arg;
|
||||
144
unified-ai-platform/node_modules/arg/index.js
generated
vendored
Normal file
144
unified-ai-platform/node_modules/arg/index.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
const flagSymbol = Symbol('arg flag');
|
||||
|
||||
function arg(opts, {argv = process.argv.slice(2), permissive = false, stopAtPositional = false} = {}) {
|
||||
if (!opts) {
|
||||
throw new Error('Argument specification object is required');
|
||||
}
|
||||
|
||||
const result = {_: []};
|
||||
|
||||
const aliases = {};
|
||||
const handlers = {};
|
||||
|
||||
for (const key of Object.keys(opts)) {
|
||||
if (!key) {
|
||||
throw new TypeError('Argument key cannot be an empty string');
|
||||
}
|
||||
|
||||
if (key[0] !== '-') {
|
||||
throw new TypeError(`Argument key must start with '-' but found: '${key}'`);
|
||||
}
|
||||
|
||||
if (key.length === 1) {
|
||||
throw new TypeError(`Argument key must have a name; singular '-' keys are not allowed: ${key}`);
|
||||
}
|
||||
|
||||
if (typeof opts[key] === 'string') {
|
||||
aliases[key] = opts[key];
|
||||
continue;
|
||||
}
|
||||
|
||||
let type = opts[key];
|
||||
let isFlag = false;
|
||||
|
||||
if (Array.isArray(type) && type.length === 1 && typeof type[0] === 'function') {
|
||||
const [fn] = type;
|
||||
type = (value, name, prev = []) => {
|
||||
prev.push(fn(value, name, prev[prev.length - 1]));
|
||||
return prev;
|
||||
};
|
||||
isFlag = fn === Boolean || fn[flagSymbol] === true;
|
||||
} else if (typeof type === 'function') {
|
||||
isFlag = type === Boolean || type[flagSymbol] === true;
|
||||
} else {
|
||||
throw new TypeError(`Type missing or not a function or valid array type: ${key}`);
|
||||
}
|
||||
|
||||
if (key[1] !== '-' && key.length > 2) {
|
||||
throw new TypeError(`Short argument keys (with a single hyphen) must have only one character: ${key}`);
|
||||
}
|
||||
|
||||
handlers[key] = [type, isFlag];
|
||||
}
|
||||
|
||||
for (let i = 0, len = argv.length; i < len; i++) {
|
||||
const wholeArg = argv[i];
|
||||
|
||||
if (stopAtPositional && result._.length > 0) {
|
||||
result._ = result._.concat(argv.slice(i));
|
||||
break;
|
||||
}
|
||||
|
||||
if (wholeArg === '--') {
|
||||
result._ = result._.concat(argv.slice(i + 1));
|
||||
break;
|
||||
}
|
||||
|
||||
if (wholeArg.length > 1 && wholeArg[0] === '-') {
|
||||
/* eslint-disable operator-linebreak */
|
||||
const separatedArguments = (wholeArg[1] === '-' || wholeArg.length === 2)
|
||||
? [wholeArg]
|
||||
: wholeArg.slice(1).split('').map(a => `-${a}`);
|
||||
/* eslint-enable operator-linebreak */
|
||||
|
||||
for (let j = 0; j < separatedArguments.length; j++) {
|
||||
const arg = separatedArguments[j];
|
||||
const [originalArgName, argStr] = arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined];
|
||||
|
||||
let argName = originalArgName;
|
||||
while (argName in aliases) {
|
||||
argName = aliases[argName];
|
||||
}
|
||||
|
||||
if (!(argName in handlers)) {
|
||||
if (permissive) {
|
||||
result._.push(arg);
|
||||
continue;
|
||||
} else {
|
||||
const err = new Error(`Unknown or unexpected option: ${originalArgName}`);
|
||||
err.code = 'ARG_UNKNOWN_OPTION';
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
const [type, isFlag] = handlers[argName];
|
||||
|
||||
if (!isFlag && ((j + 1) < separatedArguments.length)) {
|
||||
throw new TypeError(`Option requires argument (but was followed by another short argument): ${originalArgName}`);
|
||||
}
|
||||
|
||||
if (isFlag) {
|
||||
result[argName] = type(true, argName, result[argName]);
|
||||
} else if (argStr === undefined) {
|
||||
if (
|
||||
argv.length < i + 2 ||
|
||||
(
|
||||
argv[i + 1].length > 1 &&
|
||||
(argv[i + 1][0] === '-') &&
|
||||
!(
|
||||
argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) &&
|
||||
(
|
||||
type === Number ||
|
||||
// eslint-disable-next-line no-undef
|
||||
(typeof BigInt !== 'undefined' && type === BigInt)
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
const extended = originalArgName === argName ? '' : ` (alias for ${argName})`;
|
||||
throw new Error(`Option requires argument: ${originalArgName}${extended}`);
|
||||
}
|
||||
|
||||
result[argName] = type(argv[i + 1], argName, result[argName]);
|
||||
++i;
|
||||
} else {
|
||||
result[argName] = type(argStr, argName, result[argName]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result._.push(wholeArg);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
arg.flag = fn => {
|
||||
fn[flagSymbol] = true;
|
||||
return fn;
|
||||
};
|
||||
|
||||
// Utility types
|
||||
arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1);
|
||||
|
||||
module.exports = arg;
|
||||
30
unified-ai-platform/node_modules/arg/package.json
generated
vendored
Normal file
30
unified-ai-platform/node_modules/arg/package.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "arg",
|
||||
"version": "4.1.3",
|
||||
"description": "Another simple argument parser",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"repository": "zeit/arg",
|
||||
"author": "Josh Junon <junon@zeit.co>",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "WARN_EXIT=1 jest --coverage -w 2"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"complexity": 0,
|
||||
"max-depth": 0,
|
||||
"no-div-regex": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.1.1",
|
||||
"jest": "^20.0.4",
|
||||
"xo": "^0.18.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user