import type { DeployResult } from './deploy.js'; export const DEPLOY_HELP = [ 'No login is required. This command provisions a temporary site and returns repository access. Commit and push the documentation yourself; the CLI does not upload files.', 'Run from your documentation directory, or pass --directory. Put docs.json, pages, and assets at the hosted repository root.', 'Run again from the same documentation directory for the current anonymous site and a fresh write token. Use --new --subdomain to create another site.', 'Claimed sites are managed in the dashboard. Confirmed expired sites start a new anonymous registration.', 'Pass --email to obtain a claim link for the user. If it is absent, ask the user for their email and rerun with --email from the same directory. Never invent an email address.', 'To claim an existing site without provisioning, run mint claim --email . Show the link to the user and ask them to return the displayed code. Then run mint claim --code . Use the original documentation directory for both commands, or pass --directory.', 'The output contains a short-lived write token. Do not paste it into public logs or save it in a Git remote.', ].join('\n\n'); export function deploymentInstructions(result: DeployResult, claimUrl?: string): string { if (result.status !== 'ready') return ''; return [ '\nNext steps:', '1. Clone the hosted repository into a separate directory. Do not replace the user’s existing Git remote.', '2. Copy the selected documentation into its root, including docs.json, .md/.mdx pages, images, and other required assets. Exclude credentials, .env files, node_modules, and .git.', '3. Commit the documentation. For subsequent updates, fetch the hosted main branch and commit on top of it. Do not force-push.', '4. Push to main. Supply the write token as an HTTP Authorization: Bearer header for this Git operation only; never embed it in the remote URL or persist it in Git config.', '5. If the write token expires, run mint deploy again from the same documentation directory to obtain a fresh token.', 'A successful push starts the normal build. Provisioning and Git success do not confirm build success.', '', 'Git examples (POSIX shell): set REPOSITORY_URL and WRITE_TOKEN from the output above. Set CHECKOUT_DIR to a new directory outside the source documentation directory. Keep the token private and do not enable shell tracing.', 'GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${REPOSITORY_URL}.extraHeader" GIT_CONFIG_VALUE_0="Authorization: Bearer ${WRITE_TOKEN}" git clone "$REPOSITORY_URL" "$CHECKOUT_DIR"', 'After copying and committing the documentation:', 'GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${REPOSITORY_URL}.extraHeader" GIT_CONFIG_VALUE_0="Authorization: Bearer ${WRITE_TOKEN}" git -C "$CHECKOUT_DIR" push origin HEAD:main', 'These settings apply only to that Git process. Use the same authentication settings for later fetches.', '', ...(claimUrl ? [ `Claim link for the user: ${claimUrl}`, 'Show this link to the user. Ask them to open it, sign in, and return the displayed code. Do not sign in on their behalf.', 'After the user returns the code, run mint claim --code from the same documentation directory (or repeat --directory). The CLI completes the claim using its saved credentials.', ] : [ 'Ask the user for the email address they want to use to claim this site. Never invent an email address.', 'After they provide it, run mint deploy --email from the same documentation directory (or repeat --directory). This reuses the site and returns its claim link.', ]), ].join('\n'); }