@beignet/cli 0.0.30 → 0.0.32

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 (72) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +49 -6
  3. package/dist/check.d.ts +2 -0
  4. package/dist/check.d.ts.map +1 -1
  5. package/dist/check.js +16 -0
  6. package/dist/check.js.map +1 -1
  7. package/dist/choices.d.ts +22 -2
  8. package/dist/choices.d.ts.map +1 -1
  9. package/dist/choices.js +60 -0
  10. package/dist/choices.js.map +1 -1
  11. package/dist/config.d.ts +1 -0
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/config.js +1 -0
  14. package/dist/config.js.map +1 -1
  15. package/dist/create-prompts.d.ts +6 -2
  16. package/dist/create-prompts.d.ts.map +1 -1
  17. package/dist/create-prompts.js +1 -1
  18. package/dist/create-prompts.js.map +1 -1
  19. package/dist/db.d.ts +5 -5
  20. package/dist/db.d.ts.map +1 -1
  21. package/dist/db.js +4 -4
  22. package/dist/db.js.map +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +107 -26
  25. package/dist/index.js.map +1 -1
  26. package/dist/inspect.d.ts +5 -0
  27. package/dist/inspect.d.ts.map +1 -1
  28. package/dist/inspect.js +8 -4
  29. package/dist/inspect.js.map +1 -1
  30. package/dist/make/shared.d.ts +1 -1
  31. package/dist/make/shared.d.ts.map +1 -1
  32. package/dist/make/shared.js +8 -1
  33. package/dist/make/shared.js.map +1 -1
  34. package/dist/make.d.ts.map +1 -1
  35. package/dist/make.js +7 -10
  36. package/dist/make.js.map +1 -1
  37. package/dist/preflight.d.ts +90 -0
  38. package/dist/preflight.d.ts.map +1 -0
  39. package/dist/preflight.js +423 -0
  40. package/dist/preflight.js.map +1 -0
  41. package/dist/provider-add.d.ts +10 -1
  42. package/dist/provider-add.d.ts.map +1 -1
  43. package/dist/provider-add.js +209 -16
  44. package/dist/provider-add.js.map +1 -1
  45. package/dist/templates/agents.d.ts.map +1 -1
  46. package/dist/templates/agents.js +2 -1
  47. package/dist/templates/agents.js.map +1 -1
  48. package/dist/templates/base.d.ts.map +1 -1
  49. package/dist/templates/base.js +2 -8
  50. package/dist/templates/base.js.map +1 -1
  51. package/dist/templates/server.js +4 -4
  52. package/dist/templates/shared.d.ts +2 -0
  53. package/dist/templates/shared.d.ts.map +1 -1
  54. package/dist/templates/shared.js +2 -0
  55. package/dist/templates/shared.js.map +1 -1
  56. package/package.json +2 -2
  57. package/skills/app-structure/SKILL.md +1 -1
  58. package/src/check.ts +23 -0
  59. package/src/choices.ts +81 -0
  60. package/src/config.ts +2 -0
  61. package/src/create-prompts.ts +8 -2
  62. package/src/db.ts +11 -11
  63. package/src/index.ts +155 -36
  64. package/src/inspect.ts +8 -4
  65. package/src/make/shared.ts +9 -2
  66. package/src/make.ts +7 -11
  67. package/src/preflight.ts +596 -0
  68. package/src/provider-add.ts +223 -16
  69. package/src/templates/agents.ts +2 -1
  70. package/src/templates/base.ts +2 -10
  71. package/src/templates/server.ts +4 -4
  72. package/src/templates/shared.ts +2 -0
package/src/inspect.ts CHANGED
@@ -398,7 +398,11 @@ export function formatDoctor(
398
398
  return lines.join("\n");
399
399
  }
400
400
 
401
- const productionHardeningDiagnosticCodes = new Set([
401
+ /**
402
+ * Doctor diagnostic codes that describe production hardening concerns.
403
+ * `beignet preflight` promotes these to gate failures.
404
+ */
405
+ export const productionHardeningDiagnosticCodes = new Set([
402
406
  "BEIGNET_AUTH_ROUTE_MISSING",
403
407
  "BEIGNET_AUTH_TRUSTED_ORIGINS_MISSING",
404
408
  "BEIGNET_BETTER_AUTH_SECRET_PLACEHOLDER",
@@ -1973,7 +1977,7 @@ const readinessRelevantProviderPackages = new Set([
1973
1977
  "@beignet/provider-mail-smtp",
1974
1978
  "@beignet/provider-payments-stripe",
1975
1979
  "@beignet/provider-rate-limit-upstash",
1976
- "@beignet/provider-redis",
1980
+ "@beignet/provider-cache-redis",
1977
1981
  "@beignet/provider-search-meilisearch",
1978
1982
  "@beignet/provider-storage-s3",
1979
1983
  ]);
@@ -2182,7 +2186,7 @@ async function inspectProductionReadiness(
2182
2186
  severity: "warning",
2183
2187
  code: "BEIGNET_PROVIDER_TABLE_MISSING",
2184
2188
  file: schemaDir,
2185
- message: `${provider.packageName} is installed and ${variant.displayName} is registered, but required table ${tableName} was not found in ${schemaDir}/, drizzle/, or app database setup files. Add it with beignet db schema generate, include it in your Drizzle schema/migrations, or remove the provider registration.`,
2189
+ message: `${provider.packageName} is installed and ${variant.displayName} is registered, but required table ${tableName} was not found in ${schemaDir}/, drizzle/, or app database setup files. Add it with beignet db schema sync, include it in your Drizzle schema/migrations, or remove the provider registration.`,
2186
2190
  });
2187
2191
  }
2188
2192
  }
@@ -2229,7 +2233,7 @@ async function inspectProductionReadiness(
2229
2233
  severity: "warning",
2230
2234
  code: "BEIGNET_PROVIDER_TABLE_MISSING",
2231
2235
  file: schemaDir,
2232
- message: `${provider.packageName} is installed, but required table ${tableName} was not found in ${schemaDir}/, drizzle/, or app database setup files. Add it with beignet db schema generate, include it in your Drizzle schema/migrations, or remove the unused provider package.`,
2236
+ message: `${provider.packageName} is installed, but required table ${tableName} was not found in ${schemaDir}/, drizzle/, or app database setup files. Add it with beignet db schema sync, include it in your Drizzle schema/migrations, or remove the unused provider package.`,
2233
2237
  });
2234
2238
  }
2235
2239
  }
@@ -913,7 +913,8 @@ export type CapabilityBuilder =
913
913
  | "jobs"
914
914
  | "schedules"
915
915
  | "notifications"
916
- | "tasks";
916
+ | "tasks"
917
+ | "uploads";
917
918
 
918
919
  export const capabilityBuilders: Record<
919
920
  CapabilityBuilder,
@@ -944,6 +945,11 @@ export const capabilityBuilders: Record<
944
945
  defineName: "defineTask",
945
946
  module: "@beignet/core/tasks",
946
947
  },
948
+ uploads: {
949
+ factoryName: "createUploads",
950
+ defineName: "defineUpload",
951
+ module: "@beignet/core/uploads",
952
+ },
947
953
  };
948
954
 
949
955
  export function capabilityBuilderPath(
@@ -954,7 +960,8 @@ export function capabilityBuilderPath(
954
960
  if (capability === "jobs") return config.paths.jobsBuilder;
955
961
  if (capability === "schedules") return config.paths.schedulesBuilder;
956
962
  if (capability === "notifications") return config.paths.notificationsBuilder;
957
- return config.paths.tasksBuilder;
963
+ if (capability === "tasks") return config.paths.tasksBuilder;
964
+ return config.paths.uploadsBuilder;
958
965
  }
959
966
 
960
967
  export function capabilityBuilderFile(
package/src/make.ts CHANGED
@@ -138,7 +138,6 @@ import {
138
138
  } from "./make/shared.js";
139
139
  import {
140
140
  appendToArrayExpression,
141
- appendToNamedArray,
142
141
  appendToOutboxRegistryArray,
143
142
  arrayInitializerInfo,
144
143
  identifiersFromArrayExpression,
@@ -1957,7 +1956,10 @@ export async function makeUpload(
1957
1956
  force: Boolean(options.force),
1958
1957
  dryRun: Boolean(options.dryRun),
1959
1958
  name: `${names.feature.kebab}/${names.artifact.kebab}`,
1960
- files: uploadFiles(names, config),
1959
+ files: [
1960
+ ...(await missingCapabilityBuilderFiles(targetDir, "uploads", config)),
1961
+ ...uploadFiles(names, config),
1962
+ ],
1961
1963
  index: featureArtifactIndexFile("upload", names, config),
1962
1964
  dependencies: {
1963
1965
  "@beignet/core": beignetDependencyVersion,
@@ -4800,9 +4802,8 @@ ${names.timezone ? `\t\ttimezone: "${names.timezone}",\n` : ""}\t\tpayload: ${na
4800
4802
  }
4801
4803
 
4802
4804
  function uploadFile(names: UploadNames, config: ResolvedBeignetConfig): string {
4803
- return `import { defineUpload } from "@beignet/core/uploads";
4804
- import { z } from "zod";
4805
- import type { AppContext } from "${aliasModule(config.paths.appContext)}";
4805
+ return `import { z } from "zod";
4806
+ import { defineUpload } from "${aliasModule(config.paths.uploadsBuilder)}";
4806
4807
 
4807
4808
  export const ${names.metadataSchemaName} = z.object({
4808
4809
  \tresourceId: z.string().min(1),
@@ -4810,12 +4811,7 @@ export const ${names.metadataSchemaName} = z.object({
4810
4811
 
4811
4812
  export type ${names.metadataTypeName} = z.infer<typeof ${names.metadataSchemaName}>;
4812
4813
 
4813
- export const ${names.uploadExportName} = defineUpload<
4814
- \t"${names.uploadName}",
4815
- \ttypeof ${names.metadataSchemaName},
4816
- \tAppContext,
4817
- \t{ objectKeys: string[] }
4818
- >("${names.uploadName}", {
4814
+ export const ${names.uploadExportName} = defineUpload("${names.uploadName}", {
4819
4815
  \tmetadata: ${names.metadataSchemaName},
4820
4816
  \tfile: {
4821
4817
  \t\tcontentTypes: ["application/pdf", "text/plain"],