@equinor/fusion-framework-cli 11.0.0-next.1 → 11.0.0-next.11

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 +108 -0
  2. package/bin/build/bin.js +16 -9
  3. package/bin/build/cli.js +443 -212
  4. package/bin/build/create-auth-client-B_j4Y_Dr.js +1415 -0
  5. package/bin/build/portal-config-publish-ezU_DFki.js +29578 -0
  6. package/dist/esm/bin/app-dev.js +17 -7
  7. package/dist/esm/bin/app-dev.js.map +1 -1
  8. package/dist/esm/bin/helpers/resolve-portal-config.js +46 -0
  9. package/dist/esm/bin/helpers/resolve-portal-config.js.map +1 -0
  10. package/dist/esm/bin/index.js +2 -0
  11. package/dist/esm/bin/index.js.map +1 -1
  12. package/dist/esm/bin/portal-config-publish.js +74 -0
  13. package/dist/esm/bin/portal-config-publish.js.map +1 -0
  14. package/dist/esm/bin/portal-config.js +48 -0
  15. package/dist/esm/bin/portal-config.js.map +1 -0
  16. package/dist/esm/bin/portal-dev.js +13 -21
  17. package/dist/esm/bin/portal-dev.js.map +1 -1
  18. package/dist/esm/bin/utils/create-dev-server.js +4 -4
  19. package/dist/esm/bin/utils/create-dev-server.js.map +1 -1
  20. package/dist/esm/cli/commands/app/alias.js +4 -4
  21. package/dist/esm/cli/commands/app/alias.js.map +1 -1
  22. package/dist/esm/cli/commands/app/build.js +10 -3
  23. package/dist/esm/cli/commands/app/build.js.map +1 -1
  24. package/dist/esm/cli/commands/app/check.js +15 -5
  25. package/dist/esm/cli/commands/app/check.js.map +1 -1
  26. package/dist/esm/cli/commands/app/config.js +20 -8
  27. package/dist/esm/cli/commands/app/config.js.map +1 -1
  28. package/dist/esm/cli/commands/app/dev.js +10 -4
  29. package/dist/esm/cli/commands/app/dev.js.map +1 -1
  30. package/dist/esm/cli/commands/app/index.js +18 -1
  31. package/dist/esm/cli/commands/app/index.js.map +1 -1
  32. package/dist/esm/cli/commands/app/manifest.js +12 -3
  33. package/dist/esm/cli/commands/app/manifest.js.map +1 -1
  34. package/dist/esm/cli/commands/app/pack.js +16 -9
  35. package/dist/esm/cli/commands/app/pack.js.map +1 -1
  36. package/dist/esm/cli/commands/app/publish.js +15 -4
  37. package/dist/esm/cli/commands/app/publish.js.map +1 -1
  38. package/dist/esm/cli/commands/app/tag.js +16 -4
  39. package/dist/esm/cli/commands/app/tag.js.map +1 -1
  40. package/dist/esm/cli/commands/app/upload.js +13 -8
  41. package/dist/esm/cli/commands/app/upload.js.map +1 -1
  42. package/dist/esm/cli/commands/auth/index.js +13 -1
  43. package/dist/esm/cli/commands/auth/index.js.map +1 -1
  44. package/dist/esm/cli/commands/auth/login.js +11 -7
  45. package/dist/esm/cli/commands/auth/login.js.map +1 -1
  46. package/dist/esm/cli/commands/auth/logout.js +10 -7
  47. package/dist/esm/cli/commands/auth/logout.js.map +1 -1
  48. package/dist/esm/cli/commands/auth/token.js +13 -9
  49. package/dist/esm/cli/commands/auth/token.js.map +1 -1
  50. package/dist/esm/cli/commands/disco/resolve.js +13 -16
  51. package/dist/esm/cli/commands/disco/resolve.js.map +1 -1
  52. package/dist/esm/cli/commands/portal/build.js +12 -7
  53. package/dist/esm/cli/commands/portal/build.js.map +1 -1
  54. package/dist/esm/cli/commands/portal/config.js +101 -0
  55. package/dist/esm/cli/commands/portal/config.js.map +1 -0
  56. package/dist/esm/cli/commands/portal/dev.js +9 -6
  57. package/dist/esm/cli/commands/portal/dev.js.map +1 -1
  58. package/dist/esm/cli/commands/portal/index.js +3 -1
  59. package/dist/esm/cli/commands/portal/index.js.map +1 -1
  60. package/dist/esm/cli/commands/portal/manifest.js +11 -8
  61. package/dist/esm/cli/commands/portal/manifest.js.map +1 -1
  62. package/dist/esm/cli/commands/portal/pack.js +13 -8
  63. package/dist/esm/cli/commands/portal/pack.js.map +1 -1
  64. package/dist/esm/cli/commands/portal/publish.js +11 -8
  65. package/dist/esm/cli/commands/portal/publish.js.map +1 -1
  66. package/dist/esm/cli/commands/portal/schema.js +10 -8
  67. package/dist/esm/cli/commands/portal/schema.js.map +1 -1
  68. package/dist/esm/cli/commands/portal/tag.js +12 -8
  69. package/dist/esm/cli/commands/portal/tag.js.map +1 -1
  70. package/dist/esm/cli/commands/portal/upload.js +8 -7
  71. package/dist/esm/cli/commands/portal/upload.js.map +1 -1
  72. package/dist/esm/lib/app/create-app-manifest.js +2 -0
  73. package/dist/esm/lib/app/create-app-manifest.js.map +1 -1
  74. package/dist/esm/lib/portal/create-portal-manifest.js +5 -5
  75. package/dist/esm/lib/portal/create-portal-manifest.js.map +1 -1
  76. package/dist/esm/lib/portal/index.js +2 -0
  77. package/dist/esm/lib/portal/index.js.map +1 -1
  78. package/dist/esm/lib/portal/load-portal-config.js +49 -0
  79. package/dist/esm/lib/portal/load-portal-config.js.map +1 -0
  80. package/dist/esm/lib/portal/load-portal-manifest.js +1 -1
  81. package/dist/esm/lib/portal/load-portal-manifest.js.map +1 -1
  82. package/dist/esm/lib/portal/portal-config.js +23 -0
  83. package/dist/esm/lib/portal/portal-config.js.map +1 -0
  84. package/dist/esm/lib/portal/portal-manifest.schema.js +1 -1
  85. package/dist/esm/lib/portal/portal-manifest.schema.js.map +1 -1
  86. package/dist/esm/version.js +1 -1
  87. package/dist/esm/version.js.map +1 -1
  88. package/dist/tsconfig.tsbuildinfo +1 -1
  89. package/dist/types/bin/helpers/resolve-portal-config.d.ts +18 -0
  90. package/dist/types/bin/index.d.ts +2 -0
  91. package/dist/types/bin/portal-build.d.ts +1 -1
  92. package/dist/types/bin/portal-config-publish.d.ts +26 -0
  93. package/dist/types/bin/portal-config.d.ts +46 -0
  94. package/dist/types/bin/portal-manifest.d.ts +1 -1
  95. package/dist/types/bin/portal-pack.d.ts +1 -1
  96. package/dist/types/bin/utils/create-dev-server.d.ts +3 -3
  97. package/dist/types/cli/commands/app/config.d.ts +3 -3
  98. package/dist/types/cli/commands/app/pack.d.ts +1 -1
  99. package/dist/types/cli/commands/auth/logout.d.ts +0 -4
  100. package/dist/types/cli/commands/auth/token.d.ts +0 -5
  101. package/dist/types/cli/commands/disco/resolve.d.ts +0 -7
  102. package/dist/types/cli/commands/portal/config.d.ts +32 -0
  103. package/dist/types/lib/portal/index.d.ts +2 -0
  104. package/dist/types/lib/portal/load-portal-config.d.ts +83 -0
  105. package/dist/types/lib/portal/load-portal-manifest.d.ts +3 -3
  106. package/dist/types/lib/portal/portal-config.d.ts +69 -0
  107. package/dist/types/lib/portal/portal-manifest.schema.d.ts +7 -7
  108. package/dist/types/version.d.ts +1 -1
  109. package/package.json +26 -23
  110. package/bin/build/create-auth-client-7P8K_6Vu.js +0 -89
  111. package/bin/build/portal-pack-CAsnV44B.js +0 -12069
package/bin/build/cli.js CHANGED
@@ -4,22 +4,28 @@ import { readPackageUpSync } from 'read-package-up';
4
4
  import { createCommand, createOption, InvalidOptionArgumentError, Command } from 'commander';
5
5
  import 'node:fs';
6
6
  import chalk from 'chalk';
7
- import 'pretty-bytes';
8
- import { S as Spinner, b as buildApplication, a as bundleApp, F as FusionEnv, r as resolveDefaultEnv, f as resolveProjectPackage, h as resolveAppManifest, i as initializeFramework, p as publishAppConfig, g as generateApplicationConfig, j as formatPath, H as HttpJsonResponseError, k as loadAppManifest, s as startAppDevServer, m as fileExistsSync, N as NoAccountsError, n as createDevServer, l as loadPortalManifest, o as loadPortalSchema, w as writeFile$1, c as buildPortal, d as bundlePortal } from './portal-pack-CAsnV44B.js';
7
+ import { S as Spinner, b as buildApplication, a as bundleApp, F as FusionEnv, r as resolveDefaultEnv, i as resolveProjectPackage, j as resolveAppManifest, k as initializeFramework, p as publishAppConfig, g as generateApplicationConfig, m as formatPath, H as HttpJsonResponseError, n as loadAppManifest, s as startAppDevServer, o as fileExistsSync, N as NoAccountsError, q as resolvePortalManifest, t as resolvePortalConfig, u as createDevServer, l as loadPortalManifest, v as getDefaultExportFromCjs, w as loadPortalSchema, x as writeFile$1, c as buildPortal, d as bundlePortal, f as publishPortalConfig, e as generatePortalConfig } from './portal-config-publish-ezU_DFki.js';
9
8
  import { importJSON } from '@equinor/fusion-imports';
10
- import 'lodash.mergewith';
11
9
  import '@equinor/fusion-framework-dev-server';
12
10
  import 'vite';
13
11
  import { mkdir, writeFile } from 'node:fs/promises';
14
12
  import 'node:assert';
15
13
  import 'node:child_process';
14
+ import 'zod';
16
15
  import AdmZip from 'adm-zip';
17
16
  import { stdout } from 'node:process';
18
- import '@azure/msal-node';
19
- import 'open';
17
+ import 'http';
18
+ import 'https';
19
+ import 'crypto';
20
+ import 'buffer';
21
+ import 'stream';
22
+ import 'util';
23
+ import 'fs';
24
+ import 'path';
20
25
  import 'node:http';
21
- import 'zod';
22
- import 'is-ci';
26
+ import 'node:buffer';
27
+ import 'node:util';
28
+ import 'node:os';
23
29
  import 'ora';
24
30
 
25
31
  // ConsoleLogger provides a unified interface for logging and spinner-based feedback in CLI tools.
@@ -157,12 +163,19 @@ class ConsoleLogger {
157
163
  *
158
164
  * @see buildApplication for build implementation details
159
165
  */
160
- const command$o = createCommand('build')
161
- .description([
162
- 'Build the application using a manifest file and environment-specific configuration.',
163
- 'If no manifest is provided, the command will search for a default app.manifest.[ts|js|json] in the current directory.',
166
+ const command$p = createCommand('build')
167
+ .description('Build the application using a manifest file and environment-specific configuration.')
168
+ .addHelpText('after', [
169
+ 'Builds the application using a manifest file and environment-specific configuration.',
170
+ 'If no manifest is provided, searches for a default app.manifest.[ts|js|json] in the current directory.',
164
171
  'You can use environment variables to customize the build process.',
165
172
  '',
173
+ 'Arguments:',
174
+ ' [manifest] Manifest file to use for building (e.g., app.manifest.ts)',
175
+ '',
176
+ 'Options:',
177
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
178
+ '',
166
179
  'Examples:',
167
180
  ' $ fusion build',
168
181
  ' $ fusion build app.manifest.dev.ts --debug',
@@ -174,11 +187,7 @@ const command$o = createCommand('build')
174
187
  await buildApplication({ log, manifest });
175
188
  });
176
189
 
177
- function getDefaultExportFromCjs (x) {
178
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
179
- }
180
-
181
- const defaultArchive = 'app-bundle.zip';
190
+ const DEFAULT_ARCHIVE = 'app-bundle.zip';
182
191
  /**
183
192
  * CLI command: `pack`
184
193
  *
@@ -207,20 +216,27 @@ const defaultArchive = 'app-bundle.zip';
207
216
  *
208
217
  * @see bundleApp for implementation details
209
218
  */
210
- const command$n = createCommand('pack')
211
- .description([
212
- 'Create a distributable app bundle of the application.',
213
- 'The bundle includes all necessary files for deployment.',
214
- 'You can specify the output filename and directory.',
215
- 'Optionally, provide a manifest file to customize the bundle.',
216
- 'If no manifest is provided, the command will look for a default app.manifest.[ts|js|json] in the current directory.',
217
- 'For more details, see the Fusion Framework documentation.',
219
+ const command$o = createCommand('pack')
220
+ .description('Create a distributable app bundle of the application.')
221
+ .addHelpText('after', [
222
+ 'Creates a distributable app bundle of the application.',
223
+ 'Bundles all necessary files for deployment.',
224
+ 'You can specify the output filename and directory, and optionally provide a manifest file.',
225
+ 'If no manifest is provided, defaults to app.manifest.[ts|js|json] in the current directory.',
226
+ '',
227
+ 'Arguments:',
228
+ ' [manifest] Manifest file to use for bundling (e.g., app.manifest.ts)',
229
+ '',
230
+ 'Options:',
231
+ ' -a, --archive Name of the output archive file (default: app-bundle.zip)',
232
+ ' -o, --output Directory where the archive will be saved (default: current working directory)',
233
+ ' -d, --debug Enable debug mode for verbose logging',
218
234
  '',
219
235
  'Examples:',
220
236
  ' $ fusion pack',
221
237
  ' $ fusion pack app.manifest.dev.ts --archive my-app.zip --output ./dist',
222
238
  ].join('\n'))
223
- .option('-a, --archive [string]', 'Name of the output archive file (default: app-bundle.zip)', defaultArchive)
239
+ .option('-a, --archive [string]', 'Name of the output archive file (default: app-bundle.zip)', DEFAULT_ARCHIVE)
224
240
  .option('-o, --output [string]', 'Directory where the archive will be saved (default: current working directory)', process.cwd())
225
241
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
226
242
  .argument('[manifest]', 'Manifest file to use for bundling (e.g., app.manifest.ts)')
@@ -441,11 +457,21 @@ const checkApp = async (options) => {
441
457
  *
442
458
  * @see checkApp for implementation details
443
459
  */
444
- const command$m = withAuthOptions(createCommand('check')
445
- .description([
446
- 'Check if application is registered in Fusion app store',
447
- 'This command verifies the registration status of your application in the Fusion app store.',
448
- "It can help identify issues with your app's registration or configuration.",
460
+ const command$n = withAuthOptions(createCommand('check')
461
+ .description('Check if application is registered in Fusion app store.')
462
+ .addHelpText('after', [
463
+ 'Checks if the application is registered in the Fusion app store.',
464
+ 'Verifies the registration status of your application in the Fusion app store.',
465
+ 'Helps identify issues with app registration or configuration.',
466
+ 'Supports authentication and environment options. Provides a debug mode for verbose logging.',
467
+ '',
468
+ 'Options:',
469
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
470
+ ' --environment <env> Specify the environment (see available environments)',
471
+ ' --token <token> Provide an authentication token (if required)',
472
+ '',
473
+ 'Examples:',
474
+ ' $ fusion check --environment prod --debug',
449
475
  ].join('\n'))
450
476
  .option('-d, --debug', 'debug mode', false)
451
477
  .addOption(createEnvOption({ allowDev: false }))
@@ -621,16 +647,21 @@ const uploadApplication = async (opt) => {
621
647
  *
622
648
  * @see uploadApplication for implementation details
623
649
  */
624
- const command$l = withAuthOptions(createCommand('upload')
625
- .description([
626
- 'Upload a Fusion application bundle to the Fusion App Store.',
650
+ const command$m = withAuthOptions(createCommand('upload')
651
+ .description('Upload a Fusion application bundle to the Fusion App Store.')
652
+ .addHelpText('after', [
627
653
  '',
628
- 'This command uploads a distributable application bundle (e.g., app-bundle.zip) to the Fusion app registry, making it available for deployment and management.',
654
+ 'Uploads a Fusion application bundle to the Fusion App Store.',
655
+ 'Uploads a distributable application bundle (e.g., app-bundle.zip) to the Fusion app registry.',
656
+ 'Supports specifying application key, environment, and debug mode.',
657
+ '',
658
+ 'Arguments:',
659
+ ' [bundle] Application bundle to upload (default: app-bundle.zip)',
629
660
  '',
630
661
  'Options:',
631
- ' --appKey <string> Specify the application key (if omitted, resolved from manifest)',
632
- ' --env <env> Target environment (production, staging, etc.)',
633
- ' --debug Enable verbose logging for troubleshooting',
662
+ ' -k, --appKey <string> Application key (if not provided, resolved from manifest)',
663
+ ' -e, --env <env> Target environment',
664
+ ' -d, --debug Enable debug mode for verbose logging',
634
665
  '',
635
666
  'Examples:',
636
667
  ' $ fusion upload',
@@ -640,7 +671,7 @@ const command$l = withAuthOptions(createCommand('upload')
640
671
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
641
672
  .option('-k, --appKey <string>', 'Application key (if not provided, resolved from manifest)')
642
673
  .addOption(createEnvOption({ allowDev: false }))
643
- .argument('[bundle]', 'Application bundle to upload (default: app-bundle.zip)', defaultArchive)
674
+ .argument('[bundle]', 'Application bundle to upload (default: app-bundle.zip)', DEFAULT_ARCHIVE)
644
675
  .action(async (bundle, options) => {
645
676
  const log = new ConsoleLogger('portal:upload', {
646
677
  debug: options.debug,
@@ -692,25 +723,37 @@ const command$l = withAuthOptions(createCommand('upload')
692
723
  * -o, --output <stdout|path> Output to stdout or a file (default: stdout)
693
724
  *
694
725
  * Example:
695
- * $ fusion config app.config.ts
696
- * $ fusion config app.config.prod.ts --output ./dist/app.config.json
697
- * $ fusion config --publish --manifest app.manifest.ts --env prod
726
+ * $ fusion-framework-cli config app.config.ts
727
+ * $ fusion-framework-cli config app.config.prod.ts --output ./dist/app.config.json
728
+ * $ fusion-framework-cli config --publish --manifest app.manifest.ts --env prod
698
729
  *
699
730
  * @see generateApplicationConfig, publishAppConfig for implementation details
700
731
  */
701
- const command$k = withAuthOptions(createCommand('config')
702
- .description([
732
+ const command$l = withAuthOptions(createCommand('config')
733
+ .description('Generate or publish the Fusion application configuration file.')
734
+ .addHelpText('after', [
703
735
  'Generate and/or publish the application configuration for Fusion apps.',
704
736
  '',
705
737
  'By default, outputs the generated config to stdout or a file. Use --publish to upload the config to the Fusion app registry.',
706
738
  'Options [token, tenant, client, manifest] are only relevant when --publish is used.',
707
739
  'Option [-e, --env] cannot be set to dev when --publish is used.',
708
740
  '',
741
+ 'Arguments:',
742
+ ' [config] Config build file to use (e.g., app.config[.env]?.[ts,js,json])',
743
+ '',
744
+ 'Options:',
745
+ ' --debug Enable debug mode for verbose logging',
746
+ ' --silent Silent mode, suppresses output except errors',
747
+ ' --publish Publish config to Fusion app registry',
748
+ ' --manifest <path> Path to the app manifest file (required with --publish)',
749
+ ' -e, --env <env> Target environment',
750
+ ' -o, --output <stdout|path> Output to stdout or a file (default: stdout)',
751
+ '',
709
752
  'Examples:',
710
- ' $ fusion config app.config.ts',
711
- ' $ fusion config app.config.prod.ts --output ./dist/app.config.json',
712
- ' $ fusion config --publish --manifest app.manifest.ts --env prod',
713
- ' $ fusion config --env prod my-custom.config.ts',
753
+ ' $ fusion-framework-cli config app.config.ts',
754
+ ' $ fusion-framework-cli config app.config.prod.ts --output ./dist/app.config.json',
755
+ ' $ fusion-framework-cli config --publish --manifest app.manifest.ts --env prod',
756
+ ' $ fusion-framework-cli config --env prod my-custom.config.ts',
714
757
  ].join('\n'))
715
758
  .option('--debug', 'Enable debug mode for verbose logging')
716
759
  .option('--silent', 'Silent mode, suppresses output except errors')
@@ -865,14 +908,26 @@ const tagApplication = async (options) => {
865
908
  *
866
909
  * @see tagApplication for implementation details
867
910
  */
868
- const command$j = withAuthOptions(createCommand('tag')
869
- .description([
870
- 'Tag your Fusion application with a specific version or preview in the Fusion app registry.',
911
+ const command$k = withAuthOptions(createCommand('tag')
912
+ .description('Tag your Fusion application with a specific version or preview.')
913
+ .addHelpText('after', [
871
914
  '',
872
- 'This command applies a tag to the specified application version, making it easy to manage releases and previews.',
873
- 'You can provide the app key and version directly, or let the command resolve them from the manifest file.',
915
+ 'Tags a Fusion application with a specific version or preview in the Fusion app registry.',
916
+ 'Applies a tag to the specified application version for release management.',
917
+ 'App key and version can be provided or resolved from the manifest file.',
874
918
  'Supports environment selection, debug, and silent modes.',
875
919
  '',
920
+ 'Arguments:',
921
+ ' <tag> Tag to apply (latest | preview | stable)',
922
+ '',
923
+ 'Options:',
924
+ ' --appKey <string> Application key (if not provided, resolved from manifest)',
925
+ ' -v, --version <string> Version to tag (if not provided, resolved from manifest)',
926
+ ' -m, --manifest <string> Manifest file to use for resolving app key and version',
927
+ ' --debug Enable debug mode for verbose logging',
928
+ ' --silent Silent mode, suppresses output except errors',
929
+ ' -e, --env <env> Target environment',
930
+ '',
876
931
  'Examples:',
877
932
  ' $ fusion tag latest',
878
933
  ' $ fusion tag preview --env prod --manifest app.manifest.prod.ts',
@@ -954,12 +1009,18 @@ const command$j = withAuthOptions(createCommand('tag')
954
1009
  *
955
1010
  * @see startAppDevServer for implementation details
956
1011
  */
957
- const command$i = createCommand('dev')
958
- .description([
959
- 'Start the application in development mode.',
1012
+ const command$j = createCommand('dev')
1013
+ .description('Start the application in development mode.')
1014
+ .addHelpText('after', [
960
1015
  '',
961
- 'This command launches the development server for your application.',
962
- 'You can specify a custom manifest or config file, set the runtime environment, and choose the port.',
1016
+ 'Starts the application in development mode with a local dev server.',
1017
+ '',
1018
+ 'Options:',
1019
+ ' --debug Enable debug mode',
1020
+ ' --manifest <path> Path to the app manifest file (app.manifest[.env]?.[ts,js,json])',
1021
+ ' --config <path> Path to the app config file (app.config[.env]?.[ts,js,json])',
1022
+ ' --env <environment> Runtime environment for the dev server (default: local)',
1023
+ ' --port <port> Port for the development server (default: 3000)',
963
1024
  '',
964
1025
  'Examples:',
965
1026
  ' $ fusion app dev',
@@ -1012,14 +1073,23 @@ const command$i = createCommand('dev')
1012
1073
  *
1013
1074
  * @see loadAppManifest for implementation details
1014
1075
  */
1015
- const command$h = createCommand('manifest')
1016
- .description([
1017
- 'Build and output the application manifest for Fusion apps.',
1076
+ const command$i = createCommand('manifest')
1077
+ .description('Build and output the application manifest for Fusion apps.')
1078
+ .addHelpText('after', [
1018
1079
  '',
1019
- 'By default, the manifest is printed to stdout. Use --output to write it to a file.',
1080
+ 'Builds and outputs the application manifest for Fusion apps.',
1081
+ 'By default, prints the manifest to stdout. Use --output to write to a file.',
1020
1082
  'You can specify a custom manifest build file or use the default (app.manifest[.env]?.[ts,js,json]).',
1021
1083
  'Supports debug and silent modes for flexible output.',
1022
1084
  '',
1085
+ 'Arguments:',
1086
+ ' [manifest] Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])',
1087
+ '',
1088
+ 'Options:',
1089
+ ' -d, --debug Enable debug mode for verbose logging',
1090
+ ' -o, --output Write manifest to the specified file (default: stdout)',
1091
+ ' -s, --silent Silent mode, suppresses output except errors',
1092
+ '',
1023
1093
  'Examples:',
1024
1094
  ' $ fusion manifest',
1025
1095
  ' $ fusion manifest app.manifest.prod.ts --output ./dist/app.manifest.json',
@@ -1077,12 +1147,23 @@ const command$h = createCommand('manifest')
1077
1147
  *
1078
1148
  * @see uploadApplication, tagApplication for implementation details
1079
1149
  */
1080
- const command$g = withAuthOptions(createCommand('publish')
1081
- .description([
1082
- 'Build, upload, and tag your Fusion application for deployment to the Fusion portal.',
1150
+ const command$h = withAuthOptions(createCommand('publish')
1151
+ .description('Build, upload, and tag your Fusion application for deployment.')
1152
+ .addHelpText('after', [
1153
+ '',
1154
+ 'Builds, uploads, and tags a Fusion application for deployment to the Fusion portal.',
1155
+ 'Bundles the app, uploads it to the Fusion app store, and applies a tag for versioning.',
1156
+ 'Supports specifying environment, manifest file, and tag.',
1157
+ 'Debug mode and authentication options are supported.',
1083
1158
  '',
1084
- 'This command bundles your app, uploads it to the Fusion app store, and applies a tag for versioning.',
1085
- 'You can specify the environment, manifest file, and tag to use. Debug mode and authentication options are supported.',
1159
+ 'Arguments:',
1160
+ ' [bundle] Path to the app bundle to upload',
1161
+ '',
1162
+ 'Options:',
1163
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
1164
+ ' -e, --env <env> Target environment',
1165
+ ' -m, --manifest Manifest file to use for bundling (e.g., app.manifest.ts)',
1166
+ ' -t, --tag Tag to apply to the published app (latest | preview)',
1086
1167
  '',
1087
1168
  'Examples:',
1088
1169
  ' $ fusion publish',
@@ -1163,30 +1244,30 @@ const command$g = withAuthOptions(createCommand('publish')
1163
1244
  * Each alias maps an old "build-*" command to its new equivalent, providing warnings and guidance for users.
1164
1245
  * These aliases help maintain backward compatibility and inform users about updated command usage.
1165
1246
  */
1166
- command$n.alias('build-pack').hook('preAction', (thisCommand) => {
1247
+ command$o.alias('build-pack').hook('preAction', (thisCommand) => {
1167
1248
  if (process.argv[3] === 'build-pack') {
1168
1249
  console.warn(chalk.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.'));
1169
1250
  if (!thisCommand.getOptionValue('archive')) {
1170
- thisCommand.setOptionValue('archive', defaultArchive);
1251
+ thisCommand.setOptionValue('archive', DEFAULT_ARCHIVE);
1171
1252
  }
1172
1253
  }
1173
1254
  });
1174
- command$l.alias('build-upload').hook('preAction', (thisCommand) => {
1255
+ command$m.alias('build-upload').hook('preAction', (thisCommand) => {
1175
1256
  if (process.argv[3] === 'build-upload') {
1176
1257
  console.warn(chalk.bgRedBright.bold('The command "build-upload" is deprecated. Please use "upload" instead.'));
1177
1258
  if (thisCommand.getOptionValue('service')) {
1178
1259
  throw new Error('The --service option is deprecated. Please use --env instead.');
1179
1260
  }
1180
- const bundle = thisCommand.getOptionValue('bundle') ?? defaultArchive;
1261
+ const bundle = thisCommand.getOptionValue('bundle') ?? DEFAULT_ARCHIVE;
1181
1262
  process.argv[4] = bundle;
1182
1263
  }
1183
1264
  });
1184
- command$h.alias('build-manifest').hook('preAction', (thisCommand) => {
1265
+ command$i.alias('build-manifest').hook('preAction', () => {
1185
1266
  if (process.argv[3] === 'build-manifest') {
1186
1267
  console.warn(chalk.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'));
1187
1268
  }
1188
1269
  });
1189
- command$g.alias('build-publish').hook('preAction', (thisCommand) => {
1270
+ command$h.alias('build-publish').hook('preAction', (thisCommand) => {
1190
1271
  if (process.argv[3] === 'build-publish') {
1191
1272
  console.warn(chalk.bgRedBright.bold('The command "build-publish" is deprecated. Please use "publish" instead.'));
1192
1273
  }
@@ -1195,8 +1276,26 @@ command$g.alias('build-publish').hook('preAction', (thisCommand) => {
1195
1276
  }
1196
1277
  });
1197
1278
 
1198
- const command$f = createCommand('app')
1199
- .description('Develop and deploy Fusion applications')
1279
+ const command$g = createCommand('app')
1280
+ .description('Develop, build, configure, and deploy Fusion applications from your workspace root.')
1281
+ .addHelpText('after', [
1282
+ '',
1283
+ 'The "app" command is your main entry point for managing Fusion applications in this workspace.',
1284
+ '',
1285
+ 'It provides access to subcommands for every stage of the application lifecycle, including development, building, packaging, configuration, deployment, and release management.',
1286
+ '',
1287
+ 'All available subcommands are listed below automatically. For details and options for a specific subcommand, run:',
1288
+ ' fusion app <subcommand> --help',
1289
+ '',
1290
+ 'Typical usage:',
1291
+ ' - Run and test your app locally with the dev subcommand',
1292
+ ' - Build, bundle, and configure your app for deployment',
1293
+ ' - Upload, publish, and tag releases to the Fusion App Store',
1294
+ ' - Check registration and generate manifests as needed',
1295
+ '',
1296
+ 'This command should be run from your app root directory.',
1297
+ ].join('\n'))
1298
+ .addCommand(command$p)
1200
1299
  .addCommand(command$o)
1201
1300
  .addCommand(command$n)
1202
1301
  .addCommand(command$m)
@@ -1204,30 +1303,33 @@ const command$f = createCommand('app')
1204
1303
  .addCommand(command$k)
1205
1304
  .addCommand(command$j)
1206
1305
  .addCommand(command$i)
1207
- .addCommand(command$h)
1208
- .addCommand(command$g);
1306
+ .addCommand(command$h);
1209
1307
 
1210
1308
  /**
1211
1309
  * Command to authenticate and log in to Fusion Framework using interactive browser-based authentication.
1212
1310
  *
1213
1311
  * This command initializes the Fusion Framework and opens a browser window for secure login.
1214
1312
  * Supports custom tenant, client, and scope options for advanced authentication scenarios.
1215
- *
1216
- * @example
1217
- * $ fusion login
1218
- * $ fusion login --tenant my-tenant --client my-client-id --scope api://my-app/.default
1219
1313
  */
1220
1314
  const DEFAULT_SERVER_PORT = 49741;
1221
- const command$e = createCommand('login')
1222
- .description([
1315
+ const command$f = createCommand('login')
1316
+ .description('Authenticate and log in to Fusion Framework using interactive browser-based authentication.')
1317
+ .addHelpText('after', [
1318
+ '',
1223
1319
  'Authenticate and log in to Fusion Framework using interactive browser-based authentication.',
1224
1320
  '',
1225
1321
  'This command initializes the Fusion Framework and opens a browser window for secure login.',
1226
1322
  'Supports custom tenant, client, and scope options for advanced authentication scenarios.',
1227
1323
  '',
1324
+ 'Options:',
1325
+ ' --tenant <tenantId> Specify the tenant ID',
1326
+ ' --client <clientId> Specify the client ID',
1327
+ ' --scope <scope> Specify the scope(s) for authentication',
1328
+ ' --debug Enable debug mode for verbose logging',
1329
+ '',
1228
1330
  'Examples:',
1229
- ' $ fusion login',
1230
- ' $ fusion login --tenant my-tenant --client my-client-id --scope api://my-app/.default',
1331
+ ' $ fusion-framework-cli login',
1332
+ ' $ fusion-framework-cli login --tenant my-tenant --client my-client-id --scope api://my-app/.default',
1231
1333
  ].join('\n'))
1232
1334
  .action(async (options) => {
1233
1335
  const log = new ConsoleLogger('auth:login', { debug: options.debug });
@@ -1264,7 +1366,7 @@ const command$e = createCommand('login')
1264
1366
  * Adds authentication options to the login command.
1265
1367
  * @see withAuthOptions
1266
1368
  */
1267
- withAuthOptions(command$e, {
1369
+ withAuthOptions(command$f, {
1268
1370
  includeScope: true,
1269
1371
  excludeToken: true,
1270
1372
  });
@@ -1274,21 +1376,24 @@ withAuthOptions(command$e, {
1274
1376
  *
1275
1377
  * This command removes your current authentication state from the Fusion Framework CLI.
1276
1378
  * Supports custom tenant and client options for advanced scenarios.
1277
- *
1278
- * @example
1279
- * $ fusion logout
1280
- * $ fusion logout --tenant my-tenant --client my-client-id
1281
1379
  */
1282
- const command$d = createCommand('logout')
1283
- .description([
1380
+ const command$e = createCommand('logout')
1381
+ .description('Log out from Fusion Framework and clear your authentication session.')
1382
+ .addHelpText('after', [
1383
+ '',
1284
1384
  'Log out from Fusion Framework and clear your authentication session.',
1285
1385
  '',
1286
1386
  'This command removes your current authentication state from the Fusion Framework CLI.',
1287
1387
  'Supports custom tenant and client options for advanced scenarios.',
1288
1388
  '',
1389
+ 'Options:',
1390
+ ' --tenant <tenantId> Specify the tenant ID',
1391
+ ' --client <clientId> Specify the client ID',
1392
+ ' --debug Enable debug mode for verbose logging',
1393
+ '',
1289
1394
  'Examples:',
1290
- ' $ fusion logout',
1291
- ' $ fusion logout --tenant my-tenant --client my-client-id',
1395
+ ' $ fusion-framework-cli logout',
1396
+ ' $ fusion-framework-cli logout --tenant my-tenant --client my-client-id',
1292
1397
  ].join('\n'))
1293
1398
  .action(async (options) => {
1294
1399
  const log = new ConsoleLogger('auth:logout', { debug: options.debug });
@@ -1314,7 +1419,7 @@ const command$d = createCommand('logout')
1314
1419
  * Adds authentication options to the logout command.
1315
1420
  * @see withAuthOptions
1316
1421
  */
1317
- withAuthOptions(command$d, {
1422
+ withAuthOptions(command$e, {
1318
1423
  excludeToken: true,
1319
1424
  includeScope: false,
1320
1425
  });
@@ -1324,23 +1429,27 @@ withAuthOptions(command$d, {
1324
1429
  *
1325
1430
  * This command retrieves an access token for the specified scopes, tenant, and client.
1326
1431
  * Supports debug and silent modes for flexible output.
1327
- *
1328
- * @example
1329
- * $ fusion token
1330
- * $ fusion token --scope api://my-app/.default
1331
- * $ fusion token --tenant my-tenant --client my-client-id --silent
1332
1432
  */
1333
- const command$c = createCommand('token')
1334
- .description([
1433
+ const command$d = createCommand('token')
1434
+ .description('Acquire and print an access token for Fusion APIs using your current authentication context.')
1435
+ .addHelpText('after', [
1436
+ '',
1335
1437
  'Acquire and print an access token for Fusion APIs using your current authentication context.',
1336
1438
  '',
1337
1439
  'This command retrieves an access token for the specified scopes, tenant, and client.',
1338
1440
  'Supports debug and silent modes for flexible output.',
1339
1441
  '',
1442
+ 'Options:',
1443
+ ' --tenant <tenantId> Specify the tenant ID',
1444
+ ' --client <clientId> Specify the client ID',
1445
+ ' --scope <scope> Specify the scope(s) for authentication',
1446
+ ' --debug Enable debug mode for verbose logging',
1447
+ ' --silent Only output the token (no extra logging)',
1448
+ '',
1340
1449
  'Examples:',
1341
- ' $ fusion token',
1342
- ' $ fusion token --scope api://my-app/.default',
1343
- ' $ fusion token --tenant my-tenant --client my-client-id --silent',
1450
+ ' $ fusion-framework-cli token',
1451
+ ' $ fusion-framework-cli token --scope api://my-app/.default',
1452
+ ' $ fusion-framework-cli token --tenant my-tenant --client my-client-id --silent',
1344
1453
  ].join('\n'))
1345
1454
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
1346
1455
  .option('--silent', 'Only output the token (no extra logging)')
@@ -1383,14 +1492,26 @@ const command$c = createCommand('token')
1383
1492
  * Adds authentication options to the token command.
1384
1493
  * @see withAuthOptions
1385
1494
  */
1386
- withAuthOptions(command$c, {
1495
+ withAuthOptions(command$d, {
1387
1496
  includeScope: true,
1388
1497
  });
1389
1498
 
1390
- const command$b = new Command('auth').description('Authenticate with Fusion Framework CLI');
1391
- command$b.addCommand(command$e, { isDefault: true });
1392
- command$b.addCommand(command$d);
1393
- command$b.addCommand(command$c);
1499
+ const command$c = new Command('auth')
1500
+ .description('Authenticate with Fusion Framework CLI')
1501
+ .addHelpText('after', [
1502
+ '',
1503
+ 'Authentication commands for Fusion Framework CLI.',
1504
+ '',
1505
+ 'Use these commands to log in, log out, or acquire tokens for Fusion APIs.',
1506
+ '',
1507
+ 'Examples:',
1508
+ ' $ fusion-framework-cli auth login',
1509
+ ' $ fusion-framework-cli auth logout',
1510
+ ' $ fusion-framework-cli auth token --scope api://my-app/.default',
1511
+ ].join('\n'));
1512
+ command$c.addCommand(command$f, { isDefault: true });
1513
+ command$c.addCommand(command$e);
1514
+ command$c.addCommand(command$d);
1394
1515
 
1395
1516
  /**
1396
1517
  * The `resolve` command resolves and displays information about a service registered in Fusion service discovery.
@@ -1399,13 +1520,6 @@ command$b.addCommand(command$c);
1399
1520
  *
1400
1521
  * Supports environment selection and authentication options.
1401
1522
  *
1402
- * ## Examples
1403
- *
1404
- * ```sh
1405
- * $ fusion resolve my-service
1406
- * $ fusion resolve my-service --env prod
1407
- * ```
1408
- *
1409
1523
  * @command resolve
1410
1524
  * @description Resolve and display information about a service registered in Fusion service discovery.
1411
1525
  * @argument {string} service - Name of the service to resolve in Fusion service discovery.
@@ -1415,16 +1529,20 @@ command$b.addCommand(command$c);
1415
1529
  * @option {string} --clientId - Client ID for authentication.
1416
1530
  * @returns {Promise<void>} Prints the resolved service details to the console.
1417
1531
  */
1418
- const command$a = withAuthOptions(createCommand('resolve')
1419
- .description([
1532
+ const command$b = withAuthOptions(createCommand('resolve')
1533
+ .description('Resolve and display information about a service registered in Fusion service discovery.')
1534
+ .addHelpText('after', [
1535
+ '',
1420
1536
  'Resolve and display information about a service registered in Fusion service discovery.',
1421
1537
  '',
1422
1538
  'This command looks up a service by name and prints its discovery details using the current authentication and environment.',
1423
- 'Supports environment selection and authentication options.',
1424
1539
  '',
1425
1540
  'Examples:',
1426
- ' $ fusion resolve my-service',
1427
- ' $ fusion resolve my-service --env prod',
1541
+ ' $ fusion-framework-cli resolve my-service',
1542
+ ' $ fusion-framework-cli resolve my-service --env prod',
1543
+ ' $ fusion-framework-cli resolve my-service --env test --tenantId my-tenant --clientId my-client-id',
1544
+ '',
1545
+ 'The command will print the resolved service details to the console.',
1428
1546
  ].join('\n'))
1429
1547
  .addOption(createEnvOption({ allowDev: false }))
1430
1548
  .argument('<service>', 'Name of the service to resolve in Fusion service discovery')
@@ -1447,8 +1565,8 @@ const command$a = withAuthOptions(createCommand('resolve')
1447
1565
  console.debug(appClient);
1448
1566
  }));
1449
1567
 
1450
- const command$9 = createCommand('disco').description('Service discovery operations');
1451
- command$9.addCommand(command$a);
1568
+ const command$a = createCommand('disco').description('Service discovery operations');
1569
+ command$a.addCommand(command$b);
1452
1570
 
1453
1571
  /**
1454
1572
  * Starts the portal development server for local development and testing.
@@ -1463,7 +1581,7 @@ command$9.addCommand(command$a);
1463
1581
  */
1464
1582
  const startPortalDevServer = async (options) => {
1465
1583
  const { log } = options ?? {};
1466
- // Resolve the application's package.json for root and metadata
1584
+ // Resolve the portals's package.json for root and metadata
1467
1585
  const pkg = await resolveProjectPackage(log);
1468
1586
  // Setup the runtime environment for the dev server
1469
1587
  const env = {
@@ -1473,22 +1591,11 @@ const startPortalDevServer = async (options) => {
1473
1591
  mode: 'development', // Force development mode
1474
1592
  command: 'serve', // Command is always 'serve' for dev
1475
1593
  };
1476
- // @todo - replace with resolvePortalManifest
1477
- // Dummy implementation for resolving the portal manifest
1478
- const resolvePortalManifest = async (...args) => {
1479
- // Returns a dummy manifest for development; replace with real logic as needed
1480
- return {
1481
- id: 'dev-portal-dummy',
1482
- build: {
1483
- entrypoint: resolve$1(env.root || '', 'src/index.ts'),
1484
- // if this is portal - portal-template-manifest
1485
- template: {},
1486
- },
1487
- };
1488
- };
1489
- const portalManifest = await resolvePortalManifest();
1490
- // Dummy implementation for resolving the portal config
1491
- const resolvePortalConfig = async (...args) => ({ foo: 'bar' });
1594
+ // Resolve the portal manifest using the environment and manifest path
1595
+ const portalManifest = await resolvePortalManifest(env, pkg, {
1596
+ log,
1597
+ manifestPath: options?.manifest,
1598
+ });
1492
1599
  // Resolve the portal config (replace with real logic as needed)
1493
1600
  const portalConfig = await resolvePortalConfig(env, { log, config: options?.config });
1494
1601
  log?.start('Starting app development server...');
@@ -1496,15 +1603,19 @@ const startPortalDevServer = async (options) => {
1496
1603
  const devServer = await createDevServer(env, {
1497
1604
  template: {
1498
1605
  portal: {
1499
- id: portalManifest.id,
1606
+ id: portalManifest.name,
1500
1607
  },
1501
1608
  },
1502
1609
  portal: {
1503
1610
  manifest: portalManifest,
1504
1611
  config: portalConfig,
1505
1612
  },
1613
+ }, {
1506
1614
  server: {
1507
1615
  port: options?.server?.port,
1616
+ fs: {
1617
+ allow: [pkg.root], // Allow access to the root directory
1618
+ },
1508
1619
  },
1509
1620
  });
1510
1621
  await devServer.listen();
@@ -1514,16 +1625,19 @@ const startPortalDevServer = async (options) => {
1514
1625
  return devServer;
1515
1626
  };
1516
1627
 
1517
- const command$8 = createCommand('dev')
1518
- .description([
1519
- 'Start the Fusion portal in development mode with live reloading and custom port support.',
1628
+ const command$9 = createCommand('dev')
1629
+ .description('Start a local development server for the Fusion portal.')
1630
+ .addHelpText('after', [
1520
1631
  '',
1521
- 'This command launches a local development server for the portal, enabling rapid development and testing.',
1522
- 'You can specify the port and enable debug mode for verbose logging.',
1632
+ 'Starts a local development server for your Fusion portal.',
1633
+ '',
1634
+ 'Options:',
1635
+ ' -p, --port Port to run the development server on (default: 3000)',
1636
+ ' -d, --debug Enable debug mode for verbose logging',
1523
1637
  '',
1524
1638
  'Examples:',
1525
- ' $ fusion portal dev',
1526
- ' $ fusion portal dev --port 4000 --debug',
1639
+ ' $ fusion-framework-cli portal dev',
1640
+ ' $ fusion-framework-cli portal dev --port 4000 --debug',
1527
1641
  ].join('\n'))
1528
1642
  .option('-p, --port <number>', 'Port to run the development server on', '3000')
1529
1643
  .option('-d, --debug', 'Enable debug mode for verbose logging')
@@ -1534,18 +1648,21 @@ const command$8 = createCommand('dev')
1534
1648
  log.succeed('Development server started successfully.');
1535
1649
  });
1536
1650
 
1537
- const command$7 = createCommand('manifest')
1538
- .description([
1539
- 'Build and output the portal manifest for Fusion apps.',
1651
+ const command$8 = createCommand('manifest')
1652
+ .description('Generate or validate a Fusion portal manifest file.')
1653
+ .addHelpText('after', [
1654
+ 'Generates or validates a Fusion portal manifest file.',
1540
1655
  '',
1541
- 'By default, the manifest is printed to stdout. Use --output to write it to a file.',
1542
- 'You can specify a custom manifest build file or use the default (app.manifest[.env]?.[ts,js,json]).',
1543
- 'Supports debug and silent modes for flexible output.',
1656
+ 'If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.',
1657
+ '',
1658
+ 'Options:',
1659
+ ' -o, --output Write manifest to the specified file (default: stdout)',
1660
+ ' -d, --debug Enable debug mode for verbose logging',
1661
+ ' -s, --silent Silent mode, suppresses output except errors',
1544
1662
  '',
1545
1663
  'Examples:',
1546
- ' $ fusion portal manifest',
1547
- ' $ fusion portal manifest app.manifest.prod.ts --output ./dist/portal.manifest.json',
1548
- ' $ fusion portal manifest --debug',
1664
+ ' $ fusion-framework-cli portal manifest',
1665
+ ' $ fusion-framework-cli portal manifest portal.manifest.prod.ts --output ./dist/portal.manifest.json',
1549
1666
  ].join('\n'))
1550
1667
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
1551
1668
  .option('-o, --output <string>', 'Write manifest to the specified file', 'stdout')
@@ -9351,18 +9468,20 @@ function require_2020 () {
9351
9468
  var _2020Exports = require_2020();
9352
9469
  var Ajv2020 = /*@__PURE__*/getDefaultExportFromCjs(_2020Exports);
9353
9470
 
9354
- const command$6 = createCommand('schema')
9355
- .description([
9356
- 'Generate and validate the JSON schema for the Fusion portal application.',
9471
+ const command$7 = createCommand('schema')
9472
+ .description('Generate or validate a Fusion portal schema file.')
9473
+ .addHelpText('after', [
9474
+ 'Generates or validates a Fusion portal schema file.',
9357
9475
  '',
9358
- 'This command generates a schema file for your portal app, optionally writes it to a file, and can validate a JSON file against the generated schema.',
9359
- 'Supports environment selection, debug mode, and output to stdout or file.',
9476
+ 'Options:',
9477
+ ' -o, --output Output file name (default: stdout)',
9478
+ ' -v, --validate Validate the generated schema against a JSON file',
9479
+ ' -d, --debug Enable debug mode for verbose logging',
9360
9480
  '',
9361
9481
  'Examples:',
9362
- ' $ fusion portal schema',
9363
- ' $ fusion portal schema --output portal.schema.json',
9364
- ' $ fusion portal schema --validate my-config.json',
9365
- ' $ fusion portal schema portal.schema.prod.ts --debug',
9482
+ ' $ fusion-framework-cli portal schema',
9483
+ ' $ fusion-framework-cli portal schema --output portal.schema.json',
9484
+ ' $ fusion-framework-cli portal schema --validate my-config.json',
9366
9485
  ].join('\n'))
9367
9486
  .addOption(createEnvOption({ allowDev: true }))
9368
9487
  .option('-o, --output <string>', 'Output file name (default: stdout)', 'stdout')
@@ -9411,40 +9530,50 @@ const command$6 = createCommand('schema')
9411
9530
  }
9412
9531
  });
9413
9532
 
9414
- const command$5 = createCommand('build')
9415
- .description([
9416
- 'Build the Fusion portal using a manifest file and environment-specific configuration.',
9533
+ const command$6 = createCommand('build')
9534
+ .description('Build the Fusion portal from a manifest file with environment-specific settings.')
9535
+ .addHelpText('after', [
9536
+ 'Builds the Fusion portal using a manifest file and environment-specific configuration.',
9417
9537
  '',
9418
- 'If no manifest is provided, the command will search for a default app.manifest.[ts|js|json] in the current directory.',
9419
- 'You can use environment variables to customize the build process.',
9538
+ 'If no manifest is provided, the command will search for a default portal.manifest.[ts|js|json] in the current directory.',
9539
+ 'You can use environment variables to customize the build process (e.g., NODE_ENV, FUSION_PORTAL_*).',
9540
+ '',
9541
+ 'Options:',
9542
+ ' -d, --debug Enable debug mode for verbose logging',
9420
9543
  '',
9421
9544
  'Examples:',
9422
- ' $ fusion portal build',
9423
- ' $ fusion portal build app.manifest.prod.ts --debug',
9545
+ ' $ fusion-framework-cli portal build',
9546
+ ' $ fusion-framework-cli portal build portal.manifest.prod.ts --debug',
9547
+ '',
9424
9548
  ].join('\n'))
9425
9549
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
9426
- .argument('[manifest]', 'Manifest build file to use for building (e.g., app.manifest[.env]?.[ts,js,json])')
9550
+ .argument('[manifest]', 'Manifest build file to use for building (e.g., portal.manifest[.env]?.[ts,js,json])')
9427
9551
  .action(async (manifest, opt) => {
9428
9552
  const log = new ConsoleLogger('portal:build', { debug: opt.debug });
9429
9553
  await buildPortal({ log, manifest });
9430
9554
  });
9431
9555
 
9432
- const command$4 = createCommand('pack')
9433
- .description([
9434
- 'Create a distributable bundle of the Fusion portal application for deployment.',
9556
+ const command$5 = createCommand('pack')
9557
+ .description('Bundle the Fusion portal into a deployable archive.')
9558
+ .addHelpText('after', [
9559
+ 'Bundles the Fusion portal using the provided manifest and schema into a zip archive for deployment.',
9435
9560
  '',
9436
- 'This command packages the portal app, allowing you to specify the output archive, manifest, and schema files.',
9437
- 'Supports debug mode for verbose logging.',
9561
+ 'If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.',
9562
+ '',
9563
+ 'Options:',
9564
+ ' -a, --archive Name of the output archive file (default: out/bundle.zip)',
9565
+ ' --schema Schema file to use for validation',
9566
+ ' -d, --debug Enable debug mode for verbose logging',
9438
9567
  '',
9439
9568
  'Examples:',
9440
- ' $ fusion portal pack',
9441
- ' $ fusion portal pack --archive my-portal.zip --schema portal.schema.json',
9442
- ' $ fusion portal pack app.manifest.prod.ts --debug',
9569
+ ' $ fusion-framework-cli portal pack',
9570
+ ' $ fusion-framework-cli portal pack --archive my-portal.zip --schema portal.schema.json',
9571
+ ' $ fusion-framework-cli portal pack portal.manifest.prod.ts --debug',
9443
9572
  ].join('\n'))
9444
9573
  .option('-a, --archive [string]', 'Name of the output archive file (default: out/bundle.zip)', 'out/bundle.zip')
9445
9574
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
9446
9575
  .option('--schema [string]', 'Schema file to use for validation')
9447
- .argument('[manifest]', 'Manifest file to use for bundling (e.g., app.manifest[.env]?.[ts,js,json])')
9576
+ .argument('[manifest]', 'Manifest file to use for bundling (e.g., portal.manifest[.env]?.[ts,js,json])')
9448
9577
  .action(async (manifest, options) => {
9449
9578
  const log = new ConsoleLogger('portal:pack', {
9450
9579
  debug: options.debug,
@@ -9554,17 +9683,18 @@ const uploadPortalBundle = async (opt) => {
9554
9683
  }
9555
9684
  };
9556
9685
 
9557
- const command$3 = withAuthOptions(createCommand('upload')
9558
- .description([
9559
- 'Upload a Fusion portal bundle to the Fusion portal registry for deployment.',
9686
+ const command$4 = withAuthOptions(createCommand('upload')
9687
+ .description('Upload a Fusion portal bundle to the portal registry.')
9688
+ .addHelpText('after', [
9689
+ 'Uploads a distributable Fusion portal bundle to the portal registry for deployment.',
9560
9690
  '',
9561
- 'This command uploads a distributable portal bundle to the Fusion portal registry using the current authentication and environment.',
9562
- 'Supports debug mode and custom environment selection.',
9691
+ 'Options:',
9692
+ ' --env Target environment',
9693
+ ' -d, --debug Enable debug mode for verbose logging',
9563
9694
  '',
9564
9695
  'Examples:',
9565
- ' $ fusion portal upload my-portal-bundle.zip',
9566
- ' $ fusion portal upload my-portal-bundle.zip --env prod',
9567
- ' $ fusion portal upload my-portal-bundle.zip --debug',
9696
+ ' $ fusion-framework-cli portal upload my-portal-bundle.zip',
9697
+ ' $ fusion-framework-cli portal upload my-portal-bundle.zip --env prod',
9568
9698
  ].join('\n'))
9569
9699
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
9570
9700
  .addOption(createEnvOption({ allowDev: false }))
@@ -9679,18 +9809,22 @@ const tagPortal = async (options) => {
9679
9809
  }
9680
9810
  };
9681
9811
 
9682
- const command$2 = withAuthOptions(createCommand('tag')
9683
- .description([
9684
- 'Tag your Fusion portal application with a specific version or preview in the Fusion portal registry.',
9812
+ const command$3 = withAuthOptions(createCommand('tag')
9813
+ .description('Tag your Fusion portal with a specific version or label.')
9814
+ .addHelpText('after', [
9815
+ 'Tags your Fusion portal with a specific version or label in the portal registry.',
9685
9816
  '',
9686
- 'This command applies a tag to the specified portal version, making it easy to manage releases and previews.',
9687
- 'You can provide the portal name and version directly, or let the command resolve them from the manifest file.',
9688
- 'Supports environment selection, debug, and silent modes.',
9817
+ 'Options:',
9818
+ ' -n, --name Portal name (if not provided, resolved from manifest)',
9819
+ ' -m, --manifest Manifest file to use for resolving portal name and version',
9820
+ ' -v, --version Version to tag (if not provided, resolved from manifest)',
9821
+ ' --env Target environment',
9822
+ ' -d, --debug Enable debug mode for verbose logging',
9823
+ ' --silent Silent mode, suppresses output except errors',
9689
9824
  '',
9690
9825
  'Examples:',
9691
- ' $ fusion portal tag latest',
9692
- ' $ fusion portal tag preview --env prod --manifest portal.manifest.prod.ts',
9693
- ' $ fusion portal tag stable --name my-portal --version 1.2.3',
9826
+ ' $ fusion-framework-cli portal tag latest',
9827
+ ' $ fusion-framework-cli portal tag preview --env prod --manifest portal.manifest.prod.ts',
9694
9828
  ].join('\n'))
9695
9829
  .addOption(createEnvOption({ allowDev: false }))
9696
9830
  .option('-n, --name <string>', 'Portal name (if not provided, resolved from manifest)')
@@ -9740,18 +9874,21 @@ const command$2 = withAuthOptions(createCommand('tag')
9740
9874
  });
9741
9875
  }));
9742
9876
 
9743
- const command$1 = withAuthOptions(createCommand('publish')
9744
- .description([
9745
- 'Build, upload, and tag your Fusion portal bundle for deployment to the Fusion portal registry.',
9877
+ const command$2 = withAuthOptions(createCommand('publish')
9878
+ .description('Build, upload, and tag your Fusion portal bundle for deployment.')
9879
+ .addHelpText('after', [
9880
+ 'Builds, uploads, and tags your Fusion portal bundle for deployment to the portal registry.',
9746
9881
  '',
9747
- 'This command bundles the portal, uploads it to the registry, and applies a tag for versioning.',
9748
- 'You can specify the environment, manifest file, schema, and tag. Debug mode and authentication options are supported.',
9882
+ 'Options:',
9883
+ ' --env Target environment',
9884
+ ' -m, --manifest Manifest file to use for bundling',
9885
+ ' --schema Schema file to use for validation',
9886
+ ' -t, --tag Tag to apply to the published portal',
9887
+ ' -d, --debug Enable debug mode for verbose logging',
9749
9888
  '',
9750
9889
  'Examples:',
9751
- ' $ fusion portal publish',
9752
- ' $ fusion portal publish --env prod --manifest portal.manifest.prod.ts',
9753
- ' $ fusion portal publish --tag latest --debug',
9754
- ' $ fusion portal publish --schema portal.schema.json',
9890
+ ' $ fusion-framework-cli portal publish',
9891
+ ' $ fusion-framework-cli portal publish --env prod --manifest portal.manifest.prod.ts',
9755
9892
  ].join('\n'))
9756
9893
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
9757
9894
  .addOption(createEnvOption({ allowDev: false }))
@@ -9803,8 +9940,102 @@ const command$1 = withAuthOptions(createCommand('publish')
9803
9940
  log.succeed('🏷️ Tagging completed');
9804
9941
  }));
9805
9942
 
9943
+ /**
9944
+ * CLI command: `portal config`
9945
+ *
9946
+ * Generates and/or publishes the portal configuration for Fusion portals.
9947
+ *
9948
+ * Features:
9949
+ * - Outputs the generated config to stdout or a file.
9950
+ * - Use --publish to upload the config to the Fusion portal registry.
9951
+ * - Options [token, tenant, client, config, identifier, env, output] are only relevant when --publish is used.
9952
+ * - Option [--env] cannot be set to dev when --publish is used.
9953
+ *
9954
+ * Usage:
9955
+ * $ fusion-framework-cli portal config --identifier <portal@version> [options]
9956
+ *
9957
+ * Options:
9958
+ * --debug Enable debug mode for verbose logging
9959
+ * --silent Silent mode, suppresses output except errors
9960
+ * --publish Publish config to Fusion portal registry
9961
+ * --identifier <name@version> Identifier of the portal, example my-portal@1.2.3 (required with --publish)
9962
+ * -o, --output <stdout|path> Output to stdout or a file (default: stdout)
9963
+ * <config> Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])
9964
+ * --env <env> Target environment
9965
+ *
9966
+ * Examples:
9967
+ * $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o stdout portal.config.ts
9968
+ * $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o ./dist/portal.config.json portal.config.prod.ts
9969
+ * $ fusion-framework-cli portal config --publish --env prod --identifier my-portal@1.2.3 portal.config.ts
9970
+ *
9971
+ * @see generatePortalConfig, publishPortalConfig for implementation details
9972
+ */
9973
+ const command$1 = withAuthOptions(createCommand('config')
9974
+ .description('Generate or publish the Fusion portal configuration file.')
9975
+ .addHelpText('after', [
9976
+ 'Generates and/or publishes the Fusion portal configuration.',
9977
+ '',
9978
+ 'By default, outputs the config to stdout or a file. Use --publish to upload to the portal registry.',
9979
+ '',
9980
+ 'Options:',
9981
+ ' --publish Publish config to Fusion portal registry',
9982
+ ' --identifier Portal identifier (required with --publish)',
9983
+ ' -o, --output Output to stdout or a file (default: stdout)',
9984
+ ' --env Target environment',
9985
+ ' --debug Enable debug mode for verbose logging',
9986
+ '',
9987
+ 'Examples:',
9988
+ ' $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o stdout portal.config.ts',
9989
+ ' $ fusion-framework-cli portal config --publish --env prod --identifier my-portal@1.2.3 portal.config.ts',
9990
+ ].join('\n'))
9991
+ .option('--debug', 'Enable debug mode for verbose logging')
9992
+ .option('--silent', 'Silent mode, suppresses output except errors')
9993
+ .option('--publish <name@version>', 'Publish config to Fusion portal registry, Identifier of the portal, example my-portal@1.2.3')
9994
+ .addOption(createEnvOption({ allowDev: true }))
9995
+ .option('-o, --output <stdout|path>', 'Output the result to stdout or a file (ignored with --publish, default: stdout)', 'stdout')
9996
+ .argument('[config]', 'Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])')
9997
+ .action(async (config, options) => {
9998
+ const log = options.silent
9999
+ ? null
10000
+ : new ConsoleLogger('portal:config', { debug: !!options.debug });
10001
+ // Validate env for publish (no dev allowed)
10002
+ if (options.publish) {
10003
+ const [name, version] = options.publish.split('@') || [];
10004
+ if (!name || !version) {
10005
+ log?.fail('🤪', 'Portal identifier is required when using', chalk.blue('--publish'));
10006
+ log?.info('Example: fusion-framework-cli portal config --publish my-portal@1.2.3');
10007
+ process.exit(1);
10008
+ }
10009
+ if (options.env === 'dev') {
10010
+ log?.fail('🤪', chalk.blue('--env'), 'cannot be "dev" when', chalk.blue('--publish'), ' is used');
10011
+ process.exit(1);
10012
+ }
10013
+ return publishPortalConfig({
10014
+ config: options.config,
10015
+ portal: {
10016
+ name,
10017
+ version,
10018
+ },
10019
+ environment: options.env,
10020
+ auth: 'token' in options ? { token: options.token } : options,
10021
+ debug: options.debug,
10022
+ });
10023
+ }
10024
+ // Generate config
10025
+ const { config: portalConfig } = await generatePortalConfig({
10026
+ log,
10027
+ config,
10028
+ env: { environment: options.env },
10029
+ output: options.output === 'stdout' ? undefined : options.output,
10030
+ });
10031
+ if (options.output === 'stdout') {
10032
+ stdout.write(JSON.stringify(portalConfig, null, 2));
10033
+ }
10034
+ }));
10035
+
9806
10036
  const command = createCommand('portal')
9807
10037
  .description('Develop and deploy portal templates')
10038
+ .addCommand(command$9)
9808
10039
  .addCommand(command$8)
9809
10040
  .addCommand(command$7)
9810
10041
  .addCommand(command$6)
@@ -9815,9 +10046,9 @@ const command = createCommand('portal')
9815
10046
  .addCommand(command$1);
9816
10047
 
9817
10048
  var registerCommands = (program) => {
9818
- program.addCommand(command$f);
9819
- program.addCommand(command$b);
9820
- program.addCommand(command$9);
10049
+ program.addCommand(command$g);
10050
+ program.addCommand(command$c);
10051
+ program.addCommand(command$a);
9821
10052
  program.addCommand(command);
9822
10053
  };
9823
10054