create-maestro-app 0.0.2
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 +193 -0
- package/README.md +62 -0
- package/dist/args.d.ts +28 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +102 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +76 -0
- package/dist/bin.js.map +1 -0
- package/dist/capabilities.d.ts +55 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +75 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/commands.d.ts +17 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +19 -0
- package/dist/commands.js.map +1 -0
- package/dist/credentials.d.ts +34 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +72 -0
- package/dist/credentials.js.map +1 -0
- package/dist/flow.d.ts +37 -0
- package/dist/flow.d.ts.map +1 -0
- package/dist/flow.js +177 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +29 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +79 -0
- package/dist/io.js.map +1 -0
- package/dist/platform-client.d.ts +64 -0
- package/dist/platform-client.d.ts.map +1 -0
- package/dist/platform-client.js +76 -0
- package/dist/platform-client.js.map +1 -0
- package/dist/project.d.ts +26 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +40 -0
- package/dist/project.js.map +1 -0
- package/dist/scaffold.d.ts +36 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +67 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/session.d.ts +24 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +73 -0
- package/dist/session.js.map +1 -0
- package/package.json +34 -0
- package/templates/app/README.md +44 -0
- package/templates/app/_env.example +5 -0
- package/templates/app/_gitignore +15 -0
- package/templates/app/index.html +12 -0
- package/templates/app/maestro.config.ts +13 -0
- package/templates/app/package.json +25 -0
- package/templates/app/src/App.vue +19 -0
- package/templates/app/src/main.ts +6 -0
- package/templates/app/src/vite-env.d.ts +11 -0
- package/templates/app/tsconfig.json +17 -0
- package/templates/app/vite.config.ts +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
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
|
|
44
|
+
purposes of this License, Derivative Works shall not include works
|
|
45
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
46
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including the
|
|
49
|
+
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
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives, including
|
|
56
|
+
but not limited to communication on electronic mailing lists, source
|
|
57
|
+
code control systems, and issue tracking systems that are managed by,
|
|
58
|
+
or on behalf of, the Licensor for the purpose of discussing and
|
|
59
|
+
improving the Work, but excluding communication that is conspicuously
|
|
60
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
61
|
+
"Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing
|
|
142
|
+
the origin of the Work and reproducing the content of the NOTICE
|
|
143
|
+
file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and assume any
|
|
153
|
+
risks associated with Your exercise of permissions under this
|
|
154
|
+
License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
Copyright 2026 BeMaestro
|
|
182
|
+
|
|
183
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
184
|
+
you may not use this file except in compliance with the License.
|
|
185
|
+
You may obtain a copy of the License at
|
|
186
|
+
|
|
187
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
188
|
+
|
|
189
|
+
Unless required by applicable law or agreed to in writing, software
|
|
190
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
191
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
192
|
+
See the License for the specific language governing permissions and
|
|
193
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# create-maestro-app
|
|
2
|
+
|
|
3
|
+
Scaffold a **Maestro** product app in one command. The CLI provisions an App on the hosted Maestro
|
|
4
|
+
platform (creating it from the capabilities you pick) and generates **one integrated Vue project** —
|
|
5
|
+
the End-User app — wired to it. You own and deploy that project; everything else (schema, orgs, billing)
|
|
6
|
+
stays on the hosted platform.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm create maestro-app@latest my-app
|
|
10
|
+
# or
|
|
11
|
+
npx create-maestro-app@latest my-app
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What you get
|
|
15
|
+
|
|
16
|
+
- A Vite + Vue 3 project that mounts the shared **`@bemaestro/saas-ui`** shell — End-User login, account
|
|
17
|
+
area, and every surface of your App rendered from `/runtime` with no hand-written data wiring.
|
|
18
|
+
- `maestro.config.ts` pre-filled with your App key and the hosted Core URL; a git-ignored `.env`.
|
|
19
|
+
- Dependencies installed and a git repo initialized (opt out with `--no-install` / `--no-git`).
|
|
20
|
+
|
|
21
|
+
## Capabilities
|
|
22
|
+
|
|
23
|
+
You pick a **set** of capabilities; the CLI applies all their blueprints to one App and scaffolds one
|
|
24
|
+
app that renders them together:
|
|
25
|
+
|
|
26
|
+
- **saas** — accounts / orgs / billing (the product base).
|
|
27
|
+
- **site** — a public content website.
|
|
28
|
+
- **products** (e-learning, scheduling, …) — feature areas that **require accounts**, so selecting one
|
|
29
|
+
pulls in `saas` automatically. You can have `saas` without a product, never a product without `saas`.
|
|
30
|
+
- **site + saas** — the public site gets a login/sign-up hand-off into the SaaS product.
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
| Command | What it does |
|
|
35
|
+
| -------------------------- | --------------------------------------- |
|
|
36
|
+
| `create-maestro-app <dir>` | Interactive scaffold |
|
|
37
|
+
| `maestro login` / `logout` | Sign in to / out of the hosted platform |
|
|
38
|
+
| `maestro new <dir>` | Scaffold (installed-CLI form) |
|
|
39
|
+
| `maestro modules` | List capabilities from the live catalog |
|
|
40
|
+
|
|
41
|
+
## Flags
|
|
42
|
+
|
|
43
|
+
`--with <a,b>` (repeatable), `--app-key`, `--app-name`, `--api-url`, `--pm <pnpm\|npm\|yarn\|bun>`,
|
|
44
|
+
`--seed` / `--no-seed`, `--no-git`, `--no-install`, `--force`, `--yes`, `--dry-run`.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Non-interactive: a SaaS product with a public site, no prompts
|
|
48
|
+
npx create-maestro-app shop --with saas_base,cms --yes
|
|
49
|
+
|
|
50
|
+
# Full education marketplace (Pagofiit-shaped elearning + CMS + SaaS)
|
|
51
|
+
npx create-maestro-app meu-studio \
|
|
52
|
+
--with saas_base,cms,elearning_marketplace --yes
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Auth & secrets
|
|
56
|
+
|
|
57
|
+
The CLI signs in as a Platform Operator (`maestro login`) and caches only a refresh token in
|
|
58
|
+
`~/.maestro/credentials.json` (`0600`). The generated app authenticates End Users with a JWT — **no
|
|
59
|
+
secret is written into your project**. For a server-to-server key, create a least-privilege, org-scoped
|
|
60
|
+
key in the hosted admin console.
|
|
61
|
+
|
|
62
|
+
See `docs/specs/18-cli-scaffolding.md` for the full contract.
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI argument parsing (spec 18 US-18.1 flags). Zero-dep: a small hand-rolled
|
|
3
|
+
* parser over `process.argv` — the initializer ships with no heavy deps (NFR).
|
|
4
|
+
*/
|
|
5
|
+
export interface CliArgs {
|
|
6
|
+
/** Sub-command; the bare initializer form implies `new`. */
|
|
7
|
+
command: 'new' | 'login' | 'logout' | 'modules';
|
|
8
|
+
/** Target directory / project name (positional). */
|
|
9
|
+
dir?: string;
|
|
10
|
+
/** Selected capabilities (blueprint keys), e.g. `['saas_base','cms']`. */
|
|
11
|
+
capabilities?: string[];
|
|
12
|
+
appKey?: string;
|
|
13
|
+
appName?: string;
|
|
14
|
+
apiUrl?: string;
|
|
15
|
+
pm?: 'pnpm' | 'npm' | 'yarn' | 'bun';
|
|
16
|
+
seed?: boolean;
|
|
17
|
+
git: boolean;
|
|
18
|
+
install: boolean;
|
|
19
|
+
force: boolean;
|
|
20
|
+
yes: boolean;
|
|
21
|
+
dryRun: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse argv (without the `node script` prefix). Unknown `--flags` throw so a
|
|
25
|
+
* typo never silently no-ops.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseArgs(argv: string[]): CliArgs;
|
|
28
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,OAAO;IACtB,4DAA4D;IAC5D,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAChD,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAiBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAgFjD"}
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI argument parsing (spec 18 US-18.1 flags). Zero-dep: a small hand-rolled
|
|
3
|
+
* parser over `process.argv` — the initializer ships with no heavy deps (NFR).
|
|
4
|
+
*/
|
|
5
|
+
const KNOWN_COMMANDS = new Set(['new', 'login', 'logout', 'modules']);
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
git: true,
|
|
8
|
+
install: true,
|
|
9
|
+
force: false,
|
|
10
|
+
yes: false,
|
|
11
|
+
dryRun: false,
|
|
12
|
+
};
|
|
13
|
+
function parsePm(value) {
|
|
14
|
+
if (value === 'pnpm' || value === 'npm' || value === 'yarn' || value === 'bun')
|
|
15
|
+
return value;
|
|
16
|
+
throw new Error(`Unknown package manager: ${value} (expected pnpm|npm|yarn|bun)`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parse argv (without the `node script` prefix). Unknown `--flags` throw so a
|
|
20
|
+
* typo never silently no-ops.
|
|
21
|
+
*/
|
|
22
|
+
export function parseArgs(argv) {
|
|
23
|
+
const args = { command: 'new', ...DEFAULTS };
|
|
24
|
+
const positionals = [];
|
|
25
|
+
let i = 0;
|
|
26
|
+
// A leading bare word that names a command switches the sub-command.
|
|
27
|
+
if (argv[0] && !argv[0].startsWith('-') && KNOWN_COMMANDS.has(argv[0])) {
|
|
28
|
+
args.command = argv[0];
|
|
29
|
+
i = 1;
|
|
30
|
+
}
|
|
31
|
+
for (; i < argv.length; i++) {
|
|
32
|
+
const token = argv[i];
|
|
33
|
+
if (!token.startsWith('-')) {
|
|
34
|
+
positionals.push(token);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
// Support `--flag=value` and `--flag value`.
|
|
38
|
+
const eq = token.indexOf('=');
|
|
39
|
+
const flag = eq === -1 ? token : token.slice(0, eq);
|
|
40
|
+
const inlineValue = eq === -1 ? undefined : token.slice(eq + 1);
|
|
41
|
+
const next = () => {
|
|
42
|
+
if (inlineValue !== undefined)
|
|
43
|
+
return inlineValue;
|
|
44
|
+
const v = argv[++i];
|
|
45
|
+
if (v === undefined)
|
|
46
|
+
throw new Error(`Missing value for ${flag}`);
|
|
47
|
+
return v;
|
|
48
|
+
};
|
|
49
|
+
switch (flag) {
|
|
50
|
+
case '--with':
|
|
51
|
+
// Comma-separated and/or repeatable: `--with saas,site --with elearning`.
|
|
52
|
+
args.capabilities = [
|
|
53
|
+
...(args.capabilities ?? []),
|
|
54
|
+
...next()
|
|
55
|
+
.split(',')
|
|
56
|
+
.map((s) => s.trim())
|
|
57
|
+
.filter(Boolean),
|
|
58
|
+
];
|
|
59
|
+
break;
|
|
60
|
+
case '--app-key':
|
|
61
|
+
args.appKey = next();
|
|
62
|
+
break;
|
|
63
|
+
case '--app-name':
|
|
64
|
+
args.appName = next();
|
|
65
|
+
break;
|
|
66
|
+
case '--api-url':
|
|
67
|
+
args.apiUrl = next();
|
|
68
|
+
break;
|
|
69
|
+
case '--pm':
|
|
70
|
+
args.pm = parsePm(next());
|
|
71
|
+
break;
|
|
72
|
+
case '--seed':
|
|
73
|
+
args.seed = true;
|
|
74
|
+
break;
|
|
75
|
+
case '--no-seed':
|
|
76
|
+
args.seed = false;
|
|
77
|
+
break;
|
|
78
|
+
case '--no-git':
|
|
79
|
+
args.git = false;
|
|
80
|
+
break;
|
|
81
|
+
case '--no-install':
|
|
82
|
+
args.install = false;
|
|
83
|
+
break;
|
|
84
|
+
case '--force':
|
|
85
|
+
args.force = true;
|
|
86
|
+
break;
|
|
87
|
+
case '-y':
|
|
88
|
+
case '--yes':
|
|
89
|
+
args.yes = true;
|
|
90
|
+
break;
|
|
91
|
+
case '--dry-run':
|
|
92
|
+
args.dryRun = true;
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
throw new Error(`Unknown flag: ${flag}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (positionals.length > 0)
|
|
99
|
+
args.dir = positionals[0];
|
|
100
|
+
return args;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAEtE,MAAM,QAAQ,GAA6B;IACzC,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAC7F,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,+BAA+B,CAAC,CAAC;AACpF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,IAAI,GAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtD,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,qEAAqE;IACrE,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC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AC;QAAE,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { parseArgs } from './args.js';
|
|
4
|
+
import { capabilitiesFromCatalog } from './capabilities.js';
|
|
5
|
+
import { SpawnRunner } from './commands.js';
|
|
6
|
+
import { ReadlineIo } from './io.js';
|
|
7
|
+
import { PlatformClient } from './platform-client.js';
|
|
8
|
+
import { ADMIN_CONSOLE_URL, DEFAULT_API_URL, runCreate } from './flow.js';
|
|
9
|
+
import { SessionManager } from './session.js';
|
|
10
|
+
/** `packages/create-app/templates`, resolved from the compiled `dist/bin.js`. */
|
|
11
|
+
const templatesRoot = fileURLToPath(new URL('../templates', import.meta.url));
|
|
12
|
+
async function main() {
|
|
13
|
+
const args = parseArgs(process.argv.slice(2));
|
|
14
|
+
const io = new ReadlineIo();
|
|
15
|
+
const baseUrl = (args.apiUrl ?? DEFAULT_API_URL).replace(/\/+$/, '');
|
|
16
|
+
const platform = new PlatformClient({ baseUrl });
|
|
17
|
+
const session = new SessionManager(baseUrl, platform);
|
|
18
|
+
switch (args.command) {
|
|
19
|
+
case 'login': {
|
|
20
|
+
const email = await io.text('Operator email');
|
|
21
|
+
const password = await io.password('Password');
|
|
22
|
+
const result = await session.signIn(email, password);
|
|
23
|
+
io.log(`Signed in as ${result.operator.email} on ${baseUrl}.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
case 'logout': {
|
|
27
|
+
await session.signOut();
|
|
28
|
+
io.log(`Signed out of ${baseUrl}.`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
case 'modules': {
|
|
32
|
+
const token = await session.getAccessToken();
|
|
33
|
+
if (!token) {
|
|
34
|
+
io.error('Not signed in. Run `maestro login` first.');
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const catalog = await platform.listTemplates(token);
|
|
39
|
+
for (const cap of capabilitiesFromCatalog(catalog)) {
|
|
40
|
+
const tag = cap.requiresSaas ? ' (requires saas)' : '';
|
|
41
|
+
io.log(` ${cap.templateKey.padEnd(24)} ${cap.label}${tag}`);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
case 'new': {
|
|
46
|
+
const result = await runCreate(args, {
|
|
47
|
+
io,
|
|
48
|
+
platform,
|
|
49
|
+
session,
|
|
50
|
+
templatesRoot,
|
|
51
|
+
cwd: process.cwd(),
|
|
52
|
+
runner: new SpawnRunner(),
|
|
53
|
+
});
|
|
54
|
+
io.log('');
|
|
55
|
+
if (result.dryRun) {
|
|
56
|
+
io.log(`Dry run — would create App "${result.app.key}" with [${result.blueprints.join(', ')}] and write ${result.files.length} files.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
io.log(`Done. App "${result.app.key}" is live with [${result.blueprints.join(', ')}] on the hosted platform.`);
|
|
60
|
+
io.log('');
|
|
61
|
+
io.log('Next steps:');
|
|
62
|
+
io.log(` cd ${result.targetDir}`);
|
|
63
|
+
if (!result.installed)
|
|
64
|
+
io.log(` ${result.packageManager} install`);
|
|
65
|
+
io.log(` ${result.packageManager} dev`);
|
|
66
|
+
io.log('');
|
|
67
|
+
io.log(`Manage this App at ${ADMIN_CONSOLE_URL}.`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
main().catch((err) => {
|
|
73
|
+
process.stderr.write(`\n${err instanceof Error ? err.message : String(err)}\n`);
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
});
|
|
76
|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C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities (spec 18). A "capability" is a user-selectable piece of the app the
|
|
3
|
+
* CLI builds — `saas`, `site`, `elearning`, `ecommerce`, `scheduling`, … Each maps
|
|
4
|
+
* to a **blueprint** in the platform catalog (spec 16). The CLI applies the chosen
|
|
5
|
+
* blueprints to ONE App so their collections + surfaces coexist ("integrated"),
|
|
6
|
+
* and scaffolds ONE Vue app that renders them together.
|
|
7
|
+
*
|
|
8
|
+
* Dependency rule (locked with the product owner):
|
|
9
|
+
* - `saas_base` is the **account base** (accounts/orgs/billing product shell).
|
|
10
|
+
* - `cms` is a **public site** (no login) — standalone, but when picked
|
|
11
|
+
* with saas it gets a login/sign-up hand-off into the saas product.
|
|
12
|
+
* - **every other** blueprint is a **product** that REQUIRES accounts ⇒ pulls in
|
|
13
|
+
* `saas`. So you can have `saas` without `ecommerce`, but never `ecommerce`
|
|
14
|
+
* without `saas`.
|
|
15
|
+
*/
|
|
16
|
+
/** Minimal catalog card the CLI consumes (spec 16 US-16.1). */
|
|
17
|
+
export interface CatalogTemplate {
|
|
18
|
+
key: string;
|
|
19
|
+
name: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
category: string;
|
|
22
|
+
}
|
|
23
|
+
export type CapabilityKind = 'base' | 'site' | 'product';
|
|
24
|
+
/** The account-base blueprint every account-requiring product depends on. */
|
|
25
|
+
export declare const SAAS_BASE_KEY = "saas_base";
|
|
26
|
+
/** The public-site blueprint (no login). */
|
|
27
|
+
export declare const SITE_KEY = "cms";
|
|
28
|
+
/** Classify a blueprint into a capability kind. */
|
|
29
|
+
export declare function capabilityKind(templateKey: string): CapabilityKind;
|
|
30
|
+
export interface Capability {
|
|
31
|
+
/** Blueprint key (the selection value). */
|
|
32
|
+
templateKey: string;
|
|
33
|
+
label: string;
|
|
34
|
+
kind: CapabilityKind;
|
|
35
|
+
/** True when this capability requires the saas account base. */
|
|
36
|
+
requiresSaas: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Turn the live catalog into the selectable capability list (US-18.6). */
|
|
39
|
+
export declare function capabilitiesFromCatalog(catalog: CatalogTemplate[]): Capability[];
|
|
40
|
+
export interface ResolvedSelection {
|
|
41
|
+
/** Blueprints to apply, base-first (saas before products), then site. */
|
|
42
|
+
ordered: string[];
|
|
43
|
+
/** True when `saas_base` was pulled in to satisfy a product's dependency. */
|
|
44
|
+
autoAddedSaas: boolean;
|
|
45
|
+
hasSaas: boolean;
|
|
46
|
+
hasSite: boolean;
|
|
47
|
+
/** The blueprint used to create the App (the rest are applied on top). */
|
|
48
|
+
baseTemplateKey: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a user's selection into an ordered, dependency-complete blueprint list.
|
|
52
|
+
* Throws if the selection is empty or references an unknown blueprint.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveSelection(selected: string[], catalog: CatalogTemplate[]): ResolvedSelection;
|
|
55
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzD,6EAA6E;AAC7E,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAIlE;AAED,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,gEAAgE;IAChE,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,UAAU,EAAE,CAUhF;AAED,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,6EAA6E;IAC7E,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,eAAe,EAAE,GACzB,iBAAiB,CA8BnB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities (spec 18). A "capability" is a user-selectable piece of the app the
|
|
3
|
+
* CLI builds — `saas`, `site`, `elearning`, `ecommerce`, `scheduling`, … Each maps
|
|
4
|
+
* to a **blueprint** in the platform catalog (spec 16). The CLI applies the chosen
|
|
5
|
+
* blueprints to ONE App so their collections + surfaces coexist ("integrated"),
|
|
6
|
+
* and scaffolds ONE Vue app that renders them together.
|
|
7
|
+
*
|
|
8
|
+
* Dependency rule (locked with the product owner):
|
|
9
|
+
* - `saas_base` is the **account base** (accounts/orgs/billing product shell).
|
|
10
|
+
* - `cms` is a **public site** (no login) — standalone, but when picked
|
|
11
|
+
* with saas it gets a login/sign-up hand-off into the saas product.
|
|
12
|
+
* - **every other** blueprint is a **product** that REQUIRES accounts ⇒ pulls in
|
|
13
|
+
* `saas`. So you can have `saas` without `ecommerce`, but never `ecommerce`
|
|
14
|
+
* without `saas`.
|
|
15
|
+
*/
|
|
16
|
+
/** The account-base blueprint every account-requiring product depends on. */
|
|
17
|
+
export const SAAS_BASE_KEY = 'saas_base';
|
|
18
|
+
/** The public-site blueprint (no login). */
|
|
19
|
+
export const SITE_KEY = 'cms';
|
|
20
|
+
/** Classify a blueprint into a capability kind. */
|
|
21
|
+
export function capabilityKind(templateKey) {
|
|
22
|
+
if (templateKey === SAAS_BASE_KEY)
|
|
23
|
+
return 'base';
|
|
24
|
+
if (templateKey === SITE_KEY)
|
|
25
|
+
return 'site';
|
|
26
|
+
return 'product';
|
|
27
|
+
}
|
|
28
|
+
/** Turn the live catalog into the selectable capability list (US-18.6). */
|
|
29
|
+
export function capabilitiesFromCatalog(catalog) {
|
|
30
|
+
return catalog.map((t) => {
|
|
31
|
+
const kind = capabilityKind(t.key);
|
|
32
|
+
return {
|
|
33
|
+
templateKey: t.key,
|
|
34
|
+
label: `${t.name} — ${t.summary}`,
|
|
35
|
+
kind,
|
|
36
|
+
requiresSaas: kind === 'product',
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a user's selection into an ordered, dependency-complete blueprint list.
|
|
42
|
+
* Throws if the selection is empty or references an unknown blueprint.
|
|
43
|
+
*/
|
|
44
|
+
export function resolveSelection(selected, catalog) {
|
|
45
|
+
if (selected.length === 0)
|
|
46
|
+
throw new Error('Select at least one capability.');
|
|
47
|
+
const known = new Set(catalog.map((t) => t.key));
|
|
48
|
+
for (const key of selected) {
|
|
49
|
+
if (!known.has(key))
|
|
50
|
+
throw new Error(`Unknown capability blueprint: ${key}`);
|
|
51
|
+
}
|
|
52
|
+
const set = new Set(selected);
|
|
53
|
+
const needsSaas = [...set].some((k) => capabilityKind(k) === 'product');
|
|
54
|
+
const autoAddedSaas = needsSaas && !set.has(SAAS_BASE_KEY) && known.has(SAAS_BASE_KEY);
|
|
55
|
+
if (autoAddedSaas)
|
|
56
|
+
set.add(SAAS_BASE_KEY);
|
|
57
|
+
// Order: saas base first (so product collections can reference accounts),
|
|
58
|
+
// then products, then the public site last.
|
|
59
|
+
const hasSaas = set.has(SAAS_BASE_KEY);
|
|
60
|
+
const hasSite = set.has(SITE_KEY);
|
|
61
|
+
const products = [...set].filter((k) => capabilityKind(k) === 'product').sort();
|
|
62
|
+
const ordered = [
|
|
63
|
+
...(hasSaas ? [SAAS_BASE_KEY] : []),
|
|
64
|
+
...products,
|
|
65
|
+
...(hasSite ? [SITE_KEY] : []),
|
|
66
|
+
];
|
|
67
|
+
return {
|
|
68
|
+
ordered,
|
|
69
|
+
autoAddedSaas,
|
|
70
|
+
hasSaas,
|
|
71
|
+
hasSite,
|
|
72
|
+
baseTemplateKey: ordered[0],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AACzC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;AAE9B,mDAAmD;AACnD,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,IAAI,WAAW,KAAK,aAAa;QAAE,OAAO,MAAM,CAAC;IACjD,IAAI,WAAW,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC;AAWD,2EAA2E;AAC3E,MAAM,UAAU,uBAAuB,CAAC,OAA0B;IAChE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,C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G,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IAChF,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,GAAG,QAAQ;QACX,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/B,CAAC;IAEF,OAAO;QACL,OAAO;QACP,aAAa;QACb,OAAO;QACP,OAAO;QACP,eAAe,EAAE,OAAO,CAAC,CAAC,CAAE;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal command runner (spec 18 US-18.1: `pnpm install`, `git init`).
|
|
3
|
+
* Abstracted so the flow can be tested with a fake that records calls instead of
|
|
4
|
+
* spawning real processes.
|
|
5
|
+
*/
|
|
6
|
+
export interface CommandRunner {
|
|
7
|
+
/** Resolve `true` on exit code 0, `false` otherwise (never rejects on a
|
|
8
|
+
* non-zero exit — install/git are best-effort and must not abort a scaffold). */
|
|
9
|
+
run(command: string, args: string[], cwd: string): Promise<boolean>;
|
|
10
|
+
/** Whether a command is available on PATH (e.g. `git`). */
|
|
11
|
+
has(command: string): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare class SpawnRunner implements CommandRunner {
|
|
14
|
+
run(command: string, args: string[], cwd: string): Promise<boolean>;
|
|
15
|
+
has(command: string): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;sFACkF;IAClF,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpE,2DAA2D;IAC3D,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AAED,qBAAa,WAAY,YAAW,aAAa;IAC/C,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQnE,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAQvC"}
|