@dokploy/cli 0.2.8 → 0.3.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.
- package/LICENSE.md +1 -1
- package/dist/client.d.ts +10 -0
- package/dist/client.js +72 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +28 -0
- package/dist/generated/commands.d.ts +2 -0
- package/dist/generated/commands.js +9059 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -1
- package/package.json +25 -58
- package/readme.md +101 -83
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -6
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -5
- package/dist/commands/app/create.d.ts +0 -17
- package/dist/commands/app/create.js +0 -127
- package/dist/commands/app/delete.d.ts +0 -11
- package/dist/commands/app/delete.js +0 -106
- package/dist/commands/app/deploy.d.ts +0 -11
- package/dist/commands/app/deploy.js +0 -107
- package/dist/commands/app/stop.d.ts +0 -11
- package/dist/commands/app/stop.js +0 -102
- package/dist/commands/authenticate.d.ts +0 -10
- package/dist/commands/authenticate.js +0 -83
- package/dist/commands/database/mariadb/create.d.ts +0 -18
- package/dist/commands/database/mariadb/create.js +0 -188
- package/dist/commands/database/mariadb/delete.d.ts +0 -11
- package/dist/commands/database/mariadb/delete.js +0 -104
- package/dist/commands/database/mariadb/deploy.d.ts +0 -11
- package/dist/commands/database/mariadb/deploy.js +0 -103
- package/dist/commands/database/mariadb/stop.d.ts +0 -11
- package/dist/commands/database/mariadb/stop.js +0 -103
- package/dist/commands/database/mongo/create.d.ts +0 -17
- package/dist/commands/database/mongo/create.js +0 -176
- package/dist/commands/database/mongo/delete.d.ts +0 -11
- package/dist/commands/database/mongo/delete.js +0 -106
- package/dist/commands/database/mongo/deploy.d.ts +0 -11
- package/dist/commands/database/mongo/deploy.js +0 -103
- package/dist/commands/database/mongo/stop.d.ts +0 -11
- package/dist/commands/database/mongo/stop.js +0 -103
- package/dist/commands/database/mysql/create.d.ts +0 -18
- package/dist/commands/database/mysql/create.js +0 -188
- package/dist/commands/database/mysql/delete.d.ts +0 -11
- package/dist/commands/database/mysql/delete.js +0 -106
- package/dist/commands/database/mysql/deploy.d.ts +0 -6
- package/dist/commands/database/mysql/deploy.js +0 -86
- package/dist/commands/database/mysql/stop.d.ts +0 -6
- package/dist/commands/database/mysql/stop.js +0 -86
- package/dist/commands/database/postgres/create.d.ts +0 -17
- package/dist/commands/database/postgres/create.js +0 -176
- package/dist/commands/database/postgres/delete.d.ts +0 -11
- package/dist/commands/database/postgres/delete.js +0 -106
- package/dist/commands/database/postgres/deploy.d.ts +0 -11
- package/dist/commands/database/postgres/deploy.js +0 -103
- package/dist/commands/database/postgres/stop.d.ts +0 -11
- package/dist/commands/database/postgres/stop.js +0 -103
- package/dist/commands/database/redis/create.d.ts +0 -15
- package/dist/commands/database/redis/create.js +0 -151
- package/dist/commands/database/redis/delete.d.ts +0 -11
- package/dist/commands/database/redis/delete.js +0 -106
- package/dist/commands/database/redis/deploy.d.ts +0 -11
- package/dist/commands/database/redis/deploy.js +0 -103
- package/dist/commands/database/redis/stop.d.ts +0 -11
- package/dist/commands/database/redis/stop.js +0 -103
- package/dist/commands/env/pull.d.ts +0 -10
- package/dist/commands/env/pull.js +0 -68
- package/dist/commands/env/push.d.ts +0 -10
- package/dist/commands/env/push.js +0 -106
- package/dist/commands/project/create.d.ts +0 -11
- package/dist/commands/project/create.js +0 -89
- package/dist/commands/project/info.d.ts +0 -10
- package/dist/commands/project/info.js +0 -122
- package/dist/commands/project/list.d.ts +0 -6
- package/dist/commands/project/list.js +0 -43
- package/dist/commands/verify.d.ts +0 -6
- package/dist/commands/verify.js +0 -62
- package/dist/utils/http.d.ts +0 -4
- package/dist/utils/http.js +0 -4
- package/dist/utils/shared.d.ts +0 -10
- package/dist/utils/shared.js +0 -55
- package/dist/utils/slug.d.ts +0 -1
- package/dist/utils/slug.js +0 -12
- package/dist/utils/slugify.d.ts +0 -3
- package/dist/utils/slugify.js +0 -2
- package/dist/utils/utils.d.ts +0 -6
- package/dist/utils/utils.js +0 -26
- package/oclif.manifest.json +0 -1680
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { program } from "commander";
|
|
4
|
+
import { registerAuthCommand } from "./commands/auth.js";
|
|
5
|
+
import { registerGeneratedCommands } from "./generated/commands.js";
|
|
6
|
+
const pkg = {
|
|
7
|
+
name: "dokploy",
|
|
8
|
+
version: "0.3.0",
|
|
9
|
+
description: "Dokploy CLI - Manage your Dokploy server",
|
|
10
|
+
};
|
|
11
|
+
program
|
|
12
|
+
.name(pkg.name)
|
|
13
|
+
.version(pkg.version)
|
|
14
|
+
.description(pkg.description)
|
|
15
|
+
.action(() => {
|
|
16
|
+
program.help();
|
|
17
|
+
});
|
|
18
|
+
registerAuthCommand(program);
|
|
19
|
+
registerGeneratedCommands(program);
|
|
20
|
+
const argv = process.argv.filter((arg) => arg !== "--");
|
|
21
|
+
program.parseAsync(argv).catch((err) => {
|
|
22
|
+
console.error(chalk.red(err.message));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
package/package.json
CHANGED
|
@@ -1,88 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dokploy/cli",
|
|
3
3
|
"description": "A CLI to manage dokploy server remotely",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"author": "Mauricio Siu",
|
|
6
|
-
"licenses": [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"licenses": [
|
|
7
|
+
{
|
|
8
|
+
"type": "MIT",
|
|
9
|
+
"url": "https://github.com/Dokploy/cli/blob/master/LICENSE"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
10
12
|
"publishConfig": {
|
|
11
13
|
"access": "public"
|
|
12
14
|
},
|
|
13
15
|
"bin": {
|
|
14
|
-
"dokploy": "./
|
|
16
|
+
"dokploy": "./dist/index.js"
|
|
15
17
|
},
|
|
16
18
|
"bugs": "https://github.com/Dokploy/cli/issues",
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@oclif/core": "^3",
|
|
19
|
-
"@oclif/plugin-help": "^6",
|
|
20
|
-
"@oclif/plugin-plugins": "^5",
|
|
21
20
|
"axios": "^1.7.2",
|
|
22
21
|
"chalk": "^5.3.0",
|
|
23
|
-
"
|
|
24
|
-
"inquirer": "^9.2.23",
|
|
25
|
-
"slugify": "^1.6.6",
|
|
26
|
-
"superjson": "^2.2.1"
|
|
22
|
+
"commander": "^13.1.0"
|
|
27
23
|
},
|
|
28
24
|
"devDependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@oclif/test": "^4",
|
|
31
|
-
"@types/chai": "^4",
|
|
32
|
-
"@types/inquirer": "9.0.7",
|
|
33
|
-
"@types/mocha": "^10",
|
|
25
|
+
"@biomejs/biome": "2.1.1",
|
|
34
26
|
"@types/node": "^18",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"eslint-config-oclif-typescript": "^3",
|
|
39
|
-
"eslint-config-prettier": "^9",
|
|
40
|
-
"mocha": "^10",
|
|
41
|
-
"oclif": "^4",
|
|
42
|
-
"shx": "^0.3.3",
|
|
43
|
-
"ts-node": "^10",
|
|
44
|
-
"typescript": "^5"
|
|
27
|
+
"tsx": "^4.21.0",
|
|
28
|
+
"typescript": "^5",
|
|
29
|
+
"vitest": "^4.1.4"
|
|
45
30
|
},
|
|
46
31
|
"engines": {
|
|
47
32
|
"node": ">=18.0.0"
|
|
48
33
|
},
|
|
49
34
|
"files": [
|
|
50
|
-
"/
|
|
51
|
-
"/dist",
|
|
52
|
-
"/oclif.manifest.json"
|
|
35
|
+
"/dist"
|
|
53
36
|
],
|
|
54
37
|
"homepage": "https://github.com/Dokploy/cli",
|
|
55
38
|
"keywords": [
|
|
56
|
-
"
|
|
39
|
+
"dokploy",
|
|
40
|
+
"cli"
|
|
57
41
|
],
|
|
58
42
|
"license": "MIT",
|
|
59
43
|
"main": "dist/index.js",
|
|
60
44
|
"type": "module",
|
|
61
|
-
"oclif": {
|
|
62
|
-
"bin": "dokploy",
|
|
63
|
-
"dirname": "dokploy",
|
|
64
|
-
"commands": "./dist/commands",
|
|
65
|
-
"plugins": [
|
|
66
|
-
"@oclif/plugin-help",
|
|
67
|
-
"@oclif/plugin-plugins"
|
|
68
|
-
],
|
|
69
|
-
"topicSeparator": " ",
|
|
70
|
-
"topics": {
|
|
71
|
-
"hello": {
|
|
72
|
-
"description": "Say hello to the world and others"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
45
|
"repository": "Dokploy/cli",
|
|
46
|
+
"types": "dist/index.d.ts",
|
|
77
47
|
"scripts": {
|
|
78
|
-
"build": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"test": "
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
"types": "dist/index.d.ts"
|
|
88
|
-
}
|
|
48
|
+
"build": "tsc -b",
|
|
49
|
+
"generate": "tsx scripts/generate.ts",
|
|
50
|
+
"prebuild": "pnpm run generate",
|
|
51
|
+
"dev": "tsx src/index.ts",
|
|
52
|
+
"lint": "biome check --write .",
|
|
53
|
+
"test": "vitest run"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,118 +1,136 @@
|
|
|
1
1
|
# Dokploy CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Dokploy CLI is a powerful and versatile command-line tool designed to remotely manage your Dokploy server. It simplifies the process of creating, deploying, and managing applications and databases.
|
|
6
|
-
|
|
7
|
-
<!-- [](https://oclif.io)
|
|
8
|
-
[](https://npmjs.org/package/dokploy)
|
|
9
|
-
[](https://npmjs.org/package/dokploy)
|
|
10
|
-
[](https://github.com/yourusername/dokploy/blob/master/package.json) -->
|
|
11
|
-
|
|
12
|
-
## Table of Contents
|
|
13
|
-
|
|
14
|
-
- [Installation](#installation)
|
|
15
|
-
- [Usage](#usage)
|
|
16
|
-
- [Commands](#commands)
|
|
17
|
-
- [Authentication](#authentication)
|
|
18
|
-
- [Project Management](#project-management)
|
|
19
|
-
- [Application Management](#application-management)
|
|
20
|
-
- [Environment Management](#environment-management)
|
|
21
|
-
- [Database Management](#database-management)
|
|
22
|
-
- [Contributing](#contributing)
|
|
23
|
-
- [Support](#support)
|
|
24
|
-
- [License](#license)
|
|
3
|
+
Dokploy CLI is a command-line tool to manage your Dokploy server remotely. It provides **449 commands** auto-generated from the Dokploy OpenAPI spec, covering every API endpoint.
|
|
25
4
|
|
|
26
5
|
## Installation
|
|
27
6
|
|
|
28
|
-
```
|
|
29
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @dokploy/cli
|
|
30
9
|
```
|
|
31
10
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
```sh-session
|
|
35
|
-
$ dokploy COMMAND
|
|
36
|
-
running command...
|
|
11
|
+
## Authentication
|
|
37
12
|
|
|
38
|
-
|
|
39
|
-
dokploy/0.0.0 darwin-arm64 node-v18.18.0
|
|
13
|
+
### Option 1: Using the `auth` command
|
|
40
14
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
$ dokploy COMMAND
|
|
44
|
-
...
|
|
15
|
+
```bash
|
|
16
|
+
dokploy auth -u https://panel.dokploy.com -t YOUR_API_KEY
|
|
45
17
|
```
|
|
46
18
|
|
|
47
|
-
|
|
19
|
+
### Option 2: Environment variables
|
|
48
20
|
|
|
49
|
-
|
|
21
|
+
```bash
|
|
22
|
+
export DOKPLOY_URL="https://panel.dokploy.com"
|
|
23
|
+
export DOKPLOY_API_KEY="YOUR_API_KEY"
|
|
24
|
+
```
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
- `dokploy verify`: Verify current authentication.
|
|
26
|
+
### Option 3: `.env` file
|
|
53
27
|
|
|
54
|
-
|
|
28
|
+
Create a `.env` file in your working directory:
|
|
55
29
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
30
|
+
```env
|
|
31
|
+
DOKPLOY_URL="https://panel.dokploy.com"
|
|
32
|
+
DOKPLOY_API_KEY="YOUR_API_KEY"
|
|
33
|
+
```
|
|
59
34
|
|
|
60
|
-
|
|
35
|
+
The CLI loads it automatically. Shell environment variables take priority over the `.env` file.
|
|
61
36
|
|
|
62
|
-
|
|
63
|
-
- `dokploy app:delete`: Delete an existing application.
|
|
64
|
-
- `dokploy app:deploy`: Deploy an application.
|
|
65
|
-
- `dokploy app:stop`: Stop a running application.
|
|
37
|
+
## Usage
|
|
66
38
|
|
|
67
|
-
|
|
39
|
+
```bash
|
|
40
|
+
dokploy <group> <action> [options]
|
|
41
|
+
```
|
|
68
42
|
|
|
69
|
-
|
|
70
|
-
- `dokploy env push <file>`: Push environment variables to Dokploy from a <file>.
|
|
43
|
+
### Examples
|
|
71
44
|
|
|
72
|
-
|
|
45
|
+
```bash
|
|
46
|
+
# List all projects
|
|
47
|
+
dokploy project all
|
|
73
48
|
|
|
74
|
-
|
|
49
|
+
# Get a specific project
|
|
50
|
+
dokploy project one --projectId abc123
|
|
75
51
|
|
|
76
|
-
|
|
52
|
+
# Create an application
|
|
53
|
+
dokploy application create --name "my-app" --environmentId env123
|
|
77
54
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
- `dokploy database:mariadb:deploy`
|
|
81
|
-
- `dokploy database:mariadb:stop`
|
|
55
|
+
# Deploy an application
|
|
56
|
+
dokploy application deploy --applicationId app123
|
|
82
57
|
|
|
83
|
-
|
|
58
|
+
# Create a postgres database
|
|
59
|
+
dokploy postgres create --name "my-db" --environmentId env123
|
|
84
60
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `dokploy database:mongo:deploy`
|
|
88
|
-
- `dokploy database:mongo:stop`
|
|
61
|
+
# Stop a database
|
|
62
|
+
dokploy postgres stop --postgresId pg123
|
|
89
63
|
|
|
90
|
-
|
|
64
|
+
# Get raw JSON output
|
|
65
|
+
dokploy project all --json
|
|
66
|
+
```
|
|
91
67
|
|
|
92
|
-
|
|
93
|
-
- `dokploy database:mysql:delete`
|
|
94
|
-
- `dokploy database:mysql:deploy`
|
|
95
|
-
- `dokploy database:mysql:stop`
|
|
68
|
+
### Getting help
|
|
96
69
|
|
|
97
|
-
|
|
70
|
+
```bash
|
|
71
|
+
# List all groups
|
|
72
|
+
dokploy --help
|
|
98
73
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- `dokploy database:postgres:deploy`
|
|
102
|
-
- `dokploy database:postgres:stop`
|
|
74
|
+
# List actions in a group
|
|
75
|
+
dokploy application --help
|
|
103
76
|
|
|
104
|
-
|
|
77
|
+
# See options for a specific action
|
|
78
|
+
dokploy application deploy --help
|
|
79
|
+
```
|
|
105
80
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
81
|
+
## Available command groups
|
|
82
|
+
|
|
83
|
+
| Group | Commands | Group | Commands |
|
|
84
|
+
|---|---|---|---|
|
|
85
|
+
| `admin` | 1 | `notification` | 38 |
|
|
86
|
+
| `ai` | 9 | `organization` | 10 |
|
|
87
|
+
| `application` | 29 | `patch` | 12 |
|
|
88
|
+
| `backup` | 11 | `port` | 4 |
|
|
89
|
+
| `bitbucket` | 7 | `postgres` | 14 |
|
|
90
|
+
| `certificates` | 4 | `preview-deployment` | 4 |
|
|
91
|
+
| `cluster` | 4 | `project` | 8 |
|
|
92
|
+
| `compose` | 28 | `redirects` | 4 |
|
|
93
|
+
| `deployment` | 8 | `redis` | 14 |
|
|
94
|
+
| `destination` | 6 | `registry` | 7 |
|
|
95
|
+
| `docker` | 7 | `rollback` | 2 |
|
|
96
|
+
| `domain` | 9 | `schedule` | 6 |
|
|
97
|
+
| `environment` | 7 | `security` | 4 |
|
|
98
|
+
| `gitea` | 8 | `server` | 16 |
|
|
99
|
+
| `github` | 6 | `settings` | 49 |
|
|
100
|
+
| `gitlab` | 7 | `ssh-key` | 6 |
|
|
101
|
+
| `git-provider` | 2 | `sso` | 10 |
|
|
102
|
+
| `license-key` | 6 | `stripe` | 7 |
|
|
103
|
+
| `mariadb` | 14 | `swarm` | 3 |
|
|
104
|
+
| `mongo` | 14 | `user` | 18 |
|
|
105
|
+
| `mounts` | 6 | `volume-backups` | 6 |
|
|
106
|
+
| `mysql` | 14 | | |
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Install dependencies
|
|
112
|
+
pnpm install
|
|
113
|
+
|
|
114
|
+
# Run in dev mode
|
|
115
|
+
pnpm run dev -- project all
|
|
116
|
+
|
|
117
|
+
# Regenerate commands from OpenAPI spec
|
|
118
|
+
pnpm run generate
|
|
119
|
+
|
|
120
|
+
# Build
|
|
121
|
+
pnpm run build
|
|
122
|
+
|
|
123
|
+
# Lint & format
|
|
124
|
+
pnpm run lint
|
|
125
|
+
```
|
|
110
126
|
|
|
111
|
-
|
|
127
|
+
### Updating commands
|
|
112
128
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
129
|
+
Commands are auto-generated from `openapi.json`. To update:
|
|
130
|
+
|
|
131
|
+
1. Replace `openapi.json` with the latest spec from the [Dokploy repo](https://github.com/Dokploy/dokploy)
|
|
132
|
+
2. Run `pnpm run generate`
|
|
133
|
+
3. Build with `pnpm run build`
|
|
116
134
|
|
|
117
135
|
## Contributing
|
|
118
136
|
|
|
@@ -120,7 +138,7 @@ If you want to contribute to Dokploy CLI, please check out our [Contributing Gui
|
|
|
120
138
|
|
|
121
139
|
## Support
|
|
122
140
|
|
|
123
|
-
If you encounter any issues or have any questions, please [open an issue](https://github.com/
|
|
141
|
+
If you encounter any issues or have any questions, please [open an issue](https://github.com/Dokploy/cli/issues) in our GitHub repository.
|
|
124
142
|
|
|
125
143
|
## License
|
|
126
144
|
|
package/bin/dev.cmd
DELETED
package/bin/dev.js
DELETED
package/bin/run.cmd
DELETED
package/bin/run.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
import { type Project } from "../../utils/shared.js";
|
|
3
|
-
export interface Answers {
|
|
4
|
-
project: Project;
|
|
5
|
-
}
|
|
6
|
-
export default class AppCreate extends Command {
|
|
7
|
-
static description: string;
|
|
8
|
-
static examples: string[];
|
|
9
|
-
static flags: {
|
|
10
|
-
projectId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
-
name: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
-
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
-
appName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
-
skipConfirm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
|
-
};
|
|
16
|
-
run(): Promise<void>;
|
|
17
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Command, Flags } from "@oclif/core";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import inquirer from "inquirer";
|
|
5
|
-
import { getProjects } from "../../utils/shared.js";
|
|
6
|
-
import { slugify } from "../../utils/slug.js";
|
|
7
|
-
import { readAuthConfig } from "../../utils/utils.js";
|
|
8
|
-
export default class AppCreate extends Command {
|
|
9
|
-
static description = "Create a new application within a project.";
|
|
10
|
-
static examples = ["$ <%= config.bin %> app create"];
|
|
11
|
-
static flags = {
|
|
12
|
-
projectId: Flags.string({
|
|
13
|
-
char: "p",
|
|
14
|
-
description: "ID of the project",
|
|
15
|
-
required: false,
|
|
16
|
-
}),
|
|
17
|
-
name: Flags.string({
|
|
18
|
-
char: "n",
|
|
19
|
-
description: "Application name",
|
|
20
|
-
required: false,
|
|
21
|
-
}),
|
|
22
|
-
description: Flags.string({
|
|
23
|
-
char: "d",
|
|
24
|
-
description: "Application description",
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
appName: Flags.string({
|
|
28
|
-
description: "Docker app name",
|
|
29
|
-
required: false,
|
|
30
|
-
}),
|
|
31
|
-
skipConfirm: Flags.boolean({
|
|
32
|
-
char: "y",
|
|
33
|
-
description: "Skip confirmation prompt",
|
|
34
|
-
default: false,
|
|
35
|
-
}),
|
|
36
|
-
};
|
|
37
|
-
async run() {
|
|
38
|
-
const auth = await readAuthConfig(this);
|
|
39
|
-
const { flags } = await this.parse(AppCreate);
|
|
40
|
-
let { projectId, name, description, appName } = flags;
|
|
41
|
-
// Modo interactivo si no se proporcionan los flags necesarios
|
|
42
|
-
if (!projectId || !name || !appName) {
|
|
43
|
-
console.log(chalk.blue.bold("\n Listing all Projects \n"));
|
|
44
|
-
const projects = await getProjects(auth, this);
|
|
45
|
-
if (!projectId) {
|
|
46
|
-
const { project } = await inquirer.prompt([
|
|
47
|
-
{
|
|
48
|
-
choices: projects.map((project) => ({
|
|
49
|
-
name: project.name,
|
|
50
|
-
value: project,
|
|
51
|
-
})),
|
|
52
|
-
message: "Select a project to create the application in:",
|
|
53
|
-
name: "project",
|
|
54
|
-
type: "list",
|
|
55
|
-
},
|
|
56
|
-
]);
|
|
57
|
-
projectId = project.projectId;
|
|
58
|
-
}
|
|
59
|
-
if (!name || !appName) {
|
|
60
|
-
const appDetails = await inquirer.prompt([
|
|
61
|
-
{
|
|
62
|
-
message: "Enter the application name:",
|
|
63
|
-
name: "name",
|
|
64
|
-
type: "input",
|
|
65
|
-
validate: (input) => (input ? true : "Application name is required"),
|
|
66
|
-
default: name,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
message: "Enter the application description (optional):",
|
|
70
|
-
name: "appDescription",
|
|
71
|
-
type: "input",
|
|
72
|
-
default: description,
|
|
73
|
-
},
|
|
74
|
-
]);
|
|
75
|
-
name = appDetails.name;
|
|
76
|
-
description = appDetails.appDescription;
|
|
77
|
-
const appNamePrompt = await inquirer.prompt([
|
|
78
|
-
{
|
|
79
|
-
default: appName || `${slugify(name)}`,
|
|
80
|
-
message: "Enter the App name:",
|
|
81
|
-
name: "appName",
|
|
82
|
-
type: "input",
|
|
83
|
-
validate: (input) => (input ? true : "App name is required"),
|
|
84
|
-
},
|
|
85
|
-
]);
|
|
86
|
-
appName = appNamePrompt.appName;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Confirmar si no se especifica --skipConfirm
|
|
90
|
-
if (!flags.skipConfirm) {
|
|
91
|
-
const confirm = await inquirer.prompt([
|
|
92
|
-
{
|
|
93
|
-
type: 'confirm',
|
|
94
|
-
name: 'proceed',
|
|
95
|
-
message: 'Do you want to create this application?',
|
|
96
|
-
default: false,
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
99
|
-
if (!confirm.proceed) {
|
|
100
|
-
this.error(chalk.yellow("Application creation cancelled."));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
const response = await axios.post(`${auth.url}/api/trpc/application.create`, {
|
|
106
|
-
json: {
|
|
107
|
-
name,
|
|
108
|
-
appDescription: description,
|
|
109
|
-
appName,
|
|
110
|
-
projectId,
|
|
111
|
-
},
|
|
112
|
-
}, {
|
|
113
|
-
headers: {
|
|
114
|
-
"x-api-key": auth.token,
|
|
115
|
-
"Content-Type": "application/json",
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
if (response.status !== 200) {
|
|
119
|
-
this.error(chalk.red("Error creating application"));
|
|
120
|
-
}
|
|
121
|
-
this.log(chalk.green(`Application '${name}' created successfully.`));
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
this.error(chalk.red(`Error creating application: ${error.message}`));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
export default class AppDelete extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
projectId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
-
applicationId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
-
skipConfirm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Command, Flags } from "@oclif/core";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import inquirer from "inquirer";
|
|
5
|
-
import { getProject, getProjects } from "../../utils/shared.js";
|
|
6
|
-
import { readAuthConfig } from "../../utils/utils.js";
|
|
7
|
-
export default class AppDelete extends Command {
|
|
8
|
-
static description = "Delete an application from a project.";
|
|
9
|
-
static examples = [
|
|
10
|
-
"$ <%= config.bin %> app delete",
|
|
11
|
-
"$ <%= config.bin %> app delete -p <projectId>",
|
|
12
|
-
];
|
|
13
|
-
static flags = {
|
|
14
|
-
projectId: Flags.string({
|
|
15
|
-
char: "p",
|
|
16
|
-
description: "ID of the project",
|
|
17
|
-
required: false,
|
|
18
|
-
}),
|
|
19
|
-
applicationId: Flags.string({
|
|
20
|
-
char: 'a',
|
|
21
|
-
description: 'ID of the application to delete',
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
skipConfirm: Flags.boolean({
|
|
25
|
-
char: 'y',
|
|
26
|
-
description: 'Skip confirmation prompt',
|
|
27
|
-
default: false,
|
|
28
|
-
})
|
|
29
|
-
};
|
|
30
|
-
async run() {
|
|
31
|
-
const auth = await readAuthConfig(this);
|
|
32
|
-
const { flags } = await this.parse(AppDelete);
|
|
33
|
-
let { projectId, applicationId } = flags;
|
|
34
|
-
// Modo interactivo si no se proporcionan los flags necesarios
|
|
35
|
-
if (!projectId || !applicationId) {
|
|
36
|
-
console.log(chalk.blue.bold("\n Listing all Projects \n"));
|
|
37
|
-
const projects = await getProjects(auth, this);
|
|
38
|
-
if (!projectId) {
|
|
39
|
-
const { project } = await inquirer.prompt([
|
|
40
|
-
{
|
|
41
|
-
choices: projects.map((project) => ({
|
|
42
|
-
name: project.name,
|
|
43
|
-
value: project,
|
|
44
|
-
})),
|
|
45
|
-
message: "Select a project to delete the application from:",
|
|
46
|
-
name: "project",
|
|
47
|
-
type: "list",
|
|
48
|
-
},
|
|
49
|
-
]);
|
|
50
|
-
projectId = project.projectId;
|
|
51
|
-
}
|
|
52
|
-
const projectSelected = await getProject(projectId, auth, this);
|
|
53
|
-
if (projectSelected.applications.length === 0) {
|
|
54
|
-
this.error(chalk.yellow("No applications found in this project."));
|
|
55
|
-
}
|
|
56
|
-
if (!applicationId) {
|
|
57
|
-
const appAnswers = await inquirer.prompt([
|
|
58
|
-
{
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
choices: projectSelected.applications.map((app) => ({
|
|
61
|
-
name: app.name,
|
|
62
|
-
value: app.applicationId,
|
|
63
|
-
})),
|
|
64
|
-
message: "Select the application to delete:",
|
|
65
|
-
name: "selectedApp",
|
|
66
|
-
type: "list",
|
|
67
|
-
},
|
|
68
|
-
]);
|
|
69
|
-
applicationId = appAnswers.selectedApp;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Confirmar si no se especifica --skipConfirm
|
|
73
|
-
if (!flags.skipConfirm) {
|
|
74
|
-
const confirmAnswers = await inquirer.prompt([
|
|
75
|
-
{
|
|
76
|
-
default: false,
|
|
77
|
-
message: "Are you sure you want to delete this application?",
|
|
78
|
-
name: "confirmDelete",
|
|
79
|
-
type: "confirm",
|
|
80
|
-
},
|
|
81
|
-
]);
|
|
82
|
-
if (!confirmAnswers.confirmDelete) {
|
|
83
|
-
this.error(chalk.yellow("Application deletion cancelled."));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
const deleteResponse = await axios.post(`${auth.url}/api/trpc/application.delete`, {
|
|
88
|
-
json: {
|
|
89
|
-
applicationId,
|
|
90
|
-
},
|
|
91
|
-
}, {
|
|
92
|
-
headers: {
|
|
93
|
-
"x-api-key": auth.token,
|
|
94
|
-
"Content-Type": "application/json",
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
if (!deleteResponse.data.result.data.json) {
|
|
98
|
-
this.error(chalk.red("Error deleting application"));
|
|
99
|
-
}
|
|
100
|
-
this.log(chalk.green("Application deleted successfully."));
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
this.error(chalk.red(`Failed to delete application: ${error.message}`));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
export default class AppDeploy extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
applicationId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
-
projectId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
-
skipConfirm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|