@agentic-kit/db-tools 0.12.46 → 0.13.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.
Files changed (180) hide show
  1. package/README.md +18 -4
  2. package/access/findings.d.ts +93 -0
  3. package/access/findings.js +434 -0
  4. package/access/index.d.ts +5 -0
  5. package/access/index.js +27 -0
  6. package/access/policies.d.ts +142 -0
  7. package/access/policies.js +338 -0
  8. package/access/provisioning.d.ts +121 -0
  9. package/access/provisioning.js +381 -0
  10. package/access/rule-check.d.ts +52 -0
  11. package/access/rule-check.js +307 -0
  12. package/access/words.d.ts +38 -0
  13. package/access/words.js +530 -0
  14. package/app-workspace.d.ts +1 -0
  15. package/app-workspace.js +7 -9
  16. package/blueprint/blueprint-defaults.d.ts +9 -0
  17. package/blueprint/blueprint-defaults.js +77 -0
  18. package/blueprint/blueprint-schema.d.ts +68 -0
  19. package/blueprint/blueprint-schema.js +139 -0
  20. package/blueprint/field-type.d.ts +4 -0
  21. package/blueprint/field-type.js +100 -0
  22. package/blueprint/internal-policies.d.ts +1 -0
  23. package/blueprint/internal-policies.js +10 -0
  24. package/blueprint-construction.d.ts +10 -6
  25. package/blueprint-construction.js +34 -25
  26. package/context.d.ts +15 -0
  27. package/context.js +132 -69
  28. package/db-probe.d.ts +1 -1
  29. package/db-probe.js +19 -4
  30. package/esm/access/findings.d.ts +93 -0
  31. package/esm/access/findings.js +428 -0
  32. package/esm/access/index.d.ts +5 -0
  33. package/esm/access/index.js +5 -0
  34. package/esm/access/policies.d.ts +142 -0
  35. package/esm/access/policies.js +315 -0
  36. package/esm/access/provisioning.d.ts +121 -0
  37. package/esm/access/provisioning.js +375 -0
  38. package/esm/access/rule-check.d.ts +52 -0
  39. package/esm/access/rule-check.js +297 -0
  40. package/esm/access/words.d.ts +38 -0
  41. package/esm/access/words.js +524 -0
  42. package/esm/app-workspace.d.ts +1 -0
  43. package/esm/app-workspace.js +7 -10
  44. package/esm/blueprint/blueprint-defaults.d.ts +9 -0
  45. package/esm/blueprint/blueprint-defaults.js +74 -0
  46. package/esm/blueprint/blueprint-schema.d.ts +68 -0
  47. package/esm/blueprint/blueprint-schema.js +134 -0
  48. package/esm/blueprint/field-type.d.ts +4 -0
  49. package/esm/blueprint/field-type.js +95 -0
  50. package/esm/blueprint/internal-policies.d.ts +1 -0
  51. package/esm/blueprint/internal-policies.js +7 -0
  52. package/esm/blueprint-construction.d.ts +10 -6
  53. package/esm/blueprint-construction.js +32 -24
  54. package/esm/context.d.ts +15 -0
  55. package/esm/context.js +133 -70
  56. package/esm/db-probe.d.ts +1 -1
  57. package/esm/db-probe.js +21 -6
  58. package/esm/failure.d.ts +89 -0
  59. package/esm/failure.js +362 -0
  60. package/esm/gate.d.ts +6 -4
  61. package/esm/gate.js +42 -14
  62. package/esm/graphql-http.d.ts +27 -6
  63. package/esm/graphql-http.js +96 -24
  64. package/esm/host.d.ts +33 -8
  65. package/esm/host.js +42 -2
  66. package/esm/index.d.ts +22 -12
  67. package/esm/index.js +21 -39
  68. package/esm/provision-database/env-file.d.ts +7 -0
  69. package/esm/provision-database/env-file.js +30 -0
  70. package/esm/provision-database/preset-match.js +1 -2
  71. package/esm/provision-database/provision.d.ts +21 -4
  72. package/esm/provision-database/provision.js +330 -85
  73. package/esm/provision-database/request-database.d.ts +22 -3
  74. package/esm/provision-database/request-database.js +46 -13
  75. package/esm/ready.d.ts +20 -0
  76. package/esm/ready.js +45 -0
  77. package/esm/run-codegen/barrels.js +1 -1
  78. package/esm/run-codegen/endpoints.js +5 -6
  79. package/esm/schema-model/normalize.js +1 -1
  80. package/esm/schema-model.js +4 -5
  81. package/esm/schema-resolve.d.ts +50 -0
  82. package/esm/schema-resolve.js +200 -14
  83. package/esm/table-access.d.ts +116 -0
  84. package/esm/table-access.js +418 -0
  85. package/esm/tools/access.d.ts +218 -0
  86. package/esm/tools/access.js +651 -0
  87. package/esm/tools/add-policies.d.ts +44 -12
  88. package/esm/tools/add-policies.js +84 -84
  89. package/esm/tools/add-records.d.ts +23 -2
  90. package/esm/tools/add-records.js +113 -75
  91. package/esm/tools/add-relation-schema.d.ts +5 -5
  92. package/esm/tools/add-relation-schema.js +13 -14
  93. package/esm/tools/add-relation.d.ts +11 -2
  94. package/esm/tools/add-relation.js +68 -31
  95. package/esm/tools/create-api-key.d.ts +18 -4
  96. package/esm/tools/create-api-key.js +105 -54
  97. package/esm/tools/describe-schema.d.ts +5 -7
  98. package/esm/tools/describe-schema.js +41 -118
  99. package/esm/tools/entity-types.d.ts +54 -0
  100. package/esm/tools/entity-types.js +233 -0
  101. package/esm/tools/index.d.ts +26 -0
  102. package/esm/tools/index.js +151 -0
  103. package/esm/tools/mutations.d.ts +36 -7
  104. package/esm/tools/mutations.js +245 -99
  105. package/esm/tools/provision-blueprint.d.ts +25 -1
  106. package/esm/tools/provision-blueprint.js +184 -42
  107. package/esm/tools/provision-database.d.ts +7 -5
  108. package/esm/tools/provision-database.js +31 -17
  109. package/esm/tools/run-codegen.d.ts +27 -4
  110. package/esm/tools/run-codegen.js +143 -76
  111. package/esm/tools/templates.d.ts +30 -7
  112. package/esm/tools/templates.js +166 -95
  113. package/failure.d.ts +89 -0
  114. package/failure.js +375 -0
  115. package/gate.d.ts +6 -4
  116. package/gate.js +41 -13
  117. package/graphql-http.d.ts +27 -6
  118. package/graphql-http.js +105 -25
  119. package/host.d.ts +33 -8
  120. package/host.js +45 -2
  121. package/index.d.ts +22 -12
  122. package/index.js +86 -43
  123. package/package.json +6 -5
  124. package/provision-database/env-file.d.ts +7 -0
  125. package/provision-database/env-file.js +32 -1
  126. package/provision-database/preset-match.js +1 -2
  127. package/provision-database/provision.d.ts +21 -4
  128. package/provision-database/provision.js +327 -81
  129. package/provision-database/request-database.d.ts +22 -3
  130. package/provision-database/request-database.js +49 -14
  131. package/ready.d.ts +20 -0
  132. package/ready.js +52 -0
  133. package/run-codegen/barrels.js +1 -1
  134. package/run-codegen/endpoints.js +5 -6
  135. package/schema-model/normalize.js +4 -4
  136. package/schema-model.js +4 -5
  137. package/schema-resolve.d.ts +50 -0
  138. package/schema-resolve.js +209 -14
  139. package/table-access.d.ts +116 -0
  140. package/table-access.js +437 -0
  141. package/tools/access.d.ts +218 -0
  142. package/tools/access.js +669 -0
  143. package/tools/add-policies.d.ts +44 -12
  144. package/tools/add-policies.js +86 -84
  145. package/tools/add-records.d.ts +23 -2
  146. package/tools/add-records.js +113 -74
  147. package/tools/add-relation-schema.d.ts +5 -5
  148. package/tools/add-relation-schema.js +13 -14
  149. package/tools/add-relation.d.ts +11 -2
  150. package/tools/add-relation.js +69 -31
  151. package/tools/create-api-key.d.ts +18 -4
  152. package/tools/create-api-key.js +104 -53
  153. package/tools/describe-schema.d.ts +5 -7
  154. package/tools/describe-schema.js +40 -117
  155. package/tools/entity-types.d.ts +54 -0
  156. package/tools/entity-types.js +240 -0
  157. package/tools/index.d.ts +26 -0
  158. package/tools/index.js +154 -0
  159. package/tools/mutations.d.ts +36 -7
  160. package/tools/mutations.js +252 -101
  161. package/tools/provision-blueprint.d.ts +25 -1
  162. package/tools/provision-blueprint.js +186 -43
  163. package/tools/provision-database.d.ts +7 -5
  164. package/tools/provision-database.js +33 -18
  165. package/tools/run-codegen.d.ts +27 -4
  166. package/tools/run-codegen.js +141 -73
  167. package/tools/templates.d.ts +30 -7
  168. package/tools/templates.js +167 -94
  169. package/esm/policy/add-policies-to-table.d.ts +0 -26
  170. package/esm/policy/add-policies-to-table.js +0 -66
  171. package/esm/policy/provision-helpers.d.ts +0 -38
  172. package/esm/policy/provision-helpers.js +0 -50
  173. package/esm/tools/manage-entity-types.d.ts +0 -40
  174. package/esm/tools/manage-entity-types.js +0 -201
  175. package/policy/add-policies-to-table.d.ts +0 -26
  176. package/policy/add-policies-to-table.js +0 -71
  177. package/policy/provision-helpers.d.ts +0 -38
  178. package/policy/provision-helpers.js +0 -58
  179. package/tools/manage-entity-types.d.ts +0 -40
  180. package/tools/manage-entity-types.js +0 -206
@@ -8,22 +8,35 @@
8
8
  // finds an in-flight provision of the same name before anything new is
9
9
  // requested, and a completed one is only reported (binding it is `adopt`);
10
10
  // - the host saves the binding before `.env` is written.
11
- import { readFile, realpath, writeFile } from 'node:fs/promises';
11
+ import { realpathSync } from 'node:fs';
12
+ import { readFile, writeFile } from 'node:fs/promises';
12
13
  import path from 'node:path';
13
14
  import { prewarmAppWorkspace, run } from '../app-workspace';
14
15
  import { probeDatabase } from '../db-probe';
15
- import { getHost, noBackendReason, reprovisionAdvice } from '../host';
16
+ import { failureText, invalidBinding, noBackendFailure, suggest } from '../failure';
17
+ import { answersSignedOut, thrownText } from '../graphql-http';
18
+ import { getHost, readAccount, readBackendConfig, replaceCall, reprovisionAdvice } from '../host';
16
19
  import { selectProvisionCredential } from './credential';
17
- import { archiveBindingKeys, ARCHIVED_BINDING_KEYS, mergeEnv, provisionEnvVars, readEnv } from './env-file';
20
+ import { archiveBindingKeys, ARCHIVED_BINDING_KEYS, invalidBindingKeys, mergeEnv, provisionEnvVars, readEnv } from './env-file';
18
21
  import { loadProvisionManifest } from './manifest';
19
22
  import { abandonedTickets, archivePendingTicket, clearPendingTicket, MAX_PENDING_ATTEMPTS, recordAbandoned, recordedTicket, recordPendingTicket, } from './pending-ticket';
20
23
  import { selectProvisionRequest } from './preset-match';
21
- import { createProvisionExecutor, isTicketInFlight, isTransientProvisionError, ProvisionPendingError, ProvisionTicketLostError, requestDatabaseProvision, } from './request-database';
24
+ import { createProvisionExecutor, isTicketInFlight, isTransientProvisionError, ProvisionJobError, ProvisionPendingError, ProvisionSignedOutError, ProvisionTicketLostError, requestDatabaseProvision, } from './request-database';
22
25
  import { resolveProvisionModules } from './resolve';
23
- function failure(code, message, extra = {}) {
24
- return { ...extra, success: false, message, code };
26
+ function refuse(code, why, extra = {}) {
27
+ const failure = { ...why, code };
28
+ return { ...extra, success: false, message: failureText(failure), code, failure };
29
+ }
30
+ function withoutFailure({ failure: _failure, ...details }) {
31
+ return details;
32
+ }
33
+ // A probe the backend could not answer: a rejected account credential needs a
34
+ // sign-in, which the probe's detail already asks for; anything else, a retry.
35
+ function unanswered(probe, message, hint, extra = {}) {
36
+ return probe.cause === 'auth'
37
+ ? refuse('signed-out', { message }, extra)
38
+ : refuse('backend-unreachable', { message, hint, retryable: true }, extra);
25
39
  }
26
- const errorText = (err) => (err instanceof Error ? err.message : String(err));
27
40
  const today = () => new Date().toISOString().slice(0, 10);
28
41
  const noop = () => undefined;
29
42
  async function readText(file) {
@@ -40,13 +53,86 @@ async function readText(file) {
40
53
  async function updateEnvFile(envPath, edit) {
41
54
  await writeFile(envPath, edit(await readText(envPath)));
42
55
  }
43
- /** The DATABASE_ID in a project's `.env`, if any. */
56
+ /** A project's `.env`, with each binding value checked: one that is not of its form is never used, sent or shown. */
57
+ async function readBinding(envPath) {
58
+ const env = readEnv(await readText(envPath));
59
+ const invalid = invalidBindingKeys(env);
60
+ return invalid.length ? { kind: 'failed', failure: invalidBinding(invalid) } : { kind: 'ok', value: env };
61
+ }
62
+ /** The DATABASE_ID in a project's `.env`, if it has one of the form a database id takes. */
44
63
  export async function boundDatabaseId(cwd) {
45
- return readEnv(await readText(path.join(cwd, '.env'))).DATABASE_ID || undefined;
64
+ const binding = await boundDatabase(cwd);
65
+ return binding.kind === 'ok' ? binding.value?.id : undefined;
66
+ }
67
+ /** The database the `.env` of `cwd` binds, as a plan names it. */
68
+ async function boundDatabase(cwd) {
69
+ const binding = await readBinding(path.join(cwd, '.env'));
70
+ if (binding.kind === 'failed')
71
+ return binding;
72
+ const env = binding.value;
73
+ return { kind: 'ok', value: env.DATABASE_ID ? { name: env.DATABASE_NAME ?? '', id: env.DATABASE_ID } : undefined };
74
+ }
75
+ /**
76
+ * The backend and the account a provision runs with, or why it cannot run.
77
+ * The host's backend config is the only endpoint source: the account bearer
78
+ * provisions with it, so an ambient env var or a guessed default must never
79
+ * redirect it. Every project provisions UNDER the account (requestDatabase
80
+ * owns the database to the JWT user).
81
+ */
82
+ async function provisionAccess(host) {
83
+ const backendRead = readBackendConfig(host);
84
+ if (backendRead.kind === 'failed')
85
+ return { kind: 'failed', failure: { ...backendRead.failure, code: 'no-backend' } };
86
+ const apiEndpoint = backendRead.value?.apiEndpoint;
87
+ const modulesEndpoint = backendRead.value?.modulesEndpoint;
88
+ if (!apiEndpoint || !modulesEndpoint) {
89
+ const noBackend = noBackendFailure(host.signInHint);
90
+ return { kind: 'failed', failure: { ...noBackend, message: `Cannot provision a database: ${noBackend.message}` } };
91
+ }
92
+ const accountRead = await readAccount(host);
93
+ if (accountRead.kind === 'failed')
94
+ return { kind: 'failed', failure: { ...accountRead.failure, code: 'signed-out' } };
95
+ const credential = selectProvisionCredential(accountRead.value, host.signInHint);
96
+ if (credential.mode === 'error') {
97
+ return { kind: 'failed', failure: { code: 'signed-out', message: `Cannot provision a database: ${credential.reason}` } };
98
+ }
99
+ const account = accountRead.value;
100
+ return {
101
+ kind: 'ok',
102
+ value: { apiEndpoint, modulesEndpoint, credential, ...(account?.email ? { email: account.email } : {}), ...(account?.agent ? { agent: account.agent } : {}) },
103
+ };
104
+ }
105
+ /**
106
+ * What provision_database and replace_database check before they change
107
+ * anything: a backend and an account to provision under, and a binding whose
108
+ * values are of their form. They act on no bound database; a replace names
109
+ * the one the directory leaves.
110
+ */
111
+ export async function provisionDatabaseReady(replace, cwd) {
112
+ const access = await provisionAccess(getHost());
113
+ if (access.kind === 'failed')
114
+ return access;
115
+ const bound = await boundDatabase(cwd);
116
+ if (bound.kind === 'failed')
117
+ return bound;
118
+ const replaces = replace ? bound.value : undefined;
119
+ return {
120
+ kind: 'ok',
121
+ value: {
122
+ kind: 'account',
123
+ apiEndpoint: access.value.apiEndpoint,
124
+ account: {
125
+ userId: access.value.credential.ownerId,
126
+ ...(access.value.email ? { email: access.value.email } : {}),
127
+ ...(access.value.agent ? { agent: access.value.agent } : {}),
128
+ },
129
+ ...(replaces ? { replaces } : {}),
130
+ },
131
+ };
46
132
  }
47
133
  // The per-DB endpoints are subdomain.<domain>; the provisioning domain is the api
48
- // endpoint's host minus its first label (api.localhost -> localhost,
49
- // api.launchql.dev -> launchql.dev), so dev and devnet both provision correctly.
134
+ // endpoint's host minus its first label (api.example.com -> example.com), so
135
+ // every backend provisions under its own domain.
50
136
  function provisionDomain(apiEndpoint) {
51
137
  try {
52
138
  const { hostname } = new URL(apiEndpoint);
@@ -69,8 +155,18 @@ function pollDeadline(ms) {
69
155
  const projectLocks = new Map();
70
156
  // One provision per project at a time: a second call waits, then sees what
71
157
  // the first one left (a binding, a recorded ticket) instead of racing it.
158
+ // The key is resolved synchronously, so a call takes its place in the queue
159
+ // before it yields and calls queue in call order.
160
+ function lockKey(cwd) {
161
+ try {
162
+ return realpathSync(cwd);
163
+ }
164
+ catch {
165
+ return path.resolve(cwd);
166
+ }
167
+ }
72
168
  async function withProjectLock(cwd, fn) {
73
- const key = await realpath(cwd).catch(() => path.resolve(cwd));
169
+ const key = lockKey(cwd);
74
170
  const previous = projectLocks.get(key) ?? Promise.resolve();
75
171
  let release = noop;
76
172
  const done = new Promise((resolve) => (release = resolve));
@@ -91,40 +187,34 @@ async function withProjectLock(cwd, fn) {
91
187
  * entry point: replace mode refuses a live binding here, and `abandonPending`
92
188
  * and `adopt` are honoured.
93
189
  */
94
- export function provisionDatabase(input, ctx, exec = run) {
95
- return withProjectLock(ctx.cwd, () => provision(input, ctx.cwd, exec, false));
190
+ export async function provisionDatabase(input, ctx, exec = run) {
191
+ return withoutFailure(await withProjectLock(ctx.cwd, () => provision(input, ctx.cwd, exec, false)));
96
192
  }
97
193
  /**
98
- * The provision_database tool's entry point: its `reprovision: true` may
194
+ * The entry point of provision_database and replace_database: a replace may
99
195
  * replace a live binding (a clean rebuild), unless the host turned tool
100
196
  * reprovisioning off.
101
197
  */
102
- export function provisionFromTool(input, ctx, exec = run) {
103
- return withProjectLock(ctx.cwd, () => provision(input, ctx.cwd, exec, true));
198
+ export async function provisionFromTool(input, ctx, exec = run) {
199
+ const outcome = await withProjectLock(ctx.cwd, () => provision(input, ctx.cwd, exec, true));
200
+ return { details: withoutFailure(outcome), ...(outcome.failure ? { failure: outcome.failure } : {}) };
104
201
  }
105
202
  async function provision(input, cwd, exec, viaTool) {
106
203
  const name = input.databaseName?.trim();
107
204
  if (!name)
108
- return failure('failed', 'database_name is required.');
109
- // The host's backend config is the only endpoint source: the account bearer
110
- // provisions with it, so an ambient env var or a guessed default must never
111
- // redirect it.
205
+ return refuse('invalid-input', { message: 'The database needs a name.' });
112
206
  const host = getHost();
113
- const backend = host.backendConfig();
114
- const apiEndpoint = backend?.apiEndpoint;
115
- const modulesEndpoint = backend?.modulesEndpoint;
116
- if (!apiEndpoint || !modulesEndpoint) {
117
- return failure('failed', `Cannot provision a database: ${noBackendReason(host.signInHint)}`);
118
- }
119
- // Every project provisions UNDER the account (requestDatabase owns the
120
- // database to the JWT user). The account bearer authenticates the mutation
121
- // and the probes.
122
- const credential = selectProvisionCredential(host.account(), host.signInHint);
123
- if (credential.mode === 'error') {
124
- return failure('signed-out', `Cannot provision a database: ${credential.reason}`);
207
+ const access = await provisionAccess(host);
208
+ if (access.kind === 'failed') {
209
+ const { code, ...why } = access.failure;
210
+ return refuse(code, why);
125
211
  }
212
+ const { apiEndpoint, modulesEndpoint, credential } = access.value;
126
213
  const envPath = path.join(cwd, '.env');
127
- const env = readEnv(await readText(envPath));
214
+ const binding = await readBinding(envPath);
215
+ if (binding.kind === 'failed')
216
+ return refuse('missing-credentials', binding.failure);
217
+ const env = binding.value;
128
218
  const bound = env.DATABASE_ID || undefined;
129
219
  const r = {
130
220
  host,
@@ -154,7 +244,7 @@ async function provision(input, cwd, exec, viaTool) {
154
244
  }
155
245
  if (input.adopt) {
156
246
  const prewarm = startPrewarm(r, exec);
157
- return bindDatabase(r, { databaseId: input.adopt, replaced, adopted: true }, prewarm);
247
+ return afterPrewarm(await bindDatabase(r, { databaseId: input.adopt, replaced, adopted: true }, prewarm), prewarm);
158
248
  }
159
249
  return requestAndBind(r, input, env, replaced, exec);
160
250
  }
@@ -162,19 +252,30 @@ async function provision(input, cwd, exec, viaTool) {
162
252
  async function keepBinding(r, env, bound, adopt) {
163
253
  const probe = await r.probe(bound);
164
254
  if (probe.status === 'unreachable') {
165
- return failure('backend-unreachable', `Cannot verify the existing database binding (DATABASE_ID=${bound}): ${probe.detail}. Retry once the backend answers; don't reprovision on an unreachable backend.`, { databaseId: bound });
255
+ return unanswered(probe, `Cannot verify the existing database binding (DATABASE_ID=${bound}): ${probe.detail}.`, "Retry once the backend answers; don't reprovision on an unreachable backend.", { databaseId: bound });
166
256
  }
167
257
  if (probe.status === 'missing') {
168
- return failure('db-missing', `Project carries a binding (DATABASE_ID=${bound}) but that database no longer exists on this backend, or this account lost access to it. ${reprovisionAdvice(r.host)}`, { databaseId: bound });
258
+ return refuse('db-missing', {
259
+ message: `Project carries a binding (DATABASE_ID=${bound}) but that database no longer exists on this backend, or this account lost access to it.`,
260
+ hint: reprovisionAdvice(r.host),
261
+ ...replaceCall(r.host),
262
+ }, { databaseId: bound });
169
263
  }
170
264
  if (probe.ownerId && probe.ownerId !== r.ownerId) {
171
- return failure('account-mismatch', `Project carries a binding (DATABASE_ID=${bound}) but that database was provisioned under a different account than the one signed in. ${reprovisionAdvice(r.host)}`, { databaseId: bound });
265
+ return refuse('account-mismatch', {
266
+ message: `Project carries a binding (DATABASE_ID=${bound}) but that database was provisioned under a different account than the one signed in.`,
267
+ hint: reprovisionAdvice(r.host),
268
+ ...replaceCall(r.host),
269
+ }, { databaseId: bound });
172
270
  }
173
271
  if (probe.status === 'suspended') {
174
- return failure('db-suspended', suspendedText(bound, probe), { databaseId: bound });
272
+ return refuse('db-suspended', { message: suspendedText(bound, probe) }, { databaseId: bound });
175
273
  }
176
274
  if (adopt && adopt !== bound) {
177
- return failure('binding-live', `The project is bound to a live database (DATABASE_ID=${bound}); adopt binds only an unbound project. Use replace mode to swap it.`, { databaseId: bound });
275
+ return refuse('binding-live', {
276
+ message: `The project is bound to a live database (DATABASE_ID=${bound}); adopt binds only an unbound project.`,
277
+ hint: 'Use replace mode to swap it.',
278
+ }, { databaseId: bound });
178
279
  }
179
280
  // Heal stale endpoint pins and missing binding keys on the skip path.
180
281
  const databaseName = env.DATABASE_NAME || probe.name || '';
@@ -209,10 +310,10 @@ async function keepBinding(r, env, bound, adopt) {
209
310
  note = ` Refreshed in .env: ${keys}.`;
210
311
  }
211
312
  catch (err) {
212
- note = ` Could not refresh ${keys} in .env: ${errorText(err)}.`;
313
+ note = ` Could not refresh ${keys} in .env: ${thrownText(err)}.`;
213
314
  }
214
315
  }
215
- const advice = r.host.toolReprovision === false ? '' : ' Pass reprovision: true only for an explicit clean rebuild.';
316
+ const advice = r.host.toolReprovision === false ? '' : ' Replacing it with a new database is a separate change, only for an explicit clean rebuild.';
216
317
  return {
217
318
  success: true,
218
319
  message: `Project already provisioned (DATABASE_ID=${bound}) and the database is live under this account. Skipping.${advice}${note}`,
@@ -229,24 +330,30 @@ function suspendedText(databaseId, probe) {
229
330
  // ---- replace: compare and swap -------------------------------------------
230
331
  async function checkReplace(r, input, bound) {
231
332
  if (r.viaTool && r.host.toolReprovision === false) {
232
- return failure('reprovision-not-allowed', `provision_database can't replace this project's database: the app replaces a database only after the user approves it. ${reprovisionAdvice(r.host)}`);
333
+ return refuse('reprovision-not-allowed', {
334
+ message: "This project's database is not replaced here: the app replaces a database only after the user approves it.",
335
+ hint: reprovisionAdvice(r.host),
336
+ });
233
337
  }
234
338
  const expected = input.replaces === undefined ? bound : input.replaces || undefined;
235
339
  if ((expected ?? '') !== (bound ?? '')) {
236
- return failure('binding-changed', `The project's binding changed (DATABASE_ID is ${bound ?? 'unset'}, expected ${expected ?? 'unset'}), so nothing was replaced.`, { databaseId: bound });
340
+ return refuse('binding-changed', {
341
+ message: `The project's binding changed (DATABASE_ID is ${bound ?? 'unset'}, expected ${expected ?? 'unset'}), so nothing was replaced.`,
342
+ }, { databaseId: bound });
237
343
  }
238
344
  if (!bound)
239
345
  return null;
240
346
  const probe = await r.probe(bound);
241
347
  if (probe.status === 'unreachable') {
242
- return failure('backend-unreachable', `Cannot verify the binding being replaced (DATABASE_ID=${bound}): ${probe.detail}. Retry once the backend answers.`, { databaseId: bound });
348
+ return unanswered(probe, `Cannot verify the binding being replaced (DATABASE_ID=${bound}): ${probe.detail}.`, 'Retry once the backend answers.', { databaseId: bound });
349
+ }
350
+ if (probe.status === 'suspended') {
351
+ return refuse('db-suspended', { message: suspendedText(bound, probe) }, { databaseId: bound });
243
352
  }
244
- if (probe.status === 'suspended')
245
- return failure('db-suspended', suspendedText(bound, probe), { databaseId: bound });
246
353
  // A missing or foreign-owned binding is replaced; a live one of this account
247
354
  // only through the tool's explicit rebuild.
248
355
  if (probe.status === 'found' && (!probe.ownerId || probe.ownerId === r.ownerId) && !r.viaTool) {
249
- return failure('binding-live', `The bound database (DATABASE_ID=${bound}) is live under this account, so it wasn't replaced.`, { databaseId: bound });
356
+ return refuse('binding-live', { message: `The bound database (DATABASE_ID=${bound}) is live under this account, so it wasn't replaced.` }, { databaseId: bound });
250
357
  }
251
358
  return null;
252
359
  }
@@ -259,13 +366,26 @@ async function findInFlight(r, skip) {
259
366
  return { inFlight: tickets.filter((t) => t.id && !skip.has(t.id) && isTicketInFlight(t)) };
260
367
  }
261
368
  catch (err) {
369
+ if (answersSignedOut(err)) {
370
+ return {
371
+ inFlight: [],
372
+ refusal: refuse('signed-out', {
373
+ message: `The backend did not accept the account credential while this call checked for a provision of "${r.name}" already in progress. Nothing was requested.`,
374
+ hint: r.host.signInHint ?? 'Sign in again, then call again.',
375
+ }),
376
+ };
377
+ }
262
378
  if (isTransientProvisionError(err)) {
263
379
  return {
264
380
  inFlight: [],
265
- refusal: failure('backend-unreachable', `Could not check the backend for a provision of "${r.name}" already in progress (${errorText(err)}). Nothing was requested; retry once the backend answers.`),
381
+ refusal: refuse('backend-unreachable', {
382
+ message: `Could not check the backend for a provision of "${r.name}" already in progress (${thrownText(err)}). Nothing was requested.`,
383
+ hint: 'Retry once the backend answers.',
384
+ retryable: true,
385
+ }),
266
386
  };
267
387
  }
268
- return { inFlight: [], problem: errorText(err) };
388
+ return { inFlight: [], problem: thrownText(err) };
269
389
  }
270
390
  }
271
391
  const ticketOf = (r, ticket) => ({
@@ -275,12 +395,25 @@ const ticketOf = (r, ticket) => ({
275
395
  userId: r.ownerId,
276
396
  attempts: 0,
277
397
  });
398
+ // The packages/app scaffold + install don't need the database, so they run
399
+ // while the backend builds it. Best-effort: run_codegen re-runs the same
400
+ // idempotent steps. A pending call leaves it running; a retry joins that same
401
+ // run rather than starting a second install.
278
402
  function startPrewarm(r, exec) {
279
- // The packages/app scaffold + install are database-INDEPENDENT, so they run
280
- // alongside the provision. Best-effort: run_codegen re-runs the same
281
- // idempotent steps. A call that returns early leaves it running; a retry
282
- // joins that same run rather than starting a second install.
283
- return prewarmAppWorkspace(r.cwd, exec).catch((err) => ({ ok: false, out: errorText(err) }));
403
+ if (r.host.prewarmApp === false)
404
+ return Promise.resolve({ ok: false, out: 'The host prepares packages/app itself.' });
405
+ return prewarmAppWorkspace(r.cwd, exec).catch((err) => ({ ok: false, out: thrownText(err) }));
406
+ }
407
+ // The prewarm runs whether or not a database comes of the call, so a call that
408
+ // fails after it started waits for it and says what it left in packages/app.
409
+ async function afterPrewarm(outcome, prewarm) {
410
+ if (outcome.success || outcome.pending || !outcome.failure || !(await prewarm).ok)
411
+ return outcome;
412
+ const failure = {
413
+ ...outcome.failure,
414
+ message: `${outcome.failure.message.replace(/\.?$/, '.')} packages/app is ready for the next attempt.`,
415
+ };
416
+ return { ...outcome, failure, message: failureText(failure), appWorkspacePrepared: true };
284
417
  }
285
418
  async function requestAndBind(r, input, env, replaced, exec) {
286
419
  const abandoned = abandonedTickets(env);
@@ -302,7 +435,11 @@ async function requestAndBind(r, input, env, replaced, exec) {
302
435
  await abandon([recorded.ticketId]);
303
436
  }
304
437
  else if (recorded.databaseName !== r.name) {
305
- return failure('pending-other', `A provision of "${recorded.databaseName}" (ticket ${recorded.ticketId}) is still recorded for this project. Call provision_database with database_name "${recorded.databaseName}" to finish it; another name would start a second database.`, { ticketId: recorded.ticketId });
438
+ return refuse('pending-other', {
439
+ message: `A provision of "${recorded.databaseName}" (ticket ${recorded.ticketId}) is still recorded for this project.`,
440
+ hint: `Call again with the name "${recorded.databaseName}" to finish it; another name would start a second database.`,
441
+ calls: [suggest(againTool(r), { database_name: recorded.databaseName }, 'Finish the provision recorded for this project')],
442
+ }, { ticketId: recorded.ticketId });
306
443
  }
307
444
  else {
308
445
  current = recorded;
@@ -323,7 +460,6 @@ async function requestAndBind(r, input, env, replaced, exec) {
323
460
  recovered = true;
324
461
  }
325
462
  }
326
- const prewarm = startPrewarm(r, exec);
327
463
  // Resolve the module set: pinned base preset from node-type-registry, then
328
464
  // ordered overlays (host default < project-local provision.json). A bad
329
465
  // preset/manifest fails the run rather than provisioning a wrong module set.
@@ -339,8 +475,14 @@ async function requestAndBind(r, input, env, replaced, exec) {
339
475
  modules = resolveProvisionModules(layers);
340
476
  }
341
477
  catch (err) {
342
- return failure('failed', `Cannot resolve provision modules: ${errorText(err)}`);
478
+ return refuse('failed', { message: `Cannot resolve provision modules: ${thrownText(err)}` });
343
479
  }
480
+ const prewarm = startPrewarm(r, exec);
481
+ return afterPrewarm(await sendRequest(r, { current, recovered, abandoned, modules, replaced }, prewarm), prewarm);
482
+ }
483
+ async function sendRequest(r, request, prewarm) {
484
+ let { current, recovered } = request;
485
+ const { abandoned, modules, replaced } = request;
344
486
  // requestDatabase claims a warm-pool database when the module set matches a
345
487
  // cataloged preset and cold-provisions otherwise; the ticket is polled on the
346
488
  // modules endpoint until the database AND its owner bootstrap complete. An
@@ -374,6 +516,8 @@ async function requestAndBind(r, input, env, replaced, exec) {
374
516
  if (err instanceof ProvisionPendingError) {
375
517
  return pendingResult(r, ticketFor(err.ticketId), err.message, recovered);
376
518
  }
519
+ if (err instanceof ProvisionSignedOutError)
520
+ return signedOutWaiting(r, ticketFor(err.ticketId), err.message);
377
521
  if (err instanceof ProvisionTicketLostError) {
378
522
  // The ticket can't be read back, which doesn't mean the provision
379
523
  // stopped. Follow another in-flight one of this name, or stop without
@@ -391,7 +535,11 @@ async function requestAndBind(r, input, env, replaced, exec) {
391
535
  const checked = lookup.problem
392
536
  ? `the backend couldn't be asked for another one (${lookup.problem})`
393
537
  : 'no other provision of that name is in progress';
394
- return failure('ticket-lost', `The provision of "${r.name}" (ticket ${err.ticketId}) can no longer be found on this backend, and ${checked}. Nothing was created, and the record is cleared, so calling provision_database again requests a new database.`, { ticketId: err.ticketId });
538
+ return refuse('ticket-lost', {
539
+ message: `The provision of "${r.name}" (ticket ${err.ticketId}) can no longer be found on this backend, and ${checked}.`,
540
+ hint: 'Nothing was created, and the record is cleared, so calling again requests a new database.',
541
+ calls: [again(r, 'Request the database again')],
542
+ }, { ticketId: err.ticketId });
395
543
  }
396
544
  // A definitive failure ends the recorded request, so forget it.
397
545
  if (current)
@@ -421,25 +569,109 @@ async function pendingResult(r, ticket, reason, recovered) {
421
569
  recordedOk = false;
422
570
  }
423
571
  if (ticket.attempts > MAX_PENDING_ATTEMPTS) {
424
- return failure('provision-stuck', `Database "${r.name}" is still not ready after ${MAX_PENDING_ATTEMPTS} waits (${reason}). Its request (ticket ${ticketId}) stays recorded, and no other database is requested while it is in progress. Check the backend's provisioning jobs.`, { ticketId });
572
+ return refuse('provision-stuck', {
573
+ message: `Database "${r.name}" is still not ready after ${MAX_PENDING_ATTEMPTS} waits (${reason}). Its request (ticket ${ticketId}) stays recorded, and no other database is requested while it is in progress.`,
574
+ hint: "Check the backend's provisioning jobs.",
575
+ }, { ticketId });
425
576
  }
426
- const again = `call provision_database again with database_name "${r.name}"${r.mode === 'replace' && r.viaTool ? ' and reprovision: true' : ''}`;
577
+ const waiting = `call again with the same name, "${r.name}", to keep waiting on it`;
427
578
  const message = recordedOk
428
- ? `Database "${r.name}" is still provisioning (${reason}). The request is recorded in .env; ${again} to keep waiting on it. Don't change the name: that starts a second database.`
429
- : `Database "${r.name}" is still provisioning (${reason}). Recording its ticket in .env failed, but the backend still has it: ${again} to keep waiting on it. Don't change the name: that starts a second database.`;
430
- return { success: false, message, pending: true, ticketId, ...(recovered ? { recovered: true } : {}) };
579
+ ? `Database "${r.name}" is still provisioning (${reason}). The request is recorded in .env; ${waiting}. Don't change the name: that starts a second database.`
580
+ : `Database "${r.name}" is still provisioning (${reason}). Recording its ticket in .env failed, but the backend still has it: ${waiting}. Don't change the name: that starts a second database.`;
581
+ return {
582
+ success: false,
583
+ message,
584
+ pending: true,
585
+ ticketId,
586
+ ...(recovered ? { recovered: true } : {}),
587
+ // No details code: a pending call has not failed, it has not finished.
588
+ failure: {
589
+ code: 'provision-pending',
590
+ message,
591
+ retryable: true,
592
+ calls: [again(r, 'Keep waiting on the recorded request')],
593
+ },
594
+ };
595
+ }
596
+ // A failed ticket stores the job's error text, not a GraphQL error, so the
597
+ // code a refusal raised and PostgreSQL's own unique-violation text are the
598
+ // only signals it has; the request's own GraphQL answer has a code.
599
+ const TICKET_CODE_RE = /^(?:\[[^\]]*\]\s*)?([A-Z][A-Z0-9_]+)\b/;
600
+ const TICKET_UNIQUE_RE = /duplicate key value violates unique constraint/;
601
+ /** The public code of a refusal: from the request's GraphQL answer, or from a failed ticket. */
602
+ function refusalCode(err) {
603
+ if (err instanceof ProvisionJobError)
604
+ return TICKET_CODE_RE.exec(err.ticketError)?.[1];
605
+ const errors = err?.errors;
606
+ if (!Array.isArray(errors))
607
+ return undefined;
608
+ const code = errors.find((error) => error?.extensions?.class !== 'internal')?.extensions?.code;
609
+ return typeof code === 'string' ? code : undefined;
610
+ }
611
+ const isNameTaken = (err) => refusalCode(err) === 'UNIQUE_VIOLATION' || (err instanceof ProvisionJobError && TICKET_UNIQUE_RE.test(err.ticketError));
612
+ const REFUSED = 'Database provisioning was refused';
613
+ // The tool of the same call again: a replace from the tool is its own tool.
614
+ const againTool = (r) => (r.mode === 'replace' && r.viaTool ? 'replace_database' : 'provision_database');
615
+ // The same call again, with the same name.
616
+ const again = (r, why) => suggest(againTool(r), { database_name: r.name }, why);
617
+ const anotherName = (r) => suggest(againTool(r), {}, 'Request the database under a name that is free', ['database_name']);
618
+ // The backend refused a read of the provision because the sign-in ended. The provision may still be running, so its
619
+ // ticket stays recorded, and the next call after a sign-in waits on it instead of requesting another database.
620
+ async function signedOutWaiting(r, ticket, reason) {
621
+ const recorded = await updateEnvFile(r.envPath, (content) => recordPendingTicket(content, ticket)).then(() => true, () => false);
622
+ return refuse('signed-out', {
623
+ message: `The backend did not accept the account credential while it read the provision of "${r.name}" (ticket ${ticket.ticketId}): ${reason}. ` +
624
+ `The database may still be on its way${recorded ? ', and the request stays recorded in .env' : ''}.`,
625
+ hint: `${r.host.signInHint ?? 'Sign in again'}, then call again with the same name to keep waiting on it. Don't change the name: that starts a second database.`,
626
+ calls: [again(r, 'Keep waiting on the recorded request once signed in')],
627
+ }, { ticketId: ticket.ticketId });
431
628
  }
432
- const NAME_TAKEN_RE = /already exists|already taken|already in use|duplicate/i;
433
629
  async function requestFailure(r, err) {
434
- const detail = errorText(err);
435
- if (!NAME_TAKEN_RE.test(detail))
436
- return failure('failed', `Database provisioning failed: ${detail}.`);
630
+ const detail = thrownText(err);
631
+ if (answersSignedOut(err)) {
632
+ return refuse('signed-out', {
633
+ message: `${REFUSED}${refusalCode(err) ? ` (${refusalCode(err)})` : ''}: the backend did not accept the account credential.`,
634
+ hint: r.host.signInHint ?? 'Sign in again, then call again.',
635
+ });
636
+ }
637
+ switch (refusalCode(err)) {
638
+ case 'BILLING_PLAN_REQUIRED':
639
+ return refuse('plan-required', {
640
+ message: `${REFUSED} (BILLING_PLAN_REQUIRED): this account has no active plan, and this backend requires one before it creates a database.`,
641
+ hint: 'Choose a plan for this account under Billing → Plans in the Constructive dashboard, then call again.',
642
+ calls: [again(r, 'Request the database again once the account has a plan')],
643
+ });
644
+ case 'LIMIT_REACHED':
645
+ return refuse('limit-reached', {
646
+ message: `${REFUSED} (LIMIT_REACHED): this account has as many databases as its plan allows.`,
647
+ hint: 'Delete a database this account no longer needs, or choose a plan that allows more under Billing → Plans in the Constructive dashboard, then call again.',
648
+ calls: [again(r, 'Request the database again once the account has room for it')],
649
+ });
650
+ case 'BILLING_QUOTA_EXCEEDED':
651
+ return refuse('limit-reached', {
652
+ message: `${REFUSED} (BILLING_QUOTA_EXCEEDED): this account has used up the allowance of its plan.`,
653
+ hint: 'Choose a plan with a larger allowance under Billing → Plans in the Constructive dashboard, or wait for the allowance to renew, then call again.',
654
+ calls: [again(r, 'Request the database again once the allowance allows it')],
655
+ });
656
+ default:
657
+ break;
658
+ }
659
+ if (!isNameTaken(err))
660
+ return refuse('failed', { message: `Database provisioning failed: ${detail}.` });
437
661
  const heldBy = await ownHolder(r);
438
662
  if (heldBy) {
439
663
  const when = heldBy.createdAt ? `, requested ${heldBy.createdAt}` : '';
440
- return failure('name-taken', `Database provisioning failed: ${detail}. The name "${r.name}" belongs to a database this account provisioned earlier (ID ${heldBy.databaseId}${when}) that this project isn't bound to, so it was not bound. Re-run with a different database_name.`, { heldBy });
441
- }
442
- return failure('name-taken', `Database provisioning failed: ${detail}. The database name is already taken on the backend; re-run with a different database_name.`);
664
+ return refuse('name-taken', {
665
+ message: `Database provisioning failed: ${detail}. The name "${r.name}" belongs to a database this account provisioned earlier (ID ${heldBy.databaseId}${when}) that this project isn't bound to, so it was not bound.`,
666
+ hint: 'Call again with another database name.',
667
+ calls: [anotherName(r)],
668
+ }, { heldBy });
669
+ }
670
+ return refuse('name-taken', {
671
+ message: `Database provisioning failed: ${detail}. The database name is already taken on the backend.`,
672
+ hint: 'Call again with another database name.',
673
+ calls: [anotherName(r)],
674
+ });
443
675
  }
444
676
  // A completed provision of this name by this account whose database still
445
677
  // exists under it: reported with name-taken so the host can adopt it.
@@ -473,7 +705,15 @@ async function saveBinding(r, binding, ticket) {
473
705
  // Keep the ticket recorded, so the next call resumes it and binds it.
474
706
  if (ticket)
475
707
  await updateEnvFile(r.envPath, (content) => recordPendingTicket(content, ticket)).catch(noop);
476
- return failure('binding-not-saved', `Database "${binding.databaseName}" (ID ${binding.databaseId}) is ready, but the app couldn't save the binding (${errorText(err)}), so .env was left unchanged.${ticket ? ' Calling provision_database again with the same name binds it.' : ''}`, { databaseId: binding.databaseId, ...(ticket ? { ticketId: ticket.ticketId } : {}) });
708
+ return refuse('binding-not-saved', {
709
+ message: `Database "${binding.databaseName}" (ID ${binding.databaseId}) is ready, but the app couldn't save the binding (${thrownText(err)}), so .env was left unchanged.`,
710
+ ...(ticket
711
+ ? {
712
+ hint: 'Calling again with the same name binds it.',
713
+ calls: [again(r, 'Bind the database that is ready')],
714
+ }
715
+ : {}),
716
+ }, { databaseId: binding.databaseId, ...(ticket ? { ticketId: ticket.ticketId } : {}) });
477
717
  }
478
718
  }
479
719
  async function bindDatabase(r, bind, prewarm) {
@@ -485,7 +725,7 @@ async function bindDatabase(r, bind, prewarm) {
485
725
  if (ticket) {
486
726
  return pendingResult(r, ticket, `provisioned, but its owner couldn't be confirmed: ${owner.detail}`, bind.recovered);
487
727
  }
488
- return failure('backend-unreachable', `Cannot verify database ${databaseId}: ${owner.detail}. Retry once the backend answers.`);
728
+ return unanswered(owner, `Cannot verify database ${databaseId}: ${owner.detail}.`, 'Retry once the backend answers.');
489
729
  }
490
730
  const visible = owner.status !== 'missing';
491
731
  if (!visible || owner.ownerId !== r.ownerId) {
@@ -493,12 +733,18 @@ async function bindDatabase(r, bind, prewarm) {
493
733
  await updateEnvFile(r.envPath, clearPendingTicket).catch(noop);
494
734
  const why = visible ? "it isn't owned by" : "it isn't visible to";
495
735
  if (bind.adopted) {
496
- return failure(visible ? 'account-mismatch' : 'db-missing', `Database ${databaseId} was not bound: ${why} the signed-in account.`);
736
+ return refuse(visible ? 'account-mismatch' : 'db-missing', {
737
+ message: `Database ${databaseId} was not bound: ${why} the signed-in account.`,
738
+ });
497
739
  }
498
- return failure('failed', `Database provisioning returned database ${databaseId}, but ${why} the signed-in account, so it was not bound. Call provision_database again to request a new database.`);
740
+ return refuse('failed', {
741
+ message: `Database provisioning returned database ${databaseId}, but ${why} the signed-in account, so it was not bound.`,
742
+ hint: 'Call again to request a new database.',
743
+ calls: [again(r, 'Request a new database')],
744
+ });
499
745
  }
500
746
  if (bind.adopted && owner.status === 'suspended') {
501
- return failure('db-suspended', suspendedText(databaseId, owner));
747
+ return refuse('db-suspended', { message: suspendedText(databaseId, owner) });
502
748
  }
503
749
  const saved = await saveBinding(r, {
504
750
  cwd: r.cwd,
@@ -523,22 +769,21 @@ async function bindDatabase(r, bind, prewarm) {
523
769
  })));
524
770
  }
525
771
  catch (err) {
526
- return failure('env-write-failed', `Database provisioned (ID: ${databaseId}) but writing .env failed: ${errorText(err)}`, { databaseId });
772
+ return refuse('env-write-failed', { message: `Database provisioned (ID: ${databaseId}) but writing .env failed: ${thrownText(err)}` }, { databaseId });
527
773
  }
528
774
  // Settle the concurrent prewarm so the scaffold + install are in place before
529
775
  // run_codegen runs. A failure here is non-fatal: run_codegen redoes the work.
530
- const prewarmed = (await prewarm).ok ? ' packages/app prewarmed.' : '';
776
+ const prewarmed = (await prewarm).ok ? ' packages/app is ready.' : '';
531
777
  const notes = [
532
- bind.resumed ? ' Finished the provision an earlier call had started.' : '',
533
- bind.recovered ? ' Found it on the backend by name: its ticket was no longer recorded.' : '',
778
+ bind.resumed ? ' Finished an earlier request.' : '',
779
+ bind.recovered ? ' Found it on the backend by name.' : '',
534
780
  prewarmed,
535
- bind.replaced
536
- ? ' Previous binding archived in .env (old database kept); rebuild the schema with provision_blueprint + run_codegen.'
537
- : '',
781
+ bind.replaced ? ' The old binding is archived in .env, and the old database keeps its data. Build the schema again here.' : '',
538
782
  ].join('');
783
+ const named = `${r.name} (${databaseId.slice(0, 8)})`;
539
784
  const message = bind.adopted
540
- ? `Bound database "${r.name}" (ID: ${databaseId}), which this account provisioned earlier. Binding written to .env.${notes}`
541
- : `Provisioned database "${r.name}" (ID: ${databaseId}). Binding written to .env.${notes}`;
785
+ ? `Bound this directory to ${named}. Wrote .env.${notes}`
786
+ : `Created ${named} and bound this directory to it. Wrote .env.${notes}`;
542
787
  return {
543
788
  success: true,
544
789
  message,