@signageos/cli 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +54 -0
  2. package/dist/Applet/Build/appletBuildCommand.d.ts +1 -2
  3. package/dist/Applet/Build/appletBuildCommand.js +1 -2
  4. package/dist/Applet/Generate/appletGenerateCommand.d.ts +1 -1
  5. package/dist/Applet/Generate/appletGenerateCommand.js +6 -6
  6. package/dist/Applet/Start/appletStartCommand.d.ts +1 -1
  7. package/dist/Applet/Start/appletStartCommand.js +1 -1
  8. package/dist/Applet/Test/Upload/appletTestRunCommand.d.ts +1 -1
  9. package/dist/Applet/Test/Upload/appletTestRunCommand.js +1 -1
  10. package/dist/Applet/Test/Upload/appletTestUploadCommand.d.ts +1 -1
  11. package/dist/Applet/Test/Upload/appletTestUploadCommand.js +1 -1
  12. package/dist/Applet/Test/appletTestCommand.d.ts +1 -1
  13. package/dist/Applet/Test/appletTestCommand.js +1 -1
  14. package/dist/Applet/Upload/appletUploadCommand.d.ts +1 -1
  15. package/dist/Applet/Upload/appletUploadCommand.js +1 -1
  16. package/dist/Applet/appletCommand.d.ts +1 -1
  17. package/dist/Applet/appletCommand.js +1 -1
  18. package/dist/Applet/appletFacade.d.ts +2 -2
  19. package/dist/Applet/appletFacade.js +22 -14
  20. package/dist/Auth/loginCommand.d.ts +3 -10
  21. package/dist/Auth/loginCommand.js +10 -22
  22. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.d.ts +1 -1
  23. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.js +1 -1
  24. package/dist/Command/Autocomplete/Install/installAutocompleteCommand.ts +1 -1
  25. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.d.ts +1 -1
  26. package/dist/Command/Autocomplete/Uninstall/uninstallAutocompleteCommand.js +1 -1
  27. package/dist/Command/Autocomplete/autocompleteCommand.d.ts +1 -1
  28. package/dist/Command/Autocomplete/autocompleteCommand.js +1 -1
  29. package/dist/Command/commandProcessor.d.ts +1 -0
  30. package/dist/Command/commandProcessor.js +78 -0
  31. package/dist/Command/globalArgs.d.ts +0 -2
  32. package/dist/Command/globalArgs.js +0 -2
  33. package/dist/CustomScript/Generate/customScriptGenerateCommand.d.ts +32 -8
  34. package/dist/CustomScript/Generate/customScriptGenerateCommand.js +17 -9
  35. package/dist/CustomScript/Generate/customScriptGenerateFacade.d.ts +7 -5
  36. package/dist/CustomScript/Generate/customScriptGenerateFacade.js +81 -32
  37. package/dist/CustomScript/Generate/customScriptGenerateOptions.d.ts +17 -0
  38. package/dist/CustomScript/Generate/customScriptGenerateOptions.js +13 -0
  39. package/dist/CustomScript/Upload/customScriptUploadCommand.d.ts +23 -16
  40. package/dist/CustomScript/Upload/customScriptUploadCommand.js +26 -18
  41. package/dist/CustomScript/customScriptCommand.d.ts +31 -9
  42. package/dist/CustomScript/customScriptCommand.js +9 -7
  43. package/dist/CustomScript/customScriptFacade.d.ts +1 -1
  44. package/dist/CustomScript/customScriptFacade.js +29 -19
  45. package/dist/Device/Connect/connectCommand.d.ts +1 -1
  46. package/dist/Device/Connect/connectCommand.js +1 -1
  47. package/dist/Device/Content/setContentCommand.d.ts +16 -6
  48. package/dist/Device/Content/setContentCommand.js +23 -10
  49. package/dist/Device/PowerAction/powerActionCommand.d.ts +1 -1
  50. package/dist/Device/PowerAction/powerActionCommand.js +1 -1
  51. package/dist/Device/deviceCommand.d.ts +9 -1
  52. package/dist/Device/deviceCommand.js +1 -1
  53. package/dist/Device/deviceFacade.d.ts +1 -1
  54. package/dist/Device/deviceFacade.js +22 -17
  55. package/dist/Organization/Get/organizationGetCommand.d.ts +1 -1
  56. package/dist/Organization/Get/organizationGetCommand.js +1 -1
  57. package/dist/Organization/List/organizationListCommand.d.ts +1 -1
  58. package/dist/Organization/List/organizationListCommand.js +1 -1
  59. package/dist/Organization/SetDefault/organizationSetDefaultCommand.d.ts +1 -1
  60. package/dist/Organization/SetDefault/organizationSetDefaultCommand.js +1 -1
  61. package/dist/Organization/organizationCommand.d.ts +1 -1
  62. package/dist/Organization/organizationCommand.js +1 -1
  63. package/dist/Plugin/Generate/pluginGenerateCommand.d.ts +36 -2
  64. package/dist/Plugin/Generate/pluginGenerateCommand.js +25 -3
  65. package/dist/Plugin/Generate/pluginGenerateFacade.d.ts +7 -5
  66. package/dist/Plugin/Generate/pluginGenerateFacade.js +38 -16
  67. package/dist/Plugin/Generate/pluginGenerateOptions.d.ts +13 -0
  68. package/dist/Plugin/Generate/pluginGenerateOptions.js +20 -0
  69. package/dist/Plugin/Upload/pluginUploadCommand.d.ts +28 -0
  70. package/dist/Plugin/Upload/pluginUploadCommand.js +31 -2
  71. package/dist/Plugin/pluginCommand.d.ts +49 -2
  72. package/dist/Plugin/pluginCommand.js +31 -0
  73. package/dist/Plugin/pluginFacade.d.ts +1 -1
  74. package/dist/Plugin/pluginFacade.js +29 -19
  75. package/dist/Runner/Generate/runnerGenerateCommand.d.ts +36 -2
  76. package/dist/Runner/Generate/runnerGenerateCommand.js +25 -3
  77. package/dist/Runner/Generate/runnerGenerateFacade.d.ts +7 -5
  78. package/dist/Runner/Generate/runnerGenerateFacade.js +38 -16
  79. package/dist/Runner/Generate/runnerGenerateOptions.d.ts +13 -0
  80. package/dist/Runner/Generate/runnerGenerateOptions.js +20 -0
  81. package/dist/Runner/Upload/runnerUploadCommand.d.ts +28 -0
  82. package/dist/Runner/Upload/runnerUploadCommand.js +31 -2
  83. package/dist/Runner/runnerCommand.d.ts +41 -2
  84. package/dist/Runner/runnerCommand.js +23 -0
  85. package/dist/Runner/runnerFacede.d.ts +1 -1
  86. package/dist/Runner/runnerFacede.js +29 -19
  87. package/dist/Timing/List/timingListCommand.d.ts +1 -1
  88. package/dist/Timing/List/timingListCommand.js +1 -1
  89. package/dist/Timing/timingCommand.d.ts +1 -1
  90. package/dist/Timing/timingCommand.js +1 -1
  91. package/dist/index.js +2 -1
  92. package/docs/applet/build/index.md +1 -1
  93. package/docs/applet/generate/index.md +1 -1
  94. package/docs/applet/index.md +1 -1
  95. package/docs/applet/start/index.md +1 -1
  96. package/docs/applet/test/index.md +1 -1
  97. package/docs/applet/test/run/index.md +1 -1
  98. package/docs/applet/test/upload/index.md +1 -1
  99. package/docs/applet/upload/index.md +1 -1
  100. package/docs/autocomplete/index.md +1 -1
  101. package/docs/autocomplete/install/index.md +1 -1
  102. package/docs/autocomplete/uninstall/index.md +1 -1
  103. package/docs/custom-script/generate/index.md +20 -6
  104. package/docs/custom-script/index.md +9 -7
  105. package/docs/custom-script/upload/index.md +19 -14
  106. package/docs/device/connect/index.md +1 -1
  107. package/docs/device/index.md +1 -1
  108. package/docs/device/power-action/index.md +1 -1
  109. package/docs/device/set-content/index.md +12 -8
  110. package/docs/index.md +20 -4
  111. package/docs/login/index.md +2 -2
  112. package/docs/organization/get/index.md +1 -1
  113. package/docs/organization/index.md +1 -1
  114. package/docs/organization/list/index.md +1 -1
  115. package/docs/organization/set-default/index.md +1 -1
  116. package/docs/plugin/generate/index.md +31 -1
  117. package/docs/plugin/index.md +34 -1
  118. package/docs/plugin/upload/index.md +28 -5
  119. package/docs/runner/generate/index.md +31 -1
  120. package/docs/runner/index.md +26 -1
  121. package/docs/runner/upload/index.md +28 -5
  122. package/docs/timing/index.md +1 -1
  123. package/docs/timing/list/index.md +1 -1
  124. package/package.json +2 -2
@@ -64,7 +64,7 @@ declare const OPTION_LIST: readonly [{
64
64
  * The command sets up a development server and configures the device to load the applet
65
65
  * from the local machine, enabling hot reload and live debugging capabilities.
66
66
  *
67
- * @group Management:1
67
+ * @group Management:11
68
68
  *
69
69
  * @example
70
70
  * ```bash
@@ -53,7 +53,7 @@ const OPTION_LIST = [
53
53
  * The command sets up a development server and configures the device to load the applet
54
54
  * from the local machine, enabling hot reload and live debugging capabilities.
55
55
  *
56
- * @group Management:1
56
+ * @group Management:11
57
57
  *
58
58
  * @example
59
59
  * ```bash
@@ -15,30 +15,36 @@ declare const OPTION_LIST: readonly [{
15
15
  readonly name: "device-uid";
16
16
  readonly type: StringConstructor;
17
17
  readonly description: "Device UID";
18
+ }, {
19
+ readonly name: "yes";
20
+ readonly type: BooleanConstructor;
21
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
18
22
  }];
19
23
  /**
20
24
  * Deploys an applet to a specific device by creating a timing configuration
21
25
  * that activates the specified applet version on the target device. This command
22
26
  * establishes the applet-to-device relationship for production deployment.
23
27
  *
24
- * @group Management:3
28
+ * @group Management:13
25
29
  *
26
30
  * @example
27
31
  * ```bash
28
- * # Deploy applet to device
32
+ * # Deploy applet to device (interactive, allows selection if multiple versions exist)
29
33
  * sos device set-content --device-uid device123 --applet-uid my-applet
30
34
  *
35
+ * # Skip selection prompts (requires explicit UIDs, fails if multiple versions)
36
+ * sos device set-content --device-uid device123 --applet-uid my-applet --yes
37
+ *
31
38
  * # Deploy with organization override
32
39
  * sos device set-content --device-uid device123 --applet-uid my-applet --organization-uid org456
33
40
  * ```
34
41
  *
42
+ * @throws {Error} When device-uid or applet-uid arguments are missing
43
+ * @throws {Error} When multiple applets/versions exist and --yes is used
35
44
  * @throws {Error} When device or applet cannot be found or accessed
36
- *
37
45
  * @throws {Error} When timing configuration creation fails
38
- *
39
46
  * @throws {Error} When organization access is denied
40
- *
41
- * @throws {Error} When applet version cannot be determined
47
+ * @throws {Error} When user cancels interactive prompts (without `--yes`)
42
48
  *
43
49
  * @since 0.9.0
44
50
  */
@@ -61,6 +67,10 @@ export declare const setContent: {
61
67
  readonly name: "device-uid";
62
68
  readonly type: StringConstructor;
63
69
  readonly description: "Device UID";
70
+ }, {
71
+ readonly name: "yes";
72
+ readonly type: BooleanConstructor;
73
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
64
74
  }];
65
75
  commands: never[];
66
76
  run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
@@ -20,30 +20,42 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
20
20
  const helper_1 = require("../../helper");
21
21
  const organizationFacade_1 = require("../../Organization/organizationFacade");
22
22
  const deviceFacade_1 = require("../deviceFacade");
23
- const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION, appletFacade_1.APPLET_UID_OPTION, deviceFacade_1.DEVICE_UID_OPTION];
23
+ const OPTION_LIST = [
24
+ organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
25
+ organizationFacade_1.ORGANIZATION_UID_OPTION,
26
+ appletFacade_1.APPLET_UID_OPTION,
27
+ deviceFacade_1.DEVICE_UID_OPTION,
28
+ {
29
+ name: 'yes',
30
+ type: Boolean,
31
+ description: 'Skip selection prompts (requires explicit device-uid and applet-uid for safety)',
32
+ },
33
+ ];
24
34
  /**
25
35
  * Deploys an applet to a specific device by creating a timing configuration
26
36
  * that activates the specified applet version on the target device. This command
27
37
  * establishes the applet-to-device relationship for production deployment.
28
38
  *
29
- * @group Management:3
39
+ * @group Management:13
30
40
  *
31
41
  * @example
32
42
  * ```bash
33
- * # Deploy applet to device
43
+ * # Deploy applet to device (interactive, allows selection if multiple versions exist)
34
44
  * sos device set-content --device-uid device123 --applet-uid my-applet
35
45
  *
46
+ * # Skip selection prompts (requires explicit UIDs, fails if multiple versions)
47
+ * sos device set-content --device-uid device123 --applet-uid my-applet --yes
48
+ *
36
49
  * # Deploy with organization override
37
50
  * sos device set-content --device-uid device123 --applet-uid my-applet --organization-uid org456
38
51
  * ```
39
52
  *
53
+ * @throws {Error} When device-uid or applet-uid arguments are missing
54
+ * @throws {Error} When multiple applets/versions exist and --yes is used
40
55
  * @throws {Error} When device or applet cannot be found or accessed
41
- *
42
56
  * @throws {Error} When timing configuration creation fails
43
- *
44
57
  * @throws {Error} When organization access is denied
45
- *
46
- * @throws {Error} When applet version cannot be determined
58
+ * @throws {Error} When user cancels interactive prompts (without `--yes`)
47
59
  *
48
60
  * @since 0.9.0
49
61
  */
@@ -57,9 +69,10 @@ exports.setContent = (0, commandDefinition_1.createCommandDefinition)({
57
69
  const organizationUid = yield (0, organizationFacade_1.getOrganizationUidOrDefaultOrSelect)(options);
58
70
  const organization = yield (0, organizationFacade_1.getOrganization)(organizationUid);
59
71
  const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
60
- const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options);
61
- const appletVersion = yield (0, appletFacade_1.getAppletVersionFromApi)(restApi, appletUid);
62
- const deviceUid = yield (0, deviceFacade_1.getDeviceUid)(restApi, options);
72
+ const skipConfirmation = !!options.yes;
73
+ const appletUid = yield (0, appletFacade_1.getAppletUid)(restApi, options, skipConfirmation);
74
+ const appletVersion = yield (0, appletFacade_1.getAppletVersionFromApi)(restApi, appletUid, skipConfirmation);
75
+ const deviceUid = yield (0, deviceFacade_1.getDeviceUid)(restApi, options, skipConfirmation);
63
76
  yield restApi.timing.create({
64
77
  deviceUid: deviceUid,
65
78
  appletUid: appletUid,
@@ -22,7 +22,7 @@ declare const OPTION_LIST: readonly [{
22
22
  * This command provides remote device management capabilities for troubleshooting
23
23
  * and maintenance operations.
24
24
  *
25
- * @group Management:2
25
+ * @group Management:12
26
26
  *
27
27
  * @example
28
28
  * ```bash
@@ -26,7 +26,7 @@ const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organi
26
26
  * This command provides remote device management capabilities for troubleshooting
27
27
  * and maintenance operations.
28
28
  *
29
- * @group Management:2
29
+ * @group Management:12
30
30
  *
31
31
  * @example
32
32
  * ```bash
@@ -2,7 +2,7 @@
2
2
  * Provides commands for managing signageOS devices, including connecting to devices
3
3
  * for development, controlling device power states, and managing applet deployment.
4
4
  *
5
- * @group Management:3
5
+ * @group Management:200
6
6
  *
7
7
  * @example
8
8
  * ```bash
@@ -41,6 +41,10 @@ export declare const device: {
41
41
  readonly name: "device-uid";
42
42
  readonly type: StringConstructor;
43
43
  readonly description: "Device UID";
44
+ }, {
45
+ readonly name: "yes";
46
+ readonly type: BooleanConstructor;
47
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
44
48
  }];
45
49
  commands: never[];
46
50
  run(options: import("../Command/commandDefinition").CommandLineOptions<readonly [{
@@ -59,6 +63,10 @@ export declare const device: {
59
63
  readonly name: "device-uid";
60
64
  readonly type: StringConstructor;
61
65
  readonly description: "Device UID";
66
+ }, {
67
+ readonly name: "yes";
68
+ readonly type: BooleanConstructor;
69
+ readonly description: "Skip selection prompts (requires explicit device-uid and applet-uid for safety)";
62
70
  }]>): Promise<void>;
63
71
  } | {
64
72
  name: "power-action";
@@ -18,7 +18,7 @@ const commandDefinition_1 = require("../Command/commandDefinition");
18
18
  * Provides commands for managing signageOS devices, including connecting to devices
19
19
  * for development, controlling device power states, and managing applet deployment.
20
20
  *
21
- * @group Management:3
21
+ * @group Management:200
22
22
  *
23
23
  * @example
24
24
  * ```bash
@@ -17,6 +17,6 @@ export declare const POWER_ACTION_TYPE_OPTION: {
17
17
  readonly type: StringConstructor;
18
18
  readonly description: "Type of device power action";
19
19
  };
20
- export declare function getDeviceUid(restApi: RestApi, options: CommandLineOptions<[typeof DEVICE_UID_OPTION]>): Promise<string>;
20
+ export declare function getDeviceUid(restApi: RestApi, options: CommandLineOptions<[typeof DEVICE_UID_OPTION]>, skipConfirmation?: boolean): Promise<string>;
21
21
  export declare function getActionType(options: CommandLineOptions<[typeof POWER_ACTION_TYPE_OPTION]>): Promise<string>;
22
22
  export declare function disconnectDevice(organization: IOrganization, deviceUid: string): Promise<any>;
@@ -35,25 +35,30 @@ exports.typeMap = new Map([
35
35
  ]);
36
36
  exports.DEVICE_UID_OPTION = { name: 'device-uid', type: String, description: 'Device UID' };
37
37
  exports.POWER_ACTION_TYPE_OPTION = { name: 'type', type: String, description: `Type of device power action` };
38
- function getDeviceUid(restApi, options) {
39
- return __awaiter(this, void 0, void 0, function* () {
38
+ function getDeviceUid(restApi_1, options_1) {
39
+ return __awaiter(this, arguments, void 0, function* (restApi, options, skipConfirmation = false) {
40
40
  let deviceUid = options['device-uid'];
41
41
  if (!deviceUid) {
42
- const devices = yield restApi.device.list();
43
- const response = yield (0, prompts_1.default)({
44
- type: 'autocomplete',
45
- name: 'deviceUid',
46
- message: `Select device to use`,
47
- choices: devices.map((dev) => {
48
- var _a;
49
- return ({
50
- title: `${(_a = dev.name) !== null && _a !== void 0 ? _a : `Unnamed device, created ${dev.createdAt.toString()}`} (${dev.uid})`,
51
- value: dev.uid,
52
- });
53
- }),
54
- });
55
- Debug('Device selected', response.deviceUid);
56
- deviceUid = response.deviceUid;
42
+ if (skipConfirmation) {
43
+ throw new Error('Device UID is required. Please specify --device-uid argument.');
44
+ }
45
+ else {
46
+ const devices = yield restApi.device.list();
47
+ const response = yield (0, prompts_1.default)({
48
+ type: 'autocomplete',
49
+ name: 'deviceUid',
50
+ message: `Select device to use`,
51
+ choices: devices.map((dev) => {
52
+ var _a;
53
+ return ({
54
+ title: `${(_a = dev.name) !== null && _a !== void 0 ? _a : `Unnamed device, created ${dev.createdAt.toString()}`} (${dev.uid})`,
55
+ value: dev.uid,
56
+ });
57
+ }),
58
+ });
59
+ Debug('Device selected', response.deviceUid);
60
+ deviceUid = response.deviceUid;
61
+ }
57
62
  }
58
63
  if (!deviceUid) {
59
64
  throw new Error('Missing argument --device-uid <string>');
@@ -13,7 +13,7 @@ declare const OPTION_LIST: readonly [{
13
13
  * by its UID. If no organization UID is provided, uses the default organization
14
14
  * or prompts for selection from available organizations.
15
15
  *
16
- * @group Management:2
16
+ * @group Management:22
17
17
  *
18
18
  * @example
19
19
  * ```bash
@@ -24,7 +24,7 @@ const OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organi
24
24
  * by its UID. If no organization UID is provided, uses the default organization
25
25
  * or prompts for selection from available organizations.
26
26
  *
27
- * @group Management:2
27
+ * @group Management:22
28
28
  *
29
29
  * @example
30
30
  * ```bash
@@ -3,7 +3,7 @@
3
3
  * account has access to. This command helps users understand which organizations
4
4
  * they can work with and select appropriate targets for other CLI operations.
5
5
  *
6
- * @group Management:1
6
+ * @group Management:21
7
7
  *
8
8
  * @example
9
9
  * ```bash
@@ -23,7 +23,7 @@ const Debug = (0, debug_1.default)('@signageos/cli:Organization:list');
23
23
  * account has access to. This command helps users understand which organizations
24
24
  * they can work with and select appropriate targets for other CLI operations.
25
25
  *
26
- * @group Management:1
26
+ * @group Management:21
27
27
  *
28
28
  * @example
29
29
  * ```bash
@@ -9,7 +9,7 @@ declare const OPTION_LIST: readonly [{
9
9
  * that require an organization context. This eliminates the need to specify the organization
10
10
  * UID for each command. The default organization is stored in the ~/.sosrc configuration file.
11
11
  *
12
- * @group Management:3
12
+ * @group Management:23
13
13
  *
14
14
  * @example
15
15
  * ```bash
@@ -26,7 +26,7 @@ const OPTION_LIST = [organizationFacade_1.ORGANIZATION_UID_OPTION];
26
26
  * that require an organization context. This eliminates the need to specify the organization
27
27
  * UID for each command. The default organization is stored in the ~/.sosrc configuration file.
28
28
  *
29
- * @group Management:3
29
+ * @group Management:23
30
30
  *
31
31
  * @example
32
32
  * ```bash
@@ -2,7 +2,7 @@
2
2
  * Provides commands to manage signageOS organizations including listing available organizations,
3
3
  * retrieving organization details, and setting default organization for CLI operations.
4
4
  *
5
- * @group Management:6
5
+ * @group Management:201
6
6
  *
7
7
  * @subcommands
8
8
  * - `list` - List all organizations accessible to the current user
@@ -18,7 +18,7 @@ const commandDefinition_1 = require("../Command/commandDefinition");
18
18
  * Provides commands to manage signageOS organizations including listing available organizations,
19
19
  * retrieving organization details, and setting default organization for CLI operations.
20
20
  *
21
- * @group Management:6
21
+ * @group Management:201
22
22
  *
23
23
  * @subcommands
24
24
  * - `list` - List all organizations accessible to the current user
@@ -1,7 +1,41 @@
1
+ import { CommandLineOptions } from '../../Command/commandDefinition';
2
+ import { OPTION_LIST } from './pluginGenerateOptions';
3
+ /**
4
+ * Generates a local repository for developing a Plugin with boilerplate code and configuration files.
5
+ * Sets up complete development environment with necessary dependencies and project structure.
6
+ *
7
+ * Runs interactively by default or non-interactively with `--yes` option.
8
+ * Requires Git to be installed and accessible.
9
+ *
10
+ * @group Development:31
11
+ *
12
+ * @example
13
+ * ```bash
14
+ * # Generate plugin project interactively
15
+ * sos plugin generate
16
+ *
17
+ * # Generate non-interactively (suitable for CI/CD)
18
+ * sos plugin generate --name my-plugin --description "My custom plugin" --yes
19
+ * ```
20
+ *
21
+ * @since 2.6.0
22
+ */
1
23
  export declare const pluginGenerate: {
2
24
  name: "generate";
3
25
  description: string;
4
- optionList: never[];
26
+ optionList: readonly [{
27
+ readonly name: "name";
28
+ readonly type: StringConstructor;
29
+ readonly description: "Plugin name";
30
+ }, {
31
+ readonly name: "description";
32
+ readonly type: StringConstructor;
33
+ readonly description: "Plugin description";
34
+ }, {
35
+ readonly name: "yes";
36
+ readonly type: BooleanConstructor;
37
+ readonly description: "Skip confirmation prompts and use provided values";
38
+ }];
5
39
  commands: never[];
6
- run(): Promise<void>;
40
+ run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
7
41
  };
@@ -19,15 +19,37 @@ const commandDefinition_1 = require("../../Command/commandDefinition");
19
19
  const git_1 = require("../../Lib/git");
20
20
  const customScriptFacade_1 = require("../../CustomScript/customScriptFacade");
21
21
  const pluginGenerateFacade_1 = require("./pluginGenerateFacade");
22
+ const pluginGenerateOptions_1 = require("./pluginGenerateOptions");
23
+ /**
24
+ * Generates a local repository for developing a Plugin with boilerplate code and configuration files.
25
+ * Sets up complete development environment with necessary dependencies and project structure.
26
+ *
27
+ * Runs interactively by default or non-interactively with `--yes` option.
28
+ * Requires Git to be installed and accessible.
29
+ *
30
+ * @group Development:31
31
+ *
32
+ * @example
33
+ * ```bash
34
+ * # Generate plugin project interactively
35
+ * sos plugin generate
36
+ *
37
+ * # Generate non-interactively (suitable for CI/CD)
38
+ * sos plugin generate --name my-plugin --description "My custom plugin" --yes
39
+ * ```
40
+ *
41
+ * @since 2.6.0
42
+ */
22
43
  exports.pluginGenerate = (0, commandDefinition_1.createCommandDefinition)({
23
44
  name: 'generate',
24
45
  description: 'Generates a local repository for developing a Plugin',
25
- optionList: [],
46
+ optionList: pluginGenerateOptions_1.OPTION_LIST,
26
47
  commands: [],
27
- run() {
48
+ run(options) {
28
49
  return __awaiter(this, void 0, void 0, function* () {
29
50
  yield (0, git_1.throwErrorIfGitNotInstalled)();
30
- const { targetDir, name, description } = yield (0, pluginGenerateFacade_1.askForParameters)();
51
+ const skipConfirmation = !!options.yes;
52
+ const { targetDir, name, description } = yield (0, pluginGenerateFacade_1.askForParameters)(options, skipConfirmation);
31
53
  yield (0, pluginGenerateFacade_1.downloadBoilerplateCode)(targetDir);
32
54
  yield (0, customScriptFacade_1.addToConfigFile)(targetDir, { name, description });
33
55
  (0, log_1.log)('info', `Plugin ${chalk_1.default.green(name)} has been generated in ${chalk_1.default.green(targetDir)}.`);
@@ -1,10 +1,12 @@
1
+ import { CommandLineOptions } from '../../Command/commandDefinition';
2
+ import { OPTION_LIST } from './pluginGenerateOptions';
1
3
  /**
2
- * Prompts the user for the parameters needed to generate a plugin.
4
+ * Prompts the user for the parameters needed to generate a custom script.
3
5
  */
4
- export declare function askForParameters(): Promise<{
5
- targetDir: any;
6
- name: any;
7
- description: any;
6
+ export declare function askForParameters(options?: CommandLineOptions<typeof OPTION_LIST>, skipConfirmation?: boolean): Promise<{
7
+ targetDir: string;
8
+ name: string;
9
+ description: string;
8
10
  }>;
9
11
  /**
10
12
  * Downloads the latest version of the boilerplate code from the GitHub repository.
@@ -54,39 +54,61 @@ const fs = __importStar(require("fs-extra"));
54
54
  const log_1 = require("@signageos/sdk/dist/Console/log");
55
55
  const git_1 = require("../../Lib/git");
56
56
  /**
57
- * Prompts the user for the parameters needed to generate a plugin.
57
+ * Prompts the user for the parameters needed to generate a custom script.
58
58
  */
59
- function askForParameters() {
60
- return __awaiter(this, void 0, void 0, function* () {
59
+ function askForParameters(options_1) {
60
+ return __awaiter(this, arguments, void 0, function* (options, skipConfirmation = false) {
61
61
  const throwCanceledError = () => {
62
62
  throw new Error('Plugin generation was canceled.');
63
63
  };
64
- const { name, description } = yield (0, prompts_1.default)([
65
- {
64
+ // Get values from CLI options if provided
65
+ const nameFromOptions = options === null || options === void 0 ? void 0 : options.name;
66
+ const descriptionFromOptions = options === null || options === void 0 ? void 0 : options.description;
67
+ // Determine which prompts are needed
68
+ const promisesToAsk = [];
69
+ if (!nameFromOptions) {
70
+ promisesToAsk.push({
66
71
  type: 'text',
67
72
  name: 'name',
68
73
  message: 'Type name',
69
74
  min: 1,
70
- },
71
- {
75
+ });
76
+ }
77
+ if (!descriptionFromOptions) {
78
+ promisesToAsk.push({
72
79
  type: 'text',
73
80
  name: 'description',
74
81
  message: 'Type description',
75
82
  min: 1,
76
- },
77
- ], { onCancel: throwCanceledError });
83
+ });
84
+ }
85
+ // Only prompt if we need values
86
+ let promptResults = {};
87
+ if (promisesToAsk.length > 0) {
88
+ if (skipConfirmation && (nameFromOptions || descriptionFromOptions)) {
89
+ // If in non-interactive mode but missing required parameters, throw error
90
+ throw new Error('Missing required parameters. In non-interactive mode (--yes), you must provide --name and --description options.');
91
+ }
92
+ promptResults = yield (0, prompts_1.default)(promisesToAsk, { onCancel: throwCanceledError });
93
+ }
94
+ // Use CLI options or prompt results
95
+ const name = nameFromOptions || promptResults.name;
96
+ const description = descriptionFromOptions || promptResults.description;
78
97
  const targetDir = name;
79
98
  (0, log_1.log)('info', `Generating Plugin with these parameters:\n` +
80
99
  ` - Directory: ${chalk_1.default.green(targetDir)}\n` +
81
100
  ` - Name: ${chalk_1.default.green(name)}\n` +
82
101
  ` - Description: ${chalk_1.default.green(description)}\n`);
83
- const { confirm } = yield (0, prompts_1.default)({
84
- type: 'confirm',
85
- name: 'confirm',
86
- message: 'Confirm',
87
- });
88
- if (!confirm) {
89
- throwCanceledError();
102
+ // Skip confirmation if in non-interactive mode
103
+ if (!skipConfirmation) {
104
+ const { confirm } = yield (0, prompts_1.default)({
105
+ type: 'confirm',
106
+ name: 'confirm',
107
+ message: 'Confirm',
108
+ });
109
+ if (!confirm) {
110
+ throwCanceledError();
111
+ }
90
112
  }
91
113
  return {
92
114
  targetDir,
@@ -0,0 +1,13 @@
1
+ export declare const OPTION_LIST: readonly [{
2
+ readonly name: "name";
3
+ readonly type: StringConstructor;
4
+ readonly description: "Plugin name";
5
+ }, {
6
+ readonly name: "description";
7
+ readonly type: StringConstructor;
8
+ readonly description: "Plugin description";
9
+ }, {
10
+ readonly name: "yes";
11
+ readonly type: BooleanConstructor;
12
+ readonly description: "Skip confirmation prompts and use provided values";
13
+ }];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OPTION_LIST = void 0;
4
+ exports.OPTION_LIST = [
5
+ {
6
+ name: 'name',
7
+ type: String,
8
+ description: 'Plugin name',
9
+ },
10
+ {
11
+ name: 'description',
12
+ type: String,
13
+ description: 'Plugin description',
14
+ },
15
+ {
16
+ name: 'yes',
17
+ type: Boolean,
18
+ description: 'Skip confirmation prompts and use provided values',
19
+ },
20
+ ];
@@ -7,7 +7,31 @@ export declare const OPTION_LIST: readonly [{
7
7
  readonly name: "organization-uid";
8
8
  readonly type: StringConstructor;
9
9
  readonly description: "Organization UID";
10
+ }, {
11
+ readonly name: "yes";
12
+ readonly type: BooleanConstructor;
13
+ readonly description: "Skip confirmation prompts for plugin or version creation";
10
14
  }];
15
+ /**
16
+ * Uploads current plugin version to the signageOS platform based on configuration
17
+ * and schema files in the current directory. Handles plugin and version management automatically.
18
+ *
19
+ * May prompt for confirmation when creating new plugins or versions.
20
+ * Use `--yes` to skip confirmation prompts for automated deployments.
21
+ *
22
+ * @group Development:32
23
+ *
24
+ * @example
25
+ * ```bash
26
+ * # Upload plugin from current directory
27
+ * sos plugin upload
28
+ *
29
+ * # Upload with specific organization, skip prompts
30
+ * sos plugin upload --organization-uid abc123def456 --yes
31
+ * ```
32
+ *
33
+ * @since 2.6.0
34
+ */
11
35
  export declare const pluginUpload: {
12
36
  name: "upload";
13
37
  description: string;
@@ -19,6 +43,10 @@ export declare const pluginUpload: {
19
43
  readonly name: "organization-uid";
20
44
  readonly type: StringConstructor;
21
45
  readonly description: "Organization UID";
46
+ }, {
47
+ readonly name: "yes";
48
+ readonly type: BooleanConstructor;
49
+ readonly description: "Skip confirmation prompts for plugin or version creation";
22
50
  }];
23
51
  commands: never[];
24
52
  run(options: CommandLineOptions<typeof OPTION_LIST>): Promise<void>;
@@ -23,7 +23,35 @@ const util_1 = require("util");
23
23
  const helper_1 = require("../../helper");
24
24
  const debug_1 = __importDefault(require("debug"));
25
25
  const Debug = (0, debug_1.default)('@signageos/cli:Plugin:Upload:Command');
26
- exports.OPTION_LIST = [organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION, organizationFacade_1.ORGANIZATION_UID_OPTION];
26
+ exports.OPTION_LIST = [
27
+ organizationFacade_1.NO_DEFAULT_ORGANIZATION_OPTION,
28
+ organizationFacade_1.ORGANIZATION_UID_OPTION,
29
+ {
30
+ name: 'yes',
31
+ type: Boolean,
32
+ description: 'Skip confirmation prompts for plugin or version creation',
33
+ },
34
+ ];
35
+ /**
36
+ * Uploads current plugin version to the signageOS platform based on configuration
37
+ * and schema files in the current directory. Handles plugin and version management automatically.
38
+ *
39
+ * May prompt for confirmation when creating new plugins or versions.
40
+ * Use `--yes` to skip confirmation prompts for automated deployments.
41
+ *
42
+ * @group Development:32
43
+ *
44
+ * @example
45
+ * ```bash
46
+ * # Upload plugin from current directory
47
+ * sos plugin upload
48
+ *
49
+ * # Upload with specific organization, skip prompts
50
+ * sos plugin upload --organization-uid abc123def456 --yes
51
+ * ```
52
+ *
53
+ * @since 2.6.0
54
+ */
27
55
  exports.pluginUpload = (0, commandDefinition_1.createCommandDefinition)({
28
56
  name: 'upload',
29
57
  description: 'Uploads current plugin version',
@@ -37,7 +65,8 @@ exports.pluginUpload = (0, commandDefinition_1.createCommandDefinition)({
37
65
  const restApi = yield (0, helper_1.createOrganizationRestApi)(organization);
38
66
  const config = yield (0, customScriptFacade_1.getConfig)(currentDirectory);
39
67
  const schema = yield (0, pluginFacade_1.loadSchemas)(currentDirectory);
40
- const pluginVersion = yield (0, pluginFacade_1.ensurePluginVersion)(restApi, config, schema);
68
+ const skipConfirmation = !!options.yes;
69
+ const pluginVersion = yield (0, pluginFacade_1.ensurePluginVersion)(restApi, config, schema, skipConfirmation);
41
70
  for (const platform of Object.keys(config.platforms)) {
42
71
  const platformConfig = config.platforms[platform];
43
72
  if (!platformConfig) {