@edgible-team/cli 1.0.1

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/LICENSE +136 -0
  2. package/README.md +450 -0
  3. package/dist/client/api-client.js +1057 -0
  4. package/dist/client/index.js +21 -0
  5. package/dist/commands/agent.js +1280 -0
  6. package/dist/commands/ai.js +608 -0
  7. package/dist/commands/application.js +885 -0
  8. package/dist/commands/auth.js +570 -0
  9. package/dist/commands/base/BaseCommand.js +93 -0
  10. package/dist/commands/base/CommandHandler.js +7 -0
  11. package/dist/commands/base/command-wrapper.js +58 -0
  12. package/dist/commands/base/middleware.js +77 -0
  13. package/dist/commands/config.js +116 -0
  14. package/dist/commands/connectivity.js +59 -0
  15. package/dist/commands/debug.js +98 -0
  16. package/dist/commands/discover.js +144 -0
  17. package/dist/commands/examples/migrated-command-example.js +180 -0
  18. package/dist/commands/gateway.js +494 -0
  19. package/dist/commands/managedGateway.js +787 -0
  20. package/dist/commands/utils/config-validator.js +76 -0
  21. package/dist/commands/utils/gateway-prompt.js +79 -0
  22. package/dist/commands/utils/input-parser.js +120 -0
  23. package/dist/commands/utils/output-formatter.js +109 -0
  24. package/dist/config/app-config.js +99 -0
  25. package/dist/detection/SystemCapabilityDetector.js +1244 -0
  26. package/dist/detection/ToolDetector.js +305 -0
  27. package/dist/detection/WorkloadDetector.js +314 -0
  28. package/dist/di/bindings.js +99 -0
  29. package/dist/di/container.js +88 -0
  30. package/dist/di/types.js +32 -0
  31. package/dist/index.js +52 -0
  32. package/dist/interfaces/IDaemonManager.js +3 -0
  33. package/dist/repositories/config-repository.js +62 -0
  34. package/dist/repositories/gateway-repository.js +35 -0
  35. package/dist/scripts/postinstall.js +101 -0
  36. package/dist/services/AgentStatusManager.js +299 -0
  37. package/dist/services/ConnectivityTester.js +271 -0
  38. package/dist/services/DependencyInstaller.js +475 -0
  39. package/dist/services/LocalAgentManager.js +2216 -0
  40. package/dist/services/application/ApplicationService.js +299 -0
  41. package/dist/services/auth/AuthService.js +214 -0
  42. package/dist/services/aws.js +644 -0
  43. package/dist/services/daemon/DaemonManagerFactory.js +65 -0
  44. package/dist/services/daemon/DockerDaemonManager.js +395 -0
  45. package/dist/services/daemon/LaunchdDaemonManager.js +257 -0
  46. package/dist/services/daemon/PodmanDaemonManager.js +369 -0
  47. package/dist/services/daemon/SystemdDaemonManager.js +221 -0
  48. package/dist/services/daemon/WindowsServiceDaemonManager.js +210 -0
  49. package/dist/services/daemon/index.js +16 -0
  50. package/dist/services/edgible.js +3060 -0
  51. package/dist/services/gateway/GatewayService.js +334 -0
  52. package/dist/state/config.js +146 -0
  53. package/dist/types/AgentConfig.js +5 -0
  54. package/dist/types/AgentStatus.js +5 -0
  55. package/dist/types/ApiClient.js +5 -0
  56. package/dist/types/ApiRequests.js +5 -0
  57. package/dist/types/ApiResponses.js +5 -0
  58. package/dist/types/Application.js +5 -0
  59. package/dist/types/CaddyJson.js +5 -0
  60. package/dist/types/UnifiedAgentStatus.js +56 -0
  61. package/dist/types/WireGuard.js +5 -0
  62. package/dist/types/Workload.js +5 -0
  63. package/dist/types/agent.js +5 -0
  64. package/dist/types/command-options.js +5 -0
  65. package/dist/types/connectivity.js +5 -0
  66. package/dist/types/errors.js +250 -0
  67. package/dist/types/gateway-types.js +5 -0
  68. package/dist/types/index.js +48 -0
  69. package/dist/types/models/ApplicationData.js +5 -0
  70. package/dist/types/models/CertificateData.js +5 -0
  71. package/dist/types/models/DeviceData.js +5 -0
  72. package/dist/types/models/DevicePoolData.js +5 -0
  73. package/dist/types/models/OrganizationData.js +5 -0
  74. package/dist/types/models/OrganizationInviteData.js +5 -0
  75. package/dist/types/models/ProviderConfiguration.js +5 -0
  76. package/dist/types/models/ResourceData.js +5 -0
  77. package/dist/types/models/ServiceResourceData.js +5 -0
  78. package/dist/types/models/UserData.js +5 -0
  79. package/dist/types/route.js +5 -0
  80. package/dist/types/validation/schemas.js +218 -0
  81. package/dist/types/validation.js +5 -0
  82. package/dist/utils/FileIntegrityManager.js +256 -0
  83. package/dist/utils/PathMigration.js +219 -0
  84. package/dist/utils/PathResolver.js +235 -0
  85. package/dist/utils/PlatformDetector.js +277 -0
  86. package/dist/utils/console-logger.js +130 -0
  87. package/dist/utils/docker-compose-parser.js +179 -0
  88. package/dist/utils/errors.js +130 -0
  89. package/dist/utils/health-checker.js +155 -0
  90. package/dist/utils/json-logger.js +72 -0
  91. package/dist/utils/log-formatter.js +293 -0
  92. package/dist/utils/logger.js +59 -0
  93. package/dist/utils/network-utils.js +217 -0
  94. package/dist/utils/output.js +182 -0
  95. package/dist/utils/passwordValidation.js +91 -0
  96. package/dist/utils/progress.js +167 -0
  97. package/dist/utils/sudo-checker.js +22 -0
  98. package/dist/utils/urls.js +32 -0
  99. package/dist/utils/validation.js +31 -0
  100. package/dist/validation/schemas.js +175 -0
  101. package/dist/validation/validator.js +67 -0
  102. package/package.json +83 -0
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Validation utilities for commands
4
+ * Wraps Zod schemas with CLI-friendly error handling
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.validateOptions = validateOptions;
8
+ exports.validateValue = validateValue;
9
+ exports.validateAndTransform = validateAndTransform;
10
+ exports.createValidationMiddleware = createValidationMiddleware;
11
+ const zod_1 = require("zod");
12
+ const errors_1 = require("../utils/errors");
13
+ const schemas_1 = require("./schemas");
14
+ /**
15
+ * Validate command options against schema
16
+ */
17
+ function validateOptions(schema, options) {
18
+ try {
19
+ return schema.parse(options);
20
+ }
21
+ catch (error) {
22
+ if (error instanceof zod_1.ZodError) {
23
+ const message = (0, schemas_1.formatValidationError)(error);
24
+ throw new errors_1.ValidationError(`Invalid options: ${message}`);
25
+ }
26
+ throw error;
27
+ }
28
+ }
29
+ /**
30
+ * Validate a single value against schema
31
+ */
32
+ function validateValue(schema, value, fieldName) {
33
+ try {
34
+ return schema.parse(value);
35
+ }
36
+ catch (error) {
37
+ if (error instanceof zod_1.ZodError) {
38
+ const message = (0, schemas_1.formatValidationError)(error);
39
+ throw new errors_1.ValidationError(`Invalid ${fieldName}: ${message}`);
40
+ }
41
+ throw error;
42
+ }
43
+ }
44
+ /**
45
+ * Validate and transform command input
46
+ */
47
+ function validateAndTransform(input, schema) {
48
+ try {
49
+ return schema.parse(input);
50
+ }
51
+ catch (error) {
52
+ if (error instanceof zod_1.ZodError) {
53
+ const message = (0, schemas_1.formatValidationError)(error);
54
+ throw new errors_1.ValidationError(`Validation failed: ${message}`);
55
+ }
56
+ throw error;
57
+ }
58
+ }
59
+ /**
60
+ * Create a validation middleware for commands
61
+ */
62
+ function createValidationMiddleware(schema) {
63
+ return (options) => {
64
+ return validateOptions(schema, options);
65
+ };
66
+ }
67
+ //# sourceMappingURL=validator.js.map
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@edgible-team/cli",
3
+ "version": "1.0.01",
4
+ "description": "CLI tool for Edgible service",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "edgible": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist/**/*.js",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "prebuild": "node scripts/copy-shared-deps.js",
16
+ "linux-build": "npm run prebuild && tsc && chmod +x dist/index.js",
17
+ "build": "tsc",
18
+ "postbuild": "node scripts/restore-symlinks.js && node scripts/copy-postinstall.js",
19
+ "build:prod": "NODE_ENV=production npm run prebuild && npm run build",
20
+ "restore-symlinks": "node scripts/restore-symlinks.js",
21
+ "dev": "ts-node src/index.ts",
22
+ "start": "node dist/index.js",
23
+ "test": "jest",
24
+ "test:watch": "jest --watch",
25
+ "test:coverage": "jest --coverage",
26
+ "test:ci": "jest --ci --coverage --watchAll=false",
27
+ "prepublishOnly": "npm run prebuild && npm run build",
28
+ "postinstall": "node dist/scripts/postinstall.js || true",
29
+ "clean": "rm -rf dist node_modules",
30
+ "version:patch": "npm version patch && npm publish --access public",
31
+ "version:minor": "npm version minor && npm publish --access public",
32
+ "version:major": "npm version major && npm publish --access public",
33
+ "publish:patch": "npm run version:patch",
34
+ "publish:minor": "npm run version:minor",
35
+ "publish:major": "npm run version:major"
36
+ },
37
+ "keywords": [
38
+ "cli",
39
+ "edgible",
40
+ "typescript",
41
+ "wireguard",
42
+ "vpn",
43
+ "networking",
44
+ "gateway",
45
+ "edge",
46
+ "private-network"
47
+ ],
48
+ "author": "Edgible Team",
49
+ "license": "PolyForm-Noncommercial-1.0.0",
50
+ "homepage": "https://edgible.com",
51
+ "dependencies": {
52
+ "@aws-sdk/client-ec2": "^3.901.0",
53
+ "@aws-sdk/client-s3": "^3.901.0",
54
+ "@aws-sdk/client-ssm": "^3.901.0",
55
+ "@aws-sdk/credential-provider-node": "^3.901.0",
56
+ "axios": "^1.12.2",
57
+ "chalk": "^4.1.2",
58
+ "commander": "^11.1.0",
59
+ "find-process": "^2.0.0",
60
+ "inquirer": "^9.2.12",
61
+ "js-yaml": "^4.1.0",
62
+ "node-fetch": "^3.3.2",
63
+ "ssh2": "^1.15.0",
64
+ "zod": "^3.25.76"
65
+ },
66
+ "devDependencies": {
67
+ "@types/inquirer": "^9.0.7",
68
+ "@types/js-yaml": "^4.0.9",
69
+ "@types/jest": "^29.5.0",
70
+ "@types/node": "^20.10.0",
71
+ "@types/ssh2": "^1.11.0",
72
+ "@types/supertest": "^2.0.0",
73
+ "jest": "^29.5.0",
74
+ "jest-esm-transformer": "^1.0.0",
75
+ "supertest": "^6.3.0",
76
+ "ts-jest": "^29.1.0",
77
+ "ts-node": "^10.9.0",
78
+ "typescript": "^5.9.3"
79
+ },
80
+ "engines": {
81
+ "node": ">=16.0.0"
82
+ }
83
+ }