burgee 0.0.0 → 0.2.0

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.
Files changed (114) hide show
  1. package/README.md +28 -1
  2. package/dist/agent.d.ts +19 -0
  3. package/dist/agent.js +25 -0
  4. package/dist/brand.d.ts +186 -0
  5. package/dist/brand.js +232 -0
  6. package/dist/cli.d.ts +51 -0
  7. package/dist/cli.js +105 -0
  8. package/dist/commander-argument.d.ts +22 -0
  9. package/dist/commander-argument.js +72 -0
  10. package/dist/commander-command.d.ts +345 -0
  11. package/dist/commander-command.js +1605 -0
  12. package/dist/commander-error.d.ts +10 -0
  13. package/dist/commander-error.js +20 -0
  14. package/dist/commander-help.d.ts +67 -0
  15. package/dist/commander-help.js +319 -0
  16. package/dist/commander-option.d.ts +58 -0
  17. package/dist/commander-option.js +164 -0
  18. package/dist/commander-suggest.d.ts +2 -0
  19. package/dist/commander-suggest.js +59 -0
  20. package/dist/commander.d.ts +18 -0
  21. package/dist/commander.js +12 -0
  22. package/dist/completions.d.ts +39 -0
  23. package/dist/completions.js +224 -0
  24. package/dist/config.d.ts +28 -0
  25. package/dist/config.js +98 -0
  26. package/dist/contrast.d.ts +70 -0
  27. package/dist/contrast.js +93 -0
  28. package/dist/execute.d.ts +97 -0
  29. package/dist/execute.js +433 -0
  30. package/dist/exit-code.d.ts +18 -0
  31. package/dist/exit-code.js +12 -0
  32. package/dist/help.d.ts +22 -0
  33. package/dist/help.js +158 -0
  34. package/dist/index.d.ts +16 -1
  35. package/dist/index.js +9 -2
  36. package/dist/manifest.d.ts +192 -0
  37. package/dist/manifest.js +55 -0
  38. package/dist/mcp.d.ts +40 -0
  39. package/dist/mcp.js +111 -0
  40. package/dist/names.d.ts +5 -0
  41. package/dist/names.js +6 -0
  42. package/dist/pkg.d.ts +5 -0
  43. package/dist/pkg.js +21 -0
  44. package/dist/precedence.d.ts +55 -0
  45. package/dist/precedence.js +100 -0
  46. package/dist/runtime.d.ts +27 -0
  47. package/dist/runtime.js +17 -0
  48. package/dist/schema.d.ts +71 -0
  49. package/dist/schema.js +108 -0
  50. package/dist/testing-helpers.d.ts +62 -0
  51. package/dist/testing-helpers.js +110 -0
  52. package/dist/testing.d.ts +10 -0
  53. package/dist/testing.js +3 -0
  54. package/dist/validate.d.ts +27 -0
  55. package/dist/validate.js +133 -0
  56. package/dist/yargs-burgee.d.ts +50 -0
  57. package/dist/yargs-burgee.js +104 -0
  58. package/dist/yargs-cliui.d.ts +56 -0
  59. package/dist/yargs-cliui.js +421 -0
  60. package/dist/yargs-command.d.ts +82 -0
  61. package/dist/yargs-command.js +414 -0
  62. package/dist/yargs-completion.d.ts +41 -0
  63. package/dist/yargs-completion.js +271 -0
  64. package/dist/yargs-factory.d.ts +193 -0
  65. package/dist/yargs-factory.js +1606 -0
  66. package/dist/yargs-helpers.d.ts +6 -0
  67. package/dist/yargs-helpers.js +2 -0
  68. package/dist/yargs-middleware.d.ts +32 -0
  69. package/dist/yargs-middleware.js +81 -0
  70. package/dist/yargs-parser.d.ts +41 -0
  71. package/dist/yargs-parser.js +929 -0
  72. package/dist/yargs-shim.d.ts +54 -0
  73. package/dist/yargs-shim.js +84 -0
  74. package/dist/yargs-usage.d.ts +42 -0
  75. package/dist/yargs-usage.js +479 -0
  76. package/dist/yargs-utils.d.ts +33 -0
  77. package/dist/yargs-utils.js +209 -0
  78. package/dist/yargs-validation.d.ts +26 -0
  79. package/dist/yargs-validation.js +261 -0
  80. package/dist/yargs-y18n.d.ts +21 -0
  81. package/dist/yargs-y18n.js +117 -0
  82. package/dist/yargs.d.ts +6 -0
  83. package/dist/yargs.js +8 -0
  84. package/locales/be.json +46 -0
  85. package/locales/cs.json +51 -0
  86. package/locales/de.json +46 -0
  87. package/locales/en.json +55 -0
  88. package/locales/es.json +46 -0
  89. package/locales/fi.json +49 -0
  90. package/locales/fr.json +53 -0
  91. package/locales/he.json +55 -0
  92. package/locales/hi.json +49 -0
  93. package/locales/hu.json +46 -0
  94. package/locales/id.json +50 -0
  95. package/locales/it.json +46 -0
  96. package/locales/ja.json +51 -0
  97. package/locales/ka.json +55 -0
  98. package/locales/ko.json +49 -0
  99. package/locales/nb.json +44 -0
  100. package/locales/nl.json +49 -0
  101. package/locales/nn.json +44 -0
  102. package/locales/pirate.json +13 -0
  103. package/locales/pl.json +49 -0
  104. package/locales/pt.json +45 -0
  105. package/locales/pt_BR.json +48 -0
  106. package/locales/ru.json +51 -0
  107. package/locales/th.json +46 -0
  108. package/locales/tr.json +48 -0
  109. package/locales/uk_UA.json +51 -0
  110. package/locales/uz.json +52 -0
  111. package/locales/zh_CN.json +48 -0
  112. package/locales/zh_TW.json +51 -0
  113. package/package.json +61 -8
  114. package/dist/index.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `burgee/yargs/helpers` — what `yargs/helpers` exports: `hideBin`, `applyExtends`
3
+ * and the parser.
4
+ */
5
+ export { applyExtends, hideBin } from './yargs-utils.js';
6
+ export { Parser } from './yargs-parser.js';
@@ -0,0 +1,2 @@
1
+ export { applyExtends, hideBin } from './yargs-utils.js';
2
+ export { Parser } from './yargs-parser.js';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * yargs' middleware — global, per-command, and the coerce middleware `.coerce()`
3
+ * registers — ported for `burgee/yargs`.
4
+ */
5
+ export interface MiddlewareCallback {
6
+ (argv: any, yargs: any): any;
7
+ }
8
+ export interface Middleware extends MiddlewareCallback {
9
+ applyBeforeValidation?: boolean;
10
+ global?: boolean;
11
+ mutates?: boolean;
12
+ applied?: boolean;
13
+ option?: string;
14
+ }
15
+ interface YargsLike {
16
+ getAliases: () => Record<string, string[]>;
17
+ }
18
+ export declare class GlobalMiddleware {
19
+ globalMiddleware: Middleware[];
20
+ frozens: Middleware[][];
21
+ yargs: YargsLike;
22
+ constructor(yargs: YargsLike);
23
+ addMiddleware(callback: Middleware | Middleware[], applyBeforeValidation: boolean, global?: boolean, mutates?: boolean): YargsLike;
24
+ addCoerceMiddleware(callback: Middleware, option: string): YargsLike;
25
+ getMiddleware(): Middleware[];
26
+ freeze(): void;
27
+ unfreeze(): void;
28
+ reset(): void;
29
+ }
30
+ export declare function commandMiddlewareFactory(commandMiddleware?: Middleware[]): Middleware[];
31
+ export declare function applyMiddleware(argv: any, yargs: any, middlewares: Middleware[], beforeValidation: boolean): any;
32
+ export {};
@@ -0,0 +1,81 @@
1
+ import { argsert, isPromise } from './yargs-utils.js';
2
+ export class GlobalMiddleware {
3
+ globalMiddleware = [];
4
+ frozens = [];
5
+ yargs;
6
+ constructor(yargs) {
7
+ this.yargs = yargs;
8
+ }
9
+ addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
10
+ argsert('<array|function> [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length);
11
+ if (Array.isArray(callback)) {
12
+ for (let i = 0; i < callback.length; i++) {
13
+ if (typeof callback[i] !== 'function')
14
+ throw Error('middleware must be a function');
15
+ const m = callback[i];
16
+ m.applyBeforeValidation = applyBeforeValidation;
17
+ m.global = global;
18
+ }
19
+ Array.prototype.push.apply(this.globalMiddleware, callback);
20
+ }
21
+ else if (typeof callback === 'function') {
22
+ const m = callback;
23
+ m.applyBeforeValidation = applyBeforeValidation;
24
+ m.global = global;
25
+ m.mutates = mutates;
26
+ this.globalMiddleware.push(callback);
27
+ }
28
+ return this.yargs;
29
+ }
30
+ addCoerceMiddleware(callback, option) {
31
+ const aliases = this.yargs.getAliases();
32
+ this.globalMiddleware = this.globalMiddleware.filter((m) => {
33
+ const toCheck = [...(aliases[option] || []), option];
34
+ if (!m.option)
35
+ return true;
36
+ return !toCheck.includes(m.option);
37
+ });
38
+ callback.option = option;
39
+ return this.addMiddleware(callback, true, true, true);
40
+ }
41
+ getMiddleware() {
42
+ return this.globalMiddleware;
43
+ }
44
+ freeze() {
45
+ this.frozens.push([...this.globalMiddleware]);
46
+ }
47
+ unfreeze() {
48
+ const frozen = this.frozens.pop();
49
+ if (frozen !== undefined)
50
+ this.globalMiddleware = frozen;
51
+ }
52
+ reset() {
53
+ this.globalMiddleware = this.globalMiddleware.filter((m) => m.global);
54
+ }
55
+ }
56
+ export function commandMiddlewareFactory(commandMiddleware) {
57
+ if (!commandMiddleware)
58
+ return [];
59
+ return commandMiddleware.map((middleware) => {
60
+ middleware.applyBeforeValidation = false;
61
+ return middleware;
62
+ });
63
+ }
64
+ export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
65
+ return middlewares.reduce((acc, middleware) => {
66
+ if (middleware.applyBeforeValidation !== beforeValidation)
67
+ return acc;
68
+ if (middleware.mutates) {
69
+ if (middleware.applied)
70
+ return acc;
71
+ middleware.applied = true;
72
+ }
73
+ if (isPromise(acc)) {
74
+ return acc
75
+ .then((initialObj) => Promise.all([initialObj, middleware(initialObj, yargs)]))
76
+ .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
77
+ }
78
+ const result = middleware(acc, yargs);
79
+ return isPromise(result) ? result.then((middlewareObj) => Object.assign(acc, middlewareObj)) : Object.assign(acc, result);
80
+ }, argv);
81
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * yargs-parser 22, ported for `burgee/yargs` (J9: burgee depends on nothing, so the
3
+ * parser yargs delegates to is ours too). Graded by yargs' own suite through
4
+ * compat-oracle; every branch, error string and configuration flag is the upstream's.
5
+ */
6
+ export interface ParserMixin {
7
+ cwd: () => string;
8
+ format: (...args: any[]) => string;
9
+ normalize: (p: string) => string;
10
+ resolve: (...p: string[]) => string;
11
+ require: (p: string) => any;
12
+ env: () => Record<string, string | undefined>;
13
+ }
14
+ export interface DetailedArguments {
15
+ argv: Record<string, any>;
16
+ error: Error | null;
17
+ aliases: Record<string, string[]>;
18
+ newAliases: Record<string, boolean>;
19
+ defaulted: Record<string, boolean>;
20
+ configuration: Record<string, any>;
21
+ }
22
+ export declare function camelCase(str: string): string;
23
+ export declare function decamelize(str: string, joinString?: string): string;
24
+ export declare function looksLikeNumber(x: any): boolean;
25
+ export declare function tokenizeArgString(argString: string | any[]): string[];
26
+ export declare class YargsParser {
27
+ private readonly mixin;
28
+ constructor(mixin: ParserMixin);
29
+ parse(argsInput: string | any[], options?: any): DetailedArguments;
30
+ }
31
+ export interface Parser {
32
+ (args: string | any[], opts?: any): Record<string, any>;
33
+ detailed: (args: string | any[], opts?: any) => DetailedArguments;
34
+ camelCase: typeof camelCase;
35
+ decamelize: typeof decamelize;
36
+ looksLikeNumber: typeof looksLikeNumber;
37
+ }
38
+ declare const yargsParser: Parser;
39
+ export { yargsParser as Parser };
40
+ /** `burgee/yargs/parser`: what `import parser from 'yargs-parser'` gives, the same object the front-end parses with. */
41
+ export default yargsParser;