@forumulate/cli 0.9.0 → 0.11.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 (240) hide show
  1. package/README.md +3 -3
  2. package/dist/api/args.d.ts.map +1 -1
  3. package/dist/api/args.js +1 -0
  4. package/dist/api/args.js.map +1 -1
  5. package/dist/api/command.d.ts +1 -1
  6. package/dist/api/command.d.ts.map +1 -1
  7. package/dist/api/command.js +86 -11
  8. package/dist/api/command.js.map +1 -1
  9. package/dist/api/http.d.ts +8 -0
  10. package/dist/api/http.d.ts.map +1 -1
  11. package/dist/api/http.js +3 -2
  12. package/dist/api/http.js.map +1 -1
  13. package/dist/api/live-spec.d.ts +48 -0
  14. package/dist/api/live-spec.d.ts.map +1 -0
  15. package/dist/api/live-spec.js +72 -0
  16. package/dist/api/live-spec.js.map +1 -0
  17. package/dist/api/operations.json +1 -1
  18. package/dist/api/request.d.ts.map +1 -1
  19. package/dist/api/request.js +25 -1
  20. package/dist/api/request.js.map +1 -1
  21. package/dist/api/send.d.ts +10 -1
  22. package/dist/api/send.d.ts.map +1 -1
  23. package/dist/api/send.js +14 -3
  24. package/dist/api/send.js.map +1 -1
  25. package/dist/api/slim.d.ts +14 -0
  26. package/dist/api/slim.d.ts.map +1 -0
  27. package/dist/api/slim.js +174 -0
  28. package/dist/api/slim.js.map +1 -0
  29. package/dist/cache-command.d.ts +12 -0
  30. package/dist/cache-command.d.ts.map +1 -0
  31. package/dist/cache-command.js +93 -0
  32. package/dist/cache-command.js.map +1 -0
  33. package/dist/check/command.d.ts +48 -0
  34. package/dist/check/command.d.ts.map +1 -0
  35. package/dist/check/command.js +256 -0
  36. package/dist/check/command.js.map +1 -0
  37. package/dist/check/external.d.ts +66 -0
  38. package/dist/check/external.d.ts.map +1 -0
  39. package/dist/check/external.js +177 -0
  40. package/dist/check/external.js.map +1 -0
  41. package/dist/check/markdown-links.d.ts +38 -0
  42. package/dist/check/markdown-links.d.ts.map +1 -0
  43. package/dist/check/markdown-links.js +166 -0
  44. package/dist/check/markdown-links.js.map +1 -0
  45. package/dist/cli.js +42 -7
  46. package/dist/cli.js.map +1 -1
  47. package/dist/commands/completion.d.ts.map +1 -1
  48. package/dist/commands/completion.js +3 -0
  49. package/dist/commands/completion.js.map +1 -1
  50. package/dist/commands/context.d.ts.map +1 -1
  51. package/dist/commands/context.js +6 -2
  52. package/dist/commands/context.js.map +1 -1
  53. package/dist/commands/groups-api.d.ts.map +1 -1
  54. package/dist/commands/groups-api.js +20 -2
  55. package/dist/commands/groups-api.js.map +1 -1
  56. package/dist/commands/groups-docs.d.ts.map +1 -1
  57. package/dist/commands/groups-docs.js +8 -2
  58. package/dist/commands/groups-docs.js.map +1 -1
  59. package/dist/commands/groups-jobs.d.ts +10 -0
  60. package/dist/commands/groups-jobs.d.ts.map +1 -0
  61. package/dist/commands/groups-jobs.js +89 -0
  62. package/dist/commands/groups-jobs.js.map +1 -0
  63. package/dist/commands/groups-org.d.ts.map +1 -1
  64. package/dist/commands/groups-org.js +59 -2
  65. package/dist/commands/groups-org.js.map +1 -1
  66. package/dist/commands/groups-site.d.ts.map +1 -1
  67. package/dist/commands/groups-site.js +33 -3
  68. package/dist/commands/groups-site.js.map +1 -1
  69. package/dist/commands/groups-spaces.d.ts.map +1 -1
  70. package/dist/commands/groups-spaces.js +11 -5
  71. package/dist/commands/groups-spaces.js.map +1 -1
  72. package/dist/commands/groups-types.d.ts.map +1 -1
  73. package/dist/commands/groups-types.js +74 -0
  74. package/dist/commands/groups-types.js.map +1 -1
  75. package/dist/commands/groups.d.ts.map +1 -1
  76. package/dist/commands/groups.js +2 -0
  77. package/dist/commands/groups.js.map +1 -1
  78. package/dist/commands/index.d.ts +9 -0
  79. package/dist/commands/index.d.ts.map +1 -1
  80. package/dist/commands/index.js +18 -3
  81. package/dist/commands/index.js.map +1 -1
  82. package/dist/commands/job-wait.d.ts +64 -0
  83. package/dist/commands/job-wait.d.ts.map +1 -0
  84. package/dist/commands/job-wait.js +91 -0
  85. package/dist/commands/job-wait.js.map +1 -0
  86. package/dist/commands/resource.d.ts +19 -0
  87. package/dist/commands/resource.d.ts.map +1 -1
  88. package/dist/commands/resource.js +65 -3
  89. package/dist/commands/resource.js.map +1 -1
  90. package/dist/content/library.d.ts +8 -0
  91. package/dist/content/library.d.ts.map +1 -1
  92. package/dist/content/library.js +10 -2
  93. package/dist/content/library.js.map +1 -1
  94. package/dist/credentials.d.ts +43 -4
  95. package/dist/credentials.d.ts.map +1 -1
  96. package/dist/credentials.js +67 -4
  97. package/dist/credentials.js.map +1 -1
  98. package/dist/doctor/address-checks.d.ts +56 -0
  99. package/dist/doctor/address-checks.d.ts.map +1 -0
  100. package/dist/doctor/address-checks.js +183 -0
  101. package/dist/doctor/address-checks.js.map +1 -0
  102. package/dist/doctor/boilerplate.d.ts +33 -0
  103. package/dist/doctor/boilerplate.d.ts.map +1 -0
  104. package/dist/doctor/boilerplate.js +78 -0
  105. package/dist/doctor/boilerplate.js.map +1 -0
  106. package/dist/doctor/command.d.ts +18 -0
  107. package/dist/doctor/command.d.ts.map +1 -0
  108. package/dist/doctor/command.js +234 -0
  109. package/dist/doctor/command.js.map +1 -0
  110. package/dist/doctor/crawl.d.ts +49 -0
  111. package/dist/doctor/crawl.d.ts.map +1 -0
  112. package/dist/doctor/crawl.js +210 -0
  113. package/dist/doctor/crawl.js.map +1 -0
  114. package/dist/doctor/extended.d.ts +52 -0
  115. package/dist/doctor/extended.d.ts.map +1 -0
  116. package/dist/doctor/extended.js +150 -0
  117. package/dist/doctor/extended.js.map +1 -0
  118. package/dist/doctor/page-checks.d.ts +42 -0
  119. package/dist/doctor/page-checks.d.ts.map +1 -0
  120. package/dist/doctor/page-checks.js +200 -0
  121. package/dist/doctor/page-checks.js.map +1 -0
  122. package/dist/doctor/probe.d.ts +63 -0
  123. package/dist/doctor/probe.d.ts.map +1 -0
  124. package/dist/doctor/probe.js +170 -0
  125. package/dist/doctor/probe.js.map +1 -0
  126. package/dist/doctor/reader-auth-atlas.d.ts +18 -0
  127. package/dist/doctor/reader-auth-atlas.d.ts.map +1 -0
  128. package/dist/doctor/reader-auth-atlas.js +50 -0
  129. package/dist/doctor/reader-auth-atlas.js.map +1 -0
  130. package/dist/doctor/robots-params.d.ts +36 -0
  131. package/dist/doctor/robots-params.d.ts.map +1 -0
  132. package/dist/doctor/robots-params.js +97 -0
  133. package/dist/doctor/robots-params.js.map +1 -0
  134. package/dist/doctor/site.d.ts +42 -0
  135. package/dist/doctor/site.d.ts.map +1 -0
  136. package/dist/doctor/site.js +82 -0
  137. package/dist/doctor/site.js.map +1 -0
  138. package/dist/doctor.d.ts +21 -0
  139. package/dist/doctor.d.ts.map +1 -1
  140. package/dist/doctor.js +94 -3
  141. package/dist/doctor.js.map +1 -1
  142. package/dist/exit-codes.d.ts +40 -0
  143. package/dist/exit-codes.d.ts.map +1 -0
  144. package/dist/exit-codes.js +66 -0
  145. package/dist/exit-codes.js.map +1 -0
  146. package/dist/help-commands.d.ts +14 -0
  147. package/dist/help-commands.d.ts.map +1 -0
  148. package/dist/help-commands.js +264 -0
  149. package/dist/help-commands.js.map +1 -0
  150. package/dist/help.d.ts +1 -1
  151. package/dist/help.d.ts.map +1 -1
  152. package/dist/help.js +67 -11
  153. package/dist/help.js.map +1 -1
  154. package/dist/io.d.ts +33 -0
  155. package/dist/io.d.ts.map +1 -0
  156. package/dist/io.js +81 -0
  157. package/dist/io.js.map +1 -0
  158. package/dist/plan/command.d.ts +51 -0
  159. package/dist/plan/command.d.ts.map +1 -0
  160. package/dist/plan/command.js +182 -0
  161. package/dist/plan/command.js.map +1 -0
  162. package/dist/plan/document.d.ts +24 -0
  163. package/dist/plan/document.d.ts.map +1 -0
  164. package/dist/plan/document.js +208 -0
  165. package/dist/plan/document.js.map +1 -0
  166. package/dist/plan/markdown-dir.d.ts +64 -0
  167. package/dist/plan/markdown-dir.d.ts.map +1 -0
  168. package/dist/plan/markdown-dir.js +191 -0
  169. package/dist/plan/markdown-dir.js.map +1 -0
  170. package/dist/plan/output.d.ts +59 -0
  171. package/dist/plan/output.d.ts.map +1 -0
  172. package/dist/plan/output.js +102 -0
  173. package/dist/plan/output.js.map +1 -0
  174. package/dist/preview-comment.d.ts +20 -0
  175. package/dist/preview-comment.d.ts.map +1 -0
  176. package/dist/preview-comment.js +88 -0
  177. package/dist/preview-comment.js.map +1 -0
  178. package/dist/publish/about.d.ts +23 -0
  179. package/dist/publish/about.d.ts.map +1 -0
  180. package/dist/publish/about.js +66 -0
  181. package/dist/publish/about.js.map +1 -0
  182. package/dist/publish/command.d.ts +20 -0
  183. package/dist/publish/command.d.ts.map +1 -1
  184. package/dist/publish/command.js +97 -4
  185. package/dist/publish/command.js.map +1 -1
  186. package/dist/publish/context.d.ts +8 -0
  187. package/dist/publish/context.d.ts.map +1 -1
  188. package/dist/publish/context.js.map +1 -1
  189. package/dist/publish/docs-apply.d.ts.map +1 -1
  190. package/dist/publish/docs-apply.js +13 -1
  191. package/dist/publish/docs-apply.js.map +1 -1
  192. package/dist/publish/extras.d.ts +10 -0
  193. package/dist/publish/extras.d.ts.map +1 -1
  194. package/dist/publish/extras.js +54 -2
  195. package/dist/publish/extras.js.map +1 -1
  196. package/dist/publish/manifest.d.ts.map +1 -1
  197. package/dist/publish/manifest.js +27 -2
  198. package/dist/publish/manifest.js.map +1 -1
  199. package/dist/publish/preview.d.ts +56 -0
  200. package/dist/publish/preview.d.ts.map +1 -0
  201. package/dist/publish/preview.js +133 -0
  202. package/dist/publish/preview.js.map +1 -0
  203. package/dist/publish/redirects.d.ts +13 -0
  204. package/dist/publish/redirects.d.ts.map +1 -0
  205. package/dist/publish/redirects.js +154 -0
  206. package/dist/publish/redirects.js.map +1 -0
  207. package/dist/publish/scan.d.ts +2 -0
  208. package/dist/publish/scan.d.ts.map +1 -1
  209. package/dist/publish/scan.js +1 -0
  210. package/dist/publish/scan.js.map +1 -1
  211. package/dist/publish/studio-edits.d.ts +25 -0
  212. package/dist/publish/studio-edits.d.ts.map +1 -0
  213. package/dist/publish/studio-edits.js +53 -0
  214. package/dist/publish/studio-edits.js.map +1 -0
  215. package/dist/publish/types.d.ts +22 -1
  216. package/dist/publish/types.d.ts.map +1 -1
  217. package/dist/publish-command.d.ts +55 -0
  218. package/dist/publish-command.d.ts.map +1 -0
  219. package/dist/publish-command.js +197 -0
  220. package/dist/publish-command.js.map +1 -0
  221. package/dist/run.d.ts +3 -10
  222. package/dist/run.d.ts.map +1 -1
  223. package/dist/run.js +152 -120
  224. package/dist/run.js.map +1 -1
  225. package/dist/translations/target.d.ts.map +1 -1
  226. package/dist/translations/target.js +2 -2
  227. package/dist/translations/target.js.map +1 -1
  228. package/dist/validate.d.ts +39 -0
  229. package/dist/validate.d.ts.map +1 -0
  230. package/dist/validate.js +166 -0
  231. package/dist/validate.js.map +1 -0
  232. package/dist/version.d.ts +8 -0
  233. package/dist/version.d.ts.map +1 -0
  234. package/dist/version.js +11 -0
  235. package/dist/version.js.map +1 -0
  236. package/dist/whoami.d.ts +41 -0
  237. package/dist/whoami.d.ts.map +1 -0
  238. package/dist/whoami.js +161 -0
  239. package/dist/whoami.js.map +1 -0
  240. package/package.json +2 -2
package/dist/help.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** `forumulate help`. The resource groups print their own (`forumulate spaces --help`). */
2
- export declare const HELP = "forumulate \u2014 Forumulate command-line interface\n\nUsage:\n forumulate <command> [args]\n\nCommands:\n login [--token <pat>] Store a token for this API, so every other\n command stops needing FORUMULATE_TOKEN in\n the environment\n logout Forget the stored token\n whoami Show the authenticated user\n config set|get|unset|list Defaults: org, space, library, api-version\n (`forumulate config set org acme`)\n\nEvery API operation:\n api list [--tag t] [--search w] Discover operations and their summaries\n api describe <operationId> Parameters and body schema, as flags\n api <operationId> [args] [flags] Call it: --<param> value, --data @f.json,\n api <METHOD> <path> [flags] --field a.b=v, --paginate, --json\n\nResources (each: <group> --help lists its verbs and the operation each calls):\n Org: orgs | members | invites | groups | roles | service-accounts (bots)\n tokens (pats) | webhooks | extensions | audit\n Spaces: spaces | snapshots | shape | domains | assets | space-types (types)\n Docs: items (pages) | docs | collections | versions | change-requests (crs)\n openapi | sdks | github (git)\n Content: blog | forum | changelog | roadmap | status | events | course\n careers | forms (blog/forum/changelog/status: translations \u2026)\n CMS: libraries | entries | media | releases | environments (envs)\n Site: theme | sites | reader\n search <query...> [--org] e.g. spaces create Docs --slug docs --type DOCS\n items create --space docs --file a.md --publish\n docs schedule set <pageId> <when> --space docs\n webhooks deliveries <id>; webhooks replay <id> <d>\n --out <file> where a file answer goes (SDK archive, PDF, CSV export)\n completion bash|zsh|fish Shell completion script\n\nOlder forms, unchanged:\n orgs List your organizations\n spaces <orgId> List spaces in an org\n items <orgId> <spaceId> List what is in a space, with where each\n piece's content lives\n search <orgId> <query...> Unified search across docs/forum/blog\n dev <folder> Preview a folder of Markdown locally, rendered\n by your space's own renderer; reloads on save.\n --org <id> --space <id> [--port 4321] [--site <your docs URL>]\n publish <folder> Publish a folder of Markdown: one folder per\n collection, front matter, assets, order,\n and a forumulate.yaml manifest for space,\n site, theme, OpenAPI and monitors. Re-runs\n change only what changed, then read back.\n --org <id|slug> --space <id|slug> (or org:/space: in the manifest)\n --dry-run print the plan, write nothing (no token needed for a\n public space)\n --prune remove pages/posts/collections with no file (to the trash)\n --only a,b just these slugs, files, folders, or manifest parts\n (site, theme, settings, openapi, monitors)\n --force re-send every page even if it looks unchanged\n --no-verify skip the read-back --pace <ms> gap between writes\n --manifest <file> a manifest somewhere else\n --diff print the changed paragraphs and fields of each update\n sync <folder> Content as code: the same folder publish,\n PLAN BY DEFAULT. Posts (blog), pages\n (docs, custom, legal), FAQ questions,\n changelog releases and blog categories,\n matched by slug; images uploaded once by\n content hash; README, LICENSE, _drafts/,\n dotfiles skipped. Guide:\n https://forumulate.com/guides/content-as-code\n --apply write the plan (then read it back)\n --prune also remove what has no file (to the trash)\n --diff print the changed paragraphs and fields of each update\n --org, --space, --only, --force, --no-verify, --pace, --manifest, --json\n as for publish\n publish <orgId> <spaceId> <pageId> Publish a page\n publish <orgId> <spaceId> <dir> The folder form, with org and space given\n domains <orgId> <spaceId> List this space's domains and their state\n domains verify <orgId> <spaceId> <hostname>\n Re-run verification and say what is missing\n snapshot <orgId> <spaceId> <label> Create a space version snapshot\n content types --library <id|slug> TypeScript for a content library's model:\n collections, globals, the block union\n [--org <id|slug>] [--out forumulate.d.ts] [--preview] [--schema <file>]\n [--check] fail (exit 1) when the file is out of date, write nothing\n content pull --library <id|slug> Write the model to forumulate.content.json\n [--format json|payload] [--out <file>] (payload: forumulate.payload.ts)\n content push [file] Show the diff against the library, then\n apply it as a new model version\n [--library \u2026] [--dry-run] [--yes] [--force]\n [--rename type.field=new | block:hero.field=new | library:field=new]\n [--rename-type old=new] [--rename-block old=new]\n import <payload|contentful|sanity|strapi|wordpress> <export path>\n Bring another CMS's content into a library:\n model, media, entries, references (always\n shows a dry run first)\n Re-running updates entries a\n previous import made. strapi takes a\n folder or an unencrypted export .tar.gz\n --library <id|slug> [--org \u2026] [--dry-run] [--yes]\n [--config payload.config.ts] (payload) the config that becomes the model\n [--publish source|all|none] what to publish (default: what was live)\n [--allow-model-removals] [--pace <ms>] [--base-url <url>] (strapi uploads)\n translations (alias i18n) Every translation capability, one vocabulary\n locales list|add|relabel|remove|set a space's (--space) or library's\n (--library) languages; set es=Espa\u00F1ol fr [--prune] is exact\n status each piece \u00D7 language: missing/draft/published/outdated\n [--locale es,fr] [--fail-on missing,outdated] (exit 1)\n pull one Markdown file per piece per language \u2192 [--out translations]\n [--locale \u2026] [--only slug,\u2026] [--include-missing] (stubs)\n push [dir] diff the files against the API, write what changed [--dry-run]\n auto machine-translate with YOUR DeepL/AI key --locale es\n [--state missing,outdated] [--only \u2026] [--force] [--publish]\n [--library \u2026 --entry id,\u2026] [--dry-run]\n labels pull|push [file] chrome words (--site <id> | --space \u2026)\n overrides pull|push [file] org UI string overrides [--prune]\n [--format json|xliff] for labels and overrides\n item-locale <itemId> <locale|none> correct a piece's declared language\n remove <pieceId> <locale> one translation (--yes)\n entry <entryId> <locale> a library entry's twin [--fields f.json]\n name <locale> <name\u2026> a space's (or --collection's) name\n switcher get|set <f.json> the org's reader language switcher\n provider status|connect|disconnect your DeepL key (DEEPL_API_KEY)\n conformance <collectionUrl> Run the Content Sync Protocol suite against\n any platform's collection endpoint\n doctor <readerUrl> Check a live site from the outside: health,\n public read, canonical, cache headers,\n crawler access, feeds, HTML rewriting\n help Show this help\n\nEnvironment:\n FORUMULATE_TOKEN Personal Access Token (Bearer). Overrides a stored one, so\n CI keeps working exactly as it did. Mint one at\n https://forumulate.com/account/tokens\n FORUMULATE_URL The site (default https://forumulate.com); the API is its\n /api, i.e. https://forumulate.com/api. A value already\n ending in /api is used as-is.\n FORUMULATE_API_URL Exact API base, for a local API with no /api prefix\n (http://localhost:4000). Wins over FORUMULATE_URL.\n FORUMULATE_ORG, FORUMULATE_SPACE, FORUMULATE_LIBRARY\n Defaults for --org, --space and --library; they beat\n `forumulate config set`, a flag beats both.\n FORUMULATE_API_VERSION\n Forumulate-Version for api/resource commands\n (default 2026-12-01).\n\nThe SDK (ForumulateClient.fromEnv) and the MCP server (@forumulate/mcp) read\nthe same variables. Guide: https://forumulate.com/guides/api-tokens-and-scopes\n\nFlags:\n --json Emit raw JSON instead of a formatted summary\n --dry-run (api, resources) print the request instead of sending it\n --dry-run Plan the work and write nothing (publish of a directory)\n --version Print the CLI version\n";
2
+ export declare const HELP = "forumulate \u2014 Forumulate command-line interface\n\nUsage:\n forumulate <command> [args]\n\nCommands:\n login [--token <pat>] Store a token for this API, so every other\n command stops needing FORUMULATE_TOKEN in\n the environment\n logout Forget the stored token\n whoami [--json] Who you are, and WHICH token: its source (--token,\n FORUMULATE_TOKEN or credentials.json), id, name,\n last 4, expiry, narrowing and the API base\n auth status [--json] The same report, for scripts\n config set|get|unset|list Defaults: org, space, library, api-version\n (`forumulate config set org acme`)\n\nEvery API operation:\n api list [--tag t] [--search w] Discover operations and their summaries\n [--refresh] ...from the live API's spec, not the bundled one\n api describe <operationId> Parameters and body schema, as flags\n api <operationId> [args] [flags] Call it: --<param> value, --data @f.json,\n api <METHOD> <path> [flags] --field a.b=v, --paginate, --json\n\nResources (each: <group> --help lists its verbs and the operation each calls):\n Org: orgs | members | invites | groups | roles | service-accounts (bots)\n tokens (pats) | keys | integration-tokens (int-tokens)\n webhooks | extensions | audit\n Spaces: spaces | snapshots | shape | domains | assets | space-types (types)\n Docs: items (pages) | docs | collections | versions | change-requests (crs)\n openapi | sdks | github (git)\n Content: blog | forum | changelog | roadmap | status | events | course\n careers | forms (blog/forum/changelog/status: translations \u2026)\n CMS: libraries | entries | media | releases | environments (envs)\n Site: theme | sites | reader\n Jobs: jobs | backups | imports | manifest (starters take --wait [--timeout s])\n search <query...> [--org] e.g. spaces create Docs --slug docs --type DOCS\n items create --space docs --file a.md --publish\n docs schedule set <pageId> <when> --space docs\n webhooks deliveries <id>; webhooks replay <id> <d>\n --out <file> where a file answer goes (SDK archive, PDF, CSV export)\n cache purge --space <s> [--page p] Drop cached copies (web tier + every CDN); deletes\n nothing\n completion bash|zsh|fish Shell completion script\n\nOlder forms, unchanged:\n orgs List your organizations\n spaces <orgId> List spaces in an org\n items <orgId> <spaceId> List what is in a space, with where each\n piece's content lives\n search <orgId> <query...> Unified search across docs/forum/blog\n dev <folder> Preview a folder of Markdown locally, rendered\n by your space's own renderer; reloads on save.\n --org <id> --space <id> [--port 4321] [--site <your docs URL>]\n publish <folder> --org <o> --space <s>\n Publish a folder of Markdown: one folder per\n collection, front matter, assets, order,\n and a forumulate.yaml manifest for space,\n site, theme, OpenAPI and monitors. Re-runs\n change only what changed, then read back.\n --org <id|slug> --space <id|slug> (or org:/space: in the manifest)\n --dry-run print the plan, write nothing (no token needed for a\n public space)\n --prune remove pages/posts/collections with no file (to the trash)\n --only a,b just these slugs, files, folders, or manifest parts\n (site, theme, settings, openapi, monitors)\n --force re-send every page even if it looks unchanged\n --no-verify skip the read-back --pace <ms> gap between writes\n --manifest <file> a manifest somewhere else\n --diff print the changed paragraphs and fields of each update\n --purge page|space|none what to drop from the cache (default page),\n reported per CDN\n --json one summary: created, updated, unchanged, trashed, purged,\n verify, diffUrl (the run is recorded; publish.completed fires)\n Pages edited in the studio since the last publish are not overwritten\n without --force. Full reference: forumulate publish --help\n sync <folder> Content as code: the same folder publish,\n PLAN BY DEFAULT. Posts (blog), pages\n (docs, custom, legal), FAQ questions,\n changelog releases and blog categories,\n matched by slug; images uploaded once by\n content hash; README, LICENSE, _drafts/,\n dotfiles skipped. Guide:\n https://forumulate.com/guides/content-as-code\n --apply write the plan (then read it back)\n --prune also remove what has no file (to the trash)\n --diff print the changed paragraphs and fields of each update\n --org, --space, --only, --force, --no-verify, --pace, --manifest, --json\n as for publish\n plan [forumulate.yaml] The whole site as one document (version: 2):\n spaces and their SEO, languages, front doors,\n contact form and About parts, Markdown pages\n with locale twins, redirects, sites. Prints\n the diff; writes nothing. --check exits 1\n when it is not empty. Full reference:\n forumulate plan --help\n apply [forumulate.yaml] Carry that plan out, idempotently, every\n write read back; --prune also removes what\n the manifest wrote and no longer declares\n check links [folder] Broken internal links, #anchors, pictures and\n (--external) outside links in a folder, before\n publishing; exit 1 when any is broken\n --space <s> [--org <o>] the same report for a published space\n --allow-redirect <hosts> --ignore <text> --json\n publish <folder> --preview <name> Send the change to a preview link instead of\n publishing it (--comment posts it on the PR)\n publish <orgId> <spaceId> <pageId> (deprecated) Publish a page \u2014 use items publish\n publish <orgId> <spaceId> <dir> (deprecated) \u2014 use publish <dir> --org --space\n domains <orgId> <spaceId> List this space's domains and their state\n domains verify <orgId> <spaceId> <hostname>\n Re-run verification and say what is missing\n snapshot <orgId> <spaceId> <label> Create a space version snapshot\n content types --library <id|slug> TypeScript for a content library's model:\n collections, globals, the block union\n [--org <id|slug>] [--out forumulate.d.ts] [--preview] [--schema <file>]\n [--check] fail (exit 1) when the file is out of date, write nothing\n content pull --library <id|slug> Write the model to forumulate.content.json\n [--format json|payload] [--out <file>] (payload: forumulate.payload.ts)\n content push [file] Show the diff against the library, then\n apply it as a new model version\n [--library \u2026] [--dry-run] [--yes] [--force]\n [--rename type.field=new | block:hero.field=new | library:field=new]\n [--rename-type old=new] [--rename-block old=new]\n import <payload|contentful|sanity|strapi|wordpress> <export path>\n Bring another CMS's content into a library:\n model, media, entries, references (always\n shows a dry run first)\n Re-running updates entries a\n previous import made. strapi takes a\n folder or an unencrypted export .tar.gz\n --library <id|slug> [--org \u2026] [--dry-run] [--yes]\n [--config payload.config.ts] (payload) the config that becomes the model\n [--publish source|all|none] what to publish (default: what was live)\n [--allow-model-removals] [--pace <ms>] [--base-url <url>] (strapi uploads)\n translations (alias i18n) Every translation capability, one vocabulary\n locales list|add|relabel|remove|set a space's (--space) or library's\n (--library) languages; set es=Espa\u00F1ol fr [--prune] is exact\n status each piece \u00D7 language: missing/draft/published/outdated\n [--locale es,fr] [--fail-on missing,outdated] (exit 1)\n pull one Markdown file per piece per language \u2192 [--out translations]\n [--locale \u2026] [--only slug,\u2026] [--include-missing] (stubs)\n push [dir] diff the files against the API, write what changed [--dry-run]\n auto machine-translate with YOUR DeepL/AI key --locale es\n [--state missing,outdated] [--only \u2026] [--force] [--publish]\n [--library \u2026 --entry id,\u2026] [--dry-run]\n labels pull|push [file] chrome words (--site <id> | --space \u2026)\n overrides pull|push [file] org UI string overrides [--prune]\n [--format json|xliff] for labels and overrides\n item-locale <itemId> <locale|none> correct a piece's declared language\n remove <pieceId> <locale> one translation (--yes)\n entry <entryId> <locale> a library entry's twin [--fields f.json]\n name <locale> <name\u2026> a space's (or --collection's) name\n switcher get|set <f.json> the org's reader language switcher\n provider status|connect|disconnect your DeepL key (DEEPL_API_KEY)\n conformance <collectionUrl> Run the Content Sync Protocol suite against\n any platform's collection endpoint\n validate [dir] Check forumulate.yaml, front matter and $schema\n files against the published schemas, with\n did-you-mean hints. --json; exit 2 if invalid\n doctor <readerUrl> | --site <s> Check a live site from the outside: health,\n canonical on both addresses, sitemap, cache\n consistency, root redirect, descriptions,\n llms.txt, favicon, consent tag, white-label\n leaks. --json; exit 1 on any FAIL\n help [command] Show this help, or a command's own\n (every command also takes --help)\n\nEnvironment:\n FORUMULATE_TOKEN Personal Access Token (Bearer). Overrides a stored one, so\n CI keeps working exactly as it did; --token overrides it.\n Mint one at\n https://forumulate.com/account/tokens\n FORUMULATE_URL The site (default https://forumulate.com); the API is its\n /api, i.e. https://forumulate.com/api. A value already\n ending in /api is used as-is.\n FORUMULATE_API_URL Exact API base, for a local API with no /api prefix\n (http://localhost:4000). Wins over FORUMULATE_URL.\n FORUMULATE_ORG, FORUMULATE_SPACE, FORUMULATE_LIBRARY\n Defaults for --org, --space and --library; they beat\n `forumulate config set`, a flag beats both.\n FORUMULATE_API_VERSION\n Forumulate-Version for api/resource commands\n (default 2026-12-01).\n\nThe SDK (ForumulateClient.fromEnv) and the MCP server (@forumulate/mcp) read\nthe same variables. Guide: https://forumulate.com/guides/api-tokens-and-scopes\n\nEvery FORUMULATE_* variable not listed above is reported (with the one you\nprobably meant) by `forumulate whoami` and on any authentication failure.\n\nFlags:\n --json Emit raw JSON instead of a formatted summary (stdout only;\n progress and warnings go to stderr)\n --out <file> Write stdout to a file (never truncated; non-zero exit if the\n write fails). content/translations use --out for their own file\n --jsonl With --paginate: one JSON row per line, streamed\n --token <pat> The token for this run, on every command. Precedence:\n --token, then FORUMULATE_TOKEN, then credentials.json. On an\n operation with a `token` parameter of its own (registries\n set, github connect, domains acme-challenge) the flag is that\n parameter; set FORUMULATE_TOKEN for the PAT there\n --dry-run (api, resources) print the request instead of sending it\n --dry-run Plan the work and write nothing (publish of a directory)\n --version Print the CLI version\n\nExit status:\n 0 ok 1 failed (verification mismatch, doctor FAIL) 2 usage\n 3 auth (no token, 401, token not allowed) 4 not found\n 5 conflict (409/412, edited in the studio since your last publish)\n";
3
3
  //# sourceMappingURL=help.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,eAAO,MAAM,IAAI,k2TAyJhB,CAAC"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,eAAO,MAAM,IAAI,+zbAiNhB,CAAC"}
package/dist/help.js CHANGED
@@ -12,19 +12,24 @@ Commands:
12
12
  command stops needing FORUMULATE_TOKEN in
13
13
  the environment
14
14
  logout Forget the stored token
15
- whoami Show the authenticated user
15
+ whoami [--json] Who you are, and WHICH token: its source (--token,
16
+ FORUMULATE_TOKEN or credentials.json), id, name,
17
+ last 4, expiry, narrowing and the API base
18
+ auth status [--json] The same report, for scripts
16
19
  config set|get|unset|list Defaults: org, space, library, api-version
17
20
  (\`forumulate config set org acme\`)
18
21
 
19
22
  Every API operation:
20
23
  api list [--tag t] [--search w] Discover operations and their summaries
24
+ [--refresh] ...from the live API's spec, not the bundled one
21
25
  api describe <operationId> Parameters and body schema, as flags
22
26
  api <operationId> [args] [flags] Call it: --<param> value, --data @f.json,
23
27
  api <METHOD> <path> [flags] --field a.b=v, --paginate, --json
24
28
 
25
29
  Resources (each: <group> --help lists its verbs and the operation each calls):
26
30
  Org: orgs | members | invites | groups | roles | service-accounts (bots)
27
- tokens (pats) | webhooks | extensions | audit
31
+ tokens (pats) | keys | integration-tokens (int-tokens)
32
+ webhooks | extensions | audit
28
33
  Spaces: spaces | snapshots | shape | domains | assets | space-types (types)
29
34
  Docs: items (pages) | docs | collections | versions | change-requests (crs)
30
35
  openapi | sdks | github (git)
@@ -32,11 +37,14 @@ Resources (each: <group> --help lists its verbs and the operation each calls):
32
37
  careers | forms (blog/forum/changelog/status: translations …)
33
38
  CMS: libraries | entries | media | releases | environments (envs)
34
39
  Site: theme | sites | reader
40
+ Jobs: jobs | backups | imports | manifest (starters take --wait [--timeout s])
35
41
  search <query...> [--org] e.g. spaces create Docs --slug docs --type DOCS
36
42
  items create --space docs --file a.md --publish
37
43
  docs schedule set <pageId> <when> --space docs
38
44
  webhooks deliveries <id>; webhooks replay <id> <d>
39
45
  --out <file> where a file answer goes (SDK archive, PDF, CSV export)
46
+ cache purge --space <s> [--page p] Drop cached copies (web tier + every CDN); deletes
47
+ nothing
40
48
  completion bash|zsh|fish Shell completion script
41
49
 
42
50
  Older forms, unchanged:
@@ -48,7 +56,8 @@ Older forms, unchanged:
48
56
  dev <folder> Preview a folder of Markdown locally, rendered
49
57
  by your space's own renderer; reloads on save.
50
58
  --org <id> --space <id> [--port 4321] [--site <your docs URL>]
51
- publish <folder> Publish a folder of Markdown: one folder per
59
+ publish <folder> --org <o> --space <s>
60
+ Publish a folder of Markdown: one folder per
52
61
  collection, front matter, assets, order,
53
62
  and a forumulate.yaml manifest for space,
54
63
  site, theme, OpenAPI and monitors. Re-runs
@@ -63,6 +72,12 @@ Older forms, unchanged:
63
72
  --no-verify skip the read-back --pace <ms> gap between writes
64
73
  --manifest <file> a manifest somewhere else
65
74
  --diff print the changed paragraphs and fields of each update
75
+ --purge page|space|none what to drop from the cache (default page),
76
+ reported per CDN
77
+ --json one summary: created, updated, unchanged, trashed, purged,
78
+ verify, diffUrl (the run is recorded; publish.completed fires)
79
+ Pages edited in the studio since the last publish are not overwritten
80
+ without --force. Full reference: forumulate publish --help
66
81
  sync <folder> Content as code: the same folder publish,
67
82
  PLAN BY DEFAULT. Posts (blog), pages
68
83
  (docs, custom, legal), FAQ questions,
@@ -76,8 +91,25 @@ Older forms, unchanged:
76
91
  --diff print the changed paragraphs and fields of each update
77
92
  --org, --space, --only, --force, --no-verify, --pace, --manifest, --json
78
93
  as for publish
79
- publish <orgId> <spaceId> <pageId> Publish a page
80
- publish <orgId> <spaceId> <dir> The folder form, with org and space given
94
+ plan [forumulate.yaml] The whole site as one document (version: 2):
95
+ spaces and their SEO, languages, front doors,
96
+ contact form and About parts, Markdown pages
97
+ with locale twins, redirects, sites. Prints
98
+ the diff; writes nothing. --check exits 1
99
+ when it is not empty. Full reference:
100
+ forumulate plan --help
101
+ apply [forumulate.yaml] Carry that plan out, idempotently, every
102
+ write read back; --prune also removes what
103
+ the manifest wrote and no longer declares
104
+ check links [folder] Broken internal links, #anchors, pictures and
105
+ (--external) outside links in a folder, before
106
+ publishing; exit 1 when any is broken
107
+ --space <s> [--org <o>] the same report for a published space
108
+ --allow-redirect <hosts> --ignore <text> --json
109
+ publish <folder> --preview <name> Send the change to a preview link instead of
110
+ publishing it (--comment posts it on the PR)
111
+ publish <orgId> <spaceId> <pageId> (deprecated) Publish a page — use items publish
112
+ publish <orgId> <spaceId> <dir> (deprecated) — use publish <dir> --org --space
81
113
  domains <orgId> <spaceId> List this space's domains and their state
82
114
  domains verify <orgId> <spaceId> <hostname>
83
115
  Re-run verification and say what is missing
@@ -126,14 +158,21 @@ Older forms, unchanged:
126
158
  provider status|connect|disconnect your DeepL key (DEEPL_API_KEY)
127
159
  conformance <collectionUrl> Run the Content Sync Protocol suite against
128
160
  any platform's collection endpoint
129
- doctor <readerUrl> Check a live site from the outside: health,
130
- public read, canonical, cache headers,
131
- crawler access, feeds, HTML rewriting
132
- help Show this help
161
+ validate [dir] Check forumulate.yaml, front matter and $schema
162
+ files against the published schemas, with
163
+ did-you-mean hints. --json; exit 2 if invalid
164
+ doctor <readerUrl> | --site <s> Check a live site from the outside: health,
165
+ canonical on both addresses, sitemap, cache
166
+ consistency, root redirect, descriptions,
167
+ llms.txt, favicon, consent tag, white-label
168
+ leaks. --json; exit 1 on any FAIL
169
+ help [command] Show this help, or a command's own
170
+ (every command also takes --help)
133
171
 
134
172
  Environment:
135
173
  FORUMULATE_TOKEN Personal Access Token (Bearer). Overrides a stored one, so
136
- CI keeps working exactly as it did. Mint one at
174
+ CI keeps working exactly as it did; --token overrides it.
175
+ Mint one at
137
176
  https://forumulate.com/account/tokens
138
177
  FORUMULATE_URL The site (default https://forumulate.com); the API is its
139
178
  /api, i.e. https://forumulate.com/api. A value already
@@ -150,10 +189,27 @@ Environment:
150
189
  The SDK (ForumulateClient.fromEnv) and the MCP server (@forumulate/mcp) read
151
190
  the same variables. Guide: https://forumulate.com/guides/api-tokens-and-scopes
152
191
 
192
+ Every FORUMULATE_* variable not listed above is reported (with the one you
193
+ probably meant) by \`forumulate whoami\` and on any authentication failure.
194
+
153
195
  Flags:
154
- --json Emit raw JSON instead of a formatted summary
196
+ --json Emit raw JSON instead of a formatted summary (stdout only;
197
+ progress and warnings go to stderr)
198
+ --out <file> Write stdout to a file (never truncated; non-zero exit if the
199
+ write fails). content/translations use --out for their own file
200
+ --jsonl With --paginate: one JSON row per line, streamed
201
+ --token <pat> The token for this run, on every command. Precedence:
202
+ --token, then FORUMULATE_TOKEN, then credentials.json. On an
203
+ operation with a \`token\` parameter of its own (registries
204
+ set, github connect, domains acme-challenge) the flag is that
205
+ parameter; set FORUMULATE_TOKEN for the PAT there
155
206
  --dry-run (api, resources) print the request instead of sending it
156
207
  --dry-run Plan the work and write nothing (publish of a directory)
157
208
  --version Print the CLI version
209
+
210
+ Exit status:
211
+ 0 ok 1 failed (verification mismatch, doctor FAIL) 2 usage
212
+ 3 auth (no token, 401, token not allowed) 4 not found
213
+ 5 conflict (409/412, edited in the studio since your last publish)
158
214
  `;
159
215
  //# sourceMappingURL=help.js.map
package/dist/help.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;AAAA,2FAA2F;AAC9E,QAAA,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyJnB,CAAC"}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;AAAA,2FAA2F;AAC9E,QAAA,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiNnB,CAAC"}
package/dist/io.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import type { Writable } from 'node:stream';
2
+ /**
3
+ * Where a command's output goes, and the promise that it got there (FMU-B02/D05).
4
+ *
5
+ * `--json` piped into another program stopped at exactly 65,536 or 131,072
6
+ * bytes: the CLI called `process.exit()` the moment the command returned, and
7
+ * on a pipe Node writes stdout asynchronously, so whatever was still queued
8
+ * was thrown away — `items list --json | wc -c` said 65536 while the same
9
+ * command into a file wrote 8 MB. A sink buffers nothing of its own; it writes
10
+ * through, counts what the stream has not yet flushed, and `finish()` waits for
11
+ * the stream to say every byte is handed to the OS before the process ends.
12
+ * A write the OS refuses (a closed pipe, a full disk) is remembered and turns
13
+ * into a non-zero exit, rather than a truncated file and an exit 0.
14
+ */
15
+ export interface Sink {
16
+ line(text: string): void;
17
+ /** Resolves once everything written is flushed; the first write error, if any. */
18
+ finish(): Promise<Error | undefined>;
19
+ }
20
+ export declare function streamSink(stream: Writable, opts?: {
21
+ closeOnFinish?: boolean;
22
+ }): Sink;
23
+ /**
24
+ * `--out <file>`: stdout into a file, opened on the first line so a command
25
+ * that prints nothing leaves no empty file behind. The write errors (no such
26
+ * directory, permission) surface on `finish()` like a pipe's.
27
+ */
28
+ export declare function fileSink(path: string): Sink;
29
+ /** Commands whose own `--out` means "the file this command writes", not "my stdout". */
30
+ export declare const OWNS_OUT: Set<string>;
31
+ /** The `--out` value a global redirect should use, or undefined. */
32
+ export declare function globalOut(argv: string[]): string | undefined;
33
+ //# sourceMappingURL=io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kFAAkF;IAClF,MAAM,IAAI,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;CACtC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,IAAI,CAoCzF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAW3C;AAED,wFAAwF;AACxF,eAAO,MAAM,QAAQ,aAA+C,CAAC;AAErE,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAQ5D"}
package/dist/io.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OWNS_OUT = void 0;
4
+ exports.streamSink = streamSink;
5
+ exports.fileSink = fileSink;
6
+ exports.globalOut = globalOut;
7
+ const node_fs_1 = require("node:fs");
8
+ function streamSink(stream, opts = {}) {
9
+ let failed;
10
+ stream.on('error', (e) => {
11
+ failed ??= e;
12
+ });
13
+ return {
14
+ line(text) {
15
+ if (failed)
16
+ return;
17
+ try {
18
+ stream.write(`${text}\n`);
19
+ }
20
+ catch (e) {
21
+ failed ??= e;
22
+ }
23
+ },
24
+ finish() {
25
+ return new Promise((resolve) => {
26
+ let settled = false;
27
+ const done = (e) => {
28
+ if (settled)
29
+ return;
30
+ settled = true;
31
+ resolve(failed ?? e ?? undefined);
32
+ };
33
+ if (failed)
34
+ return done();
35
+ // A stream that errors never finishes: listen for both.
36
+ stream.once('error', (e) => done(e));
37
+ // `end`'s callback carries the error, and Node runs it BEFORE the
38
+ // 'error' event: dropping its argument resolved "no error" for an
39
+ // `--out` into a missing directory, and the CLI exited 0 having
40
+ // written nothing.
41
+ if (opts.closeOnFinish)
42
+ stream.end((e) => done(e ?? undefined));
43
+ // An empty write's callback runs after every earlier write has flushed.
44
+ else
45
+ stream.write('', (e) => done(e ?? undefined));
46
+ });
47
+ },
48
+ };
49
+ }
50
+ /**
51
+ * `--out <file>`: stdout into a file, opened on the first line so a command
52
+ * that prints nothing leaves no empty file behind. The write errors (no such
53
+ * directory, permission) surface on `finish()` like a pipe's.
54
+ */
55
+ function fileSink(path) {
56
+ let inner;
57
+ return {
58
+ line(text) {
59
+ inner ??= streamSink((0, node_fs_1.createWriteStream)(path), { closeOnFinish: true });
60
+ inner.line(text);
61
+ },
62
+ finish() {
63
+ return inner ? inner.finish() : Promise.resolve(undefined);
64
+ },
65
+ };
66
+ }
67
+ /** Commands whose own `--out` means "the file this command writes", not "my stdout". */
68
+ exports.OWNS_OUT = new Set(['content', 'translations', 'i18n']);
69
+ /** The `--out` value a global redirect should use, or undefined. */
70
+ function globalOut(argv) {
71
+ const cmd = argv.find((a) => !a.startsWith('-'));
72
+ if (cmd && exports.OWNS_OUT.has(cmd))
73
+ return undefined;
74
+ const inline = argv.find((a) => a.startsWith('--out='));
75
+ if (inline)
76
+ return inline.slice(6) || undefined;
77
+ const at = argv.indexOf('--out');
78
+ const v = at >= 0 ? argv[at + 1] : undefined;
79
+ return v && !v.startsWith('--') ? v : undefined;
80
+ }
81
+ //# sourceMappingURL=io.js.map
package/dist/io.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.js","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":";;;AAsBA,gCAoCC;AAOD,4BAWC;AAMD,8BAQC;AA1FD,qCAA8D;AAsB9D,SAAgB,UAAU,CAAC,MAAgB,EAAE,OAAoC,EAAE;IACjF,IAAI,MAAyB,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC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C,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { ApiClient } from '../publish/client';
2
+ import { type ManifestAnswer } from './output';
3
+ /**
4
+ * `forumulate plan` and `forumulate apply` (DX-D): one `forumulate.yaml`
5
+ * (version 2) and its Markdown folders, planned as a diff and applied
6
+ * idempotently through `PUT /orgs/{org}/manifest` — the API's own planner and
7
+ * applier, so there is no second engine here that could disagree with it.
8
+ *
9
+ * What the CLI adds is only what needs the disk or the terminal: folders
10
+ * become pages, local images are uploaded once by content hash and their
11
+ * references rewritten, and a large apply is split into batches. The batches
12
+ * exist because an apply is a request, and a request through the edge is cut
13
+ * at 30 seconds while the work carries on: forty new pages, each written,
14
+ * published and read back, do not fit in one. So the plan is computed first
15
+ * and the CHANGED pages are sent a batch at a time, each request carrying
16
+ * every page already settled (which plans `unchanged` and costs a read); the
17
+ * last request is the whole document, and only it carries `prune`, so a
18
+ * prune always sees every page that is declared.
19
+ */
20
+ export interface PlanFlags {
21
+ command: 'plan' | 'apply';
22
+ file?: string;
23
+ org?: string;
24
+ prune: boolean;
25
+ json: boolean;
26
+ diff: boolean;
27
+ /** `plan --check`: exit 1 when the plan is not empty (drift detection in CI). */
28
+ check: boolean;
29
+ verbose: boolean;
30
+ /** Changed pages per apply request. */
31
+ batch: number;
32
+ }
33
+ export interface PlanCliDeps {
34
+ client: ApiClient;
35
+ out: (l: string) => void;
36
+ err: (l: string) => void;
37
+ env?: NodeJS.ProcessEnv;
38
+ upload?: (path: string, form: FormData) => Promise<unknown>;
39
+ cwd?: string;
40
+ }
41
+ type Body = Record<string, unknown>;
42
+ export declare function runPlanCommand(flags: PlanFlags, deps: PlanCliDeps): Promise<number>;
43
+ export declare function hasChanges(answer: ManifestAnswer): boolean;
44
+ /**
45
+ * The apply requests: every page the plan leaves alone is in all of them;
46
+ * the changed ones are added `size` at a time; the last request is the whole
47
+ * document, and is the only one that may prune.
48
+ */
49
+ export declare function batches(body: Body, plan: ManifestAnswer, size: number): Body[];
50
+ export {};
51
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/plan/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAExE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,iFAAiF;IACjF,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAkEzF;AAsBD,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAE1D;AA2DD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,CAiB9E"}
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runPlanCommand = runPlanCommand;
4
+ exports.hasChanges = hasChanges;
5
+ exports.batches = batches;
6
+ const api_1 = require("../publish/api");
7
+ const manifest_1 = require("../publish/manifest");
8
+ const rewrite_1 = require("../publish/rewrite");
9
+ const exit_codes_1 = require("../exit-codes");
10
+ const document_1 = require("./document");
11
+ const output_1 = require("./output");
12
+ async function runPlanCommand(flags, deps) {
13
+ const file = (0, manifest_1.findManifest)(deps.cwd ?? process.cwd(), flags.file);
14
+ if (!file) {
15
+ deps.err(`forumulate ${flags.command}: no forumulate.yaml here; pass the file: forumulate ${flags.command} path/to/forumulate.yaml`);
16
+ return exit_codes_1.EXIT.USAGE;
17
+ }
18
+ let doc;
19
+ try {
20
+ doc = (0, document_1.loadPlanDocument)(file);
21
+ }
22
+ catch (e) {
23
+ deps.err(e.message);
24
+ return exit_codes_1.EXIT.USAGE;
25
+ }
26
+ const org = flags.org ?? doc.org ?? deps.env?.FORUMULATE_ORG ?? process.env.FORUMULATE_ORG;
27
+ if (!org) {
28
+ deps.err('Which organization? Put `org:` in forumulate.yaml, pass --org, or set FORUMULATE_ORG.');
29
+ return exit_codes_1.EXIT.USAGE;
30
+ }
31
+ if (flags.prune)
32
+ doc.body.prune = true;
33
+ for (const s of doc.skipped)
34
+ deps.err(`skipped ${s}`);
35
+ const api = new api_1.PublishApi({
36
+ client: deps.client,
37
+ authed: true,
38
+ readOnly: flags.command === 'plan',
39
+ paceMs: 0,
40
+ upload: deps.upload,
41
+ });
42
+ try {
43
+ let spaces = await spaceIds(api, org);
44
+ await settleImpliedCollections(api, org, doc, spaces);
45
+ await resolveAssets(api, org, doc, spaces, flags.command === 'apply');
46
+ const planned = await send(deps.client, org, doc.body, false);
47
+ if (flags.command === 'plan') {
48
+ if (flags.json)
49
+ deps.out(JSON.stringify(planned, null, 2));
50
+ else
51
+ (0, output_1.formatPlan)(planned, { diff: flags.diff, verbose: flags.verbose }).forEach((l) => deps.out(l));
52
+ if (!planned.ok)
53
+ return exit_codes_1.EXIT.FAILED;
54
+ return flags.check && hasChanges(planned) ? exit_codes_1.EXIT.FAILED : exit_codes_1.EXIT.OK;
55
+ }
56
+ // Pages pointing at local files in a space this apply creates: the space
57
+ // must exist before its assets can be uploaded, so everything but the
58
+ // pages lands first, then the uploads, then a fresh plan.
59
+ const answers = [];
60
+ let plan = planned;
61
+ if (pendingAssets(doc, spaces)) {
62
+ const { pages: _p, prune: _x, ...rest } = doc.body;
63
+ answers.push(await send(deps.client, org, rest, true));
64
+ if (!answers[0].ok)
65
+ return report(answers, flags, deps);
66
+ spaces = await spaceIds(api, org);
67
+ await resolveAssets(api, org, doc, spaces, true);
68
+ plan = await send(deps.client, org, doc.body, false);
69
+ }
70
+ for (const body of batches(doc.body, plan, flags.batch)) {
71
+ const answer = await send(deps.client, org, body, true);
72
+ answers.push(answer);
73
+ if (!answer.ok)
74
+ break;
75
+ }
76
+ return report(answers, flags, deps);
77
+ }
78
+ catch (e) {
79
+ const err = e;
80
+ deps.err(`forumulate ${flags.command}: ${err.message ?? String(e)}`);
81
+ if (err.details && typeof err.details === 'object')
82
+ deps.err(JSON.stringify(err.details));
83
+ return (0, exit_codes_1.exitCodeForError)(e);
84
+ }
85
+ }
86
+ function report(answers, flags, deps) {
87
+ if (flags.json)
88
+ deps.out(JSON.stringify({ ok: answers.every((a) => a.ok), batches: answers }, null, 2));
89
+ else
90
+ (0, output_1.formatApply)(answers, { verbose: flags.verbose }).forEach((l) => deps.out(l));
91
+ const bad = answers.some((a) => !a.ok || a.steps.some((s) => s.status === 'failed' || ('readBack' in s && s.readBack === 'mismatch')));
92
+ return bad ? exit_codes_1.EXIT.FAILED : exit_codes_1.EXIT.OK;
93
+ }
94
+ /** The manifest door: a dry run, or `?apply=true`. */
95
+ async function send(client, org, body, apply) {
96
+ // The dry run writes nothing by the API's own contract (dry run is its
97
+ // default), so it is sent straight through rather than through the
98
+ // read-only guard that stops a planning bug from writing.
99
+ return client.request('PUT', `/orgs/${encodeURIComponent(org)}/manifest`, {
100
+ body,
101
+ ...(apply ? { query: { apply: true } } : {}),
102
+ });
103
+ }
104
+ function hasChanges(answer) {
105
+ return answer.steps.some((s) => s.action !== 'unchanged' && s.action !== 'unsupported');
106
+ }
107
+ async function spaceIds(api, org) {
108
+ const rows = await api.all(`/orgs/${encodeURIComponent(org)}/spaces`, 'spaces', { limit: 500 });
109
+ return new Map(rows.map((s) => [s.slug, s.id]));
110
+ }
111
+ async function settleImpliedCollections(api, org, doc, spaces) {
112
+ for (const [space, slugs] of doc.implied) {
113
+ const id = spaces.get(space);
114
+ if (!id)
115
+ continue;
116
+ const have = await api.all(`/orgs/${encodeURIComponent(org)}/spaces/${id}/collections`, 'collections');
117
+ (0, document_1.dropImplied)(doc.body, space, new Set(have.map((c) => c.slug)), slugs);
118
+ }
119
+ }
120
+ function pendingAssets(doc, spaces) {
121
+ return [...doc.assets.keys()].some((space) => !spaces.has(space));
122
+ }
123
+ /**
124
+ * Local references → asset URLs, in every page body, slot and metadata value.
125
+ * A plan only LOOKS an asset up (by content hash); a file not uploaded yet
126
+ * gets a placeholder, so the page shows as changing — which it will.
127
+ */
128
+ async function resolveAssets(api, org, doc, spaces, upload) {
129
+ const pages = (0, document_1.pagesOf)(doc.body);
130
+ for (const [space, byPage] of doc.assets) {
131
+ const spaceId = spaces.get(space);
132
+ const existing = spaceId ? await api.assets(org, spaceId) : new Map();
133
+ for (const [key, refs] of byPage) {
134
+ const urls = new Map();
135
+ for (const [ref, abs] of refs) {
136
+ const known = (0, api_1.lookupAsset)(existing, abs);
137
+ if (known)
138
+ urls.set(ref, known);
139
+ else if (upload && spaceId)
140
+ urls.set(ref, await api.upload(org, spaceId, abs, existing));
141
+ else
142
+ urls.set(ref, `https://assets.invalid/${encodeURIComponent(ref)}`);
143
+ }
144
+ const [slug, locale] = key.split('@');
145
+ const page = pages.find((p) => p.space === space && p.slug === slug);
146
+ if (!page)
147
+ continue;
148
+ const target = (locale ? page.translations?.[locale] : page);
149
+ if (!target)
150
+ continue;
151
+ if (target.body)
152
+ target.body = (0, rewrite_1.rewriteAssets)(target.body, urls);
153
+ if (target.sections)
154
+ target.sections = Object.fromEntries(Object.entries(target.sections).map(([k, v]) => [k, (0, rewrite_1.rewriteAssets)(v, urls)]));
155
+ if (target.metadata)
156
+ target.metadata = (0, rewrite_1.rewriteValue)(target.metadata, urls);
157
+ }
158
+ }
159
+ }
160
+ /**
161
+ * The apply requests: every page the plan leaves alone is in all of them;
162
+ * the changed ones are added `size` at a time; the last request is the whole
163
+ * document, and is the only one that may prune.
164
+ */
165
+ function batches(body, plan, size) {
166
+ const pages = (0, document_1.pagesOf)(body);
167
+ const changed = new Set(plan.steps
168
+ .filter((s) => s.unit === 'pages' && s.action !== 'unchanged' && s.action !== 'delete')
169
+ .map((s) => s.ref.split('@')[0]));
170
+ const settled = pages.filter((p) => !changed.has(`${p.space}/${p.slug}`));
171
+ const moving = pages.filter((p) => changed.has(`${p.space}/${p.slug}`));
172
+ const n = Math.max(1, size);
173
+ if (moving.length <= n)
174
+ return [body];
175
+ const out = [];
176
+ for (let end = n; end < moving.length; end += n) {
177
+ out.push({ ...body, pages: [...settled, ...moving.slice(0, end)], prune: false });
178
+ }
179
+ out.push(body);
180
+ return out;
181
+ }
182
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/plan/command.ts"],"names":[],"mappings":";;AAkDA,wCAkEC;AAsBD,gCAEC;AAgED,0BAiBC;AA7ND,wCAAyD;AAEzD,kDAAmD;AACnD,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;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,GAAW,EAAE,CAAC;IACvB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAChD,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type ScannedPage } from './markdown-dir';
2
+ export interface PlanDocument {
3
+ file: string;
4
+ org?: string;
5
+ /** The body for `PUT /orgs/{org}/manifest`. */
6
+ body: Record<string, unknown>;
7
+ /** Local files pages point at: space → page key (`slug`, `slug@es`) → reference → absolute path. */
8
+ assets: Map<string, Map<string, Map<string, string>>>;
9
+ /** Files left out on purpose (drafts), for the plan to name. */
10
+ skipped: string[];
11
+ /**
12
+ * Collections this loader added to a space's `collections` (space → slugs),
13
+ * because a folder implies them. The command drops the ones the space
14
+ * already has: declaring an existing collection under a guessed name would
15
+ * plan a RENAME of it.
16
+ */
17
+ implied: Map<string, string[]>;
18
+ }
19
+ export declare function loadPlanDocument(file: string): PlanDocument;
20
+ /** Take back implied collections the space turned out to have already. */
21
+ export declare function dropImplied(body: Record<string, unknown>, space: string, existing: Set<string>, implied: string[]): void;
22
+ /** The pages of a body, typed loosely: what the CLI rewrites and batches. */
23
+ export declare function pagesOf(body: Record<string, unknown>): ScannedPage[];
24
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/plan/document.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuCnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,oGAAoG;IACpG,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACtD,gEAAgE;IAChE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;OAKG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAoDD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAoE3D;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAOxH;AAsBD,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAAE,CAEpE"}