turbine-orm 0.55.0 → 0.57.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 (52) hide show
  1. package/README.md +16 -1
  2. package/dist/cjs/cli/index.d.ts +3 -1
  3. package/dist/cjs/cli/index.js +341 -14
  4. package/dist/cjs/client.d.ts +16 -1
  5. package/dist/cjs/client.js +7 -39
  6. package/dist/cjs/dialect.d.ts +9 -0
  7. package/dist/cjs/index-stats.d.ts +46 -0
  8. package/dist/cjs/index-stats.js +42 -1
  9. package/dist/cjs/plan-divergence.d.ts +511 -0
  10. package/dist/cjs/plan-divergence.js +790 -0
  11. package/dist/cjs/powql.d.ts +11 -0
  12. package/dist/cjs/powql.js +22 -0
  13. package/dist/cjs/prisma-compat.d.ts +32 -1
  14. package/dist/cjs/prisma-compat.js +297 -41
  15. package/dist/cjs/query/builder.d.ts +45 -0
  16. package/dist/cjs/query/builder.js +90 -17
  17. package/dist/cjs/query/deferred.d.ts +9 -0
  18. package/dist/cjs/query/index.d.ts +2 -0
  19. package/dist/cjs/query/index.js +18 -1
  20. package/dist/cjs/query/option-surface.d.ts +100 -0
  21. package/dist/cjs/query/option-surface.js +214 -0
  22. package/dist/cjs/query/types.d.ts +140 -0
  23. package/dist/cjs/query/utils.d.ts +30 -0
  24. package/dist/cjs/query/utils.js +67 -3
  25. package/dist/cjs/query/warn-registry.d.ts +8 -0
  26. package/dist/cjs/query/warn-registry.js +8 -0
  27. package/dist/cli/index.d.ts +3 -1
  28. package/dist/cli/index.js +341 -14
  29. package/dist/client.d.ts +16 -1
  30. package/dist/client.js +8 -40
  31. package/dist/dialect.d.ts +9 -0
  32. package/dist/index-stats.d.ts +46 -0
  33. package/dist/index-stats.js +42 -1
  34. package/dist/plan-divergence.d.ts +511 -0
  35. package/dist/plan-divergence.js +783 -0
  36. package/dist/powql.d.ts +11 -0
  37. package/dist/powql.js +22 -0
  38. package/dist/prisma-compat.d.ts +32 -1
  39. package/dist/prisma-compat.js +297 -41
  40. package/dist/query/builder.d.ts +45 -0
  41. package/dist/query/builder.js +90 -17
  42. package/dist/query/deferred.d.ts +9 -0
  43. package/dist/query/index.d.ts +2 -0
  44. package/dist/query/index.js +1 -0
  45. package/dist/query/option-surface.d.ts +100 -0
  46. package/dist/query/option-surface.js +209 -0
  47. package/dist/query/types.d.ts +140 -0
  48. package/dist/query/utils.d.ts +30 -0
  49. package/dist/query/utils.js +66 -3
  50. package/dist/query/warn-registry.d.ts +8 -0
  51. package/dist/query/warn-registry.js +8 -0
  52. package/package.json +1 -1
@@ -465,6 +465,8 @@ export interface FindUniqueArgs<T, R extends object = {}, W extends TypedWithCla
465
465
  skipGlobalFilters?: SkipGlobalFilters;
466
466
  /** Include PII-tagged columns in the result. See {@link FindManyArgs.includePii}. */
467
467
  includePii?: boolean;
468
+ /** Plan this query with its real parameter values. See {@link FindManyArgs.forceCustomPlan}. */
469
+ forceCustomPlan?: boolean;
468
470
  }
469
471
  export interface FindManyArgs<T, R extends object = {}, W extends TypedWithClause<R> = TypedWithClause<R>, S extends Record<string, boolean> | undefined = undefined, O extends Record<string, boolean> | undefined = undefined> {
470
472
  /** Row filter. Keys are checked against `T` and `R` (see {@link WhereClause}). */
@@ -518,6 +520,138 @@ export interface FindManyArgs<T, R extends object = {}, W extends TypedWithClaus
518
520
  * always allowed regardless of this flag (the reference is explicit).
519
521
  */
520
522
  includePii?: boolean;
523
+ /**
524
+ * Plan THIS query with its actual parameter values, every execution.
525
+ * PostgreSQL only (see the refusal below).
526
+ *
527
+ * WHY IT EXISTS. Turbine executes through a NAMED prepared statement, which
528
+ * enters the backend's plan cache, and from the sixth execution onward
529
+ * PostgreSQL may replace the per-execution plan with a single GENERIC plan
530
+ * (whenever the generic plan's estimated cost is not worse than the average
531
+ * custom cost). A generic plan substitutes a default for every value it
532
+ * cannot see: an unknown equality gets `rows / n_distinct`, an unknown range
533
+ * gets a third of the table, an unknown LIKE gets 0.5%, and an unknown LIMIT
534
+ * gets 10% of its child node's estimate. When one of those defaults lands on
535
+ * the other side of a plan boundary from the real value, the plan SHAPE
536
+ * flips, and the flip can be catastrophic. It fails in both directions: a
537
+ * default above the truth and a default below it are both capable of it, so
538
+ * "the tenant with few rows" is not the predictor.
539
+ *
540
+ * WHAT IT DOES, stated as the mechanism really is rather than as the tempting
541
+ * one-liner. `true` sends this one statement UNNAMED. It is NOT true that
542
+ * PostgreSQL treats an unnamed statement as a one-shot plan that never enters
543
+ * the plan cache: `exec_parse_message` builds a `CachedPlanSource` and calls
544
+ * `SaveCachedPlan` on it for the unnamed statement too (it is kept in
545
+ * `unnamed_stmt_psrc`). The reason the option works is one level up, in the
546
+ * DRIVER: node-postgres only skips Parse for a statement it has already
547
+ * parsed BY NAME (`Query.hasBeenParsed` is `this.name && ...`), so an unnamed
548
+ * statement is re-Parsed on every execution. Each Parse replaces the unnamed
549
+ * entry with a fresh `CachedPlanSource` whose custom-plan counter starts at
550
+ * zero, so the five-execution threshold that precedes promotion is never
551
+ * reached and every execution is planned with the real parameter values.
552
+ *
553
+ * That distinction matters in practice: the guarantee is a property of the
554
+ * driver's behaviour plus the backend's promotion rule, not a special
555
+ * one-shot plan class, which is exactly why a connection pinned to
556
+ * `force_generic_plan` still overrides it (see PRECEDENCE below).
557
+ *
558
+ * Nothing is set on the session, no `SET` is emitted, no transaction is
559
+ * opened, and no extra round trip is added.
560
+ *
561
+ * WHAT IT CANNOT DO, and why this is a boolean rather than the client-level
562
+ * three-value {@link TurbineConfig.planCacheMode}: the generic direction is
563
+ * NOT expressible per query. `force_generic_plan` is a property of a CACHED
564
+ * plan, and the only per-query lever here is keeping the statement out of the
565
+ * cache, which can only ever mean "custom". A per-query
566
+ * `planCacheMode: 'force_generic_plan'` would be a promise this mechanism
567
+ * cannot keep, so the option is named for the one thing it does.
568
+ *
569
+ * PRECEDENCE over the client-level `planCacheMode`, which is a connection
570
+ * parameter and cannot be unset for one query. Stated exactly, because one of
571
+ * these four is the opposite of what the mechanism suggests:
572
+ * - Client on the default (`planCacheMode` unset) or `'auto'`: this is what
573
+ * the option is FOR. `auto` is the only mode in which promotion to a
574
+ * generic plan happens, and the re-Parse described above resets the
575
+ * counter that promotion depends on before it can ever be reached.
576
+ * - Client on `'force_custom_plan'`: redundant and harmless, both routes
577
+ * plan with the real values.
578
+ * - Client on `'force_generic_plan'`: REFUSED, with `ValidationError`
579
+ * (E003). It does NOT win. That setting governs the unnamed statement's
580
+ * cached plan source as well as a named one (measured on PostgreSQL 16.14: five executions
581
+ * of the same unnamed statement read 19,107 buffers under the setting and
582
+ * 55 with the connection back on `auto`), so withholding the name buys
583
+ * nothing against it and the query would be planned generically anyway.
584
+ * Rather than report a guarantee it cannot keep, Turbine refuses the
585
+ * combination and says which of the two settings to change. Only the
586
+ * setting TURBINE applied is visible: a `plan_cache_mode` installed by a
587
+ * caller's `SET`, `ALTER ROLE`, or a pooler cannot be seen or refused.
588
+ * - `false` / omitted changes nothing. It does not opt back out of a
589
+ * client-level setting, it simply leaves that setting in charge.
590
+ * - With the client-level `preparedStatements: false`, every statement is
591
+ * already unnamed, so this option is a no-op for plan choice.
592
+ *
593
+ * COST, and it has two halves.
594
+ *
595
+ * The first is planning. The statement is parsed and planned on every
596
+ * execution instead of once. On a flat read that is in the noise (an unnamed
597
+ * statement also skips the extra Parse/Describe round trip a named one needs
598
+ * on its first execution, so it can even come out ahead). It grows with the
599
+ * size of the statement: a deep `with` tree is a much larger plan, and
600
+ * re-planning it per execution is a measurable share of a fast query's
601
+ * latency. Turn it on where a plan flip is the risk, not everywhere.
602
+ *
603
+ * The second is the one nobody expects: A CUSTOM PLAN IS NOT ALWAYS THE
604
+ * BETTER PLAN. There are real shapes where the generic plan's ignorance is
605
+ * what saves it, and forcing a custom plan forecloses that. Reproduced on
606
+ * PostgreSQL 16.14, `synchronize_seqscans` off, parallel workers off:
607
+ *
608
+ * ```sql
609
+ * CREATE TABLE ev (id bigserial PRIMARY KEY, tenant_id int NOT NULL, pad text);
610
+ * -- 320,000 rows over 800 tenants, inserted in RANDOM physical order
611
+ * INSERT INTO ev (tenant_id, pad)
612
+ * SELECT t, repeat('x', 60)
613
+ * FROM (SELECT ((g % 800) + 1) AS t FROM generate_series(1, 320000) g
614
+ * ORDER BY random()) s
615
+ * WHERE t <> 400;
616
+ * -- then tenant 400's 80,000 rows LAST, so they all sit past everything above
617
+ * INSERT INTO ev (tenant_id, pad)
618
+ * SELECT 400, repeat('x', 60) FROM generate_series(1, 80000) g;
619
+ * CREATE INDEX ev_tenant_idx ON ev (tenant_id);
620
+ * ANALYZE ev; -- relpages 5334, n_distinct 800, correlation 0.004
621
+ *
622
+ * PREPARE q(int, int) AS SELECT * FROM ev WHERE tenant_id = $1 LIMIT $2;
623
+ * -- force_custom_plan : Seq Scan, Buffers: shared hit=4262
624
+ * -- force_generic_plan: Bitmap Heap Scan, Buffers: shared hit=71
625
+ * ```
626
+ *
627
+ * 60x, with no `ORDER BY` anywhere. The custom planner knows tenant 400 is
628
+ * 20% of the table, so with `LIMIT 20` it prices a sequential scan as
629
+ * essentially free on the assumption it will stop almost immediately. It is
630
+ * right about how MANY rows match and wrong about WHERE they are: they are
631
+ * all at the end of the heap, so it reads 319,600 non-matching rows first.
632
+ * The generic plan, unable to see the value, estimates 500 rows, takes the
633
+ * bitmap path, and touches one heap block. Re-insert the identical rows in
634
+ * random physical order and the effect vanishes and reverses (custom 2
635
+ * buffers, generic 66): physical CLUSTERING is the variable, not selectivity.
636
+ *
637
+ * Read that carefully before treating it as an argument against this option.
638
+ * On that shape `plan_cache_mode = auto` never promotes (the generic plan's
639
+ * ESTIMATED cost is far higher than the average custom cost, which is exactly
640
+ * the condition under which `auto` refuses), so the default already produces
641
+ * the 4,262-buffer plan and `forceCustomPlan` costs nothing against it. The
642
+ * honest statement is that a generic plan is 60x better there than either the
643
+ * default or this option, and only an explicit client-level
644
+ * `planCacheMode: 'force_generic_plan'` can reach it. The reason to scope
645
+ * this option per query is still real: it is a targeted remedy for a measured
646
+ * flip, not a setting to turn on globally.
647
+ *
648
+ * NON-POSTGRESQL ENGINES. `true` throws {@link UnsupportedFeatureError}
649
+ * (E017), the same refusal the client-level option gives: an engine with no
650
+ * PostgreSQL plan cache has no cached generic plan to keep this query out of,
651
+ * so silently accepting the flag would report a guarantee that was never
652
+ * made. Omitting it (or `false`) is accepted everywhere.
653
+ */
654
+ forceCustomPlan?: boolean;
521
655
  }
522
656
  export interface FindManyStreamArgs<T, R extends object = {}, W extends TypedWithClause<R> = TypedWithClause<R>, S extends Record<string, boolean> | undefined = undefined, O extends Record<string, boolean> | undefined = undefined> extends FindManyArgs<T, R, W, S, O> {
523
657
  /**
@@ -716,6 +850,8 @@ export interface CountArgs<T, R extends object = {}> {
716
850
  timeout?: number;
717
851
  /** Opt out of configured {@link GlobalFilters}. See {@link SkipGlobalFilters}. */
718
852
  skipGlobalFilters?: SkipGlobalFilters;
853
+ /** Plan this query with its real parameter values. See {@link FindManyArgs.forceCustomPlan}. */
854
+ forceCustomPlan?: boolean;
719
855
  }
720
856
  /**
721
857
  * Comparison operators usable inside a `having` aggregate filter. A bare value
@@ -955,6 +1091,8 @@ export interface GroupByArgs<T, R extends object = {}> {
955
1091
  timeout?: number;
956
1092
  /** Opt out of configured {@link GlobalFilters}. See {@link SkipGlobalFilters}. */
957
1093
  skipGlobalFilters?: SkipGlobalFilters;
1094
+ /** Plan this query with its real parameter values. See {@link FindManyArgs.forceCustomPlan}. */
1095
+ forceCustomPlan?: boolean;
958
1096
  }
959
1097
  /** The by-key union of a groupBy args type (array element type of `by`). */
960
1098
  type GroupByKeys<A> = A extends {
@@ -1055,6 +1193,8 @@ export interface AggregateArgs<T, R extends object = {}> {
1055
1193
  timeout?: number;
1056
1194
  /** Opt out of configured {@link GlobalFilters}. See {@link SkipGlobalFilters}. */
1057
1195
  skipGlobalFilters?: SkipGlobalFilters;
1196
+ /** Plan this query with its real parameter values. See {@link FindManyArgs.forceCustomPlan}. */
1197
+ forceCustomPlan?: boolean;
1058
1198
  }
1059
1199
  /** Result type for aggregate queries */
1060
1200
  export interface AggregateResult<T> {
@@ -319,6 +319,20 @@ export declare function isDefaultTextParser(oid: number, parser: (text: string)
319
319
  * the origin of, and the resulting bug is order-dependent: which reading wins
320
320
  * depends on module evaluation order, which lazy route imports make unstable
321
321
  * between requests. So say it out loud, once.
322
+ *
323
+ * NOT DEV-ONLY. It used to go quiet under `NODE_ENV=production`, along with
324
+ * every other dev warning, and that was the wrong rule for THIS one, for the
325
+ * same reason the temporal-infinity warning (builder.ts `warnTemporalInfinity`)
326
+ * is not dev-only either. A parser overwrite is ORDER-DEPENDENT: which module
327
+ * calls `setTypeParser` last decides the reading, and evaluation order is
328
+ * exactly what differs between a dev process (eager imports, one route
329
+ * exercised at a time) and a production one (bundled or lazily imported routes,
330
+ * warmed in whatever order traffic arrives). So a process can be clean in dev
331
+ * and wrong in production purely from import order, which makes production the
332
+ * case that matters MOST, and it was the case that was silent. The cost is
333
+ * bounded to the point of irrelevance: once per OID per process, at client
334
+ * construction, and only when somebody else's non-default parser is actually
335
+ * being replaced.
322
336
  */
323
337
  export declare function warnParserOverwrite(oid: number, typeName: string): void;
324
338
  /**
@@ -406,6 +420,22 @@ export declare function jsonWireCoercionOid(pgType: string | undefined): number
406
420
  export declare function coerceJsonWireValue(oid: number, value: unknown): unknown;
407
421
  /** The closest name in `candidates` to `input`, or null when none is close. */
408
422
  export declare function closestName(input: string, candidates: Iterable<string>): string | null;
423
+ /**
424
+ * The real option key `key` most likely meant, or null when nothing is close.
425
+ *
426
+ * Shared by every "unknown option" diagnostic (the client-config warner in
427
+ * client.ts and the prisma-compat query-option warner), so a reader who has
428
+ * seen one recognizes the ranking in the other.
429
+ *
430
+ * {@link closestName} decides first, which is bounded by edit distance and
431
+ * covers typos. It does not cover the miss these warnings exist for: a guessed
432
+ * name that omits a whole WORD. `logParams` is five edits from `logQueryParams`,
433
+ * past the bound, yet it names the same words in the same order; likewise
434
+ * `customPlan` for `forceCustomPlan`. So a second pass accepts a candidate whose
435
+ * camelCase words CONTAIN the guess's words in order, preferring the one that
436
+ * adds fewest words.
437
+ */
438
+ export declare function suggestKey(key: string, candidates: Iterable<string>): string | null;
409
439
  /**
410
440
  * The "unknown field" error text, listing RELATIONS as well as columns.
411
441
  *
@@ -34,6 +34,7 @@ exports.registerUtcTemporalParsers = registerUtcTemporalParsers;
34
34
  exports.jsonWireCoercionOid = jsonWireCoercionOid;
35
35
  exports.coerceJsonWireValue = coerceJsonWireValue;
36
36
  exports.closestName = closestName;
37
+ exports.suggestKey = suggestKey;
37
38
  exports.unknownFieldMessage = unknownFieldMessage;
38
39
  const pg_1 = __importDefault(require("pg"));
39
40
  const schema_js_1 = require("../schema.js");
@@ -598,10 +599,22 @@ function isDefaultTextParser(oid, parser) {
598
599
  * the origin of, and the resulting bug is order-dependent: which reading wins
599
600
  * depends on module evaluation order, which lazy route imports make unstable
600
601
  * between requests. So say it out loud, once.
602
+ *
603
+ * NOT DEV-ONLY. It used to go quiet under `NODE_ENV=production`, along with
604
+ * every other dev warning, and that was the wrong rule for THIS one, for the
605
+ * same reason the temporal-infinity warning (builder.ts `warnTemporalInfinity`)
606
+ * is not dev-only either. A parser overwrite is ORDER-DEPENDENT: which module
607
+ * calls `setTypeParser` last decides the reading, and evaluation order is
608
+ * exactly what differs between a dev process (eager imports, one route
609
+ * exercised at a time) and a production one (bundled or lazily imported routes,
610
+ * warmed in whatever order traffic arrives). So a process can be clean in dev
611
+ * and wrong in production purely from import order, which makes production the
612
+ * case that matters MOST, and it was the case that was silent. The cost is
613
+ * bounded to the point of irrelevance: once per OID per process, at client
614
+ * construction, and only when somebody else's non-default parser is actually
615
+ * being replaced.
601
616
  */
602
617
  function warnParserOverwrite(oid, typeName) {
603
- if (process.env.NODE_ENV === 'production')
604
- return;
605
618
  const getParser = pg_1.default.types.getTypeParser;
606
619
  const current = getParser(oid, 'text');
607
620
  // Turbine's own earlier registration is not a third party's expectation.
@@ -621,7 +634,9 @@ function warnParserOverwrite(oid, typeName) {
621
634
  'process, and Turbine is replacing it. `pg.types.setTypeParser` is process-global and takes effect ' +
622
635
  'immediately for EVERY pg.Pool in the process, including pools that already exist and are already ' +
623
636
  'querying, so whatever set that parser will now read this column differently. If yours should win, ' +
624
- `register it AFTER constructing the client.${remedy} Dev-only: silent under \`NODE_ENV=production\`.`);
637
+ `register it AFTER constructing the client.${remedy} This warning fires under \`NODE_ENV=production\` ` +
638
+ 'too: which parser wins depends on module evaluation order, so a process can be clean in dev and wrong ' +
639
+ 'in production from import order alone.');
625
640
  }
626
641
  /**
627
642
  * Register the UTC readings of the four zone-less temporal OIDs on the pg
@@ -800,6 +815,55 @@ function closestName(input, candidates) {
800
815
  }
801
816
  return best;
802
817
  }
818
+ /** camelCase name → its lowercased words (`logQueryParams` → log, query, params). */
819
+ function camelWords(name) {
820
+ return name
821
+ .split(/(?=[A-Z])/)
822
+ .map((w) => w.toLowerCase())
823
+ .filter(Boolean);
824
+ }
825
+ /**
826
+ * The real option key `key` most likely meant, or null when nothing is close.
827
+ *
828
+ * Shared by every "unknown option" diagnostic (the client-config warner in
829
+ * client.ts and the prisma-compat query-option warner), so a reader who has
830
+ * seen one recognizes the ranking in the other.
831
+ *
832
+ * {@link closestName} decides first, which is bounded by edit distance and
833
+ * covers typos. It does not cover the miss these warnings exist for: a guessed
834
+ * name that omits a whole WORD. `logParams` is five edits from `logQueryParams`,
835
+ * past the bound, yet it names the same words in the same order; likewise
836
+ * `customPlan` for `forceCustomPlan`. So a second pass accepts a candidate whose
837
+ * camelCase words CONTAIN the guess's words in order, preferring the one that
838
+ * adds fewest words.
839
+ */
840
+ function suggestKey(key, candidates) {
841
+ const direct = closestName(key, candidates);
842
+ if (direct)
843
+ return direct;
844
+ const wanted = camelWords(key);
845
+ if (wanted.length < 2)
846
+ return null;
847
+ let best = null;
848
+ let bestExtra = Number.POSITIVE_INFINITY;
849
+ for (const candidate of candidates) {
850
+ const words = camelWords(candidate);
851
+ if (words.length <= wanted.length)
852
+ continue;
853
+ let i = 0;
854
+ for (const w of words)
855
+ if (w === wanted[i])
856
+ i++;
857
+ if (i !== wanted.length)
858
+ continue;
859
+ const extra = words.length - wanted.length;
860
+ if (extra < bestExtra) {
861
+ bestExtra = extra;
862
+ best = candidate;
863
+ }
864
+ }
865
+ return best;
866
+ }
803
867
  /**
804
868
  * The "unknown field" error text, listing RELATIONS as well as columns.
805
869
  *
@@ -96,6 +96,14 @@ export declare const WARN_NS: {
96
96
  * `warnParserOverwrite`). Keyed on the OID.
97
97
  */
98
98
  readonly parserOverwrite: "parserOverwrite";
99
+ /**
100
+ * A key on the args object passed to a `turbine-orm/prisma-compat` delegate
101
+ * call that is neither a Prisma arg for that operation nor a turbine-native
102
+ * query option (prisma-compat.ts `warnUnknownQueryOptions`). Keyed on
103
+ * `model.operation.key`, so the same typo on two models is two reports, and
104
+ * a million executions of one call site is one.
105
+ */
106
+ readonly unknownQueryOption: "unknownQueryOption";
99
107
  /**
100
108
  * `planCacheMode` was set on a client given an EXTERNAL pool, where Turbine
101
109
  * runs no connection setup, so the option is a no-op (client.ts constructor).
@@ -137,6 +137,14 @@ exports.WARN_NS = {
137
137
  * `warnParserOverwrite`). Keyed on the OID.
138
138
  */
139
139
  parserOverwrite: 'parserOverwrite',
140
+ /**
141
+ * A key on the args object passed to a `turbine-orm/prisma-compat` delegate
142
+ * call that is neither a Prisma arg for that operation nor a turbine-native
143
+ * query option (prisma-compat.ts `warnUnknownQueryOptions`). Keyed on
144
+ * `model.operation.key`, so the same typo on two models is two reports, and
145
+ * a million executions of one call site is one.
146
+ */
147
+ unknownQueryOption: 'unknownQueryOption',
140
148
  /**
141
149
  * `planCacheMode` was set on a client given an EXTERNAL pool, where Turbine
142
150
  * runs no connection setup, so the option is a no-op (client.ts constructor).
@@ -14,7 +14,7 @@
14
14
  * turbine migrate status , Show migration status
15
15
  * turbine seed , Run seed file
16
16
  * turbine status , Show schema summary
17
- * turbine doctor - Cost-aware missing-FK-index triage (--fix, --json, --no-concurrently, --unused, --audit)
17
+ * turbine doctor - Index + cached-plan triage (--fix, --json, --no-concurrently, --unused, --audit, --no-plan-divergence)
18
18
  * turbine studio : Launch local read-only web UI (--demo for a seeded sample DB)
19
19
  * turbine mcp , Start read-only MCP server over JSON-RPC stdio
20
20
  * turbine observe , Launch metrics dashboard (requires TURBINE_OBSERVE_URL)
@@ -61,6 +61,8 @@ export interface CliArgs {
61
61
  minScans?: number;
62
62
  /** `doctor --metrics-url <url>`: read _turbine_metrics for the table-heat boost from a separate DB. */
63
63
  metricsUrl?: string;
64
+ /** `doctor --no-plan-divergence`: skip the cached-plan divergence section (and its pg_stats read). */
65
+ noPlanDivergence?: boolean;
64
66
  /** `init --yes`/`-y`: accept every step's default non-interactively. */
65
67
  yes?: boolean;
66
68
  /** `init --skip-schema`: don't scaffold the schema file. */