icore 1.0.14 → 1.0.15
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/cli.d.ts +1 -1
- package/dist/cli.js +2 -1
- package/dist/commands.d.ts +6 -0
- package/dist/commands.js +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/package.json +2 -1
- package/readme.md +12 -0
- package/CHANGELOG.md +0 -203
package/dist/cli.d.ts
CHANGED
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
* This file must not contain parser, validator, or command runtime logic.
|
|
10
10
|
*/
|
|
11
11
|
export { parseArgv, type ParsedArgv } from './argv';
|
|
12
|
-
export { defineCommand, defineCommandRegistry, isCommandName, prepareCommandFromArgs, resolveCommand, resolveCommandFromArgs, runCommand, runPreparedCommand, runCommandFromRegistry, type CommandDefinition, type CommandContext, type CommandInput, type CommandName, type CommandPayload, type CommandRegistry, type CommandResolutionOptions, type CommandResult, type PreparedCommand, type PreparedCommandInput, type ResolvedCommand } from './commands';
|
|
12
|
+
export { defineCommand, defineCommandRegistry, isCommandName, isPreparedCommandName, prepareCommandFromArgs, resolveCommand, resolveCommandFromArgs, runCommand, runPreparedCommand, runCommandFromRegistry, type CommandDefinition, type CommandContext, type CommandInput, type CommandName, type CommandPayload, type CommandRegistry, type CommandResolutionOptions, type CommandResult, type PreparedCommand, type PreparedCommandInput, type ResolvedCommand } from './commands';
|
|
13
13
|
export { IcoreError, type IcoreErrorCode, type IcoreErrorDetails } from './errors';
|
|
14
14
|
export { mergeOptionsSchema, parseOptions, parseOptionsDetailed, type BooleanOption, type InferOptions, type InferProvidedOptions, type MergeOptionsSchemas, type NumberOption, type OptionDefinition, type OptionsSchema, type ParseOptionsResult, type RawOptionValue, type StringOption } from './options';
|
package/dist/cli.js
CHANGED
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
* This file must not contain parser, validator, or command runtime logic.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.parseOptionsDetailed = exports.parseOptions = exports.mergeOptionsSchema = exports.IcoreError = exports.runCommandFromRegistry = exports.runPreparedCommand = exports.runCommand = exports.resolveCommandFromArgs = exports.resolveCommand = exports.prepareCommandFromArgs = exports.isCommandName = exports.defineCommandRegistry = exports.defineCommand = exports.parseArgv = void 0;
|
|
13
|
+
exports.parseOptionsDetailed = exports.parseOptions = exports.mergeOptionsSchema = exports.IcoreError = exports.runCommandFromRegistry = exports.runPreparedCommand = exports.runCommand = exports.resolveCommandFromArgs = exports.resolveCommand = exports.prepareCommandFromArgs = exports.isPreparedCommandName = exports.isCommandName = exports.defineCommandRegistry = exports.defineCommand = exports.parseArgv = void 0;
|
|
14
14
|
var argv_1 = require("./argv");
|
|
15
15
|
Object.defineProperty(exports, "parseArgv", { enumerable: true, get: function () { return argv_1.parseArgv; } });
|
|
16
16
|
var commands_1 = require("./commands");
|
|
17
17
|
Object.defineProperty(exports, "defineCommand", { enumerable: true, get: function () { return commands_1.defineCommand; } });
|
|
18
18
|
Object.defineProperty(exports, "defineCommandRegistry", { enumerable: true, get: function () { return commands_1.defineCommandRegistry; } });
|
|
19
19
|
Object.defineProperty(exports, "isCommandName", { enumerable: true, get: function () { return commands_1.isCommandName; } });
|
|
20
|
+
Object.defineProperty(exports, "isPreparedCommandName", { enumerable: true, get: function () { return commands_1.isPreparedCommandName; } });
|
|
20
21
|
Object.defineProperty(exports, "prepareCommandFromArgs", { enumerable: true, get: function () { return commands_1.prepareCommandFromArgs; } });
|
|
21
22
|
Object.defineProperty(exports, "resolveCommand", { enumerable: true, get: function () { return commands_1.resolveCommand; } });
|
|
22
23
|
Object.defineProperty(exports, "resolveCommandFromArgs", { enumerable: true, get: function () { return commands_1.resolveCommandFromArgs; } });
|
package/dist/commands.d.ts
CHANGED
|
@@ -137,6 +137,12 @@ export declare function defineCommandRegistry<const TCommands extends readonly A
|
|
|
137
137
|
* Checks whether a value is a command name registered in the given registry.
|
|
138
138
|
*/
|
|
139
139
|
export declare function isCommandName<const TCommands extends readonly AnyCommandDefinition[]>(registry: CommandRegistry<TCommands>, value: unknown): value is CommandName<TCommands[number]>;
|
|
140
|
+
/**
|
|
141
|
+
* Checks whether a prepared command has the given command name.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isPreparedCommandName<TPrepared extends PreparedCommand<AnyCommandDefinition>, TName extends TPrepared['name']>(prepared: TPrepared, name: TName): prepared is Extract<TPrepared, {
|
|
144
|
+
name: TName;
|
|
145
|
+
}>;
|
|
140
146
|
/**
|
|
141
147
|
* Resolves a command from already parsed positional arguments.
|
|
142
148
|
*/
|
package/dist/commands.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.defineCommand = defineCommand;
|
|
16
16
|
exports.defineCommandRegistry = defineCommandRegistry;
|
|
17
17
|
exports.isCommandName = isCommandName;
|
|
18
|
+
exports.isPreparedCommandName = isPreparedCommandName;
|
|
18
19
|
exports.resolveCommand = resolveCommand;
|
|
19
20
|
exports.resolveCommandFromArgs = resolveCommandFromArgs;
|
|
20
21
|
exports.prepareCommandFromArgs = prepareCommandFromArgs;
|
|
@@ -48,6 +49,12 @@ function isCommandName(registry, value) {
|
|
|
48
49
|
return typeof value === 'string'
|
|
49
50
|
&& registry.commandNames.includes(value);
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks whether a prepared command has the given command name.
|
|
54
|
+
*/
|
|
55
|
+
function isPreparedCommandName(prepared, name) {
|
|
56
|
+
return prepared.name === name;
|
|
57
|
+
}
|
|
51
58
|
/**
|
|
52
59
|
* Resolves a command from already parsed positional arguments.
|
|
53
60
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { defineCommand, defineCommandRegistry, IcoreError, isCommandName, mergeOptionsSchema, parseArgv, parseOptions, parseOptionsDetailed, prepareCommandFromArgs, resolveCommand, resolveCommandFromArgs, runCommand, runPreparedCommand, runCommandFromRegistry, type BooleanOption, type CommandDefinition, type CommandContext, type CommandInput, type CommandName, type CommandPayload, type CommandRegistry, type CommandResolutionOptions, type CommandResult, type InferOptions, type InferProvidedOptions, type IcoreErrorCode, type IcoreErrorDetails, type MergeOptionsSchemas, type NumberOption, type OptionDefinition, type OptionsSchema, type ParseOptionsResult, type ParsedArgv, type PreparedCommand, type PreparedCommandInput, type RawOptionValue, type ResolvedCommand, type StringOption } from './cli';
|
|
1
|
+
export { defineCommand, defineCommandRegistry, IcoreError, isCommandName, isPreparedCommandName, mergeOptionsSchema, parseArgv, parseOptions, parseOptionsDetailed, prepareCommandFromArgs, resolveCommand, resolveCommandFromArgs, runCommand, runPreparedCommand, runCommandFromRegistry, type BooleanOption, type CommandDefinition, type CommandContext, type CommandInput, type CommandName, type CommandPayload, type CommandRegistry, type CommandResolutionOptions, type CommandResult, type InferOptions, type InferProvidedOptions, type IcoreErrorCode, type IcoreErrorDetails, type MergeOptionsSchemas, type NumberOption, type OptionDefinition, type OptionsSchema, type ParseOptionsResult, type ParsedArgv, type PreparedCommand, type PreparedCommandInput, type RawOptionValue, type ResolvedCommand, type StringOption } from './cli';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runCommandFromRegistry = exports.runPreparedCommand = exports.runCommand = exports.resolveCommandFromArgs = exports.resolveCommand = exports.prepareCommandFromArgs = exports.parseOptionsDetailed = exports.parseOptions = exports.parseArgv = exports.mergeOptionsSchema = exports.isCommandName = exports.IcoreError = exports.defineCommandRegistry = exports.defineCommand = void 0;
|
|
3
|
+
exports.runCommandFromRegistry = exports.runPreparedCommand = exports.runCommand = exports.resolveCommandFromArgs = exports.resolveCommand = exports.prepareCommandFromArgs = exports.parseOptionsDetailed = exports.parseOptions = exports.parseArgv = exports.mergeOptionsSchema = exports.isPreparedCommandName = exports.isCommandName = exports.IcoreError = exports.defineCommandRegistry = exports.defineCommand = void 0;
|
|
4
4
|
var cli_1 = require("./cli");
|
|
5
5
|
Object.defineProperty(exports, "defineCommand", { enumerable: true, get: function () { return cli_1.defineCommand; } });
|
|
6
6
|
Object.defineProperty(exports, "defineCommandRegistry", { enumerable: true, get: function () { return cli_1.defineCommandRegistry; } });
|
|
7
7
|
Object.defineProperty(exports, "IcoreError", { enumerable: true, get: function () { return cli_1.IcoreError; } });
|
|
8
8
|
Object.defineProperty(exports, "isCommandName", { enumerable: true, get: function () { return cli_1.isCommandName; } });
|
|
9
|
+
Object.defineProperty(exports, "isPreparedCommandName", { enumerable: true, get: function () { return cli_1.isPreparedCommandName; } });
|
|
9
10
|
Object.defineProperty(exports, "mergeOptionsSchema", { enumerable: true, get: function () { return cli_1.mergeOptionsSchema; } });
|
|
10
11
|
Object.defineProperty(exports, "parseArgv", { enumerable: true, get: function () { return cli_1.parseArgv; } });
|
|
11
12
|
Object.defineProperty(exports, "parseOptions", { enumerable: true, get: function () { return cli_1.parseOptions; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icore",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Declarative command line interface mechanics for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"command-line",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
|
+
"prepare": "tsc",
|
|
31
32
|
"test": "node --test dist/*.test.js",
|
|
32
33
|
"lint": "eslint src"
|
|
33
34
|
},
|
package/readme.md
CHANGED
|
@@ -32,6 +32,7 @@ npm install icore
|
|
|
32
32
|
- [`defineCommand(command)`](#definecommandcommand)
|
|
33
33
|
- [`defineCommandRegistry(commands)`](#definecommandregistrycommands)
|
|
34
34
|
- [`isCommandName(registry, value)`](#iscommandnameregistry-value)
|
|
35
|
+
- [`isPreparedCommandName(prepared, name)`](#ispreparedcommandnameprepared-name)
|
|
35
36
|
- [`resolveCommand(registry, positionals)`](#resolvecommandregistry-positionals)
|
|
36
37
|
- [`resolveCommandFromArgs(registry, args)`](#resolvecommandfromargsregistry-args)
|
|
37
38
|
- [`prepareCommandFromArgs(registry, args, options?)`](#preparecommandfromargsregistry-args-options)
|
|
@@ -236,6 +237,17 @@ if (isCommandName(registry, value)) {
|
|
|
236
237
|
}
|
|
237
238
|
```
|
|
238
239
|
|
|
240
|
+
### `isPreparedCommandName(prepared, name)`
|
|
241
|
+
|
|
242
|
+
Checks whether a prepared command has the given command name and narrows the
|
|
243
|
+
prepared command union.
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
if (isPreparedCommandName(prepared, 'hello')) {
|
|
247
|
+
// prepared.payload is narrowed to the `hello` command payload.
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
239
251
|
### `resolveCommand(registry, positionals)`
|
|
240
252
|
|
|
241
253
|
Resolves a command from already parsed positional arguments.
|
package/CHANGELOG.md
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
Historical entries before this file was introduced were reconstructed from npm
|
|
9
|
-
publish metadata and local git history. Older entries are intentionally
|
|
10
|
-
conservative.
|
|
11
|
-
|
|
12
|
-
## [Unreleased]
|
|
13
|
-
|
|
14
|
-
### Added
|
|
15
|
-
|
|
16
|
-
- Added machine-readable `IcoreError` codes and details.
|
|
17
|
-
- Added opt-in `strict: true` command resolution for rejecting options before command paths.
|
|
18
|
-
- Added `strict: true` support to direct `runCommand` execution.
|
|
19
|
-
- Added typed prepared command `payload` returned from `prepare` and passed to `handle`.
|
|
20
|
-
- Added public `CommandPayload`, `CommandContext`, and `CommandResult` helper types.
|
|
21
|
-
- Added this changelog.
|
|
22
|
-
|
|
23
|
-
### Changed
|
|
24
|
-
|
|
25
|
-
- Changed `PreparedCommand` typing to preserve payload correlation when narrowing registry unions by command name.
|
|
26
|
-
|
|
27
|
-
### Removed
|
|
28
|
-
|
|
29
|
-
- Removed explicit boolean values such as `--flag=true` and `--flag=false`; use `--flag` and `--no-flag`.
|
|
30
|
-
|
|
31
|
-
## [1.0.12] - 2026-07-02
|
|
32
|
-
|
|
33
|
-
### Changed
|
|
34
|
-
|
|
35
|
-
- Replaced the preliminary flag-only boolean option naming with `syntax: 'flag'`.
|
|
36
|
-
- Documented flag-only boolean option behavior.
|
|
37
|
-
|
|
38
|
-
## [1.0.11] - 2026-07-02
|
|
39
|
-
|
|
40
|
-
### Added
|
|
41
|
-
|
|
42
|
-
- Added preliminary flag-only boolean option support.
|
|
43
|
-
|
|
44
|
-
## [1.0.10] - 2026-07-02
|
|
45
|
-
|
|
46
|
-
### Added
|
|
47
|
-
|
|
48
|
-
- Added two-phase command execution.
|
|
49
|
-
- Added `PreparedCommandInput`.
|
|
50
|
-
- Added `PreparedCommand`.
|
|
51
|
-
- Added `prepareCommandFromArgs`.
|
|
52
|
-
- Added `runPreparedCommand`.
|
|
53
|
-
- Added command `metadata`.
|
|
54
|
-
- Added command `prepare` hook.
|
|
55
|
-
- Added focused tests for prepare-time validation and handler safety.
|
|
56
|
-
|
|
57
|
-
### Changed
|
|
58
|
-
|
|
59
|
-
- Changed `runCommand` and `runCommandFromRegistry` to use the prepare-and-run flow internally.
|
|
60
|
-
|
|
61
|
-
## [1.0.9] - 2026-07-02
|
|
62
|
-
|
|
63
|
-
### Changed
|
|
64
|
-
|
|
65
|
-
- Refined npm package metadata.
|
|
66
|
-
- Updated repository metadata for npm.
|
|
67
|
-
- Simplified published package contents.
|
|
68
|
-
|
|
69
|
-
## [1.0.8] - 2026-07-02
|
|
70
|
-
|
|
71
|
-
### Changed
|
|
72
|
-
|
|
73
|
-
- Updated package author metadata.
|
|
74
|
-
- Normalized README heading structure.
|
|
75
|
-
|
|
76
|
-
## [1.0.7] - 2026-07-02
|
|
77
|
-
|
|
78
|
-
### Changed
|
|
79
|
-
|
|
80
|
-
- Renamed README examples from `upper` to `uppercase`.
|
|
81
|
-
- Cleaned duplicated command test coverage without changing public behavior.
|
|
82
|
-
|
|
83
|
-
## [1.0.6] - 2026-07-02
|
|
84
|
-
|
|
85
|
-
### Added
|
|
86
|
-
|
|
87
|
-
- Added explicit long boolean values such as `--flag=true` and `--flag=false`.
|
|
88
|
-
- Added schema-known boolean negation such as `--no-flag`.
|
|
89
|
-
- Added short option aliases such as `-f` and `-n value`.
|
|
90
|
-
- Added alias validation and duplicate detection between short and long option forms.
|
|
91
|
-
- Documented supported option syntax.
|
|
92
|
-
|
|
93
|
-
## [1.0.5] - 2026-07-01
|
|
94
|
-
|
|
95
|
-
### Changed
|
|
96
|
-
|
|
97
|
-
- Rebuilt README as the main public documentation entry point.
|
|
98
|
-
|
|
99
|
-
### Removed
|
|
100
|
-
|
|
101
|
-
- Removed separate generated reference docs from the published documentation flow.
|
|
102
|
-
|
|
103
|
-
## [1.0.4] - 2026-07-01
|
|
104
|
-
|
|
105
|
-
### Changed
|
|
106
|
-
|
|
107
|
-
- Reorganized README and documentation references.
|
|
108
|
-
|
|
109
|
-
## [1.0.3] - 2026-07-01
|
|
110
|
-
|
|
111
|
-
### Added
|
|
112
|
-
|
|
113
|
-
- Added README table of contents.
|
|
114
|
-
|
|
115
|
-
### Changed
|
|
116
|
-
|
|
117
|
-
- Polished README formatting and emphasis.
|
|
118
|
-
|
|
119
|
-
## [1.0.2] - 2026-06-30
|
|
120
|
-
|
|
121
|
-
### Added
|
|
122
|
-
|
|
123
|
-
- Added module boundary comments to production source files.
|
|
124
|
-
|
|
125
|
-
### Changed
|
|
126
|
-
|
|
127
|
-
- Clarified CLI scope and supported syntax in README.
|
|
128
|
-
- Updated package description and keywords.
|
|
129
|
-
|
|
130
|
-
## [1.0.1] - 2026-06-30
|
|
131
|
-
|
|
132
|
-
### Changed
|
|
133
|
-
|
|
134
|
-
- Published documentation updates after the first stable release.
|
|
135
|
-
- No dedicated version commit is present in local git history for this patch.
|
|
136
|
-
|
|
137
|
-
## [1.0.0] - 2026-06-30
|
|
138
|
-
|
|
139
|
-
### Added
|
|
140
|
-
|
|
141
|
-
- First stable release of the new `icore` CLI mechanics package.
|
|
142
|
-
- Added declarative option parsing and validation.
|
|
143
|
-
- Added schema-aware argv parsing.
|
|
144
|
-
- Added option presence metadata through `parseOptionsDetailed`.
|
|
145
|
-
- Added option schema composition through `mergeOptionsSchema`.
|
|
146
|
-
- Added command registry routing.
|
|
147
|
-
- Added typed command handler input.
|
|
148
|
-
- Added CommonJS package entry points and TypeScript declarations.
|
|
149
|
-
|
|
150
|
-
### Changed
|
|
151
|
-
|
|
152
|
-
- Lowered the runtime Node.js engine to `>=16.9.0`.
|
|
153
|
-
|
|
154
|
-
## [1.0.0-alpha] - 2026-06-28
|
|
155
|
-
|
|
156
|
-
### Added
|
|
157
|
-
|
|
158
|
-
- Started the new CLI mechanics codebase after pruning the legacy package code.
|
|
159
|
-
- Added the initial TypeScript build, test, and lint setup for the new package.
|
|
160
|
-
|
|
161
|
-
## [0.1.38] - 2019-06-12
|
|
162
|
-
|
|
163
|
-
### Added
|
|
164
|
-
|
|
165
|
-
- Added legacy tests and documentation.
|
|
166
|
-
|
|
167
|
-
### Changed
|
|
168
|
-
|
|
169
|
-
- Final legacy web-framework line release.
|
|
170
|
-
- Updated the legacy package description.
|
|
171
|
-
|
|
172
|
-
### Removed
|
|
173
|
-
|
|
174
|
-
- Trimmed legacy runtime dependencies.
|
|
175
|
-
|
|
176
|
-
## [0.0.37 and earlier]
|
|
177
|
-
|
|
178
|
-
### Added
|
|
179
|
-
|
|
180
|
-
- Original legacy npm package line published between 2017 and 2019.
|
|
181
|
-
- Legacy history is preserved for package provenance.
|
|
182
|
-
|
|
183
|
-
### Changed
|
|
184
|
-
|
|
185
|
-
- Detailed changelog entries were not maintained for these releases.
|
|
186
|
-
|
|
187
|
-
[Unreleased]: https://github.com/woodger/icore/commits/develop
|
|
188
|
-
[1.0.12]: https://www.npmjs.com/package/icore/v/1.0.12
|
|
189
|
-
[1.0.11]: https://www.npmjs.com/package/icore/v/1.0.11
|
|
190
|
-
[1.0.10]: https://www.npmjs.com/package/icore/v/1.0.10
|
|
191
|
-
[1.0.9]: https://www.npmjs.com/package/icore/v/1.0.9
|
|
192
|
-
[1.0.8]: https://www.npmjs.com/package/icore/v/1.0.8
|
|
193
|
-
[1.0.7]: https://www.npmjs.com/package/icore/v/1.0.7
|
|
194
|
-
[1.0.6]: https://www.npmjs.com/package/icore/v/1.0.6
|
|
195
|
-
[1.0.5]: https://www.npmjs.com/package/icore/v/1.0.5
|
|
196
|
-
[1.0.4]: https://www.npmjs.com/package/icore/v/1.0.4
|
|
197
|
-
[1.0.3]: https://www.npmjs.com/package/icore/v/1.0.3
|
|
198
|
-
[1.0.2]: https://www.npmjs.com/package/icore/v/1.0.2
|
|
199
|
-
[1.0.1]: https://www.npmjs.com/package/icore/v/1.0.1
|
|
200
|
-
[1.0.0]: https://www.npmjs.com/package/icore/v/1.0.0
|
|
201
|
-
[1.0.0-alpha]: https://www.npmjs.com/package/icore/v/1.0.0-alpha
|
|
202
|
-
[0.1.38]: https://www.npmjs.com/package/icore/v/0.1.38
|
|
203
|
-
[0.0.37 and earlier]: https://www.npmjs.com/package/icore?activeTab=versions
|