create-autopilotseo
v0.4.1
Published
Write .autopilotseo.json, blog/{site} folders, and sync AutoPilot SEO articles into a generic-site hub.
Readme
create-autopilotseo
Write .autopilotseo.json for a generic multi-site hub. Posts go in blog/{hostname}/. The API key is never written to that JSON file.
npx create-autopilotseo login
npx create-autopilotseo
npx create-autopilotseo sync
npx create-autopilotseo --list
npx create-autopilotseo --site example.comlogin opens autopilotseo.net, you sign in, and the CLI stores a key at ~/.config/autopilotseo/credentials.json. After that you can run the CLI without --api-key.
With no flags in a terminal, the CLI lists your projects. Use ↑↓ (or j/k) and Enter to pick one. It then lists that project's sites (the project domain plus Search Console properties on the connected Google account) and asks which one to import — or All. A spinner shows while sites load, folders are written, and articles are pulled. That writes .autopilotseo.json and blog/{site}/, then downloads AutoPilot SEO drafts into those folders. q or Ctrl-C cancels. If the project has no sites, the CLI asks for a hostname (for example example.com).
sync re-pulls articles into the folders already listed in .autopilotseo.json without showing the site picker. It overwrites local files for those articles. It does not mark posts published in AutoPilot SEO (that happens after they are live). --skip-sync writes the config and empty folders only.
--list prints every project id, then the Search Console sites on this Google account, and does not write files. --list --project-id shows one project. --site connects one hostname. --no-prompt (or a non-TTY / CI=1) skips the menu and connects every project that has a domain. Repeat --site to add more hostnames; existing sites[] entries are merged, not replaced.
You can still pass a key instead of logging in:
npx create-autopilotseo --api-key oseo_YOUR_KEY --site example.com
AUTOPILOTSEO_API_KEY=oseo_YOUR_KEY npx create-autopilotseo --site example.comCreate a key at https://autopilotseo.net/settings if you prefer that path. OPENSEO_API_KEY is accepted as well.
Options
| Flag | Meaning |
| -------------------- | -------------------------------------------------------------------------------------------------------------- |
| login | Open AutoPilot SEO in the browser and store an API key locally. |
| logout | Delete the stored API key. |
| sync | Pull AutoPilot SEO articles into the folders already in .autopilotseo.json. |
| --api-key | AutoPilot SEO API key (oseo_…). Or set AUTOPILOTSEO_API_KEY. |
| --api-url | MCP URL (default: https://autopilotseo.net/mcp). Login uses this origin. Or set AUTOPILOTSEO_API_URL. Local dashboard: http://localhost:3001/mcp. |
| --list | Print projects, then Search Console sites on this Google account, and exit. Does not write .autopilotseo.json. |
| --no-prompt | Skip the project menu; connect every project that has a domain. |
| --skip-sync | Write .autopilotseo.json and blog/{site}/ only; do not pull articles. |
| --site, -s | Hostname, or hostname:projectId. Repeatable. |
| --project-id, -p | With --site, bind that site. With --list, show only that project. |
| --dir, -C | Repo root (default: current directory). |
| --framework | nextjs, astro, hugo, eleventy, gatsby, nuxt, jekyll, remix, cms, other (default: other). |
| --extension | md, mdx, or mdoc (default: mdx). |
| --route-prefix | Public path prefix (default: /blog). |
| --layout | collection-file, date-prefixed-file, or slug-folder. |
| --force | Convert a single-site .autopilotseo.json (top-level projectId) into blog/{site} + sites[]. |
| --dry-run | Print the file to stdout without writing. |
| --help, -h | Show usage. |
If .autopilotseo.json already uses blog/{site} and sites[], a new --site is appended (same hostname updates projectId when you pass one).
A single-site file such as { "projectId": "...", "contentDir": "src/content/blog" } is left alone unless you pass --force.
Programmatic use
import { mergeAutopilotSeoConfig } from "create-autopilotseo";
const next = mergeAutopilotSeoConfig(existingJson, {
sites: [{ site: "example.com", projectId: "00000000-0000-0000-0000-000000000001" }],
});