icore 1.0.1 → 1.0.3
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.
- package/dist/argv.d.ts +11 -0
- package/dist/argv.d.ts.map +1 -1
- package/dist/argv.js +11 -0
- package/dist/argv.js.map +1 -1
- package/dist/cli.d.ts +5 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -13
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts +12 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +12 -0
- package/dist/commands.js.map +1 -1
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +12 -0
- package/dist/options.js.map +1 -1
- package/package.json +10 -3
- package/readme.md +79 -90
package/dist/argv.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The argv parser module transforms raw CLI tokens into positional segments
|
|
3
|
+
* and unvalidated long-option values.
|
|
4
|
+
*
|
|
5
|
+
* Allowed here:
|
|
6
|
+
* - splitting argv into positionals and named options;
|
|
7
|
+
* - applying option-schema hints only when token ownership is ambiguous;
|
|
8
|
+
* - rejecting duplicate raw option names before schema validation;
|
|
9
|
+
*
|
|
10
|
+
* This file must not contain typed option validation or command resolution.
|
|
11
|
+
*/
|
|
1
12
|
import type { OptionsSchema, RawOptionValue } from './options';
|
|
2
13
|
/**
|
|
3
14
|
* Parsed CLI arguments split into positional command path segments and raw
|
package/dist/argv.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,CAAC,EAAE,aAAa,GACrB,UAAU,CAqEZ"}
|
|
1
|
+
{"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,CAAC,EAAE,aAAa,GACrB,UAAU,CAqEZ"}
|
package/dist/argv.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The argv parser module transforms raw CLI tokens into positional segments
|
|
4
|
+
* and unvalidated long-option values.
|
|
5
|
+
*
|
|
6
|
+
* Allowed here:
|
|
7
|
+
* - splitting argv into positionals and named options;
|
|
8
|
+
* - applying option-schema hints only when token ownership is ambiguous;
|
|
9
|
+
* - rejecting duplicate raw option names before schema validation;
|
|
10
|
+
*
|
|
11
|
+
* This file must not contain typed option validation or command resolution.
|
|
12
|
+
*/
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.parseArgv = parseArgv;
|
|
4
15
|
/**
|
package/dist/argv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":";AAAA;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C;QAC/D,CAAC;QAED,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;YACjD,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,UAAU,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACrB,SAAS;QACX,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAEhC,IAAI,UAAU,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YACxB,KAAK,IAAI,CAAC,CAAC;YACX,SAAS;QACX,CAAC;QAED,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YACxB,KAAK,IAAI,CAAC,CAAC;YACX,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,OAAO;QACL,WAAW;QACX,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The CLI
|
|
3
|
-
* generic user argument parsing.
|
|
2
|
+
* The CLI public barrel module exposes the supported command mechanics API.
|
|
4
3
|
*
|
|
5
4
|
* Allowed here:
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* - checking command paths and extra positionals;
|
|
10
|
-
* - running command handlers with typed options and caller-provided context.
|
|
5
|
+
* - re-exporting public argv parser contracts;
|
|
6
|
+
* - re-exporting public option schema contracts;
|
|
7
|
+
* - re-exporting public command registry contracts;
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
* - application-specific business rules;
|
|
14
|
-
* - SDK/API request building;
|
|
15
|
-
* - external client lifecycle management;
|
|
16
|
-
* - JSON/table/CSV output formatting;
|
|
17
|
-
* - domain-specific command DSLs.
|
|
9
|
+
* This file must not contain parser, validator, or command runtime logic.
|
|
18
10
|
*/
|
|
19
11
|
export { parseArgv, type ParsedArgv } from './argv';
|
|
20
12
|
export { defineCommand, defineCommandRegistry, isCommandName, resolveCommand, resolveCommandFromArgs, runCommand, runCommandFromRegistry, type CommandDefinition, type CommandInput, type CommandName, type CommandRegistry, type ResolvedCommand } from './commands';
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,UAAU,EAChB,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,WAAW,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* The CLI
|
|
4
|
-
* generic user argument parsing.
|
|
3
|
+
* The CLI public barrel module exposes the supported command mechanics API.
|
|
5
4
|
*
|
|
6
5
|
* Allowed here:
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* - checking command paths and extra positionals;
|
|
11
|
-
* - running command handlers with typed options and caller-provided context.
|
|
6
|
+
* - re-exporting public argv parser contracts;
|
|
7
|
+
* - re-exporting public option schema contracts;
|
|
8
|
+
* - re-exporting public command registry contracts;
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
* - application-specific business rules;
|
|
15
|
-
* - SDK/API request building;
|
|
16
|
-
* - external client lifecycle management;
|
|
17
|
-
* - JSON/table/CSV output formatting;
|
|
18
|
-
* - domain-specific command DSLs.
|
|
10
|
+
* This file must not contain parser, validator, or command runtime logic.
|
|
19
11
|
*/
|
|
20
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
13
|
exports.parseOptionsDetailed = exports.parseOptions = exports.mergeOptionsSchema = exports.runCommandFromRegistry = exports.runCommand = exports.resolveCommandFromArgs = exports.resolveCommand = exports.isCommandName = exports.defineCommandRegistry = exports.defineCommand = exports.parseArgv = void 0;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,+BAGgB;AAFd,iGAAA,SAAS,OAAA;AAGX,uCAaoB;AAZlB,yGAAA,aAAa,OAAA;AACb,iHAAA,qBAAqB,OAAA;AACrB,yGAAA,aAAa,OAAA;AACb,0GAAA,cAAc,OAAA;AACd,kHAAA,sBAAsB,OAAA;AACtB,sGAAA,UAAU,OAAA;AACV,kHAAA,sBAAsB,OAAA;AAOxB,qCAcmB;AAbjB,6GAAA,kBAAkB,OAAA;AAClB,uGAAA,YAAY,OAAA;AACZ,+GAAA,oBAAoB,OAAA"}
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command mechanics module resolves command paths and runs typed command
|
|
3
|
+
* handlers after argv and option validation.
|
|
4
|
+
*
|
|
5
|
+
* Allowed here:
|
|
6
|
+
* - defining command and registry contracts;
|
|
7
|
+
* - resolving the most specific command path match;
|
|
8
|
+
* - passing parsed options, provided metadata, positionals, and context to handlers;
|
|
9
|
+
*
|
|
10
|
+
* This file must not contain raw token parsing, option schema validation,
|
|
11
|
+
* domain behavior, SDK calls, or output formatting.
|
|
12
|
+
*/
|
|
1
13
|
import { type InferOptions, type InferProvidedOptions, type OptionsSchema } from './options';
|
|
2
14
|
/**
|
|
3
15
|
* Input passed to a command handler after command path and option validation.
|
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,aAAa,EAC7B,QAAQ,IACN;IACF,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC/B,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACxC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AA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WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAGzC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,SAAS,SAAS,SAAS,oBAAoB,EAAE,EAEvD,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,EACpC,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAUpC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,SAAS,SAAS,SAAS,oBAAoB,EAAE,EAEvD,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,EACpC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAWpC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,CAAC,SAAS,SAAS,SAAS,oBAAoB,EAAE,EAEvD,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,EACpC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GACzC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAQ3C;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,KAAK,CAAC,OAAO,SAAS,aAAa,EACnC,QAAQ,EACR,OAAO,EAEP,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,EACtD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
|
package/dist/commands.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The command mechanics module resolves command paths and runs typed command
|
|
4
|
+
* handlers after argv and option validation.
|
|
5
|
+
*
|
|
6
|
+
* Allowed here:
|
|
7
|
+
* - defining command and registry contracts;
|
|
8
|
+
* - resolving the most specific command path match;
|
|
9
|
+
* - passing parsed options, provided metadata, positionals, and context to handlers;
|
|
10
|
+
*
|
|
11
|
+
* This file must not contain raw token parsing, option schema validation,
|
|
12
|
+
* domain behavior, SDK calls, or output formatting.
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.defineCommand = defineCommand;
|
|
4
16
|
exports.defineCommandRegistry = defineCommandRegistry;
|
package/dist/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA+FH,sCASC;AAKD,sDAaC;AAKD,sCAQC;AAKD,wCAeC;AAKD,wDAgBC;AAKD,wDAcC;AAMD,gCA0BC;AAjOD,iCAEgB;AAChB,uCAKmB;AAkFnB;;GAEG;AACH,SAAgB,aAAa,CAM3B,OAA6D;IAE7D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAGnC,QAAmB;IAEnB,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhF,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAE5C,OAAO;QACL,QAAQ;QACR,YAAY,EAAE,YAAoE;KACnF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAG3B,QAAoC,EACpC,KAAc;IAEd,OAAO,OAAO,KAAK,KAAK,QAAQ;WAC3B,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAuC,CAAC,CAAC;AAC/E,CAAC;AAED;;GAEG;AACH,SAAg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AC;IAED,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,wBAAwB,CAAC,WAA8B;IAC9D,OAAO,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/options.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The option schema module validates raw option values against declarative
|
|
3
|
+
* primitive option contracts.
|
|
4
|
+
*
|
|
5
|
+
* Allowed here:
|
|
6
|
+
* - defining string, boolean, and number option contracts;
|
|
7
|
+
* - applying and validating default values;
|
|
8
|
+
* - producing typed option values and user-provided metadata;
|
|
9
|
+
*
|
|
10
|
+
* This file must not contain argv tokenization, command resolution, or
|
|
11
|
+
* application-specific validation rules.
|
|
12
|
+
*/
|
|
1
13
|
type OptionBase<TType extends string, TValue> = {
|
|
2
14
|
type: TType;
|
|
3
15
|
required?: boolean;
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,IAAI;IAC9C,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,IAC7E,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG;IAChD,OAA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option schema module validates raw option values against declarative
|
|
4
|
+
* primitive option contracts.
|
|
5
|
+
*
|
|
6
|
+
* Allowed here:
|
|
7
|
+
* - defining string, boolean, and number option contracts;
|
|
8
|
+
* - applying and validating default values;
|
|
9
|
+
* - producing typed option values and user-provided metadata;
|
|
10
|
+
*
|
|
11
|
+
* This file must not contain argv tokenization, command resolution, or
|
|
12
|
+
* application-specific validation rules.
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.mergeOptionsSchema = mergeOptionsSchema;
|
|
4
16
|
exports.parseOptions = parseOptions;
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAmJH,gDAYC;AAKD,oCAKC;AAMD,oDA4CC;AA7ED;;;;GAIG;AACH,SAAgB,kBAAkB,CAIhC,MAAe,EACf,GAAG,OAAiB;IAEpB,OAAO,MAAM,CAAC,MAAM,CAClB,EAAE,EACF,MAAM,EACN,GAAG,OAAO,CAC6C,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAC1B,MAAe,EACf,MAAsC;IAEtC,OAAO,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,MAAe,EACf,MAAsC;IAEtC,MAAM,MAAM,GAA4C,EAAE,CAAC;IAC3D,MAAM,QAAQ,GAA4C,EAAE,CAAC;IAE7D,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;YACjC,M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M,IAAI,KAAK,CAAC,eAAe,IAAI,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,oCAAoC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnG,CAAC;IAED,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,iCAAiC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,YAAY,CACnB,IAAY,EACZ,OAAsC,EACtC,KAAa;IAEb,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,gBAAgB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icore",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Declarative command line interface mechanics for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
6
|
+
"command-line",
|
|
7
|
+
"argv",
|
|
8
|
+
"argument-parser",
|
|
9
|
+
"option-parser",
|
|
10
|
+
"command-registry",
|
|
11
|
+
"command-router",
|
|
12
|
+
"typed-cli",
|
|
13
|
+
"declarative-cli"
|
|
7
14
|
],
|
|
8
15
|
"license": "MIT",
|
|
9
16
|
"author": {
|
|
@@ -12,7 +19,7 @@
|
|
|
12
19
|
},
|
|
13
20
|
"repository": {
|
|
14
21
|
"type": "git",
|
|
15
|
-
"url": "
|
|
22
|
+
"url": "git@github.com:woodger/icore.git"
|
|
16
23
|
},
|
|
17
24
|
"main": "dist/index.js",
|
|
18
25
|
"types": "dist/index.d.ts",
|
package/readme.md
CHANGED
|
@@ -5,121 +5,101 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/icore)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Small dependency-free command line interface mechanics for [Node.js®](https://nodejs.org) applications.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
handlers focused on application work. It standardizes argument parsing,
|
|
12
|
-
primitive option validation, defaults, choices, numeric ranges, and positional
|
|
13
|
-
argument checks. It can also resolve commands from a registry and report whether
|
|
14
|
-
each option was provided explicitly by the user or filled from a default.
|
|
10
|
+
[API](#api) | [Option Schemas](#option-schemas) | [Type Inference](#type-inference)
|
|
15
11
|
|
|
16
12
|
### How it works?
|
|
17
13
|
|
|
18
14
|

|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
response mapping, and output formatting should stay in the application that uses
|
|
22
|
-
`icore`.
|
|
16
|
+
Use `icore` when you need more than raw argument parsing:
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
- typed command definitions;
|
|
19
|
+
- command registry resolution;
|
|
20
|
+
- required options;
|
|
21
|
+
- string choices;
|
|
22
|
+
- number parsing with integer, minimum, and maximum constraints;
|
|
23
|
+
- option presence metadata;
|
|
24
|
+
- typed command handler input.
|
|
25
|
+
|
|
26
|
+
Use [`node:util.parseArgs`](https://nodejs.org/api/util.html#utilparseargsconfig)
|
|
27
|
+
directly when you only need low-level argument parsing.
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
- [Requirements](#requirements)
|
|
28
|
-
- [Basic Usage](#basic-usage)
|
|
29
|
-
- [Design Goals](#design-goals)
|
|
30
|
-
- [What icore Handles](#what-icore-handles)
|
|
31
|
-
- [What icore Does Not Handle](#what-icore-does-not-handle)
|
|
32
|
-
- [Option Schemas](#option-schemas)
|
|
33
|
-
- [API](#api)
|
|
29
|
+
### Installation
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
To use `icores` in your project, run:
|
|
36
32
|
|
|
37
33
|
```sh
|
|
38
34
|
npm install icore
|
|
39
35
|
```
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
### Table of Contents
|
|
38
|
+
|
|
39
|
+
- [`parseArgv(args, schema?)`](#parseargvargs-schema)
|
|
40
|
+
- [`parseOptions(schema, values)`](#parseoptionsschema-values)
|
|
41
|
+
- [`parseOptionsDetailed(schema, values)`](#parseoptionsdetailedschema-values)
|
|
42
|
+
- [`defineCommand(command)`](#definecommandcommand)
|
|
43
|
+
- [`defineCommandRegistry(commands)`](#definecommandregistrycommands)
|
|
44
|
+
- [`isCommandName(registry, value)`](#iscommandnameregistry-value)
|
|
45
|
+
- [`resolveCommand(registry, positionals)`](#resolvecommandregistry-positionals)
|
|
46
|
+
- [`resolveCommandFromArgs(registry, args)`](#resolvecommandfromargsregistry-args)
|
|
47
|
+
- [`runCommandFromRegistry(registry, args, context)`](#runcommandfromregistryregistry-args-context)
|
|
48
|
+
- [`mergeOptionsSchema(...schemas)`](#mergeoptionsschemaschemas)
|
|
49
|
+
- [`runCommand(command, args, context)`](#runcommandcommand-args-context)
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
### Design Goals
|
|
52
|
+
|
|
53
|
+
- describe CLI mechanics declaratively;
|
|
54
|
+
- use literal option types: `type: 'string' | 'boolean' | 'number'`;
|
|
55
|
+
- keep handlers free from repetitive option parsing;
|
|
56
|
+
- keep domain and API semantics outside the framework;
|
|
57
|
+
- provide predictable user-facing errors;
|
|
58
|
+
- avoid runtime dependencies.
|
|
45
59
|
|
|
46
|
-
|
|
60
|
+
#### Basic Usage
|
|
47
61
|
|
|
48
62
|
```ts
|
|
49
63
|
import { defineCommand, runCommand } from 'icore';
|
|
50
64
|
|
|
51
|
-
const
|
|
52
|
-
path: ['
|
|
65
|
+
const helloCommand = defineCommand({
|
|
66
|
+
path: ['hello'],
|
|
53
67
|
options: {
|
|
54
|
-
|
|
68
|
+
name: {
|
|
55
69
|
type: 'string',
|
|
56
|
-
|
|
57
|
-
default: 'table'
|
|
70
|
+
default: 'world'
|
|
58
71
|
},
|
|
59
|
-
|
|
72
|
+
upper: {
|
|
60
73
|
type: 'boolean'
|
|
61
74
|
}
|
|
62
75
|
},
|
|
63
|
-
async handle({ options
|
|
64
|
-
const
|
|
76
|
+
async handle({ options }) {
|
|
77
|
+
const message = `Hello, ${options.name}!`;
|
|
65
78
|
|
|
66
|
-
return
|
|
79
|
+
return options.upper ? message.toUpperCase() : message;
|
|
67
80
|
}
|
|
68
81
|
});
|
|
69
82
|
|
|
70
83
|
const output = await runCommand(
|
|
71
|
-
|
|
72
|
-
['
|
|
73
|
-
{
|
|
74
|
-
sdk,
|
|
75
|
-
formatAccounts
|
|
76
|
-
}
|
|
84
|
+
helloCommand,
|
|
85
|
+
['hello', '--name', 'Stanislav', '--upper'],
|
|
86
|
+
{}
|
|
77
87
|
);
|
|
88
|
+
|
|
89
|
+
console.log(output);
|
|
78
90
|
```
|
|
79
91
|
|
|
80
92
|
The command handler receives parsed options, user-provided option metadata,
|
|
81
93
|
remaining positionals, and caller provided context.
|
|
82
94
|
|
|
83
|
-
|
|
95
|
+
CommonJS is supported:
|
|
84
96
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
## What icore Handles
|
|
93
|
-
|
|
94
|
-
`icore` handles generic CLI mechanics:
|
|
95
|
-
|
|
96
|
-
- parsing long options;
|
|
97
|
-
- validating known options;
|
|
98
|
-
- rejecting duplicated options;
|
|
99
|
-
- checking required options;
|
|
100
|
-
- applying and validating defaults;
|
|
101
|
-
- validating string choices;
|
|
102
|
-
- validating boolean flag form;
|
|
103
|
-
- composing option schemas;
|
|
104
|
-
- defining command registries;
|
|
105
|
-
- resolving commands by path;
|
|
106
|
-
- preserving user-provided option metadata;
|
|
107
|
-
- parsing numbers;
|
|
108
|
-
- validating integer, minimum, and maximum numeric constraints;
|
|
109
|
-
- checking command path and extra positional arguments.
|
|
110
|
-
|
|
111
|
-
## What icore Does Not Handle
|
|
112
|
-
|
|
113
|
-
`icore` intentionally does not handle application-specific behavior:
|
|
114
|
-
|
|
115
|
-
- building API request DTOs;
|
|
116
|
-
- calling SDKs or network clients;
|
|
117
|
-
- managing database, HTTP, or gRPC lifecycle;
|
|
118
|
-
- checking business invariants such as `from <= to`;
|
|
119
|
-
- resolving mutually exclusive command modes;
|
|
120
|
-
- formatting output as JSON, tables, CSV, or other application formats.
|
|
121
|
-
|
|
122
|
-
Keep those decisions near the command handler or in your application layer.
|
|
97
|
+
```js
|
|
98
|
+
const {
|
|
99
|
+
defineCommand,
|
|
100
|
+
runCommand
|
|
101
|
+
} = require('icore');
|
|
102
|
+
```
|
|
123
103
|
|
|
124
104
|
## Option Schemas
|
|
125
105
|
|
|
@@ -188,7 +168,7 @@ const schema = {
|
|
|
188
168
|
Number options parse decimal numeric values and can validate integer and range
|
|
189
169
|
constraints. Defaults are validated with the same rules as user-provided values.
|
|
190
170
|
|
|
191
|
-
|
|
171
|
+
### API
|
|
192
172
|
|
|
193
173
|
### `parseArgv(args, schema?)`
|
|
194
174
|
|
|
@@ -501,7 +481,7 @@ const output = await runCommand(
|
|
|
501
481
|
By default, extra positionals are rejected. A command can opt in to extra
|
|
502
482
|
positionals with `allowExtraPositionals: true`.
|
|
503
483
|
|
|
504
|
-
|
|
484
|
+
### Type Inference
|
|
505
485
|
|
|
506
486
|
Use `InferOptions` when you need the parsed option type explicitly.
|
|
507
487
|
|
|
@@ -567,9 +547,26 @@ type Name = CommandName<typeof usersGetAccountsCommand>;
|
|
|
567
547
|
type Name = 'users get-accounts';
|
|
568
548
|
```
|
|
569
549
|
|
|
570
|
-
|
|
550
|
+
### Facade of arguments
|
|
551
|
+
|
|
552
|
+
The table below provides examples of how to specify the syntax.
|
|
571
553
|
|
|
572
|
-
|
|
554
|
+
| Syntax | Supported | Notes |
|
|
555
|
+
|---|---:|---|
|
|
556
|
+
| `--name value` | yes | string and number options |
|
|
557
|
+
| `--name=value` | yes | string and number options |
|
|
558
|
+
| `--flag` | yes | boolean options |
|
|
559
|
+
| `--flag=true` | no | boolean options are flag-only |
|
|
560
|
+
| `-f` | no | short aliases are not supported |
|
|
561
|
+
| `--no-cache` | no | negative boolean flags are not supported |
|
|
562
|
+
| repeated options | no | duplicates are rejected |
|
|
563
|
+
| multiple values | no | arrays are not supported |
|
|
564
|
+
|
|
565
|
+
### Error Messages
|
|
566
|
+
|
|
567
|
+
`icore` throws regular `Error` objects with predictable user-facing messages.
|
|
568
|
+
Applications should treat these messages as display text, not as a
|
|
569
|
+
machine-readable API.
|
|
573
570
|
|
|
574
571
|
Examples:
|
|
575
572
|
|
|
@@ -586,7 +583,7 @@ Expected '--depth' to be greater than or equal to 1
|
|
|
586
583
|
|
|
587
584
|
Applications can catch these errors and decide how to print them.
|
|
588
585
|
|
|
589
|
-
|
|
586
|
+
### Project Boundary
|
|
590
587
|
|
|
591
588
|
`icore` is intended to be a small CLI mechanics module. It should not grow into a
|
|
592
589
|
domain-specific framework for a particular SDK or API.
|
|
@@ -597,11 +594,3 @@ Good responsibilities for `icore`:
|
|
|
597
594
|
- command path checking;
|
|
598
595
|
- common argument errors;
|
|
599
596
|
- typed command handler input.
|
|
600
|
-
|
|
601
|
-
Responsibilities that should stay outside `icore`:
|
|
602
|
-
|
|
603
|
-
- business validation;
|
|
604
|
-
- SDK lifecycle management;
|
|
605
|
-
- provider-specific request modes;
|
|
606
|
-
- generated contract mapping;
|
|
607
|
-
- presentation formatting.
|