drivethrough-cli 0.1.35 → 0.1.37
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/main.mjs +17 -3
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -40322,7 +40322,7 @@ function registerTools(server, ctx) {
|
|
|
40322
40322
|
{
|
|
40323
40323
|
outputSchema: OUTPUT_SCHEMAS.deploy_site,
|
|
40324
40324
|
title: "Deploy site",
|
|
40325
|
-
description: `Deploy a site to Drivethrough. Idempotent: creates the site if needed, else ships a new version. Sites are private by default. ${deploySources} Images and other binary assets \u2014 pick the route by where the bytes live: already at a public URL \u2192 {path, source_url} (fetched server-side); ${binaryRoutes}already deployed on this site \u2192 {path, from_path} copies it server-side (with delete_paths, a move). Never base64-encode a file, by hand or in code \u2014 inline base64 is capped at 1 MB and is only for tiny pasted assets; a file shipped via upload_id is referenced, never additionally inlined. To rework an already-deployed site, read it back with get_site first, then deploy with mode "patch" \u2014 only the files that change. For small text changes to existing files, use edit_site instead: it sends find/replace pairs, never whole files. Every deploy's version number is a restore point: prior versions stay listed (get_site history), diffable, viewable (preview_site), and returnable (revert_site). A successful deploy may still return \`warnings\` \u2014 things that will bite at runtime but only for visitors, never for you: a form type anonymous visitors can write with no page loading the Turnstile widget, or a page that fetches a data type its visitors have no permission to read. Resolve them before telling the user it works.`,
|
|
40325
|
+
description: `Deploy a site to Drivethrough. Idempotent: creates the site if needed, else ships a new version. Sites are private by default. ${deploySources} An account's first deploy needs a username (it starts every site address): if the deploy returns username_required, ask the user to confirm the suggested one or pick their own, then retry with \`username\`. Images and other binary assets \u2014 pick the route by where the bytes live: already at a public URL \u2192 {path, source_url} (fetched server-side); ${binaryRoutes}already deployed on this site \u2192 {path, from_path} copies it server-side (with delete_paths, a move). Never base64-encode a file, by hand or in code \u2014 inline base64 is capped at 1 MB and is only for tiny pasted assets; a file shipped via upload_id is referenced, never additionally inlined. To rework an already-deployed site, read it back with get_site first, then deploy with mode "patch" \u2014 only the files that change. For small text changes to existing files, use edit_site instead: it sends find/replace pairs, never whole files. Every deploy's version number is a restore point: prior versions stay listed (get_site history), diffable, viewable (preview_site), and returnable (revert_site). A successful deploy may still return \`warnings\` \u2014 things that will bite at runtime but only for visitors, never for you: a form type anonymous visitors can write with no page loading the Turnstile widget, or a page that fetches a data type its visitors have no permission to read. Resolve them before telling the user it works.`,
|
|
40326
40326
|
// Destructive: the default "replace" mode drops every deployed file the
|
|
40327
40327
|
// call doesn't re-send, and delete_paths removes files outright. Prior
|
|
40328
40328
|
// versions stay revertible, but the live site does lose content.
|
|
@@ -40355,6 +40355,9 @@ function registerTools(server, ctx) {
|
|
|
40355
40355
|
),
|
|
40356
40356
|
site: external_exports.string().optional().describe('Site name (defaults to drivethrough.json "site" or the folder name)'),
|
|
40357
40357
|
title: external_exports.string().optional().describe("Human title shown to guests"),
|
|
40358
|
+
username: external_exports.string().optional().describe(
|
|
40359
|
+
"The account's username, set on its first deploy only \u2014 pass it after a username_required error, once the user has confirmed or chosen it. Every site address starts with it. Ignored when the account already has one."
|
|
40360
|
+
),
|
|
40358
40361
|
mode: external_exports.enum(["replace", "patch"]).optional().describe(
|
|
40359
40362
|
'"patch" carries every unchanged file forward from the currently deployed version \u2014 send only the files that change (and/or delete_paths). Default "replace": the files given are the whole site.'
|
|
40360
40363
|
),
|
|
@@ -40369,6 +40372,7 @@ function registerTools(server, ctx) {
|
|
|
40369
40372
|
files,
|
|
40370
40373
|
site: site2,
|
|
40371
40374
|
title,
|
|
40375
|
+
username,
|
|
40372
40376
|
mode,
|
|
40373
40377
|
delete_paths,
|
|
40374
40378
|
base_version
|
|
@@ -40463,9 +40467,19 @@ function registerTools(server, ctx) {
|
|
|
40463
40467
|
form.set("base_version", String(base_version));
|
|
40464
40468
|
}
|
|
40465
40469
|
const finalTitle = title ?? config2?.title;
|
|
40466
|
-
const
|
|
40470
|
+
const createSite = () => ctx.api.request("POST", "/v1/sites", {
|
|
40467
40471
|
body: { sitename, ...finalTitle ? { title: finalTitle } : {} }
|
|
40468
40472
|
});
|
|
40473
|
+
let siteRes;
|
|
40474
|
+
try {
|
|
40475
|
+
siteRes = await createSite();
|
|
40476
|
+
} catch (error62) {
|
|
40477
|
+
if (!(username && error62 instanceof ToolApiError && error62.body.error.code === "username_required")) {
|
|
40478
|
+
throw error62;
|
|
40479
|
+
}
|
|
40480
|
+
await ctx.api.request("POST", "/v1/account/username", { body: { username } });
|
|
40481
|
+
siteRes = await createSite();
|
|
40482
|
+
}
|
|
40469
40483
|
const deploy = await ctx.api.request(
|
|
40470
40484
|
"POST",
|
|
40471
40485
|
`${sitePath(siteRes.site.id)}/deployments`,
|
|
@@ -41503,7 +41517,7 @@ Custom domains (paid plans): manage_domain attaches a domain the user already ow
|
|
|
41503
41517
|
},
|
|
41504
41518
|
schedules: { cycle: { every: "3h", rotate: "quote", action: "show" } }
|
|
41505
41519
|
});
|
|
41506
|
-
INTEGRATION_REFERENCE = `Integrations are declared in the site's drivethrough.json and deployed with deploy_site, like any other file. Keys: "secrets" lists the key names (values are set by the user via create_integration_setup_link, never in chat or a file). "routes" maps a same-origin path under /api/ext/<name> to an upstream, allowing only the listed "methods" and "paths" prefixes, adding "headers" server-side (\${NAME} inserts a secret); "access" is "owner" (default), "viewers" or "public"; "cache" and "query" are optional. "actions" declare a POST ("post" URL, "headers", JSON "body" where {{field}} inserts a row's field); a type with "on_write": "<action>" sends it when a visitor's form or the owner's button on the page saves a row \u2014 never for write_db, imports or schedule pulls. "schedules" repeat every 1h/3h/6h/12h/1d/1w/1mo (no cron strings, times of day or timezones): "rotate": "<type>" with "action" sends the next row of the type through the action; "pull": {route, path, into, map} saves a route's JSON response as a new row ("map" uses $.dotted.paths; numeric strings become numbers). They pause after 10 failures in a row (the owner gets one email) until the next deploy. "webhooks" receive events another service POSTs to https://<site>/api/hook/<name>: "verify" is "stripe", "github", "standard" (Standard Webhooks: Resend, Clerk, Svix\u2026), "hmac_sha256" (with "header": the signature header's name) or, only for services that can't sign, "url_token"; "secret" names the declared secret; "map" (same $.paths) fills a row of "into". Unverified, duplicate and replayed deliveries are never stored. Every mistake is refused at deploy time with the corrected snippet \u2014 follow it. Two complete examples \u2014 a read-only brokerage dashboard that also snapshots equity hourly for a chart: ${INTEGRATION_EXAMPLE_A} \u2014 and a display that shows a quote when the owner clicks, and cycles through saved quotes every 3 hours: ${INTEGRATION_EXAMPLE_B}.`;
|
|
41520
|
+
INTEGRATION_REFERENCE = `Integrations are declared in the site's drivethrough.json and deployed with deploy_site, like any other file. Keys: "secrets" lists the key names (values are set by the user via create_integration_setup_link, never in chat or a file). "routes" maps a same-origin path under /api/ext/<name> to an upstream, allowing only the listed "methods" and "paths" prefixes, adding "headers" server-side (\${NAME} inserts a secret); "access" is "owner" (default), "viewers" or "public"; "cache" and "query" are optional. "actions" declare a POST ("post" URL, "headers", JSON "body" where {{field}} inserts a row's field); a type with "on_write": "<action>" sends it when a visitor's form or the owner's button on the page saves a row \u2014 never for write_db, imports or schedule pulls. Visitors get "rate_limit": "20/hour" on such a type unless it sets its own. "schedules" repeat every 1h/3h/6h/12h/1d/1w/1mo (no cron strings, times of day or timezones): "rotate": "<type>" with "action" sends the next row of the type through the action; "pull": {route, path, into, map} saves a route's JSON response as a new row ("map" uses $.dotted.paths; numeric strings become numbers). They pause after 10 failures in a row (the owner gets one email) until the next deploy. "webhooks" receive events another service POSTs to https://<site>/api/hook/<name>: "verify" is "stripe", "github", "standard" (Standard Webhooks: Resend, Clerk, Svix\u2026), "hmac_sha256" (with "header": the signature header's name) or, only for services that can't sign, "url_token"; "secret" names the declared secret; "map" (same $.paths) fills a row of "into". Unverified, duplicate and replayed deliveries are never stored. Every mistake is refused at deploy time with the corrected snippet \u2014 follow it. Two complete examples \u2014 a read-only brokerage dashboard that also snapshots equity hourly for a chart: ${INTEGRATION_EXAMPLE_A} \u2014 and a display that shows a quote when the owner clicks, and cycles through saved quotes every 3 hours: ${INTEGRATION_EXAMPLE_B}.`;
|
|
41507
41521
|
}
|
|
41508
41522
|
});
|
|
41509
41523
|
|