@cyanheads/mcp-ts-core 0.12.8 → 0.13.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 (118) hide show
  1. package/AGENTS.md +12 -11
  2. package/CLAUDE.md +12 -11
  3. package/README.md +2 -2
  4. package/biome.json +1 -1
  5. package/changelog/0.12.x/0.12.9.md +36 -0
  6. package/changelog/0.13.x/0.13.0.md +48 -0
  7. package/changelog/template.md +7 -24
  8. package/dist/cli/init.js +2 -2
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/config/envValue.d.ts +18 -0
  11. package/dist/config/envValue.d.ts.map +1 -0
  12. package/dist/config/envValue.js +35 -0
  13. package/dist/config/envValue.js.map +1 -0
  14. package/dist/config/index.d.ts.map +1 -1
  15. package/dist/config/index.js +5 -7
  16. package/dist/config/index.js.map +1 -1
  17. package/dist/config/parseEnvConfig.d.ts +7 -0
  18. package/dist/config/parseEnvConfig.d.ts.map +1 -1
  19. package/dist/config/parseEnvConfig.js +9 -1
  20. package/dist/config/parseEnvConfig.js.map +1 -1
  21. package/dist/linter/validate.js +2 -2
  22. package/dist/linter/validate.js.map +1 -1
  23. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
  24. package/dist/mcp-server/transports/http/httpTransport.js +70 -2
  25. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
  26. package/dist/mcp-server/transports/http/landing-page/sections/connect.d.ts.map +1 -1
  27. package/dist/mcp-server/transports/http/landing-page/sections/connect.js +9 -2
  28. package/dist/mcp-server/transports/http/landing-page/sections/connect.js.map +1 -1
  29. package/dist/mcp-server/transports/http/sessionStore.d.ts +10 -2
  30. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
  31. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
  32. package/dist/services/mirror/sqlite/handle.d.ts.map +1 -1
  33. package/dist/services/mirror/sqlite/handle.js +14 -12
  34. package/dist/services/mirror/sqlite/handle.js.map +1 -1
  35. package/dist/services/mirror/sqlite/sqliteMirrorStore.js +8 -9
  36. package/dist/services/mirror/sqlite/sqliteMirrorStore.js.map +1 -1
  37. package/dist/services/mirror/types.d.ts +5 -1
  38. package/dist/services/mirror/types.d.ts.map +1 -1
  39. package/dist/utils/internal/performance.d.ts +1 -1
  40. package/dist/utils/internal/performance.js +2 -2
  41. package/dist/utils/network/fetchWithTimeout.js +1 -1
  42. package/dist/utils/network/retry.js +1 -1
  43. package/dist/utils/security/idGenerator.d.ts +3 -1
  44. package/dist/utils/security/idGenerator.d.ts.map +1 -1
  45. package/dist/utils/security/idGenerator.js +12 -1
  46. package/dist/utils/security/idGenerator.js.map +1 -1
  47. package/framework-skills/README.md +40 -0
  48. package/{skills → framework-skills}/add-app-tool/SKILL.md +2 -2
  49. package/{skills → framework-skills}/add-resource/SKILL.md +2 -2
  50. package/{skills → framework-skills}/add-service/SKILL.md +2 -2
  51. package/{skills → framework-skills}/add-test/SKILL.md +2 -2
  52. package/{skills → framework-skills}/add-tool/SKILL.md +7 -7
  53. package/{skills → framework-skills}/api-config/SKILL.md +3 -1
  54. package/{skills → framework-skills}/api-context/SKILL.md +3 -3
  55. package/{skills → framework-skills}/api-errors/SKILL.md +2 -1
  56. package/{skills → framework-skills}/api-linter/SKILL.md +4 -4
  57. package/{skills → framework-skills}/api-mirror/SKILL.md +3 -1
  58. package/{skills → framework-skills}/design-mcp-server/SKILL.md +59 -101
  59. package/{skills → framework-skills}/field-test/SKILL.md +10 -5
  60. package/{skills → framework-skills}/git-wrapup/SKILL.md +5 -3
  61. package/{skills → framework-skills}/maintenance/SKILL.md +30 -21
  62. package/{skills → framework-skills}/orchestrations/SKILL.md +2 -2
  63. package/{skills → framework-skills}/orchestrations/workflows/field-test-fix.md +8 -8
  64. package/{skills → framework-skills}/orchestrations/workflows/fix-wrapup-release.md +5 -5
  65. package/{skills → framework-skills}/orchestrations/workflows/greenfield-build.md +11 -11
  66. package/{skills → framework-skills}/orchestrations/workflows/maintenance-release.md +12 -12
  67. package/{skills → framework-skills}/polish-docs-meta/SKILL.md +18 -10
  68. package/{skills → framework-skills}/polish-docs-meta/references/agent-protocol.md +1 -1
  69. package/{skills → framework-skills}/polish-docs-meta/references/package-meta.md +1 -1
  70. package/{skills → framework-skills}/polish-docs-meta/references/readme.md +88 -72
  71. package/{skills → framework-skills}/release-and-publish/SKILL.md +4 -1
  72. package/{skills → framework-skills}/release-pr-review/SKILL.md +2 -2
  73. package/{skills → framework-skills}/report-issue-framework/SKILL.md +25 -25
  74. package/{skills → framework-skills}/report-issue-local/SKILL.md +22 -24
  75. package/{skills → framework-skills}/security-pass/SKILL.md +2 -2
  76. package/{skills → framework-skills}/setup/SKILL.md +10 -8
  77. package/package.json +13 -13
  78. package/scripts/check-framework-antipatterns.ts +1 -1
  79. package/scripts/check-skill-versions.ts +16 -9
  80. package/scripts/check-skills-sync.ts +64 -13
  81. package/scripts/clean-mcpb.ts +3 -3
  82. package/scripts/devcheck.ts +37 -27
  83. package/scripts/lint-packaging.ts +158 -24
  84. package/scripts/list-skills.ts +2 -2
  85. package/templates/.claude-plugin/plugin.json +5 -1
  86. package/templates/.env.example +1 -1
  87. package/templates/.github/CONTRIBUTING.md +4 -5
  88. package/templates/.github/ISSUE_TEMPLATE/bug_report.yml +5 -4
  89. package/templates/.github/ISSUE_TEMPLATE/config.yml +6 -1
  90. package/templates/.github/ISSUE_TEMPLATE/feature_request.yml +1 -2
  91. package/templates/AGENTS.md +16 -15
  92. package/templates/CLAUDE.md +16 -15
  93. package/templates/_.mcpbignore +1 -1
  94. package/templates/changelog/template.md +7 -24
  95. package/templates/package.json +4 -3
  96. package/templates/src/mcp-server/resources/definitions/echo-app-ui.app-resource.ts +1 -1
  97. package/skills/README.md +0 -38
  98. /package/{skills → framework-skills}/add-export/SKILL.md +0 -0
  99. /package/{skills → framework-skills}/add-prompt/SKILL.md +0 -0
  100. /package/{skills → framework-skills}/add-provider/SKILL.md +0 -0
  101. /package/{skills → framework-skills}/api-auth/SKILL.md +0 -0
  102. /package/{skills → framework-skills}/api-canvas/SKILL.md +0 -0
  103. /package/{skills → framework-skills}/api-services/SKILL.md +0 -0
  104. /package/{skills → framework-skills}/api-services/references/graph.md +0 -0
  105. /package/{skills → framework-skills}/api-services/references/llm.md +0 -0
  106. /package/{skills → framework-skills}/api-services/references/speech.md +0 -0
  107. /package/{skills → framework-skills}/api-telemetry/SKILL.md +0 -0
  108. /package/{skills → framework-skills}/api-testing/SKILL.md +0 -0
  109. /package/{skills → framework-skills}/api-utils/SKILL.md +0 -0
  110. /package/{skills → framework-skills}/api-utils/references/formatting.md +0 -0
  111. /package/{skills → framework-skills}/api-utils/references/parsing.md +0 -0
  112. /package/{skills → framework-skills}/api-utils/references/security.md +0 -0
  113. /package/{skills → framework-skills}/api-workers/SKILL.md +0 -0
  114. /package/{skills → framework-skills}/code-simplifier/SKILL.md +0 -0
  115. /package/{skills → framework-skills}/polish-docs-meta/references/server-json.md +0 -0
  116. /package/{skills → framework-skills}/techniques/SKILL.md +0 -0
  117. /package/{skills → framework-skills}/techniques/references/outline-on-overflow.md +0 -0
  118. /package/{skills → framework-skills}/tool-defs-analysis/SKILL.md +0 -0
@@ -158,7 +158,11 @@ export interface QueryResult {
158
158
  }
159
159
  /** A schema migration: bump `version` and apply `up` on open when the stored version is lower. */
160
160
  export interface Migration {
161
- /** Apply the migration. Runs inside the open handle; should be idempotent. */
161
+ /**
162
+ * Apply the migration. Runs inside the open handle, on first creation as well
163
+ * as on upgrade, so it must be idempotent and tolerate a database that already
164
+ * has the current declarative schema.
165
+ */
162
166
  up(handle: SqliteHandle): void;
163
167
  /** Target schema version this migration produces. */
164
168
  version: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/mirror/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEjE,YAAY,EAAE,Y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CAAC,CAAC;IAC9C,gDAAgD;IAChD,cAAc,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC9D,6EAA6E;IAC7E,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD;;;;OAIG;IACH,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7B,qCAAqC;IACrC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,yGAAyG;IACzG,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,EAAE,WAAW,CAAC;IACnB,0DAA0D;IAC1D,IAAI,EAAE,aAAa,CAAC;CACrB"}
@@ -12,7 +12,7 @@ export declare function initHandlerMetrics(): void;
12
12
  * Returns the current time in milliseconds using `globalThis.performance.now()`.
13
13
  *
14
14
  * Sub-millisecond resolution is guaranteed on all supported engine floors
15
- * (Node ≥24, Bun ≥1.3, Cloudflare Workers). The returned value is suitable for
15
+ * (Node ≥24, Bun ≥1.4, Cloudflare Workers). The returned value is suitable for
16
16
  * computing durations but its epoch origin is implementation-defined — do not
17
17
  * treat it as a wall-clock timestamp.
18
18
  *
@@ -54,14 +54,14 @@ function getActiveRequestsGauge() {
54
54
  * Returns the current time in milliseconds using `globalThis.performance.now()`.
55
55
  *
56
56
  * Sub-millisecond resolution is guaranteed on all supported engine floors
57
- * (Node ≥24, Bun ≥1.3, Cloudflare Workers). The returned value is suitable for
57
+ * (Node ≥24, Bun ≥1.4, Cloudflare Workers). The returned value is suitable for
58
58
  * computing durations but its epoch origin is implementation-defined — do not
59
59
  * treat it as a wall-clock timestamp.
60
60
  *
61
61
  * @returns Current time in milliseconds.
62
62
  */
63
63
  // performance is an ambient global declared by @types/node (perf_hooks.d.ts)
64
- // and available in all supported environments (Node ≥24, Bun ≥1.3, workerd).
64
+ // and available in all supported environments (Node ≥24, Bun ≥1.4, workerd).
65
65
  export const nowMs = () => performance.now();
66
66
  // Module-level TextEncoder singleton (stateless, safe to reuse)
67
67
  let cachedEncoder;
@@ -479,7 +479,7 @@ export async function fetchWithTimeout(url, timeoutMs, context, options) {
479
479
  const timeoutReason = new DOMException(`${operationDescription} timed out after ${timeoutMs}ms.`, 'TimeoutError');
480
480
  const timeoutId = setTimeout(() => controller.abort(timeoutReason), timeoutMs);
481
481
  // Compose the timeout signal with any caller-supplied signal. AbortSignal.any
482
- // is available on all supported floors (Node ≥24, Bun ≥1.3, workerd).
482
+ // is available on all supported floors (Node ≥24, Bun ≥1.4, workerd).
483
483
  const fetchSignal = externalSignal
484
484
  ? AbortSignal.any([controller.signal, externalSignal])
485
485
  : controller.signal;
@@ -209,7 +209,7 @@ function sleep(ms, signal) {
209
209
  return;
210
210
  }
211
211
  const controller = new AbortController();
212
- // AbortSignal.any is available on all supported floors (Node ≥24, Bun ≥1.3, workerd).
212
+ // AbortSignal.any is available on all supported floors (Node ≥24, Bun ≥1.4, workerd).
213
213
  const combined = signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;
214
214
  const timer = setTimeout(() => {
215
215
  controller.abort();
@@ -64,8 +64,10 @@ export declare class IdGenerator {
64
64
  /**
65
65
  * Generates a cryptographically secure random string.
66
66
  * @param length - The desired length of the random string. Defaults to `IdGenerator.DEFAULT_LENGTH`.
67
- * @param charset - The character set to use. Defaults to `IdGenerator.DEFAULT_CHARSET`.
67
+ * @param charset - The character set to use, 1 to 256 characters. Defaults to `IdGenerator.DEFAULT_CHARSET`.
68
68
  * @returns The generated random string.
69
+ * @throws {McpError} With {@link JsonRpcErrorCode.ValidationError} when `charset` is empty
70
+ * or longer than 256 characters — the sampler cannot terminate on either.
69
71
  */
70
72
  generateRandomString(length?: number, charset?: string): string;
71
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"idGenerator.d.ts","sourceRoot":"","sources":["../../../src/utils/security/idGenerator.ts"],"names":[],"mappings":"AA8CA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe,CAA0C;IACxE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAO;IACvC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc,CAAK;IAElC;;;OAGG;IACH,OAAO,CAAC,cAAc,CAA0B;IAChD;;;OAGG;IACH,OAAO,CAAC,kBAAkB,CAA8B;IAExD;;;OAGG;IACH,YAAY,cAAc,GAAE,kBAAuB,EAGlD;IAED;;;OAGG;IACI,iBAAiB,CAAC,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAWjE;IAED;;;OAGG;IACI,iBAAiB,IAAI,kBAAkB,CAE7C;IAED;;;;;OAKG;IACI,oBAAoB,CACzB,MAAM,GAAE,MAAmC,EAC3C,OAAO,GAAE,MAAoC,GAC5C,MAAM,CAER;IAED;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAW1E;IAED;;;;;;OAMG;IACI,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAMtF;IAED;;;;;;;OAOG;IACI,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAqBzF;IAED;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;;;;;;;;;;;OAiBG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,MAAsC,GAAG,MAAM,CAGxF;IAED;;;;;;OAMG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,MAAsC,GAAG,MAAM,CAe1F;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACI,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,MAAsC,GAAG,MAAM,CAStF;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,aAAoB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,QAAO,MAA6B,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,QAAO,MAG3C,CAAC"}
1
+ {"version":3,"file":"idGenerator.d.ts","sourceRoot":"","sources":["../../../src/utils/security/idGenerator.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe,CAA0C;IACxE;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAO;IACvC;;;OAGG;IAC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;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,QAAO,MAG3C,CAAC"}
@@ -21,6 +21,8 @@ function getRandomBytes(count) {
21
21
  crypto.getRandomValues(bytes);
22
22
  return bytes;
23
23
  }
24
+ /** Largest charset the byte-wise rejection sampler below can draw from. */
25
+ const MAX_CHARSET_LENGTH = 256;
24
26
  /**
25
27
  * Builds a random string of `length` characters drawn uniformly from `charset`.
26
28
  *
@@ -28,6 +30,10 @@ function getRandomBytes(count) {
28
30
  * multiple of `charset.length` that fits in 256, so `byte % charset.length`
29
31
  * never biases toward the low characters. Bytes are drawn in over-sized chunks
30
32
  * rather than one at a time, so a typical ID costs one `getRandomValues` call.
33
+ *
34
+ * `charset` must hold 1 to {@link MAX_CHARSET_LENGTH} characters: an empty
35
+ * charset never grows `result`, and a longer one rejects every byte, so either
36
+ * would spin here forever. Public callers validate before reaching this.
31
37
  */
32
38
  function randomStringFromCharset(length, charset) {
33
39
  const maxValidByteValue = Math.floor(256 / charset.length) * charset.length;
@@ -103,10 +109,15 @@ export class IdGenerator {
103
109
  /**
104
110
  * Generates a cryptographically secure random string.
105
111
  * @param length - The desired length of the random string. Defaults to `IdGenerator.DEFAULT_LENGTH`.
106
- * @param charset - The character set to use. Defaults to `IdGenerator.DEFAULT_CHARSET`.
112
+ * @param charset - The character set to use, 1 to 256 characters. Defaults to `IdGenerator.DEFAULT_CHARSET`.
107
113
  * @returns The generated random string.
114
+ * @throws {McpError} With {@link JsonRpcErrorCode.ValidationError} when `charset` is empty
115
+ * or longer than 256 characters — the sampler cannot terminate on either.
108
116
  */
109
117
  generateRandomString(length = IdGenerator.DEFAULT_LENGTH, charset = IdGenerator.DEFAULT_CHARSET) {
118
+ if (charset.length === 0 || charset.length > MAX_CHARSET_LENGTH) {
119
+ throw validationError(`Charset must contain between 1 and ${MAX_CHARSET_LENGTH} characters; received ${charset.length}.`, { charsetLength: charset.length, max: MAX_CHARSET_LENGTH });
120
+ }
110
121
  return randomStringFromCharset(length, charset);
111
122
  }
112
123
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"idGenerator.js","sourceRoot":"","sources":["../../../src/utils/security/idGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAa;IACnC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAAC,MAAc,EAAE,OAAe;IAC9D,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5E,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChE,IAAI,IAAI,IAAI,iBAAiB;gBAAE,SAAS;YACxC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAChD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;gBAAE,MAAM;QACtC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAsBD;;;GAGG;AACH,MAAM,OAAO,WAAW;IACtB;;;OAGG;IACK,MAAM,CAAC,eAAe,GAAG,sCAAsC,CAAC;IACxE;;;OAGG;IACK,MAAM,CAAC,iBAAiB,GAAG,GAAG,CAAC;IACvC;;;OAGG;IACK,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC;IAElC;;;OAGG;IAC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AC;QACpC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpD,8EAA8E;QAC9E,0CAA0C;QAC1C,OAAO,GAAG,gBAAgB,GAAG,SAAS,GAAG,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;IACtE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAW,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAW,EAAE;IACnD,MAAM,OAAO,GAAG,sCAAsC,CAAC;IACvD,OAAO,GAAG,uBAAuB,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,uBAAuB,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;AACzF,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ # Framework skills
2
+
3
+ Agent Skills for `@cyanheads/mcp-ts-core`. Each subdirectory contains a `SKILL.md` following the [Agent Skills specification](https://agentskills.io/specification).
4
+
5
+ The directory is `framework-skills/`, not `skills/`, on purpose. Claude Code and Codex auto-load a plugin's root `skills/`, and these are development-time skills for building a server — not skills for the agents that use one. A server that ships a plugin manifest keeps `skills/` free for that second kind.
6
+
7
+ ## Three-Tier Distribution
8
+
9
+ Skills flow through three locations. Each tier has a distinct role:
10
+
11
+ | Tier | Location | Written by | Purpose |
12
+ |:-----|:---------|:-----------|:--------|
13
+ | 1. Package | `node_modules/@cyanheads/mcp-ts-core/framework-skills/` | `npm publish` / `bun publish` | Canonical source. Ships with the package. |
14
+ | 2. Project | `framework-skills/` (project root) | `@cyanheads/mcp-ts-core init` CLI | Project's source of truth. Committed to git. Server-specific skills live here too. |
15
+ | 3. Agent | `.claude/skills/`, `.codex/skills/`, etc. | The agent itself | Agent's working copy. Synced from project `framework-skills/`. Checklists are checked here. |
16
+
17
+ ### Flow
18
+
19
+ ```text
20
+ npm publish init CLI agent sync
21
+ [package framework-skills/] ──────────> [project framework-skills/] ──────────> [.claude/skills/]
22
+ │
23
+ ├── core skills (from package)
24
+ └── server-specific skills (added by devs)
25
+ ```
26
+
27
+ ## Audience
28
+
29
+ Each skill declares `metadata.audience` in its SKILL.md frontmatter:
30
+
31
+ - **`external`** — For consumers building MCP servers. Copied to project `framework-skills/` by `init`.
32
+ - **`internal`** — For core package developers. Stays in `node_modules`, not copied.
33
+
34
+ ## Versioning
35
+
36
+ Skills declare `metadata.version` in frontmatter. The `maintenance` skill's Phase A compares versions after `bun update` and replaces a skill directory when the package version is newer; `init` only fills in what is missing and never overwrites an existing file. To pin a skill against those replacements, bump its local `metadata.version` above the package's.
37
+
38
+ ## Adding Server-Specific Skills
39
+
40
+ Create a new directory in `framework-skills/` with a `SKILL.md` following the same format. The agent will pick it up on next sync. Use the core skills as examples for structure and checklist conventions.
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold an MCP App tool + UI resource pair. Use when the user asks to add a tool with interactive UI, create an MCP App, or build a visual/interactive tool.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.4"
7
+ version: "1.5"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -117,7 +117,7 @@ const APP_HTML = `<!DOCTYPE html>
117
117
  applyDocumentTheme,
118
118
  applyHostFonts,
119
119
  applyHostStyleVariables,
120
- } from "https://unpkg.com/@modelcontextprotocol/ext-apps@1/app-with-deps";
120
+ } from "https://unpkg.com/@modelcontextprotocol/ext-apps@2/app-with-deps";
121
121
 
122
122
  const app = new App({ name: "{{TOOL_TITLE}}", version: "1.0.0" });
123
123
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.5"
7
+ version: "1.6"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -139,7 +139,7 @@ export const articleResource = resource('article://{pmid}', {
139
139
  });
140
140
  ```
141
141
 
142
- Without `errors[]`, the handler receives plain `Context` (no `fail` method) and throws via error factories (`notFound`, `serviceUnavailable`, …) directly. The contract is opt-in. See `skills/api-errors/SKILL.md` for the full pattern, baseline codes, and conformance rules.
142
+ Without `errors[]`, the handler receives plain `Context` (no `fail` method) and throws via error factories (`notFound`, `serviceUnavailable`, …) directly. The contract is opt-in. See `framework-skills/api-errors/SKILL.md` for the full pattern, baseline codes, and conformance rules.
143
143
 
144
144
  ### URI template variable completion
145
145
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new service integration. Use when the user asks to add a service, integrate an external API, or create a reusable domain module with its own initialization and state.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.9"
7
+ version: "1.10"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -95,7 +95,7 @@ handler: async (input, ctx) => {
95
95
 
96
96
  ## Resilience (External API Services)
97
97
 
98
- When a service wraps an external API, apply these patterns. For the framework retry contract, see `skills/api-utils/SKILL.md`.
98
+ When a service wraps an external API, apply these patterns. For the framework retry contract, see `framework-skills/api-utils/SKILL.md`.
99
99
 
100
100
  ### Retry wraps the full pipeline
101
101
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a test file for an existing tool, resource, or service. Use when the user asks to add tests, improve coverage, or when a definition exists without a matching test file.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.6"
7
+ version: "1.7"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -15,7 +15,7 @@ Tests use Vitest and `createMockContext` from `@cyanheads/mcp-ts-core/testing`.
15
15
 
16
16
  For the full `createMockContext` API and testing patterns, read:
17
17
 
18
- skills/api-testing/SKILL.md
18
+ framework-skills/api-testing/SKILL.md
19
19
 
20
20
  ## Steps
21
21
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new MCP tool definition. Use when the user asks to add a tool, create a new tool, or implement a new capability for the server.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.22"
7
+ version: "2.24"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -26,9 +26,9 @@ Tools use the `tool()` builder from `@cyanheads/mcp-ts-core`. Each tool lives in
26
26
 
27
27
  Tools use lowercase snake_case with a canonical server/domain prefix: `{server}_{verb}_{noun}` — 3 words.
28
28
 
29
- Examples: `pubmed_search_articles`, `pubmed_fetch_fulltext`, `clinicaltrials_find_studies`.
29
+ Examples: `pubmed_search_articles`, `pubmed_fetch_fulltext`, `clinicaltrials_find_eligible`.
30
30
 
31
- The server prefix uses the canonical platform/brand name, not an abbreviation (`patentsview_` not `patents_`, `clinicaltrials_` not `ct_`). When a name resists the schema — can't pick a verb, noun feels generic, wants 4+ segments — that's usually a signal the scope is fuzzy; split the tool, rename, or reconsider.
31
+ The server prefix is judged on clarity, not length: the brand name or the plain well-known word for the domain both pass (`pubmed_`, `patents_`); an abbreviation fails only when it reads as something else out of context (`loc_`, `ct_`). A fourth segment is fine when the noun is inherently two words (`openfda_search_device_clearances`). When a name resists the schema — can't pick a verb, noun feels generic, the *verb* wants a second word — that's usually a signal the scope is fuzzy; split the tool, rename, or reconsider.
32
32
 
33
33
  For shape selection (Workflow or Instruction variants — standard single-action tools are the default), see the `design-mcp-server` skill's Tool shapes section.
34
34
 
@@ -169,7 +169,7 @@ export const {{TOOL_EXPORT}} = tool('{{tool_name}}', {
169
169
  });
170
170
  ```
171
171
 
172
- Write it as `return ctx.requestInput(...)` — the `never` return type makes it valid in return position for any output, and it is what lets TypeScript narrow the line below. Full reference (`inputRequired.elicitUrl` / `.createMessage` / `.listRoots`, `requestState`, decline handling): `skills/api-context`.
172
+ Write it as `return ctx.requestInput(...)` — the `never` return type makes it valid in return position for any output, and it is what lets TypeScript narrow the line below. Full reference (`inputRequired.elicitUrl` / `.createMessage` / `.listRoots`, `requestState`, decline handling): `framework-skills/api-context`.
173
173
 
174
174
  ### Registration
175
175
 
@@ -413,7 +413,7 @@ async handler(input, ctx) {
413
413
  },
414
414
  ```
415
415
 
416
- The alternative — declaring `previewData: z.string()` in `output` and emitting the block from `format()` — ships the bytes twice (once in `structuredContent`, once in the block). Reserve `output` for data the agent reasons over; route raw media through `ctx.content`. Test with `getContentBlocks(ctx)`. Full reference: `skills/api-context` § `ctx.content`.
416
+ The alternative — declaring `previewData: z.string()` in `output` and emitting the block from `format()` — ships the bytes twice (once in `structuredContent`, once in the block). Reserve `output` for data the agent reasons over; route raw media through `ctx.content`. Test with `getContentBlocks(ctx)`. Full reference: `framework-skills/api-context` § `ctx.content`.
417
417
 
418
418
  ### Capped lists must disclose truncation
419
419
 
@@ -714,7 +714,7 @@ throw invalidParams(
714
714
  );
715
715
  ```
716
716
 
717
- **Error messages are recovery instructions.** Name what went wrong, why, and what action to take. The message is the agent's only signal — a bare "Not found" is a dead end. See `skills/api-errors/SKILL.md` for the full contract pattern, factories list, auto-classification table, and error-path parity (how `data.recovery.hint` reaches both client surfaces).
717
+ **Error messages are recovery instructions.** Name what went wrong, why, and what action to take. The message is the agent's only signal — a bare "Not found" is a dead end. See `framework-skills/api-errors/SKILL.md` for the full contract pattern, factories list, auto-classification table, and error-path parity (how `data.recovery.hint` reaches both client surfaces).
718
718
 
719
719
  ### Include operational metadata
720
720
 
@@ -774,7 +774,7 @@ Large payloads burn the agent's context window. Default to curated summaries; of
774
774
  - **Lists**: Return top N with a total count and pagination cursor, not unbounded arrays
775
775
  - **Large objects**: Return key fields by default; accept a `fields` or `verbose` parameter for full data
776
776
  - **Binary/blob content**: Return metadata and a reference, not the raw content
777
- - **Analytical working sets**: When upstream returns more *analytical* rows (data an agent would SQL — aggregate, group, join) than fit in context, `DataCanvas` (`ctx.core.canvas?`, Tier 3 — opt-in via `CANVAS_PROVIDER_TYPE=duckdb`) lets you register the rows and return the `canvas_id` plus a preview so the agent can run SQL to slice down without a re-fetch. The `spillover()` helper (`@cyanheads/mcp-ts-core/canvas`) automates the overflow case: drain rows up to a character budget for the inline preview, auto-register the full source on overflow, return both as a discriminated union. **Two gates:** it must be analytical, not a discovery/search surface of categorical metadata (those don't earn a canvas regardless of row count — use MCP-side list filtering or pagination); and a tool emitting a `canvas_id` MUST be paired with a registered `dataframe_query` tool, or the handle is unreachable. Compute distributions or refinement hints across the full result — not the preview — so the agent gets honest aggregate signal on the rows it didn't read. See `api-canvas` for the register / query / export pattern and the spillover flow.
777
+ - **Analytical working sets**: When upstream returns more *analytical* rows (data an agent would SQL — aggregate, group, join) than fit in context, `DataCanvas` (`core.canvas`, wired in `setup()` via `setCanvas`; Tier 3 — opt-in via `CANVAS_PROVIDER_TYPE=duckdb`) lets you register the rows and return the `canvas_id` plus a preview so the agent can run SQL to slice down without a re-fetch. The `spillover()` helper (`@cyanheads/mcp-ts-core/canvas`) automates the overflow case: drain rows up to a character budget for the inline preview, auto-register the full source on overflow, return both as a discriminated union. **Two gates:** it must be analytical, not a discovery/search surface of categorical metadata (those don't earn a canvas regardless of row count — use MCP-side list filtering or pagination); and a tool emitting a `canvas_id` MUST be paired with a registered `dataframe_query` tool, or the handle is unreachable. Compute distributions or refinement hints across the full result — not the preview — so the agent gets honest aggregate signal on the rows it didn't read. See `api-canvas` for the register / query / export pattern and the spillover flow.
778
778
  - **One large document**: When a single call returns one document-shaped record (not a row set) that can overflow context, return a section *outline* — top-level keys + per-section byte size — and let the agent re-call with `sections: [...]` for only what it needs, instead of truncating one surface. `outlineOnOverflow()` with `OUTLINE_VARIANT` / `selectSections()` / `formatOutline()` (`@cyanheads/mcp-ts-core/utils`) measures the payload and returns a `full | outline` result. Declare the tool's `output` as a flat `z.object` with a `kind` discriminator and presence-based optional arms (fold in `OUTLINE_VARIANT.shape.sections` / `.notice`) — `tool()` rejects a `z.discriminatedUnion` output — and render each arm on field presence in `format()` so parity holds. Pure measure + key-slice — Workers-portable, unlike canvas `spillover()`. Use for one fat record; use `spillover()` for a row collection. See the `techniques` skill's `outline-on-overflow` reference.
779
779
 
780
780
  ## MCP-side list filtering
@@ -4,7 +4,7 @@ description: >
4
4
  Reference for core and server configuration in `@cyanheads/mcp-ts-core`. Covers env var tables with defaults, priority order, server-specific Zod schema pattern, and Workers lazy-parsing requirement.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.16"
7
+ version: "1.17"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -262,6 +262,8 @@ export function getServerConfig(): ServerConfig {
262
262
 
263
263
  **Env booleans — use `z.stringbool()`, never `z.coerce.boolean()`.** `z.coerce.boolean()` runs `Boolean(value)`, so `"false"`, `"0"`, and `"no"` all coerce to `true` — the flag becomes impossible to disable through the environment except by omitting it entirely. `z.stringbool()` parses `true/false/1/0/yes/no/on/off` (case-insensitive) and rejects anything else, so `MY_VERBOSE_LOGGING=false` actually disables and a typo fails loudly at startup instead of silently coercing. Empty string and unset both fall through to `.default()`.
264
264
 
265
+ **Unset means unset.** `parseEnvConfig` and the framework's own config both treat an empty string and a whole-value `${…}` placeholder — what an MCPB or plugin host forwards when a user leaves an option blank and nothing substitutes it — as the variable being absent: an optional field stays `undefined`, a defaulted field takes its default, and a required field fails as missing rather than as a format error against the literal text. A value that merely contains `${…}` is kept. No per-field `z.preprocess` guard is needed for either case.
266
+
265
267
  **Why `parseEnvConfig`?** It maps Zod schema paths to env var names so validation errors name the actual variable at fault. A missing `MY_API_KEY` produces:
266
268
 
267
269
  ```
@@ -4,7 +4,7 @@ description: >
4
4
  Canonical reference for the unified `Context` object passed to every tool and resource handler in `@cyanheads/mcp-ts-core`. Covers the full interface, its `RequestContext` base, all sub-APIs (`ctx.log`, `ctx.state`, `ctx.requestInput`, `ctx.inputs`, `ctx.enrich`, `ctx.content`), and when to use each.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "2.2"
7
+ version: "2.3"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -594,7 +594,7 @@ async handler(input, ctx) {
594
594
  }
595
595
  ```
596
596
 
597
- The contract is opt-in. See `skills/api-errors/SKILL.md` for the full type-driven pattern, lint rules, and baseline-codes guidance.
597
+ The contract is opt-in. See `framework-skills/api-errors/SKILL.md` for the full type-driven pattern, lint rules, and baseline-codes guidance.
598
598
 
599
599
  ---
600
600
 
@@ -737,7 +737,7 @@ async handler(input, ctx) {
737
737
 
738
738
  The `capped-list-no-truncation` lint rule fires when a cap-like input + array output shape is present without any of: `truncated` or `totalCount` in the declared `enrichment`, or `truncated` or `totalCount` in `output`. Using `ctx.enrich.total(n)` (writes `totalCount`) is also recognized as honest disclosure.
739
739
 
740
- See `add-tool`'s **Tool Response Design** and `skills/api-linter` (`enrichment-*` rules) for the full pattern. Test enrichment with `getEnrichment(ctx)` from `@cyanheads/mcp-ts-core/testing`.
740
+ See `add-tool`'s **Tool Response Design** and `framework-skills/api-linter` (`enrichment-*` rules) for the full pattern. Test enrichment with `getEnrichment(ctx)` from `@cyanheads/mcp-ts-core/testing`.
741
741
 
742
742
  ---
743
743
 
@@ -4,7 +4,7 @@ description: >
4
4
  McpError constructor, JsonRpcErrorCode reference, and error handling patterns for `@cyanheads/mcp-ts-core`. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.9"
7
+ version: "1.10"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -363,6 +363,7 @@ Important properties:
363
363
  - **`data` propagation is restricted** to explicitly-thrown `McpError.data` and `ZodError.issues`. Auto-classified plain errors (`TypeError`, network errors, etc.) emit `code` + `message` only — no `data` — so internal classification context never leaks to clients.
364
364
  - **Recovery hint mirroring is automatic.** When the thrown `McpError` carries `data.recovery.hint`, the handler factory appends it to the `content[]` text so the markdown surface matches the JSON surface. Authors don't need to format the hint manually.
365
365
  - **Argument-schema rejection is a tool error with the same envelope.** An unknown root key, a wrong type, a missing required field, or a failed constraint returns `isError: true` with `structuredContent.error.code = -32602` (`InvalidParams`) and the readable `Invalid arguments for tool <name>: …` diagnostic in `content[]`. The handler never runs. Two neighbouring failures keep the protocol error path instead, arriving as a JSON-RPC error rather than a tool result: an unknown or disabled tool name, and a malformed request envelope.
366
+ - **A schema constraint cannot carry a declared reason.** Because the handler never runs, a rejection by `.max()`, `.regex()`, `.min()`, or any other Zod refinement bypasses `errors[]` entirely: it arrives as `InvalidParams` with `data.issues` and no `data.reason`, so a caller has nothing to branch on and gets no recovery hint. Decide per constraint which surface it belongs on. A bound that is purely structural — the input is the wrong shape and no guidance beyond the diagnostic would help — belongs on the schema, where it also advertises itself in `inputSchema`. A bound a caller is expected to recover from belongs in the handler as `ctx.fail('reason', message, ctx.recoveryFor('reason'))` against a declared `errors[]` entry, with the limit restated in the field's `.describe()` so it is still visible before the call. Enforcing the same bound in both places is the trap: the schema wins, and the contract entry becomes unreachable while still reading as covered.
366
367
 
367
368
  **Handler — throw freely, no try/catch:**
368
369
 
@@ -4,7 +4,7 @@ description: >
4
4
  MCP definition linter rules reference. Use when `bun run lint:mcp` or `bun run devcheck` reports a lint error or warning (`format-parity`, `schema-is-object`, `name-format`, `server-json-*`, etc.) and you need to understand the rule, its severity, and how to fix it. Every rule ID the linter emits has an entry in this doc.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.13"
7
+ version: "1.14"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -18,7 +18,7 @@ The linter validates tool, resource, and prompt definitions against the MCP spec
18
18
  | `bun run lint:mcp` | Manual or CI | Prints errors + warnings, exits non-zero on errors. |
19
19
  | `bun run devcheck` | Pre-commit workflow | Wraps `lint:mcp` alongside typecheck, format, `bun audit`, `bun outdated`. |
20
20
 
21
- Both surface the same `LintReport` from `validateDefinitions()` (exported from `@cyanheads/mcp-ts-core/linter`). Each diagnostic has a stable `rule` ID — that's the anchor you land on via the `See: skills/api-linter/SKILL.md#<rule>` breadcrumb appended to every message.
21
+ Both surface the same `LintReport` from `validateDefinitions()` (exported from `@cyanheads/mcp-ts-core/linter`). Each diagnostic has a stable `rule` ID — that's the anchor you land on via the `See: framework-skills/api-linter/SKILL.md#<rule>` breadcrumb appended to every message.
22
22
 
23
23
  **Severity:**
24
24
  - **error** — MUST-level spec violation; blocks `devcheck`.
@@ -615,7 +615,7 @@ Validate the `landing` config passed to `createApp()` (the config object that dr
615
615
  | `landing-theme-accent` | error | `theme.accent` is present but not a string |
616
616
  | `landing-theme-accent-format` | error | `theme.accent` doesn't match the expected color format |
617
617
 
618
- Diagnostic anchors for these rules are the rule ID — e.g. `skills/api-linter/SKILL.md#landing-shape`. Pass `landing` to `validateDefinitions({ landing, tools, resources, prompts })` to opt in.
618
+ Diagnostic anchors for these rules are the rule ID — e.g. `framework-skills/api-linter/SKILL.md#landing-shape`. Pass `landing` to `validateDefinitions({ landing, tools, resources, prompts })` to opt in.
619
619
 
620
620
  ---
621
621
 
@@ -692,7 +692,7 @@ throw serviceUnavailable('Upstream failed', { upstreamError: e }, { cause: e });
692
692
 
693
693
  Validate the optional `errors[]` declarative contract on tool/resource definitions. Structural rules check the shape of contract entries; conformance rules cross-check the handler body against the declared codes.
694
694
 
695
- When a contract is declared, the handler receives a typed `ctx.fail(reason, …)` keyed by the declared reason union. See `skills/api-errors/SKILL.md` for runtime semantics.
695
+ When a contract is declared, the handler receives a typed `ctx.fail(reason, …)` keyed by the declared reason union. See `framework-skills/api-errors/SKILL.md` for runtime semantics.
696
696
 
697
697
  ### error-contract-type
698
698
 
@@ -4,7 +4,7 @@ description: >
4
4
  Stand up a persistent, self-refreshing local mirror of a bulk upstream dataset with the MirrorService (@cyanheads/mcp-ts-core/mirror). Use when a server wraps a large or slow API and should query a synced local index (embedded SQLite + FTS5) instead of paginating the live API per request.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.1"
7
+ version: "1.2"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -81,6 +81,8 @@ Why they can't merge: during a from-scratch init the records aren't ordered by t
81
81
 
82
82
  For access paths the generic query can't express — junction tables for index-backed multi-value filtering, denormalized counters, bespoke `bm25` weighting — use the **raw handle**: `const db = await mirror.raw();` then run prepared statements against your own auxiliary tables (declare them via a migration). Add the auxiliary DDL in a `migrations` step; maintain it from your `sync` mapping or SQL triggers.
83
83
 
84
+ A migration runs identically on first creation and on upgrade: a fresh database runs every migration up to `version` right after the declarative DDL, an existing one runs only those above its stored version. So `up()` must tolerate a database that already has the current declarative shape — `CREATE TABLE IF NOT EXISTS` for auxiliary objects, never an `ALTER` that assumes an older layout of a declared column.
85
+
84
86
  ## Readiness — key off the completion marker, not live status
85
87
 
86
88
  `status().ready` is `true` once a full sync has **ever completed** (`completedAt != null`), not when `status === 'complete'`. The dataset stays transactionally queryable during a refresh, so a mirror mid-refresh — or one whose last refresh failed — is still ready and should keep serving. Gate the mirror read path on `await mirror.ready()`; fall back to the live API only when it is `false` (cold, never-completed init).