everything-dev 1.20.0 → 1.21.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 (61) hide show
  1. package/dist/cli/init.cjs +138 -74
  2. package/dist/cli/init.cjs.map +1 -1
  3. package/dist/cli/init.d.cts +9 -5
  4. package/dist/cli/init.d.cts.map +1 -1
  5. package/dist/cli/init.d.mts +9 -5
  6. package/dist/cli/init.d.mts.map +1 -1
  7. package/dist/cli/init.mjs +138 -75
  8. package/dist/cli/init.mjs.map +1 -1
  9. package/dist/cli/parse.cjs +9 -0
  10. package/dist/cli/parse.cjs.map +1 -1
  11. package/dist/cli/parse.mjs +9 -0
  12. package/dist/cli/parse.mjs.map +1 -1
  13. package/dist/cli/prompts.cjs +44 -13
  14. package/dist/cli/prompts.cjs.map +1 -1
  15. package/dist/cli/prompts.mjs +44 -13
  16. package/dist/cli/prompts.mjs.map +1 -1
  17. package/dist/cli/sync.cjs +6 -0
  18. package/dist/cli/sync.cjs.map +1 -1
  19. package/dist/cli/sync.mjs +6 -0
  20. package/dist/cli/sync.mjs.map +1 -1
  21. package/dist/cli.cjs +3 -1
  22. package/dist/cli.cjs.map +1 -1
  23. package/dist/cli.mjs +3 -1
  24. package/dist/cli.mjs.map +1 -1
  25. package/dist/contract.cjs +9 -1
  26. package/dist/contract.cjs.map +1 -1
  27. package/dist/contract.d.cts +37 -8
  28. package/dist/contract.d.cts.map +1 -1
  29. package/dist/contract.d.mts +37 -8
  30. package/dist/contract.d.mts.map +1 -1
  31. package/dist/contract.meta.cjs +2 -2
  32. package/dist/contract.meta.cjs.map +1 -1
  33. package/dist/contract.meta.d.cts +3 -3
  34. package/dist/contract.meta.d.mts +3 -3
  35. package/dist/contract.meta.mjs +2 -2
  36. package/dist/contract.meta.mjs.map +1 -1
  37. package/dist/contract.mjs +9 -2
  38. package/dist/contract.mjs.map +1 -1
  39. package/dist/index.cjs +1 -0
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.mjs +2 -2
  43. package/dist/plugin.cjs +24 -12
  44. package/dist/plugin.cjs.map +1 -1
  45. package/dist/plugin.d.cts +16 -5
  46. package/dist/plugin.d.cts.map +1 -1
  47. package/dist/plugin.d.mts +16 -5
  48. package/dist/plugin.d.mts.map +1 -1
  49. package/dist/plugin.mjs +25 -13
  50. package/dist/plugin.mjs.map +1 -1
  51. package/dist/types.d.cts +2 -2
  52. package/dist/types.d.mts +2 -2
  53. package/package.json +1 -1
  54. package/src/cli/init.ts +215 -89
  55. package/src/cli/parse.ts +17 -0
  56. package/src/cli/prompts.ts +45 -28
  57. package/src/cli/sync.ts +1 -0
  58. package/src/cli.ts +8 -1
  59. package/src/contract.meta.ts +6 -2
  60. package/src/contract.ts +5 -1
  61. package/src/plugin.ts +41 -18
@@ -92,8 +92,12 @@ export const cliCommandMeta = {
92
92
  account: { description: "New project NEAR account (auto-derived from extends)" },
93
93
  directory: { description: "Target directory (auto-derived from domain)" },
94
94
  source: { description: "Local source dir (skips GitHub download)" },
95
- plugins: { description: "Comma-separated plugin keys to include" },
96
- withHost: { description: "Include host/ in template output" },
95
+ plugins: {
96
+ description: "Comma-separated plugin keys to include (requires --overrides=plugins)",
97
+ },
98
+ overrides: {
99
+ description: "Comma-separated sections to override locally: ui,api,host,plugins",
100
+ },
97
101
  noInteractive: { description: "Skip prompts, use flags only" },
98
102
  noInstall: { description: "Skip bun install" },
99
103
  },
package/src/contract.ts CHANGED
@@ -142,6 +142,8 @@ export const KeyPublishResultSchema = z.object({
142
142
  error: z.string().optional(),
143
143
  });
144
144
 
145
+ export const OverrideSectionSchema = z.enum(["ui", "api", "host", "plugins"]);
146
+
145
147
  export const InitOptionsSchema = z.object({
146
148
  extends: z.string().optional(),
147
149
  directory: z.string().optional(),
@@ -149,7 +151,7 @@ export const InitOptionsSchema = z.object({
149
151
  domain: z.string().optional(),
150
152
  source: z.string().optional(),
151
153
  plugins: z.array(z.string()).optional(),
152
- withHost: z.boolean().default(false),
154
+ overrides: z.array(OverrideSectionSchema).optional(),
153
155
  noInteractive: z.boolean().default(false),
154
156
  noInstall: z.boolean().default(false),
155
157
  });
@@ -167,6 +169,7 @@ export const InitResultSchema = z.object({
167
169
  domain: z.string().optional(),
168
170
  extends: z.string(),
169
171
  plugins: z.array(z.string()).optional(),
172
+ overrides: z.array(OverrideSectionSchema).optional(),
170
173
  filesCopied: z.number(),
171
174
  timings: z.array(PhaseTimingSchema).optional(),
172
175
  error: z.string().optional(),
@@ -311,6 +314,7 @@ export type KeyPublishOptions = z.infer<typeof KeyPublishOptionsSchema>;
311
314
  export type KeyPublishResult = z.infer<typeof KeyPublishResultSchema>;
312
315
  export type InitOptions = z.infer<typeof InitOptionsSchema>;
313
316
  export type InitResult = z.infer<typeof InitResultSchema>;
317
+ export type OverrideSection = z.infer<typeof OverrideSectionSchema>;
314
318
  export type PhaseTiming = z.infer<typeof PhaseTimingSchema>;
315
319
  export type SyncOptions = z.infer<typeof SyncOptionsSchema>;
316
320
  export type SyncResult = z.infer<typeof SyncResultSchema>;
package/src/plugin.ts CHANGED
@@ -7,6 +7,7 @@ import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfi
7
7
  import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra";
8
8
  import {
9
9
  copyFilteredFiles,
10
+ detectGitRemoteUrl,
10
11
  fetchParentConfig,
11
12
  generateDatabaseMigrations,
12
13
  personalizeConfig,
@@ -35,6 +36,7 @@ import {
35
36
  import {
36
37
  type BosConfigResult,
37
38
  bosContract,
39
+ type OverrideSection,
38
40
  type PhaseTiming,
39
41
  type PluginListResult,
40
42
  } from "./contract";
@@ -1196,7 +1198,7 @@ export default createPlugin({
1196
1198
  let directory = input.directory;
1197
1199
  let account = input.account;
1198
1200
  let domain = input.domain;
1199
- let withHost = input.withHost;
1201
+ let overrides = input.overrides as OverrideSection[] | undefined;
1200
1202
  let plugins = input.plugins;
1201
1203
 
1202
1204
  if (input.extends) {
@@ -1238,7 +1240,7 @@ export default createPlugin({
1238
1240
  account,
1239
1241
  domain,
1240
1242
  plugins,
1241
- withHost,
1243
+ overrides,
1242
1244
  parentPluginKeys,
1243
1245
  });
1244
1246
  extendsAccount = prompted.extendsAccount;
@@ -1246,16 +1248,29 @@ export default createPlugin({
1246
1248
  directory = prompted.directory;
1247
1249
  account = prompted.account;
1248
1250
  domain = prompted.domain;
1249
- withHost = prompted.withHost;
1250
1251
  plugins = prompted.plugins;
1252
+ overrides = prompted.overrides;
1251
1253
  s.start("Setting up project");
1252
1254
  }
1253
1255
 
1256
+ overrides = overrides?.length ? overrides : (["ui", "api"] as OverrideSection[]);
1257
+ if (overrides.includes("plugins") && !plugins?.length) {
1258
+ plugins = parentPluginKeys;
1259
+ }
1260
+ plugins = plugins ?? [];
1261
+
1254
1262
  directory = directory || domain || extendsGateway;
1255
1263
  const targetDir = resolve(directory);
1256
- plugins = plugins ?? [];
1257
1264
  const extendsRef = `bos://${extendsAccount}/${extendsGateway}`;
1258
1265
 
1266
+ if (overrides.includes("plugins") && !plugins.length) {
1267
+ // explicitly selected plugins override with none selected — back out of all inherited plugins
1268
+ }
1269
+
1270
+ const repository =
1271
+ (await detectGitRemoteUrl(process.cwd()).catch(() => undefined)) ??
1272
+ parentConfig?.repository;
1273
+
1259
1274
  if (!parentConfig) {
1260
1275
  try {
1261
1276
  parentConfig = await timePhase(
@@ -1273,7 +1288,8 @@ export default createPlugin({
1273
1288
  account,
1274
1289
  domain,
1275
1290
  extends: extendsRef,
1276
- plugins: plugins ?? [],
1291
+ plugins,
1292
+ overrides,
1277
1293
  filesCopied: 0,
1278
1294
  timings,
1279
1295
  error: `No config found at ${extendsRef} — are you sure this is the right parent?`,
@@ -1315,7 +1331,8 @@ export default createPlugin({
1315
1331
  account: account || extendsAccount,
1316
1332
  domain,
1317
1333
  plugins,
1318
- withHost,
1334
+ overrides,
1335
+ repository,
1319
1336
  }),
1320
1337
  s,
1321
1338
  );
@@ -1330,21 +1347,24 @@ export default createPlugin({
1330
1347
  account,
1331
1348
  domain,
1332
1349
  extends: extendsRef,
1333
- plugins: plugins ?? [],
1350
+ plugins,
1351
+ overrides,
1334
1352
  filesCopied: 0,
1335
1353
  error: "No .templatekeep found in template source",
1336
1354
  };
1337
1355
  }
1338
1356
 
1339
1357
  const pluginRoutes: Record<string, string[]> = {};
1340
- const parentRuntimePlugins = await buildRuntimePluginsForConfig(
1341
- parentConfig as BosConfig,
1342
- sourceDir,
1343
- "production",
1344
- );
1345
- for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) {
1346
- if (plugin.routes && plugin.routes.length > 0) {
1347
- pluginRoutes[key] = plugin.routes;
1358
+ if (overrides.includes("plugins")) {
1359
+ const parentRuntimePlugins = await buildRuntimePluginsForConfig(
1360
+ parentConfig as BosConfig,
1361
+ sourceDir,
1362
+ "production",
1363
+ );
1364
+ for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) {
1365
+ if (plugin.routes && plugin.routes.length > 0) {
1366
+ pluginRoutes[key] = plugin.routes;
1367
+ }
1348
1368
  }
1349
1369
  }
1350
1370
 
@@ -1353,7 +1373,7 @@ export default createPlugin({
1353
1373
  "copy files",
1354
1374
  () =>
1355
1375
  copyFilteredFiles(sourceDir, targetDir, patterns, {
1356
- withHost,
1376
+ overrides,
1357
1377
  plugins,
1358
1378
  pluginRoutes,
1359
1379
  }),
@@ -1370,9 +1390,10 @@ export default createPlugin({
1370
1390
  account: account || extendsAccount,
1371
1391
  domain: domain || extendsGateway,
1372
1392
  plugins,
1393
+ overrides,
1373
1394
  pluginRoutes,
1374
1395
  workspaceOpts: { sourceDir },
1375
- withHost,
1396
+ repository,
1376
1397
  }),
1377
1398
  s,
1378
1399
  );
@@ -1382,7 +1403,7 @@ export default createPlugin({
1382
1403
  "write snapshot",
1383
1404
  () =>
1384
1405
  writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
1385
- withHost,
1406
+ overrides,
1386
1407
  plugins,
1387
1408
  pluginRoutes,
1388
1409
  }),
@@ -1466,6 +1487,7 @@ export default createPlugin({
1466
1487
  domain,
1467
1488
  extends: extendsRef,
1468
1489
  plugins,
1490
+ overrides,
1469
1491
  filesCopied,
1470
1492
  timings,
1471
1493
  };
@@ -1486,6 +1508,7 @@ export default createPlugin({
1486
1508
  domain: input.domain,
1487
1509
  extends: extendsRef,
1488
1510
  plugins: input.plugins ?? [],
1511
+ overrides: input.overrides,
1489
1512
  filesCopied: 0,
1490
1513
  timings: [],
1491
1514
  error: error instanceof Error ? error.message : "Unknown error",