bearminion 1.10.0 → 1.10.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # bearminion
2
2
 
3
+ ## 1.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 23f9084: New sites include an `AGENTS.md` (and a `CLAUDE.md` pointing to it) for AI assistants. It leads with the rules that keep secrets out of the chat and out of git, then walks through the Contact form: write the files with `add form`, run `check form`, and ask the person to confirm each step the assistant cannot see (the variables on the host, a verified domain, a redeploy, a real message).
8
+ - 88fae9e: `check form` now says when a `PUBLIC_` value such as the Turnstile site key sits under `vars` in the Wrangler config: that reaches the running Worker only, so the page has no widget; it has to be a Build variable. The Cloudflare guide adds the Turnstile secret to its settings and says a build variable needs a new build.
9
+ - 62e89bc: `npx bearminion add form <service>` now asks which host the site runs on, in a terminal, when nothing in the project names one (or two hosts do). It offers Vercel, Netlify and Cloudflare, and Enter writes the handler alone, as before. With `--host`, with `--json`, or without a terminal it does not ask.
10
+ - 88fae9e: The Cloudflare Wrangler config that `add form --host cloudflare` writes now uses `"run_worker_first": ["/api/*"]` instead of `true`, so page views are served from the built site without running the Worker, and only `/api/*` reaches the handler. A site that already has `true` keeps working. Tried on a real deploy: pages load, `/api/contact` answers, and a message arrives.
11
+
3
12
  ## 1.10.0
4
13
 
5
14
  ### Minor Changes
package/dist/astro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as SectionRegistry, J as SiteDefinition, Y as SiteOf, Yt as ContentMigrator, k as ContentModel, t as Page, u as SectionOf } from "./page-BfI9cD8g.js";
2
- import { a as StoreKeyError, c as createFileStore, i as FileStoreOptions, n as EditorContext, o as StoreOperation, r as ContentStore, s as UploadStore, t as BearminionOptions } from "./options-gXystJjG.js";
1
+ import { A as SectionRegistry, J as SiteDefinition, Y as SiteOf, Yt as ContentMigrator, k as ContentModel, t as Page, u as SectionOf } from "./page-CA4iyFDS.js";
2
+ import { a as StoreKeyError, c as createFileStore, i as FileStoreOptions, n as EditorContext, o as StoreOperation, r as ContentStore, s as UploadStore, t as BearminionOptions } from "./options-4HWVEj9O.js";
3
3
  import { AstroIntegration } from "astro";
4
4
  //#region src/integration.d.ts
5
5
  interface BearminionIntegration extends AstroIntegration {
package/dist/cli.js CHANGED
@@ -216,7 +216,7 @@ export default {
216
216
  "wrangler.json",
217
217
  "wrangler.toml"
218
218
  ],
219
- skipNote: "This site already has a Wrangler config, so it was left alone. It needs \"main\": \"./worker.ts\", \"assets\" with \"binding\": \"ASSETS\" and \"run_worker_first\": true, and CONTACT_FROM and CONTACT_TO under \"vars\". See the Forms guide.",
219
+ skipNote: "This site already has a Wrangler config, so it was left alone. It needs \"main\": \"./worker.ts\", \"assets\" with \"binding\": \"ASSETS\" and \"run_worker_first\": [\"/api/*\"], and CONTACT_FROM and CONTACT_TO under \"vars\". See the Forms guide.",
220
220
  source: `// "name" has to be the name of your Worker in Cloudflare.
221
221
  // RESEND_API_KEY is a secret: set it in the Worker's Settings, not here. CONTACT_FROM and CONTACT_TO are plain values and
222
222
  // live under "vars", because a deploy replaces variables that exist only in the dashboard. Fill them in, and keep this
@@ -225,7 +225,7 @@ export default {
225
225
  "name": "my-site",
226
226
  "compatibility_date": "2026-10-27",
227
227
  "main": "./worker.ts",
228
- "assets": { "directory": "./dist", "binding": "ASSETS", "run_worker_first": true },
228
+ "assets": { "directory": "./dist", "binding": "ASSETS", "run_worker_first": ["/api/*"] },
229
229
  "observability": { "logs": { "enabled": true, "invocation_logs": true, "persist": true } },
230
230
  "vars": { "CONTACT_FROM": "", "CONTACT_TO": "" }
231
231
  }
@@ -509,7 +509,15 @@ function checkCloudflare(root, add, plainNames, secretNames) {
509
509
  if (typeof value === "string" && value.trim() !== "") add("ok", `${variable} is set under "vars".`);
510
510
  else add("problem", `${variable} is not set under "vars" in ${configFile}. A variable that exists only in the dashboard is replaced on the next deploy.`, `Put ${variable} under "vars" (plain values, so keep the repository private if they should not be public).`);
511
511
  }
512
- if (secretNames.length > 0) add("note", `Set ${secretNames.join(", ")} as Secrets in the Worker's Settings. I cannot read them from here.`);
512
+ const publicNames = configFile.endsWith(".toml") ? [...text.matchAll(/^\s*(PUBLIC_[A-Z0-9_]+)\s*=/gm)].map((match) => match[1]) : Object.keys(vars).filter((variable) => variable.startsWith("PUBLIC_"));
513
+ if (publicNames.length > 0) {
514
+ const one = publicNames.length === 1;
515
+ add("note", `${publicNames.join(", ")} ${one ? "is" : "are"} in ${configFile}. Those reach the running Worker only; Astro reads PUBLIC_ values when the site is built, so set ${one ? "it" : "them"} as Build variables in the dashboard (then push or retry the build). Under "vars" the page has no Turnstile widget.`);
516
+ }
517
+ if (secretNames.length > 0) {
518
+ const many = secretNames.length > 1;
519
+ add("note", `Set ${secretNames.join(", ")} as ${many ? "Secrets" : "a Secret"} in the Worker's Settings. I cannot read ${many ? "them" : "it"} from here.`);
520
+ }
513
521
  if (logs !== true) add("note", "Logs are not turned on in the Wrangler config (\"observability\"), so a failing handler leaves no trace in the dashboard.");
514
522
  }
515
523
  /**
@@ -1050,7 +1058,18 @@ async function runAddForm(root, names, values, io) {
1050
1058
  const handler = names[0] === void 0 ? void 0 : HANDLERS.find((candidate) => candidate.name === names[0]);
1051
1059
  if (names[0] !== void 0 && handler === void 0) return fail(`There is no form service called "${names[0]}". The services are: ${HANDLERS.map((candidate) => candidate.name).join(", ")}.`);
1052
1060
  const detected = values.host === void 0 ? detectHost(root) : void 0;
1053
- const hostName = values.host ?? detected;
1061
+ let chosen;
1062
+ if (values.host === void 0 && detected === void 0 && handler !== void 0 && !json && io.choose !== void 0) {
1063
+ chosen = await io.choose("Where does this site run? The project does not say.", [...GLUE.map((candidate) => ({
1064
+ value: candidate.name,
1065
+ label: candidate.description
1066
+ })), {
1067
+ value: "",
1068
+ label: "Somewhere else: write the handler only"
1069
+ }]);
1070
+ if (chosen === "") chosen = void 0;
1071
+ }
1072
+ const hostName = values.host ?? detected ?? chosen;
1054
1073
  const glue = hostName === void 0 ? void 0 : GLUE.find((candidate) => candidate.name === hostName);
1055
1074
  if (values.host !== void 0 && glue === void 0) return fail(`There is no host called "${hostName}". The hosts are: ${GLUE.map((candidate) => candidate.name).join(", ")}.`);
1056
1075
  if (handler === void 0 && glue === void 0) return fail("Name a service, a host, or both. For example: npx bearminion add form resend --host vercel. Use --list to see them.", 2);
@@ -1078,7 +1097,7 @@ async function runAddForm(root, names, values, io) {
1078
1097
  ...extra
1079
1098
  }, null, 2);
1080
1099
  if (!json) {
1081
- log(`${values["dry-run"] ? "Would add" : "Adding"} the form recipe${glue ? ` for ${glue.name}${detected ? " (found from the project)" : ""}` : ""}${handler ? ` with ${handler.name}` : ""}`);
1100
+ log(`${values["dry-run"] ? "Would add" : "Adding"} the form recipe${glue ? ` for ${glue.name}${detected ? " (found from the project)" : chosen ? " (your choice)" : ""}` : ""}${handler ? ` with ${handler.name}` : ""}`);
1082
1101
  log("");
1083
1102
  for (const file of changes) log(` ${LABELS[file.action].padEnd(9)} ${file.path}`);
1084
1103
  const same = plan.files.length - changes.length;
@@ -1156,8 +1175,26 @@ async function confirm(question) {
1156
1175
  rl.close();
1157
1176
  }
1158
1177
  }
1178
+ /** A numbered list; Enter, or a number that is not on the list, picks nothing. */
1179
+ async function choose(question, options) {
1180
+ const rl = createInterface({
1181
+ input: process.stdin,
1182
+ output: process.stdout
1183
+ });
1184
+ try {
1185
+ console.log(question);
1186
+ for (const [index, option] of options.entries()) console.log(` ${index + 1}. ${option.label}`);
1187
+ const answer = Number((await rl.question("Number: ")).trim());
1188
+ return Number.isInteger(answer) ? options[answer - 1]?.value : void 0;
1189
+ } finally {
1190
+ rl.close();
1191
+ }
1192
+ }
1159
1193
  process.exitCode = await run(process.argv.slice(2), {
1160
1194
  registryDir,
1161
- ...process.stdin.isTTY ? { confirm } : {}
1195
+ ...process.stdin.isTTY ? {
1196
+ confirm,
1197
+ choose
1198
+ } : {}
1162
1199
  });
1163
1200
  //#endregion
package/dist/content.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { k as ContentModel, t as Page, u as SectionOf } from "./page-BfI9cD8g.js";
1
+ import { k as ContentModel, t as Page, u as SectionOf } from "./page-CA4iyFDS.js";
2
2
  import { z } from "zod";
3
3
  //#region src/content.d.ts
4
4
  export interface ContentCollectionsOptions {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as brandLogoSchema, $t as createMigrator, A as SectionRegistry, At as wireframeIssues, B as FooterColumn, Bt as themeModes, C as jsonLdWarnings, Ct as SectionDefinition, D as upsertJsonLd, Dt as Wireframe, E as siteJsonLdIds, Et as WireRect, F as defineTheme, Ft as NumberOption, G as SiteAnalytics, Gt as FieldIcons, H as Header, Ht as tones, I as BRAND_LOGO_HEIGHT, It as Option, J as SiteDefinition, Jt as ContentMigration, K as SiteConfig, Kt as ShowCondition, L as DEFAULT_MAX_FOOTER_COLUMNS, Lt as StringOption, M as ThemeDefinition, Mt as BooleanOption, N as ThemeFont, Nt as CountRule, O as API_PREFIX, Ot as defineWireframe, P as defaultTheme, Pt as EnumOption, Q as Theme, Qt as SCHEMA_VERSION_KEY, R as DEFAULT_MAX_HEADER_ACTIONS, Rt as buttonStyles, S as jsonLdSchema, St as SectionConfig, T as parseJsonLdInput, Tt as WireKind, U as HeaderConfig, Ut as variantOption, V as FooterConfig, Vt as toneOption, W as Site, Wt as FieldChoices, X as SiteSeo, Xt as ContentVersioning, Y as SiteOf, Yt as ContentMigrator, Z as SiteWith, Zt as DocumentKind, _ as SiteJsonLdSource, _t as textMarkSchema, a as isSystemPage, at as themeSchema, b as hasJsonLdId, bt as trackingIdSchema, c as BaseSection, ct as Link, d as anchorSchema, dt as Text, et as defineSite, f as createSectionSchema, ft as Tone, g as SiteJsonLdIds, gt as richTextSchema, h as JsonLdResult, ht as linkSchema, i as createPageSchema, it as themeColorsSchema, j as ThemeConfig, jt as OptionalContent, k as ContentModel, kt as wireKinds, l as PropsOf, lt as MAX_NAV_DEPTH, m as JsonLdBlock, mt as imageSchema, n as SYSTEM_PAGES, nt as siteConsentSchema, o as seoSchema, ot as ButtonStyle, p as sectionIdSchema, pt as htmlIdSchema, q as SiteConsent, qt as ShowWhen, r as Seo, rt as siteSeoSchema, s as withoutOrphanSections, st as Image, t as Page, tt as siteAnalyticsSchema, u as SectionOf, ut as RichText, v as formatJsonLd, vt as textSchema, w as mergeJsonLd, wt as defineSection, x as isPlaceholderSiteUrl, xt as withEmphasis, y as generateSiteJsonLd, yt as toneSchema, z as Footer, zt as motionOption } from "./page-BfI9cD8g.js";
1
+ import { $ as brandLogoSchema, $t as createMigrator, A as SectionRegistry, At as wireframeIssues, B as FooterColumn, Bt as themeModes, C as jsonLdWarnings, Ct as SectionDefinition, D as upsertJsonLd, Dt as Wireframe, E as siteJsonLdIds, Et as WireRect, F as defineTheme, Ft as NumberOption, G as SiteAnalytics, Gt as FieldIcons, H as Header, Ht as tones, I as BRAND_LOGO_HEIGHT, It as Option, J as SiteDefinition, Jt as ContentMigration, K as SiteConfig, Kt as ShowCondition, L as DEFAULT_MAX_FOOTER_COLUMNS, Lt as StringOption, M as ThemeDefinition, Mt as BooleanOption, N as ThemeFont, Nt as CountRule, O as API_PREFIX, Ot as defineWireframe, P as defaultTheme, Pt as EnumOption, Q as Theme, Qt as SCHEMA_VERSION_KEY, R as DEFAULT_MAX_HEADER_ACTIONS, Rt as buttonStyles, S as jsonLdSchema, St as SectionConfig, T as parseJsonLdInput, Tt as WireKind, U as HeaderConfig, Ut as variantOption, V as FooterConfig, Vt as toneOption, W as Site, Wt as FieldChoices, X as SiteSeo, Xt as ContentVersioning, Y as SiteOf, Yt as ContentMigrator, Z as SiteWith, Zt as DocumentKind, _ as SiteJsonLdSource, _t as textMarkSchema, a as isSystemPage, at as themeSchema, b as hasJsonLdId, bt as trackingIdSchema, c as BaseSection, ct as Link, d as anchorSchema, dt as Text, et as defineSite, f as createSectionSchema, ft as Tone, g as SiteJsonLdIds, gt as richTextSchema, h as JsonLdResult, ht as linkSchema, i as createPageSchema, it as themeColorsSchema, j as ThemeConfig, jt as OptionalContent, k as ContentModel, kt as wireKinds, l as PropsOf, lt as MAX_NAV_DEPTH, m as JsonLdBlock, mt as imageSchema, n as SYSTEM_PAGES, nt as siteConsentSchema, o as seoSchema, ot as ButtonStyle, p as sectionIdSchema, pt as htmlIdSchema, q as SiteConsent, qt as ShowWhen, r as Seo, rt as siteSeoSchema, s as withoutOrphanSections, st as Image, t as Page, tt as siteAnalyticsSchema, u as SectionOf, ut as RichText, v as formatJsonLd, vt as textSchema, w as mergeJsonLd, wt as defineSection, x as isPlaceholderSiteUrl, xt as withEmphasis, y as generateSiteJsonLd, yt as toneSchema, z as Footer, zt as motionOption } from "./page-CA4iyFDS.js";
2
2
  import { _ as renderMarkedHtml, a as WeightMark, f as markClass, g as reconcileMarks, i as TextRun, l as fontMarks, m as marksFromEmphasis, o as applyTextMark, r as TextMark, t as FontMark, v as splitMarkedText, y as weightMarks } from "./marks-BzLa48Y9.js";
3
- import "./options-gXystJjG.js";
3
+ import "./options-4HWVEj9O.js";
4
4
  import { a as TURNSTILE_FIELD, i as HONEYPOT_FIELD, n as FormResult, r as FormSubmission, t as FormFieldErrors } from "./form-contract-BURSJP3Y.js";
5
5
  //#region src/errors.d.ts
6
6
  /** One schema problem, addressed by a dot path such as `sections.0.props.heading`. */
@@ -1,4 +1,4 @@
1
- import { A as SectionRegistry, J as SiteDefinition, M as ThemeDefinition, Yt as ContentMigrator, k as ContentModel } from "./page-BfI9cD8g.js";
1
+ import { A as SectionRegistry, J as SiteDefinition, M as ThemeDefinition, Yt as ContentMigrator, k as ContentModel } from "./page-CA4iyFDS.js";
2
2
  //#region src/images.d.ts
3
3
  type ImageKind = 'png' | 'jpeg' | 'webp' | 'gif' | 'avif';
4
4
  interface SavedImage {
@@ -275,10 +275,10 @@ declare const textMarkSchema: z.ZodObject<{
275
275
  start: z.ZodNumber;
276
276
  end: z.ZodNumber;
277
277
  weight: z.ZodOptional<z.ZodEnum<{
278
+ bold: "bold";
278
279
  regular: "regular";
279
280
  medium: "medium";
280
281
  semibold: "semibold";
281
- bold: "bold";
282
282
  }>>;
283
283
  italic: z.ZodOptional<z.ZodBoolean>;
284
284
  font: z.ZodOptional<z.ZodEnum<{
@@ -319,10 +319,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
319
319
  start: z.ZodNumber;
320
320
  end: z.ZodNumber;
321
321
  weight: z.ZodOptional<z.ZodEnum<{
322
+ bold: "bold";
322
323
  regular: "regular";
323
324
  medium: "medium";
324
325
  semibold: "semibold";
325
- bold: "bold";
326
326
  }>>;
327
327
  italic: z.ZodOptional<z.ZodBoolean>;
328
328
  font: z.ZodOptional<z.ZodEnum<{
@@ -337,10 +337,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
337
337
  start: z.ZodNumber;
338
338
  end: z.ZodNumber;
339
339
  weight: z.ZodOptional<z.ZodEnum<{
340
+ bold: "bold";
340
341
  regular: "regular";
341
342
  medium: "medium";
342
343
  semibold: "semibold";
343
- bold: "bold";
344
344
  }>>;
345
345
  italic: z.ZodOptional<z.ZodBoolean>;
346
346
  font: z.ZodOptional<z.ZodEnum<{
@@ -357,10 +357,10 @@ declare function withEmphasis<T extends z.ZodRawShape>(shape: T): z.ZodPipe<z.Zo
357
357
  start: z.ZodNumber;
358
358
  end: z.ZodNumber;
359
359
  weight: z.ZodOptional<z.ZodEnum<{
360
+ bold: "bold";
360
361
  regular: "regular";
361
362
  medium: "medium";
362
363
  semibold: "semibold";
363
- bold: "bold";
364
364
  }>>;
365
365
  italic: z.ZodOptional<z.ZodBoolean>;
366
366
  font: z.ZodOptional<z.ZodEnum<{
@@ -617,10 +617,10 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
617
617
  start: z.ZodNumber;
618
618
  end: z.ZodNumber;
619
619
  weight: z.ZodOptional<z.ZodEnum<{
620
+ bold: "bold";
620
621
  regular: "regular";
621
622
  medium: "medium";
622
623
  semibold: "semibold";
623
- bold: "bold";
624
624
  }>>;
625
625
  italic: z.ZodOptional<z.ZodBoolean>;
626
626
  font: z.ZodOptional<z.ZodEnum<{
@@ -852,7 +852,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
852
852
  nameMarks: {
853
853
  start: number;
854
854
  end: number;
855
- weight?: "regular" | "medium" | "semibold" | "bold" | undefined;
855
+ weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
856
856
  italic?: boolean | undefined;
857
857
  font?: "sans" | "serif" | "mono" | undefined;
858
858
  }[] | undefined;
@@ -1110,7 +1110,7 @@ declare function createSiteSchema(header: HeaderParts, footer: FooterParts): z.Z
1110
1110
  nameMarks?: {
1111
1111
  start: number;
1112
1112
  end: number;
1113
- weight?: "regular" | "medium" | "semibold" | "bold" | undefined;
1113
+ weight?: "bold" | "regular" | "medium" | "semibold" | undefined;
1114
1114
  italic?: boolean | undefined;
1115
1115
  font?: "sans" | "serif" | "mono" | undefined;
1116
1116
  }[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bearminion",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "A git-based CMS for Astro with no database and no server: JSON content in your repo, edited by clicking on the page during astro dev.",
5
5
  "license": "MIT",
6
6
  "author": "Jakub Lange",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "template": "default",
4
- "version": "1.10.0",
4
+ "version": "1.10.1",
5
5
  "files": {
6
6
  "src/components/atoms/Button.astro": {
7
7
  "hash": "7be42b3dc3a3b59bec169de32a9d801904689e2705473d1945724658dc799043",