frontpage-host 0.1.15 → 0.1.16

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/AGENTS.md CHANGED
@@ -109,7 +109,7 @@ Sites are Astro 6 + Tailwind v4. More detail: `frontpage help site-building` or
109
109
  ## Modules & articles
110
110
 
111
111
  - Forms: `data-fp-form` markup in pages + `frontpage modules` for enable/config. No submit JS / honeypot / `action`.
112
- - Wizard / connect-once modules (payments/shop/ordering): `frontpage modules <key> connect` opens the browser (Stripe or Square). Finish there, then `status`. `--no-open` for CI. `request-setup` remains valid when you want the **editor amber bar** instead. payments and shop share one Stripe account. Auto-active modules (forms/callbar/…) need markup, not request-setup. Typed settings: `frontpage modules callbar|forms|booking|signups get|set` (forms set needs `--instance`; do not target `default`). `frontpage modules <key>` prints that key's CLI usage (exit 2). Index: https://frontpage.host/developers/modules · payments/shop/ordering pages under /developers/modules/<key>
112
+ - Wizard / connect-once modules (payments/shop/ordering): `frontpage modules <key> connect` opens Frontpage (you must be logged in there), then Stripe or Square. Already-connected sites stay live — do not retry connect. payments/shop connect needs an **admin** key; ordering connect needs **editor**. `--no-open` for CI. `request-setup` remains valid when you want the **editor amber bar** instead. payments and shop share one Stripe account — payments disconnect fails if the store still uses it. Auto-active modules (forms/callbar/…) need markup, not request-setup. Typed settings: `frontpage modules callbar|forms|booking|signups get|set` (forms set needs `--instance`; do not target `default`). `frontpage modules <key>` prints that key's CLI usage (exit 2). Index: https://frontpage.host/developers/modules · payments/shop/ordering pages under /developers/modules/<key>
113
113
  - Google reviews: platform nodes only (`data-fp-google-reviews` / `data-fp-google-ask` + required `data-fp-requires="google_reviews"`). `data-layout` is `feed` (default), `badge`, or `link`. Never invent stars, quotes, a 1–10, or a Maps URL. Do not pick a Place ID via Autocomplete and do not write `placeId` through `modules config`. Owner-supplied Place ID / Maps URL: `frontpage modules google_reviews connect --place-id …` or `--maps-url …` (server resolves + seeds). Curation: `list-reviews`, `hide --id`, `show --id`, `set-stars`, `set-sort`, `set-weight`, `reset-weights`, `refresh`, `disconnect`. Usage: `frontpage modules google_reviews`. Docs: https://frontpage.host/developers/modules/google-reviews. Ask-widget scores: `frontpage inbox google_reviews`.
114
114
  - Articles: `frontpage articles …` for lifecycle; bodies via sync under `content/` or `articles content get|set`. Section landing is an owned `src/pages/<section>/index.astro`.
115
115
  - Migrate a folder into Articles: prefer `frontpage prompt "migrate … into articles"` — do not invent a mass delete+write migration.
@@ -139,8 +139,8 @@ export const MODULE_COMMANDS = [
139
139
  'frontpage modules payments request-setup --reason "Deposit button needs Stripe"',
140
140
  ],
141
141
  notes: [
142
- "Connect opens Stripe. Finish in the browser, then re-run status. This CLI cannot complete OAuth.",
143
- "payments and shop share one Stripe account — disconnect says so.",
142
+ "Connect needs an admin API key. It opens Frontpage (you must be logged in there), then Stripe. Already-connected sites stay live — disconnect first to switch accounts.",
143
+ "payments and shop share one Stripe account. Disconnecting payments fails if the store still uses that account.",
144
144
  "request-setup still lights the editor amber bar when you want the owner to finish there.",
145
145
  ],
146
146
  },
@@ -164,8 +164,8 @@ export const MODULE_COMMANDS = [
164
164
  'frontpage modules shop request-setup --reason "You asked for a store — Stripe setup makes checkout live"',
165
165
  ],
166
166
  notes: [
167
- "Connect opens Stripe. Finish in the browser, then re-run status. This CLI cannot complete OAuth.",
168
- "payments and shop share one Stripe account — disconnect says so.",
167
+ "Connect needs an admin API key. It opens Frontpage (you must be logged in there), then Stripe. Already-connected sites stay live.",
168
+ "payments and shop share one Stripe account. Shop disconnect keeps the account on payments.",
169
169
  "Shop still needs the shipping step in Modules if you have not set it.",
170
170
  "request-setup still lights the editor amber bar when you want the owner to finish there.",
171
171
  ],
@@ -192,7 +192,7 @@ export const MODULE_COMMANDS = [
192
192
  'frontpage modules ordering request-setup --reason "You asked for online ordering — Square setup makes it live"',
193
193
  ],
194
194
  notes: [
195
- "Connect opens Square. Finish in the browser, then re-run status. This CLI cannot complete OAuth.",
195
+ "Connect needs an editor API key. It opens Frontpage (you must be logged in there), then Square. Already-connected sites stay live.",
196
196
  "sync refreshes the Square catalog (same as the hub Sync button).",
197
197
  "request-setup still lights the editor amber bar when you want the owner to finish there.",
198
198
  "Fulfillment (pickup/delivery) is not in this CLI yet — use Modules or the editor.",
@@ -1,4 +1,12 @@
1
1
  export declare const OAUTH_CLI_KEYS: readonly ["payments", "shop", "ordering"];
2
2
  export type OauthCliKey = (typeof OAUTH_CLI_KEYS)[number];
3
3
  export declare function isOauthCliKey(key: string): key is OauthCliKey;
4
+ export declare function resolveOpenUrl(raw: unknown): string | null;
5
+ /** argv for the platform opener. Windows quotes the URL so `&` stays in the query. */
6
+ export declare function browserOpenCommand(url: string, platform?: NodeJS.Platform): {
7
+ command: string;
8
+ args: string[];
9
+ windowsVerbatimArguments?: boolean;
10
+ };
11
+ export declare function openBrowser(url: string): void;
4
12
  export declare function runOauthHandoff(key: OauthCliKey, slug: string, action: string, flags: string[]): Promise<number>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * §CLI-MOD-OAUTH — payments / shop / ordering connect, status, disconnect, sync.
2
+ * §CLI-MOD-OAUTH / §CLI-MOD-HARD — payments / shop / ordering connect, status, disconnect, sync.
3
3
  */
4
4
  import { spawn } from "node:child_process";
5
5
  import { assertNoUnknownFlags, hasFlag } from "../argv.js";
@@ -10,11 +10,11 @@ export const OAUTH_CLI_KEYS = ["payments", "shop", "ordering"];
10
10
  export function isOauthCliKey(key) {
11
11
  return OAUTH_CLI_KEYS.includes(key);
12
12
  }
13
- const FINISH = "Finish in the browser, then re-run status. This CLI cannot complete OAuth.";
13
+ const FINISH = "Open the Frontpage URL while logged in, finish Stripe or Square in the browser, then re-run status. This CLI cannot complete OAuth.";
14
14
  function pathFor(slug, key) {
15
15
  return `/api/v1/sites/${encodeURIComponent(slug)}/modules/${encodeURIComponent(key)}`;
16
16
  }
17
- function resolveOpenUrl(raw) {
17
+ export function resolveOpenUrl(raw) {
18
18
  if (typeof raw !== "string" || !raw.trim())
19
19
  return null;
20
20
  const trimmed = raw.trim();
@@ -24,10 +24,25 @@ function resolveOpenUrl(raw) {
24
24
  return `${apiBase()}${trimmed}`;
25
25
  return null;
26
26
  }
27
- function openBrowser(url) {
28
- const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
29
- const openerArgs = process.platform === "win32" ? ["/c", "start", "", url] : [url];
30
- spawn(opener, openerArgs, { detached: true, stdio: "ignore" }).unref();
27
+ /** argv for the platform opener. Windows quotes the URL so `&` stays in the query. */
28
+ export function browserOpenCommand(url, platform = process.platform) {
29
+ if (platform === "darwin")
30
+ return { command: "open", args: [url] };
31
+ if (platform !== "win32")
32
+ return { command: "xdg-open", args: [url] };
33
+ return {
34
+ command: "cmd",
35
+ args: ["/c", "start", '""', `"${url}"`],
36
+ windowsVerbatimArguments: true,
37
+ };
38
+ }
39
+ export function openBrowser(url) {
40
+ const spec = browserOpenCommand(url);
41
+ spawn(spec.command, spec.args, {
42
+ detached: true,
43
+ stdio: "ignore",
44
+ ...(spec.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
45
+ }).unref();
31
46
  }
32
47
  function printStatus(key, data) {
33
48
  const connection = (data.connection ?? {});
@@ -68,6 +83,7 @@ export async function runOauthHandoff(key, slug, action, flags) {
68
83
  const noOpen = hasFlag(work, "--no-open");
69
84
  assertNoUnknownFlags(work, "modules");
70
85
  const data = await v1Post(pathFor(slug, key), { action: "connect" });
86
+ const already = data.alreadyConnected === true;
71
87
  if (isJson()) {
72
88
  emitOk("modules", data);
73
89
  }
@@ -75,12 +91,12 @@ export async function runOauthHandoff(key, slug, action, flags) {
75
91
  const url = resolveOpenUrl(data.connectUrl);
76
92
  if (url)
77
93
  console.log(url);
78
- console.log(typeof data.message === "string" ? data.message : FINISH);
94
+ console.log(typeof data.message === "string" ? data.message : already ? "Already connected." : FINISH);
79
95
  if (typeof data.warning === "string")
80
96
  console.log(data.warning);
81
97
  }
82
98
  const url = resolveOpenUrl(data.connectUrl);
83
- if (url && !noOpen)
99
+ if (url && !noOpen && !already)
84
100
  openBrowser(url);
85
101
  return EXIT_OK;
86
102
  }
package/dist/registry.js CHANGED
@@ -348,7 +348,7 @@ export const COMMANDS = [
348
348
  dangers: [
349
349
  "Secret values are never returned — masks only",
350
350
  "request-setup surfaces an owner prompt in the editor status bar (CLI cannot show it)",
351
- "payments and shop share one Stripe account — disconnect warns before teardown",
351
+ "payments and shop share one Stripe account — payments disconnect 409s if the store still uses it",
352
352
  "OAuth cannot finish in the terminal; connect only opens the vendor URL",
353
353
  "Do not write placeId through generic config — that skips listing resolve + seed",
354
354
  ],
@@ -596,7 +596,7 @@ export const TOPICS = {
596
596
  frontpage tokens set --group … --key … --value …
597
597
  frontpage modules list|docs|request-setup|enable|disable|archive|config <key>
598
598
  frontpage modules <key> # that key's CLI usage
599
- frontpage modules payments|shop|ordering connect [--no-open] # opens Stripe/Square; then status
599
+ frontpage modules payments|shop|ordering connect [--no-open] # opens Frontpage then Stripe/Square; then status
600
600
  frontpage modules ordering sync
601
601
  # mailing list key: signups. Index: https://frontpage.host/developers/modules
602
602
  frontpage extensions list|docs|enable|disable|config <key>
@@ -607,7 +607,7 @@ export const TOPICS = {
607
607
  Do not fake payments/checkout. LOCKED extensions → do not fake; say plan required.
608
608
  Migrate pages → articles: prefer frontpage prompt "migrate …" over mass delete+write.
609
609
  edit uses click-edit (exact single occurrence), not push / gated-write.
610
- Connect opens Stripe/Square in the browser; this CLI never accepts or returns OAuth secrets.
610
+ Connect opens Frontpage (logged-in), then Stripe/Square; never accepts or returns OAuth secrets. payments/shop connect is admin.
611
611
  Site contract: frontpage help site-building · https://frontpage.host/developers/site-building
612
612
  Domains, billing, members, and site delete are out of v1.`,
613
613
  history: `History
package/llms.txt CHANGED
@@ -8,7 +8,7 @@
8
8
  - Fonts: frontpage fonts [--slot] [--query] → exact value → tokens set fonts.<role> → APPLY font-sans|serif|mono|display. Build bundles catalog faces from tokens.ts and/or CSS font-family contexts (not prose). Inline-only without tokens works for catalog faces after rebuild; prefer tokens+utilities for brand roles.
9
9
  - Module/extension docs: frontpage modules docs <key> | frontpage extensions docs <key>
10
10
  - Search flags: --regex --case-sensitive --whole-word --files-only --context-lines --max-results
11
- - Modules setup: wizard modules (payments/shop/ordering): frontpage modules <key> connect [--no-open] opens Stripe/Square; finish in the browser, then status. request-setup remains valid for the editor amber bar. payments and shop share one Stripe account. frontpage modules <key> prints that key's CLI usage. Index: https://frontpage.host/developers/modules. Typed config: frontpage modules callbar|forms|booking|signups get|set (forms set needs --instance; confirm emails paid-plan only). google_reviews: frontpage modules google_reviews connect --place-id | --maps-url (server resolve + seed; no Autocomplete; do not write placeId via config). Also status, list-reviews, hide/show, set-stars, set-sort, set-weight, reset-weights, refresh, disconnect. Docs: https://frontpage.host/developers/modules/google-reviews. Markup: data-fp-google-reviews / data-fp-google-ask + required data-fp-requires="google_reviews". Ask scores: frontpage inbox google_reviews.
11
+ - Modules setup: wizard modules (payments/shop/ordering): frontpage modules <key> connect [--no-open] opens Frontpage (logged-in browser) then Stripe/Square; already-connected stays live. payments/shop connect = admin key; ordering = editor. payments disconnect 409s if shop still uses the shared Stripe account. request-setup remains valid for the editor amber bar. frontpage modules <key> prints that key's CLI usage. Index: https://frontpage.host/developers/modules. Typed config: frontpage modules callbar|forms|booking|signups get|set (forms set needs --instance; confirm emails paid-plan only). google_reviews: frontpage modules google_reviews connect --place-id | --maps-url (server resolve + seed; no Autocomplete; do not write placeId via config). Also status, list-reviews, hide/show, set-stars, set-sort, set-weight, reset-weights, refresh, disconnect. Docs: https://frontpage.host/developers/modules/google-reviews. Markup: data-fp-google-reviews / data-fp-google-ask + required data-fp-requires="google_reviews". Ask scores: frontpage inbox google_reviews.
12
12
  - Analytics ops: frontpage analytics summary|query|funnel|timeseries|compare|sql (bare analytics = dashboard)
13
13
  - Media: frontpage media upload <file> (images/PDF ≤25 MB, video ≤50 MB, SVG/text ≤4 MB); human prints sitePath first — use /__media/uploads/<slug>/… in markup. Text/CSV is inline only (not media library; --json omits full content).
14
14
  - Prompt attachments: frontpage prompt "…" --attach <file|/__media/…|https://…> [--asset-url https://…] (same media caps as media upload)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontpage-host",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Frontpage CLI — manage your site from the terminal",
5
5
  "type": "module",
6
6
  "bin": {