@beignet/cli 0.0.40 → 0.0.42

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 (111) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +139 -17
  3. package/dist/analysis/source-index.d.ts +38 -0
  4. package/dist/analysis/source-index.d.ts.map +1 -0
  5. package/dist/analysis/source-index.js +271 -0
  6. package/dist/analysis/source-index.js.map +1 -0
  7. package/dist/analysis/workspace.d.ts +16 -0
  8. package/dist/analysis/workspace.d.ts.map +1 -0
  9. package/dist/analysis/workspace.js +134 -0
  10. package/dist/analysis/workspace.js.map +1 -0
  11. package/dist/app-map-schema.d.ts +5 -0
  12. package/dist/app-map-schema.d.ts.map +1 -0
  13. package/dist/app-map-schema.js +26 -0
  14. package/dist/app-map-schema.js.map +1 -0
  15. package/dist/app-map.d.ts +96 -0
  16. package/dist/app-map.d.ts.map +1 -0
  17. package/dist/app-map.js +1141 -0
  18. package/dist/app-map.js.map +1 -0
  19. package/dist/check.d.ts +7 -0
  20. package/dist/check.d.ts.map +1 -1
  21. package/dist/check.js +20 -5
  22. package/dist/check.js.map +1 -1
  23. package/dist/choices.d.ts +18 -0
  24. package/dist/choices.d.ts.map +1 -1
  25. package/dist/choices.js +35 -0
  26. package/dist/choices.js.map +1 -1
  27. package/dist/db.d.ts +49 -13
  28. package/dist/db.d.ts.map +1 -1
  29. package/dist/db.js +202 -21
  30. package/dist/db.js.map +1 -1
  31. package/dist/doctor-fixes.d.ts +64 -0
  32. package/dist/doctor-fixes.d.ts.map +1 -0
  33. package/dist/doctor-fixes.js +142 -0
  34. package/dist/doctor-fixes.js.map +1 -0
  35. package/dist/explain.d.ts +100 -0
  36. package/dist/explain.d.ts.map +1 -0
  37. package/dist/explain.js +606 -0
  38. package/dist/explain.js.map +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +165 -21
  41. package/dist/index.js.map +1 -1
  42. package/dist/inspect.d.ts +33 -9
  43. package/dist/inspect.d.ts.map +1 -1
  44. package/dist/inspect.js +406 -119
  45. package/dist/inspect.js.map +1 -1
  46. package/dist/lib.d.ts +10 -2
  47. package/dist/lib.d.ts.map +1 -1
  48. package/dist/lib.js +5 -2
  49. package/dist/lib.js.map +1 -1
  50. package/dist/make/shared.js +3 -3
  51. package/dist/make/shared.js.map +1 -1
  52. package/dist/make.d.ts.map +1 -1
  53. package/dist/make.js +63 -2
  54. package/dist/make.js.map +1 -1
  55. package/dist/mcp.d.ts +1 -1
  56. package/dist/mcp.d.ts.map +1 -1
  57. package/dist/mcp.js +188 -12
  58. package/dist/mcp.js.map +1 -1
  59. package/dist/preflight.d.ts.map +1 -1
  60. package/dist/preflight.js +10 -0
  61. package/dist/preflight.js.map +1 -1
  62. package/dist/provider-add.d.ts.map +1 -1
  63. package/dist/provider-add.js +167 -13
  64. package/dist/provider-add.js.map +1 -1
  65. package/dist/provider-audit.d.ts +6 -0
  66. package/dist/provider-audit.d.ts.map +1 -1
  67. package/dist/provider-audit.js +63 -15
  68. package/dist/provider-audit.js.map +1 -1
  69. package/dist/templates/agents.d.ts.map +1 -1
  70. package/dist/templates/agents.js +35 -6
  71. package/dist/templates/agents.js.map +1 -1
  72. package/dist/templates/base.d.ts.map +1 -1
  73. package/dist/templates/base.js +13 -7
  74. package/dist/templates/base.js.map +1 -1
  75. package/dist/templates/index.d.ts +1 -1
  76. package/dist/templates/index.d.ts.map +1 -1
  77. package/dist/templates/index.js +8 -1
  78. package/dist/templates/index.js.map +1 -1
  79. package/dist/templates/server.d.ts +3 -0
  80. package/dist/templates/server.d.ts.map +1 -1
  81. package/dist/templates/server.js +55 -1
  82. package/dist/templates/server.js.map +1 -1
  83. package/dist/templates/shared.d.ts +2 -1
  84. package/dist/templates/shared.d.ts.map +1 -1
  85. package/dist/templates/shared.js +8 -5
  86. package/dist/templates/shared.js.map +1 -1
  87. package/package.json +3 -2
  88. package/skills/app-structure/SKILL.md +48 -6
  89. package/src/analysis/source-index.ts +395 -0
  90. package/src/analysis/workspace.ts +180 -0
  91. package/src/app-map-schema.ts +28 -0
  92. package/src/app-map.ts +1705 -0
  93. package/src/check.ts +27 -4
  94. package/src/choices.ts +57 -0
  95. package/src/db.ts +276 -28
  96. package/src/doctor-fixes.ts +252 -0
  97. package/src/explain.ts +894 -0
  98. package/src/index.ts +237 -31
  99. package/src/inspect.ts +567 -147
  100. package/src/lib.ts +64 -1
  101. package/src/make/shared.ts +3 -3
  102. package/src/make.ts +90 -2
  103. package/src/mcp.ts +292 -12
  104. package/src/preflight.ts +14 -0
  105. package/src/provider-add.ts +211 -12
  106. package/src/provider-audit.ts +127 -22
  107. package/src/templates/agents.ts +35 -6
  108. package/src/templates/base.ts +25 -6
  109. package/src/templates/index.ts +18 -1
  110. package/src/templates/server.ts +58 -1
  111. package/src/templates/shared.ts +15 -7
package/dist/make.js CHANGED
@@ -558,6 +558,7 @@ export async function makeJob(options) {
558
558
  await updateOutboxRegistry(targetDir, names, "jobs", config, {
559
559
  dryRun: true,
560
560
  });
561
+ await updateInngestJobRegistry(targetDir, names, config, { dryRun: true });
561
562
  const result = await makeFeatureArtifact({
562
563
  targetDir,
563
564
  config,
@@ -582,6 +583,9 @@ export async function makeJob(options) {
582
583
  await applyOutboxPortWiring(result, targetDir, config, {
583
584
  dryRun: Boolean(options.dryRun),
584
585
  });
586
+ await applyInngestJobRegistryUpdate(result, targetDir, names, config, {
587
+ dryRun: Boolean(options.dryRun),
588
+ });
585
589
  return result;
586
590
  }
587
591
  export async function makeTask(options) {
@@ -2416,6 +2420,65 @@ async function applyOutboxRegistryUpdate(result, targetDir, names, kind, config,
2416
2420
  result.files.push(config.paths.outbox);
2417
2421
  }
2418
2422
  }
2423
+ function inngestRegistryPath(config) {
2424
+ return path.posix.join(path.posix.dirname(config.paths.server), "inngest.ts");
2425
+ }
2426
+ async function appUsesInngestJobs(targetDir) {
2427
+ const source = await readOptionalFile(path.join(targetDir, "package.json"));
2428
+ if (source === undefined)
2429
+ return false;
2430
+ try {
2431
+ const packageJson = JSON.parse(source);
2432
+ return Boolean(packageJson.dependencies?.["@beignet/provider-jobs-inngest"] ??
2433
+ packageJson.devDependencies?.["@beignet/provider-jobs-inngest"]);
2434
+ }
2435
+ catch {
2436
+ return false;
2437
+ }
2438
+ }
2439
+ async function updateInngestJobRegistry(targetDir, names, config, options) {
2440
+ if (!(await appUsesInngestJobs(targetDir)))
2441
+ return undefined;
2442
+ const registryPath = inngestRegistryPath(config);
2443
+ const destination = path.join(targetDir, registryPath);
2444
+ const existing = await readOptionalFile(destination);
2445
+ if (existing === undefined) {
2446
+ throw new Error(`@beignet/provider-jobs-inngest is installed, but ${registryPath} is missing. Run \`beignet provider add jobs-inngest\` to create the execution registry before generating jobs.`);
2447
+ }
2448
+ const featureIndexPath = path.join(featureArtifactDir(names, "jobs", config), "index.ts");
2449
+ const registryName = `${names.featureSingularCamel}Jobs`;
2450
+ const importLine = `import { ${registryName} } from "${aliasModule(featureIndexPath)}";`;
2451
+ let next = existing;
2452
+ if (!next.includes(importLine))
2453
+ next = insertAfterImports(next, importLine);
2454
+ const registry = arrayInitializerInfo(next, "inngestJobs");
2455
+ if (!registry) {
2456
+ throw new Error(`Could not find \`export const inngestJobs = [...]\` in ${registryPath}. Restore the generated registry or register ${registryName} manually.`);
2457
+ }
2458
+ if (!identifiersFromArrayExpression(registry.text).has(registryName)) {
2459
+ const updatedArray = appendToArrayExpression(registry.text, [
2460
+ `...${registryName}`,
2461
+ ]);
2462
+ next = `${next.slice(0, registry.start)}${updatedArray}${next.slice(registry.end)}`;
2463
+ }
2464
+ if (next === existing)
2465
+ return "skipped";
2466
+ if (!options.dryRun)
2467
+ await writeFile(destination, next);
2468
+ return "updated";
2469
+ }
2470
+ async function applyInngestJobRegistryUpdate(result, targetDir, names, config, options) {
2471
+ const registryResult = await updateInngestJobRegistry(targetDir, names, config, options);
2472
+ if (registryResult === undefined)
2473
+ return;
2474
+ const registryPath = inngestRegistryPath(config);
2475
+ if (registryResult === "updated")
2476
+ result.updatedFiles.push(registryPath);
2477
+ if (registryResult === "skipped")
2478
+ result.skippedFiles.push(registryPath);
2479
+ if (!result.files.includes(registryPath))
2480
+ result.files.push(registryPath);
2481
+ }
2419
2482
  function schemasFile(names, mode, options) {
2420
2483
  return `import { z } from "zod";
2421
2484
 
@@ -3621,8 +3684,6 @@ export const ${names.jobExportName} = defineJob("${names.jobName}", {
3621
3684
  \tpayload: ${names.payloadSchemaName},
3622
3685
  \tretry: retry.exponential({
3623
3686
  \t\tattempts: 3,
3624
- \t\tinitialDelay: "1s",
3625
- \t\tmaxDelay: "1m",
3626
3687
  \t}),
3627
3688
  \tasync handle({ payload, ctx }) {
3628
3689
  \t\tctx.ports.logger.info("Job handled", {