create-meterkit 0.0.0 → 0.3.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 +25 -6
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +173 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.test.d.ts +1 -0
- package/dist/cli.test.js +105 -0
- package/dist/cli.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plan.d.ts +12 -0
- package/dist/plan.js +90 -0
- package/dist/plan.js.map +1 -0
- package/dist/security.test.d.ts +1 -0
- package/dist/security.test.js +63 -0
- package/dist/security.test.js.map +1 -0
- package/dist/templates.integration.test.d.ts +1 -0
- package/dist/templates.integration.test.js +107 -0
- package/dist/templates.integration.test.js.map +1 -0
- package/dist/write.d.ts +16 -0
- package/dist/write.js +159 -0
- package/dist/write.js.map +1 -0
- package/dist/write.test.d.ts +1 -0
- package/dist/write.test.js +48 -0
- package/dist/write.test.js.map +1 -0
- package/package.json +40 -8
- package/templates/express/.env.example +5 -0
- package/templates/express/README.md +59 -0
- package/templates/express/package.json +22 -0
- package/templates/express/src/payment-store.ts +20 -0
- package/templates/express/src/server.ts +31 -0
- package/templates/hono/.env.example +5 -0
- package/templates/hono/README.md +37 -0
- package/templates/hono/package.json +24 -0
- package/templates/hono/src/payment-store.ts +20 -0
- package/templates/hono/src/server.ts +48 -0
- package/templates/mcp/.env.example +5 -0
- package/templates/mcp/README.md +30 -0
- package/templates/mcp/package.json +24 -0
- package/templates/mcp/src/payment-store.ts +20 -0
- package/templates/mcp/src/server.ts +94 -0
- package/templates/next-route/.env.example +5 -0
- package/templates/next-route/README.md +37 -0
- package/templates/next-route/app/api/premium/route.ts +52 -0
- package/templates/next-route/app/payment-store.ts +22 -0
- package/templates/next-route/next-env.d.ts +4 -0
- package/templates/next-route/package.json +27 -0
- package/templates/next-route/tsconfig.json +20 -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
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
# create-meterkit
|
|
1
|
+
# create-meterkit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
reviewed `0.2.0` release.
|
|
3
|
+
Public devnet-beta initializer for MeterKit 0.3.0. It creates Express, Next.js,
|
|
4
|
+
Hono or experimental MCP projects without cloning the monorepo.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Interactive:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm create meterkit@0.3.0
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Reproducible non-interactive Express path:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm create meterkit@0.3.0 -- meterkit-app --surface express --package-manager npm --recipient <DEVNET_PUBLIC_WALLET> --yes
|
|
16
|
+
cd meterkit-app
|
|
17
|
+
npm run dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
In a second terminal, run `npm run check:unpaid`. The endpoint must return and
|
|
21
|
+
decode an x402 v2 HTTP 402 challenge. Only a public recipient address is stored;
|
|
22
|
+
the initializer never asks for a seed phrase or private key.
|
|
23
|
+
|
|
24
|
+
Node 22 is supported. npm and pnpm are supported package managers. Express,
|
|
25
|
+
Next Route and Hono are supported HTTP surfaces; MCP is experimental. Generated
|
|
26
|
+
projects use an in-memory replay store for the first-402 demo and print a
|
|
27
|
+
non-durable warning. Do not serve paid requests with memory storage.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export declare const CREATE_METERKIT_VERSION = "0.3.0";
|
|
3
|
+
interface CliArguments {
|
|
4
|
+
directory: string;
|
|
5
|
+
surface: "express" | "next-route" | "hono" | "mcp";
|
|
6
|
+
packageManager: "pnpm" | "npm" | "yarn" | "bun";
|
|
7
|
+
dryRun: boolean;
|
|
8
|
+
json: boolean;
|
|
9
|
+
yes: boolean;
|
|
10
|
+
recipient?: string;
|
|
11
|
+
install: boolean;
|
|
12
|
+
durability: "memory" | "postgres";
|
|
13
|
+
}
|
|
14
|
+
export declare function parseCliArguments(args: string[]): CliArguments;
|
|
15
|
+
export interface PromptRequest {
|
|
16
|
+
id: "directory" | "surface" | "packageManager" | "recipient" | "install";
|
|
17
|
+
message: string;
|
|
18
|
+
defaultValue?: string | boolean;
|
|
19
|
+
}
|
|
20
|
+
interface CliIo {
|
|
21
|
+
cwd?: string;
|
|
22
|
+
stdout?: (value: string) => void;
|
|
23
|
+
stderr?: (value: string) => void;
|
|
24
|
+
isTTY?: boolean;
|
|
25
|
+
prompt?: (request: PromptRequest) => Promise<string | boolean | undefined>;
|
|
26
|
+
}
|
|
27
|
+
export declare function runCli(args: string[], io?: CliIo): Promise<number>;
|
|
28
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { createInterface } from "node:readline/promises";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { createInitializerPlan } from "./plan.js";
|
|
8
|
+
import { installGeneratedProject, writeInitializerPlan } from "./write.js";
|
|
9
|
+
export const CREATE_METERKIT_VERSION = "0.3.0";
|
|
10
|
+
export function parseCliArguments(args) {
|
|
11
|
+
const directory = args[0];
|
|
12
|
+
if (!directory || directory.startsWith("-"))
|
|
13
|
+
throw new Error("directory is required");
|
|
14
|
+
let surface = "express";
|
|
15
|
+
let packageManager = "pnpm";
|
|
16
|
+
let dryRun = false;
|
|
17
|
+
let json = false;
|
|
18
|
+
let yes = false;
|
|
19
|
+
let recipient;
|
|
20
|
+
let install = false;
|
|
21
|
+
let durability = "memory";
|
|
22
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
23
|
+
const argument = args[index];
|
|
24
|
+
if (argument === "--surface")
|
|
25
|
+
surface = args[++index];
|
|
26
|
+
else if (argument === "--package-manager")
|
|
27
|
+
packageManager = args[++index];
|
|
28
|
+
else if (argument === "--dry-run")
|
|
29
|
+
dryRun = true;
|
|
30
|
+
else if (argument === "--json")
|
|
31
|
+
json = true;
|
|
32
|
+
else if (argument === "--yes")
|
|
33
|
+
yes = true;
|
|
34
|
+
else if (argument === "--recipient")
|
|
35
|
+
recipient = args[++index];
|
|
36
|
+
else if (argument === "--install")
|
|
37
|
+
install = true;
|
|
38
|
+
else if (argument === "--no-install")
|
|
39
|
+
install = false;
|
|
40
|
+
else if (argument === "--store")
|
|
41
|
+
durability = args[++index];
|
|
42
|
+
else
|
|
43
|
+
throw new Error(`unknown option: ${argument}`);
|
|
44
|
+
}
|
|
45
|
+
if (yes && !args.includes("--no-install"))
|
|
46
|
+
install = true;
|
|
47
|
+
return {
|
|
48
|
+
directory,
|
|
49
|
+
surface,
|
|
50
|
+
packageManager,
|
|
51
|
+
dryRun,
|
|
52
|
+
json,
|
|
53
|
+
yes,
|
|
54
|
+
...(recipient ? { recipient } : {}),
|
|
55
|
+
install,
|
|
56
|
+
durability,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function promptInTerminal(request) {
|
|
60
|
+
const terminal = createInterface({
|
|
61
|
+
input: process.stdin,
|
|
62
|
+
output: process.stdout,
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
const suffix = request.defaultValue === undefined
|
|
66
|
+
? ""
|
|
67
|
+
: ` [${String(request.defaultValue)}]`;
|
|
68
|
+
const answer = (await terminal.question(`${request.message}${suffix}: `)).trim();
|
|
69
|
+
if (!answer)
|
|
70
|
+
return request.defaultValue;
|
|
71
|
+
if (typeof request.defaultValue === "boolean") {
|
|
72
|
+
return /^(?:y|yes|true|1)$/i.test(answer);
|
|
73
|
+
}
|
|
74
|
+
return answer;
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
terminal.close();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function guidedArguments(io) {
|
|
81
|
+
const isTTY = io.isTTY ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
82
|
+
if (!isTTY)
|
|
83
|
+
return [];
|
|
84
|
+
const prompt = io.prompt ?? promptInTerminal;
|
|
85
|
+
const detectedManager = process.env.npm_config_user_agent?.startsWith("pnpm/")
|
|
86
|
+
? "pnpm"
|
|
87
|
+
: "npm";
|
|
88
|
+
const directory = await prompt({
|
|
89
|
+
id: "directory",
|
|
90
|
+
message: "Project directory",
|
|
91
|
+
defaultValue: "meterkit-app",
|
|
92
|
+
});
|
|
93
|
+
const surface = await prompt({
|
|
94
|
+
id: "surface",
|
|
95
|
+
message: "Surface (express, next-route, hono, mcp)",
|
|
96
|
+
defaultValue: "express",
|
|
97
|
+
});
|
|
98
|
+
const packageManager = await prompt({
|
|
99
|
+
id: "packageManager",
|
|
100
|
+
message: "Package manager (npm or pnpm)",
|
|
101
|
+
defaultValue: detectedManager,
|
|
102
|
+
});
|
|
103
|
+
const recipient = await prompt({
|
|
104
|
+
id: "recipient",
|
|
105
|
+
message: "Disposable devnet recipient public key",
|
|
106
|
+
});
|
|
107
|
+
const install = await prompt({
|
|
108
|
+
id: "install",
|
|
109
|
+
message: "Install dependencies",
|
|
110
|
+
defaultValue: true,
|
|
111
|
+
});
|
|
112
|
+
return [
|
|
113
|
+
String(directory || "meterkit-app"),
|
|
114
|
+
"--surface",
|
|
115
|
+
String(surface || "express"),
|
|
116
|
+
"--package-manager",
|
|
117
|
+
String(packageManager || detectedManager),
|
|
118
|
+
"--recipient",
|
|
119
|
+
String(recipient ?? ""),
|
|
120
|
+
install === false ? "--no-install" : "--install",
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
export async function runCli(args, io = {}) {
|
|
124
|
+
const stdout = io.stdout ?? ((value) => process.stdout.write(value));
|
|
125
|
+
const stderr = io.stderr ?? ((value) => process.stderr.write(value));
|
|
126
|
+
try {
|
|
127
|
+
const effectiveArguments = args.length === 0 ? await guidedArguments(io) : args;
|
|
128
|
+
const parsed = parseCliArguments(effectiveArguments);
|
|
129
|
+
if (!parsed.dryRun && !parsed.recipient) {
|
|
130
|
+
throw new Error("recipient is required unless --dry-run is used");
|
|
131
|
+
}
|
|
132
|
+
const plan = await createInitializerPlan({
|
|
133
|
+
surface: parsed.surface,
|
|
134
|
+
packageManager: parsed.packageManager,
|
|
135
|
+
targetDirectory: resolve(io.cwd ?? process.cwd(), parsed.directory),
|
|
136
|
+
...(parsed.recipient ? { recipient: parsed.recipient } : {}),
|
|
137
|
+
durability: parsed.durability,
|
|
138
|
+
});
|
|
139
|
+
if (parsed.dryRun) {
|
|
140
|
+
stdout(parsed.json
|
|
141
|
+
? `${JSON.stringify(plan, null, 2)}\n`
|
|
142
|
+
: `Would create ${plan.surface} in ${plan.targetDirectory}\n`);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
await writeInitializerPlan(plan);
|
|
146
|
+
const installation = parsed.install
|
|
147
|
+
? await installGeneratedProject(plan.targetDirectory, parsed.packageManager)
|
|
148
|
+
: { state: "ready" };
|
|
149
|
+
stdout(parsed.json
|
|
150
|
+
? `${JSON.stringify({ created: true, plan, installation })}\n`
|
|
151
|
+
: `Created MeterKit ${plan.surface} project in ${plan.targetDirectory}\nPackage manager: ${plan.packageManager}\n${installation.state === "written_install_failed" ? `Install failed; recover with: ${installation.recoveryCommand}\n` : ""}`);
|
|
152
|
+
return installation.state === "ready" ? 0 : 1;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const message = error instanceof Error ? error.message : "unknown failure";
|
|
156
|
+
const filesystem = message.startsWith("UNSAFE_FILESYSTEM");
|
|
157
|
+
stderr(`${filesystem ? "UNSAFE_FILESYSTEM" : "INVALID_INPUT"}: ${message.replace(/^(?:UNSAFE_FILESYSTEM|INVALID_INPUT):\s*/, "")}\n`);
|
|
158
|
+
return filesystem ? 3 : 2;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const executedPath = process.argv[1]
|
|
162
|
+
? (() => {
|
|
163
|
+
try {
|
|
164
|
+
return realpathSync(process.argv[1]);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return resolve(process.argv[1]);
|
|
168
|
+
}
|
|
169
|
+
})()
|
|
170
|
+
: undefined;
|
|
171
|
+
if (executedPath === fileURLToPath(import.meta.url))
|
|
172
|
+
process.exitCode = await runCli(process.argv.slice(2));
|
|
173
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAc/C,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,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AC,mBAAmB,CAAC,CAAC,CAAC,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC,IAAI,CAC9H,CAAC;QACF,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC,GAAG,EAAE;QACJ,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC,EAAE;IACN,CAAC,CAAC,SAAS,CAAC;AACd,IAAI,YAAY,KAAK,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IACjD,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.test.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { mkdtemp, readFile } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { parseCliArguments, runCli } from "./cli.js";
|
|
6
|
+
describe("create-meterkit CLI", () => {
|
|
7
|
+
it("parses the documented command surface deterministically", () => {
|
|
8
|
+
expect(parseCliArguments([
|
|
9
|
+
"demo",
|
|
10
|
+
"--surface",
|
|
11
|
+
"hono",
|
|
12
|
+
"--package-manager",
|
|
13
|
+
"pnpm",
|
|
14
|
+
"--dry-run",
|
|
15
|
+
"--json",
|
|
16
|
+
"--yes",
|
|
17
|
+
])).toEqual({
|
|
18
|
+
directory: "demo",
|
|
19
|
+
surface: "hono",
|
|
20
|
+
packageManager: "pnpm",
|
|
21
|
+
dryRun: true,
|
|
22
|
+
json: true,
|
|
23
|
+
yes: true,
|
|
24
|
+
install: true,
|
|
25
|
+
durability: "memory",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
it("emits the same dry-run plan without writing", async () => {
|
|
29
|
+
const cwd = await mkdtemp(join(tmpdir(), "meterkit-cli-"));
|
|
30
|
+
const output = [];
|
|
31
|
+
const args = ["demo", "--surface", "express", "--dry-run", "--json"];
|
|
32
|
+
expect(await runCli(args, { cwd, stdout: (value) => output.push(value) })).toBe(0);
|
|
33
|
+
const first = output.join("");
|
|
34
|
+
output.length = 0;
|
|
35
|
+
expect(await runCli(args, { cwd, stdout: (value) => output.push(value) })).toBe(0);
|
|
36
|
+
expect(output.join("")).toBe(first);
|
|
37
|
+
await expect(readFile(join(cwd, "demo", "package.json"))).rejects.toThrow();
|
|
38
|
+
});
|
|
39
|
+
it("uses stable invalid-input diagnostics", async () => {
|
|
40
|
+
const errors = [];
|
|
41
|
+
expect(await runCli(["demo", "--surface", "rails"], {
|
|
42
|
+
cwd: process.cwd(),
|
|
43
|
+
stderr: (value) => errors.push(value),
|
|
44
|
+
})).toBe(2);
|
|
45
|
+
expect(errors.join("")).toContain("INVALID_INPUT");
|
|
46
|
+
});
|
|
47
|
+
it("collects the guided bare-command choices only in a TTY", async () => {
|
|
48
|
+
const cwd = await mkdtemp(join(tmpdir(), "meterkit-guided-"));
|
|
49
|
+
const answers = {
|
|
50
|
+
directory: "guided-app",
|
|
51
|
+
surface: "hono",
|
|
52
|
+
packageManager: "npm",
|
|
53
|
+
recipient: "7NXuBzJ3EQV4CuxpSVELD3t1bs5xZ6ocfGvwjFDbCZUE",
|
|
54
|
+
install: false,
|
|
55
|
+
};
|
|
56
|
+
const output = [];
|
|
57
|
+
expect(await runCli([], {
|
|
58
|
+
cwd,
|
|
59
|
+
isTTY: true,
|
|
60
|
+
prompt: async (request) => answers[request.id],
|
|
61
|
+
stdout: (value) => output.push(value),
|
|
62
|
+
})).toBe(0);
|
|
63
|
+
expect(output.join("")).toContain("guided-app");
|
|
64
|
+
expect(output.join("")).toContain("npm");
|
|
65
|
+
});
|
|
66
|
+
it("never prompts in a non-interactive shell", async () => {
|
|
67
|
+
let prompted = false;
|
|
68
|
+
const errors = [];
|
|
69
|
+
expect(await runCli([], {
|
|
70
|
+
isTTY: false,
|
|
71
|
+
prompt: async () => {
|
|
72
|
+
prompted = true;
|
|
73
|
+
return "unexpected";
|
|
74
|
+
},
|
|
75
|
+
stderr: (value) => errors.push(value),
|
|
76
|
+
})).toBe(2);
|
|
77
|
+
expect(prompted).toBe(false);
|
|
78
|
+
expect(errors.join("")).toContain("directory is required");
|
|
79
|
+
});
|
|
80
|
+
it("honors complete non-interactive install flags and recipient", () => {
|
|
81
|
+
expect(parseCliArguments([
|
|
82
|
+
"automated-app",
|
|
83
|
+
"--surface",
|
|
84
|
+
"express",
|
|
85
|
+
"--package-manager",
|
|
86
|
+
"npm",
|
|
87
|
+
"--recipient",
|
|
88
|
+
"7NXuBzJ3EQV4CuxpSVELD3t1bs5xZ6ocfGvwjFDbCZUE",
|
|
89
|
+
"--no-install",
|
|
90
|
+
"--yes",
|
|
91
|
+
])).toMatchObject({
|
|
92
|
+
directory: "automated-app",
|
|
93
|
+
surface: "express",
|
|
94
|
+
packageManager: "npm",
|
|
95
|
+
recipient: "7NXuBzJ3EQV4CuxpSVELD3t1bs5xZ6ocfGvwjFDbCZUE",
|
|
96
|
+
install: false,
|
|
97
|
+
yes: true,
|
|
98
|
+
durability: "memory",
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
it("selects PostgreSQL durability explicitly", () => {
|
|
102
|
+
expect(parseCliArguments(["durable", "--store", "postgres"]).durability).toBe("postgres");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL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C,CAAC,CAAC;QACV,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,CACJ,iBAAiB,CAAC;YAChB,eAAe;YACf,WAAW;YACX,SAAS;YACT,mBAAmB;YACnB,KAAK;YACL,aAAa;YACb,8CAA8C;YAC9C,cAAc;YACd,OAAO;SACR,CAAC,CACH,CAAC,aAAa,CAAC;YACd,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE,SAAS;YAClB,cAAc,EAAE,KAAK;YACrB,SAAS,EAAE,8CAA8C;YACzD,OAAO,EAAE,KAAK;YACd,GAAG,EAAE,IAAI;YACT,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,CACJ,iBAAiB,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CACjE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/plan.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InitializerPlan } from "@usemeterkit/core";
|
|
2
|
+
export interface InitializerOptions {
|
|
3
|
+
surface: unknown;
|
|
4
|
+
packageManager: unknown;
|
|
5
|
+
targetDirectory: string;
|
|
6
|
+
network?: unknown;
|
|
7
|
+
recipient?: string;
|
|
8
|
+
durability?: unknown;
|
|
9
|
+
templatePathOverride?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createInitializerPlan(options: InitializerOptions): Promise<InitializerPlan>;
|
|
12
|
+
export declare function templateRootFor(surface: InitializerPlan["surface"]): string;
|