everything-dev 1.27.0 → 1.28.1

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 (114) hide show
  1. package/dist/cli/infra.cjs +1 -1
  2. package/dist/cli/infra.mjs +1 -1
  3. package/dist/cli/init.cjs +34 -9
  4. package/dist/cli/init.cjs.map +1 -1
  5. package/dist/cli/init.d.cts +2 -1
  6. package/dist/cli/init.d.cts.map +1 -1
  7. package/dist/cli/init.d.mts +2 -1
  8. package/dist/cli/init.d.mts.map +1 -1
  9. package/dist/cli/init.mjs +34 -9
  10. package/dist/cli/init.mjs.map +1 -1
  11. package/dist/cli/prompts.cjs +28 -24
  12. package/dist/cli/prompts.cjs.map +1 -1
  13. package/dist/cli/prompts.mjs +27 -24
  14. package/dist/cli/prompts.mjs.map +1 -1
  15. package/dist/cli/sync.cjs +40 -3
  16. package/dist/cli/sync.cjs.map +1 -1
  17. package/dist/cli/sync.mjs +40 -3
  18. package/dist/cli/sync.mjs.map +1 -1
  19. package/dist/cli.cjs +187 -12
  20. package/dist/cli.cjs.map +1 -1
  21. package/dist/cli.mjs +186 -11
  22. package/dist/cli.mjs.map +1 -1
  23. package/dist/config.cjs +1 -0
  24. package/dist/config.cjs.map +1 -1
  25. package/dist/config.d.cts.map +1 -1
  26. package/dist/config.d.mts.map +1 -1
  27. package/dist/config.mjs +1 -0
  28. package/dist/config.mjs.map +1 -1
  29. package/dist/contract.cjs +1 -1
  30. package/dist/contract.cjs.map +1 -1
  31. package/dist/contract.d.cts +38 -34
  32. package/dist/contract.d.cts.map +1 -1
  33. package/dist/contract.d.mts +38 -34
  34. package/dist/contract.d.mts.map +1 -1
  35. package/dist/contract.mjs +1 -0
  36. package/dist/contract.mjs.map +1 -1
  37. package/dist/dev-session.cjs +0 -1
  38. package/dist/dev-session.mjs +1 -1
  39. package/dist/index.cjs +0 -2
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.mjs +0 -1
  43. package/dist/near-cli.cjs +1 -1
  44. package/dist/near-cli.mjs +1 -1
  45. package/dist/orchestrator.cjs +1 -1
  46. package/dist/orchestrator.mjs +1 -1
  47. package/dist/plugin.cjs +183 -151
  48. package/dist/plugin.cjs.map +1 -1
  49. package/dist/plugin.d.cts +67 -34
  50. package/dist/plugin.d.cts.map +1 -1
  51. package/dist/plugin.d.mts +66 -34
  52. package/dist/plugin.d.mts.map +1 -1
  53. package/dist/plugin.mjs +173 -142
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/service-descriptor.d.cts +34 -0
  56. package/dist/service-descriptor.d.cts.map +1 -0
  57. package/dist/service-descriptor.d.mts +36 -0
  58. package/dist/service-descriptor.d.mts.map +1 -0
  59. package/dist/types.d.cts +2 -2
  60. package/dist/types.d.mts +2 -2
  61. package/dist/utils/run.cjs +9 -20
  62. package/dist/utils/run.cjs.map +1 -1
  63. package/dist/utils/run.mjs +9 -20
  64. package/dist/utils/run.mjs.map +1 -1
  65. package/package.json +2 -2
  66. package/src/api-contract.ts +0 -623
  67. package/src/app.ts +0 -193
  68. package/src/cli/catalog.ts +0 -49
  69. package/src/cli/framework-version.ts +0 -61
  70. package/src/cli/help.ts +0 -13
  71. package/src/cli/infra.ts +0 -190
  72. package/src/cli/init.ts +0 -1145
  73. package/src/cli/parse.ts +0 -147
  74. package/src/cli/prompts.ts +0 -135
  75. package/src/cli/snapshot.ts +0 -46
  76. package/src/cli/status.ts +0 -99
  77. package/src/cli/sync.ts +0 -429
  78. package/src/cli/timing.ts +0 -63
  79. package/src/cli/upgrade.ts +0 -869
  80. package/src/cli.ts +0 -516
  81. package/src/components/dev-view.tsx +0 -352
  82. package/src/components/streaming-view.ts +0 -177
  83. package/src/config.ts +0 -893
  84. package/src/contract.meta.ts +0 -140
  85. package/src/contract.ts +0 -326
  86. package/src/dev-logs.ts +0 -92
  87. package/src/dev-session.ts +0 -283
  88. package/src/fastkv.ts +0 -181
  89. package/src/index.ts +0 -8
  90. package/src/integrity.ts +0 -138
  91. package/src/internal/manifest-normalizer.ts +0 -290
  92. package/src/merge.ts +0 -187
  93. package/src/mf.ts +0 -147
  94. package/src/near-cli.ts +0 -259
  95. package/src/network.ts +0 -3
  96. package/src/orchestrator.ts +0 -493
  97. package/src/plugin.ts +0 -1799
  98. package/src/sdk.ts +0 -14
  99. package/src/service-descriptor.ts +0 -281
  100. package/src/shared.ts +0 -249
  101. package/src/sidebar.ts +0 -140
  102. package/src/types.ts +0 -330
  103. package/src/ui/head.ts +0 -83
  104. package/src/ui/index.ts +0 -5
  105. package/src/ui/metadata.ts +0 -95
  106. package/src/ui/router.ts +0 -88
  107. package/src/ui/runtime.ts +0 -42
  108. package/src/ui/types.ts +0 -65
  109. package/src/utils/banner.ts +0 -21
  110. package/src/utils/linkify.ts +0 -11
  111. package/src/utils/path-match.ts +0 -16
  112. package/src/utils/run.ts +0 -31
  113. package/src/utils/save-config.ts +0 -20
  114. package/src/utils/theme.ts +0 -39
package/dist/plugin.mjs CHANGED
@@ -3,32 +3,68 @@ import { getNetworkIdForAccount } from "./network.mjs";
3
3
  import { buildRuntimePluginsForConfig, findConfigPath, getHostDevelopmentPort, getProjectRoot, loadConfig, resolveLocalDevelopmentPath, writeResolvedConfig } from "./config.mjs";
4
4
  import { createPlugin, z } from "./sdk.mjs";
5
5
  import { bosContract } from "./contract.mjs";
6
+ import { writePluginSidebarGen } from "./sidebar.mjs";
7
+ import { computeSriHashForUrl } from "./integrity.mjs";
6
8
  import { syncApiContractBridge } from "./api-contract.mjs";
7
9
  import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
8
10
  import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra.mjs";
9
11
  import { saveBosConfig } from "./utils/save-config.mjs";
10
- import { buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, scaffoldMinimalProject, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot } from "./cli/init.mjs";
11
- import { promptInitOptions } from "./cli/prompts.mjs";
12
+ import { buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveSourceDir, runBunInstall, runTypesGen, scaffoldMinimalProject, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot } from "./cli/init.mjs";
12
13
  import { getStatus } from "./cli/status.mjs";
13
14
  import { syncTemplate } from "./cli/sync.mjs";
14
- import { timePhase } from "./cli/timing.mjs";
15
15
  import { upgradeTemplate } from "./cli/upgrade.mjs";
16
- import { computeSriHashForUrl } from "./integrity.mjs";
17
16
  import { addFunctionCallAccessKey, ensureNearCli, executeTransaction } from "./near-cli.mjs";
18
17
  import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
19
18
  import { syncAndGenerateSharedUi } from "./shared.mjs";
20
- import { writePluginSidebarGen } from "./sidebar.mjs";
21
19
  import { run } from "./utils/run.mjs";
22
- import { colors } from "./utils/theme.mjs";
23
20
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
24
21
  import { basename, dirname, join, resolve } from "node:path";
22
+ import { EventEmitter } from "node:events";
23
+ import { access, readFile } from "node:fs/promises";
25
24
  import process from "node:process";
26
- import * as p from "@clack/prompts";
27
25
  import { Effect } from "effect";
28
26
 
29
27
  //#region src/plugin.ts
30
- async function loadDevSession() {
31
- return import("./dev-session.mjs");
28
+ const pluginEvents = new EventEmitter();
29
+ let pendingSession = null;
30
+ let pendingStartSummary = null;
31
+ function consumeDevSession() {
32
+ const data = pendingSession;
33
+ const summary = pendingStartSummary;
34
+ pendingSession = null;
35
+ pendingStartSummary = null;
36
+ if (!data) return null;
37
+ return summary ? {
38
+ ...data,
39
+ summary
40
+ } : data;
41
+ }
42
+ async function timePhase(timings, name, fn) {
43
+ pluginEvents.emit("progress", {
44
+ phase: name,
45
+ status: "running"
46
+ });
47
+ const startedAt = Date.now();
48
+ try {
49
+ const result = await fn();
50
+ timings.push({
51
+ name,
52
+ durationMs: Date.now() - startedAt
53
+ });
54
+ pluginEvents.emit("progress", {
55
+ phase: name,
56
+ status: "done",
57
+ durationMs: Date.now() - startedAt
58
+ });
59
+ return result;
60
+ } catch (error) {
61
+ pluginEvents.emit("progress", {
62
+ phase: name,
63
+ status: "error",
64
+ durationMs: Date.now() - startedAt
65
+ });
66
+ throw error;
67
+ }
32
68
  }
33
69
  const buildCommands = {
34
70
  host: {
@@ -61,6 +97,17 @@ function buildConfigResult(bosConfig) {
61
97
  remotes: packages.filter((name) => name !== "host")
62
98
  };
63
99
  }
100
+ async function fileExists(path) {
101
+ try {
102
+ await access(path);
103
+ return true;
104
+ } catch {
105
+ return false;
106
+ }
107
+ }
108
+ async function readJsonFile(path) {
109
+ return JSON.parse(await readFile(path, "utf8"));
110
+ }
64
111
  function resolveWorkspaceTarget(key, bosConfig, runtimeConfig, configDir) {
65
112
  if (bosConfig?.app && key in bosConfig.app) {
66
113
  const appEntry = bosConfig.app[key];
@@ -156,10 +203,8 @@ function extractPublishedUrl(output) {
156
203
  return match[match.length - 1] ?? null;
157
204
  }
158
205
  async function buildEveryPluginQuietly(cwd) {
159
- const packageDir = `${cwd}/packages/every-plugin`;
160
- if (!await Bun.file(`${packageDir}/package.json`).exists()) return;
161
- const distPath = `${cwd}/packages/every-plugin/dist/build/rspack/plugin.mjs`;
162
- if (await Bun.file(distPath).exists()) return;
206
+ if (!await fileExists(`${`${cwd}/packages/every-plugin`}/package.json`)) return;
207
+ if (await fileExists(`${cwd}/packages/every-plugin/dist/build/rspack/plugin.mjs`)) return;
163
208
  const result = await run("bun", [
164
209
  "run",
165
210
  "--cwd",
@@ -178,10 +223,8 @@ async function buildEveryPluginQuietly(cwd) {
178
223
  throw new Error(`bun run --cwd packages/every-plugin build failed with exit code ${result.exitCode}`);
179
224
  }
180
225
  async function buildEverythingDevQuietly(cwd) {
181
- const packageDir = `${cwd}/packages/everything-dev`;
182
- if (!await Bun.file(`${packageDir}/package.json`).exists()) return;
183
- const distPath = `${cwd}/packages/everything-dev/dist/index.mjs`;
184
- if (await Bun.file(distPath).exists()) return;
226
+ if (!await fileExists(`${`${cwd}/packages/everything-dev`}/package.json`)) return;
227
+ if (await fileExists(`${cwd}/packages/everything-dev/dist/index.mjs`)) return;
185
228
  const result = await run("bun", [
186
229
  "run",
187
230
  "--cwd",
@@ -220,7 +263,7 @@ async function buildWorkspaceTargets(opts) {
220
263
  skipped.push(target);
221
264
  continue;
222
265
  }
223
- if (await Bun.file(`${resolved.path}/package.json`).exists()) existing.push(resolved);
266
+ if (await fileExists(`${resolved.path}/package.json`)) existing.push(resolved);
224
267
  else skipped.push(target);
225
268
  }
226
269
  if (existing.length === 0) return {
@@ -248,7 +291,7 @@ async function buildWorkspaceTargets(opts) {
248
291
  ] : existing;
249
292
  const built = [];
250
293
  for (const resolved of orderedExisting) {
251
- const pkgJson = JSON.parse(await Bun.file(`${resolved.path}/package.json`).text());
294
+ const pkgJson = await readJsonFile(`${resolved.path}/package.json`);
252
295
  const buildConfig = opts.deploy && pkgJson.scripts?.deploy ? {
253
296
  cmd: "bun",
254
297
  args: ["run", "deploy"]
@@ -374,12 +417,12 @@ var plugin_default = createPlugin({
374
417
  error: `Plugin '${input.key}' does not have a local development path`
375
418
  };
376
419
  const pkgPath = join(localPath, "package.json");
377
- if (!await Bun.file(pkgPath).exists()) return {
420
+ if (!await fileExists(pkgPath)) return {
378
421
  status: "error",
379
422
  key: input.key,
380
423
  error: `Missing package.json at ${localPath}`
381
424
  };
382
- const pkgJson = await Bun.file(pkgPath).json();
425
+ const pkgJson = await readJsonFile(pkgPath);
383
426
  const script = pkgJson.scripts?.deploy ? "deploy" : "build";
384
427
  const { stdout, stderr, exitCode } = await run("bun", ["run", script], {
385
428
  cwd: localPath,
@@ -435,6 +478,10 @@ var plugin_default = createPlugin({
435
478
  }),
436
479
  dev: builder.dev.handler(async ({ input }) => {
437
480
  ensureEnvFile(deps.configDir);
481
+ pluginEvents.emit("progress", {
482
+ phase: "config",
483
+ status: "running"
484
+ });
438
485
  const localPackages = detectLocalPackages(deps.bosConfig ?? void 0, deps.runtimeConfig ?? void 0);
439
486
  const hostSource = localPackages.includes("host") ? parseSourceMode(input.host, "local") : "remote";
440
487
  const uiSource = localPackages.includes("ui") ? parseSourceMode(input.ui, "local") : "remote";
@@ -447,9 +494,41 @@ var plugin_default = createPlugin({
447
494
  hostMode: hostSource,
448
495
  bosConfig: deps.bosConfig ?? void 0,
449
496
  extendsChain: []
450
- })).catalogChanged) await run("bun", ["install"], { cwd: deps.configDir });
451
- if (apiSource === "local" && !proxy || localPackages.some((pkg) => pkg.startsWith("plugin:"))) await buildEveryPluginQuietly(deps.configDir);
497
+ })).catalogChanged) {
498
+ pluginEvents.emit("progress", {
499
+ phase: "install",
500
+ status: "running"
501
+ });
502
+ await run("bun", ["install"], { cwd: deps.configDir });
503
+ pluginEvents.emit("progress", {
504
+ phase: "install",
505
+ status: "done"
506
+ });
507
+ }
508
+ if (apiSource === "local" && !proxy || localPackages.some((pkg) => pkg.startsWith("plugin:"))) {
509
+ pluginEvents.emit("progress", {
510
+ phase: "build plugin",
511
+ status: "running"
512
+ });
513
+ await buildEveryPluginQuietly(deps.configDir);
514
+ pluginEvents.emit("progress", {
515
+ phase: "build plugin",
516
+ status: "done"
517
+ });
518
+ }
519
+ pluginEvents.emit("progress", {
520
+ phase: "build",
521
+ status: "running"
522
+ });
452
523
  await buildEverythingDevQuietly(deps.configDir);
524
+ pluginEvents.emit("progress", {
525
+ phase: "build",
526
+ status: "done"
527
+ });
528
+ pluginEvents.emit("progress", {
529
+ phase: "config",
530
+ status: "done"
531
+ });
453
532
  const refreshed = await loadConfig({ cwd: deps.configDir });
454
533
  deps.bosConfig = refreshed?.config ?? deps.bosConfig;
455
534
  deps.runtimeConfig = refreshed?.runtime ?? deps.runtimeConfig;
@@ -497,8 +576,11 @@ var plugin_default = createPlugin({
497
576
  port: runtimeConfig.host.port,
498
577
  interactive: input.interactive
499
578
  };
500
- const { devApp } = await loadDevSession();
501
- devApp(orchestrator, services, runtimeConfig);
579
+ pendingSession = {
580
+ orchestrator,
581
+ services,
582
+ runtimeConfig
583
+ };
502
584
  return {
503
585
  status: "started",
504
586
  description: orchestrator.description,
@@ -507,6 +589,10 @@ var plugin_default = createPlugin({
507
589
  }),
508
590
  start: builder.start.handler(async ({ input }) => {
509
591
  ensureEnvFile(deps.configDir);
592
+ pluginEvents.emit("progress", {
593
+ phase: "config",
594
+ status: "running"
595
+ });
510
596
  const account = input.account ?? process.env.BOS_ACCOUNT;
511
597
  const domain = input.domain ?? process.env.BOS_GATEWAY;
512
598
  let config = null;
@@ -541,10 +627,18 @@ var plugin_default = createPlugin({
541
627
  env: "production",
542
628
  plugins: runtimePlugins
543
629
  });
630
+ pluginEvents.emit("progress", {
631
+ phase: "generate artifacts",
632
+ status: "running"
633
+ });
544
634
  await generateCodeArtifacts(deps.configDir, config, {
545
635
  env: "production",
546
636
  runtimeConfig
547
637
  });
638
+ pluginEvents.emit("progress", {
639
+ phase: "generate artifacts",
640
+ status: "done"
641
+ });
548
642
  const productionEnv = {};
549
643
  const warnings = [];
550
644
  if (!process.env.CORS_ORIGIN && config.domain) {
@@ -564,32 +658,40 @@ var plugin_default = createPlugin({
564
658
  if (missingSecrets.length > 0) warnings.push(`Missing ${missingSecrets.length} secret(s): ${missingSecrets.join(", ")}`);
565
659
  const services = buildServiceDescriptorMap(runtimeConfig);
566
660
  const stagingEnvVars = isStaging ? { BOS_GATEWAY: config.staging?.domain ?? config.domain ?? "" } : {};
567
- const configSource = remoteConfig ? `bos://${account}/${domain}` : findConfigPath() ?? "bos.config.json";
568
- const configSourceHttp = remoteConfig && account && domain ? buildRegistryConfigUrl(account, domain) : void 0;
569
- const summaryLines = ["", ` ${colors.dim("Config Source:")} ${configSource}`];
570
- if (configSourceHttp) summaryLines.push(` ${colors.dim(configSourceHttp)}`);
571
- summaryLines.push(` ${colors.dim("Account:")} ${config.account}`, ` ${colors.dim("Domain:")} ${config.domain ?? "not configured"}`, "", ` ${colors.dim("Modules:")}`, ` ${colors.dim("HOST")} → ${runtimeConfig.host.remoteUrl ?? runtimeConfig.host.url ?? "local"}`, ` ${colors.dim("UI")} → ${runtimeConfig.ui.url ?? "local"}`, ` ${colors.dim("API")} → ${runtimeConfig.api.url ?? "local"}`);
572
- if (runtimeConfig.auth) summaryLines.push(` ${colors.dim("AUTH")} → ${runtimeConfig.auth.url ?? "local"}`);
573
- if (warnings.length > 0) {
574
- summaryLines.push("");
575
- for (const w of warnings) summaryLines.push(` ${colors.yellow(w)}`);
576
- }
577
- summaryLines.push("");
578
- console.log(summaryLines.join("\n"));
579
- const orchestrator = {
580
- packages: ["host"],
581
- env: {
582
- NODE_ENV: "production",
583
- ...productionEnv,
584
- ...stagingEnvVars
661
+ const summary = {
662
+ configSource: remoteConfig ? `bos://${account}/${domain}` : findConfigPath() ?? "bos.config.json",
663
+ configSourceHttp: remoteConfig && account && domain ? buildRegistryConfigUrl(account, domain) : void 0,
664
+ account: config.account,
665
+ domain: config.domain ?? void 0,
666
+ modules: {
667
+ host: runtimeConfig.host.remoteUrl ?? runtimeConfig.host.url ?? "local",
668
+ ui: runtimeConfig.ui.url ?? "local",
669
+ api: runtimeConfig.api.url ?? "local",
670
+ auth: runtimeConfig.auth?.url ?? void 0
671
+ },
672
+ warnings
673
+ };
674
+ pendingSession = {
675
+ orchestrator: {
676
+ packages: ["host"],
677
+ env: {
678
+ NODE_ENV: "production",
679
+ ...productionEnv,
680
+ ...stagingEnvVars
681
+ },
682
+ description: `${isStaging ? "Staging" : "Production"} Mode (${config.account})`,
683
+ port,
684
+ interactive: input.interactive,
685
+ noLogs: true
585
686
  },
586
- description: `${isStaging ? "Staging" : "Production"} Mode (${config.account})`,
587
- port,
588
- interactive: input.interactive,
589
- noLogs: true
687
+ services,
688
+ runtimeConfig
590
689
  };
591
- const { startApp } = await loadDevSession();
592
- startApp(orchestrator, services, runtimeConfig);
690
+ pendingStartSummary = summary;
691
+ pluginEvents.emit("progress", {
692
+ phase: "config",
693
+ status: "done"
694
+ });
593
695
  return {
594
696
  status: "running",
595
697
  url: `http://localhost:${port}`
@@ -779,8 +881,8 @@ var plugin_default = createPlugin({
779
881
  let extendsAccount = "";
780
882
  let extendsGateway = "";
781
883
  let directory = input.directory;
782
- let account = input.account;
783
- let domain = input.domain;
884
+ const account = input.account;
885
+ const domain = input.domain;
784
886
  let overrides = input.overrides;
785
887
  let plugins = input.plugins;
786
888
  if (input.extends) {
@@ -792,77 +894,22 @@ var plugin_default = createPlugin({
792
894
  }
793
895
  extendsAccount = extendsAccount || "dev.everything.near";
794
896
  extendsGateway = extendsGateway || "everything.dev";
795
- const s = p.spinner();
796
- s.start("Initializing project");
797
897
  let parentPluginKeys = [];
798
898
  let parentConfig = null;
799
899
  try {
800
- parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway), s);
900
+ parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
801
901
  if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
802
902
  } catch {}
803
- if (!input.noInteractive) {
804
- s.stop("Config fetched");
805
- const initialExtendsAccount = extendsAccount;
806
- const initialExtendsGateway = extendsGateway;
807
- const prompted = await promptInitOptions({
808
- extends: `bos://${extendsAccount}/${extendsGateway}`,
809
- directory,
810
- account,
811
- domain,
812
- plugins,
813
- overrides,
814
- parentPluginKeys
815
- });
816
- extendsAccount = prompted.extendsAccount;
817
- extendsGateway = prompted.extendsGateway;
818
- directory = prompted.directory;
819
- account = prompted.account;
820
- domain = prompted.domain;
821
- plugins = prompted.plugins;
822
- overrides = prompted.overrides;
823
- if (!parentConfig || prompted.extendsAccount !== initialExtendsAccount || prompted.extendsGateway !== initialExtendsGateway) {
824
- try {
825
- parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(prompted.extendsAccount, prompted.extendsGateway), s);
826
- if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
827
- else parentPluginKeys = [];
828
- } catch {
829
- return {
830
- status: "error",
831
- directory,
832
- extendsRef: `bos://${prompted.extendsAccount}/${prompted.extendsGateway}`,
833
- account,
834
- domain,
835
- extends: `bos://${prompted.extendsAccount}/${prompted.extendsGateway}`,
836
- plugins,
837
- overrides,
838
- filesCopied: 0,
839
- timings,
840
- error: `No config found at bos://${prompted.extendsAccount}/${prompted.extendsGateway} — are you sure this is the right parent?`
841
- };
842
- }
843
- s.stop("Config fetched");
844
- }
845
- if (typeof parentConfig?.title === "string" && parentConfig.title.trim() && typeof parentConfig.description === "string" && parentConfig.description.trim()) {
846
- const shouldContinue = await p.confirm({
847
- message: `You will be extending ${parentConfig.title} - ${parentConfig.description}. Continue?`,
848
- initialValue: true
849
- });
850
- if (p.isCancel(shouldContinue) || !shouldContinue) process.exit(0);
851
- }
852
- s.start("Setting up project");
853
- }
854
903
  overrides = overrides?.length ? overrides : ["ui", "api"];
855
- if (overrides.includes("plugins") && !plugins?.length) plugins = parentPluginKeys;
904
+ if (overrides.includes("plugins") && plugins === void 0) plugins = parentPluginKeys;
856
905
  plugins = plugins ?? [];
857
906
  directory = directory || domain || extendsGateway;
858
907
  const targetDir = resolve(directory);
859
908
  const extendsRef = `bos://${extendsAccount}/${extendsGateway}`;
860
- if (overrides.includes("plugins") && !plugins.length) {}
861
909
  const repository = await detectGitRemoteUrl(process.cwd()).catch(() => void 0) ?? parentConfig?.repository;
862
910
  if (!parentConfig) try {
863
- parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway), s);
911
+ parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
864
912
  } catch {
865
- s.stop("Failed");
866
913
  return {
867
914
  status: "error",
868
915
  directory,
@@ -881,7 +928,7 @@ var plugin_default = createPlugin({
881
928
  extendsAccount,
882
929
  extendsGateway,
883
930
  source: input.source
884
- }), s);
931
+ }));
885
932
  parentConfig = resolvedParentConfig;
886
933
  const isMinimalScaffold = sourceDir === "";
887
934
  try {
@@ -897,7 +944,7 @@ var plugin_default = createPlugin({
897
944
  repository,
898
945
  title: parentConfig?.title,
899
946
  description: parentConfig?.description
900
- }), s);
947
+ }));
901
948
  await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
902
949
  extendsAccount,
903
950
  extendsGateway,
@@ -911,13 +958,13 @@ var plugin_default = createPlugin({
911
958
  description: parentConfig?.description,
912
959
  testnet: parentConfig?.testnet,
913
960
  staging: parentConfig?.staging
914
- }), s);
961
+ }));
915
962
  } else {
916
963
  const patterns = buildInitPatterns(overrides, plugins);
917
964
  filesCopied = await timePhase(timings, "copy files", () => copyFilteredFiles(sourceDir, targetDir, patterns, {
918
965
  overrides,
919
966
  plugins
920
- }), s);
967
+ }));
921
968
  await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
922
969
  extendsAccount,
923
970
  extendsGateway,
@@ -931,45 +978,28 @@ var plugin_default = createPlugin({
931
978
  description: parentConfig?.description,
932
979
  testnet: parentConfig?.testnet,
933
980
  staging: parentConfig?.staging
934
- }), s);
981
+ }));
935
982
  await timePhase(timings, "write snapshot", () => writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
936
983
  overrides,
937
984
  plugins
938
- }), s);
985
+ }));
939
986
  }
940
987
  const lockfilePath = join(targetDir, "bun.lock");
941
988
  stripOrphanedWorkspacesFromLockfile(lockfilePath, computeAllowedWorkspaces(overrides, plugins));
942
989
  removeInitLockfile(lockfilePath);
943
- const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }), s);
990
+ const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }));
944
991
  if (initConfig?.runtime) await timePhase(timings, "generate env/docker", async () => {
945
992
  writeGeneratedInfra(targetDir, initConfig.runtime);
946
- }, s);
993
+ });
947
994
  await timePhase(timings, "create env file", async () => {
948
995
  ensureEnvFile(targetDir);
949
- }, s);
996
+ });
950
997
  if (!input.noInstall) {
951
- await timePhase(timings, "install dependencies", () => runBunInstall(targetDir, s ?? void 0));
952
- await timePhase(timings, "generate types", () => runTypesGen(targetDir, s ?? void 0));
953
- await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir), s);
954
- }
955
- if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config), s);
956
- s.stop("Project initialized");
957
- if (!input.noInteractive) {
958
- if (await p.confirm({
959
- message: "Run docker compose up -d --wait?",
960
- initialValue: true
961
- }) === true) {
962
- const dockerSpinner = p.spinner();
963
- dockerSpinner.start("Starting Docker services");
964
- try {
965
- await timePhase(timings, "docker compose up", () => runDockerComposeUp(targetDir));
966
- dockerSpinner.stop("Docker services ready");
967
- } catch (error) {
968
- dockerSpinner.stop("Docker services not started");
969
- p.log.warn(`docker compose up -d --wait failed: ${error instanceof Error ? error.message : error}`);
970
- }
971
- }
998
+ await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
999
+ await timePhase(timings, "generate types", () => runTypesGen(targetDir));
1000
+ await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir));
972
1001
  }
1002
+ if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config));
973
1003
  return {
974
1004
  status: "initialized",
975
1005
  directory,
@@ -980,7 +1010,8 @@ var plugin_default = createPlugin({
980
1010
  plugins,
981
1011
  overrides,
982
1012
  filesCopied,
983
- timings
1013
+ timings,
1014
+ targetDir
984
1015
  };
985
1016
  } finally {
986
1017
  await cleanup();
@@ -1155,10 +1186,10 @@ function computeAllowedWorkspaces(overrides, plugins) {
1155
1186
  if (section === "ui") workspaces.push("ui");
1156
1187
  if (section === "api") workspaces.push("api");
1157
1188
  }
1158
- if (plugins) for (const plugin of plugins) workspaces.push(`plugins/${plugin}`);
1189
+ if (plugins && plugins.length > 0) workspaces.push("plugins/*");
1159
1190
  return workspaces;
1160
1191
  }
1161
1192
 
1162
1193
  //#endregion
1163
- export { plugin_default as default };
1194
+ export { consumeDevSession, plugin_default as default, pluginEvents };
1164
1195
  //# sourceMappingURL=plugin.mjs.map