kitcn 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +13 -0
- package/package.json +1 -1
- package/skills/convex/references/features/auth.md +7 -1
- package/skills/convex/references/setup/auth.md +3 -3
- package/skills/convex/references/setup/index.md +16 -6
- package/skills/convex/references/setup/react.md +0 -1
- package/skills/convex/references/setup/server.md +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -2521,6 +2521,16 @@ const applyDependencyHintsInstall = async (dependencyHints, execaFn) => {
|
|
|
2521
2521
|
});
|
|
2522
2522
|
return missingDependencyHints;
|
|
2523
2523
|
};
|
|
2524
|
+
const applyPlanningDependencyInstall = async (dependencySpecs, execaFn) => {
|
|
2525
|
+
const missingDependencySpecs = resolveMissingDependencyHints(dependencySpecs);
|
|
2526
|
+
if (missingDependencySpecs.length === 0) return [];
|
|
2527
|
+
const { packageJsonPath } = resolvePackageJsonInstallTarget();
|
|
2528
|
+
await execaFn("bun", ["add", ...missingDependencySpecs], {
|
|
2529
|
+
cwd: dirname(packageJsonPath),
|
|
2530
|
+
stdio: "inherit"
|
|
2531
|
+
});
|
|
2532
|
+
return missingDependencySpecs;
|
|
2533
|
+
};
|
|
2524
2534
|
const applyPluginDependencyInstall = async (install, execaFn) => {
|
|
2525
2535
|
if (install.skipped || !install.packageName || !install.packageJsonPath) return install;
|
|
2526
2536
|
const packageSpec = install.packageSpec ?? install.packageName;
|
|
@@ -5633,6 +5643,7 @@ const authRegistryItem = defineInternalRegistryItem({
|
|
|
5633
5643
|
},
|
|
5634
5644
|
internal: {
|
|
5635
5645
|
localDocsPath: "www/content/docs/auth/server.mdx",
|
|
5646
|
+
planningDependencies: [OPENTELEMETRY_API_INSTALL_SPEC],
|
|
5636
5647
|
envFields: AUTH_ENV_FIELDS,
|
|
5637
5648
|
liveBootstrap: { mode: "local" },
|
|
5638
5649
|
schemaRegistration: {
|
|
@@ -7297,6 +7308,7 @@ function toPluginCatalogEntry(definition) {
|
|
|
7297
7308
|
},
|
|
7298
7309
|
packageName: getPackageNameFromInstallSpec(installDependency),
|
|
7299
7310
|
packageInstallSpec: installDependency,
|
|
7311
|
+
planningDependencies: internal.planningDependencies,
|
|
7300
7312
|
envFields: internal.envFields,
|
|
7301
7313
|
liveBootstrap: internal.liveBootstrap,
|
|
7302
7314
|
schemaRegistration: internal.schemaRegistration,
|
|
@@ -11941,6 +11953,7 @@ const handleAddCommand = async (argv, deps = {}) => {
|
|
|
11941
11953
|
templates: selectedTemplates
|
|
11942
11954
|
})) throw new Error(AUTH_SCHEMA_ONLY_MISSING_ERROR);
|
|
11943
11955
|
}
|
|
11956
|
+
if (!addArgs.dryRun) await applyPlanningDependencyInstall(pluginDescriptor.planningDependencies ?? [], execaFn);
|
|
11944
11957
|
const plan = filterPluginInstallPlanForAddScope({
|
|
11945
11958
|
plan: await buildPluginInstallPlan({
|
|
11946
11959
|
applyScope,
|
package/package.json
CHANGED
|
@@ -69,7 +69,7 @@ Use the CLI-first path:
|
|
|
69
69
|
npx kitcn add auth --yes
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
If kitcn is not bootstrapped yet, start with `npx kitcn init -t next --yes` for a fresh app or `npx kitcn init --yes` for in-place adoption.
|
|
72
|
+
If kitcn is not bootstrapped yet, start with `npx kitcn@latest init -t next --yes` for a fresh app or `npx kitcn@latest init --yes` for in-place adoption.
|
|
73
73
|
|
|
74
74
|
On local Convex, `add auth --yes` also finishes the first auth bootstrap pass: generated runtime, `BETTER_AUTH_SECRET`, and `JWKS`.
|
|
75
75
|
|
|
@@ -279,6 +279,12 @@ export const {
|
|
|
279
279
|
|
|
280
280
|
### Sign In
|
|
281
281
|
|
|
282
|
+
Rule:
|
|
283
|
+
|
|
284
|
+
1. The standard Next local path assumes `NEXT_PUBLIC_SITE_URL=http://localhost:3000`.
|
|
285
|
+
2. If the app runs on another port, update `.env.local` `NEXT_PUBLIC_SITE_URL`,
|
|
286
|
+
`convex/.env` `SITE_URL`, and the app dev script together.
|
|
287
|
+
|
|
282
288
|
**Social:**
|
|
283
289
|
```ts
|
|
284
290
|
const signInSocial = useMutation(useSignInSocialMutationOptions());
|
|
@@ -7,10 +7,10 @@ Feature gate: only apply this section if auth is enabled.
|
|
|
7
7
|
If kitcn is not bootstrapped yet, start there first:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npx kitcn@latest init -t next --yes
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Use `
|
|
13
|
+
Use `npx kitcn@latest init --yes` instead for in-place adoption of the
|
|
14
14
|
current supported app.
|
|
15
15
|
|
|
16
16
|
Then install auth:
|
|
@@ -82,7 +82,7 @@ export default defineAuth(() => ({
|
|
|
82
82
|
|
|
83
83
|
Canonical rule:
|
|
84
84
|
|
|
85
|
-
1. `
|
|
85
|
+
1. `npx kitcn@latest init --yes`, `bunx kitcn dev`, and `bunx kitcn add auth --yes` all drive generation of `convex/functions/generated/` when they own the local Convex flow.
|
|
86
86
|
2. `auth.ts` default-exports `defineAuth(() => ({ ...options, triggers }))` imported from `./generated/auth`.
|
|
87
87
|
3. Import runtime auth contract (`getAuth`, `authClient`, CRUD/triggers, `auth`) from `<functionsDir>/generated/auth`.
|
|
88
88
|
4. If `auth.ts` is missing or incomplete, codegen still succeeds and generated runtime exports `authEnabled = false` with setup guidance at call time.
|
|
@@ -86,7 +86,7 @@ Quickstart path:
|
|
|
86
86
|
```bash
|
|
87
87
|
mkdir my-app
|
|
88
88
|
cd my-app
|
|
89
|
-
|
|
89
|
+
npx kitcn@latest init -t next --yes
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Then start the long-running backend with `bunx kitcn dev`, run the
|
|
@@ -99,19 +99,19 @@ Use the CLI first:
|
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
# Adopt the current supported app in place
|
|
102
|
-
|
|
102
|
+
npx kitcn@latest init --yes
|
|
103
103
|
|
|
104
104
|
# Adopt the current supported app on Concave
|
|
105
|
-
|
|
105
|
+
npx kitcn@latest --backend concave init --yes
|
|
106
106
|
|
|
107
107
|
# New Next.js app with deterministic shadcn bootstrap + first local Convex bootstrap
|
|
108
|
-
|
|
108
|
+
npx kitcn@latest init -t next --yes
|
|
109
109
|
|
|
110
110
|
# New Vite app with the React baseline + first local Convex bootstrap
|
|
111
|
-
|
|
111
|
+
npx kitcn@latest init -t vite --yes
|
|
112
112
|
|
|
113
113
|
# Nested app target
|
|
114
|
-
|
|
114
|
+
npx kitcn@latest init -t next --yes --cwd apps --name web
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
Then add only the features you want:
|
|
@@ -373,6 +373,13 @@ NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
|
|
373
373
|
|
|
374
374
|
Rule: real-time URL uses `.cloud`; HTTP/router/caller URL uses `.site`.
|
|
375
375
|
|
|
376
|
+
Local auth contract:
|
|
377
|
+
|
|
378
|
+
1. Default app origin is `http://localhost:3000`.
|
|
379
|
+
2. If you move the app to another local port, update `.env.local`
|
|
380
|
+
`NEXT_PUBLIC_SITE_URL`, `convex/.env` `SITE_URL`, and the app dev script
|
|
381
|
+
together.
|
|
382
|
+
|
|
376
383
|
### 4.3 Typed env helper (recommended for full backend parity)
|
|
377
384
|
|
|
378
385
|
When multiple Convex functions and libs share env values (auth, billing, dev guards), create one typed helper:
|
|
@@ -598,6 +605,7 @@ CLI commands:
|
|
|
598
605
|
```bash
|
|
599
606
|
bunx kitcn dev
|
|
600
607
|
# deterministic one-shot local runtime proof:
|
|
608
|
+
# stop any long-running local backend first
|
|
601
609
|
bunx kitcn verify
|
|
602
610
|
# optional fallback only if dev cannot run and backend is already active:
|
|
603
611
|
bunx kitcn codegen
|
|
@@ -622,6 +630,7 @@ dev session and auto-pushes later edits. Keep `env push` for `--prod`,
|
|
|
622
630
|
Run these after base setup (Sections 3-5) and before starting Section 6:
|
|
623
631
|
|
|
624
632
|
```bash
|
|
633
|
+
# stop any long-running local backend first
|
|
625
634
|
bunx kitcn verify
|
|
626
635
|
bunx convex run internal.seed.seed
|
|
627
636
|
bunx convex run internal.init.default
|
|
@@ -643,6 +652,7 @@ Then sanity-check runtime paths (non-auth only):
|
|
|
643
652
|
Run this after Section 6 and before Sections 7-10:
|
|
644
653
|
|
|
645
654
|
```bash
|
|
655
|
+
# stop any long-running local backend first
|
|
646
656
|
bunx kitcn verify
|
|
647
657
|
bun run typecheck || bunx tsc --noEmit
|
|
648
658
|
bun test
|
|
@@ -172,4 +172,3 @@ Provider mount checklist:
|
|
|
172
172
|
1. `AppConvexProvider` wraps app routes before client feature components render.
|
|
173
173
|
2. `CRPCProvider` is nested inside TanStack Query provider (`QueryClientProvider`).
|
|
174
174
|
3. Next.js apps pass token where required (Section 8.A.4) or intentionally run without token for public-only paths.
|
|
175
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## 5. Core Backend
|
|
2
2
|
|
|
3
|
-
For production bootstrap, start in the CLI Registry: use `
|
|
3
|
+
For production bootstrap, start in the CLI Registry: use `npx kitcn@latest init -t <next|vite> --yes` for the shortest fresh local path, `npx kitcn@latest init --yes` to adopt the current app and finish the first local Convex bootstrap in one command, and `bunx kitcn add <plugin>` for feature layers. This file is the manual backend wiring reference.
|
|
4
4
|
|
|
5
5
|
### 5.1 Define schema and relations
|
|
6
6
|
|
|
@@ -204,8 +204,8 @@ Do not fake generated files.
|
|
|
204
204
|
|
|
205
205
|
Automation/non-interactive path:
|
|
206
206
|
|
|
207
|
-
1. Run `
|
|
208
|
-
2. Run `bunx kitcn verify` when you want a non-interactive local runtime proof in the current app. It reuses an existing local deployment when one is already configured, and only falls back to anonymous fresh-local setup when it has to.
|
|
207
|
+
1. Run `npx kitcn@latest init --yes` when you want scaffold or adoption plus the one-shot local Convex bootstrap in one command.
|
|
208
|
+
2. Run `bunx kitcn verify` when you want a non-interactive local runtime proof in the current app. Stop any long-running local backend first. It reuses an existing local deployment when one is already configured, and only falls back to anonymous fresh-local setup when it has to.
|
|
209
209
|
3. Confirm the generated runtime exists in `convex/functions/generated/server.ts`.
|
|
210
210
|
4. Then run `bunx kitcn dev` for ongoing codegen/API refresh.
|
|
211
211
|
|
|
@@ -222,7 +222,7 @@ Agent command policy:
|
|
|
222
222
|
1. Default to `bunx kitcn dev`.
|
|
223
223
|
2. `kitcn dev` already runs codegen/API generation.
|
|
224
224
|
3. Do not run `bunx kitcn codegen` as a separate default step.
|
|
225
|
-
4. Use `bunx kitcn verify` for one-shot local runtime proof in CI or agent runs.
|
|
225
|
+
4. Use `bunx kitcn verify` for one-shot local runtime proof in CI or agent runs, with any long-running local backend stopped first.
|
|
226
226
|
5. Use manual `bunx kitcn codegen` only as fallback when `kitcn dev` cannot be run and backend is already active.
|
|
227
227
|
6. Use `bunx kitcn insights` for cloud-deployment debugging; it forwards to the upstream Convex insights CLI.
|
|
228
228
|
|