create-disposabl-app 0.9.1 → 0.10.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.
Files changed (25) hide show
  1. package/dist/disposabl.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
  4. package/dist/templates/default/bun.lock +72 -178
  5. package/dist/templates/default/package.json +1 -2
  6. package/dist/templates/default/packages/backend/README.md +3 -1
  7. package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +6 -0
  8. package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +0 -2
  9. package/dist/templates/default/packages/backend/convex/auth.config.ts +2 -10
  10. package/dist/templates/default/packages/backend/convex/convex.config.ts +3 -14
  11. package/dist/templates/default/packages/backend/convex/mcpEnterprise/README.md +42 -0
  12. package/dist/templates/default/packages/backend/convex/mcpEnterprise/internal.ts +153 -0
  13. package/dist/templates/default/packages/backend/convex/mcpEnterprise/provision.ts +102 -0
  14. package/dist/templates/default/packages/backend/convex/mcpEnterprise/validator.ts +35 -0
  15. package/dist/templates/default/packages/backend/convex/schema.ts +18 -0
  16. package/dist/templates/default/packages/backend/package.json +0 -1
  17. package/dist/templates/default/packages/disposabl-kit/package.json +4 -2
  18. package/dist/templates/default/packages/disposabl-kit/server/http.ts +19 -12
  19. package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +12 -0
  20. package/dist/templates/default/packages/disposabl-kit/server/mcp/enterprise.ts +267 -0
  21. package/dist/templates/default/packages/disposabl-kit/server/mcp/identity.ts +33 -0
  22. package/dist/templates/default/vendor/README.md +30 -0
  23. package/dist/templates/default/vendor/convex-auth-6c0ebf3f.tgz +0 -0
  24. package/package.json +1 -1
  25. package/dist/templates/default/patches/@convex-dev%2Fauth@2.0.0-beta.0.patch +0 -310
@@ -0,0 +1,33 @@
1
+ /** Claude publishes this public client with token_endpoint_auth_method: none. */
2
+ export const CLAUDE_CLIENT_ID =
3
+ "https://claude.ai/oauth/mcp-oauth-client-metadata";
4
+ export const JWT_GRANT = "urn:ietf:params:oauth:grant-type:jwt-bearer";
5
+ export const ID_JAG_PROFILE = "urn:ietf:params:oauth:grant-profile:id-jag";
6
+ export const TOKEN_PREFIX = "mcp_ema_";
7
+
8
+ export function claudeIssuer(value: string) {
9
+ if (
10
+ !/^https:\/\/identity\.anthropic\.com\/issuers\/[A-Za-z0-9_-]+$/.test(value)
11
+ )
12
+ throw new Error(
13
+ "Use the exact Claude organization issuer URL, without a trailing slash.",
14
+ );
15
+ return value;
16
+ }
17
+
18
+ export function normalizeEmail(value: string) {
19
+ const email = value.trim().toLowerCase();
20
+ if (email.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))
21
+ throw new Error("A verified email is required.");
22
+ return email;
23
+ }
24
+
25
+ export async function tokenHash(value: string) {
26
+ const bytes = await crypto.subtle.digest(
27
+ "SHA-256",
28
+ new TextEncoder().encode(value),
29
+ );
30
+ return Array.from(new Uint8Array(bytes), (byte) =>
31
+ byte.toString(16).padStart(2, "0"),
32
+ ).join("");
33
+ }
@@ -0,0 +1,30 @@
1
+ # Convex Auth reboot snapshot
2
+
3
+ `convex-auth-6c0ebf3f.tgz` contains `@convex-dev/auth` built from [convex/convex-auth](https://github.com/convex/convex-auth) commit [`6c0ebf3f1403e95cbc67536aa32e4fb03280be23`](https://github.com/convex/convex-auth/commit/6c0ebf3f1403e95cbc67536aa32e4fb03280be23), on the `reboot` branch, checked on 2026-11-04.
4
+
5
+ The package version is `2.0.0-beta.0-reboot.6c0ebf3f` to distinguish it from the published beta. Source code is unchanged. The archive includes the Apache 2.0 license declared by upstream.
6
+
7
+ SHA-256: `16b88c41043d948d2c04325283eb7532461c5defa50837984b337ec77f509a57`.
8
+
9
+ The root catalog references this archive, and the generator includes it in new apps. Builds install this exact snapshot without depending on a moving branch or executing an upstream Git prepare hook.
10
+
11
+ ## Rebuild
12
+
13
+ Check out the exact commit in a separate directory. Install its pinned workspace dependencies with `pnpm install --frozen-lockfile`. Run the core package's `build` command, which produces both public and internal declaration files. Change only the core package version to the snapshot version above, include the Apache 2.0 LICENSE, and use `npm pack --ignore-scripts` in `packages/core`. Review and record the resulting archive checksum before updating it here. The archive includes source and compiled output.
14
+
15
+ ## Existing deployments need a migration
16
+
17
+ Fresh apps need no session migration. Existing deployments must perform the migration below before deploying this snapshot.
18
+
19
+ Upstream removed fields from both `auth/sessions` and `auth/refreshTokens`, changed the JWT subject to the session ID, moved signing to Convex deployment-issued JWTs, and changed the audience to `convex-auth`. The app now uses `convexAuthProvider()` and no longer generates or binds `AUTH_PRIVATE_KEY` and `AUTH_JWKS`.
20
+
21
+ Before upgrading an existing deployment:
22
+
23
+ 1. Back up that deployment, including authentication components.
24
+ 2. Schedule a sign-out window and obtain approval to invalidate all sessions.
25
+ 3. Follow upstream's migration requirement to clear only the auth component's sessions and refreshTokens tables, then deploy the new package and auth configuration together. This signs everyone out. Do not delete users, credentials, other auth components, or app data.
26
+ 4. Verify sign-in, refresh, sign-out, authenticated queries, and existing account access on the deployed app.
27
+
28
+ Do not apply the upgrade to production automatically. Old deployment environment keys can remain until the migration succeeds; this change does not delete them.
29
+
30
+ Upstream migration notes: [session schema change](https://github.com/convex/convex-auth/commit/0fdc1bac), [refresh-token schema change](https://github.com/convex/convex-auth/commit/07911f86230f86ff61655559e8fd278a843ca084).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,310 +0,0 @@
1
- diff --git a/dist/cli/program.d.ts b/dist/cli/program.d.ts
2
- index bd6fd586968841cfda5aff80bb943f27d1a9e75d..793c51c8fdb474be84d2518c2a7382790be2f16c 100644
3
- --- a/dist/cli/program.d.ts
4
- +++ b/dist/cli/program.d.ts
5
- @@ -56,7 +56,7 @@ export declare function installCommand(packageManager: string): "pnpm add @conve
6
- */
7
- export declare function detectPackageManager(dir: string, env?: NodeJS.ProcessEnv): PackageManager;
8
- /** The real implementations, injected into `runInit` (overridden in tests). */
9
- -export declare function defaultDeps(): InitDeps;
10
- +export declare function defaultDeps(deploymentArgs?: string[]): InitDeps;
11
- /**
12
- * Run the full initialization against the injected `deps`. Fatal problems are
13
- * reported via `command.error`, which prints to stderr and exits (or throws a
14
- @@ -64,6 +64,7 @@ export declare function defaultDeps(): InitDeps;
15
- */
16
- declare function runInit(deps: InitDeps, options: {
17
- force?: boolean;
18
- + keysOnly?: boolean;
19
- }, command: Command): Promise<void>;
20
- /** Build the commander program, wired to the given dependencies. */
21
- export declare function createProgram(deps?: InitDeps): Command;
22
- diff --git a/dist/cli/program.js b/dist/cli/program.js
23
- index 81d8f6d54dfcbae2662504b4b57ae3ee5b224ebf..d5795d97273aa4b00d11ef62a17f3e4532dc8d84 100644
24
- --- a/dist/cli/program.js
25
- +++ b/dist/cli/program.js
26
- @@ -18,7 +18,7 @@
27
- // TODO(nicolas) This is a rough draft. Ideally, we simplify the setup process
28
- // (e.g. by skipping the need for a key pair generation + simplyfying the API)
29
- // so that users don’t need to rely on this.
30
- -import { Command } from "commander";
31
- +import { Command, Option } from "commander";
32
- import { generateKeyPair, exportPKCS8, exportJWK } from "jose";
33
- import { randomUUID } from "node:crypto";
34
- import { spawnSync } from "node:child_process";
35
- @@ -138,8 +138,8 @@ async function generateAuthKeys() {
36
- };
37
- }
38
- /** Read an env var off the current directory's Convex deployment. */
39
- -function getConvexEnv(key) {
40
- - const result = spawnSync("npx", ["convex", "env", "get", key], {
41
- +function getConvexEnv(key, deploymentArgs) {
42
- + const result = spawnSync("bunx", ["--no-install", "convex", "env", "get", key, ...deploymentArgs], {
43
- cwd: process.cwd(),
44
- encoding: "utf8",
45
- });
46
- @@ -153,21 +153,19 @@ function getConvexEnv(key) {
47
- *
48
- * The output of the Convex CLI is captured, not printed: it echoes the value it
49
- * sets, and one of the values here is the private signing key. If the command
50
- - * fails, its stderr goes into the error message.
51
- + * fails, only a sanitized error is returned.
52
- */
53
- -function setConvexEnv(key, value) {
54
- - const result = spawnSync("npx", ["convex", "env", "set", key, value], {
55
- +function setConvexEnv(key, value, deploymentArgs) {
56
- + const result = spawnSync("bunx", ["--no-install", "convex", "env", "set", key, value, ...deploymentArgs], {
57
- cwd: process.cwd(),
58
- encoding: "utf8",
59
- });
60
- if (result.status !== 0) {
61
- - const reason = (result.stderr ?? "").trim();
62
- - throw new Error(`Could not set ${key} on the Convex deployment.` +
63
- - (reason.length > 0 ? `\n\n${indent(reason)}` : ""));
64
- + throw new Error(`Could not set ${key} on the selected Convex deployment.`);
65
- }
66
- }
67
- /** The real implementations, injected into `runInit` (overridden in tests). */
68
- -export function defaultDeps() {
69
- +export function defaultDeps(deploymentArgs = []) {
70
- return {
71
- cwd: () => process.cwd(),
72
- fs: {
73
- @@ -180,8 +178,8 @@ export function defaultDeps() {
74
- warn: (message) => console.warn(message),
75
- spinner: startSpinner,
76
- generateKeys: generateAuthKeys,
77
- - getEnv: getConvexEnv,
78
- - setEnv: setConvexEnv,
79
- + getEnv: (key) => getConvexEnv(key, deploymentArgs),
80
- + setEnv: (key, value) => setConvexEnv(key, value, deploymentArgs),
81
- detectPackageManager,
82
- };
83
- }
84
- @@ -216,10 +214,15 @@ function indent(text) {
85
- */
86
- async function ensureAuthKeys(deps, force) {
87
- const reading = deps.spinner("Reading the deployment environment…");
88
- - const isSet = deps.getEnv("AUTH_PRIVATE_KEY") && deps.getEnv("AUTH_JWKS");
89
- + const privateKey = deps.getEnv("AUTH_PRIVATE_KEY");
90
- + const jwks = deps.getEnv("AUTH_JWKS");
91
- + const isSet = privateKey && jwks;
92
- reading.stop();
93
- if (!force && isSet)
94
- return "kept";
95
- + if (!force && Boolean(privateKey) !== Boolean(jwks)) {
96
- + throw new Error("Partial Auth key configuration; restore the matching missing key. Existing keys were preserved.");
97
- + }
98
- const generating = deps.spinner("Generating an RS256 key pair…");
99
- const { authPrivateKey, authJwks } = await deps.generateKeys();
100
- generating.stop();
101
- @@ -323,23 +326,43 @@ async function runInit(deps, options, command) {
102
- deps.log(`${chalk.bold("Convex Auth")} ${chalk.dim(`setup in ${dir}`)}`);
103
- const keyOutcome = await ensureAuthKeys(deps, options.force ?? false);
104
- reportKeys(deps, keyOutcome);
105
- - reportFiles(deps, writeAuthFiles(deps, dir));
106
- - reportNextSteps(deps);
107
- + if (!options.keysOnly) {
108
- + reportFiles(deps, writeAuthFiles(deps, dir));
109
- + reportNextSteps(deps);
110
- + }
111
- }
112
- /** Build the commander program, wired to the given dependencies. */
113
- -export function createProgram(deps = defaultDeps()) {
114
- +export function createProgram(deps) {
115
- const program = new Command();
116
- program
117
- .name("@convex-dev/auth")
118
- .description("Set up Convex Auth in this project: put the signing keys on the " +
119
- "Convex deployment, and scaffold the convex/ files.")
120
- .option("--force", "Regenerate the auth signing keys even if already set")
121
- + .option("--keys-only", "Set up signing keys without scaffolding files")
122
- + .option("--prod", "Set up signing keys on production")
123
- + .addOption(new Option("--preview-name <name>", "Set up signing keys on a named preview").conflicts("prod"))
124
- // Mark every failure with the same symbol, both ours (`command.error`) and
125
- // the ones commander itself writes, which start with "error: ".
126
- .configureOutput({
127
- outputError: (text, write) => write(`${symbols.failed} ${text.replace(/^error: /, "")}`),
128
- })
129
- - .action((options, command) => runInit(deps, options, command));
130
- + .action((options, command) => {
131
- + if (options.previewName !== undefined && (!options.previewName.trim() || options.previewName.startsWith("-"))) {
132
- + command.error("--preview-name must identify a preview deployment");
133
- + }
134
- + const key = process.env.CONVEX_DEPLOY_KEY;
135
- + if (key && options.previewName && !key.startsWith("preview:")) {
136
- + command.error("Preview setup requires a preview project deploy key.");
137
- + }
138
- + if (key && options.prod && !key.startsWith("prod:")) {
139
- + command.error("Production setup requires a production deploy key.");
140
- + }
141
- + const deploymentArgs = options.previewName
142
- + ? ["--preview-name", options.previewName]
143
- + : options.prod ? ["--prod"] : [];
144
- + return runInit(deps ?? defaultDeps(deploymentArgs), options, command);
145
- + });
146
- return program;
147
- }
148
- export { runInit };
149
- diff --git a/dist/internal-types/cli/program.d.ts b/dist/internal-types/cli/program.d.ts
150
- index bd6fd586968841cfda5aff80bb943f27d1a9e75d..793c51c8fdb474be84d2518c2a7382790be2f16c 100644
151
- --- a/dist/internal-types/cli/program.d.ts
152
- +++ b/dist/internal-types/cli/program.d.ts
153
- @@ -56,7 +56,7 @@ export declare function installCommand(packageManager: string): "pnpm add @conve
154
- */
155
- export declare function detectPackageManager(dir: string, env?: NodeJS.ProcessEnv): PackageManager;
156
- /** The real implementations, injected into `runInit` (overridden in tests). */
157
- -export declare function defaultDeps(): InitDeps;
158
- +export declare function defaultDeps(deploymentArgs?: string[]): InitDeps;
159
- /**
160
- * Run the full initialization against the injected `deps`. Fatal problems are
161
- * reported via `command.error`, which prints to stderr and exits (or throws a
162
- @@ -64,6 +64,7 @@ export declare function defaultDeps(): InitDeps;
163
- */
164
- declare function runInit(deps: InitDeps, options: {
165
- force?: boolean;
166
- + keysOnly?: boolean;
167
- }, command: Command): Promise<void>;
168
- /** Build the commander program, wired to the given dependencies. */
169
- export declare function createProgram(deps?: InitDeps): Command;
170
- diff --git a/src/cli/program.ts b/src/cli/program.ts
171
- index a437ec4aa701ff90839badf12279350342b83d31..5aae1fd9b0a35757e290ea79c55519b002999bf6 100644
172
- --- a/src/cli/program.ts
173
- +++ b/src/cli/program.ts
174
- @@ -20,7 +20,7 @@
175
- // (e.g. by skipping the need for a key pair generation + simplyfying the API)
176
- // so that users don’t need to rely on this.
177
-
178
- -import { Command } from "commander";
179
- +import { Command, Option } from "commander";
180
- import { generateKeyPair, exportPKCS8, exportJWK } from "jose";
181
- import { randomUUID } from "node:crypto";
182
- import { spawnSync } from "node:child_process";
183
- @@ -191,8 +191,8 @@ async function generateAuthKeys() {
184
- }
185
-
186
- /** Read an env var off the current directory's Convex deployment. */
187
- -function getConvexEnv(key: string) {
188
- - const result = spawnSync("npx", ["convex", "env", "get", key], {
189
- +function getConvexEnv(key: string, deploymentArgs: string[]) {
190
- + const result = spawnSync("bunx", ["--no-install", "convex", "env", "get", key, ...deploymentArgs], {
191
- cwd: process.cwd(),
192
- encoding: "utf8",
193
- });
194
- @@ -206,24 +206,20 @@ function getConvexEnv(key: string) {
195
- *
196
- * The output of the Convex CLI is captured, not printed: it echoes the value it
197
- * sets, and one of the values here is the private signing key. If the command
198
- - * fails, its stderr goes into the error message.
199
- + * fails, only a sanitized error is returned.
200
- */
201
- -function setConvexEnv(key: string, value: string) {
202
- - const result = spawnSync("npx", ["convex", "env", "set", key, value], {
203
- +function setConvexEnv(key: string, value: string, deploymentArgs: string[]) {
204
- + const result = spawnSync("bunx", ["--no-install", "convex", "env", "set", key, value, ...deploymentArgs], {
205
- cwd: process.cwd(),
206
- encoding: "utf8",
207
- });
208
- if (result.status !== 0) {
209
- - const reason = (result.stderr ?? "").trim();
210
- - throw new Error(
211
- - `Could not set ${key} on the Convex deployment.` +
212
- - (reason.length > 0 ? `\n\n${indent(reason)}` : ""),
213
- - );
214
- + throw new Error(`Could not set ${key} on the selected Convex deployment.`);
215
- }
216
- }
217
-
218
- /** The real implementations, injected into `runInit` (overridden in tests). */
219
- -export function defaultDeps(): InitDeps {
220
- +export function defaultDeps(deploymentArgs: string[] = []): InitDeps {
221
- return {
222
- cwd: () => process.cwd(),
223
- fs: {
224
- @@ -236,8 +232,8 @@ export function defaultDeps(): InitDeps {
225
- warn: (message) => console.warn(message),
226
- spinner: startSpinner,
227
- generateKeys: generateAuthKeys,
228
- - getEnv: getConvexEnv,
229
- - setEnv: setConvexEnv,
230
- + getEnv: (key) => getConvexEnv(key, deploymentArgs),
231
- + setEnv: (key, value) => setConvexEnv(key, value, deploymentArgs),
232
- detectPackageManager,
233
- };
234
- }
235
- @@ -286,9 +282,14 @@ async function ensureAuthKeys(
236
- force: boolean,
237
- ): Promise<KeyOutcome> {
238
- const reading = deps.spinner("Reading the deployment environment…");
239
- - const isSet = deps.getEnv("AUTH_PRIVATE_KEY") && deps.getEnv("AUTH_JWKS");
240
- + const privateKey = deps.getEnv("AUTH_PRIVATE_KEY");
241
- + const jwks = deps.getEnv("AUTH_JWKS");
242
- + const isSet = privateKey && jwks;
243
- reading.stop();
244
- if (!force && isSet) return "kept";
245
- + if (!force && Boolean(privateKey) !== Boolean(jwks)) {
246
- + throw new Error("Partial Auth key configuration; restore the matching missing key. Existing keys were preserved.");
247
- + }
248
-
249
- const generating = deps.spinner("Generating an RS256 key pair…");
250
- const { authPrivateKey, authJwks } = await deps.generateKeys();
251
- @@ -391,7 +392,7 @@ function reportNextSteps(deps: InitDeps) {
252
- */
253
- async function runInit(
254
- deps: InitDeps,
255
- - options: { force?: boolean },
256
- + options: { force?: boolean; keysOnly?: boolean },
257
- command: Command,
258
- ) {
259
- const dir = deps.cwd();
260
- @@ -431,12 +432,14 @@ async function runInit(
261
- const keyOutcome = await ensureAuthKeys(deps, options.force ?? false);
262
- reportKeys(deps, keyOutcome);
263
-
264
- - reportFiles(deps, writeAuthFiles(deps, dir));
265
- - reportNextSteps(deps);
266
- + if (!options.keysOnly) {
267
- + reportFiles(deps, writeAuthFiles(deps, dir));
268
- + reportNextSteps(deps);
269
- + }
270
- }
271
-
272
- /** Build the commander program, wired to the given dependencies. */
273
- -export function createProgram(deps: InitDeps = defaultDeps()) {
274
- +export function createProgram(deps?: InitDeps) {
275
- const program = new Command();
276
- program
277
- .name("@convex-dev/auth")
278
- @@ -445,13 +448,31 @@ export function createProgram(deps: InitDeps = defaultDeps()) {
279
- "Convex deployment, and scaffold the convex/ files.",
280
- )
281
- .option("--force", "Regenerate the auth signing keys even if already set")
282
- + .option("--keys-only", "Set up signing keys without scaffolding files")
283
- + .option("--prod", "Set up signing keys on production")
284
- + .addOption(new Option("--preview-name <name>", "Set up signing keys on a named preview").conflicts("prod"))
285
- // Mark every failure with the same symbol, both ours (`command.error`) and
286
- // the ones commander itself writes, which start with "error: ".
287
- .configureOutput({
288
- outputError: (text, write) =>
289
- write(`${symbols.failed} ${text.replace(/^error: /, "")}`),
290
- })
291
- - .action((options, command) => runInit(deps, options, command));
292
- + .action((options, command) => {
293
- + if (options.previewName !== undefined && (!options.previewName.trim() || options.previewName.startsWith("-"))) {
294
- + command.error("--preview-name must identify a preview deployment");
295
- + }
296
- + const key = process.env.CONVEX_DEPLOY_KEY;
297
- + if (key && options.previewName && !key.startsWith("preview:")) {
298
- + command.error("Preview setup requires a preview project deploy key.");
299
- + }
300
- + if (key && options.prod && !key.startsWith("prod:")) {
301
- + command.error("Production setup requires a production deploy key.");
302
- + }
303
- + const deploymentArgs = options.previewName
304
- + ? ["--preview-name", options.previewName]
305
- + : options.prod ? ["--prod"] : [];
306
- + return runInit(deps ?? defaultDeps(deploymentArgs), options, command);
307
- + });
308
- return program;
309
- }
310
-