@tolinax/ayoune-cli 2026.10.0 → 2026.11.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.
- package/lib/api/apiClient.js +219 -52
- package/lib/commands/_registry.js +5 -0
- package/lib/commands/aggregate/list.js +3 -2
- package/lib/commands/createActionsCommand.js +11 -10
- package/lib/commands/createAiCommand.js +10 -9
- package/lib/commands/createDbCommand.js +2 -1
- package/lib/commands/createDoctorCommand.js +305 -0
- package/lib/commands/createExportCommand.js +12 -11
- package/lib/commands/createJobsCommand.js +9 -8
- package/lib/commands/createMonitorCommand.js +20 -19
- package/lib/commands/createPermissionsCommand.js +12 -11
- package/lib/commands/createProgram.js +1 -1
- package/lib/commands/createSearchCommand.js +13 -12
- package/lib/commands/createServicesCommand.js +15 -12
- package/lib/commands/createSetupCommand.js +11 -13
- package/lib/commands/createSyncCommand.js +6 -5
- package/lib/commands/createTemplateCommand.js +8 -7
- package/lib/commands/createUsersCommand.js +6 -5
- package/lib/commands/createWebhooksCommand.js +4 -3
- package/lib/commands/deploy/alerts.js +2 -1
- package/lib/commands/deploy/clusters.js +2 -1
- package/lib/commands/deploy/deployments.js +4 -3
- package/lib/commands/deploy/pipelines.js +2 -1
- package/lib/commands/deploy/plans.js +3 -2
- package/lib/commands/deploy/pods.js +2 -1
- package/lib/commands/deploy/repos.js +3 -2
- package/lib/commands/functions/list.js +3 -2
- package/lib/commands/functions/logs.js +2 -1
- package/lib/commands/functions/versions.js +2 -1
- package/lib/commands/provision/hetzner.js +2 -1
- package/lib/helpers/printNextSteps.js +34 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
|
6
6
|
import { cliError } from "../helpers/cliError.js";
|
|
7
7
|
import { aYOUneModules } from "../../data/modules.js";
|
|
8
8
|
import { aYOUneServices } from "../../data/services.js";
|
|
9
|
+
import { parseInteger } from "../helpers/parseInt.js";
|
|
9
10
|
function buildServiceRegistry() {
|
|
10
11
|
const services = [];
|
|
11
12
|
// APIs from modules
|
|
@@ -70,9 +71,9 @@ export function createServicesCommand(program) {
|
|
|
70
71
|
.command("endpoints <host>")
|
|
71
72
|
.alias("ep")
|
|
72
73
|
.description("List API endpoints for a service host")
|
|
73
|
-
.addHelpText("after", `
|
|
74
|
-
Examples:
|
|
75
|
-
ay services endpoints ai.ayoune.app
|
|
74
|
+
.addHelpText("after", `
|
|
75
|
+
Examples:
|
|
76
|
+
ay services endpoints ai.ayoune.app
|
|
76
77
|
ay services endpoints crm-api.ayoune.app -r table`)
|
|
77
78
|
.action(async (host, options) => {
|
|
78
79
|
try {
|
|
@@ -117,7 +118,7 @@ Examples:
|
|
|
117
118
|
svc
|
|
118
119
|
.command("health [host]")
|
|
119
120
|
.description("Check health of a service or all services")
|
|
120
|
-
.option("--timeout <ms>", "Request timeout in ms",
|
|
121
|
+
.option("--timeout <ms>", "Request timeout in ms", parseInteger, 5000)
|
|
121
122
|
.action(async (host, options) => {
|
|
122
123
|
try {
|
|
123
124
|
const opts = { ...program.opts(), ...options };
|
|
@@ -127,16 +128,17 @@ Examples:
|
|
|
127
128
|
// Deduplicate by host
|
|
128
129
|
const uniqueTargets = [...new Map(targets.map((t) => [t.host, t])).values()];
|
|
129
130
|
spinner.start({ text: `Checking ${uniqueTargets.length} service(s)...`, color: "magenta" });
|
|
130
|
-
const { http } = await import("@tolinax/ayoune-core/lib/http");
|
|
131
131
|
const results = await Promise.allSettled(uniqueTargets.map(async (t) => {
|
|
132
132
|
const start = Date.now();
|
|
133
|
+
// Native fetch with AbortController-driven timeout. We previously
|
|
134
|
+
// used @tolinax/ayoune-core's http wrapper here, but it loads the
|
|
135
|
+
// backend AY singleton (mongoose + ioredis + prom-client) at import
|
|
136
|
+
// time and has no place in a CLI process.
|
|
137
|
+
const controller = new AbortController();
|
|
138
|
+
const timer = setTimeout(() => controller.abort(), opts.timeout);
|
|
133
139
|
try {
|
|
134
|
-
const resp = await
|
|
135
|
-
|
|
136
|
-
validateStatus: () => true,
|
|
137
|
-
logging: false,
|
|
138
|
-
metrics: false,
|
|
139
|
-
});
|
|
140
|
+
const resp = await fetch(`https://${t.host}/`, { signal: controller.signal });
|
|
141
|
+
clearTimeout(timer);
|
|
140
142
|
return {
|
|
141
143
|
host: t.host,
|
|
142
144
|
name: t.name,
|
|
@@ -146,13 +148,14 @@ Examples:
|
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
catch (e) {
|
|
151
|
+
clearTimeout(timer);
|
|
149
152
|
return {
|
|
150
153
|
host: t.host,
|
|
151
154
|
name: t.name,
|
|
152
155
|
status: "unreachable",
|
|
153
156
|
statusCode: 0,
|
|
154
157
|
responseTime: Date.now() - start,
|
|
155
|
-
error: e.code || e.message,
|
|
158
|
+
error: e.name === "AbortError" ? "timeout" : (e.code || e.message),
|
|
156
159
|
};
|
|
157
160
|
}
|
|
158
161
|
}));
|
|
@@ -8,6 +8,7 @@ import { spinner } from "../../index.js";
|
|
|
8
8
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
9
9
|
import { cliError } from "../helpers/cliError.js";
|
|
10
10
|
import { detectRuntime } from "../helpers/dockerCompose.js";
|
|
11
|
+
import { printNextSteps } from "../helpers/printNextSteps.js";
|
|
11
12
|
const AVAILABLE_MODULES = [
|
|
12
13
|
{ name: "CRM", value: "crm", description: "Customer Relationship Management" },
|
|
13
14
|
{ name: "Marketing", value: "marketing", description: "Marketing automation & campaigns" },
|
|
@@ -306,20 +307,16 @@ Examples:
|
|
|
306
307
|
await writeFile(valuesPath, valuesContent, "utf-8");
|
|
307
308
|
spinner.success({ text: "Configuration files generated!" });
|
|
308
309
|
spinner.stop();
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
console.log(chalk.dim(" 2. helm install ayoune tolinax/ayoune -f values.yaml"));
|
|
315
|
-
console.log(chalk.dim(" 3. ay status — verify all services are healthy\n"));
|
|
310
|
+
printNextSteps([
|
|
311
|
+
"Review and adjust the generated files",
|
|
312
|
+
"helm install ayoune tolinax/ayoune -f values.yaml",
|
|
313
|
+
"ay status — verify all services are healthy",
|
|
314
|
+
], { preamble: ["Generated files:", ` ${envPath}`, ` ${valuesPath}`] });
|
|
316
315
|
}
|
|
317
316
|
else {
|
|
318
317
|
spinner.success({ text: "Configuration files generated!" });
|
|
319
318
|
spinner.stop();
|
|
320
319
|
const profiles = ["core", ...answers.modules];
|
|
321
|
-
console.log(chalk.green("\n Generated files:"));
|
|
322
|
-
console.log(chalk.dim(` ${envPath}`));
|
|
323
320
|
// Offer to launch the stack right away. Skipped non-interactively
|
|
324
321
|
// (CI / piped) — that path keeps the original "next steps" output.
|
|
325
322
|
const canLaunch = process.stdin.isTTY && detectRuntime() === "compose";
|
|
@@ -339,10 +336,11 @@ Examples:
|
|
|
339
336
|
}
|
|
340
337
|
}
|
|
341
338
|
if (!launched) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
printNextSteps([
|
|
340
|
+
"Review and adjust the .env file",
|
|
341
|
+
`docker compose --profile ${profiles.join(" --profile ")} up -d`,
|
|
342
|
+
"ay status — verify all services are healthy",
|
|
343
|
+
], { preamble: ["Generated files:", ` ${envPath}`] });
|
|
346
344
|
}
|
|
347
345
|
}
|
|
348
346
|
if (!answers.licenseKey) {
|
|
@@ -3,6 +3,7 @@ import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOpti
|
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
4
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
5
5
|
import { cliError } from "../helpers/cliError.js";
|
|
6
|
+
import { parseInteger } from "../helpers/parseInt.js";
|
|
6
7
|
export function createSyncCommand(program) {
|
|
7
8
|
const sync = program
|
|
8
9
|
.command("sync")
|
|
@@ -11,10 +12,10 @@ export function createSyncCommand(program) {
|
|
|
11
12
|
sync
|
|
12
13
|
.command("repos")
|
|
13
14
|
.description("Sync repositories from connected providers")
|
|
14
|
-
.addHelpText("after", `
|
|
15
|
-
Examples:
|
|
16
|
-
ay sync repos Sync all repositories
|
|
17
|
-
ay sync repos --provider bitbucket Sync only Bitbucket repos
|
|
15
|
+
.addHelpText("after", `
|
|
16
|
+
Examples:
|
|
17
|
+
ay sync repos Sync all repositories
|
|
18
|
+
ay sync repos --provider bitbucket Sync only Bitbucket repos
|
|
18
19
|
ay sync repos --id <repoId> Sync a specific repository`)
|
|
19
20
|
.option("--provider <provider>", "Filter by provider (bitbucket, github)")
|
|
20
21
|
.option("--id <repoId>", "Sync a specific repository by ID")
|
|
@@ -112,7 +113,7 @@ Examples:
|
|
|
112
113
|
.command("pipelines")
|
|
113
114
|
.description("Sync pipeline status from CI/CD providers")
|
|
114
115
|
.option("--provider <provider>", "Filter by provider (bitbucket, github)")
|
|
115
|
-
.option("-l, --limit <number>", "Limit results",
|
|
116
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
116
117
|
.action(async (options) => {
|
|
117
118
|
try {
|
|
118
119
|
const opts = { ...program.opts(), ...options };
|
|
@@ -4,6 +4,7 @@ import { saveFile } from "../helpers/saveFile.js";
|
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
6
6
|
import { cliError } from "../helpers/cliError.js";
|
|
7
|
+
import { parseInteger } from "../helpers/parseInt.js";
|
|
7
8
|
export function createTemplateCommand(program) {
|
|
8
9
|
const tmpl = program
|
|
9
10
|
.command("templates")
|
|
@@ -19,8 +20,8 @@ export function createTemplateCommand(program) {
|
|
|
19
20
|
.alias("ls")
|
|
20
21
|
.description("List email templates")
|
|
21
22
|
.option("--search <query>", "Search by name")
|
|
22
|
-
.option("-l, --limit <number>", "Limit results",
|
|
23
|
-
.option("-p, --page <number>", "Page number",
|
|
23
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
24
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
24
25
|
.action(async (options) => {
|
|
25
26
|
var _a, _b, _c;
|
|
26
27
|
try {
|
|
@@ -76,8 +77,8 @@ export function createTemplateCommand(program) {
|
|
|
76
77
|
.command("list")
|
|
77
78
|
.alias("ls")
|
|
78
79
|
.description("List notification templates")
|
|
79
|
-
.option("-l, --limit <number>", "Limit results",
|
|
80
|
-
.option("-p, --page <number>", "Page number",
|
|
80
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
81
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
81
82
|
.action(async (options) => {
|
|
82
83
|
var _a, _b, _c;
|
|
83
84
|
try {
|
|
@@ -129,7 +130,7 @@ export function createTemplateCommand(program) {
|
|
|
129
130
|
.command("list")
|
|
130
131
|
.alias("ls")
|
|
131
132
|
.description("List report templates")
|
|
132
|
-
.option("-l, --limit <number>", "Limit results",
|
|
133
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
133
134
|
.action(async (options) => {
|
|
134
135
|
var _a, _b, _c;
|
|
135
136
|
try {
|
|
@@ -162,8 +163,8 @@ export function createTemplateCommand(program) {
|
|
|
162
163
|
.description("List available store templates")
|
|
163
164
|
.option("--category <category>", "Filter by category")
|
|
164
165
|
.option("--search <query>", "Search templates")
|
|
165
|
-
.option("-l, --limit <number>", "Limit results",
|
|
166
|
-
.option("-p, --page <number>", "Page number",
|
|
166
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
167
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
167
168
|
.action(async (options) => {
|
|
168
169
|
var _a, _b, _c;
|
|
169
170
|
try {
|
|
@@ -5,6 +5,7 @@ import { saveFile } from "../helpers/saveFile.js";
|
|
|
5
5
|
import { spinner } from "../../index.js";
|
|
6
6
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
7
7
|
import { cliError } from "../helpers/cliError.js";
|
|
8
|
+
import { parseInteger } from "../helpers/parseInt.js";
|
|
8
9
|
export function createUsersCommand(program) {
|
|
9
10
|
const users = program
|
|
10
11
|
.command("users")
|
|
@@ -18,8 +19,8 @@ export function createUsersCommand(program) {
|
|
|
18
19
|
.option("--search <query>", "Search by name or email")
|
|
19
20
|
.option("--role <roleId>", "Filter by role ID")
|
|
20
21
|
.option("--active", "Show only active users")
|
|
21
|
-
.option("-l, --limit <number>", "Limit results",
|
|
22
|
-
.option("-p, --page <number>", "Page number",
|
|
22
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
23
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
23
24
|
.action(async (options) => {
|
|
24
25
|
var _a, _b, _c;
|
|
25
26
|
try {
|
|
@@ -138,8 +139,8 @@ export function createUsersCommand(program) {
|
|
|
138
139
|
.alias("ls")
|
|
139
140
|
.description("List teams")
|
|
140
141
|
.option("--search <query>", "Search teams by name")
|
|
141
|
-
.option("-l, --limit <number>", "Limit results",
|
|
142
|
-
.option("-p, --page <number>", "Page number",
|
|
142
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
143
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
143
144
|
.action(async (options) => {
|
|
144
145
|
var _a, _b, _c;
|
|
145
146
|
try {
|
|
@@ -230,7 +231,7 @@ export function createUsersCommand(program) {
|
|
|
230
231
|
.command("list")
|
|
231
232
|
.alias("ls")
|
|
232
233
|
.description("List available roles")
|
|
233
|
-
.option("-l, --limit <number>", "Limit results",
|
|
234
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
234
235
|
.action(async (options) => {
|
|
235
236
|
var _a, _b, _c;
|
|
236
237
|
try {
|
|
@@ -4,6 +4,7 @@ import { saveFile } from "../helpers/saveFile.js";
|
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
6
6
|
import { cliError } from "../helpers/cliError.js";
|
|
7
|
+
import { parseInteger } from "../helpers/parseInt.js";
|
|
7
8
|
export function createWebhooksCommand(program) {
|
|
8
9
|
const hooks = program
|
|
9
10
|
.command("webhooks")
|
|
@@ -14,8 +15,8 @@ export function createWebhooksCommand(program) {
|
|
|
14
15
|
.command("list")
|
|
15
16
|
.alias("ls")
|
|
16
17
|
.description("List registered webhooks")
|
|
17
|
-
.option("-l, --limit <number>", "Limit results",
|
|
18
|
-
.option("-p, --page <number>", "Page number",
|
|
18
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
19
|
+
.option("-p, --page <number>", "Page number", parseInteger, 1)
|
|
19
20
|
.action(async (options) => {
|
|
20
21
|
var _a, _b;
|
|
21
22
|
try {
|
|
@@ -124,7 +125,7 @@ export function createWebhooksCommand(program) {
|
|
|
124
125
|
hooks
|
|
125
126
|
.command("templates")
|
|
126
127
|
.description("List available webhook templates")
|
|
127
|
-
.option("-l, --limit <number>", "Limit results",
|
|
128
|
+
.option("-l, --limit <number>", "Limit results", parseInteger, 50)
|
|
128
129
|
.action(async (options) => {
|
|
129
130
|
var _a, _b;
|
|
130
131
|
try {
|
|
@@ -7,13 +7,14 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
7
7
|
import { spinner } from "../../../index.js";
|
|
8
8
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
9
9
|
import { cliError } from "../../helpers/cliError.js";
|
|
10
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
10
11
|
export function addAlertsSubcommands(deploy, rootProgram) {
|
|
11
12
|
deploy
|
|
12
13
|
.command("alerts")
|
|
13
14
|
.description("List active deployment alerts")
|
|
14
15
|
.option("--severity <level>", "Filter: critical, warning, info")
|
|
15
16
|
.option("--type <type>", "Filter: pod_crash, oom_killed, image_pull_error, deployment_failed, pipeline_failed, cluster_unreachable, high_restart_count, custom")
|
|
16
|
-
.option("-l, --limit <number>", "Limit",
|
|
17
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 50)
|
|
17
18
|
.action(async (options) => {
|
|
18
19
|
var _a, _b, _c;
|
|
19
20
|
try {
|
|
@@ -8,6 +8,7 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
10
10
|
import { cliError } from "../../helpers/cliError.js";
|
|
11
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
11
12
|
export function addClustersSubcommands(deploy, rootProgram) {
|
|
12
13
|
// ay deploy clusters
|
|
13
14
|
deploy
|
|
@@ -18,7 +19,7 @@ export function addClustersSubcommands(deploy, rootProgram) {
|
|
|
18
19
|
Examples:
|
|
19
20
|
ay deploy clusters List all clusters
|
|
20
21
|
ay deploy clusters -r table Show clusters in table format`)
|
|
21
|
-
.option("-l, --limit <number>", "Limit",
|
|
22
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 50)
|
|
22
23
|
.action(async (options) => {
|
|
23
24
|
var _a, _b, _c;
|
|
24
25
|
try {
|
|
@@ -11,6 +11,7 @@ import { spinner } from "../../../index.js";
|
|
|
11
11
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
12
12
|
import { cliError } from "../../helpers/cliError.js";
|
|
13
13
|
import { getDeployToken } from "./_token.js";
|
|
14
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
14
15
|
export function addDeploymentsSubcommands(deploy, rootProgram) {
|
|
15
16
|
// ay deploy list
|
|
16
17
|
deploy
|
|
@@ -21,8 +22,8 @@ export function addDeploymentsSubcommands(deploy, rootProgram) {
|
|
|
21
22
|
.option("--namespace <ns>", "Filter by namespace")
|
|
22
23
|
.option("--health <status>", "Filter: healthy, degraded, crashed, pending")
|
|
23
24
|
.option("-q, --search <term>", "Search by name")
|
|
24
|
-
.option("-l, --limit <number>", "Limit",
|
|
25
|
-
.option("-p, --page <number>", "Page",
|
|
25
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 50)
|
|
26
|
+
.option("-p, --page <number>", "Page", parseInteger, 1)
|
|
26
27
|
.action(async (options) => {
|
|
27
28
|
var _a, _b;
|
|
28
29
|
try {
|
|
@@ -85,7 +86,7 @@ Examples:
|
|
|
85
86
|
ay deploy logs 64a1b2c3d4e5 --follow Stream logs in real-time (SSE)
|
|
86
87
|
ay deploy logs 64a1b2c3d4e5 --tail 100 Last 100 log lines`)
|
|
87
88
|
.option("-f, --follow", "Stream logs in real-time (Server-Sent Events)")
|
|
88
|
-
.option("--tail <lines>", "Number of recent log lines",
|
|
89
|
+
.option("--tail <lines>", "Number of recent log lines", parseInteger, 50)
|
|
89
90
|
.action(async (id, options) => {
|
|
90
91
|
try {
|
|
91
92
|
const opts = { ...rootProgram.opts(), ...options };
|
|
@@ -10,6 +10,7 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
10
10
|
import { spinner } from "../../../index.js";
|
|
11
11
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
12
12
|
import { cliError } from "../../helpers/cliError.js";
|
|
13
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
13
14
|
export function addPipelinesSubcommands(deploy, rootProgram) {
|
|
14
15
|
// ay deploy pipelines
|
|
15
16
|
deploy
|
|
@@ -18,7 +19,7 @@ export function addPipelinesSubcommands(deploy, rootProgram) {
|
|
|
18
19
|
.description("List recent CI/CD pipelines")
|
|
19
20
|
.option("--repo <slug>", "Filter by repository slug")
|
|
20
21
|
.option("--result <result>", "Filter: SUCCESSFUL, FAILED, STOPPED, EXPIRED")
|
|
21
|
-
.option("-l, --limit <number>", "Limit",
|
|
22
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 20)
|
|
22
23
|
.action(async (options) => {
|
|
23
24
|
var _a, _b, _c;
|
|
24
25
|
try {
|
|
@@ -8,6 +8,7 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
10
10
|
import { cliError } from "../../helpers/cliError.js";
|
|
11
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
11
12
|
export function addPlansSubcommands(deploy, rootProgram) {
|
|
12
13
|
const plans = deploy.command("plans").description("Manage multi-step deployment plans");
|
|
13
14
|
// ay deploy plans list
|
|
@@ -15,8 +16,8 @@ export function addPlansSubcommands(deploy, rootProgram) {
|
|
|
15
16
|
.command("list")
|
|
16
17
|
.alias("ls")
|
|
17
18
|
.description("List deployment plans")
|
|
18
|
-
.option("-l, --limit <number>", "Limit",
|
|
19
|
-
.option("-p, --page <number>", "Page",
|
|
19
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 50)
|
|
20
|
+
.option("-p, --page <number>", "Page", parseInteger, 1)
|
|
20
21
|
.action(async (options) => {
|
|
21
22
|
var _a, _b, _c;
|
|
22
23
|
try {
|
|
@@ -8,6 +8,7 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
10
10
|
import { cliError } from "../../helpers/cliError.js";
|
|
11
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
11
12
|
export function addPodsSubcommands(deploy, rootProgram) {
|
|
12
13
|
// ay deploy pods
|
|
13
14
|
deploy
|
|
@@ -17,7 +18,7 @@ export function addPodsSubcommands(deploy, rootProgram) {
|
|
|
17
18
|
.option("--namespace <ns>", "Filter by namespace")
|
|
18
19
|
.option("--status <status>", "Filter: Running, Pending, Failed, Succeeded, Unknown")
|
|
19
20
|
.option("--deployment <name>", "Filter by deployment")
|
|
20
|
-
.option("-l, --limit <number>", "Limit",
|
|
21
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 100)
|
|
21
22
|
.action(async (options) => {
|
|
22
23
|
var _a, _b, _c;
|
|
23
24
|
try {
|
|
@@ -8,6 +8,7 @@ import { saveFile } from "../../helpers/saveFile.js";
|
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
10
10
|
import { cliError } from "../../helpers/cliError.js";
|
|
11
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
11
12
|
export function addReposSubcommands(deploy, rootProgram) {
|
|
12
13
|
const repos = deploy.command("repos").description("Manage git repositories");
|
|
13
14
|
// ay deploy repos list
|
|
@@ -16,8 +17,8 @@ export function addReposSubcommands(deploy, rootProgram) {
|
|
|
16
17
|
.alias("ls")
|
|
17
18
|
.description("List registered repositories")
|
|
18
19
|
.option("--provider <provider>", "Filter: bitbucket, github")
|
|
19
|
-
.option("-l, --limit <number>", "Limit",
|
|
20
|
-
.option("-p, --page <number>", "Page",
|
|
20
|
+
.option("-l, --limit <number>", "Limit", parseInteger, 50)
|
|
21
|
+
.option("-p, --page <number>", "Page", parseInteger, 1)
|
|
21
22
|
.action(async (options) => {
|
|
22
23
|
var _a, _b, _c;
|
|
23
24
|
try {
|
|
@@ -5,13 +5,14 @@ import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatO
|
|
|
5
5
|
import { cliError } from "../../helpers/cliError.js";
|
|
6
6
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
7
7
|
import { FN_MODULE, FN_COLLECTION } from "./_shared.js";
|
|
8
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
8
9
|
export function addListSubcommand(fns, rootProgram) {
|
|
9
10
|
fns
|
|
10
11
|
.command("list")
|
|
11
12
|
.alias("ls")
|
|
12
13
|
.description("List user functions for the current customer")
|
|
13
|
-
.option("-l, --limit <n>", "Limit results",
|
|
14
|
-
.option("-p, --page <n>", "Page number",
|
|
14
|
+
.option("-l, --limit <n>", "Limit results", parseInteger, 50)
|
|
15
|
+
.option("-p, --page <n>", "Page number", parseInteger, 1)
|
|
15
16
|
.option("--trigger <type>", "Filter by trigger type (cron, http, event, manual, queue)")
|
|
16
17
|
.option("--search <q>", "Search by name or slug")
|
|
17
18
|
.action(async (options) => {
|
|
@@ -10,6 +10,7 @@ import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatO
|
|
|
10
10
|
import { cliError } from "../../helpers/cliError.js";
|
|
11
11
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
12
12
|
import { FN_MODULE, FN_COLLECTION, resolveFunction } from "./_shared.js";
|
|
13
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
13
14
|
function printLogLines(entries) {
|
|
14
15
|
var _a, _b, _c, _d, _e;
|
|
15
16
|
for (const entry of entries) {
|
|
@@ -25,7 +26,7 @@ export function addLogsSubcommand(fns, rootProgram) {
|
|
|
25
26
|
.command("logs <id-or-slug>")
|
|
26
27
|
.description("Show execution logs for a function")
|
|
27
28
|
.option("-f, --follow", "Poll for new log entries every 2s", false)
|
|
28
|
-
.option("-t, --tail <n>", "Number of recent entries to show",
|
|
29
|
+
.option("-t, --tail <n>", "Number of recent entries to show", parseInteger, 50)
|
|
29
30
|
.option("--json", "Output raw JSON instead of formatted lines", false)
|
|
30
31
|
.action(async (idOrSlug, options) => {
|
|
31
32
|
var _a;
|
|
@@ -8,11 +8,12 @@ import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatO
|
|
|
8
8
|
import { cliError } from "../../helpers/cliError.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
10
10
|
import { FN_MODULE, FN_COLLECTION, resolveFunction } from "./_shared.js";
|
|
11
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
11
12
|
export function addVersionsSubcommand(fns, rootProgram) {
|
|
12
13
|
fns
|
|
13
14
|
.command("versions <id-or-slug>")
|
|
14
15
|
.description("Show version history for a function")
|
|
15
|
-
.option("-l, --limit <n>", "Limit results",
|
|
16
|
+
.option("-l, --limit <n>", "Limit results", parseInteger, 50)
|
|
16
17
|
.action(async (idOrSlug, options) => {
|
|
17
18
|
var _a, _b, _c, _d, _e;
|
|
18
19
|
try {
|
|
@@ -23,6 +23,7 @@ import { requireTool } from "./_detectTools.js";
|
|
|
23
23
|
import { runBaseWizard } from "./_wizard.js";
|
|
24
24
|
import { writeState } from "./_stateFile.js";
|
|
25
25
|
import { spawn } from "child_process";
|
|
26
|
+
import { parseInteger } from "../../helpers/parseInt.js";
|
|
26
27
|
const HETZNER_REGIONS = ["nbg1", "fsn1", "hel1", "ash", "hil", "sin"];
|
|
27
28
|
const HETZNER_INSTANCE_SIZES = ["cax21", "cax31", "cax41", "ccx13", "ccx23", "ccx33"];
|
|
28
29
|
/** Stream a command (NOT docker compose) to the user's terminal. */
|
|
@@ -44,7 +45,7 @@ export function addHetznerSubcommand(prov) {
|
|
|
44
45
|
.option("--token <token>", "Hetzner Cloud API token (or set HCLOUD_TOKEN)")
|
|
45
46
|
.option("--region <region>", `Hetzner location (${HETZNER_REGIONS.join(", ")})`, "nbg1")
|
|
46
47
|
.option("--size <size>", `Server type (${HETZNER_INSTANCE_SIZES.join(", ")})`, "cax21")
|
|
47
|
-
.option("--servers <n>", "Number of worker nodes",
|
|
48
|
+
.option("--servers <n>", "Number of worker nodes", parseInteger, 3)
|
|
48
49
|
.option("--dry-run", "Render terraform.tfvars and run `terraform plan` only", false)
|
|
49
50
|
.option("-y, --yes", "Skip the final apply confirmation prompt", false)
|
|
50
51
|
.action(async (options) => {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Tiny shared helper for the "Next steps" footer that several commands print
|
|
2
|
+
// at the end of a successful run (setup, provision, local up, ...). The goal
|
|
3
|
+
// is consistent visual framing across the CLI without taking on a `boxen`
|
|
4
|
+
// dep — boxen is ~30 KB and we already keep the dep tree thin on purpose.
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// printNextSteps([
|
|
8
|
+
// "Review the .env file",
|
|
9
|
+
// "docker compose --profile core up -d",
|
|
10
|
+
// "ay status — verify all services are healthy",
|
|
11
|
+
// ]);
|
|
12
|
+
//
|
|
13
|
+
// Or with a heading:
|
|
14
|
+
// printNextSteps(steps, { title: "Almost done!" });
|
|
15
|
+
//
|
|
16
|
+
// The output goes through console.log so it inherits whatever stdout is
|
|
17
|
+
// hooked up (a TTY in normal use, /dev/null when piped). It does NOT use the
|
|
18
|
+
// spinner — call this AFTER spinner.success/spinner.stop so it doesn't
|
|
19
|
+
// fight the spinner's rendering loop.
|
|
20
|
+
import chalk from "chalk";
|
|
21
|
+
export function printNextSteps(steps, opts = {}) {
|
|
22
|
+
var _a;
|
|
23
|
+
if (opts.preamble && opts.preamble.length > 0) {
|
|
24
|
+
console.log("");
|
|
25
|
+
for (const line of opts.preamble) {
|
|
26
|
+
console.log(chalk.green(` ${line}`));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
console.log(chalk.cyan(`\n ${(_a = opts.title) !== null && _a !== void 0 ? _a : "Next steps:"}`));
|
|
30
|
+
steps.forEach((step, i) => {
|
|
31
|
+
console.log(chalk.dim(` ${i + 1}. ${step}`));
|
|
32
|
+
});
|
|
33
|
+
console.log("");
|
|
34
|
+
}
|