@camposcloud/cli 0.0.0-stage → 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.
- package/README.md +153 -2
- package/dist/commands/apps.js +197 -0
- package/dist/commands/auth.js +194 -0
- package/dist/commands/completion.js +94 -0
- package/dist/commands/create.js +220 -0
- package/dist/commands/dashboard.js +44 -0
- package/dist/commands/db.js +85 -0
- package/dist/commands/deploy.js +104 -0
- package/dist/commands/env.js +103 -0
- package/dist/commands/files.js +101 -0
- package/dist/commands/lang.js +34 -0
- package/dist/commands/manage.js +121 -0
- package/dist/commands/teams.js +127 -0
- package/dist/commands/utils.js +102 -0
- package/dist/core/api.js +157 -0
- package/dist/core/apiErrors.js +38 -0
- package/dist/core/apps.js +98 -0
- package/dist/core/config.js +34 -0
- package/dist/core/context.js +43 -0
- package/dist/core/credentials.js +90 -0
- package/dist/core/databases.js +53 -0
- package/dist/core/detect.js +75 -0
- package/dist/core/deviceLogin.js +49 -0
- package/dist/core/env.js +71 -0
- package/dist/core/files.js +51 -0
- package/dist/core/help.js +193 -0
- package/dist/core/i18n.js +581 -0
- package/dist/core/logs.js +87 -0
- package/dist/core/output.js +27 -0
- package/dist/core/project.js +119 -0
- package/dist/core/prompt.js +29 -0
- package/dist/core/session.js +21 -0
- package/dist/core/suggest.js +28 -0
- package/dist/core/teams.js +39 -0
- package/dist/core/update.js +48 -0
- package/dist/index.js +223 -0
- package/dist/tui/App.js +400 -0
- package/dist/tui/App.test.js +189 -0
- package/dist/tui/Picker.js +87 -0
- package/dist/tui/clickable.js +64 -0
- package/dist/tui/mouse.js +65 -0
- package/dist/tui/run.js +27 -0
- package/package.json +58 -4
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { detectLanguage } from "./i18n.js";
|
|
2
|
+
/** Descriptions of the commands and options, in the language of the rest of the CLI. */
|
|
3
|
+
const PT = {
|
|
4
|
+
program: "A Campos Cloud no terminal. Sem nenhum comando, abre o painel.",
|
|
5
|
+
apiUrl: "endereço da API (padrão: CAMPOS_API_URL ou https://api.camposcloud.com)",
|
|
6
|
+
team: "trabalhar neste time só neste comando (nome, id ou \"pessoal\")",
|
|
7
|
+
version: "mostra a versão",
|
|
8
|
+
help: "mostra a ajuda",
|
|
9
|
+
json: "saída em JSON",
|
|
10
|
+
app: "a aplicação (nome, começo do nome ou id; padrão: a da pasta ligada)",
|
|
11
|
+
yes: "não perguntar; confirma direto",
|
|
12
|
+
restart: "reinicia a aplicação depois",
|
|
13
|
+
login: "Conecta a CLI à sua conta, por um código no navegador",
|
|
14
|
+
loginToken: "usa este token em vez do navegador",
|
|
15
|
+
loginNoBrowser: "não abre o navegador; mostra o endereço e o código",
|
|
16
|
+
logout: "Desconecta este computador",
|
|
17
|
+
whoami: "Mostra a conta conectada",
|
|
18
|
+
status: "Estado da aplicação da pasta (ou da nomeada); fora de uma pasta ligada, de todas",
|
|
19
|
+
apps: "Lista as aplicações do time ativo",
|
|
20
|
+
appsList: "Lista as aplicações",
|
|
21
|
+
info: "Detalhes de uma aplicação",
|
|
22
|
+
start: "Liga uma aplicação",
|
|
23
|
+
stop: "Desliga uma aplicação",
|
|
24
|
+
restartCmd: "Reinicia uma aplicação (liga, se estiver desligada)",
|
|
25
|
+
logs: "Console da aplicação (somente leitura)",
|
|
26
|
+
logsFollow: "continua mostrando as linhas novas até Ctrl+C",
|
|
27
|
+
logsTail: "quantas linhas recentes mostrar primeiro (0 a 500)",
|
|
28
|
+
create: "Cria uma aplicação a partir desta pasta (pergunta o que faltar)",
|
|
29
|
+
createName: "nome da aplicação",
|
|
30
|
+
createRuntime: "ambiente: nodejs, bun ou python",
|
|
31
|
+
createMain: "arquivo principal",
|
|
32
|
+
createMemory: "memória em MB",
|
|
33
|
+
createWeb: "com endereço público na web",
|
|
34
|
+
createPort: "porta em que a aplicação escuta",
|
|
35
|
+
createSubdomain: "subdomínio .camposcloud.app",
|
|
36
|
+
createStart: "comando de inicialização",
|
|
37
|
+
createNoEnv: "não envia as variáveis do .env",
|
|
38
|
+
delete: "Apaga uma aplicação de vez (pede para digitar o nome)",
|
|
39
|
+
link: "Liga esta pasta a uma aplicação (escolhe numa lista se não disser qual)",
|
|
40
|
+
unlink: "Desfaz a ligação desta pasta",
|
|
41
|
+
deploy: "Envia esta pasta para a aplicação e reinicia",
|
|
42
|
+
deployApp: "envia para esta aplicação em vez da ligada",
|
|
43
|
+
deployNoRestart: "envia sem reiniciar",
|
|
44
|
+
deployDryRun: "só mostra o que seria enviado",
|
|
45
|
+
env: "Variáveis de ambiente da aplicação",
|
|
46
|
+
envShow: "mostra os valores",
|
|
47
|
+
envSet: "Define variáveis: CHAVE=valor [CHAVE2=valor2...]",
|
|
48
|
+
envUnset: "Remove variáveis: CHAVE [CHAVE2...]",
|
|
49
|
+
envPull: "Baixa as variáveis para um arquivo .env",
|
|
50
|
+
envPullForce: "substitui o arquivo se já existir",
|
|
51
|
+
envPush: "Envia as variáveis de um arquivo .env",
|
|
52
|
+
envPushReplace: "substitui todas as variáveis pelas do arquivo",
|
|
53
|
+
files: "Lista os arquivos de uma pasta da aplicação",
|
|
54
|
+
filesCat: "Mostra um arquivo de texto da aplicação",
|
|
55
|
+
filesPull: "Baixa um arquivo ou pasta da aplicação",
|
|
56
|
+
filesPush: "Envia um arquivo ou pasta local para a aplicação",
|
|
57
|
+
filesRm: "Apaga arquivos ou pastas da aplicação",
|
|
58
|
+
db: "Lista os bancos de dados do time ativo",
|
|
59
|
+
dbList: "Lista os bancos de dados",
|
|
60
|
+
dbInfo: "Detalhes de um banco e a string de conexão",
|
|
61
|
+
dbUrl: "Só a string de conexão (sem a senha)",
|
|
62
|
+
dbStart: "Liga um banco",
|
|
63
|
+
dbStop: "Desliga um banco",
|
|
64
|
+
dbRestart: "Reinicia um banco",
|
|
65
|
+
teams: "Lista seus times (o ativo marcado)",
|
|
66
|
+
teamCmd: "Mostra e troca o time em que você está trabalhando",
|
|
67
|
+
teamUse: "Passa a trabalhar num time (ou na conta pessoal: campos team use pessoal)",
|
|
68
|
+
teamMembers: "Membros de um time",
|
|
69
|
+
teamInvite: "Convida alguém para o time ativo",
|
|
70
|
+
teamInviteRole: "papel no time",
|
|
71
|
+
teamCreate: "Cria um time e passa a trabalhar nele",
|
|
72
|
+
teamCreateNoUse: "não troca para o time criado",
|
|
73
|
+
open: "Abre a aplicação no painel, no navegador",
|
|
74
|
+
url: "Mostra o endereço público da aplicação",
|
|
75
|
+
urlOpen: "abre no navegador",
|
|
76
|
+
doctor: "Confere se está tudo pronto: API, login, time e pasta",
|
|
77
|
+
completion: "Completar com Tab: mostra o script para powershell, bash ou zsh",
|
|
78
|
+
lang: "Mostra ou troca o idioma da CLI: pt ou en",
|
|
79
|
+
scale: "Muda a memória da aplicação (ex.: 512, 1gb)",
|
|
80
|
+
rename: "Muda o nome da aplicação",
|
|
81
|
+
autorestart: "Liga (on) ou desliga (off) o reinício automático quando a aplicação cai",
|
|
82
|
+
dbPassword: "Troca a senha do banco (gera uma forte se você não der uma) e mostra uma vez",
|
|
83
|
+
dbPasswordValue: "usar esta senha em vez de gerar",
|
|
84
|
+
dbScale: "Muda a memória do banco",
|
|
85
|
+
dbRename: "Muda o nome do banco",
|
|
86
|
+
usage: "Uso",
|
|
87
|
+
commands: "Comandos",
|
|
88
|
+
options: "Opções",
|
|
89
|
+
arguments: "Argumentos",
|
|
90
|
+
};
|
|
91
|
+
const EN = {
|
|
92
|
+
program: "Campos Cloud in the terminal. With no command, opens the dashboard.",
|
|
93
|
+
apiUrl: "API address (default: CAMPOS_API_URL or https://api.camposcloud.com)",
|
|
94
|
+
team: "work in this team for this command only (name, id or \"personal\")",
|
|
95
|
+
version: "show the version",
|
|
96
|
+
help: "show help",
|
|
97
|
+
json: "print as JSON",
|
|
98
|
+
app: "the application (name, start of the name or id; default: the linked folder's)",
|
|
99
|
+
yes: "do not ask; confirm right away",
|
|
100
|
+
restart: "restart the application afterwards",
|
|
101
|
+
login: "Connect the CLI to your account, by a code in the browser",
|
|
102
|
+
loginToken: "use this token instead of the browser",
|
|
103
|
+
loginNoBrowser: "do not open the browser; show the address and the code",
|
|
104
|
+
logout: "Disconnect this computer",
|
|
105
|
+
whoami: "Show the signed-in account",
|
|
106
|
+
status: "Status of the folder's (or the named) application; outside a linked folder, of all of them",
|
|
107
|
+
apps: "List the active team's applications",
|
|
108
|
+
appsList: "List the applications",
|
|
109
|
+
info: "Details of an application",
|
|
110
|
+
start: "Start an application",
|
|
111
|
+
stop: "Stop an application",
|
|
112
|
+
restartCmd: "Restart an application (starts it when stopped)",
|
|
113
|
+
logs: "The application's console (read only)",
|
|
114
|
+
logsFollow: "keep showing new lines until Ctrl+C",
|
|
115
|
+
logsTail: "how many recent lines to show first (0 to 500)",
|
|
116
|
+
create: "Create an application from this folder (asks for what is missing)",
|
|
117
|
+
createName: "application name",
|
|
118
|
+
createRuntime: "runtime: nodejs, bun or python",
|
|
119
|
+
createMain: "main file",
|
|
120
|
+
createMemory: "memory in MB",
|
|
121
|
+
createWeb: "with a public web address",
|
|
122
|
+
createPort: "port the application listens on",
|
|
123
|
+
createSubdomain: ".camposcloud.app subdomain",
|
|
124
|
+
createStart: "startup command",
|
|
125
|
+
createNoEnv: "do not send the variables from .env",
|
|
126
|
+
delete: "Delete an application for good (asks to type its name)",
|
|
127
|
+
link: "Link this folder to an application (choose from a list when no name is given)",
|
|
128
|
+
unlink: "Remove this folder's link",
|
|
129
|
+
deploy: "Send this folder to its application and restart it",
|
|
130
|
+
deployApp: "send to this application instead of the linked one",
|
|
131
|
+
deployNoRestart: "send without restarting",
|
|
132
|
+
deployDryRun: "only show what would be sent",
|
|
133
|
+
env: "The application's environment variables",
|
|
134
|
+
envShow: "show the values",
|
|
135
|
+
envSet: "Set variables: KEY=value [KEY2=value2...]",
|
|
136
|
+
envUnset: "Remove variables: KEY [KEY2...]",
|
|
137
|
+
envPull: "Download the variables to a .env file",
|
|
138
|
+
envPullForce: "replace the file if it exists",
|
|
139
|
+
envPush: "Send the variables of a .env file",
|
|
140
|
+
envPushReplace: "replace all variables with the file's",
|
|
141
|
+
files: "List the files of a folder of the application",
|
|
142
|
+
filesCat: "Show a text file of the application",
|
|
143
|
+
filesPull: "Download a file or folder of the application",
|
|
144
|
+
filesPush: "Upload a local file or folder to the application",
|
|
145
|
+
filesRm: "Delete files or folders of the application",
|
|
146
|
+
db: "List the active team's databases",
|
|
147
|
+
dbList: "List the databases",
|
|
148
|
+
dbInfo: "Details of a database and its connection string",
|
|
149
|
+
dbUrl: "Only the connection string (without the password)",
|
|
150
|
+
dbStart: "Start a database",
|
|
151
|
+
dbStop: "Stop a database",
|
|
152
|
+
dbRestart: "Restart a database",
|
|
153
|
+
teams: "List your teams (the active one marked)",
|
|
154
|
+
teamCmd: "Show and switch the team you are working in",
|
|
155
|
+
teamUse: "Work in a team from now on (or the personal account: campos team use personal)",
|
|
156
|
+
teamMembers: "Members of a team",
|
|
157
|
+
teamInvite: "Invite someone to the active team",
|
|
158
|
+
teamInviteRole: "role in the team",
|
|
159
|
+
teamCreate: "Create a team and switch to it",
|
|
160
|
+
teamCreateNoUse: "do not switch to the new team",
|
|
161
|
+
open: "Open the application in the dashboard, in the browser",
|
|
162
|
+
url: "Show the application's public address",
|
|
163
|
+
urlOpen: "open it in the browser",
|
|
164
|
+
doctor: "Check that everything is ready: API, sign-in, team and folder",
|
|
165
|
+
completion: "Tab completion: prints the script for powershell, bash or zsh",
|
|
166
|
+
lang: "Show or change the CLI's language: pt or en",
|
|
167
|
+
scale: "Change the application's memory (e.g. 512, 1gb)",
|
|
168
|
+
rename: "Rename the application",
|
|
169
|
+
autorestart: "Turn restarting by itself after a crash on or off",
|
|
170
|
+
dbPassword: "Change the database password (a strong one is made if you give none) and show it once",
|
|
171
|
+
dbPasswordValue: "use this password instead of generating one",
|
|
172
|
+
dbScale: "Change the database's memory",
|
|
173
|
+
dbRename: "Rename the database",
|
|
174
|
+
usage: "Usage",
|
|
175
|
+
commands: "Commands",
|
|
176
|
+
options: "Options",
|
|
177
|
+
arguments: "Arguments",
|
|
178
|
+
};
|
|
179
|
+
const table = detectLanguage() === "pt" ? PT : EN;
|
|
180
|
+
/** For the tests: both languages must describe the same commands. */
|
|
181
|
+
export const helpKeys = { pt: Object.keys(PT), en: Object.keys(EN) };
|
|
182
|
+
export const h = (key) => table[key] ?? EN[key] ?? key;
|
|
183
|
+
/** Commander's own errors, in the CLI's language. */
|
|
184
|
+
export function translateCommanderError(text) {
|
|
185
|
+
if (detectLanguage() !== "pt")
|
|
186
|
+
return text;
|
|
187
|
+
return text
|
|
188
|
+
.replace(/^error: unknown option '([^']+)'/m, "Opção desconhecida: $1. Veja campos --help.")
|
|
189
|
+
.replace(/^error: missing required argument '([^']+)'/m, "Falta o argumento: $1. Veja a ajuda do comando com --help.")
|
|
190
|
+
.replace(/^error: too many arguments(?: for '([^']+)')?\. Expected (\d+) arguments? but got (\d+)\./m, "Argumentos demais. Veja a ajuda do comando com --help.")
|
|
191
|
+
.replace(/^error: option '([^']+)' argument missing/m, "Falta o valor da opção $1.")
|
|
192
|
+
.replace(/^error: unknown command '([^']+)'/m, "O comando \"$1\" não existe. Veja os comandos com campos --help.");
|
|
193
|
+
}
|