@xanots/sdk 0.0.11 → 0.0.13

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 (100) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +16 -9
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/{agent-file-refresh-QNKN5RYD.js → agent-file-refresh-GQWAAOBV.js} +4 -4
  5. package/dist/bin.js +11 -11
  6. package/dist/{branch-commands-2BLOC2GR.js → branch-commands-5KMPAAZV.js} +7 -7
  7. package/dist/bundle.d.ts +2 -2
  8. package/dist/bundle.js +2 -2
  9. package/dist/{capture-4WVJY4DQ.js → capture-YLUVAITI.js} +2 -2
  10. package/dist/{chunk-22TKBSDV.js → chunk-2AY3PKF4.js} +2 -2
  11. package/dist/chunk-2VTJSI6X.js +192 -0
  12. package/dist/{chunk-5XZ744TS.js → chunk-2ZCUO2UG.js} +1 -1
  13. package/dist/{chunk-XEOX6AM7.js → chunk-3LQGF2WS.js} +2 -2
  14. package/dist/{chunk-WP4OZZV4.js → chunk-3VFCKHOB.js} +2 -2
  15. package/dist/{chunk-XHEXOES3.js → chunk-5YDINUAP.js} +1 -1
  16. package/dist/{chunk-LU7TRWMC.js → chunk-6VNRMKFJ.js} +2 -2
  17. package/dist/{chunk-CTD5ZCV6.js → chunk-7WRJPKGK.js} +2 -2
  18. package/dist/{chunk-3INK4Y4E.js → chunk-AE3PDSDS.js} +1 -1
  19. package/dist/{chunk-DBFU47BJ.js → chunk-AOFFKSJC.js} +2 -2
  20. package/dist/{chunk-TCFIPDB3.js → chunk-AVGDL6RB.js} +1 -1
  21. package/dist/{chunk-UOZMSF4C.js → chunk-BYQHCCYU.js} +5 -5
  22. package/dist/{chunk-BC2C5GVI.js → chunk-DCMANKMX.js} +1 -1
  23. package/dist/{chunk-WHOJWOSV.js → chunk-EETVJZAZ.js} +1 -1
  24. package/dist/{chunk-VNQM3V2C.js → chunk-EXENFOWE.js} +2 -2
  25. package/dist/{chunk-AIZKXUNP.js → chunk-IMLYGQK6.js} +2 -2
  26. package/dist/{chunk-OWGCOGKK.js → chunk-MEFMTICH.js} +83 -8
  27. package/dist/{chunk-QK7ZQJLP.js → chunk-N74KDCBD.js} +39 -25
  28. package/dist/{chunk-3IGNIP6R.js → chunk-NDP7OUPS.js} +1 -1
  29. package/dist/{chunk-4Q7ZOHH7.js → chunk-OONT4ZL4.js} +3 -3
  30. package/dist/{chunk-EQW3YT5U.js → chunk-P6PVBQL6.js} +2 -2
  31. package/dist/{chunk-QYMAZRAU.js → chunk-PJNWOZMT.js} +5 -5
  32. package/dist/{chunk-BSK7ELHU.js → chunk-PR7OXHGZ.js} +1 -1
  33. package/dist/{chunk-RCT7UX7B.js → chunk-RLI6XD4O.js} +32 -27
  34. package/dist/{chunk-ZQ2PKR6R.js → chunk-RQ3FXV4K.js} +2 -2
  35. package/dist/{chunk-Q77KNEUL.js → chunk-RQNMTDXD.js} +1703 -2
  36. package/dist/{chunk-4IF54NU5.js → chunk-S3DOJOW4.js} +41 -21
  37. package/dist/{chunk-HYBN4H3F.js → chunk-SS2V2QOG.js} +27 -20
  38. package/dist/{chunk-QKM4U5UK.js → chunk-TJS2AF5Y.js} +2 -2
  39. package/dist/{chunk-DIA7CT7J.js → chunk-V5Y7D4LH.js} +11 -2
  40. package/dist/{chunk-KA6G2L7U.js → chunk-VK26K7AY.js} +3 -3
  41. package/dist/{chunk-VAF6A3YD.js → chunk-XWFRNJMQ.js} +1 -1
  42. package/dist/{chunk-7ZYW652H.js → chunk-YHS6VVLJ.js} +2 -2
  43. package/dist/{chunk-G4EJMQLD.js → chunk-YX22LKQE.js} +2 -2
  44. package/dist/{chunk-F6CYJ7TN.js → chunk-Z2ZIE5CO.js} +2 -2
  45. package/dist/cli.d.ts +13 -6
  46. package/dist/cli.js +10 -10
  47. package/dist/codegen-command-ZDHMGFWZ.js +47 -0
  48. package/dist/codegen.d.ts +5 -5
  49. package/dist/codegen.js +2 -2
  50. package/dist/{completion-WF46272M.js → completion-HJU5QEFB.js} +2 -2
  51. package/dist/{deploy-command-IP7V7GT4.js → deploy-command-CGVKRWUE.js} +19 -19
  52. package/dist/{ephemeral-command-U4AQ3TXX.js → ephemeral-command-2NKPEXUU.js} +8 -8
  53. package/dist/index.d.ts +88 -104
  54. package/dist/index.js +9 -9
  55. package/dist/init-command-DNDONP3O.js +32 -0
  56. package/dist/internal.d.ts +10 -16
  57. package/dist/internal.js +34 -34
  58. package/dist/{io-P2H75UV2.js → io-UBDMMDH6.js} +3 -3
  59. package/dist/{live-diff-IXKBVG4K.js → live-diff-HCOTN5WC.js} +3 -3
  60. package/dist/{lock-46FWYE4D.js → lock-HQ4KARU2.js} +2 -2
  61. package/dist/{lock-commands-ZZKZ4LZJ.js → lock-commands-6U7UIJGR.js} +11 -11
  62. package/dist/{login-command-Z6CHTA57.js → login-command-P7LXD5TE.js} +6 -6
  63. package/dist/{loop-D5NPL4VH.js → loop-IC5ISSYB.js} +3 -3
  64. package/dist/{marketplace-command-P4IPLJ6J.js → marketplace-command-T6JCHW7J.js} +4 -4
  65. package/dist/{meta-client-K2J4XH64.js → meta-client-LKRKR3L2.js} +4 -4
  66. package/dist/node.d.ts +6 -6
  67. package/dist/node.js +14 -14
  68. package/dist/{preflight-command-K346GPTY.js → preflight-command-UYE7SUQV.js} +16 -16
  69. package/dist/{profile-command-LJSBDV2L.js → profile-command-WBNSMQSI.js} +3 -3
  70. package/dist/{release-command-IMNTIVWK.js → release-command-CMMYT6XK.js} +26 -26
  71. package/dist/{response-BQVQ24l1.d.ts → response-D6xGLEIn.d.ts} +18 -23
  72. package/dist/{routes-manifest-PWZHDOI5.js → routes-manifest-MN6XBYRE.js} +25 -14
  73. package/dist/{runtime-V4C3AC3A.js → runtime-LSLIDALK.js} +1 -1
  74. package/dist/scaffold.d.ts +16 -8
  75. package/dist/scaffold.js +7 -11
  76. package/dist/{static-host-3WMV7IZO.js → static-host-4JDQCHUW.js} +1 -1
  77. package/dist/{status-command-AL47VG7H.js → status-command-VARULAR5.js} +4 -4
  78. package/dist/{store-BLyNeQ8S.d.ts → store-9Psd0jiF.d.ts} +115 -102
  79. package/dist/{test-command-YAZLKLGQ.js → test-command-YCAR4O35.js} +7 -7
  80. package/dist/{upgrade-command-BN3EHAOI.js → upgrade-command-A75DOIUH.js} +15 -16
  81. package/dist/{workspace-2COHDBM3.js → workspace-33KHFLX3.js} +2 -2
  82. package/dist/{workspace-command-MNK7Y7MQ.js → workspace-command-YELP47SJ.js} +26 -28
  83. package/dist/{workspace-export-DURY5WYL.js → workspace-export-MLYTYZS5.js} +3 -3
  84. package/dist/{xdo-BjJj5W_E.d.ts → xdo-ODuJklk6.d.ts} +27 -23
  85. package/guides/authoring.md +11 -2
  86. package/guides/typed-frontend.md +23 -6
  87. package/llms/kinds-realtime.md +2 -2
  88. package/llms/statements-data.md +3 -2
  89. package/llms/tests.md +1 -1
  90. package/llms/triggers.md +2 -2
  91. package/llms/values.md +1 -1
  92. package/llms-full.txt +26 -26
  93. package/llms.txt +17 -18
  94. package/manifest.json +6 -2
  95. package/package.json +1 -1
  96. package/dist/chunk-ANUDXFEX.js +0 -881
  97. package/dist/chunk-JGCWTCA7.js +0 -95
  98. package/dist/chunk-YBC3IKMF.js +0 -845
  99. package/dist/codegen-command-FUT2KJB6.js +0 -49
  100. package/dist/init-command-NPVL32L6.js +0 -34
package/CHANGELOG.md CHANGED
@@ -11,6 +11,43 @@ listed here.
11
11
 
12
12
  ---
13
13
 
14
+ ## 0.0.12 — Values that answer themselves
15
+
16
+ _2026-09-01_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.12)
17
+
18
+ 0.0.12 fixes a silent wrong answer: `c.now()` inside an `obj()` served the string
19
+ `"now"` instead of a timestamp, and in a realtime handler that string was written
20
+ into the stored transcript and replayed to every joiner. It also lands the four
21
+ reports from #310 — `export` was rewriting `CLAUDE.md` with the wrong theme — and
22
+ a truthfulness pass over what ships to an agent: corrected claims, and ~480 KB of
23
+ maintainer-addressed JSDoc taken out of the consumer type surface.
24
+
25
+ - `c.now()` inside `obj()` answered the string `"now"`
26
+ - `export` rewrote `CLAUDE.md` with the wrong theme
27
+ - `bind` joins: the typed path across a join, stated
28
+ - `fields: null` on 65 statements means "typed wrapper", not "missing"
29
+ - `QUERY_EXPRESSION_FILTERS` / `VECTOR_FILTERS`: where they live, and that `fl.*` cannot spell them
30
+ - The shipped type surface stopped carrying maintainer residue
31
+ - Four documented claims corrected against the source
32
+
33
+ ---
34
+
35
+ ## 0.0.11 — The silent-success pass
36
+
37
+ _2026-08-31_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.11)
38
+
39
+ This release adds one new entry point and closes a set of shapes that compiled clean and then went wrong at request time — a regex pair that answered `false` for every input, a read addressed by query string instead of by path, a column name the engine reserves, and a `0` id that fails a whole request. Most land as warnings, so an ordinary build is unaffected; `export --strict` promotes them, so a strict build that passed on 0.0.10 can newly fail. It also corrects one piece of published advice: a physical table name is not stable across deploys, and the old atomic-counter guidance said to hardcode it.
40
+
41
+ - `@xanots/sdk/bundle` reads a compiled bundle without reimplementing the SDK
42
+ - ⚠️ A reversed regex operand pair is refused instead of answering `false` forever
43
+ - ⚠️ An addressing input missing from a query's path now warns
44
+ - ⚠️ A reserved `run` column and a `get_by_id` id that can be `0` now warn
45
+ - `obj()` accepts `c.obj` and `c.array` members
46
+ - `./manifest.json` is exported from the package
47
+ - Corrected: a physical table name is not stable across deploys
48
+
49
+ ---
50
+
14
51
  ## 0.0.10 — The CLI surface pass
15
52
 
16
53
  _2026-08-31_ · [release notes](https://github.com/xanots/sdk/releases/tag/v0.0.10)
package/README.md CHANGED
@@ -173,8 +173,10 @@ const HOST = (typeof window !== "undefined" && window.XANO_HOST) || import.meta.
173
173
 
174
174
  **Prefer to wire it by hand?** Skip `init` — `npm install @xanots/sdk`, write your workspace
175
175
  in `xano/index.ts`, and steps 1 and 4 are unchanged. The entry must be an ES module (XanoTS
176
- defs are ESM-only); on Node ≥ 22.6 a `.ts` entry loads natively, and older Node wants
177
- [`tsx`](https://tsx.is).
176
+ defs are ESM-only), and a TypeScript entry wants [`tsx`](https://tsx.is) installed
177
+ (`npm i -D tsx`) — the CLI picks it up automatically. Node's own type stripping is not
178
+ enough on its own: it loads a `.ts` file but does not remap the `./x.js` specifiers a
179
+ workspace uses to import its own modules, so anything past a single file fails to resolve.
178
180
 
179
181
  ---
180
182
 
@@ -228,8 +230,9 @@ export default workspace("blog")
228
230
  Tab-complete `s.` to discover the entire statement catalog — `s.db.*`, `s.math.*`,
229
231
  `s.array.*`, `s.text.*`, `s.storage.*`, `s.api.*`, `s.cloud.*`, control flow, AI agent runs,
230
232
  and more. **All 214 engine statement surfaces are authorable** — every field name matches
231
- the Xano engine, and the output is proven byte-for-byte against the engine's own golden
232
- fixtures.
233
+ the Xano engine, and the emitted shape is checked against bytes a real engine stored. Where
234
+ a surface has no stored instance behind it yet, it is built from the engine's own schema;
235
+ [Coverage](https://github.com/xanots/sdk/blob/main/guides/coverage.md) says which is which.
233
236
 
234
237
  Give a table a `seed` array and those rows ship into the database on deploy, so a fresh
235
238
  environment comes up with its lookup tables and fixtures already in place.
@@ -288,7 +291,7 @@ remember the environment's name; it is tracked with the project.
288
291
 
289
292
  Every flag, the `--prune` rules, the identity model, and headless CI runs are in
290
293
  [Signing in & deploying](https://github.com/xanots/sdk/blob/main/guides/deploying.md). Environment management is
291
- `xanots ephemeral <list|get|delete|export>`.
294
+ `xanots ephemeral <list|get|delete|export|impersonate>`.
292
295
 
293
296
  ### Testing
294
297
 
@@ -353,9 +356,11 @@ instead — plain data plus one interpolator, importing nothing:
353
356
  xanots routes ./xano/index.ts --emit xano/routes.gen.ts
354
357
  ```
355
358
 
356
- Route names and their `{param}` keys are still checked at compile time, so a backend rename
357
- is a compile error rather than a 404. The measured bundle numbers, the full response-inference
358
- rules, endpoint-name constraints, and the realtime helpers are in
359
+ Routes are keyed `"<VERB> <name>"` `routePath("GET blog/{slug}", { slug })` so
360
+ verb-differentiated siblings coexist, and the keys and their `{param}` names are checked at
361
+ compile time: a backend rename is a compile error rather than a 404. The measured bundle
362
+ numbers, the full response-inference rules, endpoint-name constraints, and the realtime
363
+ helpers are in
359
364
  [The typed frontend surface](https://github.com/xanots/sdk/blob/main/guides/typed-frontend.md).
360
365
 
361
366
  ---
@@ -441,7 +446,9 @@ for (const { raw, path, depth } of walk(bundle.payload.query[0].run)) {
441
446
  - **`subStacks(raw)`** → the nested stacks a statement carries, keyed by where they are
442
447
  stored and labelled by what they mean — a try/catch and a conditional share the same three
443
448
  storage keys. Found by shape, so a nesting form added later is still walked.
444
- - **`statementCatalog()`** → the stored `mvp:*` name to its authoring path (`s.db.query`).
449
+ - **`statementCatalog()`** → the stored `mvp:*` name to its authoring path, minus the
450
+ namespace (`mvp:dbo_view` → `db.query`, the `sPath` you write after `s.`) — which is
451
+ the point: the stored name is often not the one you'd guess.
445
452
  - **`structuralHash(raw)`** → a diff key for a statement and everything under it, with
446
453
  engine-filled operands excluded. Without that exclusion, adding one column to a table
447
454
  reports every statement that writes it as changed.
@@ -1 +1 @@
1
- 6e6a4444f6fc73ee75afa9e72fb57b1ac2592d33d6b9a99205023fcbaccf8ed8
1
+ 294848d031f8fcc6b5fef740b901bc334009baf326298dfa54c191bede5c3847
@@ -3,10 +3,10 @@ import {
3
3
  codingAgentDetected,
4
4
  isCI,
5
5
  refreshAgentFiles
6
- } from "./chunk-JGCWTCA7.js";
7
- import "./chunk-KA6G2L7U.js";
6
+ } from "./chunk-2VTJSI6X.js";
7
+ import "./chunk-VK26K7AY.js";
8
8
  import "./chunk-ZSYZTGJH.js";
9
- import "./chunk-Q77KNEUL.js";
9
+ import "./chunk-RQNMTDXD.js";
10
10
  import "./chunk-EZG76F7R.js";
11
11
  export {
12
12
  CI_ENV_VARS,
@@ -14,4 +14,4 @@ export {
14
14
  isCI,
15
15
  refreshAgentFiles
16
16
  };
17
- //# sourceMappingURL=agent-file-refresh-QNKN5RYD.js.map
17
+ //# sourceMappingURL=agent-file-refresh-GQWAAOBV.js.map
package/dist/bin.js CHANGED
@@ -1,28 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  maybeNotifyUpdate
4
- } from "./chunk-22TKBSDV.js";
4
+ } from "./chunk-2AY3PKF4.js";
5
5
  import {
6
6
  readVersion,
7
7
  run
8
- } from "./chunk-RCT7UX7B.js";
9
- import "./chunk-CTD5ZCV6.js";
10
- import "./chunk-XEOX6AM7.js";
8
+ } from "./chunk-RLI6XD4O.js";
9
+ import "./chunk-7WRJPKGK.js";
10
+ import "./chunk-3LQGF2WS.js";
11
11
  import {
12
12
  exitCodeOf,
13
13
  reportFailure
14
- } from "./chunk-F6CYJ7TN.js";
14
+ } from "./chunk-Z2ZIE5CO.js";
15
15
  import "./chunk-GNPVYOPB.js";
16
16
  import {
17
17
  clearProgress,
18
18
  error
19
19
  } from "./chunk-EZG76F7R.js";
20
- import "./chunk-OWGCOGKK.js";
21
- import "./chunk-DIA7CT7J.js";
22
- import "./chunk-QK7ZQJLP.js";
23
- import "./chunk-WHOJWOSV.js";
24
- import "./chunk-VAF6A3YD.js";
25
- import "./chunk-5XZ744TS.js";
20
+ import "./chunk-MEFMTICH.js";
21
+ import "./chunk-V5Y7D4LH.js";
22
+ import "./chunk-N74KDCBD.js";
23
+ import "./chunk-EETVJZAZ.js";
24
+ import "./chunk-XWFRNJMQ.js";
25
+ import "./chunk-2ZCUO2UG.js";
26
26
  import "./chunk-OHX6MIUZ.js";
27
27
 
28
28
  // src/emit/interrupt.ts
@@ -3,23 +3,23 @@ import {
3
3
  listBranches,
4
4
  requireBranch,
5
5
  setLiveBranch
6
- } from "./chunk-EQW3YT5U.js";
6
+ } from "./chunk-P6PVBQL6.js";
7
7
  import {
8
8
  confirm
9
- } from "./chunk-AIZKXUNP.js";
9
+ } from "./chunk-IMLYGQK6.js";
10
10
  import {
11
11
  isMachineOutput,
12
12
  writeJson
13
13
  } from "./chunk-NUQCEOKA.js";
14
14
  import {
15
15
  getAccessToken
16
- } from "./chunk-QKM4U5UK.js";
16
+ } from "./chunk-TJS2AF5Y.js";
17
17
  import "./chunk-FE5I6S6N.js";
18
- import "./chunk-3IGNIP6R.js";
18
+ import "./chunk-NDP7OUPS.js";
19
19
  import {
20
20
  UsageError,
21
21
  assertNoForce
22
- } from "./chunk-F6CYJ7TN.js";
22
+ } from "./chunk-Z2ZIE5CO.js";
23
23
  import "./chunk-GNPVYOPB.js";
24
24
  import {
25
25
  blank,
@@ -29,7 +29,7 @@ import {
29
29
  success,
30
30
  warn
31
31
  } from "./chunk-EZG76F7R.js";
32
- import "./chunk-DIA7CT7J.js";
32
+ import "./chunk-V5Y7D4LH.js";
33
33
 
34
34
  // src/emit/branch-commands.ts
35
35
  var VERBS = ["list", "set-live", "delete"];
@@ -133,4 +133,4 @@ Promote another branch first (\`xanots workspace branch set-live <other>\`), the
133
133
  export {
134
134
  runBranchCommand
135
135
  };
136
- //# sourceMappingURL=branch-commands-2BLOC2GR.js.map
136
+ //# sourceMappingURL=branch-commands-5KMPAAZV.js.map
package/dist/bundle.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StackItemXdo, g as FieldXdo } from './xdo-BjJj5W_E.js';
2
- export { b as ConditionalContext, c as ConditionalElifContext, E as ExprGroup, d as ExprNode, e as ExprOperand, f as ExprStatement, h as FilterXdo, I as InputXdo, M as MethodXdo, k as ResultItemXdo, l as StatementInputXdo, o as TaggedValue } from './xdo-BjJj5W_E.js';
1
+ import { S as StackItemXdo, g as FieldXdo } from './xdo-ODuJklk6.js';
2
+ export { b as ConditionalContext, c as ConditionalElifContext, E as ExprGroup, d as ExprNode, e as ExprOperand, f as ExprStatement, h as FilterXdo, I as InputXdo, M as MethodXdo, k as ResultItemXdo, l as StatementInputXdo, o as TaggedValue } from './xdo-ODuJklk6.js';
3
3
 
4
4
  /**
5
5
  * The statement catalog, keyed the way a bundle reader needs it.
package/dist/bundle.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  deepEqual,
7
7
  normalize
8
- } from "./chunk-3INK4Y4E.js";
8
+ } from "./chunk-AE3PDSDS.js";
9
9
  import {
10
10
  STATEMENT_SURFACES,
11
11
  sPathOf
12
- } from "./chunk-BC2C5GVI.js";
12
+ } from "./chunk-DCMANKMX.js";
13
13
  import {
14
14
  sha1Bytes
15
15
  } from "./chunk-OHX6MIUZ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fixtureDirForKind
3
- } from "./chunk-TCFIPDB3.js";
3
+ } from "./chunk-AVGDL6RB.js";
4
4
 
5
5
  // src/validate/capture.ts
6
6
  import { mkdirSync, writeFileSync } from "fs";
@@ -29,4 +29,4 @@ function safeName(name) {
29
29
  export {
30
30
  captureFixtures
31
31
  };
32
- //# sourceMappingURL=capture-4WVJY4DQ.js.map
32
+ //# sourceMappingURL=capture-YLUVAITI.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readVersion
3
- } from "./chunk-RCT7UX7B.js";
3
+ } from "./chunk-RLI6XD4O.js";
4
4
  import {
5
5
  atomicWrite
6
6
  } from "./chunk-GNPVYOPB.js";
@@ -170,4 +170,4 @@ export {
170
170
  upgradeCommand,
171
171
  maybeNotifyUpdate
172
172
  };
173
- //# sourceMappingURL=chunk-22TKBSDV.js.map
173
+ //# sourceMappingURL=chunk-2AY3PKF4.js.map
@@ -0,0 +1,192 @@
1
+ import {
2
+ AI_PRESETS,
3
+ CODEGEN_MARKER,
4
+ managedBlockVersion,
5
+ presetFilePath,
6
+ renderPreset,
7
+ upsertManagedBlock
8
+ } from "./chunk-VK26K7AY.js";
9
+ import {
10
+ DEFAULT_DARK_MODE,
11
+ allFrontendPresets,
12
+ allIconLibraries
13
+ } from "./chunk-RQNMTDXD.js";
14
+ import {
15
+ warn
16
+ } from "./chunk-EZG76F7R.js";
17
+
18
+ // src/emit/agent-file-refresh.ts
19
+ import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
20
+ import { basename, join as join2 } from "path";
21
+
22
+ // src/emit/project-detect.ts
23
+ import { existsSync, readFileSync } from "fs";
24
+ import { join } from "path";
25
+ function readJson(path) {
26
+ try {
27
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
28
+ return typeof parsed === "object" && parsed !== null ? parsed : void 0;
29
+ } catch {
30
+ return void 0;
31
+ }
32
+ }
33
+ function readText(path) {
34
+ try {
35
+ return readFileSync(path, "utf8");
36
+ } catch {
37
+ return void 0;
38
+ }
39
+ }
40
+ function installedPackages(projectDir) {
41
+ const pkg = readJson(join(projectDir, "package.json"));
42
+ const names = /* @__PURE__ */ new Set();
43
+ for (const block of ["dependencies", "devDependencies"]) {
44
+ const deps = pkg?.[block];
45
+ if (typeof deps === "object" && deps !== null) {
46
+ for (const name of Object.keys(deps)) names.add(name);
47
+ }
48
+ }
49
+ return names;
50
+ }
51
+ function detectFrontendPreset(projectDir) {
52
+ const installed = installedPackages(projectDir);
53
+ if (installed.size === 0) return void 0;
54
+ let best;
55
+ let bestScore = 0;
56
+ let tied = false;
57
+ for (const preset of allFrontendPresets()) {
58
+ const declared = Object.keys(preset.dependencies);
59
+ if (declared.length === 0) continue;
60
+ const score = declared.filter((name) => installed.has(name)).length / declared.length;
61
+ if (score > bestScore) {
62
+ best = preset;
63
+ bestScore = score;
64
+ tied = false;
65
+ } else if (score === bestScore && score > 0) {
66
+ tied = true;
67
+ }
68
+ }
69
+ return bestScore > 0 && !tied ? best : void 0;
70
+ }
71
+ function detectIconLibrary(projectDir) {
72
+ const installed = installedPackages(projectDir);
73
+ for (const library of allIconLibraries()) {
74
+ for (const binding of [library.react, library.svelte]) {
75
+ if (Object.keys(binding.dependency).some((name) => installed.has(name))) return library.id;
76
+ }
77
+ }
78
+ return void 0;
79
+ }
80
+ function detectThemeLabel(projectDir) {
81
+ const css = readText(join(projectDir, "frontend", "src", "index.css"));
82
+ const match = css?.match(/\/\*\s*Theme:\s*(.+?)\.\s*Rebrand here/);
83
+ const label = match?.[1]?.trim();
84
+ return label !== void 0 && label.length > 0 ? label : void 0;
85
+ }
86
+ function detectDarkMode(projectDir) {
87
+ if (existsSync(join(projectDir, "frontend", "src", "lib", "theme.ts"))) return "toggle";
88
+ const entries = [
89
+ join(projectDir, "frontend", "index.html"),
90
+ join(projectDir, "frontend", "src", "app.html")
91
+ ];
92
+ for (const entry of entries) {
93
+ const html = readText(entry);
94
+ if (html === void 0) continue;
95
+ return html.includes("prefers-color-scheme") ? "system" : "off";
96
+ }
97
+ return void 0;
98
+ }
99
+ function detectFrontendGuidance(projectDir) {
100
+ const preset = detectFrontendPreset(projectDir);
101
+ if (preset === void 0) return void 0;
102
+ const label = detectThemeLabel(projectDir);
103
+ return {
104
+ label: preset.label,
105
+ section: preset.agentGuidanceSection(detectIconLibrary(projectDir)),
106
+ ...label === void 0 ? {} : { theme: { theme: { label }, dark: detectDarkMode(projectDir) ?? DEFAULT_DARK_MODE } }
107
+ };
108
+ }
109
+
110
+ // src/emit/agent-file-refresh.ts
111
+ var AGENT_ENV_VARS = [
112
+ "CLAUDECODE",
113
+ "CLAUDE_CODE",
114
+ "CURSOR_TRACE_ID",
115
+ "CURSOR_AGENT",
116
+ "CODEX_SANDBOX",
117
+ "AIDER_MODEL",
118
+ "GITHUB_COPILOT_AGENT"
119
+ ];
120
+ function codingAgentDetected(env = process.env) {
121
+ return AGENT_ENV_VARS.some((name) => (env[name] ?? "") !== "");
122
+ }
123
+ var CI_ENV_VARS = [
124
+ "CI",
125
+ "GITHUB_ACTIONS",
126
+ "GITLAB_CI",
127
+ "BUILDKITE",
128
+ "TEAMCITY_VERSION"
129
+ ];
130
+ function isCI(env = process.env) {
131
+ return CI_ENV_VARS.some((name) => (env[name] ?? "") !== "");
132
+ }
133
+ function guidanceModeFor(projectDir) {
134
+ return existsSync2(join2(projectDir, CODEGEN_MARKER)) ? "generated" : "authored";
135
+ }
136
+ function appNameFor(projectDir) {
137
+ try {
138
+ const pkg = JSON.parse(readFileSync2(join2(projectDir, "package.json"), "utf8"));
139
+ if (typeof pkg.name === "string" && pkg.name.length > 0) return pkg.name;
140
+ } catch {
141
+ }
142
+ return basename(projectDir);
143
+ }
144
+ function refreshAgentFiles(opts) {
145
+ const env = opts.env ?? process.env;
146
+ if (opts.explicit !== true && (isCI(env) || !codingAgentDetected(env))) return [];
147
+ const mode = opts.mode ?? guidanceModeFor(opts.projectDir);
148
+ const appName = opts.appName ?? appNameFor(opts.projectDir);
149
+ const frontend = opts.frontend ?? detectFrontendGuidance(opts.projectDir);
150
+ const managed = [];
151
+ for (const preset of AI_PRESETS) {
152
+ const path = presetFilePath(preset);
153
+ const absolute = join2(opts.projectDir, path);
154
+ if (!existsSync2(absolute)) continue;
155
+ try {
156
+ const existing = readFileSync2(absolute, "utf8");
157
+ const version = managedBlockVersion(existing);
158
+ if (version === null) continue;
159
+ managed.push({ preset, path, existing, version });
160
+ } catch (err) {
161
+ warn(`could not read ${path}: ${err instanceof Error ? err.message : String(err)}`);
162
+ }
163
+ }
164
+ const selected = managed.map((m) => m.preset);
165
+ const refreshed = [];
166
+ for (const { preset, path, existing, version } of managed) {
167
+ const absolute = join2(opts.projectDir, path);
168
+ try {
169
+ if (version === opts.sdkVersion) continue;
170
+ const rendered = renderPreset(preset, appName, mode, {
171
+ selected,
172
+ version: opts.sdkVersion,
173
+ frontend
174
+ });
175
+ const updated = upsertManagedBlock(existing, rendered);
176
+ if (updated === existing) continue;
177
+ writeFileSync(absolute, updated);
178
+ refreshed.push(path);
179
+ } catch (err) {
180
+ warn(`could not refresh ${path}: ${err instanceof Error ? err.message : String(err)}`);
181
+ }
182
+ }
183
+ return refreshed;
184
+ }
185
+
186
+ export {
187
+ codingAgentDetected,
188
+ CI_ENV_VARS,
189
+ isCI,
190
+ refreshAgentFiles
191
+ };
192
+ //# sourceMappingURL=chunk-2VTJSI6X.js.map
@@ -244,4 +244,4 @@ export {
244
244
  rawResponse,
245
245
  rawResponseItems
246
246
  };
247
- //# sourceMappingURL=chunk-5XZ744TS.js.map
247
+ //# sourceMappingURL=chunk-2ZCUO2UG.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  parseLock,
6
6
  serializeLock
7
- } from "./chunk-VAF6A3YD.js";
7
+ } from "./chunk-XWFRNJMQ.js";
8
8
 
9
9
  // src/lock/io.ts
10
10
  import { readFileSync, existsSync } from "fs";
@@ -35,4 +35,4 @@ export {
35
35
  readLockFile,
36
36
  writeLockFile
37
37
  };
38
- //# sourceMappingURL=chunk-XEOX6AM7.js.map
38
+ //# sourceMappingURL=chunk-3LQGF2WS.js.map
@@ -2,7 +2,7 @@ import {
2
2
  describeTransportFailure,
3
3
  httpFailure,
4
4
  retryingFetch
5
- } from "./chunk-3IGNIP6R.js";
5
+ } from "./chunk-NDP7OUPS.js";
6
6
 
7
7
  // src/deploy/import.ts
8
8
  var IMPORT_TIMEOUT_MS = 12e4;
@@ -173,4 +173,4 @@ export {
173
173
  importWorkspaceArchive,
174
174
  planWorkspaceImport
175
175
  };
176
- //# sourceMappingURL=chunk-WP4OZZV4.js.map
176
+ //# sourceMappingURL=chunk-3VFCKHOB.js.map
@@ -20,4 +20,4 @@ export {
20
20
  defineFunction,
21
21
  fileUrl
22
22
  };
23
- //# sourceMappingURL=chunk-XHEXOES3.js.map
23
+ //# sourceMappingURL=chunk-5YDINUAP.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RAW_ENVELOPE
3
- } from "./chunk-5XZ744TS.js";
3
+ } from "./chunk-2ZCUO2UG.js";
4
4
 
5
5
  // src/statements/special/raw.ts
6
6
  var CANONICAL_KEYS = [
@@ -46,4 +46,4 @@ function raw(envelope) {
46
46
  export {
47
47
  raw
48
48
  };
49
- //# sourceMappingURL=chunk-LU7TRWMC.js.map
49
+ //# sourceMappingURL=chunk-6VNRMKFJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UsageError
3
- } from "./chunk-F6CYJ7TN.js";
3
+ } from "./chunk-Z2ZIE5CO.js";
4
4
 
5
5
  // src/emit/env-selector.ts
6
6
  var ENV_SPELLINGS = "workspace, ephemeral, or ephemeral:<name>";
@@ -25,4 +25,4 @@ export {
25
25
  parseEnvSelector,
26
26
  unknownEnv
27
27
  };
28
- //# sourceMappingURL=chunk-CTD5ZCV6.js.map
28
+ //# sourceMappingURL=chunk-7WRJPKGK.js.map
@@ -976,4 +976,4 @@ export {
976
976
  filledContext,
977
977
  normalize
978
978
  };
979
- //# sourceMappingURL=chunk-3INK4Y4E.js.map
979
+ //# sourceMappingURL=chunk-AE3PDSDS.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  deepEqual,
3
3
  normalize
4
- } from "./chunk-3INK4Y4E.js";
4
+ } from "./chunk-AE3PDSDS.js";
5
5
 
6
6
  // src/deploy/live-diff.ts
7
7
  function rows(bundle, key) {
@@ -254,4 +254,4 @@ export {
254
254
  sharedSchemaChanges,
255
255
  compareToLive
256
256
  };
257
- //# sourceMappingURL=chunk-DBFU47BJ.js.map
257
+ //# sourceMappingURL=chunk-AOFFKSJC.js.map
@@ -64,4 +64,4 @@ export {
64
64
  indexByIdentity,
65
65
  resolveMatch
66
66
  };
67
- //# sourceMappingURL=chunk-TCFIPDB3.js.map
67
+ //# sourceMappingURL=chunk-AVGDL6RB.js.map
@@ -36,24 +36,24 @@ import {
36
36
  reversedOperandRefusal,
37
37
  tableColumns,
38
38
  withFilters
39
- } from "./chunk-QK7ZQJLP.js";
39
+ } from "./chunk-N74KDCBD.js";
40
40
  import {
41
41
  assertPathParamInputs,
42
42
  fillPathParams,
43
43
  parsePathParams
44
- } from "./chunk-WHOJWOSV.js";
44
+ } from "./chunk-EETVJZAZ.js";
45
45
  import {
46
46
  deriveGuid,
47
47
  realtimeChannelSeedName,
48
48
  resolveQueryRef,
49
49
  resolveRef
50
- } from "./chunk-VAF6A3YD.js";
50
+ } from "./chunk-XWFRNJMQ.js";
51
51
  import {
52
52
  annotate,
53
53
  encodeStatement,
54
54
  isRegisteredStatement,
55
55
  registerStatement
56
- } from "./chunk-5XZ744TS.js";
56
+ } from "./chunk-2ZCUO2UG.js";
57
57
 
58
58
  // src/statements/set-var.ts
59
59
  var SET_VAR = "mvp:set_var";
@@ -3741,4 +3741,4 @@ export {
3741
3741
  workspaceKind,
3742
3742
  workspaceConfig
3743
3743
  };
3744
- //# sourceMappingURL=chunk-UOZMSF4C.js.map
3744
+ //# sourceMappingURL=chunk-BYQHCCYU.js.map
@@ -248,4 +248,4 @@ export {
248
248
  IMPLEMENTED_STATEMENTS,
249
249
  sPathOf
250
250
  };
251
- //# sourceMappingURL=chunk-BC2C5GVI.js.map
251
+ //# sourceMappingURL=chunk-DCMANKMX.js.map
@@ -109,4 +109,4 @@ export {
109
109
  unboundPathParams,
110
110
  fillPathParams
111
111
  };
112
- //# sourceMappingURL=chunk-WHOJWOSV.js.map
112
+ //# sourceMappingURL=chunk-EETVJZAZ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchOrExplain,
3
3
  httpFailure
4
- } from "./chunk-3IGNIP6R.js";
4
+ } from "./chunk-NDP7OUPS.js";
5
5
 
6
6
  // src/deploy/ephemeral.ts
7
7
  var TIMEOUT_MS = 3e4;
@@ -162,4 +162,4 @@ export {
162
162
  impersonateEphemeral,
163
163
  waitUntilReady
164
164
  };
165
- //# sourceMappingURL=chunk-VNQM3V2C.js.map
165
+ //# sourceMappingURL=chunk-EXENFOWE.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UsageError
3
- } from "./chunk-F6CYJ7TN.js";
3
+ } from "./chunk-Z2ZIE5CO.js";
4
4
  import {
5
5
  style
6
6
  } from "./chunk-EZG76F7R.js";
@@ -56,4 +56,4 @@ export {
56
56
  confirm,
57
57
  promptLine
58
58
  };
59
- //# sourceMappingURL=chunk-AIZKXUNP.js.map
59
+ //# sourceMappingURL=chunk-IMLYGQK6.js.map