@quatronic/sdk 0.7.0-rc.8 → 0.7.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 (37) hide show
  1. package/dist/auth/index.js +1 -1
  2. package/dist/{chunk-5MNPBJYS.js → chunk-G7VPNC6M.js} +5 -11
  3. package/dist/{chunk-5MNPBJYS.js.map → chunk-G7VPNC6M.js.map} +1 -1
  4. package/dist/{chunk-ZZTO5Z3N.js → chunk-HQT57ITV.js} +2 -2
  5. package/dist/{chunk-EK6TGWWT.js → chunk-MET4SIMB.js} +2 -8
  6. package/dist/chunk-MET4SIMB.js.map +1 -0
  7. package/dist/{chunk-ROHIN74F.js → chunk-TEBDKNUB.js} +2 -2
  8. package/dist/cli/skills-postinstall.js +118 -1
  9. package/dist/cli/skills.js +118 -1
  10. package/dist/eslint/index.js +2 -22
  11. package/dist/eslint/index.js.map +1 -1
  12. package/dist/next/auth/index.d.ts +12 -0
  13. package/dist/next/auth/index.js +12 -4
  14. package/dist/next/auth/index.js.map +1 -1
  15. package/dist/next/better-auth/index.js +1 -1
  16. package/dist/next/connections/index.js +3 -3
  17. package/dist/next/security/index.js +3 -3
  18. package/dist/next/sentry/client.d.ts +0 -1
  19. package/dist/next/sentry/client.js +2 -2
  20. package/dist/next/sentry/register.js +2 -2
  21. package/dist/next/users/index.js +7 -4
  22. package/dist/next/users/index.js.map +1 -1
  23. package/dist/node/connections/index.js +3 -3
  24. package/dist/node/identity/index.js +2 -2
  25. package/dist/node/sentry/register.js +2 -2
  26. package/package.json +1 -5
  27. package/skills/qore-enable-auth-method/SKILL.md +4 -3
  28. package/skills/qore-use-mail-domain/SKILL.next.md +4 -4
  29. package/dist/chunk-EK6TGWWT.js.map +0 -1
  30. package/dist/observability/index.d.ts +0 -10
  31. package/dist/observability/index.js +0 -7
  32. package/dist/observability/index.js.map +0 -1
  33. package/migrations/report-error/codemod.mjs +0 -94
  34. package/migrations/report-error/instructions.md +0 -46
  35. package/migrations/report-error/meta.json +0 -6
  36. /package/dist/{chunk-ZZTO5Z3N.js.map → chunk-HQT57ITV.js.map} +0 -0
  37. /package/dist/{chunk-ROHIN74F.js.map → chunk-TEBDKNUB.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setUserContext
3
- } from "../chunk-EK6TGWWT.js";
3
+ } from "../chunk-MET4SIMB.js";
4
4
 
5
5
  // src/auth/PortalProvider.tsx
6
6
  import { useEffect as useEffect2, useState } from "react";
@@ -1,9 +1,9 @@
1
+ import {
2
+ setTelemetryHooks
3
+ } from "./chunk-MET4SIMB.js";
1
4
  import {
2
5
  makeDevSinkTransport
3
6
  } from "./chunk-7ASQHY7O.js";
4
- import {
5
- setTelemetryHooks
6
- } from "./chunk-EK6TGWWT.js";
7
7
 
8
8
  // src/sentry-core/noise.ts
9
9
  var NOISE_EXACT = /* @__PURE__ */ new Set(["/favicon.ico", "/api/auth/me"]);
@@ -180,17 +180,11 @@ function initSentry(sentry, runtime, cfg, extra = {}) {
180
180
  console.error("[qore] Sentry init failed", err);
181
181
  return false;
182
182
  }
183
- setTelemetryHooks({
184
- log: sentry.logger,
185
- setUser: (u) => sentry.setUser(u),
186
- captureException: (err, hint) => {
187
- sentry.captureException(err, hint);
188
- }
189
- });
183
+ setTelemetryHooks({ log: sentry.logger, setUser: (u) => sentry.setUser(u) });
190
184
  return true;
191
185
  }
192
186
 
193
187
  export {
194
188
  initSentry
195
189
  };
196
- //# sourceMappingURL=chunk-5MNPBJYS.js.map
190
+ //# sourceMappingURL=chunk-G7VPNC6M.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sentry-core/noise.ts","../src/sentry-core/sampler.ts","../src/sentry-core/scrub.ts","../src/sentry-core/options.ts","../src/sentry-core/init.ts"],"sourcesContent":["// Pure predicate deciding whether an HTTP request is infrastructural noise that\n// should never become a span: a `_rsc` query param, `/favicon.ico`, the SDK's\n// session poll, source maps, `/_next/*`, plus the caller's prefixes and health path.\n\nexport interface NoiseFilterOptions {\n healthPath?: string\n noisePrefixes?: string[]\n}\n\n// `/api/auth/me` is the SDK's own session poll (PortalProvider fires it on every\n// page mount): a heartbeat, not user activity.\nconst NOISE_EXACT = new Set([\"/favicon.ico\", \"/api/auth/me\"])\n\n// React Server Components navigations/prefetches carry a `?_rsc=` query param;\n// they look like real routes, so a path-prefix filter misses them.\nconst RSC_QUERY_RE = /[?&]_rsc=/\n\nexport function isNoisePath(rawUrl: string, opts: NoiseFilterOptions = {}): boolean {\n if (RSC_QUERY_RE.test(rawUrl)) return true\n const path = (rawUrl.split(\"?\")[0] ?? \"\").trim()\n if (!path) return false\n if (NOISE_EXACT.has(path)) return true\n if (path.endsWith(\".map\")) return true\n if (path.startsWith(\"/_next/\")) return true\n if ((opts.noisePrefixes ?? []).some((p) => path.startsWith(p))) return true\n if (opts.healthPath && path === opts.healthPath) return true\n return false\n}\n","import { isNoisePath } from \"./noise\"\n\nexport interface SamplingContextLike {\n name: string\n attributes?: Record<string, unknown>\n inheritOrSampleWith: (fallback: number) => number\n}\n\nconst MUTATIONS = new Set([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"])\n\nconst str = (v: unknown): string | undefined => (typeof v === \"string\" && v ? v : undefined)\n\nfunction pathOf(ctx: SamplingContextLike): string | undefined {\n const a = ctx.attributes ?? {}\n return str(a[\"url.path\"]) ?? str(a[\"http.target\"]) ?? ctx.name.split(\" \")[1]\n}\n\nexport function createTracesSampler(policy: { production: boolean; readRate: number; healthPath: string }) {\n return (ctx: SamplingContextLike): number => {\n const path = pathOf(ctx)\n if (path && isNoisePath(path, { healthPath: policy.healthPath })) return 0\n const a = ctx.attributes ?? {}\n const method = (str(a[\"http.request.method\"]) ?? str(a[\"http.method\"]) ?? \"\").toUpperCase()\n if (MUTATIONS.has(method)) return 1\n return ctx.inheritOrSampleWith(policy.production ? policy.readRate : 1)\n }\n}\n","export const REDACTED = \"●●●\"\n\n// Bounded and anchored (`(?<![...])` + `{1,64}` local part, no `.` in the\n// domain-char class) so it cannot backtrack catastrophically on long runs of\n// email-charset bytes — see the fix-round-1 report for the O(n²) it replaced.\nconst EMAIL = /(?<![A-Z0-9._%+-])[A-Z0-9._%+-]{1,64}@[A-Z0-9-]+(?:\\.[A-Z0-9-]+)*\\.[A-Z]{2,}/gi\nconst JWT = /eyJ[\\w-]+\\.[\\w-]+\\.[\\w-]+/g\nconst AUTH_SCHEME = /\\b(Bearer|Basic)\\s+\\S+/gi\nconst PARAMS_TAIL = /\\bparams:\\s.*$/s\nexport const SECRET_PARAMS: ReadonlySet<string> = new Set([\"token\", \"code\", \"state\", \"password\", \"secret\", \"key\", \"session\", \"access_token\", \"refresh_token\", \"id_token\"])\nconst SECRET_HEADERS = new Set([\n \"authorization\",\n \"cookie\",\n \"set-cookie\",\n \"x-qdc-connection-token\",\n \"x-forwarded-for\",\n \"x-real-ip\",\n \"forwarded\",\n \"user-agent\",\n])\nconst DROP_LOG_ATTRS = new Set([\"ip\", \"ip_address\", \"user_agent\", \"email\", \"user_email\", \"server.address\"])\nconst REDACT_KEYS = new Set([\"db.connection_string\", \"db.user\"])\nconst REDACT_PREFIXES = [\"net.peer.\", \"net.sock.\", \"net.host.\", \"network.peer.\", \"network.local.\"]\nconst DROP_SPAN_KEYS = new Set([\"user_agent.original\", \"http.user_agent\", \"client.address\", \"http.client_ip\"])\nconst DROP_SPAN_PREFIXES = [\"http.request.header.\", \"http.response.header.\"]\nconst URL_SPAN_KEYS = new Set([\"url.full\", \"http.url\", \"url\", \"http.target\", \"url.query\", \"http.query\"])\n\nexport function redactText(s: string): string {\n return s\n .replace(PARAMS_TAIL, \"params: [redacted]\")\n .replace(AUTH_SCHEME, \"$1 [redacted]\")\n .replace(JWT, \"[jwt]\")\n .replace(EMAIL, \"[email]\")\n}\n\nfunction redactQuery(query: string): string {\n return query\n .split(\"&\")\n .map((pair) => {\n const [k, v] = pair.split(\"=\", 2)\n return v !== undefined && SECRET_PARAMS.has(k!.toLowerCase()) ? `${k}=[redacted]` : pair\n })\n .join(\"&\")\n}\n\nfunction redactUrl(url: string): string {\n const i = url.indexOf(\"?\")\n return i < 0 ? url : url.slice(0, i + 1) + redactQuery(url.slice(i + 1))\n}\n\n// For values that are either a URL/path or a bare query string (no `?`).\nfunction redactUrlOrQuery(v: string): string {\n return v.includes(\"?\") ? redactUrl(v) : redactQuery(v)\n}\n\ntype Dict = Record<string, unknown>\n\nexport interface SentryEventLike {\n server_name?: string\n user?: Dict\n request?: { url?: string; query_string?: unknown; cookies?: unknown; headers?: Record<string, string>; data?: unknown }\n message?: string\n exception?: { values?: Array<{ type?: string; value?: string }> }\n breadcrumbs?: Array<{ message?: string; data?: Dict }>\n contexts?: { nextjs?: Dict } & Dict\n}\n\nexport function scrubEvent<E extends SentryEventLike>(e: E): E {\n delete e.server_name\n if (e.user) e.user = e.user.id ? { id: e.user.id } : {}\n if (e.request) {\n delete e.request.cookies\n delete e.request.data\n if (e.request.url) e.request.url = redactUrl(e.request.url)\n if (typeof e.request.query_string === \"string\") e.request.query_string = redactQuery(e.request.query_string)\n if (e.request.headers) {\n e.request.headers = Object.fromEntries(\n Object.entries(e.request.headers).filter(([k]) => !SECRET_HEADERS.has(k.toLowerCase())),\n )\n }\n }\n const nextjs = e.contexts?.nextjs\n if (typeof nextjs?.request_path === \"string\") nextjs.request_path = redactUrl(nextjs.request_path)\n if (e.message) e.message = redactText(e.message)\n for (const v of e.exception?.values ?? []) if (v.value) v.value = redactText(v.value)\n for (const b of e.breadcrumbs ?? []) {\n if (b.message) b.message = redactText(b.message)\n const d = b.data\n if (!d) continue\n for (const k of [\"url\", \"from\", \"to\"]) if (typeof d[k] === \"string\") d[k] = redactUrl(d[k])\n if (typeof d[\"http.query\"] === \"string\") d[\"http.query\"] = redactUrlOrQuery(d[\"http.query\"])\n if (Array.isArray(d.arguments)) d.arguments = d.arguments.map((a) => (typeof a === \"string\" ? redactText(a) : a))\n }\n return e\n}\n\nexport interface SentryLogLike {\n message: string\n attributes?: Dict\n}\n\nexport function scrubLog<L extends SentryLogLike>(l: L): L {\n l.message = redactText(l.message)\n if (l.attributes) {\n const out: Dict = {}\n for (const [k, v] of Object.entries(l.attributes)) {\n if (DROP_LOG_ATTRS.has(k)) continue\n out[k] = typeof v === \"string\" ? redactText(v) : v\n }\n l.attributes = out\n }\n return l\n}\n\nexport interface SentrySpanLike {\n description?: string\n data?: Dict\n}\n\nexport function scrubSpan<S extends SentrySpanLike>(s: S): S {\n // Browser page-metric spans are described by the full page URL.\n if (typeof s.description === \"string\") s.description = redactUrl(s.description)\n for (const [k, v] of Object.entries(s.data ?? {})) {\n if (DROP_SPAN_KEYS.has(k) || DROP_SPAN_PREFIXES.some((p) => k.startsWith(p))) delete s.data![k]\n else if (REDACT_KEYS.has(k) || REDACT_PREFIXES.some((p) => k.startsWith(p))) s.data![k] = REDACTED\n else if (typeof v === \"string\" && URL_SPAN_KEYS.has(k)) s.data![k] = redactUrlOrQuery(v)\n }\n return s\n}\n","import { makeDevSinkTransport } from \"./dev-sink\"\nimport type { SentryConfig } from \"./env\"\nimport { createTracesSampler, type SamplingContextLike } from \"./sampler\"\nimport { SECRET_PARAMS, scrubEvent, scrubLog, scrubSpan } from \"./scrub\"\n\nexport type Runtime = \"node\" | \"edge\" | \"browser\"\n\n// Structural copy of @sentry/core's DataCollection (10.75+): stop PII at collection,\n// the scrubbers stay as the backstop. Older 10.x ignores the unknown option.\nexport interface QoreDataCollection {\n userInfo: false\n cookies: false\n httpHeaders: { request: false; response: false }\n httpBodies: []\n databaseQueryData: false\n stackFrameVariables: false\n genAI: { inputs: false; outputs: false }\n urlQueryParams: { deny: string[] }\n}\n\nexport interface QoreSentryOptions {\n dsn: string\n environment: string\n release?: string\n sendDefaultPii: false\n dataCollection: QoreDataCollection\n enableLogs: true\n tracesSampler: (ctx: SamplingContextLike) => number\n tracePropagationTargets: Array<string | RegExp>\n beforeSend: typeof scrubEvent\n beforeSendTransaction: typeof scrubEvent\n beforeSendLog: typeof scrubLog\n beforeSendSpan: typeof scrubSpan\n initialScope: { tags: Record<string, string> }\n transport?: ReturnType<typeof makeDevSinkTransport>\n}\n\nfunction isTty(): boolean {\n try {\n return typeof process !== \"undefined\" && process.stdout?.isTTY === true\n } catch {\n return false\n }\n}\n\nexport function buildOptions(runtime: Runtime, cfg: SentryConfig): QoreSentryOptions {\n return {\n dsn: cfg.dsn,\n environment: cfg.environment,\n release: cfg.release,\n sendDefaultPii: false,\n dataCollection: {\n userInfo: false,\n cookies: false,\n httpHeaders: { request: false, response: false },\n httpBodies: [],\n databaseQueryData: false,\n stackFrameVariables: false,\n genAI: { inputs: false, outputs: false },\n urlQueryParams: { deny: [...SECRET_PARAMS] },\n },\n enableLogs: true,\n tracesSampler: createTracesSampler({\n production: cfg.environment === \"production\",\n readRate: cfg.readSampleRate,\n healthPath: cfg.healthPath,\n }),\n tracePropagationTargets: runtime === \"browser\" ? [/^\\//] : cfg.connOrigins,\n beforeSend: scrubEvent,\n beforeSendTransaction: scrubEvent,\n beforeSendLog: scrubLog,\n beforeSendSpan: scrubSpan,\n initialScope: { tags: cfg.tags },\n ...(cfg.local\n ? { transport: makeDevSinkTransport({ traces: cfg.devTraces ?? \"line\", color: runtime !== \"browser\" && isTty() }) }\n : {}),\n }\n}\n","import { setTelemetryHooks } from \"../telemetry-hooks\"\nimport type { SentryConfig } from \"./env\"\nimport { buildOptions, type Runtime } from \"./options\"\n\nexport interface SentryLike {\n init(options: object): unknown\n logger: Record<\"debug\" | \"info\" | \"warn\" | \"error\", (msg: string, attrs?: Record<string, string | number | boolean>) => void>\n setUser(user: { id: string } | null): void\n captureException(err: unknown, hint?: object): unknown\n}\n\nconst DONE = Symbol.for(\"@quatronic/sdk.sentry-initialised\")\ntype Holder = { [DONE]?: boolean }\nconst holder = globalThis as Holder\n\n// A factory `extra` runs only once the guard passes, inside the try: integrations\n// such as Replay throw when constructed twice.\nexport function initSentry(\n sentry: SentryLike,\n runtime: Runtime,\n cfg: SentryConfig | null,\n extra: object | (() => object) = {},\n): boolean {\n if (!cfg || holder[DONE]) return false\n holder[DONE] = true\n try {\n const extras = typeof extra === \"function\" ? extra() : extra\n sentry.init({ ...extras, ...buildOptions(runtime, cfg) })\n } catch (err) {\n console.error(\"[qore] Sentry init failed\", err)\n return false\n }\n setTelemetryHooks({\n log: sentry.logger,\n setUser: (u) => sentry.setUser(u),\n captureException: (err, hint) => {\n sentry.captureException(err, hint)\n },\n })\n return true\n}\n\nexport function resetSentryInitForTests(): void {\n delete holder[DONE]\n}\n"],"mappings":";;;;;;;;AAWA,IAAM,cAAc,oBAAI,IAAI,CAAC,gBAAgB,cAAc,CAAC;AAI5D,IAAM,eAAe;AAEd,SAAS,YAAY,QAAgB,OAA2B,CAAC,GAAY;AAClF,MAAI,aAAa,KAAK,MAAM,EAAG,QAAO;AACtC,QAAM,QAAQ,OAAO,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,KAAK;AAC/C,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,YAAY,IAAI,IAAI,EAAG,QAAO;AAClC,MAAI,KAAK,SAAS,MAAM,EAAG,QAAO;AAClC,MAAI,KAAK,WAAW,SAAS,EAAG,QAAO;AACvC,OAAK,KAAK,iBAAiB,CAAC,GAAG,KAAK,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,EAAG,QAAO;AACvE,MAAI,KAAK,cAAc,SAAS,KAAK,WAAY,QAAO;AACxD,SAAO;AACT;;;ACnBA,IAAM,YAAY,oBAAI,IAAI,CAAC,QAAQ,OAAO,SAAS,QAAQ,CAAC;AAE5D,IAAM,MAAM,CAAC,MAAoC,OAAO,MAAM,YAAY,IAAI,IAAI;AAElF,SAAS,OAAO,KAA8C;AAC5D,QAAM,IAAI,IAAI,cAAc,CAAC;AAC7B,SAAO,IAAI,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE,aAAa,CAAC,KAAK,IAAI,KAAK,MAAM,GAAG,EAAE,CAAC;AAC7E;AAEO,SAAS,oBAAoB,QAAuE;AACzG,SAAO,CAAC,QA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AAqB,EAAE,QAAQ,IAAI,aAAa,QAAQ,OAAO,YAAY,aAAa,MAAM,EAAE,CAAC,EAAE,IAChH,CAAC;AAAA,EACP;AACF;;;AClEA,IAAM,OAAO,uBAAO,IAAI,mCAAmC;AAE3D,IAAM,SAAS;AAIR,SAAS,WACd,QACA,SACA,KACA,QAAiC,CAAC,GACzB;AACT,MAAI,CAAC,OAAO,OAAO,IAAI,EAAG,QAAO;AACjC,SAAO,IAAI,IAAI;AACf,MAAI;AACF,UAAM,SAAS,OAAO,UAAU,aAAa,MAAM,IAAI;AACvD,WAAO,KAAK,EAAE,GAAG,QAAQ,GAAG,aAAa,SAAS,GAAG,EAAE,CAAC;AAAA,EAC1D,SAAS,KAAK;AACZ,YAAQ,MAAM,6BAA6B,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,oBAAkB;AAAA,IAChB,KAAK,OAAO;AAAA,IACZ,SAAS,CAAC,MAAM,OAAO,QAAQ,CAAC;AAAA,IAChC,kBAAkB,CAAC,KAAK,SAAS;AAC/B,aAAO,iBAAiB,KAAK,IAAI;AAAA,IACnC;AAAA,EACF,CAAC;AACD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/sentry-core/noise.ts","../src/sentry-core/sampler.ts","../src/sentry-core/scrub.ts","../src/sentry-core/options.ts","../src/sentry-core/init.ts"],"sourcesContent":["// Pure predicate deciding whether an HTTP request is infrastructural noise that\n// should never become a span: a `_rsc` query param, `/favicon.ico`, the SDK's\n// session poll, source maps, `/_next/*`, plus the caller's prefixes and health path.\n\nexport interface NoiseFilterOptions {\n healthPath?: string\n noisePrefixes?: string[]\n}\n\n// `/api/auth/me` is the SDK's own session poll (PortalProvider fires it on every\n// page mount): a heartbeat, not user activity.\nconst NOISE_EXACT = new Set([\"/favicon.ico\", \"/api/auth/me\"])\n\n// React Server Components navigations/prefetches carry a `?_rsc=` query param;\n// they look like real routes, so a path-prefix filter misses them.\nconst RSC_QUERY_RE = /[?&]_rsc=/\n\nexport function isNoisePath(rawUrl: string, opts: NoiseFilterOptions = {}): boolean {\n if (RSC_QUERY_RE.test(rawUrl)) return true\n const path = (rawUrl.split(\"?\")[0] ?? \"\").trim()\n if (!path) return false\n if (NOISE_EXACT.has(path)) return true\n if (path.endsWith(\".map\")) return true\n if (path.startsWith(\"/_next/\")) return true\n if ((opts.noisePrefixes ?? []).some((p) => path.startsWith(p))) return true\n if (opts.healthPath && path === opts.healthPath) return true\n return false\n}\n","import { isNoisePath } from \"./noise\"\n\nexport interface SamplingContextLike {\n name: string\n attributes?: Record<string, unknown>\n inheritOrSampleWith: (fallback: number) => number\n}\n\nconst MUTATIONS = new Set([\"POST\", \"PUT\", \"PATCH\", \"DELETE\"])\n\nconst str = (v: unknown): string | undefined => (typeof v === \"string\" && v ? v : undefined)\n\nfunction pathOf(ctx: SamplingContextLike): string | undefined {\n const a = ctx.attributes ?? {}\n return str(a[\"url.path\"]) ?? str(a[\"http.target\"]) ?? ctx.name.split(\" \")[1]\n}\n\nexport function createTracesSampler(policy: { production: boolean; readRate: number; healthPath: string }) {\n return (ctx: SamplingContextLike): number => {\n const path = pathOf(ctx)\n if (path && isNoisePath(path, { healthPath: policy.healthPath })) return 0\n const a = ctx.attributes ?? {}\n const method = (str(a[\"http.request.method\"]) ?? str(a[\"http.method\"]) ?? \"\").toUpperCase()\n if (MUTATIONS.has(method)) return 1\n return ctx.inheritOrSampleWith(policy.production ? policy.readRate : 1)\n }\n}\n","export const REDACTED = \"●●●\"\n\n// Bounded and anchored (`(?<![...])` + `{1,64}` local part, no `.` in the\n// domain-char class) so it cannot backtrack catastrophically on long runs of\n// email-charset bytes — see the fix-round-1 report for the O(n²) it replaced.\nconst EMAIL = /(?<![A-Z0-9._%+-])[A-Z0-9._%+-]{1,64}@[A-Z0-9-]+(?:\\.[A-Z0-9-]+)*\\.[A-Z]{2,}/gi\nconst JWT = /eyJ[\\w-]+\\.[\\w-]+\\.[\\w-]+/g\nconst AUTH_SCHEME = /\\b(Bearer|Basic)\\s+\\S+/gi\nconst PARAMS_TAIL = /\\bparams:\\s.*$/s\nexport const SECRET_PARAMS: ReadonlySet<string> = new Set([\"token\", \"code\", \"state\", \"password\", \"secret\", \"key\", \"session\", \"access_token\", \"refresh_token\", \"id_token\"])\nconst SECRET_HEADERS = new Set([\n \"authorization\",\n \"cookie\",\n \"set-cookie\",\n \"x-qdc-connection-token\",\n \"x-forwarded-for\",\n \"x-real-ip\",\n \"forwarded\",\n \"user-agent\",\n])\nconst DROP_LOG_ATTRS = new Set([\"ip\", \"ip_address\", \"user_agent\", \"email\", \"user_email\", \"server.address\"])\nconst REDACT_KEYS = new Set([\"db.connection_string\", \"db.user\"])\nconst REDACT_PREFIXES = [\"net.peer.\", \"net.sock.\", \"net.host.\", \"network.peer.\", \"network.local.\"]\nconst DROP_SPAN_KEYS = new Set([\"user_agent.original\", \"http.user_agent\", \"client.address\", \"http.client_ip\"])\nconst DROP_SPAN_PREFIXES = [\"http.request.header.\", \"http.response.header.\"]\nconst URL_SPAN_KEYS = new Set([\"url.full\", \"http.url\", \"url\", \"http.target\", \"url.query\", \"http.query\"])\n\nexport function redactText(s: string): string {\n return s\n .replace(PARAMS_TAIL, \"params: [redacted]\")\n .replace(AUTH_SCHEME, \"$1 [redacted]\")\n .replace(JWT, \"[jwt]\")\n .replace(EMAIL, \"[email]\")\n}\n\nfunction redactQuery(query: string): string {\n return query\n .split(\"&\")\n .map((pair) => {\n const [k, v] = pair.split(\"=\", 2)\n return v !== undefined && SECRET_PARAMS.has(k!.toLowerCase()) ? `${k}=[redacted]` : pair\n })\n .join(\"&\")\n}\n\nfunction redactUrl(url: string): string {\n const i = url.indexOf(\"?\")\n return i < 0 ? url : url.slice(0, i + 1) + redactQuery(url.slice(i + 1))\n}\n\n// For values that are either a URL/path or a bare query string (no `?`).\nfunction redactUrlOrQuery(v: string): string {\n return v.includes(\"?\") ? redactUrl(v) : redactQuery(v)\n}\n\ntype Dict = Record<string, unknown>\n\nexport interface SentryEventLike {\n server_name?: string\n user?: Dict\n request?: { url?: string; query_string?: unknown; cookies?: unknown; headers?: Record<string, string>; data?: unknown }\n message?: string\n exception?: { values?: Array<{ type?: string; value?: string }> }\n breadcrumbs?: Array<{ message?: string; data?: Dict }>\n contexts?: { nextjs?: Dict } & Dict\n}\n\nexport function scrubEvent<E extends SentryEventLike>(e: E): E {\n delete e.server_name\n if (e.user) e.user = e.user.id ? { id: e.user.id } : {}\n if (e.request) {\n delete e.request.cookies\n delete e.request.data\n if (e.request.url) e.request.url = redactUrl(e.request.url)\n if (typeof e.request.query_string === \"string\") e.request.query_string = redactQuery(e.request.query_string)\n if (e.request.headers) {\n e.request.headers = Object.fromEntries(\n Object.entries(e.request.headers).filter(([k]) => !SECRET_HEADERS.has(k.toLowerCase())),\n )\n }\n }\n const nextjs = e.contexts?.nextjs\n if (typeof nextjs?.request_path === \"string\") nextjs.request_path = redactUrl(nextjs.request_path)\n if (e.message) e.message = redactText(e.message)\n for (const v of e.exception?.values ?? []) if (v.value) v.value = redactText(v.value)\n for (const b of e.breadcrumbs ?? []) {\n if (b.message) b.message = redactText(b.message)\n const d = b.data\n if (!d) continue\n for (const k of [\"url\", \"from\", \"to\"]) if (typeof d[k] === \"string\") d[k] = redactUrl(d[k])\n if (typeof d[\"http.query\"] === \"string\") d[\"http.query\"] = redactUrlOrQuery(d[\"http.query\"])\n if (Array.isArray(d.arguments)) d.arguments = d.arguments.map((a) => (typeof a === \"string\" ? redactText(a) : a))\n }\n return e\n}\n\nexport interface SentryLogLike {\n message: string\n attributes?: Dict\n}\n\nexport function scrubLog<L extends SentryLogLike>(l: L): L {\n l.message = redactText(l.message)\n if (l.attributes) {\n const out: Dict = {}\n for (const [k, v] of Object.entries(l.attributes)) {\n if (DROP_LOG_ATTRS.has(k)) continue\n out[k] = typeof v === \"string\" ? redactText(v) : v\n }\n l.attributes = out\n }\n return l\n}\n\nexport interface SentrySpanLike {\n description?: string\n data?: Dict\n}\n\nexport function scrubSpan<S extends SentrySpanLike>(s: S): S {\n // Browser page-metric spans are described by the full page URL.\n if (typeof s.description === \"string\") s.description = redactUrl(s.description)\n for (const [k, v] of Object.entries(s.data ?? {})) {\n if (DROP_SPAN_KEYS.has(k) || DROP_SPAN_PREFIXES.some((p) => k.startsWith(p))) delete s.data![k]\n else if (REDACT_KEYS.has(k) || REDACT_PREFIXES.some((p) => k.startsWith(p))) s.data![k] = REDACTED\n else if (typeof v === \"string\" && URL_SPAN_KEYS.has(k)) s.data![k] = redactUrlOrQuery(v)\n }\n return s\n}\n","import { makeDevSinkTransport } from \"./dev-sink\"\nimport type { SentryConfig } from \"./env\"\nimport { createTracesSampler, type SamplingContextLike } from \"./sampler\"\nimport { SECRET_PARAMS, scrubEvent, scrubLog, scrubSpan } from \"./scrub\"\n\nexport type Runtime = \"node\" | \"edge\" | \"browser\"\n\n// Structural copy of @sentry/core's DataCollection (10.75+): stop PII at collection,\n// the scrubbers stay as the backstop. Older 10.x ignores the unknown option.\nexport interface QoreDataCollection {\n userInfo: false\n cookies: false\n httpHeaders: { request: false; response: false }\n httpBodies: []\n databaseQueryData: false\n stackFrameVariables: false\n genAI: { inputs: false; outputs: false }\n urlQueryParams: { deny: string[] }\n}\n\nexport interface QoreSentryOptions {\n dsn: string\n environment: string\n release?: string\n sendDefaultPii: false\n dataCollection: QoreDataCollection\n enableLogs: true\n tracesSampler: (ctx: SamplingContextLike) => number\n tracePropagationTargets: Array<string | RegExp>\n beforeSend: typeof scrubEvent\n beforeSendTransaction: typeof scrubEvent\n beforeSendLog: typeof scrubLog\n beforeSendSpan: typeof scrubSpan\n initialScope: { tags: Record<string, string> }\n transport?: ReturnType<typeof makeDevSinkTransport>\n}\n\nfunction isTty(): boolean {\n try {\n return typeof process !== \"undefined\" && process.stdout?.isTTY === true\n } catch {\n return false\n }\n}\n\nexport function buildOptions(runtime: Runtime, cfg: SentryConfig): QoreSentryOptions {\n return {\n dsn: cfg.dsn,\n environment: cfg.environment,\n release: cfg.release,\n sendDefaultPii: false,\n dataCollection: {\n userInfo: false,\n cookies: false,\n httpHeaders: { request: false, response: false },\n httpBodies: [],\n databaseQueryData: false,\n stackFrameVariables: false,\n genAI: { inputs: false, outputs: false },\n urlQueryParams: { deny: [...SECRET_PARAMS] },\n },\n enableLogs: true,\n tracesSampler: createTracesSampler({\n production: cfg.environment === \"production\",\n readRate: cfg.readSampleRate,\n healthPath: cfg.healthPath,\n }),\n tracePropagationTargets: runtime === \"browser\" ? [/^\\//] : cfg.connOrigins,\n beforeSend: scrubEvent,\n beforeSendTransaction: scrubEvent,\n beforeSendLog: scrubLog,\n beforeSendSpan: scrubSpan,\n initialScope: { tags: cfg.tags },\n ...(cfg.local\n ? { transport: makeDevSinkTransport({ traces: cfg.devTraces ?? \"line\", color: runtime !== \"browser\" && isTty() }) }\n : {}),\n }\n}\n","import { setTelemetryHooks } from \"../telemetry-hooks\"\nimport type { SentryConfig } from \"./env\"\nimport { buildOptions, type Runtime } from \"./options\"\n\nexport interface SentryLike {\n init(options: object): unknown\n logger: Record<\"debug\" | \"info\" | \"warn\" | \"error\", (msg: string, attrs?: Record<string, string | number | boolean>) => void>\n setUser(user: { id: string } | null): void\n}\n\nconst DONE = Symbol.for(\"@quatronic/sdk.sentry-initialised\")\ntype Holder = { [DONE]?: boolean }\nconst holder = globalThis as Holder\n\n// A factory `extra` runs only once the guard passes, inside the try: integrations\n// such as Replay throw when constructed twice.\nexport function initSentry(\n sentry: SentryLike,\n runtime: Runtime,\n cfg: SentryConfig | null,\n extra: object | (() => object) = {},\n): boolean {\n if (!cfg || holder[DONE]) return false\n holder[DONE] = true\n try {\n const extras = typeof extra === \"function\" ? extra() : extra\n sentry.init({ ...extras, ...buildOptions(runtime, cfg) })\n } catch (err) {\n console.error(\"[qore] Sentry init failed\", err)\n return false\n }\n setTelemetryHooks({ log: sentry.logger, setUser: (u) => sentry.setUser(u) })\n return true\n}\n\nexport function resetSentryInitForTests(): void {\n delete holder[DONE]\n}\n"],"mappings":";;;;;;;;AAWA,IAAM,cAAc,oB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,IAAI;AACvD,WAAO,KAAK,EAAE,GAAG,QAAQ,GAAG,aAAa,SAAS,GAAG,EAAE,CAAC;AAAA,EAC1D,SAAS,KAAK;AACZ,YAAQ,MAAM,6BAA6B,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,oBAAkB,EAAE,KAAK,OAAO,QAAQ,SAAS,CAAC,MAAM,OAAO,QAAQ,CAAC,EAAE,CAAC;AAC3E,SAAO;AACT;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  CONNECTION_TOKEN_HEADER,
3
3
  ConnectionError,
4
4
  DEFAULT_CONNECTION_TIMEOUT_MS
5
- } from "./chunk-ROHIN74F.js";
5
+ } from "./chunk-TEBDKNUB.js";
6
6
  import {
7
7
  collectConnectionTokens,
8
8
  connKey,
@@ -139,4 +139,4 @@ export {
139
139
  assertConnections,
140
140
  assertInboundConnection
141
141
  };
142
- //# sourceMappingURL=chunk-ZZTO5Z3N.js.map
142
+ //# sourceMappingURL=chunk-HQT57ITV.js.map
@@ -40,16 +40,10 @@ function getLogger() {
40
40
  function setUserContext(id) {
41
41
  holder[KEY]?.setUser?.(id ? { id } : null);
42
42
  }
43
- function reportError(err, ctx = {}) {
44
- const capture = holder[KEY]?.captureException;
45
- if (capture) return capture(err, { extra: flattenAttrs(ctx) });
46
- emit("error", { ...ctx, err: err instanceof Error ? err : new Error(String(err)) }, "unhandled error reported");
47
- }
48
43
 
49
44
  export {
50
45
  setTelemetryHooks,
51
46
  getLogger,
52
- setUserContext,
53
- reportError
47
+ setUserContext
54
48
  };
55
- //# sourceMappingURL=chunk-EK6TGWWT.js.map
49
+ //# sourceMappingURL=chunk-MET4SIMB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/telemetry-hooks/index.ts"],"sourcesContent":["export type LogAttrs = Record<string, unknown>\ntype Flat = Record<string, string | number | boolean>\ntype Level = \"debug\" | \"info\" | \"warn\" | \"error\"\n\nexport interface QoreLogger {\n debug(attrs: LogAttrs, msg: string): void\n info(attrs: LogAttrs, msg: string): void\n warn(attrs: LogAttrs, msg: string): void\n error(attrs: LogAttrs, msg: string): void\n}\n\nexport interface TelemetryHooks {\n log?: Record<Level, (msg: string, attrs?: Flat) => void>\n setUser?: (user: { id: string } | null) => void\n}\n\nconst KEY = Symbol.for(\"@quatronic/sdk.telemetry-hooks\")\ntype Holder = { [KEY]?: TelemetryHooks }\nconst holder = globalThis as Holder\n\nexport function setTelemetryHooks(hooks: TelemetryHooks): void {\n holder[KEY] = hooks\n}\n\nexport function resetTelemetryHooks(): void {\n delete holder[KEY]\n}\n\nexport function flattenAttrs(attrs: LogAttrs): Flat {\n const out: Flat = {}\n for (const [key, value] of Object.entries(attrs)) {\n if (value === undefined || value === null) continue\n if (value instanceof Error) {\n out[\"error.type\"] = value.name\n out[\"error.message\"] = value.message\n } else if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n out[key] = value\n } else {\n out[key] = JSON.stringify(value)\n }\n }\n return out\n}\n\nfunction emit(level: Level, attrs: LogAttrs, msg: string): void {\n const flat = flattenAttrs(attrs)\n const sink = holder[KEY]?.log\n if (sink) return sink[level](msg, flat)\n const line = JSON.stringify({ level, msg, ...flat })\n if (level === \"error\") console.error(line)\n else if (level === \"warn\") console.warn(line)\n else console.log(line)\n}\n\nconst logger: QoreLogger = {\n debug: (a, m) => emit(\"debug\", a, m),\n info: (a, m) => emit(\"info\", a, m),\n warn: (a, m) => emit(\"warn\", a, m),\n error: (a, m) => emit(\"error\", a, m),\n}\n\nexport function getLogger(): QoreLogger {\n return logger\n}\n\nexport function setUserContext(id: string | null): void {\n holder[KEY]?.setUser?.(id ? { id } : null)\n}\n"],"mappings":";AAgBA,IAAM,MAAM,uBAAO,IAAI,gCAAgC;AAEvD,IAAM,SAAS;AAER,SAAS,kBAAkB,OAA6B;AAC7D,SAAO,GAAG,IAAI;AAChB;AAMO,SAAS,aAAa,OAAuB;AAClD,QAAM,MAAY,CAAC;AACnB,aAAW,CAAC,KAAK,KAAK,K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IMB.js";
8
8
 
9
9
  // src/connections-core/errors.ts
10
10
  var ConnectionError = class extends Error {
@@ -70,4 +70,4 @@ export {
70
70
  CONNECTION_REJECT_REASON_ATTR,
71
71
  requireConnection
72
72
  };
73
- //# sourceMappingURL=chunk-ROHIN74F.js.map
73
+ //# sourceMappingURL=chunk-TEBDKNUB.js.map
@@ -172,6 +172,103 @@ off the SDK's lint rules that check the same things.
172
172
  The \`qore-\` prefix is reserved for managed skills. Sync never touches a skill
173
173
  it does not ship, so your own skills are safe under any other name.
174
174
  `;
175
+ var APP_README_PATH = "README.md";
176
+ function isLegacyAppReadme(text) {
177
+ const flat = text.replace(/\s+/g, " ");
178
+ return flat.includes("frozen at generation time") && flat.includes("The `quatronic-` prefix is reserved");
179
+ }
180
+ var APP_README_HEAD = `# Claude Code setup for this app
181
+
182
+ This app ships with a Qore Claude Code setup, committed into this repo. The
183
+ \`qore-*\` skills are managed by the SDK; everything else here is yours.
184
+ `;
185
+ var APP_README_CONVENTIONS = `## Conventions
186
+
187
+ - The \`qore-*\` skills are managed by \`@quatronic/sdk\` and stay current with it:
188
+ every SDK upgrade PR re-syncs them. How to turn one off, extend it with your
189
+ own conventions, replace it or keep your own copy is in
190
+ \`qore/README.md\`; editing a managed skill in place does not stick.
191
+ - The \`qore-\` prefix is reserved for managed skills. Name your own skills
192
+ without it (e.g. \`.claude/skills/export-report/SKILL.md\`); sync never touches
193
+ them.
194
+ - \`settings.json\` is yours: it was generated once and nothing re-syncs it.
195
+ `;
196
+ function appReadme(runtime) {
197
+ if (runtime === "next") {
198
+ return `${APP_README_HEAD}
199
+ > New here? Run \`/qore-recommended-tools\` for optional, public skills and
200
+ > plugins (like \`superpowers\` and \`frontend-design\`) that pair well with this app.
201
+
202
+ ## What's here
203
+
204
+ - \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
205
+ written (\`.env.example\` stays readable), destructive git is blocked, and \`git push\` plus edits to the auth/SDK
206
+ boundary files ask for confirmation.
207
+ - \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
208
+ \`qore/skills.md\` (imported into \`CLAUDE.md\`). Highlights:
209
+ \`/qore-ship-checklist\` (the quality gate to run before every PR),
210
+ \`/qore-author-skill\` to write your own, and \`/qore-recommended-tools\` for
211
+ optional public skills/plugins.
212
+ - \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
213
+ \`skills.md\` (the index) and \`manifest.json\` (what sync manages).
214
+ - \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
215
+ pipeline, which runs lint, format-check, typecheck, unit tests,
216
+ integration tests and build on every pull request and on every push to
217
+ \`main\`. Each of those is one of *your* \`package.json\` scripts, so change
218
+ what a check does by changing the script. Add your own jobs to the
219
+ \`verify\` job's \`needs:\` list; leave the shared call alone, as edits to it
220
+ are replaced when the pipeline is upgraded.
221
+
222
+ ${APP_README_CONVENTIONS}`;
223
+ }
224
+ return `${APP_README_HEAD}
225
+ ## What's here
226
+
227
+ - \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
228
+ written, destructive git is blocked, and \`git push\` asks for confirmation.
229
+ - \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
230
+ \`qore/skills.md\` (imported into \`CLAUDE.md\`).
231
+ - \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
232
+ \`skills.md\` (the index) and \`manifest.json\` (what sync manages).
233
+ - \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
234
+ pipeline, which runs typecheck, unit tests and build on every pull request
235
+ and on every push to \`main\`. Each of those is one of *your*
236
+ \`package.json\` scripts, so change what a check does by changing the
237
+ script; adding a \`lint\` script is not enough on its own, since the call
238
+ also has to ask for that check. Add your own jobs to the \`verify\` job's
239
+ \`needs:\` list; leave the shared call alone, as edits to it are replaced
240
+ when the pipeline is upgraded.
241
+
242
+ ${APP_README_CONVENTIONS}`;
243
+ }
244
+ var TABLE_ROW = /^\s*\|(.*)\|\s*$/;
245
+ var TABLE_RULE = /^\s*\|[\s:|-]+\|\s*$/;
246
+ var firstCell = (line) => TABLE_ROW.exec(line)?.[1].split("|")[0].trim();
247
+ function replaceSkillsTable(md, names) {
248
+ const eol = md.includes("\r\n") ? "\r\n" : "\n";
249
+ const lines = md.split(/\r?\n/);
250
+ for (let i = 0; i + 2 < lines.length; i++) {
251
+ if (!/^skill$/i.test(firstCell(lines[i]) ?? "") || !TABLE_RULE.test(lines[i + 1])) continue;
252
+ let end = i + 2;
253
+ while (end < lines.length && firstCell(lines[end]) !== void 0) end++;
254
+ const rows = lines.slice(i + 2, end);
255
+ const managed = rows.length > 0 && rows.every((r) => {
256
+ const name = /^`\/?([a-z0-9-]+)`$/.exec(firstCell(r))?.[1];
257
+ return name !== void 0 && names.has(name);
258
+ });
259
+ if (!managed) continue;
260
+ const out = [];
261
+ lines.forEach((line, j) => {
262
+ if (j === i) out.push(CLAUDE_MD_IMPORT);
263
+ else if (j > i && j < end) return;
264
+ else if (line.trim() === CLAUDE_MD_IMPORT) {
265
+ if (out.at(-1)?.trim() === "") out.pop();
266
+ } else out.push(line);
267
+ });
268
+ return out.join(eol);
269
+ }
270
+ return void 0;
271
+ }
175
272
  function buildTree(catalog, sources, f) {
176
273
  const skills = renderSkills(catalog, sources, f);
177
274
  for (const entry of catalog.skills) {
@@ -246,6 +343,7 @@ function planSync(s) {
246
343
  let claudeMd = s.claudeMd;
247
344
  const claudeMdRenamed = [];
248
345
  let claudeMdImportAdded = false;
346
+ let claudeMdTableReplaced = false;
249
347
  if (claudeMd !== void 0) {
250
348
  for (const entry of s.catalog.skills) {
251
349
  for (const legacy of entry.legacyNames ?? []) {
@@ -255,6 +353,11 @@ function planSync(s) {
255
353
  claudeMdRenamed.push([legacy, entry.name]);
256
354
  }
257
355
  }
356
+ const withoutTable = replaceSkillsTable(claudeMd, new Set(s.catalog.skills.map((e) => e.name)));
357
+ if (withoutTable !== void 0) {
358
+ claudeMd = withoutTable;
359
+ claudeMdTableReplaced = true;
360
+ }
258
361
  if (!claudeMd.split(/\r?\n/).some((l) => l.trim() === CLAUDE_MD_IMPORT)) {
259
362
  claudeMd = `${claudeMd.replace(/\s*$/, "")}
260
363
 
@@ -263,6 +366,9 @@ ${CLAUDE_MD_IMPORT}
263
366
  claudeMdImportAdded = true;
264
367
  }
265
368
  }
369
+ const currentReadme = s.read(APP_README_PATH);
370
+ const appReadmeReplaced = currentReadme !== void 0 && isLegacyAppReadme(currentReadme);
371
+ if (appReadmeReplaced) writes.set(APP_README_PATH, appReadme(s.features.runtime));
266
372
  const manifest = {
267
373
  schemaVersion: 1,
268
374
  sdkVersion: s.sdkVersion,
@@ -284,7 +390,9 @@ ${CLAUDE_MD_IMPORT}
284
390
  manifest,
285
391
  claudeMd: claudeMd === s.claudeMd ? void 0 : claudeMd,
286
392
  claudeMdRenamed: claudeMdRenamed.sort(([a], [b]) => a.localeCompare(b)),
287
- claudeMdImportAdded
393
+ claudeMdImportAdded,
394
+ claudeMdTableReplaced,
395
+ appReadmeReplaced
288
396
  };
289
397
  }
290
398
  function planChanges(p) {
@@ -316,9 +424,18 @@ function renderReport(p, opts) {
316
424
  p.legacyRemoved,
317
425
  "(replaced by their `qore-*` names; a local edit to one is in this change's diff):"
318
426
  );
427
+ if (p.appReadmeReplaced) {
428
+ lines.push(
429
+ "",
430
+ "**`.claude/README.md`** replaced: the generator's text said this setup is frozen and yours to edit, which the managed skills no longer are. A change of your own to it is in this change's diff."
431
+ );
432
+ }
319
433
  if (p.claudeMd !== void 0) {
320
434
  lines.push("", "**`CLAUDE.md`:**", "");
321
435
  for (const [from, to] of p.claudeMdRenamed) lines.push(`- Renamed \`${from}\` to \`${to}\`.`);
436
+ if (p.claudeMdTableReplaced) {
437
+ lines.push(`- Replaced the generated skills table with \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
438
+ }
322
439
  if (p.claudeMdImportAdded) lines.push(`- Imports \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
323
440
  }
324
441
  return `${lines.join("\n")}
@@ -171,6 +171,103 @@ off the SDK's lint rules that check the same things.
171
171
  The \`qore-\` prefix is reserved for managed skills. Sync never touches a skill
172
172
  it does not ship, so your own skills are safe under any other name.
173
173
  `;
174
+ var APP_README_PATH = "README.md";
175
+ function isLegacyAppReadme(text) {
176
+ const flat = text.replace(/\s+/g, " ");
177
+ return flat.includes("frozen at generation time") && flat.includes("The `quatronic-` prefix is reserved");
178
+ }
179
+ var APP_README_HEAD = `# Claude Code setup for this app
180
+
181
+ This app ships with a Qore Claude Code setup, committed into this repo. The
182
+ \`qore-*\` skills are managed by the SDK; everything else here is yours.
183
+ `;
184
+ var APP_README_CONVENTIONS = `## Conventions
185
+
186
+ - The \`qore-*\` skills are managed by \`@quatronic/sdk\` and stay current with it:
187
+ every SDK upgrade PR re-syncs them. How to turn one off, extend it with your
188
+ own conventions, replace it or keep your own copy is in
189
+ \`qore/README.md\`; editing a managed skill in place does not stick.
190
+ - The \`qore-\` prefix is reserved for managed skills. Name your own skills
191
+ without it (e.g. \`.claude/skills/export-report/SKILL.md\`); sync never touches
192
+ them.
193
+ - \`settings.json\` is yours: it was generated once and nothing re-syncs it.
194
+ `;
195
+ function appReadme(runtime) {
196
+ if (runtime === "next") {
197
+ return `${APP_README_HEAD}
198
+ > New here? Run \`/qore-recommended-tools\` for optional, public skills and
199
+ > plugins (like \`superpowers\` and \`frontend-design\`) that pair well with this app.
200
+
201
+ ## What's here
202
+
203
+ - \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
204
+ written (\`.env.example\` stays readable), destructive git is blocked, and \`git push\` plus edits to the auth/SDK
205
+ boundary files ask for confirmation.
206
+ - \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
207
+ \`qore/skills.md\` (imported into \`CLAUDE.md\`). Highlights:
208
+ \`/qore-ship-checklist\` (the quality gate to run before every PR),
209
+ \`/qore-author-skill\` to write your own, and \`/qore-recommended-tools\` for
210
+ optional public skills/plugins.
211
+ - \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
212
+ \`skills.md\` (the index) and \`manifest.json\` (what sync manages).
213
+ - \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
214
+ pipeline, which runs lint, format-check, typecheck, unit tests,
215
+ integration tests and build on every pull request and on every push to
216
+ \`main\`. Each of those is one of *your* \`package.json\` scripts, so change
217
+ what a check does by changing the script. Add your own jobs to the
218
+ \`verify\` job's \`needs:\` list; leave the shared call alone, as edits to it
219
+ are replaced when the pipeline is upgraded.
220
+
221
+ ${APP_README_CONVENTIONS}`;
222
+ }
223
+ return `${APP_README_HEAD}
224
+ ## What's here
225
+
226
+ - \`settings.json\` \u2014 a safe permission floor: secrets (\`.env\`, \`.env.local\`) can't be read or
227
+ written, destructive git is blocked, and \`git push\` asks for confirmation.
228
+ - \`skills/qore-*\` \u2014 the managed skills, listed with when to reach for each in
229
+ \`qore/skills.md\` (imported into \`CLAUDE.md\`).
230
+ - \`qore/\` \u2014 \`README.md\` (what you can and can't do with managed skills),
231
+ \`skills.md\` (the index) and \`manifest.json\` (what sync manages).
232
+ - \`../.github/workflows/ci.yml\` \u2014 the PR gate. It calls Quatronic's shared
233
+ pipeline, which runs typecheck, unit tests and build on every pull request
234
+ and on every push to \`main\`. Each of those is one of *your*
235
+ \`package.json\` scripts, so change what a check does by changing the
236
+ script; adding a \`lint\` script is not enough on its own, since the call
237
+ also has to ask for that check. Add your own jobs to the \`verify\` job's
238
+ \`needs:\` list; leave the shared call alone, as edits to it are replaced
239
+ when the pipeline is upgraded.
240
+
241
+ ${APP_README_CONVENTIONS}`;
242
+ }
243
+ var TABLE_ROW = /^\s*\|(.*)\|\s*$/;
244
+ var TABLE_RULE = /^\s*\|[\s:|-]+\|\s*$/;
245
+ var firstCell = (line) => TABLE_ROW.exec(line)?.[1].split("|")[0].trim();
246
+ function replaceSkillsTable(md, names) {
247
+ const eol = md.includes("\r\n") ? "\r\n" : "\n";
248
+ const lines = md.split(/\r?\n/);
249
+ for (let i = 0; i + 2 < lines.length; i++) {
250
+ if (!/^skill$/i.test(firstCell(lines[i]) ?? "") || !TABLE_RULE.test(lines[i + 1])) continue;
251
+ let end = i + 2;
252
+ while (end < lines.length && firstCell(lines[end]) !== void 0) end++;
253
+ const rows = lines.slice(i + 2, end);
254
+ const managed = rows.length > 0 && rows.every((r) => {
255
+ const name = /^`\/?([a-z0-9-]+)`$/.exec(firstCell(r))?.[1];
256
+ return name !== void 0 && names.has(name);
257
+ });
258
+ if (!managed) continue;
259
+ const out = [];
260
+ lines.forEach((line, j) => {
261
+ if (j === i) out.push(CLAUDE_MD_IMPORT);
262
+ else if (j > i && j < end) return;
263
+ else if (line.trim() === CLAUDE_MD_IMPORT) {
264
+ if (out.at(-1)?.trim() === "") out.pop();
265
+ } else out.push(line);
266
+ });
267
+ return out.join(eol);
268
+ }
269
+ return void 0;
270
+ }
174
271
  function buildTree(catalog, sources, f) {
175
272
  const skills = renderSkills(catalog, sources, f);
176
273
  for (const entry of catalog.skills) {
@@ -245,6 +342,7 @@ function planSync(s) {
245
342
  let claudeMd = s.claudeMd;
246
343
  const claudeMdRenamed = [];
247
344
  let claudeMdImportAdded = false;
345
+ let claudeMdTableReplaced = false;
248
346
  if (claudeMd !== void 0) {
249
347
  for (const entry of s.catalog.skills) {
250
348
  for (const legacy of entry.legacyNames ?? []) {
@@ -254,6 +352,11 @@ function planSync(s) {
254
352
  claudeMdRenamed.push([legacy, entry.name]);
255
353
  }
256
354
  }
355
+ const withoutTable = replaceSkillsTable(claudeMd, new Set(s.catalog.skills.map((e) => e.name)));
356
+ if (withoutTable !== void 0) {
357
+ claudeMd = withoutTable;
358
+ claudeMdTableReplaced = true;
359
+ }
257
360
  if (!claudeMd.split(/\r?\n/).some((l) => l.trim() === CLAUDE_MD_IMPORT)) {
258
361
  claudeMd = `${claudeMd.replace(/\s*$/, "")}
259
362
 
@@ -262,6 +365,9 @@ ${CLAUDE_MD_IMPORT}
262
365
  claudeMdImportAdded = true;
263
366
  }
264
367
  }
368
+ const currentReadme = s.read(APP_README_PATH);
369
+ const appReadmeReplaced = currentReadme !== void 0 && isLegacyAppReadme(currentReadme);
370
+ if (appReadmeReplaced) writes.set(APP_README_PATH, appReadme(s.features.runtime));
265
371
  const manifest = {
266
372
  schemaVersion: 1,
267
373
  sdkVersion: s.sdkVersion,
@@ -283,7 +389,9 @@ ${CLAUDE_MD_IMPORT}
283
389
  manifest,
284
390
  claudeMd: claudeMd === s.claudeMd ? void 0 : claudeMd,
285
391
  claudeMdRenamed: claudeMdRenamed.sort(([a], [b]) => a.localeCompare(b)),
286
- claudeMdImportAdded
392
+ claudeMdImportAdded,
393
+ claudeMdTableReplaced,
394
+ appReadmeReplaced
287
395
  };
288
396
  }
289
397
  function planChanges(p) {
@@ -315,9 +423,18 @@ function renderReport(p, opts) {
315
423
  p.legacyRemoved,
316
424
  "(replaced by their `qore-*` names; a local edit to one is in this change's diff):"
317
425
  );
426
+ if (p.appReadmeReplaced) {
427
+ lines.push(
428
+ "",
429
+ "**`.claude/README.md`** replaced: the generator's text said this setup is frozen and yours to edit, which the managed skills no longer are. A change of your own to it is in this change's diff."
430
+ );
431
+ }
318
432
  if (p.claudeMd !== void 0) {
319
433
  lines.push("", "**`CLAUDE.md`:**", "");
320
434
  for (const [from, to] of p.claudeMdRenamed) lines.push(`- Renamed \`${from}\` to \`${to}\`.`);
435
+ if (p.claudeMdTableReplaced) {
436
+ lines.push(`- Replaced the generated skills table with \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
437
+ }
321
438
  if (p.claudeMdImportAdded) lines.push(`- Imports \`${CLAUDE_MD_IMPORT}\`, the index of managed skills.`);
322
439
  }
323
440
  return `${lines.join("\n")}
@@ -445,24 +445,6 @@ var noSentryInit = {
445
445
  });
446
446
  }
447
447
  };
448
- var useReportError = {
449
- meta: meta("QDC-OBS-004 - report caught errors with reportError", "suggestion"),
450
- create(context) {
451
- const report = reporter(
452
- context,
453
- "QDC-OBS-004 - use reportError(err, ctx) from @quatronic/sdk/observability instead of Sentry.captureException; see migration report-error."
454
- );
455
- const sentry = trackSentry();
456
- return listener({
457
- ImportDeclaration: (node) => sentry.onImport(node),
458
- CallExpression: (node) => {
459
- const c = node.callee;
460
- const name = c?.type === "Identifier" ? sentry.named.get(c.name ?? "") : c?.type === "MemberExpression" && c.object?.type === "Identifier" && sentry.namespaces.has(c.object.name ?? "") ? c.property?.name : void 0;
461
- if (name === "captureException") report(node);
462
- }
463
- });
464
- }
465
- };
466
448
  var observabilityRules = {
467
449
  "no-sentry-init": noSentryInit,
468
450
  "sentry-attribute-namespace": attributeKeyRule(
@@ -474,14 +456,12 @@ var observabilityRules = {
474
456
  "QDC-OBS-003",
475
457
  "no personal data in telemetry keys",
476
458
  (key) => PII.test(key) ? `'${key}' looks like personal data. Send an id instead; see the qore-observability skill.` : void 0
477
- ),
478
- "use-report-error": useReportError
459
+ )
479
460
  };
480
461
  var OBSERVABILITY_RULE_IDS = {
481
462
  "no-sentry-init": "QDC-OBS-001",
482
463
  "sentry-attribute-namespace": "QDC-OBS-002",
483
- "no-pii-attributes": "QDC-OBS-003",
484
- "use-report-error": "QDC-OBS-004"
464
+ "no-pii-attributes": "QDC-OBS-003"
485
465
  };
486
466
 
487
467
  // src/eslint/index.ts