@zero2webmaster/starter-kit 0.10.0 → 0.12.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # z2w-starter-kit
2
2
 
3
- **Version:** 0.10.0 | **Framework:** 2.13.0
3
+ **Version:** 0.12.0 | **Framework:** 2.13.0
4
4
 
5
5
  > Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
6
6
 
@@ -112,4 +112,4 @@ Inquiries: kerry@zero2webmaster.com.
112
112
  ---
113
113
 
114
114
  *Scaffolded 2026-05-28 via the [[instantiate-z2w-project]] Claude Code skill v1; reconciled against the consolidated skill v1.1.0 (brief-first + Agent Coordination block) on 2026-05-29.*
115
- *Version: 0.10.0 | Last Updated: 2026-08-03*
115
+ *Version: 0.12.0 | Last Updated: 2026-08-05*
@@ -92,6 +92,25 @@ export declare function localEnvFrom(exampleContent: string, filename: string, s
92
92
  export declare function commonBaseFiles(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, perTypeNarrative: string): ScaffoldFile[];
93
93
  /** npm deps the mailer requires; merged into the scaffolded package.json. */
94
94
  export declare const EMAIL_DEPS: Readonly<Record<string, string>>;
95
+ /**
96
+ * npm deps the emitted Sentry `dataCollection` guard requires (`hasObservability`).
97
+ *
98
+ * BOTH are declared deliberately, and the caret ranges must stay in the same
99
+ * major.minor family:
100
+ *
101
+ * - `@sentry/nextjs` is the SDK the app actually runs.
102
+ * - `@sentry/core` is where the `ResolvedDataCollection` TYPE lives. It is NOT
103
+ * re-exported by `@sentry/nextjs` (measured on 10.69.0 — `import type
104
+ * { ResolvedDataCollection } from "@sentry/nextjs"` is a TS2305), so the
105
+ * shared module has to name `@sentry/core` directly. Relying on it as an
106
+ * undeclared transitive would work until someone runs a stricter installer.
107
+ *
108
+ * `@sentry/nextjs@X` pins `@sentry/core` to EXACTLY `X`, so a matching caret
109
+ * range on both dedupes to one copy and the type can never describe a different
110
+ * SDK than the one running. The emitted test asserts that equality at run time
111
+ * rather than trusting this comment.
112
+ */
113
+ export declare const SENTRY_DEPS: Readonly<Record<string, string>>;
95
114
  /**
96
115
  * The env-var block appended to a scaffolded `.env.example` when the project
97
116
  * sends email. Both providers' vars are stubbed so switching is a one-line env
@@ -1069,6 +1069,28 @@ export const EMAIL_DEPS = {
1069
1069
  "@aws-sdk/client-ses": "^3.1075.0",
1070
1070
  resend: "^6.16.0",
1071
1071
  };
1072
+ /**
1073
+ * npm deps the emitted Sentry `dataCollection` guard requires (`hasObservability`).
1074
+ *
1075
+ * BOTH are declared deliberately, and the caret ranges must stay in the same
1076
+ * major.minor family:
1077
+ *
1078
+ * - `@sentry/nextjs` is the SDK the app actually runs.
1079
+ * - `@sentry/core` is where the `ResolvedDataCollection` TYPE lives. It is NOT
1080
+ * re-exported by `@sentry/nextjs` (measured on 10.69.0 — `import type
1081
+ * { ResolvedDataCollection } from "@sentry/nextjs"` is a TS2305), so the
1082
+ * shared module has to name `@sentry/core` directly. Relying on it as an
1083
+ * undeclared transitive would work until someone runs a stricter installer.
1084
+ *
1085
+ * `@sentry/nextjs@X` pins `@sentry/core` to EXACTLY `X`, so a matching caret
1086
+ * range on both dedupes to one copy and the type can never describe a different
1087
+ * SDK than the one running. The emitted test asserts that equality at run time
1088
+ * rather than trusting this comment.
1089
+ */
1090
+ export const SENTRY_DEPS = {
1091
+ "@sentry/core": "^10.69.0",
1092
+ "@sentry/nextjs": "^10.69.0",
1093
+ };
1072
1094
  const EMAIL_MAILER_BODY = `// Transactional / auth email — provider router. Default provider: Amazon SES;
1073
1095
  // Resend is a swappable alternative selected with EMAIL_PROVIDER=resend.
1074
1096
  //
@@ -46,7 +46,7 @@
46
46
  // allowlist stub in `.env.example`. This CLI emits no auth code, so it plants the
47
47
  // seam + the pointer at [[z2w-magic-link-auth]] §0 rule 2b rather than a check —
48
48
  // see CANONICAL_HOSTS_ENV_BLOCK for why that is the honest half.
49
- import { commonBaseFiles, EMAIL_DEPS, EMAIL_ENV_BLOCK, emailFiles, localEnvFrom, readableInkOn, resolveBrandSpec, sub, } from "./common.js";
49
+ import { commonBaseFiles, EMAIL_DEPS, EMAIL_ENV_BLOCK, emailFiles, localEnvFrom, readableInkOn, resolveBrandSpec, SENTRY_DEPS, sub, } from "./common.js";
50
50
  const NARRATIVE = `## What this is
51
51
 
52
52
  \`{{slug}}\` is a Next.js App Router project scaffolded under the {{brand_name}} brand. The 7-item SEO baseline (per Z2W standing org requirement 2026-05-30) is wired in at instantiation.
@@ -949,6 +949,292 @@ describe("form standards", () => {
949
949
  });
950
950
  });
951
951
  `;
952
+ /**
953
+ * The emitted Sentry PII guard — ONE `dataCollection` block, typed so that an
954
+ * SDK upgrade which adds an axis fails the build.
955
+ *
956
+ * WHY THIS IS A TYPE AND NOT A LIST (email-engine's 2026-08-03 ACTION, answered
957
+ * differently than asked, and the difference is the point):
958
+ *
959
+ * They asked for a runtime set-equality test built on
960
+ * `resolveDataCollectionOptions()`. That function is NOT reachable — measured on
961
+ * `@sentry/core@10.69.0`: it is absent from `.`, `./server` and `./browser`, and
962
+ * every deep path is refused by the package `exports` map with
963
+ * ERR_PACKAGE_PATH_NOT_EXPORTED. Emitting their snippet would have put an
964
+ * unresolvable import into every scaffold. Their COUNT was right (ten axes) and
965
+ * their diagnosis was right (a hardcoded list rots silently, in the unsafe
966
+ * direction); only the mechanism was unavailable.
967
+ *
968
+ * The public `ResolvedDataCollection` type — `Required<Omit<DataCollection,
969
+ * 'queryParams'>>`, exported from `@sentry/core`'s shared-exports — carries the
970
+ * same information and binds HARDER:
971
+ *
972
+ * 1. It fails `tsc --noEmit` AND `next build`, so it does not depend on anyone
973
+ * running the test suite.
974
+ * 2. It cannot be vacuous. A runtime `expect(keys).toEqual(sdkAxes)` passes
975
+ * when both sides are empty; a missing property is a compile error.
976
+ * 3. It catches NESTED sub-keys. `Object.keys()` set-equality sees ten
977
+ * top-level names and would wave through `genAI: { inputs: false }` with
978
+ * `outputs` unset — which is precisely a PII axis silently left on.
979
+ *
980
+ * Canary-verified in both directions before shipping: the complete block
981
+ * compiles; dropping `genAI` fails; dropping `genAI.outputs` fails; and the
982
+ * known-bad `{ httpBodies: [] }` recipe fails naming all nine missing axes.
983
+ *
984
+ * The values below are the PRIVACY-FIRST floor, not a suggestion. Turning one on
985
+ * is a deliberate act with a comment saying why.
986
+ */
987
+ const SENTRY_SHARED_TEMPLATE = `/**
988
+ * Sentry data-collection policy for {{project_name}} — the single source of truth.
989
+ *
990
+ * Every Sentry runtime config (\`sentry.client.config.ts\`,
991
+ * \`sentry.server.config.ts\`, \`sentry.edge.config.ts\`) MUST spread
992
+ * \`DATA_COLLECTION\` and must NOT declare a local \`dataCollection\` key. Three
993
+ * hand-maintained copies drift, and drift here leaks user data.
994
+ * \`test/sentry-data-collection.test.ts\` enforces both halves.
995
+ *
996
+ * ── The two traps, both counter-intuitive, both measured on @sentry/core 10.69.0 ──
997
+ *
998
+ * 1. Writing a \`dataCollection\` block AT ALL flips the baseline to all-on, so
999
+ * every axis you do not name is ENABLED. \`{ httpBodies: [] }\` alone turns
1000
+ * four other axes on. An omitted key is not "leave as default" — it is an
1001
+ * opt-in.
1002
+ *
1003
+ * 2. \`stackFrameVariables\` defaults to true in BOTH branches, so
1004
+ * \`sendDefaultPii: false\` does NOT turn it off. Only an explicit block does.
1005
+ * Local variables on an error path can hold a token, a decrypted payload, or
1006
+ * a whole user record.
1007
+ *
1008
+ * ── Why the type annotation is load-bearing ──
1009
+ *
1010
+ * \`ResolvedDataCollection\` is \`Required<Omit<DataCollection, 'queryParams'>>\`.
1011
+ * Naming it here means the compiler requires EVERY axis the INSTALLED SDK knows
1012
+ * about, including nested sub-keys. When an SDK upgrade adds a collector, this
1013
+ * file fails \`next build\` on the upgrade PR — the one moment somebody is already
1014
+ * looking — instead of silently starting to collect it.
1015
+ *
1016
+ * So: do NOT loosen this annotation, and do NOT replace it with a hardcoded list
1017
+ * of axis names. A list is the failure mode; this guidance has already gone stale
1018
+ * twice (five axes → seven → ten), each time in the direction that collects more.
1019
+ *
1020
+ * Never ENABLE \`sendDefaultPii\` anywhere. On 10.69.0 switching it on resolves
1021
+ * TEN axes, including HTTP bodies in all four directions and \`genAI\` inputs +
1022
+ * outputs — the user's prompt and the model's completion.
1023
+ *
1024
+ * (Phrased as "enable" on purpose: the test below greps this file for the
1025
+ * enabled spelling, so writing the literal here — even to forbid it — would fail
1026
+ * the suite on the very file that ships the rule.)
1027
+ */
1028
+ import type { ResolvedDataCollection } from "@sentry/core";
1029
+
1030
+ export const DATA_COLLECTION: ResolvedDataCollection = {
1031
+ // Do not auto-populate user.* from instrumentation. Attach the fields you
1032
+ // actually need explicitly, where you can see the decision.
1033
+ userInfo: false,
1034
+
1035
+ // Cookies routinely carry session tokens.
1036
+ cookies: false,
1037
+
1038
+ // Headers carry Authorization, Cookie, and API keys in both directions.
1039
+ httpHeaders: { request: false, response: false },
1040
+
1041
+ // [] disables body collection entirely. An OMITTED value collects ALL four
1042
+ // body types — this empty array is doing real work.
1043
+ httpBodies: [],
1044
+
1045
+ // Query strings carry reset tokens, invite codes and email addresses.
1046
+ urlQueryParams: false,
1047
+
1048
+ // GraphQL documents and variables carry user input verbatim.
1049
+ graphQL: { document: false, variables: false },
1050
+
1051
+ // The user's PROMPT and the model's COMPLETION. Off unless a specific product
1052
+ // decision says otherwise, in writing.
1053
+ genAI: { inputs: false, outputs: false },
1054
+
1055
+ // Query parameters, inline literals and returned rows. Sanitized statement
1056
+ // text (db.query.text) is unaffected by this and still collected.
1057
+ databaseQueryData: false,
1058
+
1059
+ // Local variable VALUES captured off the stack. On by default in both
1060
+ // branches; this line is the only thing that turns it off.
1061
+ stackFrameVariables: false,
1062
+
1063
+ // Source lines around each frame. Source, not data — 5 is the SDK default and
1064
+ // is safe. Set to 0 if your source is itself sensitive.
1065
+ frameContextLines: 5,
1066
+ };
1067
+ `;
1068
+ /**
1069
+ * The emitted enforcement half of the Sentry PII policy.
1070
+ *
1071
+ * The TYPE in sentry.shared.ts is the primary guard and it runs in the compiler.
1072
+ * This test covers the three things a type cannot see: that the runtime configs
1073
+ * actually USE the shared block, that nobody loosened the annotation, and that
1074
+ * the two Sentry packages resolved to the same version.
1075
+ *
1076
+ * ⚠️ Written to tolerate the pre-wizard state. A fresh scaffold has
1077
+ * `sentry.shared.ts` but NOT the three config files (`npx @sentry/wizard` writes
1078
+ * those later), so the config assertions must not fail on a project that has not
1079
+ * been wired yet. They must also not go SILENTLY vacuous — per
1080
+ * [[zero-is-not-a-pass]], "I examined nothing" is reported, not passed.
1081
+ */
1082
+ const SENTRY_DATA_COLLECTION_TEST_TEMPLATE = `/**
1083
+ * Sentry PII policy, enforced as tests rather than as a convention someone has
1084
+ * to remember.
1085
+ *
1086
+ * The load-bearing guard is the \`ResolvedDataCollection\` type annotation in
1087
+ * sentry.shared.ts — it fails \`next build\` when an SDK upgrade adds a collection
1088
+ * axis. These tests cover what the compiler cannot see:
1089
+ *
1090
+ * - every Sentry config that EXISTS spreads the shared block and declares no
1091
+ * local \`dataCollection\` (three hand-maintained copies drift);
1092
+ * - the annotation has not been loosened to \`any\`, which would silently
1093
+ * disable the compile-time guard while leaving the file looking correct;
1094
+ * - \`@sentry/core\` (the type) and \`@sentry/nextjs\` (the runtime) resolved to
1095
+ * the same version, so the type describes the SDK that is actually running.
1096
+ */
1097
+ import { describe, it, expect } from "vitest";
1098
+ import { readFileSync, existsSync } from "node:fs";
1099
+ import { join, dirname } from "node:path";
1100
+ import { fileURLToPath } from "node:url";
1101
+
1102
+ import { DATA_COLLECTION } from "../sentry.shared.js";
1103
+
1104
+ // NOT \`__dirname\` — this package is "type": "module", where it is undefined.
1105
+ const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
1106
+ const read = (f: string) => readFileSync(join(ROOT, f), "utf8");
1107
+
1108
+ /** The Sentry runtime configs the wizard writes. Absent until it has been run. */
1109
+ const CONFIGS = [
1110
+ "sentry.client.config.ts",
1111
+ "sentry.server.config.ts",
1112
+ "sentry.edge.config.ts",
1113
+ ];
1114
+ const present = CONFIGS.filter((f) => existsSync(join(ROOT, f)));
1115
+
1116
+ const pkgVersion = (name: string): string | undefined => {
1117
+ const p = join(ROOT, "node_modules", name, "package.json");
1118
+ if (!existsSync(p)) return undefined;
1119
+ return (JSON.parse(readFileSync(p, "utf8")) as { version: string }).version;
1120
+ };
1121
+
1122
+ describe("Sentry data-collection policy", () => {
1123
+ // ── Vacuity guards. These run in every state, wired or not. ──
1124
+
1125
+ it("the shared block names every axis the SDK defines (not an empty object)", () => {
1126
+ // A runtime set-equality between two empty objects passes. This is the
1127
+ // floor that makes the assertions below mean something: 10 axes as of
1128
+ // @sentry/core 10.69.0, and the TYPE is what forces the exact set.
1129
+ expect(Object.keys(DATA_COLLECTION).length).toBeGreaterThanOrEqual(10);
1130
+ });
1131
+
1132
+ it("keeps the ResolvedDataCollection annotation — the compile-time guard", () => {
1133
+ // Loosening this to \`any\` (or deleting it) removes the only thing that
1134
+ // fails the build when an SDK upgrade adds an axis. Nothing else would
1135
+ // notice: the file still compiles and the app still boots.
1136
+ const src = read("sentry.shared.ts");
1137
+ expect(src).toMatch(
1138
+ /DATA_COLLECTION\\s*:\\s*ResolvedDataCollection\\b/,
1139
+ );
1140
+ expect(src).toContain('from "@sentry/core"');
1141
+ });
1142
+
1143
+ it("never turns on sendDefaultPii, which resolves ten axes at once", () => {
1144
+ for (const f of [...present, "sentry.shared.ts"]) {
1145
+ expect(read(f)).not.toMatch(/sendDefaultPii\\s*:\\s*true/);
1146
+ }
1147
+ });
1148
+
1149
+ it("holds the privacy-first floor on the axes that carry user data", () => {
1150
+ // Behaviour, not spelling — these are the values, whatever the file says.
1151
+ expect(DATA_COLLECTION.userInfo).toBe(false);
1152
+ expect(DATA_COLLECTION.cookies).toBe(false);
1153
+ expect(DATA_COLLECTION.httpBodies).toEqual([]);
1154
+ expect(DATA_COLLECTION.urlQueryParams).toBe(false);
1155
+ expect(DATA_COLLECTION.databaseQueryData).toBe(false);
1156
+ expect(DATA_COLLECTION.stackFrameVariables).toBe(false);
1157
+ expect(DATA_COLLECTION.genAI).toEqual({ inputs: false, outputs: false });
1158
+ expect(DATA_COLLECTION.graphQL).toEqual({ document: false, variables: false });
1159
+ expect(DATA_COLLECTION.httpHeaders).toEqual({ request: false, response: false });
1160
+ });
1161
+
1162
+ it("the type package and the runtime package are the same version", () => {
1163
+ // @sentry/nextjs@X pins @sentry/core to exactly X. If these ever disagree,
1164
+ // the ResolvedDataCollection type is describing a different SDK than the
1165
+ // one running, and the compile-time guard is checking the wrong contract.
1166
+ const core = pkgVersion("@sentry/core");
1167
+ const nextjs = pkgVersion("@sentry/nextjs");
1168
+ if (!core || !nextjs) {
1169
+ expect(
1170
+ existsSync(join(ROOT, "node_modules")),
1171
+ "node_modules is missing — run npm install before trusting this suite",
1172
+ ).toBe(false);
1173
+ return;
1174
+ }
1175
+ expect(core).toBe(nextjs);
1176
+ });
1177
+
1178
+ // ── Config assertions. Inert until \`npx @sentry/wizard@latest -i nextjs\` has
1179
+ // been run.
1180
+ //
1181
+ // They are declared with \`skipIf\` rather than looped over an empty list,
1182
+ // because a for-loop over nothing PASSES and a passing test says
1183
+ // "checked, fine" when it means "examined nothing" ([[zero-is-not-a-pass]]).
1184
+ // A skip is reported in the run summary as \`N skipped\`; a console.warn from
1185
+ // a passing test is swallowed by the default reporter and shows nobody
1186
+ // anything — measured, not assumed. ──
1187
+
1188
+ const wired = present.length === CONFIGS.length;
1189
+
1190
+ it("the Sentry runtime configs are either all present or all absent", () => {
1191
+ // This one ALWAYS runs, so the state is asserted even before wiring. A
1192
+ // single straggler means somebody hand-rolled one runtime and skipped the
1193
+ // others — the state in which the skips below would hide a real gap.
1194
+ expect(
1195
+ [0, CONFIGS.length],
1196
+ \`found \${present.length} of \${CONFIGS.length} Sentry configs: \${
1197
+ present.join(", ") || "none"
1198
+ }. Run: npx @sentry/wizard@latest -i nextjs\`,
1199
+ ).toContain(present.length);
1200
+ });
1201
+
1202
+ /**
1203
+ * The contents of a config's \`dataCollection: { … }\` literal, comments and
1204
+ * whitespace stripped. \`null\` when the key is absent entirely.
1205
+ *
1206
+ * Deliberately brace-naive: a nested object inside the literal will not match
1207
+ * the expected spread and therefore FAILS. Extra keys are the thing being
1208
+ * caught, so failing closed on them is correct.
1209
+ */
1210
+ const dataCollectionBody = (f: string): string | null => {
1211
+ const m = /dataCollection\\s*:\\s*\\{([^}]*)\\}/.exec(read(f));
1212
+ if (!m) return null;
1213
+ return (m[1] ?? "").replace(/\\/\\/[^\\n]*/g, "").replace(/\\s+/g, "");
1214
+ };
1215
+
1216
+ it.skipIf(!wired)("every Sentry config spreads the shared block", () => {
1217
+ for (const f of present) {
1218
+ expect(read(f), \`\${f} must spread DATA_COLLECTION into Sentry.init\`).toMatch(
1219
+ /\\.\\.\\.\\s*DATA_COLLECTION/,
1220
+ );
1221
+ }
1222
+ });
1223
+
1224
+ it.skipIf(!wired)("no Sentry config adds keys beyond the shared block", () => {
1225
+ // A local block does not MERGE with the shared one — the object literal is
1226
+ // the whole policy, so any extra key silently re-enables whatever the
1227
+ // shared block turned off. The only sanctioned body is the bare spread.
1228
+ for (const f of present) {
1229
+ expect(
1230
+ dataCollectionBody(f),
1231
+ \`\${f}: dataCollection must be exactly { ...DATA_COLLECTION }. \` +
1232
+ \`Change the policy in sentry.shared.ts, never per-runtime.\`,
1233
+ ).toBe("...DATA_COLLECTION");
1234
+ }
1235
+ });
1236
+ });
1237
+ `;
952
1238
  const APP_LAYOUT_TEMPLATE = `// Root layout — SEO baseline wiring per Z2W standing org requirement
953
1239
  // 2026-05-30. Every indexable page MUST export its own \`metadata\`; do not
954
1240
  // rely on these defaults to fill in per-page values.
@@ -1430,8 +1716,18 @@ CANONICAL_HOSTS=
1430
1716
  * hand-written template output (its snapshot is untouched).
1431
1717
  */
1432
1718
  function withEmailDeps(pkgJson) {
1719
+ return withExtraDeps(pkgJson, EMAIL_DEPS);
1720
+ }
1721
+ /**
1722
+ * Merge extra deps into an already-substituted package.json string.
1723
+ *
1724
+ * Insertion order only (no re-sorting) — the email path's snapshot predates this
1725
+ * helper and must keep producing the same bytes. Callers apply their merges in a
1726
+ * fixed order, so the output is deterministic without sorting.
1727
+ */
1728
+ function withExtraDeps(pkgJson, extra) {
1433
1729
  const obj = JSON.parse(pkgJson);
1434
- obj.dependencies = { ...obj.dependencies, ...EMAIL_DEPS };
1730
+ obj.dependencies = { ...obj.dependencies, ...extra };
1435
1731
  return JSON.stringify(obj, null, 2) + "\n";
1436
1732
  }
1437
1733
  export function scaffoldNextjs(inputs, opts) {
@@ -1439,9 +1735,17 @@ export function scaffoldNextjs(inputs, opts) {
1439
1735
  const base = commonBaseFiles(inputs, opts, NARRATIVE);
1440
1736
  const sendsEmail = inputs.sendsEmail === true;
1441
1737
  const hostRouted = inputs.hostRoutedTenancy === true;
1738
+ // Sentry is the default runtime-error tool for a customer-facing web app, and
1739
+ // `hasObservability` is where that intent is already recorded (it is the same
1740
+ // flag that inserts the Sentry standards block). Emitting the PII guard here
1741
+ // means the axis contract is enforced from the first build, not from whenever
1742
+ // somebody remembers to re-read a prose checklist.
1743
+ const hasObservability = inputs.hasObservability === true;
1442
1744
  let packageJson = sub(PACKAGE_JSON_TEMPLATE, inputs, opts, spec);
1443
1745
  if (sendsEmail)
1444
1746
  packageJson = withEmailDeps(packageJson);
1747
+ if (hasObservability)
1748
+ packageJson = withExtraDeps(packageJson, SENTRY_DEPS);
1445
1749
  let envExample = sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec);
1446
1750
  if (sendsEmail)
1447
1751
  envExample += EMAIL_ENV_BLOCK;
@@ -1471,6 +1775,18 @@ export function scaffoldNextjs(inputs, opts) {
1471
1775
  path: "test/form-standards.test.ts",
1472
1776
  content: sub(FORM_STANDARDS_TEST_TEMPLATE, inputs, opts, spec),
1473
1777
  },
1778
+ ...(hasObservability
1779
+ ? [
1780
+ {
1781
+ path: "sentry.shared.ts",
1782
+ content: sub(SENTRY_SHARED_TEMPLATE, inputs, opts, spec),
1783
+ },
1784
+ {
1785
+ path: "test/sentry-data-collection.test.ts",
1786
+ content: sub(SENTRY_DATA_COLLECTION_TEST_TEMPLATE, inputs, opts, spec),
1787
+ },
1788
+ ]
1789
+ : []),
1474
1790
  { path: "app/layout.tsx", content: sub(APP_LAYOUT_TEMPLATE, inputs, opts, spec) },
1475
1791
  { path: "app/page.tsx", content: sub(APP_PAGE_TEMPLATE, inputs, opts, spec) },
1476
1792
  { path: "lib/analytics/utm.ts", content: sub(ANALYTICS_UTM_TEMPLATE, inputs, opts, spec) },
package/dist/standards.js CHANGED
@@ -315,7 +315,11 @@ const SENTRY_BODY = `### Sentry runtime-error tracking (customer-facing web app)
315
315
  > - **Writing a \`dataCollection\` block AT ALL flips the baseline to all-on**, so every axis you do not name is enabled. \`{ httpBodies: [] }\` alone turns four other axes ON. An omitted key is not "leave as default" — it is an opt-in.
316
316
  > - **\`stackFrameVariables: true\` is on in BOTH branches**, so \`sendDefaultPii: false\` does not turn it off. Only an explicit \`dataCollection\` block can. Local variables on an error path can hold a token, a decrypted payload, or a whole user record.
317
317
  >
318
- > **So: write ONE complete \`dataCollection\` block naming every axis, and pin it with a test that asserts what \`resolveDataCollectionOptions()\` RESOLVED — not what you typed.** A test that reads your own config object back to itself proves you typed what you meant and nothing about what the SDK did with it; that is exactly the gap that let a partial block sit unnoticed in three Z2W repos. \`[[sentry-runtime-errors]]\` carries the current block, the resolver one-liner, and the per-repo audit — **and because a hardcoded axis list in any doc goes stale silently and in the unsafe direction every time the SDK adds a collector, the binding instruction is the resolver check, not the snippet.** Re-run it on every SDK upgrade.
318
+ > **You do not have to remember any of this — the scaffold emits the enforcement.** \`sentry.shared.ts\` holds ONE complete \`dataCollection\` block typed as \`ResolvedDataCollection\` (\`Required<Omit<DataCollection, 'queryParams'>>\`, exported from \`@sentry/core\`), and \`test/sentry-data-collection.test.ts\` pins the parts a type cannot see. **The type IS the guard:** naming it makes the compiler demand every axis the INSTALLED SDK defines, so an upgrade that adds a collector fails \`next build\` on the upgrade PR — the one moment somebody is already looking — instead of silently starting to collect it. Point every \`Sentry.init\` at \`{ ...DATA_COLLECTION }\` and change the policy in that one file, never per-runtime.
319
+ >
320
+ > **Why a TYPE and not the runtime set-equality check you may have seen proposed:** \`resolveDataCollectionOptions()\` is **not reachable** — measured on \`@sentry/core@10.69.0\`, it is absent from \`.\`, \`./server\` and \`./browser\`, and every deep path is refused by the package \`exports\` map (\`ERR_PACKAGE_PATH_NOT_EXPORTED\`). The type is public, and it binds harder anyway: it cannot be vacuous (an \`expect(keys).toEqual(sdkAxes)\` passes when both sides are empty), it does not depend on anyone running the suite, and it catches **nested** sub-keys — a top-level \`Object.keys()\` comparison would wave through \`genAI: { inputs: false }\` with \`outputs\` left on. **The general rule, which outlives the Sentry detail: when a guard needs a list of things-that-might-be-added, get the list from the system that adds them — and prefer the compiler over a test when the compiler can hold it.**
321
+ >
322
+ > A hardcoded axis list in any doc goes stale silently and in the unsafe direction every time the SDK adds a collector; this guidance has already done so twice (five → seven → ten). So the binding artifact is the emitted module, not the prose above. \`[[sentry-runtime-errors]]\` carries the per-repo audit.
319
323
  >
320
324
  > Whatever you end up collecting, never forward a Sentry payload verbatim into a shared surface (the bulletin \`## Incidents\` pipe strips to summary + link + timestamp).
321
325
  > 5. **Smoke it, then delete the smoke.** Add a throwaway auth-gated server-throw route (\`/api/boom\` style), confirm the error + replay land in Sentry and the alert email fires, then DELETE the route and the wizard's noisy example page (it's a honeypot that inflates your error count). Ship this cleanup as its own small commit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zero2webmaster/starter-kit",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",