@faable/faable 4.35.0 → 4.36.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/dist/api/FaableApi.js +7 -0
- package/dist/commands/deploy/domains/add.js +7 -4
- package/dist/commands/deploy/domains/attach.js +63 -0
- package/dist/commands/deploy/domains/check.js +8 -10
- package/dist/commands/deploy/domains/index.js +3 -1
- package/dist/commands/deploy/domains/locate.js +67 -0
- package/dist/commands/deploy/domains/rm.js +18 -16
- package/dist/mcp/tools.js +31 -6
- package/package.json +1 -1
package/dist/api/FaableApi.js
CHANGED
|
@@ -495,6 +495,13 @@ class FaableApi {
|
|
|
495
495
|
headers: projectHeader(team)
|
|
496
496
|
}));
|
|
497
497
|
}
|
|
498
|
+
// Relink a domain to another app of its project (or `null` to unlink it).
|
|
499
|
+
// Keeps the row: same id, same CNAME target, same certificate.
|
|
500
|
+
async updateDomain(domain_id, team, params) {
|
|
501
|
+
return data(this.client.post(`/domain/${domain_id}`, params, {
|
|
502
|
+
headers: projectHeader(team)
|
|
503
|
+
}));
|
|
504
|
+
}
|
|
498
505
|
async deleteDomain(domain_id, team) {
|
|
499
506
|
return data(this.client.delete(`/domain/${domain_id}`, {
|
|
500
507
|
headers: projectHeader(team)
|
|
@@ -3,6 +3,7 @@ import { print_json, json_option } from '../../../lib/listing.js';
|
|
|
3
3
|
import { log } from '../../../log.js';
|
|
4
4
|
import { resolve_app_id } from '../resolve_app_id.js';
|
|
5
5
|
import { acme_record, cname_target } from './format.js';
|
|
6
|
+
import { add_conflict_hint } from './locate.js';
|
|
6
7
|
|
|
7
8
|
const domains_add = {
|
|
8
9
|
command: 'add <fqdn>',
|
|
@@ -29,10 +30,12 @@ const domains_add = {
|
|
|
29
30
|
const ctx = await requireApi();
|
|
30
31
|
const app_id = await resolve_app_id(args.app, ctx.appId, ctx.api);
|
|
31
32
|
const app = await ctx.api.getApp(app_id);
|
|
32
|
-
const domain = await ctx.api
|
|
33
|
-
fqdn: args.fqdn,
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const domain = await ctx.api
|
|
34
|
+
.createDomain(app.team, { fqdn: args.fqdn, app_id, tls: args.tls })
|
|
35
|
+
.catch(async (err) => {
|
|
36
|
+
// Already in this project (an app deletion leaves its domains linked
|
|
37
|
+
// to no app): name the command that fixes it, not "another project".
|
|
38
|
+
throw ((await add_conflict_hint(ctx.api, app.team, args.fqdn, app_id, err)) ?? err);
|
|
36
39
|
});
|
|
37
40
|
// Same shape as `domains check --json`: the record plus the CNAME to
|
|
38
41
|
// create, which is the whole next step.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { requireApi } from '../../../api/context.js';
|
|
2
|
+
import { confirm } from '../../../lib/interactive.js';
|
|
3
|
+
import { print_json, json_option } from '../../../lib/listing.js';
|
|
4
|
+
import { log } from '../../../log.js';
|
|
5
|
+
import { resolve_app_id } from '../resolve_app_id.js';
|
|
6
|
+
import { cname_target } from './format.js';
|
|
7
|
+
import { locate_domain, attach_plan } from './locate.js';
|
|
8
|
+
|
|
9
|
+
const domains_attach = {
|
|
10
|
+
command: 'attach <fqdn>',
|
|
11
|
+
describe: 'Link a domain of the project to an app — one left with no app, or one moving from another app',
|
|
12
|
+
builder: yargs => json_option(yargs)
|
|
13
|
+
.positional('fqdn', {
|
|
14
|
+
type: 'string',
|
|
15
|
+
demandOption: true,
|
|
16
|
+
description: 'A domain already in the project'
|
|
17
|
+
})
|
|
18
|
+
.option('app', {
|
|
19
|
+
alias: 'a',
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'App id, name or slug (defaults to the linked app)'
|
|
22
|
+
})
|
|
23
|
+
.option('yes', {
|
|
24
|
+
alias: 'y',
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: false,
|
|
27
|
+
description: 'Skip the confirmation when the domain moves from another app'
|
|
28
|
+
})
|
|
29
|
+
.example('$0 deploy domains attach app.example.com --app web', 'Serve a domain whose app was deleted from "web"')
|
|
30
|
+
.epilog('The domain keeps its id, its CNAME target and its TLS certificate: no DNS change and no new certificate. Deleting an app leaves its domains in the project with no app; this links them again.')
|
|
31
|
+
.showHelpOnFail(false),
|
|
32
|
+
handler: async (args) => {
|
|
33
|
+
const ctx = await requireApi();
|
|
34
|
+
const app_id = await resolve_app_id(args.app, ctx.appId, ctx.api);
|
|
35
|
+
const app = await ctx.api.getApp(app_id);
|
|
36
|
+
// Any domain of the project: `locate_domain` without an app restriction.
|
|
37
|
+
const found = await locate_domain(ctx.api, app.team, args.fqdn, null);
|
|
38
|
+
const plan = attach_plan(found, app_id);
|
|
39
|
+
if (plan.kind === 'already') {
|
|
40
|
+
if (args.json)
|
|
41
|
+
return print_json(plan.domain);
|
|
42
|
+
log.info(`🌐 ${plan.domain.fqdn} is already attached to ${app.name} (${app_id}).`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (plan.from) {
|
|
46
|
+
const go = await confirm({
|
|
47
|
+
message: `Move domain "${found.fqdn}" from ${plan.from} to ${app.name} (${app_id})? ${plan.from} stops serving it.`,
|
|
48
|
+
yes: args.yes
|
|
49
|
+
});
|
|
50
|
+
if (!go) {
|
|
51
|
+
log.info('Cancelled.');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const domain = await ctx.api.updateDomain(found.id, app.team, { app_id });
|
|
56
|
+
if (args.json)
|
|
57
|
+
return print_json(domain);
|
|
58
|
+
log.info(`🔗 ${domain.fqdn} now serves ${app.name} (${app_id})${plan.from ? `, instead of ${plan.from}` : ''}.`);
|
|
59
|
+
log.info(`Same CNAME (${domain.fqdn} → ${cname_target(domain)}) and the same certificate: nothing to change at your DNS provider.`);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { domains_attach };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { requireApi } from '../../../api/context.js';
|
|
2
2
|
import { print_json, json_option } from '../../../lib/listing.js';
|
|
3
3
|
import { log } from '../../../log.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { acme_record, cname_target, dns_badge, tls_line } from './format.js';
|
|
5
|
+
import { domain_scope, locate_domain } from './locate.js';
|
|
6
6
|
|
|
7
7
|
const domains_check = {
|
|
8
8
|
command: 'check <fqdn>',
|
|
@@ -16,18 +16,13 @@ const domains_check = {
|
|
|
16
16
|
.option('app', {
|
|
17
17
|
alias: 'a',
|
|
18
18
|
type: 'string',
|
|
19
|
-
description: 'App id, name or slug
|
|
19
|
+
description: 'App id, name or slug. Optional: the domain is looked up in the project'
|
|
20
20
|
})
|
|
21
21
|
.showHelpOnFail(false),
|
|
22
22
|
handler: async (args) => {
|
|
23
23
|
const ctx = await requireApi();
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const domains = await ctx.api.listDomains(app_id, app.team);
|
|
27
|
-
const domain = find_by_fqdn(domains, args.fqdn);
|
|
28
|
-
if (!domain) {
|
|
29
|
-
throw new Error(`Domain ${args.fqdn} is not attached to ${app_id}. List them with "faable deploy domains list".`);
|
|
30
|
-
}
|
|
24
|
+
const scope = await domain_scope(ctx.api, args.app, ctx.appId);
|
|
25
|
+
const domain = await locate_domain(ctx.api, scope.team, args.fqdn, scope.explicit);
|
|
31
26
|
// The record plus the one thing it does not carry: the CNAME to create.
|
|
32
27
|
if (args.json) {
|
|
33
28
|
return print_json({
|
|
@@ -38,6 +33,9 @@ const domains_check = {
|
|
|
38
33
|
}
|
|
39
34
|
const status = domain.status;
|
|
40
35
|
log.info(`🌐 ${domain.fqdn} — ${dns_badge(domain)}`);
|
|
36
|
+
if (!domain.app_id) {
|
|
37
|
+
log.warn(` Linked to no app: it answers DOMAIN_NOT_LINKED. Serve it with: faable deploy domains attach ${domain.fqdn} --app <app>`);
|
|
38
|
+
}
|
|
41
39
|
log.info(` Expected CNAME: ${domain.fqdn} → ${cname_target(domain)}`);
|
|
42
40
|
if (status?.dns_observed?.length) {
|
|
43
41
|
log.info(` Observed: ${status.dns_observed.join(', ')}`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { domains_add } from './add.js';
|
|
2
|
+
import { domains_attach } from './attach.js';
|
|
2
3
|
import { domains_check } from './check.js';
|
|
3
4
|
import { domains_list } from './list.js';
|
|
4
5
|
import { domains_rm } from './rm.js';
|
|
@@ -9,9 +10,10 @@ const domains = {
|
|
|
9
10
|
builder: yargs => yargs
|
|
10
11
|
.command(domains_list)
|
|
11
12
|
.command(domains_add)
|
|
13
|
+
.command(domains_attach)
|
|
12
14
|
.command(domains_check)
|
|
13
15
|
.command(domains_rm)
|
|
14
|
-
.demandCommand(1, 'Specify a domains command: list, add, check or rm'),
|
|
16
|
+
.demandCommand(1, 'Specify a domains command: list, add, attach, check or rm'),
|
|
15
17
|
handler: () => {
|
|
16
18
|
// Unreachable: demandCommand(1) either routes to a subcommand or fails
|
|
17
19
|
// through the global .fail() in src/index.ts.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { requireProject } from '../../../api/project.js';
|
|
2
|
+
import { CliError } from '../../../lib/errors.js';
|
|
3
|
+
import { fetch_page } from '../../../lib/listing.js';
|
|
4
|
+
import { find_app_id } from '../resolve_app_id.js';
|
|
5
|
+
import { find_by_fqdn } from './format.js';
|
|
6
|
+
|
|
7
|
+
// A domain is the PROJECT's, not the app's: deleting an app unlinks its domains
|
|
8
|
+
// and leaves them in the project with no app (api deploy/domain/lifecycle.ts).
|
|
9
|
+
// So a domain is looked up in the whole project, never only in one app's list —
|
|
10
|
+
// that is how `rm` and `check` could not see app.ciapol.com (2026-11-09).
|
|
11
|
+
const project_domains = async (api, team) => (await fetch_page(p => api.listDomainsPage(undefined, team, p), {
|
|
12
|
+
limit: 200,
|
|
13
|
+
all: true
|
|
14
|
+
})).data;
|
|
15
|
+
const find_project_domain = async (api, team, fqdn) => find_by_fqdn(await project_domains(api, team), fqdn);
|
|
16
|
+
const not_in_project = (fqdn, team) => new CliError('not_found', `Domain ${fqdn} is not in project ${team}. List them with "faable deploy domains list".`);
|
|
17
|
+
/**
|
|
18
|
+
* The domain `fqdn` of the project. With an app, it must be that app's — or
|
|
19
|
+
* linked to no app, which any app may act on: there is no other app to name.
|
|
20
|
+
*/
|
|
21
|
+
const locate_domain = async (api, team, fqdn, app_id) => {
|
|
22
|
+
const domain = await find_project_domain(api, team, fqdn);
|
|
23
|
+
if (!domain)
|
|
24
|
+
throw not_in_project(fqdn, team);
|
|
25
|
+
if (app_id && domain.app_id && domain.app_id !== app_id) {
|
|
26
|
+
throw new CliError('not_found', `Domain ${domain.fqdn} is attached to ${domain.app_id}, not to ${app_id}. Run the command with --app ${domain.app_id}, or move it with "faable deploy domains attach ${domain.fqdn} --app ${app_id}".`);
|
|
27
|
+
}
|
|
28
|
+
return domain;
|
|
29
|
+
};
|
|
30
|
+
// What `attach` does with the domain it found.
|
|
31
|
+
const attach_plan = (domain, app_id) => domain.app_id === app_id
|
|
32
|
+
? { kind: 'already', domain }
|
|
33
|
+
: { kind: 'link', domain, from: domain.app_id ?? null };
|
|
34
|
+
// `domains add` on a hostname the project already has: say which command fixes
|
|
35
|
+
// it. The api says so too from `domain_unlinked` on; this also covers an older
|
|
36
|
+
// api, which answers the same anonymous `domain_taken` to everyone.
|
|
37
|
+
const add_conflict_hint = async (api, team, fqdn, app_id, err) => {
|
|
38
|
+
const code = err?.code;
|
|
39
|
+
if (code !== 'domain_taken' && code !== 'domain_unlinked')
|
|
40
|
+
return undefined;
|
|
41
|
+
const domain = await find_project_domain(api, team, fqdn).catch(() => undefined);
|
|
42
|
+
if (!domain)
|
|
43
|
+
return undefined;
|
|
44
|
+
if (domain.app_id === app_id) {
|
|
45
|
+
return new CliError('domain_taken', `Domain ${domain.fqdn} is already attached to ${app_id}. See it with "faable deploy domains check ${domain.fqdn} --app ${app_id}".`, { status: 409, cause: err });
|
|
46
|
+
}
|
|
47
|
+
return domain.app_id
|
|
48
|
+
? new CliError('domain_taken', `Domain ${domain.fqdn} is already in this project, attached to ${domain.app_id}. Move it with: faable deploy domains attach ${domain.fqdn} --app ${app_id}`, { status: 409, cause: err })
|
|
49
|
+
: new CliError('domain_unlinked', `Domain ${domain.fqdn} is already in this project, linked to no app. Link it — its CNAME and certificate stay valid — with: faable deploy domains attach ${domain.fqdn} --app ${app_id}`, { status: 409, cause: err });
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Where a domain command acts: the project of the app (`--app`, or the one the
|
|
53
|
+
* directory is linked to), else the active project (`--project`). `explicit`
|
|
54
|
+
* is the app the user NAMED — only that one restricts which domain matches; an
|
|
55
|
+
* app inferred from the directory just says which project.
|
|
56
|
+
*/
|
|
57
|
+
const domain_scope = async (api, app_ref, ctx_app_id) => {
|
|
58
|
+
const app_id = await find_app_id(app_ref, ctx_app_id, api);
|
|
59
|
+
if (app_id) {
|
|
60
|
+
const app = await api.getApp(app_id);
|
|
61
|
+
return { team: app.team, app, explicit: app_ref ? app_id : null };
|
|
62
|
+
}
|
|
63
|
+
const { id } = await requireProject(api);
|
|
64
|
+
return { team: id, app: null, explicit: null };
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { add_conflict_hint, attach_plan, domain_scope, find_project_domain, locate_domain, not_in_project, project_domains };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { requireApi } from '../../../api/context.js';
|
|
2
|
+
import { confirm } from '../../../lib/interactive.js';
|
|
2
3
|
import { print_json, json_option } from '../../../lib/listing.js';
|
|
3
4
|
import { log } from '../../../log.js';
|
|
4
|
-
import {
|
|
5
|
-
import { find_by_fqdn } from './format.js';
|
|
6
|
-
import { confirm } from '../../../lib/interactive.js';
|
|
5
|
+
import { domain_scope, locate_domain } from './locate.js';
|
|
7
6
|
|
|
8
7
|
const domains_rm = {
|
|
9
8
|
command: 'rm <fqdn>',
|
|
10
|
-
describe: 'Remove a custom domain from
|
|
9
|
+
describe: 'Remove a custom domain (from its app, or one linked to no app)',
|
|
11
10
|
builder: yargs => json_option(yargs)
|
|
12
11
|
.positional('fqdn', {
|
|
13
12
|
type: 'string',
|
|
@@ -17,7 +16,7 @@ const domains_rm = {
|
|
|
17
16
|
.option('app', {
|
|
18
17
|
alias: 'a',
|
|
19
18
|
type: 'string',
|
|
20
|
-
description: 'App id, name or slug
|
|
19
|
+
description: 'App id, name or slug. Optional: the domain is looked up in the project'
|
|
21
20
|
})
|
|
22
21
|
.option('yes', {
|
|
23
22
|
alias: 'y',
|
|
@@ -26,30 +25,33 @@ const domains_rm = {
|
|
|
26
25
|
description: 'Skip the confirmation prompt'
|
|
27
26
|
})
|
|
28
27
|
.example('$0 deploy domains rm www.example.com', 'Detach after confirmation')
|
|
28
|
+
.example('$0 deploy domains rm app.example.com -p my-project -y', 'A domain linked to no app (its app was deleted). To keep it, link it instead: domains attach')
|
|
29
29
|
.showHelpOnFail(false),
|
|
30
30
|
handler: async (args) => {
|
|
31
31
|
const ctx = await requireApi();
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const scope = await domain_scope(ctx.api, args.app, ctx.appId);
|
|
33
|
+
const domain = await locate_domain(ctx.api, scope.team, args.fqdn, scope.explicit);
|
|
34
|
+
const serves = domain.app_id
|
|
35
|
+
? scope.app?.id === domain.app_id
|
|
36
|
+
? `${scope.app.name} (${domain.app_id})`
|
|
37
|
+
: domain.app_id
|
|
38
|
+
: null;
|
|
39
39
|
const go = await confirm({
|
|
40
|
-
message:
|
|
40
|
+
message: serves
|
|
41
|
+
? `Remove domain "${domain.fqdn}" from ${serves}? Traffic to it will stop being served.`
|
|
42
|
+
: `Remove domain "${domain.fqdn}"? It is linked to no app. To serve it again with the same CNAME and certificate, use "faable deploy domains attach" instead.`,
|
|
41
43
|
yes: args.yes
|
|
42
44
|
});
|
|
43
45
|
if (!go) {
|
|
44
46
|
log.info('Cancelled.');
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
|
-
await ctx.api.deleteDomain(domain.id,
|
|
49
|
+
await ctx.api.deleteDomain(domain.id, scope.team);
|
|
48
50
|
if (args.json) {
|
|
49
51
|
return print_json({ deleted: true, id: domain.id, fqdn: domain.fqdn });
|
|
50
52
|
}
|
|
51
|
-
log.info(`🗑️ Removed domain ${domain.fqdn} from ${
|
|
52
|
-
log.info(`
|
|
53
|
+
log.info(`🗑️ Removed domain ${domain.fqdn}${serves ? ` from ${serves}` : ''}.`);
|
|
54
|
+
log.info(`Remember to delete the CNAME at your DNS provider.`);
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
|
package/dist/mcp/tools.js
CHANGED
|
@@ -13,6 +13,11 @@ const cursor = z
|
|
|
13
13
|
.describe('next_cursor from the previous page, to continue a listing');
|
|
14
14
|
const scope = (a) => (a.project ? ['--project', a.project] : []);
|
|
15
15
|
const target = (a) => ['--app', a.app, ...scope(a)];
|
|
16
|
+
// Domains are the project's: a tool that finds one needs no app.
|
|
17
|
+
const optional_app = app
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('App id (app_…), name or slug. Optional: without it, the whole project');
|
|
20
|
+
const app_or_project = (a) => (a.app ? target(a) : scope(a));
|
|
16
21
|
const opt = (flag, value) => value === undefined || value === null || value === ''
|
|
17
22
|
? []
|
|
18
23
|
: [flag, String(value)];
|
|
@@ -419,13 +424,14 @@ const TOOLS = [
|
|
|
419
424
|
{
|
|
420
425
|
name: 'list_domains',
|
|
421
426
|
title: 'List custom domains',
|
|
422
|
-
description: 'Custom domains of an app and whether their DNS is verified.',
|
|
423
|
-
input: { app, project },
|
|
427
|
+
description: 'Custom domains of an app and whether their DNS is verified. Without `app`, every domain of the project with the app it serves: `app_id: null` is a domain linked to no app (its app was deleted), which answers DOMAIN_NOT_LINKED until attach_domain links it.',
|
|
428
|
+
input: { app: optional_app, project },
|
|
424
429
|
command: ['deploy', 'domains', 'list'],
|
|
425
|
-
flags:
|
|
430
|
+
flags: app_or_project,
|
|
426
431
|
shape: page((d) => ({
|
|
427
432
|
id: d.id,
|
|
428
433
|
fqdn: d.fqdn,
|
|
434
|
+
app_id: d.app_id ?? null,
|
|
429
435
|
verified: d.verified,
|
|
430
436
|
tls: d.tls,
|
|
431
437
|
dns_message: d.status?.dns_message
|
|
@@ -438,14 +444,15 @@ const TOOLS = [
|
|
|
438
444
|
title: 'Check a domain',
|
|
439
445
|
description: 'DNS diagnostic of one custom domain: the CNAME it expects, what DNS answers today, and why it is not verified yet. `prevalidation_cname.ready` says whether the optional `_acme-challenge` record is in place, so the certificate is issued without waiting for the CNAME; `status.tls_state` is `ok` once the edge serves a valid certificate for the domain (`status.tls_expires_at`).',
|
|
440
446
|
input: {
|
|
441
|
-
app,
|
|
447
|
+
app: optional_app,
|
|
442
448
|
project,
|
|
443
449
|
fqdn: z.string().describe('The domain, e.g. www.example.com')
|
|
444
450
|
},
|
|
445
451
|
command: ['deploy', 'domains', 'check'],
|
|
446
|
-
flags: a => [a.fqdn, ...
|
|
452
|
+
flags: a => [a.fqdn, ...app_or_project(a)],
|
|
447
453
|
shape: (d) => ({
|
|
448
454
|
fqdn: d.fqdn,
|
|
455
|
+
app_id: d.app_id ?? null,
|
|
449
456
|
verified: d.verified,
|
|
450
457
|
expected_cname: d.expected_cname,
|
|
451
458
|
observed: d.status?.dns_observed ?? [],
|
|
@@ -980,7 +987,7 @@ const TOOLS = [
|
|
|
980
987
|
{
|
|
981
988
|
name: 'add_domain',
|
|
982
989
|
title: 'Add a custom domain',
|
|
983
|
-
description: "Attach a custom domain to an app. Returns the CNAME record the user must create at their DNS provider; Faable verifies it and issues the certificate on its own. If the domain already serves traffic somewhere else, tell the user to create `prevalidation_cname` (`_acme-challenge.<fqdn>` CNAME) FIRST and switch the main CNAME only once check_domain shows it ready: the certificate then exists before traffic moves, with no TLS gap.",
|
|
990
|
+
description: "Attach a custom domain to an app. Returns the CNAME record the user must create at their DNS provider; Faable verifies it and issues the certificate on its own. If the domain already serves traffic somewhere else, tell the user to create `prevalidation_cname` (`_acme-challenge.<fqdn>` CNAME) FIRST and switch the main CNAME only once check_domain shows it ready: the certificate then exists before traffic moves, with no TLS gap. If it says the domain is already in this project, use attach_domain instead: adding it again cannot work.",
|
|
984
991
|
input: { app, project, fqdn: z.string().describe('e.g. www.example.com') },
|
|
985
992
|
command: ['deploy', 'domains', 'add'],
|
|
986
993
|
flags: a => [a.fqdn, ...target(a)],
|
|
@@ -992,6 +999,24 @@ const TOOLS = [
|
|
|
992
999
|
},
|
|
993
1000
|
example: { app: 'web', fqdn: 'www.example.com' }
|
|
994
1001
|
},
|
|
1002
|
+
{
|
|
1003
|
+
name: 'attach_domain',
|
|
1004
|
+
title: 'Link a domain to an app',
|
|
1005
|
+
description: "Link a custom domain of the project to an app: one left linked to no app (deleting an app leaves its domains in the project, answering DOMAIN_NOT_LINKED), or one moving from another of the project's apps. It keeps its id, its CNAME target and its certificate: nothing changes at the DNS provider. Use it instead of add_domain when add_domain says the domain is already in this project.",
|
|
1006
|
+
input: { app, project, fqdn: z.string().describe('e.g. app.example.com') },
|
|
1007
|
+
command: ['deploy', 'domains', 'attach'],
|
|
1008
|
+
// --yes: the model was asked to move it; the CLI prompt has no one to ask.
|
|
1009
|
+
flags: a => [a.fqdn, '--yes', ...target(a)],
|
|
1010
|
+
write: true,
|
|
1011
|
+
shape: (d) => ({ id: d.id, fqdn: d.fqdn, app_id: d.app_id ?? null }),
|
|
1012
|
+
annotations: {
|
|
1013
|
+
readOnlyHint: false,
|
|
1014
|
+
destructiveHint: false,
|
|
1015
|
+
idempotentHint: true,
|
|
1016
|
+
openWorldHint: true
|
|
1017
|
+
},
|
|
1018
|
+
example: { app: 'web', fqdn: 'app.example.com' }
|
|
1019
|
+
},
|
|
995
1020
|
{
|
|
996
1021
|
name: 'configure_repo',
|
|
997
1022
|
title: 'Configure how an app deploys',
|