@lionden/cli 0.1.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.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/config-discovery.d.ts +15 -0
- package/dist/config-discovery.d.ts.map +1 -0
- package/dist/config-discovery.js +59 -0
- package/dist/config-discovery.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/output/logger.d.ts +13 -0
- package/dist/output/logger.d.ts.map +1 -0
- package/dist/output/logger.js +42 -0
- package/dist/output/logger.js.map +1 -0
- package/dist/task-dispatch.d.ts +44 -0
- package/dist/task-dispatch.d.ts.map +1 -0
- package/dist/task-dispatch.js +347 -0
- package/dist/task-dispatch.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @lionden/cli
|
|
2
|
+
|
|
3
|
+
The `lionden` command-line interface: configuration discovery, argument parsing, and task dispatch for LionDen projects.
|
|
4
|
+
|
|
5
|
+
Part of [LionDen](https://github.com/sealance-io/lionden), a Hardhat-inspired development framework for Aleo and Leo.
|
|
6
|
+
|
|
7
|
+
> **Pre-v1 notice:** LionDen is in active early development. All APIs are unstable and may change
|
|
8
|
+
> without notice between 0.x releases.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install --save-dev @lionden/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Documentation
|
|
17
|
+
|
|
18
|
+
Documentation, examples, and the issue tracker live in the
|
|
19
|
+
[LionDen repository](https://github.com/sealance-io/lionden).
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
[Apache-2.0](./LICENSE)
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the nearest lionden config file by walking up from the given directory.
|
|
3
|
+
* Returns the absolute path to the config file, or null if not found.
|
|
4
|
+
*/
|
|
5
|
+
export declare function findConfigFile(startDir: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Load and return the user config from a config file.
|
|
8
|
+
* Uses dynamic import() which handles both .ts (via tsx loader) and .js/.mjs.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadConfigFile(configPath: string): Promise<{
|
|
11
|
+
config: unknown;
|
|
12
|
+
projectRoot: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function configPathToImportSpecifier(configPath: string): string;
|
|
15
|
+
//# sourceMappingURL=config-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-discovery.d.ts","sourceRoot":"","sources":["../src/config-discovery.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB9D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCnD;AAGD,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
const CONFIG_FILENAMES = ["lionden.config.ts", "lionden.config.js", "lionden.config.mjs"];
|
|
5
|
+
/**
|
|
6
|
+
* Find the nearest lionden config file by walking up from the given directory.
|
|
7
|
+
* Returns the absolute path to the config file, or null if not found.
|
|
8
|
+
*/
|
|
9
|
+
export function findConfigFile(startDir) {
|
|
10
|
+
let dir = path.resolve(startDir);
|
|
11
|
+
// eslint-disable-next-line no-constant-condition
|
|
12
|
+
while (true) {
|
|
13
|
+
for (const filename of CONFIG_FILENAMES) {
|
|
14
|
+
const candidate = path.join(dir, filename);
|
|
15
|
+
if (fs.existsSync(candidate)) {
|
|
16
|
+
return candidate;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const parent = path.dirname(dir);
|
|
20
|
+
if (parent === dir) {
|
|
21
|
+
// Reached filesystem root
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
dir = parent;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load and return the user config from a config file.
|
|
29
|
+
* Uses dynamic import() which handles both .ts (via tsx loader) and .js/.mjs.
|
|
30
|
+
*/
|
|
31
|
+
export async function loadConfigFile(configPath) {
|
|
32
|
+
const absolutePath = path.resolve(configPath);
|
|
33
|
+
const projectRoot = path.dirname(absolutePath);
|
|
34
|
+
// Dynamic import — tsx handles .ts transpilation
|
|
35
|
+
const module = (await import(configPathToImportSpecifier(absolutePath)));
|
|
36
|
+
let config = module.default;
|
|
37
|
+
// A config file that loads cleanly but has no default export yields
|
|
38
|
+
// `module.default === undefined`. Fail here, naming the offending file,
|
|
39
|
+
// instead of letting `undefined` leak downstream and surface as a cryptic
|
|
40
|
+
// `Cannot read properties of undefined (reading 'plugins')` TypeError.
|
|
41
|
+
if (config === undefined) {
|
|
42
|
+
throw new Error(`Config file ${absolutePath} has no default export. ` +
|
|
43
|
+
"Add `export default defineConfig({ ... })` (or a config object/factory).");
|
|
44
|
+
}
|
|
45
|
+
// Support factory functions
|
|
46
|
+
if (typeof config === "function") {
|
|
47
|
+
config = await config();
|
|
48
|
+
if (config === undefined) {
|
|
49
|
+
throw new Error(`Config file ${absolutePath} default export returned undefined. ` +
|
|
50
|
+
"Return `defineConfig({ ... })` (or a config object).");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return { config, projectRoot };
|
|
54
|
+
}
|
|
55
|
+
// Internal helper exported for testing
|
|
56
|
+
export function configPathToImportSpecifier(configPath) {
|
|
57
|
+
return pathToFileURL(path.resolve(configPath)).href;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=config-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-discovery.js","sourceRoot":"","sources":["../src/config-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,E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AA0B;YACnD,0EAA0E,CAC7E,CAAC;IACJ,CAAC;IAED,4BAA4B;IAC5B,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;QACxB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,sCAAsC;gBAC/D,sDAAsD,CACzD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA6H1C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { collectGlobalOptions, createLre, resolveConfig, resolvePluginOrder, } from "@lionden/core";
|
|
3
|
+
import { findConfigFile, loadConfigFile } from "./config-discovery.js";
|
|
4
|
+
import { logger } from "./output/logger.js";
|
|
5
|
+
import { dispatchTask, parseArgs, printHelp, validateParsedArgs, validateTaskGlobalOptionCollisions, } from "./task-dispatch.js";
|
|
6
|
+
const VERSION = "0.1.0";
|
|
7
|
+
export async function main() {
|
|
8
|
+
// Initial parse for early exits (--version, --help without config)
|
|
9
|
+
let parsed = parseArgs(process.argv.slice(2));
|
|
10
|
+
if (parsed.globalArgs.version) {
|
|
11
|
+
console.log(`lionden v${VERSION}`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (parsed.globalArgs.verbose) {
|
|
15
|
+
logger.setLevel("debug");
|
|
16
|
+
}
|
|
17
|
+
// Find and load config
|
|
18
|
+
const configPath = parsed.globalArgs.config ?? findConfigFile(process.cwd());
|
|
19
|
+
if (!configPath) {
|
|
20
|
+
if (parsed.globalArgs.help) {
|
|
21
|
+
printHelp();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
logger.error("No lionden.config.ts found. Run 'create-lionden' to create a project, " +
|
|
25
|
+
"or use --config to specify a config file.");
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const absoluteConfigPath = path.resolve(configPath);
|
|
29
|
+
logger.debug(`Loading config from ${absoluteConfigPath}`);
|
|
30
|
+
const { config: rawConfig, projectRoot } = await loadConfigFile(absoluteConfigPath);
|
|
31
|
+
const userConfig = rawConfig;
|
|
32
|
+
// Resolve plugins
|
|
33
|
+
const userPlugins = (userConfig.plugins ?? []);
|
|
34
|
+
const plugins = resolvePluginOrder(userPlugins);
|
|
35
|
+
logger.debug(`Loaded ${plugins.length} plugins: ${plugins.map((p) => p.id).join(", ") || "(none)"}`);
|
|
36
|
+
// Collect plugin global options and re-parse with them
|
|
37
|
+
const globalOptionDefs = collectGlobalOptions(plugins);
|
|
38
|
+
parsed = parseArgs(process.argv.slice(2), globalOptionDefs);
|
|
39
|
+
// Resolve config through the full lifecycle
|
|
40
|
+
const { resolved: resolvedConfig, extendedUserConfig } = await resolveConfig(userConfig, plugins, projectRoot);
|
|
41
|
+
// Create LRE — use post-extend config for tasks (plugins may inject tasks via extendUserConfig).
|
|
42
|
+
// Both `config` and `globalOptions` start as written here and are populated
|
|
43
|
+
// AFTER the task-aware parse below; createLre stores them by reference, so the
|
|
44
|
+
// network override and seeded global options flow through to lre.config /
|
|
45
|
+
// lre.globalOptions without re-touching the LRE. (NetworkManagerImpl and
|
|
46
|
+
// DeploymentManagerImpl capture lre.config by reference and read
|
|
47
|
+
// defaultNetwork lazily, so mutating it here is observed at connect time.)
|
|
48
|
+
const configTasks = (extendedUserConfig.tasks ?? []);
|
|
49
|
+
const globalOptions = { configPath: absoluteConfigPath };
|
|
50
|
+
const config = { ...resolvedConfig };
|
|
51
|
+
const lre = createLre({ config, plugins, globalOptions, configTasks });
|
|
52
|
+
// Re-parse WITH task metadata so named args are routed by schema rather than
|
|
53
|
+
// by whether they appeared before or after the task name.
|
|
54
|
+
parsed = parseArgs(process.argv.slice(2), globalOptionDefs, (taskId) => lre.tasks.getTaskDefinition(taskId));
|
|
55
|
+
// Help should render before validating task/global option values. This keeps
|
|
56
|
+
// recovery/documentation available even when an invocation includes an invalid
|
|
57
|
+
// value such as `--network ghostnet --help`.
|
|
58
|
+
if (parsed.globalArgs.help) {
|
|
59
|
+
printHelp(lre, globalOptionDefs);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
validateParsedArgs(lre, parsed);
|
|
63
|
+
// Override default network from CLI. --network is global-only, and is resolved
|
|
64
|
+
// from the task-aware parse — so a value-less `--network` before a task name
|
|
65
|
+
// (e.g. `lionden --network deploy`) does not consume the task token as a bogus
|
|
66
|
+
// network value the way the earlier task-unaware parse would. Validate the name
|
|
67
|
+
// against config.networks here so an unknown --network fails once, centrally,
|
|
68
|
+
// with a clear message — instead of later and differently inside each task's
|
|
69
|
+
// connect path.
|
|
70
|
+
if (typeof parsed.globalArgs.network === "string") {
|
|
71
|
+
const requestedNetwork = parsed.globalArgs.network;
|
|
72
|
+
if (!config.networks[requestedNetwork]) {
|
|
73
|
+
const available = Object.keys(config.networks).join(", ") || "(none)";
|
|
74
|
+
throw new Error(`Network "${requestedNetwork}" (from --network) is not defined in config.networks. ` +
|
|
75
|
+
`Available networks: ${available}`);
|
|
76
|
+
}
|
|
77
|
+
config.defaultNetwork = requestedNetwork;
|
|
78
|
+
// Seed the explicit --network into globalOptions so the test task can bridge it
|
|
79
|
+
// to Vitest workers (LIONDEN_NETWORK). Other tasks keep reading config.defaultNetwork.
|
|
80
|
+
globalOptions["network"] = requestedNetwork;
|
|
81
|
+
}
|
|
82
|
+
// Seed the built-in --prove preference into globalOptions so deploy/upgrade/
|
|
83
|
+
// recipe/test resolve it via resolveProveOption()/lre.globalOptions. Unlike
|
|
84
|
+
// --network this does NOT mutate config; the `in` check preserves an explicit
|
|
85
|
+
// --prove=false (a falsy-but-present value) instead of treating it as unset.
|
|
86
|
+
if ("prove" in parsed.globalArgs) {
|
|
87
|
+
globalOptions["prove"] = parsed.globalArgs.prove;
|
|
88
|
+
}
|
|
89
|
+
// Seed global option values from the task-aware parse.
|
|
90
|
+
for (const [name, { definition }] of globalOptionDefs) {
|
|
91
|
+
if (name in parsed.globalArgs) {
|
|
92
|
+
globalOptions[name] = parsed.globalArgs[name];
|
|
93
|
+
}
|
|
94
|
+
else if (definition.defaultValue !== undefined) {
|
|
95
|
+
globalOptions[name] = definition.defaultValue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Reject tasks whose arguments shadow a built-in global option before we
|
|
99
|
+
// dispatch — otherwise the parser silently routes the colliding arg to the
|
|
100
|
+
// global and the task never receives it.
|
|
101
|
+
validateTaskGlobalOptionCollisions(lre);
|
|
102
|
+
// Dispatch task
|
|
103
|
+
await dispatchTask(lre, parsed);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,SAAS,EAET,aAAa,EACb,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kCAAkC,GACnC,MAAM,oBAAoB,CAAC;AAE5B,M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CAAC,CAAC;QAC7E,CAAC;aAAM,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACjD,aAAa,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC;QAChD,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,2EAA2E;IAC3E,yCAAyC;IACzC,kCAAkC,CAAC,GAAG,CAAC,CAAC;IAExC,gBAAgB;IAChB,MAAM,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
2
|
+
export declare class Logger {
|
|
3
|
+
private level;
|
|
4
|
+
constructor(level?: LogLevel);
|
|
5
|
+
setLevel(level: LogLevel): void;
|
|
6
|
+
debug(...args: unknown[]): void;
|
|
7
|
+
info(...args: unknown[]): void;
|
|
8
|
+
warn(...args: unknown[]): void;
|
|
9
|
+
error(...args: unknown[]): void;
|
|
10
|
+
success(...args: unknown[]): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const logger: Logger;
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/output/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAS3D,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAS;gBAEV,KAAK,GAAE,QAAiB;IAIpC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM9B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/B,OAAO,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKlC;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const LOG_LEVELS = {
|
|
2
|
+
debug: 0,
|
|
3
|
+
info: 1,
|
|
4
|
+
warn: 2,
|
|
5
|
+
error: 3,
|
|
6
|
+
};
|
|
7
|
+
export class Logger {
|
|
8
|
+
level;
|
|
9
|
+
constructor(level = "info") {
|
|
10
|
+
this.level = LOG_LEVELS[level];
|
|
11
|
+
}
|
|
12
|
+
setLevel(level) {
|
|
13
|
+
this.level = LOG_LEVELS[level];
|
|
14
|
+
}
|
|
15
|
+
debug(...args) {
|
|
16
|
+
if (this.level <= LOG_LEVELS.debug) {
|
|
17
|
+
console.debug("\x1b[90m[debug]\x1b[0m", ...args);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
info(...args) {
|
|
21
|
+
if (this.level <= LOG_LEVELS.info) {
|
|
22
|
+
console.log(...args);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
warn(...args) {
|
|
26
|
+
if (this.level <= LOG_LEVELS.warn) {
|
|
27
|
+
console.warn("\x1b[33m⚠\x1b[0m", ...args);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
error(...args) {
|
|
31
|
+
if (this.level <= LOG_LEVELS.error) {
|
|
32
|
+
console.error("\x1b[31m✗\x1b[0m", ...args);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
success(...args) {
|
|
36
|
+
if (this.level <= LOG_LEVELS.info) {
|
|
37
|
+
console.log("\x1b[32m✓\x1b[0m", ...args);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const logger = new Logger();
|
|
42
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,IAAI,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GlobalOptionDefinition, LionDenRuntimeEnvironment, TaskDefinition } from "@lionden/core";
|
|
2
|
+
export type TaskDefinitionLookup = (taskId: string) => TaskDefinition | undefined;
|
|
3
|
+
export interface ParsedArgs {
|
|
4
|
+
taskId: string | null;
|
|
5
|
+
taskArgs: Record<string, unknown>;
|
|
6
|
+
preTaskArgs: string[];
|
|
7
|
+
globalArgs: Record<string, unknown> & {
|
|
8
|
+
config?: string;
|
|
9
|
+
network?: string;
|
|
10
|
+
prove?: boolean;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
help?: boolean;
|
|
13
|
+
version?: boolean;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse CLI arguments into structured form.
|
|
18
|
+
* Format: lionden [options] <task> [options]
|
|
19
|
+
*
|
|
20
|
+
* The task id is discovered by position (first token that names a registered
|
|
21
|
+
* task), but named arguments are routed by public-name lookup against the
|
|
22
|
+
* built-in globals, plugin globals, and the selected task's schema — so an
|
|
23
|
+
* option is classified the same whether it appears before or after the task id.
|
|
24
|
+
*
|
|
25
|
+
* @param pluginGlobalOptions - global options registered by plugins
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseArgs(argv: string[], pluginGlobalOptions?: Map<string, {
|
|
28
|
+
pluginId: string;
|
|
29
|
+
definition: GlobalOptionDefinition;
|
|
30
|
+
}>, getTaskDefinition?: TaskDefinitionLookup): ParsedArgs;
|
|
31
|
+
export declare function validateTaskGlobalOptionCollisions(lre: LionDenRuntimeEnvironment): void;
|
|
32
|
+
export declare function validateParsedArgs(lre: LionDenRuntimeEnvironment, parsed: ParsedArgs): void;
|
|
33
|
+
/**
|
|
34
|
+
* Print help text for the CLI.
|
|
35
|
+
*/
|
|
36
|
+
export declare function printHelp(lre?: LionDenRuntimeEnvironment, pluginGlobalOptions?: Map<string, {
|
|
37
|
+
pluginId: string;
|
|
38
|
+
definition: GlobalOptionDefinition;
|
|
39
|
+
}>): void;
|
|
40
|
+
/**
|
|
41
|
+
* Execute a task from parsed CLI arguments.
|
|
42
|
+
*/
|
|
43
|
+
export declare function dispatchTask(lre: LionDenRuntimeEnvironment, parsed: ParsedArgs): Promise<void>;
|
|
44
|
+
//# sourceMappingURL=task-dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-dispatch.d.ts","sourceRoot":"","sources":["../src/task-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACf,MAAM,eAAe,CAAC;AASvB,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QACpC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,sBAAsB,CAAA;CAAE,CAAC,EAC3F,iBAAiB,CAAC,EAAE,oBAAoB,GACvC,UAAU,CA8DZ;AA6LD,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,yBAAyB,GAAG,IAAI,CAuBvF;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,yBAAyB,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAiD3F;AASD;;GAEG;AACH,wBAAgB,SAAS,CACvB,GAAG,CAAC,EAAE,yBAAyB,EAC/B,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,sBAAsB,CAAA;CAAE,CAAC,GAC1F,IAAI,CAoCN;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,yBAAyB,EAC9B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { ArgumentType, argumentFlagName, getPublicArgumentNames, getReservedBuiltInGlobalArgumentNames, } from "@lionden/core";
|
|
2
|
+
import { logger } from "./output/logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse CLI arguments into structured form.
|
|
5
|
+
* Format: lionden [options] <task> [options]
|
|
6
|
+
*
|
|
7
|
+
* The task id is discovered by position (first token that names a registered
|
|
8
|
+
* task), but named arguments are routed by public-name lookup against the
|
|
9
|
+
* built-in globals, plugin globals, and the selected task's schema — so an
|
|
10
|
+
* option is classified the same whether it appears before or after the task id.
|
|
11
|
+
*
|
|
12
|
+
* @param pluginGlobalOptions - global options registered by plugins
|
|
13
|
+
*/
|
|
14
|
+
export function parseArgs(argv, pluginGlobalOptions, getTaskDefinition) {
|
|
15
|
+
const globalArgs = {};
|
|
16
|
+
const taskArgs = {};
|
|
17
|
+
const preTaskArgs = [];
|
|
18
|
+
const { taskId, taskIndex } = findTask(argv, pluginGlobalOptions, getTaskDefinition);
|
|
19
|
+
const taskDefinition = taskId ? getTaskDefinition?.(taskId) : undefined;
|
|
20
|
+
const globalDefinitions = buildGlobalArgumentLookup(pluginGlobalOptions);
|
|
21
|
+
const taskDefinitions = taskDefinition
|
|
22
|
+
? buildTaskArgumentLookup(taskDefinition)
|
|
23
|
+
: new Map();
|
|
24
|
+
let i = 0;
|
|
25
|
+
while (i < argv.length) {
|
|
26
|
+
const arg = argv[i];
|
|
27
|
+
if (i === taskIndex) {
|
|
28
|
+
i++;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (arg.startsWith("--") || arg.startsWith("-")) {
|
|
32
|
+
const { rawName, inlineValue } = splitOptionToken(arg);
|
|
33
|
+
const globalDefinition = globalDefinitions.get(rawName);
|
|
34
|
+
const taskArg = taskDefinitions.get(rawName);
|
|
35
|
+
// An inline `--opt=value` carries its own value, so it never consumes the
|
|
36
|
+
// following token. Valued options without `=` fall back to the next token.
|
|
37
|
+
if (taskArg && !globalDefinition?.builtIn) {
|
|
38
|
+
if (taskArg.type === "boolean") {
|
|
39
|
+
taskArgs[taskArg.name] = coerceFlagValue(inlineValue);
|
|
40
|
+
}
|
|
41
|
+
else if (inlineValue !== undefined) {
|
|
42
|
+
taskArgs[taskArg.name] = inlineValue;
|
|
43
|
+
}
|
|
44
|
+
else if (canConsumeNextAsValue(argv, i, taskIndex)) {
|
|
45
|
+
taskArgs[taskArg.name] = argv[++i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (globalDefinition) {
|
|
49
|
+
if (globalDefinition.type === ArgumentType.BOOLEAN) {
|
|
50
|
+
globalArgs[globalDefinition.name] = coerceFlagValue(inlineValue);
|
|
51
|
+
}
|
|
52
|
+
else if (inlineValue !== undefined) {
|
|
53
|
+
globalArgs[globalDefinition.name] = inlineValue;
|
|
54
|
+
}
|
|
55
|
+
else if (canConsumeNextAsValue(argv, i, taskIndex)) {
|
|
56
|
+
globalArgs[globalDefinition.name] = argv[++i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (inlineValue !== undefined) {
|
|
60
|
+
taskArgs[rawName] = inlineValue;
|
|
61
|
+
}
|
|
62
|
+
else if (canConsumeNextAsValue(argv, i, taskIndex)) {
|
|
63
|
+
taskArgs[rawName] = argv[++i];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
taskArgs[rawName] = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (taskIndex >= 0 && i > taskIndex) {
|
|
71
|
+
const positionals = taskArgs._positional ?? [];
|
|
72
|
+
positionals.push(arg);
|
|
73
|
+
taskArgs._positional = positionals;
|
|
74
|
+
}
|
|
75
|
+
else if (taskIndex >= 0 && i < taskIndex) {
|
|
76
|
+
preTaskArgs.push(arg);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
return { taskId, taskArgs, preTaskArgs, globalArgs };
|
|
82
|
+
}
|
|
83
|
+
const BUILT_IN_GLOBAL_ARGUMENTS = [
|
|
84
|
+
{ name: "config", type: ArgumentType.FILE },
|
|
85
|
+
{ name: "network", type: ArgumentType.STRING },
|
|
86
|
+
{ name: "prove", type: ArgumentType.BOOLEAN },
|
|
87
|
+
{ name: "verbose", type: ArgumentType.BOOLEAN },
|
|
88
|
+
{ name: "help", type: ArgumentType.BOOLEAN, aliases: ["h"] },
|
|
89
|
+
{ name: "version", type: ArgumentType.BOOLEAN, aliases: ["v"] },
|
|
90
|
+
];
|
|
91
|
+
function buildGlobalArgumentLookup(pluginGlobalOptions) {
|
|
92
|
+
const lookup = new Map();
|
|
93
|
+
for (const definition of BUILT_IN_GLOBAL_ARGUMENTS) {
|
|
94
|
+
const entry = { name: definition.name, type: definition.type, builtIn: true };
|
|
95
|
+
for (const publicName of getPublicArgumentNames(definition.name)) {
|
|
96
|
+
lookup.set(publicName, entry);
|
|
97
|
+
}
|
|
98
|
+
for (const alias of definition.aliases ?? []) {
|
|
99
|
+
lookup.set(alias, entry);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const { definition } of pluginGlobalOptions?.values() ?? []) {
|
|
103
|
+
const entry = { name: definition.name, type: definition.type };
|
|
104
|
+
for (const publicName of getPublicArgumentNames(definition.name)) {
|
|
105
|
+
lookup.set(publicName, entry);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return lookup;
|
|
109
|
+
}
|
|
110
|
+
function buildTaskArgumentLookup(taskDefinition) {
|
|
111
|
+
const lookup = new Map();
|
|
112
|
+
for (const flag of taskDefinition.flags ?? []) {
|
|
113
|
+
const entry = { name: flag.name, type: "boolean" };
|
|
114
|
+
for (const publicName of getPublicArgumentNames(flag.name)) {
|
|
115
|
+
lookup.set(publicName, entry);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const option of taskDefinition.options ?? []) {
|
|
119
|
+
const entry = { name: option.name, type: option.type };
|
|
120
|
+
for (const publicName of getPublicArgumentNames(option.name)) {
|
|
121
|
+
lookup.set(publicName, entry);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Positionals may also be supplied by name (e.g. `--script-path` for a
|
|
125
|
+
// `scriptPath` positional). Register them as valued (never boolean) so a
|
|
126
|
+
// value-less `--script-path` consumes nothing and leaves the positional unset
|
|
127
|
+
// — letting the runner's required-positional check fire — instead of routing
|
|
128
|
+
// through the unknown-option branch and landing a `true` sentinel that
|
|
129
|
+
// masquerades as a supplied value. A real option/flag spelling wins on a
|
|
130
|
+
// clash (a config bug), so only fill names not already claimed above.
|
|
131
|
+
for (const positional of taskDefinition.positionalArguments ?? []) {
|
|
132
|
+
const entry = { name: positional.name, type: "string" };
|
|
133
|
+
for (const publicName of getPublicArgumentNames(positional.name)) {
|
|
134
|
+
if (!lookup.has(publicName)) {
|
|
135
|
+
lookup.set(publicName, entry);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return lookup;
|
|
140
|
+
}
|
|
141
|
+
function findTask(argv, pluginGlobalOptions, getTaskDefinition) {
|
|
142
|
+
const globalDefinitions = buildGlobalArgumentLookup(pluginGlobalOptions);
|
|
143
|
+
let firstUnclaimedToken = null;
|
|
144
|
+
for (let i = 0; i < argv.length; i++) {
|
|
145
|
+
const arg = argv[i];
|
|
146
|
+
if (arg.startsWith("--") || arg.startsWith("-")) {
|
|
147
|
+
const { rawName, inlineValue } = splitOptionToken(arg);
|
|
148
|
+
const globalDefinition = globalDefinitions.get(rawName);
|
|
149
|
+
const isValuedOption = !globalDefinition || globalDefinition.type !== ArgumentType.BOOLEAN;
|
|
150
|
+
// A valued option consumes the following token as its value — unless it
|
|
151
|
+
// already carries an inline `--opt=value`, in which case the next token is
|
|
152
|
+
// untouched. A token that names a registered task is normally left alone
|
|
153
|
+
// (so `lionden --network deploy` runs deploy with a value-less --network) —
|
|
154
|
+
// but only when it is the last task candidate. If a *later* task token
|
|
155
|
+
// exists to serve as the task, the immediate token is a genuine option
|
|
156
|
+
// value even when it matches a task name, so `lionden --network test deploy`
|
|
157
|
+
// (a network named "test") sets network=test and still dispatches deploy.
|
|
158
|
+
if (inlineValue === undefined &&
|
|
159
|
+
isValuedOption &&
|
|
160
|
+
canConsumeAsValue(argv[i + 1], getTaskDefinition, hasTaskTokenAfter(argv, i + 1, getTaskDefinition))) {
|
|
161
|
+
i++;
|
|
162
|
+
}
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (getTaskDefinition?.(arg)) {
|
|
166
|
+
return { taskId: arg, taskIndex: i };
|
|
167
|
+
}
|
|
168
|
+
firstUnclaimedToken ??= { taskId: arg, taskIndex: i };
|
|
169
|
+
}
|
|
170
|
+
return firstUnclaimedToken ?? { taskId: null, taskIndex: -1 };
|
|
171
|
+
}
|
|
172
|
+
function isOptionToken(token) {
|
|
173
|
+
return token.startsWith("-");
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Split an option token into its name and optional inline value, supporting the
|
|
177
|
+
* `--opt=value` / `-o=value` idiom. Without an `=`, `inlineValue` is undefined
|
|
178
|
+
* and the option follows the usual "consume the next token" rules. Splitting on
|
|
179
|
+
* the FIRST `=` keeps values that themselves contain `=` intact (e.g.
|
|
180
|
+
* `--out=a=b` ⇒ name "out", value "a=b").
|
|
181
|
+
*/
|
|
182
|
+
function splitOptionToken(arg) {
|
|
183
|
+
const body = arg.startsWith("--") ? arg.slice(2) : arg.slice(1);
|
|
184
|
+
const eq = body.indexOf("=");
|
|
185
|
+
if (eq === -1)
|
|
186
|
+
return { rawName: body, inlineValue: undefined };
|
|
187
|
+
return { rawName: body.slice(0, eq), inlineValue: body.slice(eq + 1) };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resolve a boolean flag's value. Presence (no inline value) ⇒ `true`; an
|
|
191
|
+
* explicit `=false` (case-insensitive) ⇒ `false`; any other inline value ⇒
|
|
192
|
+
* `true`. This keeps boolean flags permissive (the parser never throws) while
|
|
193
|
+
* making `--flag=false` mean what it says instead of being silently dropped.
|
|
194
|
+
*/
|
|
195
|
+
function coerceFlagValue(inlineValue) {
|
|
196
|
+
return inlineValue === undefined || inlineValue.toLowerCase() !== "false";
|
|
197
|
+
}
|
|
198
|
+
function canConsumeAsValue(token, getTaskDefinition, allowTaskIdValue = false) {
|
|
199
|
+
if (token === undefined)
|
|
200
|
+
return false;
|
|
201
|
+
if (isOptionToken(token))
|
|
202
|
+
return false;
|
|
203
|
+
if (!allowTaskIdValue && getTaskDefinition?.(token))
|
|
204
|
+
return false;
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Does a token that names a registered task appear at any index after
|
|
209
|
+
* `fromIndex`? Used to decide whether a valued option may consume a task-named
|
|
210
|
+
* token as its value: it may, as long as another task token remains to be the
|
|
211
|
+
* task.
|
|
212
|
+
*/
|
|
213
|
+
function hasTaskTokenAfter(argv, fromIndex, getTaskDefinition) {
|
|
214
|
+
for (let j = fromIndex + 1; j < argv.length; j++) {
|
|
215
|
+
const token = argv[j];
|
|
216
|
+
if (!isOptionToken(token) && getTaskDefinition?.(token)) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
function canConsumeNextAsValue(argv, index, taskIndex) {
|
|
223
|
+
if (index + 1 === taskIndex)
|
|
224
|
+
return false;
|
|
225
|
+
return canConsumeAsValue(argv[index + 1]);
|
|
226
|
+
}
|
|
227
|
+
export function validateTaskGlobalOptionCollisions(lre) {
|
|
228
|
+
const globalNames = getReservedBuiltInGlobalArgumentNames();
|
|
229
|
+
for (const plugin of lre.plugins) {
|
|
230
|
+
for (const opt of plugin.globalOptions ?? []) {
|
|
231
|
+
for (const publicName of getPublicArgumentNames(opt.name)) {
|
|
232
|
+
globalNames.add(publicName);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
for (const taskId of lre.tasks.getTaskIds()) {
|
|
237
|
+
const taskDefinition = lre.tasks.getTaskDefinition(taskId);
|
|
238
|
+
if (!taskDefinition)
|
|
239
|
+
continue;
|
|
240
|
+
for (const arg of [...(taskDefinition.options ?? []), ...(taskDefinition.flags ?? [])]) {
|
|
241
|
+
for (const publicName of getPublicArgumentNames(arg.name)) {
|
|
242
|
+
if (globalNames.has(publicName)) {
|
|
243
|
+
throw new Error(`Task "${taskId}" argument "${arg.name}" conflicts with global option "${argumentFlagName(publicName)}"`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export function validateParsedArgs(lre, parsed) {
|
|
250
|
+
if (!parsed.taskId) {
|
|
251
|
+
validateNoTaskArgs(parsed);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const taskDefinition = lre.tasks.getTaskDefinition(parsed.taskId);
|
|
255
|
+
if (!taskDefinition) {
|
|
256
|
+
throw new Error(`Unknown task: "${parsed.taskId}". Run 'lionden --help' to see available tasks.`);
|
|
257
|
+
}
|
|
258
|
+
if (parsed.preTaskArgs.length > 0) {
|
|
259
|
+
throw new Error(`Unexpected argument "${parsed.preTaskArgs[0]}" before task "${parsed.taskId}"`);
|
|
260
|
+
}
|
|
261
|
+
const positionalValues = Array.isArray(parsed.taskArgs._positional)
|
|
262
|
+
? parsed.taskArgs._positional
|
|
263
|
+
: [];
|
|
264
|
+
const positionalDefinitions = taskDefinition.positionalArguments ?? [];
|
|
265
|
+
const variadic = positionalDefinitions.length > 0 &&
|
|
266
|
+
positionalDefinitions[positionalDefinitions.length - 1]?.variadic === true;
|
|
267
|
+
// Positionals already supplied by name don't consume a bare slot (the runner
|
|
268
|
+
// binds bare values only to the still-unbound positionals, left-to-right), so
|
|
269
|
+
// the number of bare values the schema can absorb is the count of positionals
|
|
270
|
+
// NOT supplied by name.
|
|
271
|
+
const namedPositionalCount = positionalDefinitions.filter((definition) => getPublicArgumentNames(definition.name).some((publicName) => publicName in parsed.taskArgs)).length;
|
|
272
|
+
const bareSlots = positionalDefinitions.length - namedPositionalCount;
|
|
273
|
+
if (positionalValues.length > 0 && !variadic && positionalValues.length > bareSlots) {
|
|
274
|
+
const unexpected = positionalValues[bareSlots] ?? positionalValues[0];
|
|
275
|
+
throw new Error(`Unexpected argument "${unexpected}" for task "${parsed.taskId}"`);
|
|
276
|
+
}
|
|
277
|
+
// buildTaskArgumentLookup already includes positional public names, so a
|
|
278
|
+
// positional supplied by name (e.g. `--script-path`) is an allowed key.
|
|
279
|
+
const allowedTaskArgs = buildTaskArgumentLookup(taskDefinition);
|
|
280
|
+
for (const key of Object.keys(parsed.taskArgs)) {
|
|
281
|
+
if (key === "_positional")
|
|
282
|
+
continue;
|
|
283
|
+
if (!allowedTaskArgs.has(key)) {
|
|
284
|
+
throw new Error(`Unknown argument "${argumentFlagName(key)}" for task "${parsed.taskId}"`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function validateNoTaskArgs(parsed) {
|
|
289
|
+
for (const key of Object.keys(parsed.taskArgs)) {
|
|
290
|
+
if (key === "_positional")
|
|
291
|
+
continue;
|
|
292
|
+
throw new Error(`Unknown argument "${argumentFlagName(key)}"`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Print help text for the CLI.
|
|
297
|
+
*/
|
|
298
|
+
export function printHelp(lre, pluginGlobalOptions) {
|
|
299
|
+
console.log(`
|
|
300
|
+
\x1b[1mLionDen\x1b[0m — Aleo/Leo Development Framework
|
|
301
|
+
|
|
302
|
+
\x1b[1mUsage:\x1b[0m
|
|
303
|
+
lionden [options] <task> [task-options]
|
|
304
|
+
|
|
305
|
+
\x1b[1mGlobal Options:\x1b[0m
|
|
306
|
+
--config <path> Path to config file (default: lionden.config.ts)
|
|
307
|
+
--network <name> Network to use (overrides config default)
|
|
308
|
+
--prove Force standard/proven builders on devnode (slower; --prove=false to disable)
|
|
309
|
+
--verbose Show debug output
|
|
310
|
+
--help, -h Show this help
|
|
311
|
+
--version, -v Show version`);
|
|
312
|
+
if (pluginGlobalOptions && pluginGlobalOptions.size > 0) {
|
|
313
|
+
console.log(`
|
|
314
|
+
\x1b[1mPlugin Options:\x1b[0m`);
|
|
315
|
+
for (const [, { definition }] of pluginGlobalOptions) {
|
|
316
|
+
const typeHint = definition.type === "BOOLEAN" ? "" : ` <${definition.type.toLowerCase()}>`;
|
|
317
|
+
console.log(` --${definition.name}${typeHint} ${definition.description}`);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (lre) {
|
|
321
|
+
const taskIds = lre.tasks.getTaskIds();
|
|
322
|
+
if (taskIds.length > 0) {
|
|
323
|
+
console.log(`
|
|
324
|
+
\x1b[1mAvailable Tasks:\x1b[0m`);
|
|
325
|
+
for (const id of taskIds.sort()) {
|
|
326
|
+
console.log(` ${id}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
console.log();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Execute a task from parsed CLI arguments.
|
|
334
|
+
*/
|
|
335
|
+
export async function dispatchTask(lre, parsed) {
|
|
336
|
+
if (!parsed.taskId) {
|
|
337
|
+
printHelp(lre);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!lre.tasks.has(parsed.taskId)) {
|
|
341
|
+
logger.error(`Unknown task: "${parsed.taskId}"`);
|
|
342
|
+
logger.info("Run 'lionden --help' to see available tasks.");
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
await lre.tasks.run(parsed.taskId, parsed.taskArgs);
|
|
346
|
+
}
|
|
347
|
+
//# sourceMappingURL=task-dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-dispatch.js","sourceRoot":"","sources":["../src/task-dispatch.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,qCAAqC,GACtC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAkB5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CACvB,IAAc,EACd,mBAA2F,EAC3F,iBAAwC;IAExC,MAAM,UAAU,GAA6B,EAAE,CAAC;IAChD,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;IACrF,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,mBAAmB,CAAC,CAAC;IACzE,MAAM,eAAe,GAAG,cAAc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+
{
|
|
2
|
+
"name": "@lionden/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sealance-io/lionden.git",
|
|
9
|
+
"directory": "packages/cli"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"lionden": "./dist/bin.js"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"!dist/**/*.test.*"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc --build"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@lionden/config": "^0.1.0",
|
|
35
|
+
"@lionden/core": "^0.1.0",
|
|
36
|
+
"tsx": "^4.22.4"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@lionden/test-internals": "*"
|
|
40
|
+
}
|
|
41
|
+
}
|