@nocobase/cli 2.1.0-beta.36 → 2.1.0-beta.37

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.
@@ -15,9 +15,9 @@ import { getEnv, upsertEnv } from "../lib/auth-store.js";
15
15
  import { runPromptCatalog, } from "../lib/prompt-catalog.js";
16
16
  import { applyCliLocale, localeText, translateCli } from "../lib/cli-locale.js";
17
17
  import { resolveDefaultConfigScope } from '../lib/cli-home.js';
18
- import { runPromptCatalogWebUI, } from "../lib/prompt-web-ui.js";
18
+ import { runPromptCatalogWebUI } from "../lib/prompt-web-ui.js";
19
19
  import { validateApiBaseUrl, validateEnvKey } from "../lib/prompt-validators.js";
20
- import { inspectSkillsStatus, installNocoBaseSkills, updateNocoBaseSkills, } from '../lib/skills-manager.js';
20
+ import { installNocoBaseSkills, isNpmRegistryUnavailable } from '../lib/skills-manager.js';
21
21
  import { omitKeys, pickKeys } from "../lib/object-utils.js";
22
22
  import { printInfo, printStage, printVerbose, printWarning } from '../lib/ui.js';
23
23
  import Download from "./download.js";
@@ -33,6 +33,8 @@ const INIT_ENV_ADD_FLAG_NAMES = [
33
33
  'auth-type',
34
34
  'access-token',
35
35
  'token',
36
+ 'username',
37
+ 'password',
36
38
  'skip-auth',
37
39
  ];
38
40
  const initText = (key, values) => localeText(`commands.init.${key}`, values);
@@ -51,8 +53,8 @@ function existingAppOnly(def) {
51
53
  function newInstallOnly(def) {
52
54
  return withExtraHidden(def, (values) => values.hasNocobase !== 'no');
53
55
  }
54
- function downloadInNewInstallOnly(def) {
55
- return withExtraHidden(def, (values) => values.hasNocobase !== 'no' || values.fetchSource !== true);
56
+ function newInstallDownloadExecutionOnly(def) {
57
+ return withExtraHidden(def, (values) => values.hasNocobase !== 'no' || values.skipDownload === true);
56
58
  }
57
59
  function argvHasToken(argv, tokens) {
58
60
  return tokens.some((token) => argv.includes(token));
@@ -65,9 +67,7 @@ function resolveInitDownloadVersion(results) {
65
67
  return preset;
66
68
  }
67
69
  function initVersionPromptValue(version) {
68
- return version === 'latest' || version === 'beta' || version === 'alpha'
69
- ? version
70
- : 'other';
70
+ return version === 'latest' || version === 'beta' || version === 'alpha' ? version : 'other';
71
71
  }
72
72
  function yesInitialValue(def, fallback) {
73
73
  if ('yesInitialValue' in def && def.yesInitialValue !== undefined) {
@@ -76,8 +76,7 @@ function yesInitialValue(def, fallback) {
76
76
  return fallback;
77
77
  }
78
78
  function hasDownloadOverride(flags) {
79
- return Boolean(String(flags.source ?? '').trim()
80
- || String(flags.version ?? '').trim());
79
+ return Boolean(String(flags.source ?? '').trim() || String(flags.version ?? '').trim());
81
80
  }
82
81
  function explicitApiBaseUrlFlag(flags) {
83
82
  return String(flags['api-base-url'] ?? '').trim();
@@ -125,9 +124,7 @@ function formatSkippedAppNameRequiredMessage() {
125
124
  ].join('\n');
126
125
  }
127
126
  function shellQuoteArg(value) {
128
- return /^[A-Za-z0-9_@%+=:,./-]+$/.test(value)
129
- ? value
130
- : `'${value.replace(/'/g, `'\\''`)}'`;
127
+ return /^[A-Za-z0-9_@%+=:,./-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
131
128
  }
132
129
  function initTitle() {
133
130
  return 'Set up NocoBase';
@@ -234,20 +231,27 @@ Prompt modes:
234
231
  validate: validateApiBaseUrl,
235
232
  }),
236
233
  authType: existingAppOnly(EnvAdd.prompts.authType),
234
+ username: existingAppOnly(EnvAdd.prompts.username),
235
+ password: existingAppOnly(EnvAdd.prompts.password),
237
236
  accessToken: existingAppOnly(EnvAdd.prompts.accessToken),
238
237
  lang: newInstallOnly(Install.appPrompts.lang),
239
238
  appRootPath: newInstallOnly(Install.appPrompts.appRootPath),
240
239
  appPort: newInstallOnly(Install.appPrompts.appPort),
241
240
  storagePath: newInstallOnly(Install.appPrompts.storagePath),
242
- fetchSource: newInstallOnly(Install.appPrompts.fetchSource),
243
- source: downloadInNewInstallOnly(Download.prompts.source),
244
- version: downloadInNewInstallOnly(Download.prompts.version),
245
- otherVersion: downloadInNewInstallOnly(Download.prompts.otherVersion),
246
- dockerRegistry: downloadInNewInstallOnly(Download.prompts.dockerRegistry),
247
- dockerPlatform: downloadInNewInstallOnly(Download.prompts.dockerPlatform),
248
- dockerSave: downloadInNewInstallOnly(Download.prompts.dockerSave),
249
- gitUrl: downloadInNewInstallOnly(Download.prompts.gitUrl),
250
- outputDir: downloadInNewInstallOnly({
241
+ skipDownload: newInstallOnly({
242
+ type: 'boolean',
243
+ message: initText('prompts.skipDownload.message'),
244
+ initialValue: false,
245
+ yesInitialValue: false,
246
+ }),
247
+ source: newInstallOnly(Download.prompts.source),
248
+ version: newInstallOnly(Download.prompts.version),
249
+ otherVersion: newInstallOnly(Download.prompts.otherVersion),
250
+ dockerRegistry: newInstallOnly(Download.prompts.dockerRegistry),
251
+ dockerPlatform: newInstallOnly(Download.prompts.dockerPlatform),
252
+ dockerSave: newInstallDownloadExecutionOnly(Download.prompts.dockerSave),
253
+ gitUrl: newInstallOnly(Download.prompts.gitUrl),
254
+ outputDir: newInstallDownloadExecutionOnly({
251
255
  ...DOWNLOAD_OUTPUT_DIR_PROMPT,
252
256
  hidden: (values) => {
253
257
  const source = String(values.source ?? '').trim();
@@ -268,11 +272,11 @@ Prompt modes:
268
272
  return typeof initialValue === 'function' ? initialValue(values) : String(initialValue ?? '');
269
273
  },
270
274
  }),
271
- npmRegistry: downloadInNewInstallOnly(Download.prompts.npmRegistry),
272
- replace: downloadInNewInstallOnly(Download.prompts.replace),
273
- devDependencies: downloadInNewInstallOnly(Download.prompts.devDependencies),
274
- build: downloadInNewInstallOnly(Download.prompts.build),
275
- buildDts: downloadInNewInstallOnly(Download.prompts.buildDts),
275
+ npmRegistry: newInstallOnly(Download.prompts.npmRegistry),
276
+ replace: newInstallDownloadExecutionOnly(Download.prompts.replace),
277
+ devDependencies: newInstallDownloadExecutionOnly(Download.prompts.devDependencies),
278
+ build: newInstallDownloadExecutionOnly(Download.prompts.build),
279
+ buildDts: newInstallDownloadExecutionOnly(Download.prompts.buildDts),
276
280
  dbDialect: newInstallOnly(Install.dbPrompts.dbDialect),
277
281
  builtinDb: newInstallOnly(Install.dbPrompts.builtinDb),
278
282
  builtinDbImage: newInstallOnly(Install.dbPrompts.builtinDbImage),
@@ -281,23 +285,36 @@ Prompt modes:
281
285
  dbDatabase: newInstallOnly(Install.dbPrompts.dbDatabase),
282
286
  dbUser: newInstallOnly(Install.dbPrompts.dbUser),
283
287
  dbPassword: newInstallOnly(Install.dbPrompts.dbPassword),
288
+ dbSchema: newInstallOnly(Install.dbPrompts.dbSchema),
289
+ dbTablePrefix: newInstallOnly(Install.dbPrompts.dbTablePrefix),
290
+ dbUnderscored: newInstallOnly(Install.dbPrompts.dbUnderscored),
284
291
  rootUsername: newInstallOnly(Install.rootUserPrompts.rootUsername),
285
292
  rootEmail: newInstallOnly(Install.rootUserPrompts.rootEmail),
286
293
  rootPassword: newInstallOnly(Install.rootUserPrompts.rootPassword),
287
294
  rootNickname: newInstallOnly(Install.rootUserPrompts.rootNickname),
288
295
  };
289
296
  buildPromptCatalog(flags) {
290
- if (!flags['skip-auth']) {
291
- return Init.prompts;
292
- }
293
- const accessTokenPrompt = {
294
- ...EnvAdd.prompts.accessToken,
295
- hidden: () => true,
296
- };
297
- return {
297
+ const prompts = {
298
298
  ...Init.prompts,
299
- accessToken: existingAppOnly(accessTokenPrompt),
300
299
  };
300
+ if (flags['skip-auth']) {
301
+ const accessTokenPrompt = {
302
+ ...EnvAdd.prompts.accessToken,
303
+ hidden: () => true,
304
+ };
305
+ const usernamePrompt = {
306
+ ...EnvAdd.prompts.username,
307
+ hidden: () => true,
308
+ };
309
+ const passwordPrompt = {
310
+ ...EnvAdd.prompts.password,
311
+ hidden: () => true,
312
+ };
313
+ prompts.username = existingAppOnly(usernamePrompt);
314
+ prompts.password = existingAppOnly(passwordPrompt);
315
+ prompts.accessToken = existingAppOnly(accessTokenPrompt);
316
+ }
317
+ return prompts;
301
318
  }
302
319
  parsedFlagsForPromptSeeds;
303
320
  static flags = {
@@ -319,7 +336,7 @@ Prompt modes:
319
336
  default: false,
320
337
  }),
321
338
  'skip-skills': Flags.boolean({
322
- description: 'Skip installing or updating NocoBase AI coding skills during init',
339
+ description: 'Skip installing NocoBase AI coding skills during init',
323
340
  default: false,
324
341
  }),
325
342
  'ui-host': Flags.string({
@@ -344,15 +361,14 @@ Prompt modes:
344
361
  if (normalizedFlags.ui && normalizedFlags.yes) {
345
362
  this.error('--ui cannot be used with --yes.');
346
363
  }
347
- if (normalizedFlags['skip-auth']
348
- && (normalizedFlags['access-token'] !== undefined || normalizedFlags.token !== undefined)) {
364
+ if (normalizedFlags['skip-auth'] &&
365
+ (normalizedFlags['access-token'] !== undefined || normalizedFlags.token !== undefined)) {
349
366
  this.error('--skip-auth cannot be used with --access-token or --token.');
350
367
  }
351
368
  if (normalizedFlags.ui && normalizedFlags.resume) {
352
369
  this.error('--ui cannot be used with --resume.');
353
370
  }
354
- if (!normalizedFlags.ui &&
355
- (normalizedFlags['ui-host'] !== undefined || normalizedFlags['ui-port'] !== undefined)) {
371
+ if (!normalizedFlags.ui && (normalizedFlags['ui-host'] !== undefined || normalizedFlags['ui-port'] !== undefined)) {
356
372
  this.error('--ui-host and --ui-port require --ui.');
357
373
  }
358
374
  if (normalizedFlags.resume) {
@@ -454,8 +470,17 @@ Prompt modes:
454
470
  command: this,
455
471
  });
456
472
  const normalizedResults = {
473
+ ...pickKeys(presetValues, [
474
+ 'authType',
475
+ 'accessToken',
476
+ 'dbSchema',
477
+ 'dbTablePrefix',
478
+ 'dbUnderscored',
479
+ 'skipAuth',
480
+ 'username',
481
+ 'password',
482
+ ]),
457
483
  ...results,
458
- ...pickKeys(presetValues, ['dbSchema', 'dbTablePrefix', 'dbUnderscored', 'skipAuth']),
459
484
  };
460
485
  const hasNocobase = normalizedResults.hasNocobase === 'yes';
461
486
  const existingEnv = !hasNocobase
@@ -510,9 +535,7 @@ Prompt modes:
510
535
  }
511
536
  }
512
537
  const downloadSeed = { ...presetValues };
513
- if (flags.yes
514
- && !Object.prototype.hasOwnProperty.call(downloadSeed, 'source')
515
- && downloadSeed.fetchSource !== false) {
538
+ if (flags.yes && !Object.prototype.hasOwnProperty.call(downloadSeed, 'source')) {
516
539
  downloadSeed.source = 'docker';
517
540
  }
518
541
  const dbInitial = await Install.buildDbPromptInitialValues({
@@ -544,6 +567,8 @@ Prompt modes:
544
567
  catalog: {
545
568
  apiBaseUrl: c.apiBaseUrl,
546
569
  authType: c.authType,
570
+ username: c.username,
571
+ password: c.password,
547
572
  accessToken: c.accessToken,
548
573
  },
549
574
  },
@@ -555,7 +580,7 @@ Prompt modes:
555
580
  appRootPath: c.appRootPath,
556
581
  appPort: c.appPort,
557
582
  storagePath: c.storagePath,
558
- fetchSource: c.fetchSource,
583
+ skipDownload: c.skipDownload,
559
584
  },
560
585
  },
561
586
  {
@@ -589,6 +614,9 @@ Prompt modes:
589
614
  dbDatabase: c.dbDatabase,
590
615
  dbUser: c.dbUser,
591
616
  dbPassword: c.dbPassword,
617
+ dbSchema: c.dbSchema,
618
+ dbTablePrefix: c.dbTablePrefix,
619
+ dbUnderscored: c.dbUnderscored,
592
620
  },
593
621
  },
594
622
  {
@@ -614,8 +642,7 @@ Prompt modes:
614
642
  preset.hasNocobase = 'yes';
615
643
  preset.apiBaseUrl = apiBaseUrl;
616
644
  }
617
- else if (flags['default-api-base-url'] !== undefined
618
- && String(flags['default-api-base-url']).trim() !== '') {
645
+ else if (flags['default-api-base-url'] !== undefined && String(flags['default-api-base-url']).trim() !== '') {
619
646
  preset.apiBaseUrl = String(flags['default-api-base-url']).trim();
620
647
  }
621
648
  if (flags['auth-type'] !== undefined && String(flags['auth-type']).trim() !== '') {
@@ -628,6 +655,12 @@ Prompt modes:
628
655
  if (flags['access-token'] !== undefined || flags.token !== undefined) {
629
656
  preset.accessToken = accessToken;
630
657
  }
658
+ if (flags.username !== undefined) {
659
+ preset.username = String(flags.username ?? '').trim();
660
+ }
661
+ if (flags.password !== undefined) {
662
+ preset.password = String(flags.password ?? '');
663
+ }
631
664
  if (flags.lang !== undefined && String(flags.lang).trim() !== '') {
632
665
  preset.lang = String(flags.lang).trim();
633
666
  }
@@ -683,8 +716,15 @@ Prompt modes:
683
716
  if (argvHasToken(argv, ['--db-underscored', '--no-db-underscored'])) {
684
717
  preset.dbUnderscored = Boolean(flags['db-underscored']);
685
718
  }
686
- if (argvHasToken(argv, ['--fetch-source'])) {
687
- preset.fetchSource = Boolean(flags['fetch-source']);
719
+ if (argvHasToken(argv, ['--skip-download'])) {
720
+ preset.skipDownload = Boolean(flags['skip-download']);
721
+ if (preset.skipDownload) {
722
+ preset.dockerSave = false;
723
+ preset.replace = false;
724
+ preset.devDependencies = false;
725
+ preset.build = false;
726
+ preset.buildDts = false;
727
+ }
688
728
  }
689
729
  if (flags.source !== undefined && String(flags.source).trim() !== '') {
690
730
  preset.source = String(flags.source).trim();
@@ -747,19 +787,16 @@ Prompt modes:
747
787
  }
748
788
  try {
749
789
  logInitStage('Syncing agent skills');
750
- const status = await inspectSkillsStatus();
751
- if (!status.installed) {
752
- printVerbose('Installing NocoBase agent skills (nb skills install)');
753
- await installNocoBaseSkills();
754
- printInfo('Agent skills ready.');
755
- return;
756
- }
757
- printVerbose('Updating NocoBase agent skills (nb skills update)');
758
- await updateNocoBaseSkills();
790
+ await installNocoBaseSkills();
759
791
  printInfo('Agent skills ready.');
760
792
  }
761
793
  catch (error) {
762
794
  const message = error instanceof Error ? error.message : String(error);
795
+ if (isNpmRegistryUnavailable(error)) {
796
+ printWarning(translateCli('commands.init.messages.skillsSyncRegistryUnavailable'));
797
+ printVerbose(`Skipped agent skills sync because the npm registry was unavailable: ${message}`);
798
+ return;
799
+ }
763
800
  this.error(pc.red(`Skills sync failed: ${message}`));
764
801
  this.exit(1);
765
802
  }
@@ -786,7 +823,9 @@ Prompt modes:
786
823
  const dbTablePrefix = String(results.dbTablePrefix ?? '').trim();
787
824
  const apiBaseUrl = String(results.apiBaseUrl ?? '').trim();
788
825
  const authType = String(results.authType ?? '').trim() || 'oauth';
826
+ const authUsername = authType === 'basic' ? String(results.username ?? results.rootUsername ?? '').trim() : '';
789
827
  const accessToken = String(results.accessToken ?? '');
828
+ const skipDownload = results.skipDownload === true;
790
829
  const builtinDb = explicitDbHostFlag(flags)
791
830
  ? false
792
831
  : results.builtinDb === undefined
@@ -802,7 +841,8 @@ Prompt modes:
802
841
  : {}),
803
842
  ...(apiBaseUrl ? { apiBaseUrl } : appPort ? { apiBaseUrl: `http://127.0.0.1:${appPort}/api` } : {}),
804
843
  ...(authType ? { authType } : {}),
805
- ...(authType === 'token' && accessToken ? { accessToken } : {}),
844
+ ...(authUsername ? { authUsername } : {}),
845
+ ...((authType === 'token' || authType === 'basic') && accessToken ? { accessToken } : {}),
806
846
  ...(source ? { source } : {}),
807
847
  ...(version ? { downloadVersion: version } : {}),
808
848
  ...(dockerRegistry ? { dockerRegistry } : {}),
@@ -812,9 +852,11 @@ Prompt modes:
812
852
  ...(appRootPath ? { appRootPath } : {}),
813
853
  ...(storagePath ? { storagePath } : {}),
814
854
  ...(appPort ? { appPort } : {}),
815
- ...(results.devDependencies !== undefined ? { devDependencies: Boolean(results.devDependencies) } : {}),
816
- ...(results.build !== undefined ? { build: Boolean(results.build) } : {}),
817
- ...(results.buildDts !== undefined ? { buildDts: Boolean(results.buildDts) } : {}),
855
+ ...(!skipDownload && results.devDependencies !== undefined
856
+ ? { devDependencies: Boolean(results.devDependencies) }
857
+ : {}),
858
+ ...(!skipDownload && results.build !== undefined ? { build: Boolean(results.build) } : {}),
859
+ ...(!skipDownload && results.buildDts !== undefined ? { buildDts: Boolean(results.buildDts) } : {}),
818
860
  ...(builtinDb !== undefined ? { builtinDb } : {}),
819
861
  ...(dbDialect ? { dbDialect } : {}),
820
862
  ...(builtinDbImage || builtinDb === false ? { builtinDbImage: builtinDbImage || undefined } : {}),
@@ -834,12 +876,20 @@ Prompt modes:
834
876
  argv.push('--api-base-url', String(results.apiBaseUrl ?? DEFAULT_INIT_API_BASE_URL));
835
877
  argv.push('--auth-type', String(results.authType ?? 'oauth'));
836
878
  const accessToken = String(results.accessToken ?? '');
879
+ const username = String(results.username ?? '').trim();
880
+ const password = String(results.password ?? '');
837
881
  if (results.skipAuth === true) {
838
882
  argv.push('--skip-auth');
839
883
  }
840
884
  else if (results.authType === 'token' && accessToken) {
841
885
  argv.push('--access-token', accessToken);
842
886
  }
887
+ if (results.authType === 'basic' && username) {
888
+ argv.push('--username', username);
889
+ }
890
+ if (results.authType === 'basic' && results.skipAuth !== true && password) {
891
+ argv.push('--password', password);
892
+ }
843
893
  return argv;
844
894
  }
845
895
  buildInstallArgv(results, flags, options) {
@@ -851,15 +901,18 @@ Prompt modes:
851
901
  const processArgv = process.argv.slice(2);
852
902
  const envName = String(results.appName ?? DEFAULT_INIT_APP_NAME).trim() || DEFAULT_INIT_APP_NAME;
853
903
  const source = String(results.source ?? '').trim();
904
+ const skipDownload = Boolean(flags['skip-download']) || results.skipDownload === true;
854
905
  const hasNocobase = String(results.hasNocobase ?? '').trim() === 'yes';
855
906
  const apiBaseUrl = String(results.apiBaseUrl ?? '').trim();
856
907
  const authType = String(results.authType ?? '').trim();
857
908
  const accessToken = String(results.accessToken ?? '');
909
+ const username = String(results.username ?? flags.username ?? '').trim();
910
+ const password = String(results.password ?? flags.password ?? '');
858
911
  argv.push('--env', envName);
859
912
  if (options?.resume) {
860
913
  argv.push('--resume');
861
914
  }
862
- if (Boolean(flags.verbose)) {
915
+ if (flags.verbose) {
863
916
  argv.push('--verbose');
864
917
  }
865
918
  if (hasNocobase && apiBaseUrl) {
@@ -874,6 +927,12 @@ Prompt modes:
874
927
  if (authType === 'token' && accessToken) {
875
928
  argv.push('--access-token', accessToken);
876
929
  }
930
+ if (authType === 'basic' && username) {
931
+ argv.push('--username', username);
932
+ }
933
+ if (authType === 'basic' && password) {
934
+ argv.push('--password', password);
935
+ }
877
936
  const lang = String(results.lang ?? '').trim();
878
937
  if (lang) {
879
938
  argv.push('--lang', lang);
@@ -890,54 +949,56 @@ Prompt modes:
890
949
  if (storagePath) {
891
950
  argv.push('--storage-path', storagePath);
892
951
  }
893
- if (Boolean(flags.force)) {
952
+ if (flags.force) {
894
953
  argv.push('--force');
895
954
  }
896
- if (Boolean(results.fetchSource)) {
897
- argv.push('--fetch-source');
898
- if (source) {
899
- argv.push('--source', source);
900
- }
901
- const version = resolveInitDownloadVersion(results);
902
- if (version) {
903
- argv.push('--version', version);
904
- }
955
+ if (source) {
956
+ argv.push('--source', source);
957
+ }
958
+ const version = resolveInitDownloadVersion(results);
959
+ if (version) {
960
+ argv.push('--version', version);
961
+ }
962
+ const gitUrl = String(results.gitUrl ?? '').trim();
963
+ if (gitUrl) {
964
+ argv.push('--git-url', gitUrl);
965
+ }
966
+ const dockerRegistry = String(results.dockerRegistry ?? '').trim();
967
+ if (dockerRegistry) {
968
+ argv.push('--docker-registry', dockerRegistry);
969
+ }
970
+ const dockerPlatform = String(results.dockerPlatform ?? '').trim();
971
+ if (dockerPlatform) {
972
+ argv.push('--docker-platform', dockerPlatform);
973
+ }
974
+ const npmRegistry = String(results.npmRegistry ?? '').trim();
975
+ if (npmRegistry) {
976
+ argv.push('--npm-registry', npmRegistry);
977
+ }
978
+ if (skipDownload) {
979
+ argv.push('--skip-download');
980
+ }
981
+ else {
905
982
  const outputDir = String(results.outputDir ?? '').trim();
906
983
  if (outputDir) {
907
984
  argv.push('--output-dir', outputDir);
908
985
  }
909
- const gitUrl = String(results.gitUrl ?? '').trim();
910
- if (gitUrl) {
911
- argv.push('--git-url', gitUrl);
912
- }
913
- const dockerRegistry = String(results.dockerRegistry ?? '').trim();
914
- if (dockerRegistry) {
915
- argv.push('--docker-registry', dockerRegistry);
916
- }
917
- const dockerPlatform = String(results.dockerPlatform ?? '').trim();
918
- if (dockerPlatform) {
919
- argv.push('--docker-platform', dockerPlatform);
920
- }
921
- const npmRegistry = String(results.npmRegistry ?? '').trim();
922
- if (npmRegistry) {
923
- argv.push('--npm-registry', npmRegistry);
924
- }
925
- if (Boolean(results.replace)) {
986
+ if (results.replace) {
926
987
  argv.push('--replace');
927
988
  }
928
- if (Boolean(results.devDependencies)) {
989
+ if (results.devDependencies) {
929
990
  argv.push('--dev-dependencies');
930
991
  }
931
- if (Boolean(results.dockerSave)) {
992
+ if (results.dockerSave) {
932
993
  argv.push('--docker-save');
933
994
  }
934
- if (results.build !== undefined && !Boolean(results.build)) {
995
+ if (results.build !== undefined && !results.build) {
935
996
  argv.push('--no-build');
936
997
  }
937
998
  else if (argvHasToken(processArgv, ['--build', '--no-build']) && flags.build === false) {
938
999
  argv.push('--no-build');
939
1000
  }
940
- if (Boolean(results.buildDts)) {
1001
+ if (results.buildDts) {
941
1002
  argv.push('--build-dts');
942
1003
  }
943
1004
  }
@@ -965,9 +1026,9 @@ Prompt modes:
965
1026
  const dbPortWasProvided = argvHasToken(processArgv, ['--db-port']);
966
1027
  const dockerBuiltinDbPortIsHidden = builtinDb && source === 'docker';
967
1028
  const dbDefaultPort = defaultDbPortForDialect(dbDialect);
968
- if (dbPort
969
- && (!dockerBuiltinDbPortIsHidden || dbPortWasProvided)
970
- && (!flags.yes || dbPortWasProvided || dbPort !== dbDefaultPort)) {
1029
+ if (dbPort &&
1030
+ (!dockerBuiltinDbPortIsHidden || dbPortWasProvided) &&
1031
+ (!flags.yes || dbPortWasProvided || dbPort !== dbDefaultPort)) {
971
1032
  argv.push('--db-port', dbPort);
972
1033
  }
973
1034
  const dbDatabase = String(results.dbDatabase ?? '').trim();
@@ -991,7 +1052,7 @@ Prompt modes:
991
1052
  argv.push('--db-table-prefix', dbTablePrefix);
992
1053
  }
993
1054
  if (results.dbUnderscored !== undefined) {
994
- argv.push(Boolean(results.dbUnderscored) ? '--db-underscored' : '--no-db-underscored');
1055
+ argv.push(results.dbUnderscored ? '--db-underscored' : '--no-db-underscored');
995
1056
  }
996
1057
  const rootUsername = String(results.rootUsername ?? '').trim();
997
1058
  if (rootUsername) {
@@ -1013,50 +1074,54 @@ Prompt modes:
1013
1074
  }
1014
1075
  buildManagedInstallResumeCommand(results, flags) {
1015
1076
  const argv = ['nb', 'init'];
1016
- if (Boolean(flags.yes)) {
1077
+ if (flags.yes) {
1017
1078
  argv.push('--yes');
1018
1079
  }
1019
1080
  const envName = String(results.appName ?? DEFAULT_INIT_APP_NAME).trim() || DEFAULT_INIT_APP_NAME;
1020
1081
  argv.push('--env', envName);
1021
- if (Boolean(results.fetchSource)) {
1022
- const source = String(results.source ?? '').trim();
1023
- if (source) {
1024
- argv.push('--source', source);
1025
- }
1026
- const version = resolveInitDownloadVersion(results);
1027
- if (version) {
1028
- argv.push('--version', version);
1029
- }
1082
+ const source = String(results.source ?? '').trim();
1083
+ const skipDownload = Boolean(flags['skip-download']) || results.skipDownload === true;
1084
+ if (source) {
1085
+ argv.push('--source', source);
1086
+ }
1087
+ const version = resolveInitDownloadVersion(results);
1088
+ if (version) {
1089
+ argv.push('--version', version);
1090
+ }
1091
+ const gitUrl = String(results.gitUrl ?? '').trim();
1092
+ if (gitUrl) {
1093
+ argv.push('--git-url', gitUrl);
1094
+ }
1095
+ const dockerRegistry = String(results.dockerRegistry ?? '').trim();
1096
+ if (dockerRegistry) {
1097
+ argv.push('--docker-registry', dockerRegistry);
1098
+ }
1099
+ const dockerPlatform = String(results.dockerPlatform ?? '').trim();
1100
+ if (dockerPlatform) {
1101
+ argv.push('--docker-platform', dockerPlatform);
1102
+ }
1103
+ const npmRegistry = String(results.npmRegistry ?? '').trim();
1104
+ if (npmRegistry) {
1105
+ argv.push('--npm-registry', npmRegistry);
1106
+ }
1107
+ if (skipDownload) {
1108
+ argv.push('--skip-download');
1109
+ }
1110
+ else {
1030
1111
  const outputDir = String(results.outputDir ?? '').trim();
1031
1112
  if (outputDir && outputDir !== String(results.appRootPath ?? '').trim()) {
1032
1113
  argv.push('--output-dir', outputDir);
1033
1114
  }
1034
- const gitUrl = String(results.gitUrl ?? '').trim();
1035
- if (gitUrl) {
1036
- argv.push('--git-url', gitUrl);
1037
- }
1038
- const dockerRegistry = String(results.dockerRegistry ?? '').trim();
1039
- if (dockerRegistry) {
1040
- argv.push('--docker-registry', dockerRegistry);
1041
- }
1042
- const dockerPlatform = String(results.dockerPlatform ?? '').trim();
1043
- if (dockerPlatform) {
1044
- argv.push('--docker-platform', dockerPlatform);
1045
- }
1046
- const npmRegistry = String(results.npmRegistry ?? '').trim();
1047
- if (npmRegistry) {
1048
- argv.push('--npm-registry', npmRegistry);
1049
- }
1050
- if (Boolean(results.devDependencies)) {
1115
+ if (results.devDependencies) {
1051
1116
  argv.push('--dev-dependencies');
1052
1117
  }
1053
- if (Boolean(results.dockerSave)) {
1118
+ if (results.dockerSave) {
1054
1119
  argv.push('--docker-save');
1055
1120
  }
1056
- if (results.build !== undefined && !Boolean(results.build)) {
1121
+ if (results.build !== undefined && !results.build) {
1057
1122
  argv.push('--no-build');
1058
1123
  }
1059
- if (Boolean(results.buildDts)) {
1124
+ if (results.buildDts) {
1060
1125
  argv.push('--build-dts');
1061
1126
  }
1062
1127
  }
@@ -1065,11 +1130,7 @@ Prompt modes:
1065
1130
  }
1066
1131
  formatManagedInstallFailureMessage(message, results, flags) {
1067
1132
  const command = this.buildManagedInstallResumeCommand(results, flags);
1068
- return [
1069
- message,
1070
- '',
1071
- translateCli('commands.init.messages.resumeAfterInstallFailure', { command }),
1072
- ].join('\n');
1133
+ return [message, '', translateCli('commands.init.messages.resumeAfterInstallFailure', { command })].join('\n');
1073
1134
  }
1074
1135
  buildResumeInstallArgv(flags) {
1075
1136
  const preset = this.buildPresetValuesFromFlags(flags);
@@ -1080,10 +1141,9 @@ Prompt modes:
1080
1141
  preset.rootPassword ??= yesInitialValue(Install.rootUserPrompts.rootPassword, 'admin123');
1081
1142
  preset.rootNickname ??= yesInitialValue(Install.rootUserPrompts.rootNickname, 'Super Admin');
1082
1143
  }
1083
- if (hasDownloadOverride(flags)) {
1084
- preset.fetchSource ??= true;
1144
+ if (!flags['skip-download']) {
1145
+ preset.replace ??= true;
1085
1146
  }
1086
- preset.replace ??= true;
1087
1147
  return this.buildInstallArgv(preset, flags, {
1088
1148
  nonInteractive: Boolean(flags.yes),
1089
1149
  resume: true,