@equinor/fusion-framework-cli 11.0.0-next.4 → 11.0.0-next.6

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 (102) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/bin/build/bin.js +7 -7
  3. package/bin/build/cli.js +432 -207
  4. package/bin/build/{portal-pack-tYUpOtku.js → portal-config-publish-CqqdoblS.js} +248 -35
  5. package/dist/esm/bin/app-dev.js +17 -7
  6. package/dist/esm/bin/app-dev.js.map +1 -1
  7. package/dist/esm/bin/helpers/resolve-portal-config.js +46 -0
  8. package/dist/esm/bin/helpers/resolve-portal-config.js.map +1 -0
  9. package/dist/esm/bin/index.js +2 -0
  10. package/dist/esm/bin/index.js.map +1 -1
  11. package/dist/esm/bin/portal-config-publish.js +74 -0
  12. package/dist/esm/bin/portal-config-publish.js.map +1 -0
  13. package/dist/esm/bin/portal-config.js +48 -0
  14. package/dist/esm/bin/portal-config.js.map +1 -0
  15. package/dist/esm/bin/portal-dev.js +13 -21
  16. package/dist/esm/bin/portal-dev.js.map +1 -1
  17. package/dist/esm/bin/utils/create-dev-server.js +3 -5
  18. package/dist/esm/bin/utils/create-dev-server.js.map +1 -1
  19. package/dist/esm/cli/commands/app/alias.js +4 -4
  20. package/dist/esm/cli/commands/app/alias.js.map +1 -1
  21. package/dist/esm/cli/commands/app/build.js +10 -3
  22. package/dist/esm/cli/commands/app/build.js.map +1 -1
  23. package/dist/esm/cli/commands/app/check.js +15 -5
  24. package/dist/esm/cli/commands/app/check.js.map +1 -1
  25. package/dist/esm/cli/commands/app/config.js +20 -8
  26. package/dist/esm/cli/commands/app/config.js.map +1 -1
  27. package/dist/esm/cli/commands/app/dev.js +10 -4
  28. package/dist/esm/cli/commands/app/dev.js.map +1 -1
  29. package/dist/esm/cli/commands/app/index.js +18 -1
  30. package/dist/esm/cli/commands/app/index.js.map +1 -1
  31. package/dist/esm/cli/commands/app/manifest.js +12 -3
  32. package/dist/esm/cli/commands/app/manifest.js.map +1 -1
  33. package/dist/esm/cli/commands/app/pack.js +16 -9
  34. package/dist/esm/cli/commands/app/pack.js.map +1 -1
  35. package/dist/esm/cli/commands/app/publish.js +15 -4
  36. package/dist/esm/cli/commands/app/publish.js.map +1 -1
  37. package/dist/esm/cli/commands/app/tag.js +16 -4
  38. package/dist/esm/cli/commands/app/tag.js.map +1 -1
  39. package/dist/esm/cli/commands/app/upload.js +13 -8
  40. package/dist/esm/cli/commands/app/upload.js.map +1 -1
  41. package/dist/esm/cli/commands/auth/index.js +13 -1
  42. package/dist/esm/cli/commands/auth/index.js.map +1 -1
  43. package/dist/esm/cli/commands/auth/login.js +11 -7
  44. package/dist/esm/cli/commands/auth/login.js.map +1 -1
  45. package/dist/esm/cli/commands/auth/logout.js +10 -7
  46. package/dist/esm/cli/commands/auth/logout.js.map +1 -1
  47. package/dist/esm/cli/commands/auth/token.js +13 -9
  48. package/dist/esm/cli/commands/auth/token.js.map +1 -1
  49. package/dist/esm/cli/commands/disco/resolve.js +13 -16
  50. package/dist/esm/cli/commands/disco/resolve.js.map +1 -1
  51. package/dist/esm/cli/commands/portal/build.js +12 -7
  52. package/dist/esm/cli/commands/portal/build.js.map +1 -1
  53. package/dist/esm/cli/commands/portal/config.js +101 -0
  54. package/dist/esm/cli/commands/portal/config.js.map +1 -0
  55. package/dist/esm/cli/commands/portal/dev.js +9 -6
  56. package/dist/esm/cli/commands/portal/dev.js.map +1 -1
  57. package/dist/esm/cli/commands/portal/index.js +3 -1
  58. package/dist/esm/cli/commands/portal/index.js.map +1 -1
  59. package/dist/esm/cli/commands/portal/manifest.js +11 -8
  60. package/dist/esm/cli/commands/portal/manifest.js.map +1 -1
  61. package/dist/esm/cli/commands/portal/pack.js +13 -8
  62. package/dist/esm/cli/commands/portal/pack.js.map +1 -1
  63. package/dist/esm/cli/commands/portal/publish.js +11 -8
  64. package/dist/esm/cli/commands/portal/publish.js.map +1 -1
  65. package/dist/esm/cli/commands/portal/schema.js +10 -8
  66. package/dist/esm/cli/commands/portal/schema.js.map +1 -1
  67. package/dist/esm/cli/commands/portal/tag.js +12 -8
  68. package/dist/esm/cli/commands/portal/tag.js.map +1 -1
  69. package/dist/esm/cli/commands/portal/upload.js +8 -7
  70. package/dist/esm/cli/commands/portal/upload.js.map +1 -1
  71. package/dist/esm/lib/portal/create-portal-manifest.js +5 -5
  72. package/dist/esm/lib/portal/create-portal-manifest.js.map +1 -1
  73. package/dist/esm/lib/portal/index.js +2 -0
  74. package/dist/esm/lib/portal/index.js.map +1 -1
  75. package/dist/esm/lib/portal/load-portal-config.js +49 -0
  76. package/dist/esm/lib/portal/load-portal-config.js.map +1 -0
  77. package/dist/esm/lib/portal/load-portal-manifest.js +1 -1
  78. package/dist/esm/lib/portal/load-portal-manifest.js.map +1 -1
  79. package/dist/esm/lib/portal/portal-config.js +23 -0
  80. package/dist/esm/lib/portal/portal-config.js.map +1 -0
  81. package/dist/esm/lib/portal/portal-manifest.schema.js +1 -1
  82. package/dist/esm/lib/portal/portal-manifest.schema.js.map +1 -1
  83. package/dist/esm/version.js +1 -1
  84. package/dist/tsconfig.tsbuildinfo +1 -1
  85. package/dist/types/bin/helpers/resolve-portal-config.d.ts +18 -0
  86. package/dist/types/bin/index.d.ts +2 -0
  87. package/dist/types/bin/portal-config-publish.d.ts +26 -0
  88. package/dist/types/bin/portal-config.d.ts +46 -0
  89. package/dist/types/bin/utils/create-dev-server.d.ts +3 -3
  90. package/dist/types/cli/commands/app/config.d.ts +3 -3
  91. package/dist/types/cli/commands/app/pack.d.ts +1 -1
  92. package/dist/types/cli/commands/auth/logout.d.ts +0 -4
  93. package/dist/types/cli/commands/auth/token.d.ts +0 -5
  94. package/dist/types/cli/commands/disco/resolve.d.ts +0 -7
  95. package/dist/types/cli/commands/portal/config.d.ts +32 -0
  96. package/dist/types/lib/portal/index.d.ts +2 -0
  97. package/dist/types/lib/portal/load-portal-config.d.ts +83 -0
  98. package/dist/types/lib/portal/load-portal-manifest.d.ts +3 -3
  99. package/dist/types/lib/portal/portal-config.d.ts +69 -0
  100. package/dist/types/lib/portal/portal-manifest.schema.d.ts +1 -1
  101. package/dist/types/version.d.ts +1 -1
  102. package/package.json +10 -9
package/bin/build/cli.js CHANGED
@@ -5,7 +5,7 @@ import { createCommand, createOption, InvalidOptionArgumentError, Command } from
5
5
  import 'node:fs';
6
6
  import chalk from 'chalk';
7
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-tYUpOtku.js';
8
+ 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-CqqdoblS.js';
9
9
  import { importJSON } from '@equinor/fusion-imports';
10
10
  import 'lodash.mergewith';
11
11
  import '@equinor/fusion-framework-dev-server';
@@ -13,12 +13,12 @@ import 'vite';
13
13
  import { mkdir, writeFile } from 'node:fs/promises';
14
14
  import 'node:assert';
15
15
  import 'node:child_process';
16
+ import 'zod';
16
17
  import AdmZip from 'adm-zip';
17
18
  import { stdout } from 'node:process';
18
19
  import '@azure/msal-node';
19
20
  import 'open';
20
21
  import 'node:http';
21
- import 'zod';
22
22
  import 'is-ci';
23
23
  import 'ora';
24
24
 
@@ -157,12 +157,19 @@ class ConsoleLogger {
157
157
  *
158
158
  * @see buildApplication for build implementation details
159
159
  */
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.',
160
+ const command$p = createCommand('build')
161
+ .description('Build the application using a manifest file and environment-specific configuration.')
162
+ .addHelpText('after', [
163
+ 'Builds the application using a manifest file and environment-specific configuration.',
164
+ 'If no manifest is provided, searches for a default app.manifest.[ts|js|json] in the current directory.',
164
165
  'You can use environment variables to customize the build process.',
165
166
  '',
167
+ 'Arguments:',
168
+ ' [manifest] Manifest file to use for building (e.g., app.manifest.ts)',
169
+ '',
170
+ 'Options:',
171
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
172
+ '',
166
173
  'Examples:',
167
174
  ' $ fusion build',
168
175
  ' $ fusion build app.manifest.dev.ts --debug',
@@ -174,11 +181,7 @@ const command$o = createCommand('build')
174
181
  await buildApplication({ log, manifest });
175
182
  });
176
183
 
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';
184
+ const DEFAULT_ARCHIVE = 'app-bundle.zip';
182
185
  /**
183
186
  * CLI command: `pack`
184
187
  *
@@ -207,20 +210,27 @@ const defaultArchive = 'app-bundle.zip';
207
210
  *
208
211
  * @see bundleApp for implementation details
209
212
  */
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.',
213
+ const command$o = createCommand('pack')
214
+ .description('Create a distributable app bundle of the application.')
215
+ .addHelpText('after', [
216
+ 'Creates a distributable app bundle of the application.',
217
+ 'Bundles all necessary files for deployment.',
218
+ 'You can specify the output filename and directory, and optionally provide a manifest file.',
219
+ 'If no manifest is provided, defaults to app.manifest.[ts|js|json] in the current directory.',
220
+ '',
221
+ 'Arguments:',
222
+ ' [manifest] Manifest file to use for bundling (e.g., app.manifest.ts)',
223
+ '',
224
+ 'Options:',
225
+ ' -a, --archive Name of the output archive file (default: app-bundle.zip)',
226
+ ' -o, --output Directory where the archive will be saved (default: current working directory)',
227
+ ' -d, --debug Enable debug mode for verbose logging',
218
228
  '',
219
229
  'Examples:',
220
230
  ' $ fusion pack',
221
231
  ' $ fusion pack app.manifest.dev.ts --archive my-app.zip --output ./dist',
222
232
  ].join('\n'))
223
- .option('-a, --archive [string]', 'Name of the output archive file (default: app-bundle.zip)', defaultArchive)
233
+ .option('-a, --archive [string]', 'Name of the output archive file (default: app-bundle.zip)', DEFAULT_ARCHIVE)
224
234
  .option('-o, --output [string]', 'Directory where the archive will be saved (default: current working directory)', process.cwd())
225
235
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
226
236
  .argument('[manifest]', 'Manifest file to use for bundling (e.g., app.manifest.ts)')
@@ -441,11 +451,21 @@ const checkApp = async (options) => {
441
451
  *
442
452
  * @see checkApp for implementation details
443
453
  */
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.",
454
+ const command$n = withAuthOptions(createCommand('check')
455
+ .description('Check if application is registered in Fusion app store.')
456
+ .addHelpText('after', [
457
+ 'Checks if the application is registered in the Fusion app store.',
458
+ 'Verifies the registration status of your application in the Fusion app store.',
459
+ 'Helps identify issues with app registration or configuration.',
460
+ 'Supports authentication and environment options. Provides a debug mode for verbose logging.',
461
+ '',
462
+ 'Options:',
463
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
464
+ ' --environment <env> Specify the environment (see available environments)',
465
+ ' --token <token> Provide an authentication token (if required)',
466
+ '',
467
+ 'Examples:',
468
+ ' $ fusion check --environment prod --debug',
449
469
  ].join('\n'))
450
470
  .option('-d, --debug', 'debug mode', false)
451
471
  .addOption(createEnvOption({ allowDev: false }))
@@ -621,16 +641,21 @@ const uploadApplication = async (opt) => {
621
641
  *
622
642
  * @see uploadApplication for implementation details
623
643
  */
624
- const command$l = withAuthOptions(createCommand('upload')
625
- .description([
626
- 'Upload a Fusion application bundle to the Fusion App Store.',
644
+ const command$m = withAuthOptions(createCommand('upload')
645
+ .description('Upload a Fusion application bundle to the Fusion App Store.')
646
+ .addHelpText('after', [
627
647
  '',
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.',
648
+ 'Uploads a Fusion application bundle to the Fusion App Store.',
649
+ 'Uploads a distributable application bundle (e.g., app-bundle.zip) to the Fusion app registry.',
650
+ 'Supports specifying application key, environment, and debug mode.',
651
+ '',
652
+ 'Arguments:',
653
+ ' [bundle] Application bundle to upload (default: app-bundle.zip)',
629
654
  '',
630
655
  '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',
656
+ ' -k, --appKey <string> Application key (if not provided, resolved from manifest)',
657
+ ' -e, --env <env> Target environment',
658
+ ' -d, --debug Enable debug mode for verbose logging',
634
659
  '',
635
660
  'Examples:',
636
661
  ' $ fusion upload',
@@ -640,7 +665,7 @@ const command$l = withAuthOptions(createCommand('upload')
640
665
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
641
666
  .option('-k, --appKey <string>', 'Application key (if not provided, resolved from manifest)')
642
667
  .addOption(createEnvOption({ allowDev: false }))
643
- .argument('[bundle]', 'Application bundle to upload (default: app-bundle.zip)', defaultArchive)
668
+ .argument('[bundle]', 'Application bundle to upload (default: app-bundle.zip)', DEFAULT_ARCHIVE)
644
669
  .action(async (bundle, options) => {
645
670
  const log = new ConsoleLogger('portal:upload', {
646
671
  debug: options.debug,
@@ -692,25 +717,37 @@ const command$l = withAuthOptions(createCommand('upload')
692
717
  * -o, --output <stdout|path> Output to stdout or a file (default: stdout)
693
718
  *
694
719
  * 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
720
+ * $ fusion-framework-cli config app.config.ts
721
+ * $ fusion-framework-cli config app.config.prod.ts --output ./dist/app.config.json
722
+ * $ fusion-framework-cli config --publish --manifest app.manifest.ts --env prod
698
723
  *
699
724
  * @see generateApplicationConfig, publishAppConfig for implementation details
700
725
  */
701
- const command$k = withAuthOptions(createCommand('config')
702
- .description([
726
+ const command$l = withAuthOptions(createCommand('config')
727
+ .description('Generate or publish the Fusion application configuration file.')
728
+ .addHelpText('after', [
703
729
  'Generate and/or publish the application configuration for Fusion apps.',
704
730
  '',
705
731
  'By default, outputs the generated config to stdout or a file. Use --publish to upload the config to the Fusion app registry.',
706
732
  'Options [token, tenant, client, manifest] are only relevant when --publish is used.',
707
733
  'Option [-e, --env] cannot be set to dev when --publish is used.',
708
734
  '',
735
+ 'Arguments:',
736
+ ' [config] Config build file to use (e.g., app.config[.env]?.[ts,js,json])',
737
+ '',
738
+ 'Options:',
739
+ ' --debug Enable debug mode for verbose logging',
740
+ ' --silent Silent mode, suppresses output except errors',
741
+ ' --publish Publish config to Fusion app registry',
742
+ ' --manifest <path> Path to the app manifest file (required with --publish)',
743
+ ' -e, --env <env> Target environment',
744
+ ' -o, --output <stdout|path> Output to stdout or a file (default: stdout)',
745
+ '',
709
746
  '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',
747
+ ' $ fusion-framework-cli config app.config.ts',
748
+ ' $ fusion-framework-cli config app.config.prod.ts --output ./dist/app.config.json',
749
+ ' $ fusion-framework-cli config --publish --manifest app.manifest.ts --env prod',
750
+ ' $ fusion-framework-cli config --env prod my-custom.config.ts',
714
751
  ].join('\n'))
715
752
  .option('--debug', 'Enable debug mode for verbose logging')
716
753
  .option('--silent', 'Silent mode, suppresses output except errors')
@@ -865,14 +902,26 @@ const tagApplication = async (options) => {
865
902
  *
866
903
  * @see tagApplication for implementation details
867
904
  */
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.',
905
+ const command$k = withAuthOptions(createCommand('tag')
906
+ .description('Tag your Fusion application with a specific version or preview.')
907
+ .addHelpText('after', [
871
908
  '',
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.',
909
+ 'Tags a Fusion application with a specific version or preview in the Fusion app registry.',
910
+ 'Applies a tag to the specified application version for release management.',
911
+ 'App key and version can be provided or resolved from the manifest file.',
874
912
  'Supports environment selection, debug, and silent modes.',
875
913
  '',
914
+ 'Arguments:',
915
+ ' <tag> Tag to apply (latest | preview | stable)',
916
+ '',
917
+ 'Options:',
918
+ ' --appKey <string> Application key (if not provided, resolved from manifest)',
919
+ ' -v, --version <string> Version to tag (if not provided, resolved from manifest)',
920
+ ' -m, --manifest <string> Manifest file to use for resolving app key and version',
921
+ ' --debug Enable debug mode for verbose logging',
922
+ ' --silent Silent mode, suppresses output except errors',
923
+ ' -e, --env <env> Target environment',
924
+ '',
876
925
  'Examples:',
877
926
  ' $ fusion tag latest',
878
927
  ' $ fusion tag preview --env prod --manifest app.manifest.prod.ts',
@@ -954,12 +1003,18 @@ const command$j = withAuthOptions(createCommand('tag')
954
1003
  *
955
1004
  * @see startAppDevServer for implementation details
956
1005
  */
957
- const command$i = createCommand('dev')
958
- .description([
959
- 'Start the application in development mode.',
1006
+ const command$j = createCommand('dev')
1007
+ .description('Start the application in development mode.')
1008
+ .addHelpText('after', [
960
1009
  '',
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.',
1010
+ 'Starts the application in development mode with a local dev server.',
1011
+ '',
1012
+ 'Options:',
1013
+ ' --debug Enable debug mode',
1014
+ ' --manifest <path> Path to the app manifest file (app.manifest[.env]?.[ts,js,json])',
1015
+ ' --config <path> Path to the app config file (app.config[.env]?.[ts,js,json])',
1016
+ ' --env <environment> Runtime environment for the dev server (default: local)',
1017
+ ' --port <port> Port for the development server (default: 3000)',
963
1018
  '',
964
1019
  'Examples:',
965
1020
  ' $ fusion app dev',
@@ -1012,14 +1067,23 @@ const command$i = createCommand('dev')
1012
1067
  *
1013
1068
  * @see loadAppManifest for implementation details
1014
1069
  */
1015
- const command$h = createCommand('manifest')
1016
- .description([
1017
- 'Build and output the application manifest for Fusion apps.',
1070
+ const command$i = createCommand('manifest')
1071
+ .description('Build and output the application manifest for Fusion apps.')
1072
+ .addHelpText('after', [
1018
1073
  '',
1019
- 'By default, the manifest is printed to stdout. Use --output to write it to a file.',
1074
+ 'Builds and outputs the application manifest for Fusion apps.',
1075
+ 'By default, prints the manifest to stdout. Use --output to write to a file.',
1020
1076
  'You can specify a custom manifest build file or use the default (app.manifest[.env]?.[ts,js,json]).',
1021
1077
  'Supports debug and silent modes for flexible output.',
1022
1078
  '',
1079
+ 'Arguments:',
1080
+ ' [manifest] Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])',
1081
+ '',
1082
+ 'Options:',
1083
+ ' -d, --debug Enable debug mode for verbose logging',
1084
+ ' -o, --output Write manifest to the specified file (default: stdout)',
1085
+ ' -s, --silent Silent mode, suppresses output except errors',
1086
+ '',
1023
1087
  'Examples:',
1024
1088
  ' $ fusion manifest',
1025
1089
  ' $ fusion manifest app.manifest.prod.ts --output ./dist/app.manifest.json',
@@ -1077,12 +1141,23 @@ const command$h = createCommand('manifest')
1077
1141
  *
1078
1142
  * @see uploadApplication, tagApplication for implementation details
1079
1143
  */
1080
- const command$g = withAuthOptions(createCommand('publish')
1081
- .description([
1082
- 'Build, upload, and tag your Fusion application for deployment to the Fusion portal.',
1144
+ const command$h = withAuthOptions(createCommand('publish')
1145
+ .description('Build, upload, and tag your Fusion application for deployment.')
1146
+ .addHelpText('after', [
1147
+ '',
1148
+ 'Builds, uploads, and tags a Fusion application for deployment to the Fusion portal.',
1149
+ 'Bundles the app, uploads it to the Fusion app store, and applies a tag for versioning.',
1150
+ 'Supports specifying environment, manifest file, and tag.',
1151
+ 'Debug mode and authentication options are supported.',
1083
1152
  '',
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.',
1153
+ 'Arguments:',
1154
+ ' [bundle] Path to the app bundle to upload',
1155
+ '',
1156
+ 'Options:',
1157
+ ' -d, --debug Enable debug mode for verbose logging (default: false)',
1158
+ ' -e, --env <env> Target environment',
1159
+ ' -m, --manifest Manifest file to use for bundling (e.g., app.manifest.ts)',
1160
+ ' -t, --tag Tag to apply to the published app (latest | preview)',
1086
1161
  '',
1087
1162
  'Examples:',
1088
1163
  ' $ fusion publish',
@@ -1163,30 +1238,30 @@ const command$g = withAuthOptions(createCommand('publish')
1163
1238
  * Each alias maps an old "build-*" command to its new equivalent, providing warnings and guidance for users.
1164
1239
  * These aliases help maintain backward compatibility and inform users about updated command usage.
1165
1240
  */
1166
- command$n.alias('build-pack').hook('preAction', (thisCommand) => {
1241
+ command$o.alias('build-pack').hook('preAction', (thisCommand) => {
1167
1242
  if (process.argv[3] === 'build-pack') {
1168
1243
  console.warn(chalk.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.'));
1169
1244
  if (!thisCommand.getOptionValue('archive')) {
1170
- thisCommand.setOptionValue('archive', defaultArchive);
1245
+ thisCommand.setOptionValue('archive', DEFAULT_ARCHIVE);
1171
1246
  }
1172
1247
  }
1173
1248
  });
1174
- command$l.alias('build-upload').hook('preAction', (thisCommand) => {
1249
+ command$m.alias('build-upload').hook('preAction', (thisCommand) => {
1175
1250
  if (process.argv[3] === 'build-upload') {
1176
1251
  console.warn(chalk.bgRedBright.bold('The command "build-upload" is deprecated. Please use "upload" instead.'));
1177
1252
  if (thisCommand.getOptionValue('service')) {
1178
1253
  throw new Error('The --service option is deprecated. Please use --env instead.');
1179
1254
  }
1180
- const bundle = thisCommand.getOptionValue('bundle') ?? defaultArchive;
1255
+ const bundle = thisCommand.getOptionValue('bundle') ?? DEFAULT_ARCHIVE;
1181
1256
  process.argv[4] = bundle;
1182
1257
  }
1183
1258
  });
1184
- command$h.alias('build-manifest').hook('preAction', (thisCommand) => {
1259
+ command$i.alias('build-manifest').hook('preAction', () => {
1185
1260
  if (process.argv[3] === 'build-manifest') {
1186
1261
  console.warn(chalk.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'));
1187
1262
  }
1188
1263
  });
1189
- command$g.alias('build-publish').hook('preAction', (thisCommand) => {
1264
+ command$h.alias('build-publish').hook('preAction', (thisCommand) => {
1190
1265
  if (process.argv[3] === 'build-publish') {
1191
1266
  console.warn(chalk.bgRedBright.bold('The command "build-publish" is deprecated. Please use "publish" instead.'));
1192
1267
  }
@@ -1195,8 +1270,26 @@ command$g.alias('build-publish').hook('preAction', (thisCommand) => {
1195
1270
  }
1196
1271
  });
1197
1272
 
1198
- const command$f = createCommand('app')
1199
- .description('Develop and deploy Fusion applications')
1273
+ const command$g = createCommand('app')
1274
+ .description('Develop, build, configure, and deploy Fusion applications from your workspace root.')
1275
+ .addHelpText('after', [
1276
+ '',
1277
+ 'The "app" command is your main entry point for managing Fusion applications in this workspace.',
1278
+ '',
1279
+ 'It provides access to subcommands for every stage of the application lifecycle, including development, building, packaging, configuration, deployment, and release management.',
1280
+ '',
1281
+ 'All available subcommands are listed below automatically. For details and options for a specific subcommand, run:',
1282
+ ' fusion app <subcommand> --help',
1283
+ '',
1284
+ 'Typical usage:',
1285
+ ' - Run and test your app locally with the dev subcommand',
1286
+ ' - Build, bundle, and configure your app for deployment',
1287
+ ' - Upload, publish, and tag releases to the Fusion App Store',
1288
+ ' - Check registration and generate manifests as needed',
1289
+ '',
1290
+ 'This command should be run from your app root directory.',
1291
+ ].join('\n'))
1292
+ .addCommand(command$p)
1200
1293
  .addCommand(command$o)
1201
1294
  .addCommand(command$n)
1202
1295
  .addCommand(command$m)
@@ -1204,30 +1297,33 @@ const command$f = createCommand('app')
1204
1297
  .addCommand(command$k)
1205
1298
  .addCommand(command$j)
1206
1299
  .addCommand(command$i)
1207
- .addCommand(command$h)
1208
- .addCommand(command$g);
1300
+ .addCommand(command$h);
1209
1301
 
1210
1302
  /**
1211
1303
  * Command to authenticate and log in to Fusion Framework using interactive browser-based authentication.
1212
1304
  *
1213
1305
  * This command initializes the Fusion Framework and opens a browser window for secure login.
1214
1306
  * 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
1307
  */
1220
1308
  const DEFAULT_SERVER_PORT = 49741;
1221
- const command$e = createCommand('login')
1222
- .description([
1309
+ const command$f = createCommand('login')
1310
+ .description('Authenticate and log in to Fusion Framework using interactive browser-based authentication.')
1311
+ .addHelpText('after', [
1312
+ '',
1223
1313
  'Authenticate and log in to Fusion Framework using interactive browser-based authentication.',
1224
1314
  '',
1225
1315
  'This command initializes the Fusion Framework and opens a browser window for secure login.',
1226
1316
  'Supports custom tenant, client, and scope options for advanced authentication scenarios.',
1227
1317
  '',
1318
+ 'Options:',
1319
+ ' --tenant <tenantId> Specify the tenant ID',
1320
+ ' --client <clientId> Specify the client ID',
1321
+ ' --scope <scope> Specify the scope(s) for authentication',
1322
+ ' --debug Enable debug mode for verbose logging',
1323
+ '',
1228
1324
  'Examples:',
1229
- ' $ fusion login',
1230
- ' $ fusion login --tenant my-tenant --client my-client-id --scope api://my-app/.default',
1325
+ ' $ fusion-framework-cli login',
1326
+ ' $ fusion-framework-cli login --tenant my-tenant --client my-client-id --scope api://my-app/.default',
1231
1327
  ].join('\n'))
1232
1328
  .action(async (options) => {
1233
1329
  const log = new ConsoleLogger('auth:login', { debug: options.debug });
@@ -1264,7 +1360,7 @@ const command$e = createCommand('login')
1264
1360
  * Adds authentication options to the login command.
1265
1361
  * @see withAuthOptions
1266
1362
  */
1267
- withAuthOptions(command$e, {
1363
+ withAuthOptions(command$f, {
1268
1364
  includeScope: true,
1269
1365
  excludeToken: true,
1270
1366
  });
@@ -1274,21 +1370,24 @@ withAuthOptions(command$e, {
1274
1370
  *
1275
1371
  * This command removes your current authentication state from the Fusion Framework CLI.
1276
1372
  * 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
1373
  */
1282
- const command$d = createCommand('logout')
1283
- .description([
1374
+ const command$e = createCommand('logout')
1375
+ .description('Log out from Fusion Framework and clear your authentication session.')
1376
+ .addHelpText('after', [
1377
+ '',
1284
1378
  'Log out from Fusion Framework and clear your authentication session.',
1285
1379
  '',
1286
1380
  'This command removes your current authentication state from the Fusion Framework CLI.',
1287
1381
  'Supports custom tenant and client options for advanced scenarios.',
1288
1382
  '',
1383
+ 'Options:',
1384
+ ' --tenant <tenantId> Specify the tenant ID',
1385
+ ' --client <clientId> Specify the client ID',
1386
+ ' --debug Enable debug mode for verbose logging',
1387
+ '',
1289
1388
  'Examples:',
1290
- ' $ fusion logout',
1291
- ' $ fusion logout --tenant my-tenant --client my-client-id',
1389
+ ' $ fusion-framework-cli logout',
1390
+ ' $ fusion-framework-cli logout --tenant my-tenant --client my-client-id',
1292
1391
  ].join('\n'))
1293
1392
  .action(async (options) => {
1294
1393
  const log = new ConsoleLogger('auth:logout', { debug: options.debug });
@@ -1314,7 +1413,7 @@ const command$d = createCommand('logout')
1314
1413
  * Adds authentication options to the logout command.
1315
1414
  * @see withAuthOptions
1316
1415
  */
1317
- withAuthOptions(command$d, {
1416
+ withAuthOptions(command$e, {
1318
1417
  excludeToken: true,
1319
1418
  includeScope: false,
1320
1419
  });
@@ -1324,23 +1423,27 @@ withAuthOptions(command$d, {
1324
1423
  *
1325
1424
  * This command retrieves an access token for the specified scopes, tenant, and client.
1326
1425
  * 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
1426
  */
1333
- const command$c = createCommand('token')
1334
- .description([
1427
+ const command$d = createCommand('token')
1428
+ .description('Acquire and print an access token for Fusion APIs using your current authentication context.')
1429
+ .addHelpText('after', [
1430
+ '',
1335
1431
  'Acquire and print an access token for Fusion APIs using your current authentication context.',
1336
1432
  '',
1337
1433
  'This command retrieves an access token for the specified scopes, tenant, and client.',
1338
1434
  'Supports debug and silent modes for flexible output.',
1339
1435
  '',
1436
+ 'Options:',
1437
+ ' --tenant <tenantId> Specify the tenant ID',
1438
+ ' --client <clientId> Specify the client ID',
1439
+ ' --scope <scope> Specify the scope(s) for authentication',
1440
+ ' --debug Enable debug mode for verbose logging',
1441
+ ' --silent Only output the token (no extra logging)',
1442
+ '',
1340
1443
  'Examples:',
1341
- ' $ fusion token',
1342
- ' $ fusion token --scope api://my-app/.default',
1343
- ' $ fusion token --tenant my-tenant --client my-client-id --silent',
1444
+ ' $ fusion-framework-cli token',
1445
+ ' $ fusion-framework-cli token --scope api://my-app/.default',
1446
+ ' $ fusion-framework-cli token --tenant my-tenant --client my-client-id --silent',
1344
1447
  ].join('\n'))
1345
1448
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
1346
1449
  .option('--silent', 'Only output the token (no extra logging)')
@@ -1383,14 +1486,26 @@ const command$c = createCommand('token')
1383
1486
  * Adds authentication options to the token command.
1384
1487
  * @see withAuthOptions
1385
1488
  */
1386
- withAuthOptions(command$c, {
1489
+ withAuthOptions(command$d, {
1387
1490
  includeScope: true,
1388
1491
  });
1389
1492
 
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);
1493
+ const command$c = new Command('auth')
1494
+ .description('Authenticate with Fusion Framework CLI')
1495
+ .addHelpText('after', [
1496
+ '',
1497
+ 'Authentication commands for Fusion Framework CLI.',
1498
+ '',
1499
+ 'Use these commands to log in, log out, or acquire tokens for Fusion APIs.',
1500
+ '',
1501
+ 'Examples:',
1502
+ ' $ fusion-framework-cli auth login',
1503
+ ' $ fusion-framework-cli auth logout',
1504
+ ' $ fusion-framework-cli auth token --scope api://my-app/.default',
1505
+ ].join('\n'));
1506
+ command$c.addCommand(command$f, { isDefault: true });
1507
+ command$c.addCommand(command$e);
1508
+ command$c.addCommand(command$d);
1394
1509
 
1395
1510
  /**
1396
1511
  * The `resolve` command resolves and displays information about a service registered in Fusion service discovery.
@@ -1399,13 +1514,6 @@ command$b.addCommand(command$c);
1399
1514
  *
1400
1515
  * Supports environment selection and authentication options.
1401
1516
  *
1402
- * ## Examples
1403
- *
1404
- * ```sh
1405
- * $ fusion resolve my-service
1406
- * $ fusion resolve my-service --env prod
1407
- * ```
1408
- *
1409
1517
  * @command resolve
1410
1518
  * @description Resolve and display information about a service registered in Fusion service discovery.
1411
1519
  * @argument {string} service - Name of the service to resolve in Fusion service discovery.
@@ -1415,16 +1523,20 @@ command$b.addCommand(command$c);
1415
1523
  * @option {string} --clientId - Client ID for authentication.
1416
1524
  * @returns {Promise<void>} Prints the resolved service details to the console.
1417
1525
  */
1418
- const command$a = withAuthOptions(createCommand('resolve')
1419
- .description([
1526
+ const command$b = withAuthOptions(createCommand('resolve')
1527
+ .description('Resolve and display information about a service registered in Fusion service discovery.')
1528
+ .addHelpText('after', [
1529
+ '',
1420
1530
  'Resolve and display information about a service registered in Fusion service discovery.',
1421
1531
  '',
1422
1532
  '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
1533
  '',
1425
1534
  'Examples:',
1426
- ' $ fusion resolve my-service',
1427
- ' $ fusion resolve my-service --env prod',
1535
+ ' $ fusion-framework-cli resolve my-service',
1536
+ ' $ fusion-framework-cli resolve my-service --env prod',
1537
+ ' $ fusion-framework-cli resolve my-service --env test --tenantId my-tenant --clientId my-client-id',
1538
+ '',
1539
+ 'The command will print the resolved service details to the console.',
1428
1540
  ].join('\n'))
1429
1541
  .addOption(createEnvOption({ allowDev: false }))
1430
1542
  .argument('<service>', 'Name of the service to resolve in Fusion service discovery')
@@ -1447,8 +1559,8 @@ const command$a = withAuthOptions(createCommand('resolve')
1447
1559
  console.debug(appClient);
1448
1560
  }));
1449
1561
 
1450
- const command$9 = createCommand('disco').description('Service discovery operations');
1451
- command$9.addCommand(command$a);
1562
+ const command$a = createCommand('disco').description('Service discovery operations');
1563
+ command$a.addCommand(command$b);
1452
1564
 
1453
1565
  /**
1454
1566
  * Starts the portal development server for local development and testing.
@@ -1463,7 +1575,7 @@ command$9.addCommand(command$a);
1463
1575
  */
1464
1576
  const startPortalDevServer = async (options) => {
1465
1577
  const { log } = options ?? {};
1466
- // Resolve the application's package.json for root and metadata
1578
+ // Resolve the portals's package.json for root and metadata
1467
1579
  const pkg = await resolveProjectPackage(log);
1468
1580
  // Setup the runtime environment for the dev server
1469
1581
  const env = {
@@ -1473,22 +1585,11 @@ const startPortalDevServer = async (options) => {
1473
1585
  mode: 'development', // Force development mode
1474
1586
  command: 'serve', // Command is always 'serve' for dev
1475
1587
  };
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' });
1588
+ // Resolve the portal manifest using the environment and manifest path
1589
+ const portalManifest = await resolvePortalManifest(env, pkg, {
1590
+ log,
1591
+ manifestPath: options?.manifest,
1592
+ });
1492
1593
  // Resolve the portal config (replace with real logic as needed)
1493
1594
  const portalConfig = await resolvePortalConfig(env, { log, config: options?.config });
1494
1595
  log?.start('Starting app development server...');
@@ -1496,15 +1597,19 @@ const startPortalDevServer = async (options) => {
1496
1597
  const devServer = await createDevServer(env, {
1497
1598
  template: {
1498
1599
  portal: {
1499
- id: portalManifest.id,
1600
+ id: portalManifest.name,
1500
1601
  },
1501
1602
  },
1502
1603
  portal: {
1503
1604
  manifest: portalManifest,
1504
1605
  config: portalConfig,
1505
1606
  },
1607
+ }, {
1506
1608
  server: {
1507
1609
  port: options?.server?.port,
1610
+ fs: {
1611
+ allow: [pkg.root], // Allow access to the root directory
1612
+ },
1508
1613
  },
1509
1614
  });
1510
1615
  await devServer.listen();
@@ -1514,16 +1619,19 @@ const startPortalDevServer = async (options) => {
1514
1619
  return devServer;
1515
1620
  };
1516
1621
 
1517
- const command$8 = createCommand('dev')
1518
- .description([
1519
- 'Start the Fusion portal in development mode with live reloading and custom port support.',
1622
+ const command$9 = createCommand('dev')
1623
+ .description('Start a local development server for the Fusion portal.')
1624
+ .addHelpText('after', [
1520
1625
  '',
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.',
1626
+ 'Starts a local development server for your Fusion portal.',
1627
+ '',
1628
+ 'Options:',
1629
+ ' -p, --port Port to run the development server on (default: 3000)',
1630
+ ' -d, --debug Enable debug mode for verbose logging',
1523
1631
  '',
1524
1632
  'Examples:',
1525
- ' $ fusion portal dev',
1526
- ' $ fusion portal dev --port 4000 --debug',
1633
+ ' $ fusion-framework-cli portal dev',
1634
+ ' $ fusion-framework-cli portal dev --port 4000 --debug',
1527
1635
  ].join('\n'))
1528
1636
  .option('-p, --port <number>', 'Port to run the development server on', '3000')
1529
1637
  .option('-d, --debug', 'Enable debug mode for verbose logging')
@@ -1534,18 +1642,21 @@ const command$8 = createCommand('dev')
1534
1642
  log.succeed('Development server started successfully.');
1535
1643
  });
1536
1644
 
1537
- const command$7 = createCommand('manifest')
1538
- .description([
1539
- 'Build and output the portal manifest for Fusion apps.',
1645
+ const command$8 = createCommand('manifest')
1646
+ .description('Generate or validate a Fusion portal manifest file.')
1647
+ .addHelpText('after', [
1648
+ 'Generates or validates a Fusion portal manifest file.',
1540
1649
  '',
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.',
1650
+ 'If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.',
1651
+ '',
1652
+ 'Options:',
1653
+ ' -o, --output Write manifest to the specified file (default: stdout)',
1654
+ ' -d, --debug Enable debug mode for verbose logging',
1655
+ ' -s, --silent Silent mode, suppresses output except errors',
1544
1656
  '',
1545
1657
  'Examples:',
1546
- ' $ fusion portal manifest',
1547
- ' $ fusion portal manifest app.manifest.prod.ts --output ./dist/portal.manifest.json',
1548
- ' $ fusion portal manifest --debug',
1658
+ ' $ fusion-framework-cli portal manifest',
1659
+ ' $ fusion-framework-cli portal manifest portal.manifest.prod.ts --output ./dist/portal.manifest.json',
1549
1660
  ].join('\n'))
1550
1661
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
1551
1662
  .option('-o, --output <string>', 'Write manifest to the specified file', 'stdout')
@@ -9351,18 +9462,20 @@ function require_2020 () {
9351
9462
  var _2020Exports = require_2020();
9352
9463
  var Ajv2020 = /*@__PURE__*/getDefaultExportFromCjs(_2020Exports);
9353
9464
 
9354
- const command$6 = createCommand('schema')
9355
- .description([
9356
- 'Generate and validate the JSON schema for the Fusion portal application.',
9465
+ const command$7 = createCommand('schema')
9466
+ .description('Generate or validate a Fusion portal schema file.')
9467
+ .addHelpText('after', [
9468
+ 'Generates or validates a Fusion portal schema file.',
9357
9469
  '',
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.',
9470
+ 'Options:',
9471
+ ' -o, --output Output file name (default: stdout)',
9472
+ ' -v, --validate Validate the generated schema against a JSON file',
9473
+ ' -d, --debug Enable debug mode for verbose logging',
9360
9474
  '',
9361
9475
  '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',
9476
+ ' $ fusion-framework-cli portal schema',
9477
+ ' $ fusion-framework-cli portal schema --output portal.schema.json',
9478
+ ' $ fusion-framework-cli portal schema --validate my-config.json',
9366
9479
  ].join('\n'))
9367
9480
  .addOption(createEnvOption({ allowDev: true }))
9368
9481
  .option('-o, --output <string>', 'Output file name (default: stdout)', 'stdout')
@@ -9411,40 +9524,50 @@ const command$6 = createCommand('schema')
9411
9524
  }
9412
9525
  });
9413
9526
 
9414
- const command$5 = createCommand('build')
9415
- .description([
9416
- 'Build the Fusion portal using a manifest file and environment-specific configuration.',
9527
+ const command$6 = createCommand('build')
9528
+ .description('Build the Fusion portal from a manifest file with environment-specific settings.')
9529
+ .addHelpText('after', [
9530
+ 'Builds the Fusion portal using a manifest file and environment-specific configuration.',
9417
9531
  '',
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.',
9532
+ 'If no manifest is provided, the command will search for a default portal.manifest.[ts|js|json] in the current directory.',
9533
+ 'You can use environment variables to customize the build process (e.g., NODE_ENV, FUSION_PORTAL_*).',
9534
+ '',
9535
+ 'Options:',
9536
+ ' -d, --debug Enable debug mode for verbose logging',
9420
9537
  '',
9421
9538
  'Examples:',
9422
- ' $ fusion portal build',
9423
- ' $ fusion portal build app.manifest.prod.ts --debug',
9539
+ ' $ fusion-framework-cli portal build',
9540
+ ' $ fusion-framework-cli portal build portal.manifest.prod.ts --debug',
9541
+ '',
9424
9542
  ].join('\n'))
9425
9543
  .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])')
9544
+ .argument('[manifest]', 'Manifest build file to use for building (e.g., portal.manifest[.env]?.[ts,js,json])')
9427
9545
  .action(async (manifest, opt) => {
9428
9546
  const log = new ConsoleLogger('portal:build', { debug: opt.debug });
9429
9547
  await buildPortal({ log, manifest });
9430
9548
  });
9431
9549
 
9432
- const command$4 = createCommand('pack')
9433
- .description([
9434
- 'Create a distributable bundle of the Fusion portal application for deployment.',
9550
+ const command$5 = createCommand('pack')
9551
+ .description('Bundle the Fusion portal into a deployable archive.')
9552
+ .addHelpText('after', [
9553
+ 'Bundles the Fusion portal using the provided manifest and schema into a zip archive for deployment.',
9435
9554
  '',
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.',
9555
+ 'If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.',
9556
+ '',
9557
+ 'Options:',
9558
+ ' -a, --archive Name of the output archive file (default: out/bundle.zip)',
9559
+ ' --schema Schema file to use for validation',
9560
+ ' -d, --debug Enable debug mode for verbose logging',
9438
9561
  '',
9439
9562
  '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',
9563
+ ' $ fusion-framework-cli portal pack',
9564
+ ' $ fusion-framework-cli portal pack --archive my-portal.zip --schema portal.schema.json',
9565
+ ' $ fusion-framework-cli portal pack portal.manifest.prod.ts --debug',
9443
9566
  ].join('\n'))
9444
9567
  .option('-a, --archive [string]', 'Name of the output archive file (default: out/bundle.zip)', 'out/bundle.zip')
9445
9568
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
9446
9569
  .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])')
9570
+ .argument('[manifest]', 'Manifest file to use for bundling (e.g., portal.manifest[.env]?.[ts,js,json])')
9448
9571
  .action(async (manifest, options) => {
9449
9572
  const log = new ConsoleLogger('portal:pack', {
9450
9573
  debug: options.debug,
@@ -9554,17 +9677,18 @@ const uploadPortalBundle = async (opt) => {
9554
9677
  }
9555
9678
  };
9556
9679
 
9557
- const command$3 = withAuthOptions(createCommand('upload')
9558
- .description([
9559
- 'Upload a Fusion portal bundle to the Fusion portal registry for deployment.',
9680
+ const command$4 = withAuthOptions(createCommand('upload')
9681
+ .description('Upload a Fusion portal bundle to the portal registry.')
9682
+ .addHelpText('after', [
9683
+ 'Uploads a distributable Fusion portal bundle to the portal registry for deployment.',
9560
9684
  '',
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.',
9685
+ 'Options:',
9686
+ ' --env Target environment',
9687
+ ' -d, --debug Enable debug mode for verbose logging',
9563
9688
  '',
9564
9689
  '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',
9690
+ ' $ fusion-framework-cli portal upload my-portal-bundle.zip',
9691
+ ' $ fusion-framework-cli portal upload my-portal-bundle.zip --env prod',
9568
9692
  ].join('\n'))
9569
9693
  .option('-d, --debug [boolean]', 'Enable debug mode for verbose logging', false)
9570
9694
  .addOption(createEnvOption({ allowDev: false }))
@@ -9679,18 +9803,22 @@ const tagPortal = async (options) => {
9679
9803
  }
9680
9804
  };
9681
9805
 
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.',
9806
+ const command$3 = withAuthOptions(createCommand('tag')
9807
+ .description('Tag your Fusion portal with a specific version or label.')
9808
+ .addHelpText('after', [
9809
+ 'Tags your Fusion portal with a specific version or label in the portal registry.',
9685
9810
  '',
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.',
9811
+ 'Options:',
9812
+ ' -n, --name Portal name (if not provided, resolved from manifest)',
9813
+ ' -m, --manifest Manifest file to use for resolving portal name and version',
9814
+ ' -v, --version Version to tag (if not provided, resolved from manifest)',
9815
+ ' --env Target environment',
9816
+ ' -d, --debug Enable debug mode for verbose logging',
9817
+ ' --silent Silent mode, suppresses output except errors',
9689
9818
  '',
9690
9819
  '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',
9820
+ ' $ fusion-framework-cli portal tag latest',
9821
+ ' $ fusion-framework-cli portal tag preview --env prod --manifest portal.manifest.prod.ts',
9694
9822
  ].join('\n'))
9695
9823
  .addOption(createEnvOption({ allowDev: false }))
9696
9824
  .option('-n, --name <string>', 'Portal name (if not provided, resolved from manifest)')
@@ -9740,18 +9868,21 @@ const command$2 = withAuthOptions(createCommand('tag')
9740
9868
  });
9741
9869
  }));
9742
9870
 
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.',
9871
+ const command$2 = withAuthOptions(createCommand('publish')
9872
+ .description('Build, upload, and tag your Fusion portal bundle for deployment.')
9873
+ .addHelpText('after', [
9874
+ 'Builds, uploads, and tags your Fusion portal bundle for deployment to the portal registry.',
9746
9875
  '',
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.',
9876
+ 'Options:',
9877
+ ' --env Target environment',
9878
+ ' -m, --manifest Manifest file to use for bundling',
9879
+ ' --schema Schema file to use for validation',
9880
+ ' -t, --tag Tag to apply to the published portal',
9881
+ ' -d, --debug Enable debug mode for verbose logging',
9749
9882
  '',
9750
9883
  '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',
9884
+ ' $ fusion-framework-cli portal publish',
9885
+ ' $ fusion-framework-cli portal publish --env prod --manifest portal.manifest.prod.ts',
9755
9886
  ].join('\n'))
9756
9887
  .option('-d, --debug', 'Enable debug mode for verbose logging', false)
9757
9888
  .addOption(createEnvOption({ allowDev: false }))
@@ -9803,8 +9934,102 @@ const command$1 = withAuthOptions(createCommand('publish')
9803
9934
  log.succeed('🏷️ Tagging completed');
9804
9935
  }));
9805
9936
 
9937
+ /**
9938
+ * CLI command: `portal config`
9939
+ *
9940
+ * Generates and/or publishes the portal configuration for Fusion portals.
9941
+ *
9942
+ * Features:
9943
+ * - Outputs the generated config to stdout or a file.
9944
+ * - Use --publish to upload the config to the Fusion portal registry.
9945
+ * - Options [token, tenant, client, config, identifier, env, output] are only relevant when --publish is used.
9946
+ * - Option [--env] cannot be set to dev when --publish is used.
9947
+ *
9948
+ * Usage:
9949
+ * $ fusion-framework-cli portal config --identifier <portal@version> [options]
9950
+ *
9951
+ * Options:
9952
+ * --debug Enable debug mode for verbose logging
9953
+ * --silent Silent mode, suppresses output except errors
9954
+ * --publish Publish config to Fusion portal registry
9955
+ * --identifier <name@version> Identifier of the portal, example my-portal@1.2.3 (required with --publish)
9956
+ * -o, --output <stdout|path> Output to stdout or a file (default: stdout)
9957
+ * <config> Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])
9958
+ * --env <env> Target environment
9959
+ *
9960
+ * Examples:
9961
+ * $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o stdout portal.config.ts
9962
+ * $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o ./dist/portal.config.json portal.config.prod.ts
9963
+ * $ fusion-framework-cli portal config --publish --env prod --identifier my-portal@1.2.3 portal.config.ts
9964
+ *
9965
+ * @see generatePortalConfig, publishPortalConfig for implementation details
9966
+ */
9967
+ const command$1 = withAuthOptions(createCommand('config')
9968
+ .description('Generate or publish the Fusion portal configuration file.')
9969
+ .addHelpText('after', [
9970
+ 'Generates and/or publishes the Fusion portal configuration.',
9971
+ '',
9972
+ 'By default, outputs the config to stdout or a file. Use --publish to upload to the portal registry.',
9973
+ '',
9974
+ 'Options:',
9975
+ ' --publish Publish config to Fusion portal registry',
9976
+ ' --identifier Portal identifier (required with --publish)',
9977
+ ' -o, --output Output to stdout or a file (default: stdout)',
9978
+ ' --env Target environment',
9979
+ ' --debug Enable debug mode for verbose logging',
9980
+ '',
9981
+ 'Examples:',
9982
+ ' $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o stdout portal.config.ts',
9983
+ ' $ fusion-framework-cli portal config --publish --env prod --identifier my-portal@1.2.3 portal.config.ts',
9984
+ ].join('\n'))
9985
+ .option('--debug', 'Enable debug mode for verbose logging')
9986
+ .option('--silent', 'Silent mode, suppresses output except errors')
9987
+ .option('--publish <name@version>', 'Publish config to Fusion portal registry, Identifier of the portal, example my-portal@1.2.3')
9988
+ .addOption(createEnvOption({ allowDev: true }))
9989
+ .option('-o, --output <stdout|path>', 'Output the result to stdout or a file (ignored with --publish, default: stdout)', 'stdout')
9990
+ .argument('[config]', 'Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])')
9991
+ .action(async (config, options) => {
9992
+ const log = options.silent
9993
+ ? null
9994
+ : new ConsoleLogger('portal:config', { debug: !!options.debug });
9995
+ // Validate env for publish (no dev allowed)
9996
+ if (options.publish) {
9997
+ const [name, version] = options.publish.split('@') || [];
9998
+ if (!name || !version) {
9999
+ log?.fail('🤪', 'Portal identifier is required when using', chalk.blue('--publish'));
10000
+ log?.info('Example: fusion-framework-cli portal config --publish my-portal@1.2.3');
10001
+ process.exit(1);
10002
+ }
10003
+ if (options.env === 'dev') {
10004
+ log?.fail('🤪', chalk.blue('--env'), 'cannot be "dev" when', chalk.blue('--publish'), ' is used');
10005
+ process.exit(1);
10006
+ }
10007
+ return publishPortalConfig({
10008
+ config: options.config,
10009
+ portal: {
10010
+ name,
10011
+ version,
10012
+ },
10013
+ environment: options.env,
10014
+ auth: 'token' in options ? { token: options.token } : options,
10015
+ debug: options.debug,
10016
+ });
10017
+ }
10018
+ // Generate config
10019
+ const { config: portalConfig } = await generatePortalConfig({
10020
+ log,
10021
+ config,
10022
+ env: { environment: options.env },
10023
+ output: options.output === 'stdout' ? undefined : options.output,
10024
+ });
10025
+ if (options.output === 'stdout') {
10026
+ stdout.write(JSON.stringify(portalConfig, null, 2));
10027
+ }
10028
+ }));
10029
+
9806
10030
  const command = createCommand('portal')
9807
10031
  .description('Develop and deploy portal templates')
10032
+ .addCommand(command$9)
9808
10033
  .addCommand(command$8)
9809
10034
  .addCommand(command$7)
9810
10035
  .addCommand(command$6)
@@ -9815,9 +10040,9 @@ const command = createCommand('portal')
9815
10040
  .addCommand(command$1);
9816
10041
 
9817
10042
  var registerCommands = (program) => {
9818
- program.addCommand(command$f);
9819
- program.addCommand(command$b);
9820
- program.addCommand(command$9);
10043
+ program.addCommand(command$g);
10044
+ program.addCommand(command$c);
10045
+ program.addCommand(command$a);
9821
10046
  program.addCommand(command);
9822
10047
  };
9823
10048