qubu 0.0.0 → 0.3.4

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 (109) hide show
  1. package/dist/canonical-BbnqavJm.mjs +972 -0
  2. package/dist/codegen.d.mts +107 -0
  3. package/dist/codegen.mjs +1199 -0
  4. package/dist/column-CXMxx8Hq.mjs +118 -0
  5. package/dist/complete-D5Djh-zo.mjs +1788 -0
  6. package/dist/complete-types-BdFqUfbb.d.mts +371 -0
  7. package/dist/core.d.mts +33 -0
  8. package/dist/core.mjs +36 -0
  9. package/dist/ddl.d.mts +118 -0
  10. package/dist/ddl.mjs +1120 -0
  11. package/dist/dialect-b2-Z6uBF.mjs +13 -0
  12. package/dist/diff.d.mts +2 -0
  13. package/dist/diff.mjs +883 -0
  14. package/dist/drizzle-mysql.d.mts +24 -0
  15. package/dist/drizzle-mysql.mjs +72 -0
  16. package/dist/drizzle-postgres.d.mts +24 -0
  17. package/dist/drizzle-postgres.mjs +73 -0
  18. package/dist/drizzle-sqlite.d.mts +24 -0
  19. package/dist/drizzle-sqlite.mjs +82 -0
  20. package/dist/drizzle.d.mts +13 -0
  21. package/dist/drizzle.mjs +2 -0
  22. package/dist/errors-BGCoLe_r.mjs +14 -0
  23. package/dist/errors-Dxv73YJu.mjs +26 -0
  24. package/dist/explain-CkIK13L_.mjs +98 -0
  25. package/dist/index-Ds7-mhJi.d.mts +146 -0
  26. package/dist/index-Dug5HnLB.d.mts +204 -0
  27. package/dist/index.d.mts +2 -0
  28. package/dist/index.mjs +1276 -0
  29. package/dist/introspection.d.mts +117 -0
  30. package/dist/introspection.mjs +4341 -0
  31. package/dist/json-CUZlv4HT.mjs +169 -0
  32. package/dist/migration.d.mts +215 -0
  33. package/dist/migration.mjs +1161 -0
  34. package/dist/mysql-DqkqXB6A.mjs +355 -0
  35. package/dist/mysql.d.mts +5 -0
  36. package/dist/mysql.mjs +50 -0
  37. package/dist/naming-QVCOnSj2.mjs +20 -0
  38. package/dist/omit-OxV58AwX.mjs +5 -0
  39. package/dist/on-conflict-BxnxubMb.mjs +143 -0
  40. package/dist/postgres-DEBBeh52.mjs +235 -0
  41. package/dist/postgres.d.mts +123 -0
  42. package/dist/postgres.mjs +52 -0
  43. package/dist/registry-BufIskVN.mjs +569 -0
  44. package/dist/relational-DCZrrNia.mjs +77 -0
  45. package/dist/runtime-BTr-MTlo.mjs +193 -0
  46. package/dist/schema.d.mts +2 -0
  47. package/dist/schema.mjs +5 -0
  48. package/dist/serialize-PF1cfH2P.mjs +556 -0
  49. package/dist/snapshot-CWPgzxNx.mjs +392 -0
  50. package/dist/snapshot.d.mts +4 -0
  51. package/dist/snapshot.mjs +8 -0
  52. package/dist/source-DUoJVXmL.mjs +68 -0
  53. package/dist/sqlite-BU6DBxef.mjs +320 -0
  54. package/dist/sqlite.d.mts +5 -0
  55. package/dist/sqlite.mjs +48 -0
  56. package/dist/standard-BTVYKh_F.mjs +12 -0
  57. package/dist/table-llv9tsZ8.mjs +384 -0
  58. package/dist/types-4Q076HKo.d.mts +3636 -0
  59. package/dist/types-BX0mckiU.d.mts +644 -0
  60. package/dist/types-Cec0xzo4.mjs +116 -0
  61. package/dist/types-H4vyCw8_.d.mts +45 -0
  62. package/dist/value-BvilP0oz.mjs +29 -0
  63. package/dist/vite/ambient.d.ts +449 -0
  64. package/dist/vite.d.mts +35 -0
  65. package/dist/vite.mjs +498 -0
  66. package/docs/config.json +21 -0
  67. package/docs/dialects-and-execution.md +427 -0
  68. package/docs/getting-started.md +96 -0
  69. package/docs/guides/compose-queries.md +225 -0
  70. package/docs/guides/drizzle.md +130 -0
  71. package/docs/guides/extensions/dialects.md +40 -0
  72. package/docs/guides/extensions/overview.md +36 -0
  73. package/docs/guides/extensions/sources-and-clauses.md +82 -0
  74. package/docs/guides/extensions/typed-expressions.md +94 -0
  75. package/docs/guides/extensions/unsafe-syntax.md +27 -0
  76. package/docs/guides/json.md +65 -0
  77. package/docs/guides/mutations.md +138 -0
  78. package/docs/guides/select/conditions.md +110 -0
  79. package/docs/guides/select/grouping-and-windows.md +82 -0
  80. package/docs/guides/select/ordering-and-pagination.md +78 -0
  81. package/docs/guides/select/overview.md +139 -0
  82. package/docs/guides/sql-templates.md +157 -0
  83. package/docs/guides/vite-plugin.md +92 -0
  84. package/docs/index.md +111 -0
  85. package/docs/query-model/fragments.md +109 -0
  86. package/docs/query-model/result-shapes.md +125 -0
  87. package/docs/query-model/source-scope.md +182 -0
  88. package/docs/reference/introspection-support.md +196 -0
  89. package/docs/reference/mysql-snapshot.md +55 -0
  90. package/docs/reference/postgres-snapshot.md +61 -0
  91. package/docs/reference/sqlite-snapshot.md +53 -0
  92. package/docs/reference/supported-surface.md +104 -0
  93. package/docs/schema/catalog-model.md +58 -0
  94. package/docs/schema/code-generation.md +139 -0
  95. package/docs/schema/columns-and-writes.md +130 -0
  96. package/docs/schema/constraints-and-indexes.md +180 -0
  97. package/docs/schema/ddl-emission.md +75 -0
  98. package/docs/schema/diff.md +75 -0
  99. package/docs/schema/introspection.md +214 -0
  100. package/docs/schema/migration-plans.md +76 -0
  101. package/docs/schema/snapshots.md +93 -0
  102. package/docs/schema/storage-and-schema-sql.md +104 -0
  103. package/docs/schema/tables-and-names.md +106 -0
  104. package/docs/sql-semantic-types.md +141 -0
  105. package/docs/troubleshooting.md +151 -0
  106. package/package.json +132 -10
  107. package/skills/qubu/SKILL.md +42 -0
  108. package/skills/qubu/agents/openai.yaml +6 -0
  109. package/readme.md +0 -1
@@ -0,0 +1,106 @@
1
+ # Tables and names
2
+
3
+ > Define query-facing tables, keep their TypeScript identities stable, and control how fields become SQL names.
4
+
5
+ `table()` definitions describe the columns Qubu can select and write. They are
6
+ not database introspection and they do not create or migrate a database.
7
+
8
+ ## Register tables under stable IDs
9
+
10
+ Use `schema()` when several table declarations belong to one database model. The
11
+ record keys become logical table IDs and stay stable when a physical SQL name
12
+ changes:
13
+
14
+ ```ts
15
+ import { integer, schema, table, text } from 'qubu'
16
+
17
+ const accounts = table('account_records', {
18
+ id: integer(),
19
+ email: text(),
20
+ })
21
+ const memberships = table('membership_records', {
22
+ accountId: integer(),
23
+ })
24
+
25
+ const appSchema = schema({ accounts, memberships }, { namespace: 'public' })
26
+ ```
27
+
28
+ appSchema.registry.accounts.id is "accounts", while the physical table name is
29
+ "account_records". Registering the table does not change its query source, SQL
30
+ rendering, or row and mutation types. The namespace belongs to schema metadata
31
+ and is not added to ordinary queries.
32
+
33
+ The registry is immutable. Qubu validates duplicate IDs, duplicate physical
34
+ names, invalid namespaces, and collisions in generated names before returning
35
+ the model. A failed registry construction throws `SchemaValidationError`; its
36
+ diagnostics array contains every invalid path.
37
+
38
+ The generated-name policy is versioned. Import `generatedTableName()` from
39
+ `qubu/schema` when a schema tool needs to preview the policy. It returns
40
+ `user_id` for `userId` under policy version 1. Explicit names passed to
41
+ `table()` remain unchanged. The policy gives snapshot encoders stable names
42
+ without changing TypeScript source identity.
43
+
44
+ ## Map field names to SQL
45
+
46
+ Write schema keys in camelCase. Qubu converts them to snake_case in SQL, then
47
+ uses the camelCase keys in the returned row:
48
+
49
+ ```ts
50
+ import { from, select, table, timestamp, uuid } from 'qubu'
51
+
52
+ const events = table('events', {
53
+ userId: uuid(),
54
+ createdAt: timestamp(),
55
+ })
56
+
57
+ const query = select(
58
+ { userId: events.userId, createdAt: events.createdAt },
59
+ from(events)
60
+ )
61
+ ```
62
+
63
+ The query selects "events"."user_id" and "events"."created_at", then aliases
64
+ them as "userId" and "createdAt" for the returned row. Inserts and updates
65
+ accept the same camelCase keys.
66
+
67
+ Acronym boundaries are preserved:
68
+
69
+ | TypeScript key | SQL name |
70
+ | -------------- | ---------------- |
71
+ | userID | user_id |
72
+ | APIKey | api_key |
73
+ | XMLHttpRequest | xml_http_request |
74
+
75
+ Prefer `userId` and `apiKey` when you control the TypeScript name. Use `sqlName` when
76
+ the database name does not follow the convention:
77
+
78
+ ```ts
79
+ const events = table('events', {
80
+ createdAt: timestamp({ sqlName: 'creation_timestamp' }),
81
+ })
82
+ ```
83
+
84
+ Qubu rejects fields that resolve to the same SQL name, such as `userId` and
85
+ userID in one table.
86
+
87
+ CTEs, derived tables, lateral queries, and subqueries remain SQL relations, so
88
+ their projected names stay snake_case. Only the outer result projection uses
89
+ camelCase aliases. Pass the database relation name explicitly:
90
+
91
+ ```ts
92
+ import { table, uuid } from 'qubu'
93
+
94
+ const accounts = table('user_accounts', {
95
+ id: uuid(),
96
+ })
97
+ ```
98
+
99
+ ## Read next
100
+
101
+ - [Column behavior and write types](columns-and-writes.md) covers nullability,
102
+ defaults, generated columns, and application types.
103
+ - [Constraints, keys, and indexes](constraints-and-indexes.md) covers the
104
+ metadata used by grouping and schema checks.
105
+ - [Storage and schema SQL](storage-and-schema-sql.md) covers physical storage
106
+ and deterministic schema expressions.
@@ -0,0 +1,141 @@
1
+ # SQL semantic types
2
+
3
+ > Use SQL domains to constrain valid query composition without conflating database semantics with driver-decoded application values.
4
+
5
+ Qubu tracks four independent facts for a field or result expression:
6
+
7
+ | Fact | Question it answers | Example |
8
+ | --------------- | --------------------------------------------------------- | ------------------------- |
9
+ | JavaScript type | What value does the driver give the application? | `string` |
10
+ | Write types | What values may an insert or update accept? | `string`, `Date`, or both |
11
+ | Nullability | Can the selected value be `null`? | `false` |
12
+ | SQL domain | Which portable SQL operations may consume the expression? | `SqlText` or `SqlUuid` |
13
+
14
+ The axes are deliberately separate. Both `text()` and `uuid()` decode to a
15
+ JavaScript `string`, but their SQL behavior differs. Likewise, two
16
+ `timestamp()` definitions may share `SqlTimestamp` while a custom column uses
17
+ different JavaScript output and write types for its driver.
18
+
19
+ ## Built-in domains and capabilities
20
+
21
+ Schema helpers attach these portable semantic domains:
22
+
23
+ | Helpers | SQL domain | Portable capabilities |
24
+ | ------------- | -------------- | ----------------------------------- |
25
+ | `text()` | `SqlText` | text, equality, ordering |
26
+ | `uuid()` | `SqlUuid` | equality |
27
+ | `integer()` | `SqlInteger` | numeric, equality, numeric ordering |
28
+ | `numeric()` | `SqlDecimal` | numeric, equality, numeric ordering |
29
+ | `boolean()` | `SqlBoolean` | equality |
30
+ | `date()` | `SqlDate` | equality, date ordering |
31
+ | `timestamp()` | `SqlTimestamp` | equality, timestamp ordering |
32
+ | `json<T>()` | `SqlJson<T>` | no portable comparison capability |
33
+ | `bigint()` | `SqlBigInt` | numeric, equality, numeric ordering |
34
+ | `binary()` | `SqlBinary` | equality |
35
+
36
+ Capabilities describe portable operation families. `SqlTextLike` is accepted
37
+ by text functions and pattern matching, `SqlNumericLike` by arithmetic and
38
+ numeric aggregates, and `SqlOrderable<Group>` by ordering operations. Equality
39
+ and ordering groups allow related domains to interoperate: `SqlInteger` and
40
+ `SqlDecimal` share the `numeric` group, for example.
41
+
42
+ Specific result domains are still retained. `lower(textColumn)` produces
43
+ `SqlText`, while `avg(integerColumn)` produces `SqlDecimal`:
44
+
45
+ ```ts
46
+ import { avg, integer, lower, table, text } from 'qubu'
47
+ import type { SqlTypeOf } from 'qubu'
48
+
49
+ const metrics = table('metrics', {
50
+ label: text(),
51
+ sampleCount: integer(),
52
+ })
53
+
54
+ const normalized = lower(metrics.label)
55
+ type LowerDomain = SqlTypeOf<typeof normalized>
56
+ // SqlText
57
+
58
+ const mean = avg(metrics.sampleCount)
59
+ type MeanDomain = SqlTypeOf<typeof mean>
60
+ // SqlDecimal
61
+ ```
62
+
63
+ `SqlTypeOf<T>` reads the domain of any result-bearing expression. Named query
64
+ projections retain a map of domains through `QuerySqlTypeMap<T>`; aliases,
65
+ CTEs, LATERAL sources, scalar subqueries, set operations, and mutation
66
+ `RETURNING` projections carry those domains forward.
67
+
68
+ ## UUID is not text-like
69
+
70
+ A UUID may be decoded as a JavaScript string without acquiring SQL text
71
+ semantics. Contextual JavaScript literals remain ergonomic for compatible
72
+ operators:
73
+
74
+ ```ts
75
+ import { asc, eq, inList, like, lower, orderBy, table, uuid } from 'qubu'
76
+
77
+ const records = table('records', { id: uuid() })
78
+
79
+ eq(records.id, '108cb836-20d2-41b2-8c23-f0c94700aa7e') // valid
80
+ inList(records.id, ['first-id', 'second-id']) // valid
81
+
82
+ lower(records.id) // TypeScript error: SqlUuid is not SqlTextLike
83
+ like(records.id, '%uuid%') // TypeScript error: SqlUuid is not SqlTextLike
84
+ orderBy(asc(records.id)) // TypeScript error: SqlUuid is not portably orderable
85
+ ```
86
+
87
+ Plain JavaScript operands take their domain from the typed expression in that
88
+ operation. This contextual typing does not relabel an expression: comparing a
89
+ `SqlUuid` expression with a `SqlText` expression is still rejected. Cast when
90
+ the database operation intentionally changes domains:
91
+
92
+ ```ts
93
+ import { cast, like, text } from 'qubu'
94
+
95
+ const idAsText = cast(records.id, text())
96
+ like(idAsText, '108c%')
97
+ ```
98
+
99
+ Built-in definitions carry logical cast targets, so the active dialect can
100
+ render `TEXT`, MySQL `CHAR`, or another configured spelling while the result
101
+ remains `string`/`SqlText`. Use a custom definition or `typedCast()` when the
102
+ target is vendor-specific.
103
+
104
+ ## Known incompatibility is rejected
105
+
106
+ Qubu checks capabilities and compatibility when it knows both SQL domains.
107
+ Arithmetic and `SUM`/`AVG` require numeric-like expressions; text functions,
108
+ concatenation, `LIKE`, and PostgreSQL `ILIKE` require text-like expressions;
109
+ ordering and range comparisons require compatible ordering groups; and
110
+ equality, `IN`, `CASE`, `COALESCE`, and set-operation fields require compatible
111
+ equality groups. Boolean clauses require a boolean SQL domain.
112
+
113
+ These checks model portable capability and group relationships, not every
114
+ database's implicit casts. An expression accepted by one database after an
115
+ implicit conversion may therefore need an explicit typed cast in portable
116
+ Qubu code.
117
+
118
+ ## Unknown domains preserve compatibility
119
+
120
+ `column()`, `value()`, `call()`, and untyped custom expressions default to
121
+ `SqlUnknown`. Unknown is intentionally permissive, so existing extensions keep
122
+ composing while authors adopt semantic types incrementally:
123
+
124
+ ```ts
125
+ const legacyId = column<string>()
126
+ // ColumnSqlType<typeof legacyId> is SqlUnknown
127
+ ```
128
+
129
+ `SqlUnknown` is an escape hatch, not evidence about the database. Prefer a
130
+ declared domain for reusable extensions so incompatible composition fails at
131
+ the call site. See [Typed expressions](guides/extensions/typed-expressions.md#declare-a-custom-sql-domain)
132
+ for custom domains, functions, values, casts, and raw expressions.
133
+
134
+ ## Static metadata is not database proof
135
+
136
+ SQL semantic domains affect TypeScript only. A definition used explicitly as a
137
+ cast target also contributes a logical or named runtime target. Those domains
138
+ do not inspect the database, prove a migration safe, select a wire encoding, or
139
+ verify that the rendered type name exists. The application remains responsible
140
+ for keeping table definitions aligned with the database, and the driver
141
+ adapter remains responsible for encoding parameters and decoding rows.
@@ -0,0 +1,151 @@
1
+ # Troubleshooting
2
+
3
+ > Start from the observed error or output, verify the boundary that produced it, and apply the smallest fix that changes the result.
4
+
5
+ ## Column is not available in this query scope
6
+
7
+ Qubu found a column whose source is not in `FROM` or `JOIN` clauses.
8
+ Read [Source scope](query-model/source-scope.md) for the source
9
+ identity rules behind this error.
10
+
11
+ Check that the query includes the original source or use the columns exposed by
12
+ the alias, CTE, or derived table you actually placed in the query:
13
+
14
+ ```ts
15
+ import { alias, from, select } from 'qubu'
16
+
17
+ const author = alias(users, 'author')
18
+
19
+ select({ name: author.name }, from(author))
20
+ ```
21
+
22
+ `author.name` is valid in this query; `users.name` is a different source
23
+ identity after aliasing.
24
+
25
+ ## UPDATE/DELETE requires a WHERE
26
+
27
+ This is the default mutation safety check. Add a source-aware predicate:
28
+
29
+ ```ts
30
+ import { deleteFrom, eq, update, where } from 'qubu'
31
+
32
+ update(users, { name: 'Ada' }, where(eq(users.id, 7)))
33
+ deleteFrom(users, where(eq(users.id, 8)))
34
+ ```
35
+
36
+ If every row is intentionally affected, pass `allowAll()` explicitly and keep
37
+ that decision close to the authorization or maintenance code that justifies
38
+ it.
39
+
40
+ ## scalar() requires one selected column
41
+
42
+ A scalar subquery must return one selected field. Reduce the projection before
43
+ calling `scalar()`:
44
+
45
+ ```ts
46
+ import { from, scalar, select } from 'qubu'
47
+
48
+ const idQuery = select({ id: users.id }, from(users))
49
+ const idExpression = scalar(idQuery)
50
+ ```
51
+
52
+ Use a normal derived table or CTE when the nested query needs multiple fields.
53
+ For scalar result nullability, see [Result shapes and cardinality](query-model/result-shapes.md).
54
+
55
+ ## Placeholders do not match the driver
56
+
57
+ Render with the dialect that the adapter expects and inspect both fields of the
58
+ result:
59
+
60
+ ```ts
61
+ import { render } from 'qubu'
62
+ import { postgresDialect } from 'qubu/postgres'
63
+
64
+ const statement = render(query, postgresDialect())
65
+ console.log(statement.text)
66
+ console.log(statement.parameters)
67
+ ```
68
+
69
+ `statement.parameters` is ordered to match the placeholders in `statement.text`.
70
+ Do not interpolate the values into the text or use a PostgreSQL dialect with a
71
+ driver that expects `?` placeholders.
72
+
73
+ ## Read and repair query diagnostics
74
+
75
+ Type-level query failures carry stable properties in the diagnostic type, and
76
+ runtime authoring failures throw `QueryValidationError`. Read the code, context,
77
+ path, and hint before changing the query. The hint names the repair boundary;
78
+ the path points to the clause or field that needs attention.
79
+
80
+ ```ts
81
+ import { QueryValidationError, fetchFirst } from 'qubu'
82
+
83
+ try {
84
+ fetchFirst(-1)
85
+ } catch (error) {
86
+ if (error instanceof QueryValidationError) {
87
+ console.error(error.code, error.context, error.path, error.hint)
88
+ }
89
+ }
90
+ ```
91
+
92
+ TypeScript diagnostics expose the same names through `QueryTypeValidation`:
93
+ `__qubu_error_code__`, `__qubu_error_context__`, and
94
+ `__qubu_error_hint__`. Treat those fields as the repair contract. Do not cast
95
+ away a failed query type just to reach rendering.
96
+
97
+ | Code | Usual repair |
98
+ | ---------------------------- | ---------------------------------------------------------------------------- |
99
+ | `invalid-selection` | Give `select()` at least one valid projected field. |
100
+ | `duplicate-clause` | Keep one instance of a clause that Qubu allows only once. |
101
+ | `invalid-mutation` | Fix the mutation shape before rendering it. |
102
+ | `unsafe-mutation` | Add `where(...)` or opt into `allowAll()` deliberately. |
103
+ | `invalid-update` | Use target-table columns and valid assignment values. |
104
+ | `invalid-insert` | Supply required target columns and no unknown columns. |
105
+ | `invalid-comparison` | Use operands with compatible nullability or SQL domains. |
106
+ | `invalid-boolean-expression` | Pass a boolean expression to `where()`, `having()`, or boolean operators. |
107
+ | `invalid-pagination` | Pass a non-negative integer to `offset()`, `fetchFirst()`, or `fetchNext()`. |
108
+ | `invalid-json-path` | Use string object keys and non-negative integer array indexes. |
109
+ | `missing-source` | Add the owning source with `from()`, a join, or intentional `correlate()`. |
110
+ | `invalid-grouping` | Group visible dependencies or project them through an aggregate. |
111
+ | `incompatible-sql-domain` | Use an expression with the required SQL capability. |
112
+ | `incompatible-sql-equality` | Compare values from the same SQL equality group. |
113
+ | `incompatible-sql-order` | Compare or order values from the same SQL ordering group. |
114
+ | `incompatible-set-domain` | Make corresponding set-operation fields use compatible domains. |
115
+ | `invalid-subquery` | Give `scalar()` or `inQuery()` the required field count and shape. |
116
+ | `invalid-omission` | Use `omit` only for a conditional projection or supported query clause. |
117
+ | `missing-dialect-capability` | Render with a dialect that advertises the query's required capability. |
118
+
119
+ After the smallest source or clause fix, run the type check again, then render
120
+ the query with the adapter's dialect and inspect `text` and `parameters`
121
+ together.
122
+
123
+ ## A Vite global is undefined or missing from TypeScript
124
+
125
+ Verify all three opt-ins:
126
+
127
+ 1. The Vite config includes `qubu()` from `qubu/vite`.
128
+ 2. The source module starts its directive prologue with `'use qubu'` (after any
129
+ other directive is also supported).
130
+ 3. TypeScript includes `qubu/globals` in its `types` list or includes the
131
+ declaration explicitly.
132
+
133
+ The transform skips non-script files, dependencies under `node_modules`, files
134
+ excluded by filters, and modules that reference no eligible Qubu global.
135
+
136
+ ## Parameters are in an unexpected order
137
+
138
+ `select()` accepts clauses as independent values and normalizes their SQL
139
+ placement. Rendering traverses that normalized statement, so inspect the final
140
+ `text` and `parameters` together rather than assuming source argument order:
141
+
142
+ ```ts
143
+ import { eq, fetchFirst, from, render, select, where } from 'qubu'
144
+
145
+ const statement = render(
146
+ select({ id: users.id }, from(users), where(eq(users.id, 7)), fetchFirst(10))
147
+ )
148
+ ```
149
+
150
+ The `WHERE` parameter renders before the pagination parameter because the SQL
151
+ text places `WHERE` before pagination.
package/package.json CHANGED
@@ -1,13 +1,135 @@
1
1
  {
2
2
  "name": "qubu",
3
- "version": "0.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.3.4",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/aleclarson/qubu"
7
+ },
8
+ "type": "module",
9
+ "files": [
10
+ "dist",
11
+ "docs",
12
+ "skills"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.mts",
17
+ "import": "./dist/index.mjs"
18
+ },
19
+ "./codegen": {
20
+ "types": "./dist/codegen.d.mts",
21
+ "import": "./dist/codegen.mjs"
22
+ },
23
+ "./core": {
24
+ "types": "./dist/core.d.mts",
25
+ "import": "./dist/core.mjs"
26
+ },
27
+ "./ddl": {
28
+ "types": "./dist/ddl.d.mts",
29
+ "import": "./dist/ddl.mjs"
30
+ },
31
+ "./diff": {
32
+ "types": "./dist/diff.d.mts",
33
+ "import": "./dist/diff.mjs"
34
+ },
35
+ "./drizzle": {
36
+ "types": "./dist/drizzle.d.mts",
37
+ "import": "./dist/drizzle.mjs"
38
+ },
39
+ "./introspection": {
40
+ "types": "./dist/introspection.d.mts",
41
+ "import": "./dist/introspection.mjs"
42
+ },
43
+ "./migration": {
44
+ "types": "./dist/migration.d.mts",
45
+ "import": "./dist/migration.mjs"
46
+ },
47
+ "./mysql": {
48
+ "types": "./dist/mysql.d.mts",
49
+ "import": "./dist/mysql.mjs"
50
+ },
51
+ "./postgres": {
52
+ "types": "./dist/postgres.d.mts",
53
+ "import": "./dist/postgres.mjs"
54
+ },
55
+ "./schema": {
56
+ "types": "./dist/schema.d.mts",
57
+ "import": "./dist/schema.mjs"
58
+ },
59
+ "./snapshot": {
60
+ "types": "./dist/snapshot.d.mts",
61
+ "import": "./dist/snapshot.mjs"
62
+ },
63
+ "./sqlite": {
64
+ "types": "./dist/sqlite.d.mts",
65
+ "import": "./dist/sqlite.mjs"
66
+ },
67
+ "./vite": {
68
+ "types": "./dist/vite.d.mts",
69
+ "import": "./dist/vite.mjs"
70
+ },
71
+ "./package.json": "./package.json",
72
+ "./drizzle/mysql": {
73
+ "types": "./dist/drizzle-mysql.d.mts",
74
+ "import": "./dist/drizzle-mysql.mjs"
75
+ },
76
+ "./drizzle/postgres": {
77
+ "types": "./dist/drizzle-postgres.d.mts",
78
+ "import": "./dist/drizzle-postgres.mjs"
79
+ },
80
+ "./drizzle/sqlite": {
81
+ "types": "./dist/drizzle-sqlite.d.mts",
82
+ "import": "./dist/drizzle-sqlite.mjs"
83
+ },
84
+ "./globals": {
85
+ "types": "./dist/vite/ambient.d.ts"
86
+ }
87
+ },
88
+ "prettier": "@alloc/prettier-config",
89
+ "devDependencies": {
90
+ "@alloc/prettier-config": "^1.0.0",
91
+ "@pg-nano/pg-tmp": "^2.0.3",
92
+ "@types/bun": "^1.3.0",
93
+ "@types/node": "^24.6.2",
94
+ "@types/pg": "^8.23.1",
95
+ "drizzle-orm": "1.0.0-rc.4",
96
+ "lildocs": "^0.1.27",
97
+ "mysql2": "^3.23.4",
98
+ "pg": "^8.23.0",
99
+ "picospawn": "^0.3.10",
100
+ "prettier": "^3.6.2",
101
+ "qubu": "link:",
102
+ "radashi": "^12.6.2",
103
+ "tinyglobby": "^0.2.15",
104
+ "tsdown": "^0.22.14",
105
+ "type-fest": "^5.0.1",
106
+ "typescript": "^5.9.3",
107
+ "vitest": "^3.2.4"
108
+ },
109
+ "dependencies": {
110
+ "@standard-schema/spec": "^1.0.0"
8
111
  },
9
- "keywords": [],
10
- "author": "",
11
- "license": "MIT",
12
- "type": "commonjs"
13
- }
112
+ "peerDependencies": {
113
+ "drizzle-orm": "^1.0.0-rc.4"
114
+ },
115
+ "peerDependenciesMeta": {
116
+ "drizzle-orm": {
117
+ "optional": true
118
+ }
119
+ },
120
+ "scripts": {
121
+ "build": "tsdown",
122
+ "check:package": "node ./scripts/test-package.mjs --check-built",
123
+ "playground": "bun run ./playground/playground.ts",
124
+ "test": "vitest",
125
+ "test:e2e": "vitest --run test/e2e/dialects.test.ts",
126
+ "test:type-performance": "node ./scripts/test-type-performance.mjs",
127
+ "diff-check": "vitest --run test/diff.test.ts test/migration.test.ts",
128
+ "test:bun": "node ./scripts/test-package.mjs --runtime=bun",
129
+ "test:package": "node ./scripts/test-package.mjs",
130
+ "test:package:node": "node ./scripts/test-package.mjs --runtime=node",
131
+ "typecheck": "vitest --typecheck --run",
132
+ "typecheck:playground": "tsc --project ./playground/tsconfig.json",
133
+ "lint": "prettier --check . && npm run typecheck"
134
+ }
135
+ }
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: qubu
3
+ description: Route Qubu query, schema, and repair work to the exact installed package's canonical docs. Use when a project depends on Qubu and the task needs product guidance rather than a generic SQL answer.
4
+ ---
5
+
6
+ # Qubu
7
+
8
+ Use the documentation shipped with the Qubu package in the current project.
9
+ Resolve the package first so the guidance matches the installed version:
10
+
11
+ ```sh
12
+ node -e "const path=require.resolve('qubu/package.json'); console.log(require('node:path').join(require('node:path').dirname(path), 'docs'))"
13
+ ```
14
+
15
+ If resolution fails, Qubu is not installed in the current project. Do not use
16
+ docs from another checkout or version as a substitute.
17
+
18
+ Read the smallest page that matches the task:
19
+
20
+ - first query or canonical `SELECT` style: `docs/getting-started.md` or
21
+ `docs/guides/select/overview.md`
22
+ - optional predicates, result shape, cardinality, or query composition:
23
+ `docs/guides/select/conditions.md`, `docs/query-model/result-shapes.md`, or
24
+ `docs/guides/compose-queries.md`
25
+ - `INSERT`, `UPDATE`, or `DELETE`: `docs/guides/mutations.md`
26
+ - a compile-time or runtime query failure: `docs/troubleshooting.md`
27
+ - schema metadata or storage: `docs/schema/tables-and-names.md`,
28
+ `docs/schema/columns-and-writes.md`, or
29
+ `docs/schema/storage-and-schema-sql.md`
30
+ - snapshots or catalog reads: `docs/schema/snapshots.md` or
31
+ `docs/schema/introspection.md`
32
+ - snapshot comparison or migration planning:
33
+ `docs/schema/diff.md` or `docs/schema/migration-plans.md`
34
+ - approved-plan DDL emission: `docs/schema/ddl-emission.md`
35
+ - custom expressions, sources, clauses, or dialects: the matching page under
36
+ `docs/guides/extensions/`
37
+ - package ownership or entrypoint selection: `docs/reference/supported-surface.md`
38
+
39
+ Follow the page's root/core/schema ownership and use its examples as the
40
+ canonical source style. If the task spans concerns, read the smallest page for
41
+ each concern and keep the installed package's `docs/` directory as the only
42
+ product reference. Do not recreate API inventories or examples in this skill.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: 'Qubu'
3
+ short_description: 'Route Qubu work to package docs'
4
+ default_prompt: 'Use $qubu to find the smallest canonical Qubu guide for this task.'
5
+ policy:
6
+ allow_implicit_invocation: true
package/readme.md DELETED
@@ -1 +0,0 @@
1
- Coming soon...