frontpage-host 0.1.20 → 0.1.21

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
@@ -128,7 +128,7 @@ Sites are Astro 6 + Tailwind v4. More detail: `frontpage help site-building` or
128
128
  - Generated images: `frontpage images generate --prompt "…"` `[--count N]` — one prompt, 1–4 variations of that same picture. Prints `sitePath:` first. Counts against AI $ and storage. Flag-off environments return 404 (`Image generation is not enabled.`). Do not call xAI / Imagine yourself.
129
129
  - Analytics: bare `frontpage analytics` = dashboard; also `summary|query|funnel|timeseries|compare|sql` for structured reads (SQL is guard + RLS site-scoped).
130
130
  - People CRM: `frontpage people list|get|add|set|note|rm-note|follow-up|hide|unhide|tag|export`. Site-scoped person graph (email or phone). Inbox stays the raw ledger. Hide is not forget. List export is CSV (not a one-person legal dump). Full guide: https://frontpage.host/developers/people
131
- - Store catalog: `frontpage shop items|variants|categories|settings|orders|payments`. Integer cents only (`$49.99` is `4999`). Stock `--add` / `--remove` become signed delta (`added 5` / `removed 5` / `set to 20` / `stockNow`). Create a category before assigning it (`categories create hats --label Hats`, then `items create … --categories hats`). Connect stays `frontpage modules shop|payments connect`. Square `ordering` is a different module. Full guide: https://frontpage.host/developers/shop
131
+ - Store catalog: `frontpage shop items|variants|categories|settings|orders|payments|connect|status|disconnect`. Integer cents only (`$49.99` is `4999`). Stock `--add` / `--remove` become signed delta (`added 5` / `removed 5` / `set to 20` / `stockNow`). Create a category before assigning it (`categories create hats --label Hats`, then `items create … --categories hats`). `frontpage shop connect [--no-open]` opens Frontpage then Stripe (admin key; finish logged-in in the browser), then `status`. Disconnect keeps the shared Stripe account on payments. `frontpage modules shop|payments connect` still works. Square `ordering` is a different module. Full guide: https://frontpage.host/developers/shop
132
132
 
133
133
  ## Agent prompt loop
134
134
 
@@ -2,9 +2,11 @@ import { readFile } from "node:fs/promises";
2
2
  import { resolveSlug } from "../site.js";
3
3
  import { CliHttpError, EXIT_OK, EXIT_USAGE, v1Get, v1Patch, v1Post, v1Put, } from "../http/client.js";
4
4
  import { assertNoUnknownFlags, hasFlag, takeFlag } from "../argv.js";
5
- import { emitErr, emitOk, emitUsage, isJson } from "../runtime.js";
5
+ import { emitErr, emitOk, emitUsage, isJson, requireYesOrTty } from "../runtime.js";
6
+ import { openBrowser, resolveOpenUrl } from "../modules/oauth.js";
6
7
  import { SHOP_ID_RE, VARIANT_ID_RE } from "./shop-ids.js";
7
- const USAGE = "Usage: frontpage shop items|variants|categories|settings|orders|payments … [--site <slug>] [--json]";
8
+ const USAGE = "Usage: frontpage shop items|variants|categories|settings|orders|payments|connect|status|disconnect … [--site <slug>] [--json]";
9
+ const CONNECT_FINISH = "Open the Frontpage URL while logged in, finish Stripe in the browser, then re-run status. This CLI cannot complete OAuth.";
8
10
  const CENTS_HINT = "$49.99 is 4999";
9
11
  function takeAll(work, name) {
10
12
  const out = [];
@@ -637,6 +639,61 @@ export async function runShop(args) {
637
639
  }
638
640
  return emitUsage("shop", USAGE);
639
641
  }
642
+ if (group === "connect") {
643
+ const work = rest.slice(1);
644
+ const noOpen = hasFlag(work, "--no-open");
645
+ assertNoUnknownFlags(work, "shop");
646
+ const data = await v1Post(`${base}/connect`, { action: "connect" });
647
+ const already = data.alreadyConnected === true;
648
+ if (isJson()) {
649
+ emitOk("shop", data);
650
+ }
651
+ else {
652
+ const url = resolveOpenUrl(data.connectUrl);
653
+ if (url)
654
+ console.log(url);
655
+ console.log(typeof data.message === "string" ? data.message : already ? "Already connected." : CONNECT_FINISH);
656
+ if (typeof data.warning === "string")
657
+ console.log(data.warning);
658
+ }
659
+ const url = resolveOpenUrl(data.connectUrl);
660
+ if (url && !noOpen && !already)
661
+ openBrowser(url);
662
+ return EXIT_OK;
663
+ }
664
+ if (group === "status") {
665
+ const work = rest.slice(1);
666
+ assertNoUnknownFlags(work, "shop");
667
+ const data = await v1Get(`${base}/connect`);
668
+ if (isJson()) {
669
+ emitOk("shop", data);
670
+ return EXIT_OK;
671
+ }
672
+ const connection = (data.connection ?? {});
673
+ const display = connection.display ?? {};
674
+ console.log(`connected ${connection.ready ? "yes" : "no"}`);
675
+ console.log(`charges ${display.chargesEnabled == null ? "—" : display.chargesEnabled ? "yes" : "no"}`);
676
+ console.log(`account ${display.accountPresent ? "present" : "none"}`);
677
+ if (typeof data.sharedStripe === "string")
678
+ console.log(`note ${data.sharedStripe}`);
679
+ if (typeof data.connectUrl === "string")
680
+ console.log(`connect ${data.connectUrl}`);
681
+ return EXIT_OK;
682
+ }
683
+ if (group === "disconnect") {
684
+ const work = rest.slice(1);
685
+ assertNoUnknownFlags(work, "shop");
686
+ const refuse = requireYesOrTty("disconnect the store (shared Stripe account with payments)");
687
+ if (refuse)
688
+ return emitUsage("shop", refuse);
689
+ const data = await v1Post(`${base}/connect`, { action: "disconnect" });
690
+ if (isJson()) {
691
+ emitOk("shop", data);
692
+ return EXIT_OK;
693
+ }
694
+ console.log(typeof data.message === "string" ? data.message : "Disconnected.");
695
+ return EXIT_OK;
696
+ }
640
697
  if (group === "orders" || group === "payments") {
641
698
  const noun = group;
642
699
  const sub = rest[1] ?? "list";
package/dist/registry.js CHANGED
@@ -442,7 +442,7 @@ export const COMMANDS = [
442
442
  {
443
443
  name: "shop",
444
444
  summary: "Store catalog: items, variants, stock, and store settings (not Square, not inbox)",
445
- usage: "frontpage shop items|variants|categories|settings|orders|payments … [--site <slug>] [--json]",
445
+ usage: "frontpage shop items|variants|categories|settings|orders|payments|connect|status|disconnect … [--site <slug>] [--json]",
446
446
  topics: ["content"],
447
447
  examples: [
448
448
  "frontpage shop items list",
@@ -455,6 +455,8 @@ export const COMMANDS = [
455
455
  "frontpage shop items stock camp-hat --variant m --set 20",
456
456
  "frontpage shop settings set-fulfillment --mode pickup",
457
457
  "frontpage shop settings set-currency --currency usd",
458
+ "frontpage shop connect --no-open",
459
+ "frontpage shop status",
458
460
  ],
459
461
  flags: [
460
462
  "Integer cents only. $49.99 is 4999. Do not send 49.99 or a dollar string.",
@@ -463,7 +465,7 @@ export const COMMANDS = [
463
465
  "items: list|get|create|update|archive|activate [--off] | images --urls … | stock [--variant m] --add|--remove|--set. list --category hats. create/update --categories hats,summer",
464
466
  "categories: list|create|rename|archive. Create the category first. Assigning an unknown slug fails.",
465
467
  "variants: add|update|archive <itemId> --id m --price-cents … [--option Size=M] [--stock]",
466
- "settings: get|set-fulfillment|set-currency|set-checkout-fee. Connect stays frontpage modules shop|payments connect.",
468
+ "settings: get|set-fulfillment|set-currency|set-checkout-fee. Connect: frontpage shop connect|status|disconnect. connect opens Frontpage then Stripe; --no-open for CI. disconnect keeps the shared Stripe account on payments.",
467
469
  "orders / payments list|get read the same ledgers as frontpage inbox orders|payments",
468
470
  "Unknown leftover flags fail closed (exit 2)",
469
471
  ],
@@ -725,7 +727,7 @@ export const TOPICS = {
725
727
  frontpage inbox [leads|subscribers|orders|google_reviews|…] [--mark-read] [--csv]
726
728
  frontpage people list|get|add|set|note|rm-note|follow-up|hide|unhide|tag|export
727
729
  # People CRM guide: https://frontpage.host/developers/people
728
- frontpage shop items|variants|categories|settings|orders|payments
730
+ frontpage shop items|variants|categories|settings|orders|payments|connect|status|disconnect
729
731
  # Store catalog: https://frontpage.host/developers/shop
730
732
  # Integer cents only. $49.99 is 4999. stock --add/--remove are signed delta.
731
733
  frontpage mail settings|email|template|series|send|sends|enrolments|suppress
package/llms.txt CHANGED
@@ -17,7 +17,7 @@
17
17
  - SEO get: frontpage seo get [/path|--path /path]; search path filter: [path|--path <path>]; open [/path|--path /path]
18
18
  - Redirects: frontpage redirects list|set|rm — HTTP 301/308, instant, not a file; revert does not undo; do not fake with Astro.redirect / meta refresh
19
19
  - People CRM: frontpage people list|get|add|set|note|rm-note|follow-up|hide|unhide|tag|export. Site-scoped person graph (email or phone). Inbox stays the raw ledger. Hide is not forget. List export is CSV. Unknown leftover flags fail closed. Guide: https://frontpage.host/developers/people
20
- - Store catalog: frontpage shop items|variants|categories|settings|orders|payments. Integer cents only ($49.99 is 4999). stock --add/--remove are signed delta (added 5 / removed 5 / set to 20 / stockNow). Create a category before assigning it. Connect stays frontpage modules shop|payments connect. Not Square ordering. Guide: https://frontpage.host/developers/shop
20
+ - Store catalog: frontpage shop items|variants|categories|settings|orders|payments|connect|status|disconnect. Integer cents only ($49.99 is 4999). stock --add/--remove are signed delta (added 5 / removed 5 / set to 20 / stockNow). Create a category before assigning it. frontpage shop connect [--no-open] opens Frontpage then Stripe; disconnect keeps the shared account on payments. frontpage modules shop|payments connect still works. Not Square ordering. Guide: https://frontpage.host/developers/shop
21
21
  - Analytics funnel: --steps JSON array or comma paths (/, /pricing); bad JSON → Invalid JSON for --steps
22
22
  - Modules: unknown key errors list Known: …; mailing list module key is signups (not subscribe)
23
23
  - Errors: --json API envelopes include requestId when the server returned one; local validation omits requestId/httpStatus; runs wait failed/canceled → ok:false + run.error (exit 2); deploy wait = agent idle + tip compile ready (fail-closed / compile timeout → exit 2); push --wait and publish --wait wait for GET /deploy ready
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontpage-host",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Frontpage CLI — manage your site from the terminal",
5
5
  "type": "module",
6
6
  "bin": {