@edgible-team/cli 1.0.1 → 1.0.2

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 (228) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +114 -1
  3. package/dist/client/api-client.d.ts +575 -0
  4. package/dist/client/api-client.d.ts.map +1 -0
  5. package/dist/client/api-client.js +196 -2
  6. package/dist/client/index.d.ts +10 -0
  7. package/dist/client/index.d.ts.map +1 -0
  8. package/dist/commands/agent.d.ts +3 -0
  9. package/dist/commands/agent.d.ts.map +1 -0
  10. package/dist/commands/agent.js +18 -34
  11. package/dist/commands/ai.d.ts +3 -0
  12. package/dist/commands/ai.d.ts.map +1 -0
  13. package/dist/commands/ai.js +1660 -274
  14. package/dist/commands/application.d.ts +6 -0
  15. package/dist/commands/application.d.ts.map +1 -0
  16. package/dist/commands/application.js +377 -0
  17. package/dist/commands/auth.d.ts +3 -0
  18. package/dist/commands/auth.d.ts.map +1 -0
  19. package/dist/commands/base/BaseCommand.d.ts +53 -0
  20. package/dist/commands/base/BaseCommand.d.ts.map +1 -0
  21. package/dist/commands/base/CommandHandler.d.ts +28 -0
  22. package/dist/commands/base/CommandHandler.d.ts.map +1 -0
  23. package/dist/commands/base/command-wrapper.d.ts +21 -0
  24. package/dist/commands/base/command-wrapper.d.ts.map +1 -0
  25. package/dist/commands/base/middleware.d.ts +34 -0
  26. package/dist/commands/base/middleware.d.ts.map +1 -0
  27. package/dist/commands/config.d.ts +3 -0
  28. package/dist/commands/config.d.ts.map +1 -0
  29. package/dist/commands/connectivity.d.ts +3 -0
  30. package/dist/commands/connectivity.d.ts.map +1 -0
  31. package/dist/commands/debug.d.ts +3 -0
  32. package/dist/commands/debug.d.ts.map +1 -0
  33. package/dist/commands/debug.js +336 -0
  34. package/dist/commands/discover.d.ts +3 -0
  35. package/dist/commands/discover.d.ts.map +1 -0
  36. package/dist/commands/examples/migrated-command-example.d.ts +31 -0
  37. package/dist/commands/examples/migrated-command-example.d.ts.map +1 -0
  38. package/dist/commands/gateway.d.ts +6 -0
  39. package/dist/commands/gateway.d.ts.map +1 -0
  40. package/dist/commands/managedGateway.d.ts +6 -0
  41. package/dist/commands/managedGateway.d.ts.map +1 -0
  42. package/dist/commands/managedGateway.js +132 -0
  43. package/dist/commands/utils/config-validator.d.ts +29 -0
  44. package/dist/commands/utils/config-validator.d.ts.map +1 -0
  45. package/dist/commands/utils/gateway-prompt.d.ts +23 -0
  46. package/dist/commands/utils/gateway-prompt.d.ts.map +1 -0
  47. package/dist/commands/utils/input-parser.d.ts +34 -0
  48. package/dist/commands/utils/input-parser.d.ts.map +1 -0
  49. package/dist/commands/utils/output-formatter.d.ts +62 -0
  50. package/dist/commands/utils/output-formatter.d.ts.map +1 -0
  51. package/dist/config/app-config.d.ts +44 -0
  52. package/dist/config/app-config.d.ts.map +1 -0
  53. package/dist/detection/SystemCapabilityDetector.d.ts +139 -0
  54. package/dist/detection/SystemCapabilityDetector.d.ts.map +1 -0
  55. package/dist/detection/ToolDetector.d.ts +16 -0
  56. package/dist/detection/ToolDetector.d.ts.map +1 -0
  57. package/dist/detection/WorkloadDetector.d.ts +62 -0
  58. package/dist/detection/WorkloadDetector.d.ts.map +1 -0
  59. package/dist/di/bindings.d.ts +15 -0
  60. package/dist/di/bindings.d.ts.map +1 -0
  61. package/dist/di/container.d.ts +44 -0
  62. package/dist/di/container.d.ts.map +1 -0
  63. package/dist/di/types.d.ts +23 -0
  64. package/dist/di/types.d.ts.map +1 -0
  65. package/dist/index.d.ts +3 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +8 -1
  68. package/dist/interfaces/IDaemonManager.d.ts +67 -0
  69. package/dist/interfaces/IDaemonManager.d.ts.map +1 -0
  70. package/dist/repositories/config-repository.d.ts +46 -0
  71. package/dist/repositories/config-repository.d.ts.map +1 -0
  72. package/dist/repositories/gateway-repository.d.ts +37 -0
  73. package/dist/repositories/gateway-repository.d.ts.map +1 -0
  74. package/dist/services/AgentStatusManager.d.ts +30 -0
  75. package/dist/services/AgentStatusManager.d.ts.map +1 -0
  76. package/dist/services/ConnectivityTester.d.ts +30 -0
  77. package/dist/services/ConnectivityTester.d.ts.map +1 -0
  78. package/dist/services/DependencyInstaller.d.ts +32 -0
  79. package/dist/services/DependencyInstaller.d.ts.map +1 -0
  80. package/dist/services/LocalAgentManager.d.ts +220 -0
  81. package/dist/services/LocalAgentManager.d.ts.map +1 -0
  82. package/dist/services/LocalAgentManager.js +2 -2
  83. package/dist/services/application/ApplicationService.d.ts +54 -0
  84. package/dist/services/application/ApplicationService.d.ts.map +1 -0
  85. package/dist/services/application/ApplicationService.js +10 -3
  86. package/dist/services/auth/AuthService.d.ts +42 -0
  87. package/dist/services/auth/AuthService.d.ts.map +1 -0
  88. package/dist/services/aws.d.ts +136 -0
  89. package/dist/services/aws.d.ts.map +1 -0
  90. package/dist/services/aws.js +2 -2
  91. package/dist/services/daemon/DaemonManagerFactory.d.ts +17 -0
  92. package/dist/services/daemon/DaemonManagerFactory.d.ts.map +1 -0
  93. package/dist/services/daemon/DockerDaemonManager.d.ts +26 -0
  94. package/dist/services/daemon/DockerDaemonManager.d.ts.map +1 -0
  95. package/dist/services/daemon/LaunchdDaemonManager.d.ts +20 -0
  96. package/dist/services/daemon/LaunchdDaemonManager.d.ts.map +1 -0
  97. package/dist/services/daemon/LaunchdDaemonManager.js +6 -0
  98. package/dist/services/daemon/PodmanDaemonManager.d.ts +24 -0
  99. package/dist/services/daemon/PodmanDaemonManager.d.ts.map +1 -0
  100. package/dist/services/daemon/SystemdDaemonManager.d.ts +20 -0
  101. package/dist/services/daemon/SystemdDaemonManager.d.ts.map +1 -0
  102. package/dist/services/daemon/WindowsServiceDaemonManager.d.ts +19 -0
  103. package/dist/services/daemon/WindowsServiceDaemonManager.d.ts.map +1 -0
  104. package/dist/services/daemon/index.d.ts +7 -0
  105. package/dist/services/daemon/index.d.ts.map +1 -0
  106. package/dist/services/edgible.d.ts +304 -0
  107. package/dist/services/edgible.d.ts.map +1 -0
  108. package/dist/services/edgible.js +53 -4
  109. package/dist/services/gateway/GatewayService.d.ts +88 -0
  110. package/dist/services/gateway/GatewayService.d.ts.map +1 -0
  111. package/dist/state/config.d.ts +96 -0
  112. package/dist/state/config.d.ts.map +1 -0
  113. package/dist/types/AgentConfig.d.ts +126 -0
  114. package/dist/types/AgentConfig.d.ts.map +1 -0
  115. package/dist/types/AgentStatus.d.ts +30 -0
  116. package/dist/types/AgentStatus.d.ts.map +1 -0
  117. package/dist/types/ApiClient.d.ts +36 -0
  118. package/dist/types/ApiClient.d.ts.map +1 -0
  119. package/dist/types/ApiRequests.d.ts +269 -0
  120. package/dist/types/ApiRequests.d.ts.map +1 -0
  121. package/dist/types/ApiResponses.d.ts +348 -0
  122. package/dist/types/ApiResponses.d.ts.map +1 -0
  123. package/dist/types/Application.d.ts +13 -0
  124. package/dist/types/Application.d.ts.map +1 -0
  125. package/dist/types/CaddyJson.d.ts +231 -0
  126. package/dist/types/CaddyJson.d.ts.map +1 -0
  127. package/dist/types/DeviceMetrics.d.ts +95 -0
  128. package/dist/types/DeviceMetrics.d.ts.map +1 -0
  129. package/dist/types/DeviceMetrics.js +5 -0
  130. package/dist/types/LogAggregation.d.ts +106 -0
  131. package/dist/types/LogAggregation.d.ts.map +1 -0
  132. package/dist/types/LogAggregation.js +5 -0
  133. package/dist/types/LogEntry.d.ts +60 -0
  134. package/dist/types/LogEntry.d.ts.map +1 -0
  135. package/dist/types/LogEntry.js +5 -0
  136. package/dist/types/UnifiedAgentStatus.d.ts +28 -0
  137. package/dist/types/UnifiedAgentStatus.d.ts.map +1 -0
  138. package/dist/types/WireGuard.d.ts +36 -0
  139. package/dist/types/WireGuard.d.ts.map +1 -0
  140. package/dist/types/Workload.d.ts +9 -0
  141. package/dist/types/Workload.d.ts.map +1 -0
  142. package/dist/types/agent.d.ts +120 -0
  143. package/dist/types/agent.d.ts.map +1 -0
  144. package/dist/types/command-options.d.ts +115 -0
  145. package/dist/types/command-options.d.ts.map +1 -0
  146. package/dist/types/connectivity.d.ts +80 -0
  147. package/dist/types/connectivity.d.ts.map +1 -0
  148. package/dist/types/errors.d.ts +97 -0
  149. package/dist/types/errors.d.ts.map +1 -0
  150. package/dist/types/gateway-types.d.ts +46 -0
  151. package/dist/types/gateway-types.d.ts.map +1 -0
  152. package/dist/types/index.d.ts +28 -0
  153. package/dist/types/index.d.ts.map +1 -0
  154. package/dist/types/models/ApplicationData.d.ts +78 -0
  155. package/dist/types/models/ApplicationData.d.ts.map +1 -0
  156. package/dist/types/models/CertificateData.d.ts +44 -0
  157. package/dist/types/models/CertificateData.d.ts.map +1 -0
  158. package/dist/types/models/DeviceData.d.ts +29 -0
  159. package/dist/types/models/DeviceData.d.ts.map +1 -0
  160. package/dist/types/models/DevicePoolData.d.ts +47 -0
  161. package/dist/types/models/DevicePoolData.d.ts.map +1 -0
  162. package/dist/types/models/LifecycleEvent.d.ts +27 -0
  163. package/dist/types/models/LifecycleEvent.d.ts.map +1 -0
  164. package/dist/types/models/LifecycleEvent.js +5 -0
  165. package/dist/types/models/OrganizationData.d.ts +53 -0
  166. package/dist/types/models/OrganizationData.d.ts.map +1 -0
  167. package/dist/types/models/OrganizationInviteData.d.ts +39 -0
  168. package/dist/types/models/OrganizationInviteData.d.ts.map +1 -0
  169. package/dist/types/models/ProviderConfiguration.d.ts +37 -0
  170. package/dist/types/models/ProviderConfiguration.d.ts.map +1 -0
  171. package/dist/types/models/ResourceData.d.ts +18 -0
  172. package/dist/types/models/ResourceData.d.ts.map +1 -0
  173. package/dist/types/models/ServiceResourceData.d.ts +5 -0
  174. package/dist/types/models/ServiceResourceData.d.ts.map +1 -0
  175. package/dist/types/models/UserData.d.ts +12 -0
  176. package/dist/types/models/UserData.d.ts.map +1 -0
  177. package/dist/types/route.d.ts +67 -0
  178. package/dist/types/route.d.ts.map +1 -0
  179. package/dist/types/validation/schemas.d.ts +606 -0
  180. package/dist/types/validation/schemas.d.ts.map +1 -0
  181. package/dist/types/validation/schemas.js +46 -4
  182. package/dist/types/validation.d.ts +68 -0
  183. package/dist/types/validation.d.ts.map +1 -0
  184. package/dist/utils/FileIntegrityManager.d.ts +37 -0
  185. package/dist/utils/FileIntegrityManager.d.ts.map +1 -0
  186. package/dist/utils/PathMigration.d.ts +45 -0
  187. package/dist/utils/PathMigration.d.ts.map +1 -0
  188. package/dist/utils/PathResolver.d.ts +76 -0
  189. package/dist/utils/PathResolver.d.ts.map +1 -0
  190. package/dist/utils/PlatformDetector.d.ts +60 -0
  191. package/dist/utils/PlatformDetector.d.ts.map +1 -0
  192. package/dist/utils/console-logger.d.ts +37 -0
  193. package/dist/utils/console-logger.d.ts.map +1 -0
  194. package/dist/utils/docker-compose-parser.d.ts +28 -0
  195. package/dist/utils/docker-compose-parser.d.ts.map +1 -0
  196. package/dist/utils/errors.d.ts +63 -0
  197. package/dist/utils/errors.d.ts.map +1 -0
  198. package/dist/utils/health-checker.d.ts +34 -0
  199. package/dist/utils/health-checker.d.ts.map +1 -0
  200. package/dist/utils/json-logger.d.ts +23 -0
  201. package/dist/utils/json-logger.d.ts.map +1 -0
  202. package/dist/utils/log-formatter.d.ts +85 -0
  203. package/dist/utils/log-formatter.d.ts.map +1 -0
  204. package/dist/utils/log-formatter.js +39 -11
  205. package/dist/utils/logger.d.ts +34 -0
  206. package/dist/utils/logger.d.ts.map +1 -0
  207. package/dist/utils/network-utils.d.ts +56 -0
  208. package/dist/utils/network-utils.d.ts.map +1 -0
  209. package/dist/utils/output.d.ts +73 -0
  210. package/dist/utils/output.d.ts.map +1 -0
  211. package/dist/utils/passwordValidation.d.ts +32 -0
  212. package/dist/utils/passwordValidation.d.ts.map +1 -0
  213. package/dist/utils/progress.d.ts +74 -0
  214. package/dist/utils/progress.d.ts.map +1 -0
  215. package/dist/utils/sudo-checker.d.ts +9 -0
  216. package/dist/utils/sudo-checker.d.ts.map +1 -0
  217. package/dist/utils/urls.d.ts +19 -0
  218. package/dist/utils/urls.d.ts.map +1 -0
  219. package/dist/utils/urls.js +3 -3
  220. package/dist/utils/validation.d.ts +19 -0
  221. package/dist/utils/validation.d.ts.map +1 -0
  222. package/dist/validation/schemas.d.ts +197 -0
  223. package/dist/validation/schemas.d.ts.map +1 -0
  224. package/dist/validation/schemas.js +1 -1
  225. package/dist/validation/validator.d.ts +22 -0
  226. package/dist/validation/validator.d.ts.map +1 -0
  227. package/package.json +8 -3
  228. package/recipes/compose/open-webui/docker-compose.yml +17 -0
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Application command group
4
+ */
5
+ export declare function setupApplicationCommands(program: Command): void;
6
+ //# sourceMappingURL=application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/commands/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+1C/D"}
@@ -717,6 +717,382 @@ Examples:
717
717
  requireAuth: true,
718
718
  requireOrganization: true,
719
719
  }));
720
+ // Managed Process subcommand
721
+ const createManagedProcessCommand = new commander_1.Command('managed-process')
722
+ .description('Create application from a managed process (agent runs the command)')
723
+ .addHelpText('after', `
724
+ Examples:
725
+ $ edgible application create managed-process --name myapp --command "node server.js" --port 3000
726
+ $ edgible application create managed-process --name myapp --command "python app.py" --port 8080 --working-dir /opt/myapp
727
+ $ edgible application create managed-process --no-interactive --name myapp --command "npm start" --port 3000
728
+ `)
729
+ .option('-n, --name <name>', 'Application name')
730
+ .option('-d, --description <description>', 'Application description')
731
+ .option('-c, --command <command>', 'Command to execute')
732
+ .option('-p, --port <port>', 'Port number the process will listen on')
733
+ .option('--working-dir <dir>', 'Working directory for the process')
734
+ .option('--env <vars>', 'Environment variables (format: KEY=VALUE,KEY2=VALUE2)')
735
+ .option('--log-file <path>', 'Path to log file for stdout/stderr')
736
+ .option('--protocol <protocol>', 'Protocol (http, https, tcp, udp)', 'http')
737
+ .option('--device-id <id>', 'Serving device ID')
738
+ .option('--gateway-ids <ids>', 'Comma-separated gateway device IDs')
739
+ .option('--hostnames <hostnames>', 'Comma-separated additional hostnames')
740
+ .option('--no-interactive', 'Run in non-interactive mode')
741
+ .action((0, command_wrapper_1.wrapCommand)(async (options) => {
742
+ const container = (0, container_1.getContainer)();
743
+ const logger = container.get(types_1.TYPES.Logger);
744
+ const configRepository = container.get(types_1.TYPES.ConfigRepository);
745
+ const applicationService = container.get(types_1.TYPES.ApplicationService);
746
+ const gatewayService = container.get(types_1.TYPES.GatewayService);
747
+ const edgibleService = container.get(types_1.TYPES.EdgibleService);
748
+ (0, config_validator_1.validateConfig)(configRepository, {
749
+ requireAuth: true,
750
+ requireOrganization: true,
751
+ });
752
+ // Application name
753
+ let appName = options.name;
754
+ if (!appName && !options.noInteractive) {
755
+ const { name } = await inquirer_1.default.prompt([
756
+ {
757
+ type: 'input',
758
+ name: 'name',
759
+ message: 'Enter application name:',
760
+ validate: (i) => !!i.trim() || 'Application name is required',
761
+ },
762
+ ]);
763
+ appName = name.trim();
764
+ }
765
+ if (!appName) {
766
+ throw new Error('Application name is required');
767
+ }
768
+ // Command
769
+ let command = options.command;
770
+ if (!command && !options.noInteractive) {
771
+ const { cmd } = await inquirer_1.default.prompt([
772
+ {
773
+ type: 'input',
774
+ name: 'cmd',
775
+ message: 'Enter command to run:',
776
+ validate: (i) => !!i.trim() || 'Command is required',
777
+ },
778
+ ]);
779
+ command = cmd.trim();
780
+ }
781
+ if (!command) {
782
+ throw new Error('Command is required');
783
+ }
784
+ // Port
785
+ let port = options.port ? (0, input_parser_1.parsePort)(options.port) : undefined;
786
+ if (!port && !options.noInteractive) {
787
+ const { portInput } = await inquirer_1.default.prompt([
788
+ {
789
+ type: 'input',
790
+ name: 'portInput',
791
+ message: 'Enter port number the process will listen on:',
792
+ default: '3000',
793
+ validate: (i) => {
794
+ const p = parseInt(i, 10);
795
+ return (p > 0 && p <= 65535) || 'Port must be between 1 and 65535';
796
+ },
797
+ },
798
+ ]);
799
+ port = (0, input_parser_1.parsePort)(portInput);
800
+ }
801
+ if (!port) {
802
+ throw new Error('Port is required');
803
+ }
804
+ // Working directory
805
+ let workingDirectory = options.workingDir;
806
+ if (!workingDirectory && !options.noInteractive) {
807
+ const { dir } = await inquirer_1.default.prompt([
808
+ {
809
+ type: 'input',
810
+ name: 'dir',
811
+ message: 'Enter working directory (leave empty for current directory):',
812
+ default: process.cwd(),
813
+ },
814
+ ]);
815
+ workingDirectory = dir.trim();
816
+ }
817
+ // Environment variables
818
+ let env = {};
819
+ if (options.env) {
820
+ // Parse format: KEY=VALUE,KEY2=VALUE2
821
+ const pairs = options.env.split(',');
822
+ for (const pair of pairs) {
823
+ const [key, value] = pair.split('=');
824
+ if (key && value) {
825
+ env[key.trim()] = value.trim();
826
+ }
827
+ }
828
+ }
829
+ else if (!options.noInteractive) {
830
+ const { addEnv } = await inquirer_1.default.prompt([
831
+ {
832
+ type: 'confirm',
833
+ name: 'addEnv',
834
+ message: 'Add environment variables?',
835
+ default: false,
836
+ },
837
+ ]);
838
+ if (addEnv) {
839
+ let continueAdding = true;
840
+ while (continueAdding) {
841
+ const { key, value } = await inquirer_1.default.prompt([
842
+ {
843
+ type: 'input',
844
+ name: 'key',
845
+ message: 'Environment variable name:',
846
+ },
847
+ {
848
+ type: 'input',
849
+ name: 'value',
850
+ message: 'Environment variable value:',
851
+ },
852
+ ]);
853
+ if (key && value) {
854
+ env[key.trim()] = value.trim();
855
+ }
856
+ const { more } = await inquirer_1.default.prompt([
857
+ {
858
+ type: 'confirm',
859
+ name: 'more',
860
+ message: 'Add another environment variable?',
861
+ default: false,
862
+ },
863
+ ]);
864
+ continueAdding = more;
865
+ }
866
+ }
867
+ }
868
+ // Log file
869
+ let logFile = options.logFile;
870
+ if (!logFile && !options.noInteractive) {
871
+ const { addLog } = await inquirer_1.default.prompt([
872
+ {
873
+ type: 'confirm',
874
+ name: 'addLog',
875
+ message: 'Capture logs to file?',
876
+ default: false,
877
+ },
878
+ ]);
879
+ if (addLog) {
880
+ const { path: logPath } = await inquirer_1.default.prompt([
881
+ {
882
+ type: 'input',
883
+ name: 'path',
884
+ message: 'Log file path:',
885
+ default: `/var/log/${appName}.log`,
886
+ },
887
+ ]);
888
+ logFile = logPath.trim();
889
+ }
890
+ }
891
+ // Description
892
+ const description = options.description || `Managed process application for ${appName}`;
893
+ // Protocol
894
+ const protocol = (0, input_parser_1.parseProtocol)(options.protocol);
895
+ // Device IDs and Gateway IDs
896
+ let deviceId = options.deviceId;
897
+ let gatewayIds = (0, input_parser_1.parseGatewayIds)(options.gatewayIds);
898
+ let hostnames = Array.isArray(options.hostnames)
899
+ ? options.hostnames
900
+ : (typeof options.hostnames === 'string' && options.hostnames.trim().length > 0
901
+ ? options.hostnames.split(',').map(s => s.trim()).filter(Boolean)
902
+ : []);
903
+ let useManagedGateway = false;
904
+ if (!options.noInteractive) {
905
+ // Optional: prompt for additional hostnames
906
+ const { addHostnames } = await inquirer_1.default.prompt([
907
+ {
908
+ type: 'input',
909
+ name: 'addHostnames',
910
+ message: 'Additional hostnames (comma-separated, optional):',
911
+ when: () => hostnames.length === 0,
912
+ },
913
+ ]);
914
+ if (addHostnames && typeof addHostnames === 'string') {
915
+ hostnames = addHostnames.split(',').map((s) => s.trim()).filter((s) => s.length > 0);
916
+ }
917
+ // Prompt for managed gateway option
918
+ if (gatewayIds.length === 0) {
919
+ const { useManaged } = await inquirer_1.default.prompt([
920
+ {
921
+ type: 'confirm',
922
+ name: 'useManaged',
923
+ message: 'Use Edgible managed gateway?',
924
+ default: false,
925
+ },
926
+ ]);
927
+ useManagedGateway = useManaged;
928
+ if (!useManagedGateway) {
929
+ // Try to offer a list of gateways (via service), else fallback to manual input
930
+ try {
931
+ const gatewaysResp = await gatewayService.listGateways();
932
+ const gatewayChoices = gatewaysResp.gateways.map((g) => ({
933
+ name: `${g.device.name} (${g.device.id})`,
934
+ value: g.device.id,
935
+ }));
936
+ if (gatewayChoices.length > 0) {
937
+ const { selectedGateways } = await inquirer_1.default.prompt([
938
+ {
939
+ type: 'checkbox',
940
+ name: 'selectedGateways',
941
+ message: 'Select gateway device(s):',
942
+ choices: gatewayChoices,
943
+ validate: (vals) => vals.length > 0 ? true : 'Select at least one gateway',
944
+ },
945
+ ]);
946
+ gatewayIds = selectedGateways;
947
+ }
948
+ }
949
+ catch (error) {
950
+ logger.warn('Failed to list gateways', error);
951
+ }
952
+ if (gatewayIds.length === 0) {
953
+ const ans2 = await inquirer_1.default.prompt([
954
+ {
955
+ type: 'input',
956
+ name: 'gatewayIds',
957
+ message: 'Enter comma-separated gateway device IDs:',
958
+ validate: (v) => v && v.split(',').map((s) => s.trim()).filter(Boolean).length > 0
959
+ ? true
960
+ : 'At least one gateway ID is required',
961
+ },
962
+ ]);
963
+ gatewayIds = (0, input_parser_1.parseGatewayIds)(ans2.gatewayIds);
964
+ }
965
+ }
966
+ }
967
+ // Serving device selection
968
+ if (!deviceId) {
969
+ try {
970
+ const servingDevicesResp = await edgibleService.listServingDevices();
971
+ const servingDeviceChoices = Array.isArray(servingDevicesResp?.devices)
972
+ ? servingDevicesResp.devices.map((d) => ({
973
+ name: `${d.name || d.id}${d.description ? ` - ${d.description}` : ''}`,
974
+ value: d.id,
975
+ }))
976
+ : [];
977
+ if (servingDeviceChoices.length > 0) {
978
+ const { selectedDeviceId } = await inquirer_1.default.prompt([
979
+ {
980
+ type: 'list',
981
+ name: 'selectedDeviceId',
982
+ message: 'Select serving device:',
983
+ choices: servingDeviceChoices,
984
+ },
985
+ ]);
986
+ deviceId = selectedDeviceId;
987
+ }
988
+ else {
989
+ // Fallback to manual input if no serving devices found
990
+ const ans = await inquirer_1.default.prompt([
991
+ {
992
+ type: 'input',
993
+ name: 'deviceId',
994
+ message: 'Enter serving device ID:',
995
+ validate: (v) => v && v.trim().length > 0 ? true : 'Serving device ID is required',
996
+ },
997
+ ]);
998
+ deviceId = String(ans.deviceId).trim();
999
+ }
1000
+ }
1001
+ catch (error) {
1002
+ logger.warn('Failed to list serving devices', error);
1003
+ // Fallback to manual input if listing fails
1004
+ const ans = await inquirer_1.default.prompt([
1005
+ {
1006
+ type: 'input',
1007
+ name: 'deviceId',
1008
+ message: 'Enter serving device ID:',
1009
+ validate: (v) => v && v.trim().length > 0 ? true : 'Serving device ID is required',
1010
+ },
1011
+ ]);
1012
+ deviceId = String(ans.deviceId).trim();
1013
+ }
1014
+ }
1015
+ }
1016
+ if (!deviceId) {
1017
+ throw new Error('--device-id (serving) is required');
1018
+ }
1019
+ if (!useManagedGateway && gatewayIds.length === 0) {
1020
+ throw new Error('--gateway-ids is required (at least one) or use --use-managed-gateway');
1021
+ }
1022
+ // Build configuration
1023
+ const configuration = {
1024
+ command,
1025
+ };
1026
+ if (workingDirectory) {
1027
+ configuration.workingDirectory = workingDirectory;
1028
+ }
1029
+ if (Object.keys(env).length > 0) {
1030
+ configuration.env = env;
1031
+ }
1032
+ if (logFile) {
1033
+ configuration.logFile = logFile;
1034
+ }
1035
+ // Create application
1036
+ logger.info('Creating managed process application', {
1037
+ name: appName,
1038
+ port,
1039
+ protocol,
1040
+ command,
1041
+ deviceId,
1042
+ gatewayIds,
1043
+ subtype: 'managed-process',
1044
+ });
1045
+ console.log(chalk_1.default.blue(`\nCreating managed process application: ${appName}`));
1046
+ console.log(chalk_1.default.gray(`Command: ${command}`));
1047
+ console.log(chalk_1.default.gray(`Port: ${port}`));
1048
+ console.log(chalk_1.default.gray(`Protocol: ${protocol.toUpperCase()}`));
1049
+ if (workingDirectory) {
1050
+ console.log(chalk_1.default.gray(`Working directory: ${workingDirectory}`));
1051
+ }
1052
+ if (Object.keys(env).length > 0) {
1053
+ console.log(chalk_1.default.gray(`Environment variables: ${Object.keys(env).length} variable(s)`));
1054
+ }
1055
+ if (logFile) {
1056
+ console.log(chalk_1.default.gray(`Log file: ${logFile}`));
1057
+ }
1058
+ console.log(chalk_1.default.gray(`Serving device: ${deviceId}`));
1059
+ if (useManagedGateway) {
1060
+ console.log(chalk_1.default.gray(`Using Edgible managed gateway`));
1061
+ }
1062
+ else {
1063
+ console.log(chalk_1.default.gray(`Gateways: ${gatewayIds.join(', ')}`));
1064
+ }
1065
+ if (hostnames.length > 0) {
1066
+ console.log(chalk_1.default.gray(`Additional hostnames: ${hostnames.join(', ')}`));
1067
+ }
1068
+ const result = await applicationService.createApplicationProgrammatically({
1069
+ name: appName,
1070
+ description,
1071
+ port,
1072
+ protocol,
1073
+ hostnames,
1074
+ deviceIds: [deviceId],
1075
+ gatewayIds: useManagedGateway ? undefined : gatewayIds,
1076
+ useManagedGateway,
1077
+ subtype: 'managed-process',
1078
+ configuration,
1079
+ });
1080
+ console.log(chalk_1.default.green('\n✓ Managed process application created successfully!'));
1081
+ console.log(chalk_1.default.blue('\n📋 Application Details:'));
1082
+ if (result && typeof result === 'object' && 'name' in result) {
1083
+ const app = result;
1084
+ console.log(chalk_1.default.white(` Name: ${app.name}`));
1085
+ console.log(chalk_1.default.white(` ID: ${app.id}`));
1086
+ if (app.url)
1087
+ console.log(chalk_1.default.white(` URL: ${chalk_1.default.cyan.bold(app.url)}`));
1088
+ console.log(chalk_1.default.white(` Status: ${app.status}`));
1089
+ }
1090
+ console.log(chalk_1.default.yellow('\n⚠ Note: The agent will start the process when it receives the configuration.'));
1091
+ }, {
1092
+ configRepository: (0, container_1.getContainer)().get(types_1.TYPES.ConfigRepository),
1093
+ requireAuth: true,
1094
+ requireOrganization: true,
1095
+ }));
720
1096
  // Stub subcommands for unimplemented workload types
721
1097
  const createDockerCommand = new commander_1.Command('docker')
722
1098
  .description('Create application from Docker container (not implemented)')
@@ -748,6 +1124,7 @@ Examples:
748
1124
  // Add all subcommands to create command
749
1125
  createCommand.addCommand(createExistingCommand);
750
1126
  createCommand.addCommand(createDockerComposeCommand);
1127
+ createCommand.addCommand(createManagedProcessCommand);
751
1128
  createCommand.addCommand(createDockerCommand);
752
1129
  createCommand.addCommand(createQemuCommand);
753
1130
  createCommand.addCommand(createPodmanCommand);
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function setupAuthCommands(program: Command): void;
3
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyNxD"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Base command class
3
+ * Provides consistent command execution with middleware support
4
+ */
5
+ import { CommandHandler, CommandContext, CommandMiddleware } from './CommandHandler';
6
+ import { Logger } from '../../utils/logger';
7
+ import { ConfigRepository } from '../../repositories/config-repository';
8
+ export interface BaseCommandOptions {
9
+ logger: Logger;
10
+ configRepository: ConfigRepository;
11
+ requireAuth?: boolean;
12
+ requireOrganization?: boolean;
13
+ }
14
+ /**
15
+ * Base command implementation with error handling and middleware
16
+ */
17
+ export declare class BaseCommand implements CommandHandler {
18
+ protected logger: Logger;
19
+ protected configRepository: ConfigRepository;
20
+ protected requireAuth: boolean;
21
+ protected requireOrganization: boolean;
22
+ private middlewares;
23
+ constructor(options: BaseCommandOptions);
24
+ /**
25
+ * Add middleware to the command
26
+ */
27
+ use(middleware: CommandMiddleware): void;
28
+ /**
29
+ * Execute the command with middleware chain
30
+ */
31
+ execute(context: CommandContext): Promise<void>;
32
+ /**
33
+ * Run middleware chain
34
+ */
35
+ private runMiddleware;
36
+ /**
37
+ * Override this method in subclasses to implement command logic
38
+ */
39
+ protected doExecute(context: CommandContext): Promise<void>;
40
+ /**
41
+ * Check if user is authenticated
42
+ */
43
+ protected ensureAuthenticated(): void;
44
+ /**
45
+ * Check if organization ID is available
46
+ */
47
+ protected ensureOrganization(): void;
48
+ /**
49
+ * Validate and ensure authentication and organization
50
+ */
51
+ protected validateContext(): void;
52
+ }
53
+ //# sourceMappingURL=BaseCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/base/BaseCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,qBAAa,WAAY,YAAW,cAAc;IAChD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACvC,OAAO,CAAC,WAAW,CAA2B;gBAElC,OAAO,EAAE,kBAAkB;IAOvC;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAIxC;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrD;;OAEG;YACW,aAAa;IAW3B;;OAEG;cACa,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAcrC;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAWpC;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,IAAI;CAIlC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Command handler interface
3
+ * Defines the contract for command execution
4
+ */
5
+ import { Command } from 'commander';
6
+ export interface CommandContext {
7
+ command: Command;
8
+ args: Record<string, unknown>;
9
+ options: Record<string, unknown>;
10
+ }
11
+ export interface CommandHandler {
12
+ /**
13
+ * Execute the command
14
+ * @param context - Command context with args and options
15
+ * @returns Promise that resolves when command completes
16
+ */
17
+ execute(context: CommandContext): Promise<void>;
18
+ }
19
+ export interface CommandMiddleware {
20
+ /**
21
+ * Process the command before or after execution
22
+ * @param context - Command context
23
+ * @param next - Next middleware or handler
24
+ * @returns Promise that resolves when processing completes
25
+ */
26
+ process(context: CommandContext, next: () => Promise<void>): Promise<void>;
27
+ }
28
+ //# sourceMappingURL=CommandHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandHandler.d.ts","sourceRoot":"","sources":["../../../src/commands/base/CommandHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Command wrapper utilities
3
+ * Provides helpers for wrapping commands with standardized error handling
4
+ */
5
+ import { Logger } from '../../utils/logger';
6
+ import { ConfigRepository } from '../../repositories/config-repository';
7
+ export interface CommandWrapperOptions {
8
+ logger?: Logger;
9
+ configRepository?: ConfigRepository;
10
+ requireAuth?: boolean;
11
+ requireOrganization?: boolean;
12
+ }
13
+ /**
14
+ * Wrap a command action with standardized error handling and validation
15
+ */
16
+ export declare function wrapCommand(action: (options: Record<string, unknown>) => Promise<void>, wrapperOptions?: CommandWrapperOptions): (options: Record<string, unknown>) => Promise<void>;
17
+ /**
18
+ * Create a command handler that automatically handles errors
19
+ */
20
+ export declare function createCommandHandler(action: (options: Record<string, unknown>) => Promise<void>, options?: CommandWrapperOptions): (options: Record<string, unknown>) => void;
21
+ //# sourceMappingURL=command-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-wrapper.d.ts","sourceRoot":"","sources":["../../../src/commands/base/command-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAC3D,cAAc,GAAE,qBAA0B,GACzC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAgCrD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAC3D,OAAO,GAAE,qBAA0B,GAClC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAW5C"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Built-in command middleware
3
+ */
4
+ import { CommandContext, CommandMiddleware } from './CommandHandler';
5
+ import { Logger } from '../../utils/logger';
6
+ import { ConfigRepository } from '../../repositories/config-repository';
7
+ /**
8
+ * Logging middleware - logs command execution
9
+ */
10
+ export declare class LoggingMiddleware implements CommandMiddleware {
11
+ private logger;
12
+ constructor(logger: Logger);
13
+ process(context: CommandContext, next: () => Promise<void>): Promise<void>;
14
+ }
15
+ /**
16
+ * Validation middleware - validates command context
17
+ */
18
+ export declare class ValidationMiddleware implements CommandMiddleware {
19
+ private configRepository;
20
+ private requireAuth;
21
+ private requireOrganization;
22
+ constructor(configRepository: ConfigRepository, requireAuth?: boolean, requireOrganization?: boolean);
23
+ process(context: CommandContext, next: () => Promise<void>): Promise<void>;
24
+ }
25
+ /**
26
+ * Performance monitoring middleware
27
+ */
28
+ export declare class PerformanceMiddleware implements CommandMiddleware {
29
+ private logger;
30
+ private threshold;
31
+ constructor(logger: Logger, thresholdMs?: number);
32
+ process(context: CommandContext, next: () => Promise<void>): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/commands/base/middleware.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE;;GAEG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IAC7C,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAejF;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IAE1D,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,mBAAmB;gBAFnB,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,GAAE,OAAe,EAC5B,mBAAmB,GAAE,OAAe;IAGxC,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBjF;AAED;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAGjD,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAS;gBAEN,MAAM,EAAE,MAAM,EAAE,WAAW,GAAE,MAAa;IAIxD,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CASjF"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function setupConfigCommands(program: Command): void;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqH1D"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function setupConnectivityCommands(program: Command): void;
3
+ //# sourceMappingURL=connectivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectivity.d.ts","sourceRoot":"","sources":["../../src/commands/connectivity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgEhE"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function setupDebugCommands(program: Command): void;
3
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+bzD"}