primitive-admin 1.1.0-alpha.6 → 1.1.0-alpha.60

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 (387) hide show
  1. package/README.md +389 -71
  2. package/assets/skill/skills/primitive-platform/SKILL.md +670 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +287 -17
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +138 -19
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/analytics.js +554 -55
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps.d.ts +2 -0
  13. package/dist/src/commands/apps.js +27 -80
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.d.ts +2 -0
  16. package/dist/src/commands/auth.js +177 -7
  17. package/dist/src/commands/auth.js.map +1 -1
  18. package/dist/src/commands/blob-buckets.d.ts +2 -0
  19. package/dist/src/commands/blob-buckets.js +330 -0
  20. package/dist/src/commands/blob-buckets.js.map +1 -0
  21. package/dist/src/commands/catalog.d.ts +2 -0
  22. package/dist/src/commands/catalog.js +37 -38
  23. package/dist/src/commands/catalog.js.map +1 -1
  24. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  25. package/dist/src/commands/collection-type-configs.js +92 -0
  26. package/dist/src/commands/collection-type-configs.js.map +1 -0
  27. package/dist/src/commands/collections.d.ts +2 -0
  28. package/dist/src/commands/collections.js +526 -0
  29. package/dist/src/commands/collections.js.map +1 -0
  30. package/dist/src/commands/comparisons.d.ts +2 -0
  31. package/dist/src/commands/comparisons.js +6 -6
  32. package/dist/src/commands/comparisons.js.map +1 -1
  33. package/dist/src/commands/config.d.ts +35 -0
  34. package/dist/src/commands/config.js +437 -0
  35. package/dist/src/commands/config.js.map +1 -0
  36. package/dist/src/commands/connections.d.ts +2 -0
  37. package/dist/src/commands/connections.js +100 -0
  38. package/dist/src/commands/connections.js.map +1 -0
  39. package/dist/src/commands/cron-triggers.d.ts +2 -0
  40. package/dist/src/commands/cron-triggers.js +204 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-types.d.ts +2 -0
  43. package/dist/src/commands/database-types.js +171 -0
  44. package/dist/src/commands/database-types.js.map +1 -0
  45. package/dist/src/commands/databases.d.ts +65 -0
  46. package/dist/src/commands/databases.js +2153 -96
  47. package/dist/src/commands/databases.js.map +1 -1
  48. package/dist/src/commands/documents.d.ts +2 -0
  49. package/dist/src/commands/documents.js +1230 -19
  50. package/dist/src/commands/documents.js.map +1 -1
  51. package/dist/src/commands/email-templates.d.ts +2 -0
  52. package/dist/src/commands/email-templates.js +174 -0
  53. package/dist/src/commands/email-templates.js.map +1 -0
  54. package/dist/src/commands/env.d.ts +12 -0
  55. package/dist/src/commands/env.js +260 -0
  56. package/dist/src/commands/env.js.map +1 -0
  57. package/dist/src/commands/group-type-configs.d.ts +2 -0
  58. package/dist/src/commands/group-type-configs.js +86 -0
  59. package/dist/src/commands/group-type-configs.js.map +1 -0
  60. package/dist/src/commands/groups.d.ts +2 -0
  61. package/dist/src/commands/groups.js +38 -99
  62. package/dist/src/commands/groups.js.map +1 -1
  63. package/dist/src/commands/guides.d.ts +223 -0
  64. package/dist/src/commands/guides.js +617 -65
  65. package/dist/src/commands/guides.js.map +1 -1
  66. package/dist/src/commands/init.d.ts +17 -0
  67. package/dist/src/commands/init.js +964 -202
  68. package/dist/src/commands/init.js.map +1 -1
  69. package/dist/src/commands/integrations.d.ts +2 -0
  70. package/dist/src/commands/integrations.js +484 -205
  71. package/dist/src/commands/integrations.js.map +1 -1
  72. package/dist/src/commands/llm.d.ts +2 -0
  73. package/dist/src/commands/llm.js +13 -8
  74. package/dist/src/commands/llm.js.map +1 -1
  75. package/dist/src/commands/locks.d.ts +8 -0
  76. package/dist/src/commands/locks.js +160 -0
  77. package/dist/src/commands/locks.js.map +1 -0
  78. package/dist/src/commands/metadata.d.ts +2 -0
  79. package/dist/src/commands/metadata.js +406 -0
  80. package/dist/src/commands/metadata.js.map +1 -0
  81. package/dist/src/commands/prompts.d.ts +2 -0
  82. package/dist/src/commands/prompts.js +135 -355
  83. package/dist/src/commands/prompts.js.map +1 -1
  84. package/dist/src/commands/rule-sets.d.ts +3 -0
  85. package/dist/src/commands/rule-sets.js +271 -0
  86. package/dist/src/commands/rule-sets.js.map +1 -0
  87. package/dist/src/commands/scripts.d.ts +20 -0
  88. package/dist/src/commands/scripts.js +739 -0
  89. package/dist/src/commands/scripts.js.map +1 -0
  90. package/dist/src/commands/secrets.d.ts +2 -0
  91. package/dist/src/commands/secrets.js +108 -0
  92. package/dist/src/commands/secrets.js.map +1 -0
  93. package/dist/src/commands/sessions.d.ts +2 -0
  94. package/dist/src/commands/sessions.js +75 -0
  95. package/dist/src/commands/sessions.js.map +1 -0
  96. package/dist/src/commands/settings.d.ts +18 -0
  97. package/dist/src/commands/settings.js +54 -0
  98. package/dist/src/commands/settings.js.map +1 -0
  99. package/dist/src/commands/skill.d.ts +2 -0
  100. package/dist/src/commands/skill.js +29 -0
  101. package/dist/src/commands/skill.js.map +1 -0
  102. package/dist/src/commands/sync-app-settings.d.ts +125 -0
  103. package/dist/src/commands/sync-app-settings.js +380 -0
  104. package/dist/src/commands/sync-app-settings.js.map +1 -0
  105. package/dist/src/commands/sync.d.ts +958 -0
  106. package/dist/src/commands/sync.js +8954 -812
  107. package/dist/src/commands/sync.js.map +1 -1
  108. package/dist/src/commands/tokens.d.ts +2 -0
  109. package/dist/src/commands/tokens.js +130 -21
  110. package/dist/src/commands/tokens.js.map +1 -1
  111. package/dist/src/commands/users.d.ts +2 -0
  112. package/dist/src/commands/users.js +440 -22
  113. package/dist/src/commands/users.js.map +1 -1
  114. package/dist/src/commands/vars.d.ts +8 -0
  115. package/dist/src/commands/vars.js +96 -0
  116. package/dist/src/commands/vars.js.map +1 -0
  117. package/dist/src/commands/waitlist.d.ts +2 -0
  118. package/dist/src/commands/waitlist.js +10 -10
  119. package/dist/src/commands/waitlist.js.map +1 -1
  120. package/dist/src/commands/webhooks.d.ts +2 -0
  121. package/dist/src/commands/webhooks.js +442 -0
  122. package/dist/src/commands/webhooks.js.map +1 -0
  123. package/dist/src/commands/workflows.d.ts +94 -0
  124. package/dist/src/commands/workflows.js +1581 -448
  125. package/dist/src/commands/workflows.js.map +1 -1
  126. package/dist/src/lib/api-client.d.ts +1814 -0
  127. package/dist/src/lib/api-client.js +1655 -103
  128. package/dist/src/lib/api-client.js.map +1 -1
  129. package/dist/src/lib/app-settings-descriptor.d.ts +130 -0
  130. package/dist/src/lib/app-settings-descriptor.js +262 -0
  131. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  132. package/dist/src/lib/auth-flow.d.ts +8 -0
  133. package/dist/src/lib/batch.d.ts +26 -0
  134. package/dist/src/lib/batch.js +32 -0
  135. package/dist/src/lib/batch.js.map +1 -0
  136. package/dist/src/lib/block-layout.d.ts +160 -0
  137. package/dist/src/lib/block-layout.js +451 -0
  138. package/dist/src/lib/block-layout.js.map +1 -0
  139. package/dist/src/lib/canonical-json.d.ts +12 -0
  140. package/dist/src/lib/canonical-json.js +35 -0
  141. package/dist/src/lib/canonical-json.js.map +1 -0
  142. package/dist/src/lib/channel.d.ts +30 -0
  143. package/dist/src/lib/channel.js +68 -0
  144. package/dist/src/lib/channel.js.map +1 -0
  145. package/dist/src/lib/cli-manifest.d.ts +68 -0
  146. package/dist/src/lib/cli-manifest.js +71 -0
  147. package/dist/src/lib/cli-manifest.js.map +1 -0
  148. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +97 -0
  149. package/dist/src/lib/codegen-shared/generatedFiles.js +184 -0
  150. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  151. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  152. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  153. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  154. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  155. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  156. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  157. package/dist/src/lib/config-object-descriptor.d.ts +108 -0
  158. package/dist/src/lib/config-object-descriptor.js +607 -0
  159. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  160. package/dist/src/lib/config-payload.d.ts +85 -0
  161. package/dist/src/lib/config-payload.js +105 -0
  162. package/dist/src/lib/config-payload.js.map +1 -0
  163. package/dist/src/lib/config-surface.d.ts +93 -0
  164. package/dist/src/lib/config-surface.js +178 -0
  165. package/dist/src/lib/config-surface.js.map +1 -0
  166. package/dist/src/lib/config-toml.d.ts +10 -0
  167. package/dist/src/lib/config-toml.js +42 -0
  168. package/dist/src/lib/config-toml.js.map +1 -0
  169. package/dist/src/lib/config.d.ts +53 -0
  170. package/dist/src/lib/config.js +92 -53
  171. package/dist/src/lib/config.js.map +1 -1
  172. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  173. package/dist/src/lib/confirm-prompt.js +110 -0
  174. package/dist/src/lib/confirm-prompt.js.map +1 -0
  175. package/dist/src/lib/constants.d.ts +11 -0
  176. package/dist/src/lib/constants.js +12 -0
  177. package/dist/src/lib/constants.js.map +1 -0
  178. package/dist/src/lib/crash-handlers.d.ts +20 -0
  179. package/dist/src/lib/crash-handlers.js +49 -0
  180. package/dist/src/lib/crash-handlers.js.map +1 -0
  181. package/dist/src/lib/credentials-store.d.ts +89 -0
  182. package/dist/src/lib/credentials-store.js +330 -0
  183. package/dist/src/lib/credentials-store.js.map +1 -0
  184. package/dist/src/lib/csv.d.ts +47 -0
  185. package/dist/src/lib/csv.js +172 -0
  186. package/dist/src/lib/csv.js.map +1 -0
  187. package/dist/src/lib/data-input.d.ts +23 -0
  188. package/dist/src/lib/data-input.js +50 -0
  189. package/dist/src/lib/data-input.js.map +1 -0
  190. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  191. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  192. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  193. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  194. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  195. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  196. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  197. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  198. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  199. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  200. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  201. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  202. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  203. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  204. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  205. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  206. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  207. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  208. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  209. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  210. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  211. package/dist/src/lib/env-resolver.d.ts +62 -0
  212. package/dist/src/lib/env-resolver.js +121 -0
  213. package/dist/src/lib/env-resolver.js.map +1 -0
  214. package/dist/src/lib/fetch.d.ts +5 -0
  215. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  216. package/dist/src/lib/generated-allowlist.js +266 -0
  217. package/dist/src/lib/generated-allowlist.js.map +1 -0
  218. package/dist/src/lib/generated-config-surfaces.d.ts +578 -0
  219. package/dist/src/lib/generated-config-surfaces.js +3630 -0
  220. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  221. package/dist/src/lib/generated-template-lint.d.ts +206 -0
  222. package/dist/src/lib/generated-template-lint.js +589 -0
  223. package/dist/src/lib/generated-template-lint.js.map +1 -0
  224. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  225. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  226. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  227. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  228. package/dist/src/lib/google-client-secret-status.js +56 -0
  229. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  230. package/dist/src/lib/init-config.d.ts +81 -0
  231. package/dist/src/lib/init-config.js +149 -0
  232. package/dist/src/lib/init-config.js.map +1 -0
  233. package/dist/src/lib/log-inspection.d.ts +568 -0
  234. package/dist/src/lib/log-inspection.js +639 -0
  235. package/dist/src/lib/log-inspection.js.map +1 -0
  236. package/dist/src/lib/migration-nag.d.ts +49 -0
  237. package/dist/src/lib/migration-nag.js +163 -0
  238. package/dist/src/lib/migration-nag.js.map +1 -0
  239. package/dist/src/lib/output.d.ts +109 -0
  240. package/dist/src/lib/output.js +191 -8
  241. package/dist/src/lib/output.js.map +1 -1
  242. package/dist/src/lib/package-manager.d.ts +140 -0
  243. package/dist/src/lib/package-manager.js +305 -0
  244. package/dist/src/lib/package-manager.js.map +1 -0
  245. package/dist/src/lib/paginate.d.ts +83 -0
  246. package/dist/src/lib/paginate.js +95 -0
  247. package/dist/src/lib/paginate.js.map +1 -0
  248. package/dist/src/lib/platform-owned.d.ts +51 -0
  249. package/dist/src/lib/platform-owned.js +64 -0
  250. package/dist/src/lib/platform-owned.js.map +1 -0
  251. package/dist/src/lib/project-config.d.ts +97 -0
  252. package/dist/src/lib/project-config.js +219 -0
  253. package/dist/src/lib/project-config.js.map +1 -0
  254. package/dist/src/lib/query-operators.d.ts +43 -0
  255. package/dist/src/lib/query-operators.js +80 -0
  256. package/dist/src/lib/query-operators.js.map +1 -0
  257. package/dist/src/lib/record-filter.d.ts +18 -0
  258. package/dist/src/lib/record-filter.js +55 -0
  259. package/dist/src/lib/record-filter.js.map +1 -0
  260. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  261. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  262. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  263. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  264. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  265. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  266. package/dist/src/lib/resolve-init-server.d.ts +71 -0
  267. package/dist/src/lib/resolve-init-server.js +94 -0
  268. package/dist/src/lib/resolve-init-server.js.map +1 -0
  269. package/dist/src/lib/resolve-platform.d.ts +45 -0
  270. package/dist/src/lib/resolve-platform.js +43 -0
  271. package/dist/src/lib/resolve-platform.js.map +1 -0
  272. package/dist/src/lib/run-status.d.ts +19 -0
  273. package/dist/src/lib/run-status.generated.d.ts +39 -0
  274. package/dist/src/lib/run-status.generated.js +66 -0
  275. package/dist/src/lib/run-status.generated.js.map +1 -0
  276. package/dist/src/lib/run-status.js +19 -0
  277. package/dist/src/lib/run-status.js.map +1 -0
  278. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  279. package/dist/src/lib/signing-secret-status.js +116 -0
  280. package/dist/src/lib/signing-secret-status.js.map +1 -0
  281. package/dist/src/lib/skill-installer.d.ts +25 -0
  282. package/dist/src/lib/skill-installer.js +266 -0
  283. package/dist/src/lib/skill-installer.js.map +1 -0
  284. package/dist/src/lib/snapshots.d.ts +99 -0
  285. package/dist/src/lib/snapshots.js +357 -0
  286. package/dist/src/lib/snapshots.js.map +1 -0
  287. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
  288. package/dist/src/lib/swift-codegen/dbGenerator.js +682 -0
  289. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  290. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  291. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  292. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  293. package/dist/src/lib/swift-codegen/generator.d.ts +85 -0
  294. package/dist/src/lib/swift-codegen/generator.js +266 -0
  295. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  296. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  297. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  298. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  299. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
  300. package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
  301. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  302. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  303. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  304. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  305. package/dist/src/lib/sync-paths.d.ts +72 -0
  306. package/dist/src/lib/sync-paths.js +130 -0
  307. package/dist/src/lib/sync-paths.js.map +1 -0
  308. package/dist/src/lib/sync-resource-types.d.ts +445 -0
  309. package/dist/src/lib/sync-resource-types.js +812 -0
  310. package/dist/src/lib/sync-resource-types.js.map +1 -0
  311. package/dist/src/lib/sync-selectors.d.ts +95 -0
  312. package/dist/src/lib/sync-selectors.js +228 -0
  313. package/dist/src/lib/sync-selectors.js.map +1 -0
  314. package/dist/src/lib/template.d.ts +121 -0
  315. package/dist/src/lib/template.js +447 -67
  316. package/dist/src/lib/template.js.map +1 -1
  317. package/dist/src/lib/token-inject.d.ts +56 -0
  318. package/dist/src/lib/token-inject.js +204 -0
  319. package/dist/src/lib/token-inject.js.map +1 -0
  320. package/dist/src/lib/toml-database-config.d.ts +123 -0
  321. package/dist/src/lib/toml-database-config.js +527 -0
  322. package/dist/src/lib/toml-database-config.js.map +1 -0
  323. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  324. package/dist/src/lib/toml-metadata-config.js +476 -0
  325. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  326. package/dist/src/lib/toml-native-form.d.ts +46 -0
  327. package/dist/src/lib/toml-native-form.js +78 -0
  328. package/dist/src/lib/toml-native-form.js.map +1 -0
  329. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  330. package/dist/src/lib/toml-params-validator.js +298 -0
  331. package/dist/src/lib/toml-params-validator.js.map +1 -0
  332. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  333. package/dist/src/lib/toml-scalar-edit.js +283 -0
  334. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  335. package/dist/src/lib/user-selector.d.ts +24 -0
  336. package/dist/src/lib/user-selector.js +33 -0
  337. package/dist/src/lib/user-selector.js.map +1 -0
  338. package/dist/src/lib/version-check.d.ts +35 -0
  339. package/dist/src/lib/version-check.js +241 -0
  340. package/dist/src/lib/version-check.js.map +1 -0
  341. package/dist/src/lib/watch.d.ts +121 -0
  342. package/dist/src/lib/watch.js +169 -0
  343. package/dist/src/lib/watch.js.map +1 -0
  344. package/dist/src/lib/workflow-apply.d.ts +51 -0
  345. package/dist/src/lib/workflow-apply.js +89 -0
  346. package/dist/src/lib/workflow-apply.js.map +1 -0
  347. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  348. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  349. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  350. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  351. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  352. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  353. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
  354. package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
  355. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  356. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  357. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  358. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  359. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  360. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  361. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  362. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  363. package/dist/src/lib/workflow-config-apply.js +137 -0
  364. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  365. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  366. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  367. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  368. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  369. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  370. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  371. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  372. package/dist/src/lib/workflow-fragments.js +342 -0
  373. package/dist/src/lib/workflow-fragments.js.map +1 -0
  374. package/dist/src/lib/workflow-include-preserve.d.ts +71 -0
  375. package/dist/src/lib/workflow-include-preserve.js +153 -0
  376. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  377. package/dist/src/lib/workflow-payload.d.ts +86 -0
  378. package/dist/src/lib/workflow-payload.js +168 -0
  379. package/dist/src/lib/workflow-payload.js.map +1 -0
  380. package/dist/src/lib/workflow-toml-validator.d.ts +199 -0
  381. package/dist/src/lib/workflow-toml-validator.js +754 -0
  382. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  383. package/dist/src/types/index.d.ts +533 -0
  384. package/dist/src/validators.d.ts +65 -0
  385. package/dist/src/validators.js +64 -0
  386. package/dist/src/validators.js.map +1 -0
  387. package/package.json +32 -6
@@ -0,0 +1,262 @@
1
+ /**
2
+ * Shared field descriptor for app-settings TOML sync (issue #1033).
3
+ *
4
+ * A single source of truth describing every app setting that round-trips
5
+ * through `app.toml`. It drives BOTH directions:
6
+ * - pull (`serializeAppSettingsToToml`): server settings -> `app.toml` object
7
+ * - push (`parseTomlToAppSettings`): `app.toml` object -> settings payload
8
+ *
9
+ * Driving serializer and parser from one table means the two can never drift
10
+ * apart, and a single drift test can assert the descriptor stays in step with
11
+ * the server's `GET /settings` response and `PUT /settings` allow-list. This
12
+ * generalizes the earlier hand-maintained `AUTH_BOOLEAN_KEYS` /
13
+ * `RECOGNIZED_AUTH_KEYS` pattern to every section, and fully replaces it.
14
+ *
15
+ * Design decisions of record (issue #1033):
16
+ * - `googleClientSecret` is an ordinary `[auth]` key (#2256). It holds a whole
17
+ * `{{secrets.KEY}}` reference rather than the secret itself, so it round-trips
18
+ * through `app.toml` like any other string setting. It used to be excluded
19
+ * from TOML entirely, back when the stored value WAS the credential.
20
+ * - `[cors]` is always emitted (the `mode` key is `emit: "always"`), even in
21
+ * universal mode. A one-time diff on the next pull for existing apps is
22
+ * acceptable.
23
+ * - `[invitations]` is an additive table for the member-invitation fields.
24
+ * - Legacy `passkeyRpId` / `passkeyRpName` are still writable server-side but
25
+ * excluded from TOML (superseded by `passkeyRpConfig` -> `[auth.passkeys]`).
26
+ * The coverage test classifies them as deprecated-writable exclusions, NOT
27
+ * computed/read-only.
28
+ * - Push type mismatches are field-named validation errors — no silent
29
+ * coercion of a mistyped TOML value.
30
+ */
31
+ import { findUnknownDocumentKeys, requireConfigSurface, } from "./config-surface.js";
32
+ /**
33
+ * The vendored `app-settings` definition (#2644) this module projects. Read
34
+ * once at load; a missing definition fails loudly rather than yielding an
35
+ * empty descriptor that would silently sync nothing.
36
+ */
37
+ const APP_SETTINGS_SURFACE = requireConfigSurface("app-settings");
38
+ /**
39
+ * Every field that round-trips through `app.toml` — DERIVED from the
40
+ * `app-settings` configuration-object definition (#2644), not listed.
41
+ *
42
+ * The definition already states each field's section (its table's TOML path),
43
+ * its `app.toml` key, its type and its `emit` rule, and the coverage guard
44
+ * holds it against the `App` model. Restating those 26 entries here made
45
+ * adding a setting two edits that a parity test then compared — the "two lists
46
+ * and a test they agree" shape the design gate rejected (2026-08-12). One edit
47
+ * in the definition now reaches the server allow-list
48
+ * (`settings-fields.ts`), this descriptor, and both directions of the sync.
49
+ *
50
+ * `json` in the definition is this module's `object` — the same shape under the
51
+ * name each side has always used for it.
52
+ */
53
+ export const APP_SETTINGS_DESCRIPTOR = APP_SETTINGS_SURFACE.tables.flatMap((table) => table.fields.map((field) => ({
54
+ field: field.field,
55
+ section: table.tomlPath[0],
56
+ key: field.tomlKey,
57
+ type: (field.type === "json" ? "object" : field.type),
58
+ emit: field.emit,
59
+ })));
60
+ /**
61
+ * Section render order for a stable, diff-friendly `app.toml` — the
62
+ * definition's table order (#2644), so a new section is rendered by being
63
+ * declared there.
64
+ */
65
+ export const APP_SETTINGS_SECTIONS = APP_SETTINGS_SURFACE.tables.map((table) => table.tomlPath[0]);
66
+ /**
67
+ * `GET /settings` keys that are computed/read-only and never sync (no server
68
+ * setter). The external coverage drift test classifies these here.
69
+ */
70
+ export const IGNORED_GET_KEYS = new Set([
71
+ "appId",
72
+ "hasGoogleAuth",
73
+ // Deprecated presence flag for `googleClientSecret`, kept always-present on
74
+ // GET for one release (#2256 / #2193 decision of record). It is derived from
75
+ // `googleClientSecret` and has no server setter, so it never syncs — same
76
+ // classification as `hasGoogleAuth`. Remove this entry when the alias goes.
77
+ "googleClientSecretSet",
78
+ // How the server reads the stored `googleClientSecret` — `unset`,
79
+ // `reference`, `legacy-literal` for a row written before reference-only
80
+ // (#2256), or `malformed-reference` for a stored value carrying reference
81
+ // syntax that resolves to nothing (#2332). Derived and read-only: it exists
82
+ // so an operator can be told to remediate a value the server refuses to send
83
+ // back.
84
+ "googleClientSecretStatus",
85
+ "hasAppleAuth",
86
+ "hasPasskey",
87
+ "createdAt",
88
+ "modifiedAt",
89
+ ]);
90
+ /**
91
+ * Fields that ARE still writable server-side (present in the `PUT /settings`
92
+ * allow-list) but are deliberately excluded from TOML because a newer field
93
+ * supersedes them. Kept distinct from `IGNORED_GET_KEYS` so the coverage test's
94
+ * "every allow-listed field is covered" claim stays true — these are excluded,
95
+ * not read-only. (Codex design-review concern #1.)
96
+ */
97
+ export const DEPRECATED_WRITABLE_EXCLUDED = new Set(
98
+ // Derived (#2644): `deprecated` is exactly "still writable, superseded by
99
+ // another field", which is what this set has always meant.
100
+ APP_SETTINGS_SURFACE.tables.flatMap((table) => Object.entries(table.notExposed)
101
+ .filter(([, classification]) => classification.kind === "deprecated")
102
+ .map(([field]) => field)));
103
+ const DESCRIPTOR_BY_SECTION = (() => {
104
+ const m = new Map();
105
+ for (const d of APP_SETTINGS_DESCRIPTOR) {
106
+ const list = m.get(d.section) ?? [];
107
+ list.push(d);
108
+ m.set(d.section, list);
109
+ }
110
+ return m;
111
+ })();
112
+ /** Descriptor `field` names, for parity/coverage tests. */
113
+ export const DESCRIPTOR_FIELDS = new Set(APP_SETTINGS_DESCRIPTOR.map((d) => d.field));
114
+ function typeOfValue(value) {
115
+ if (value === null || value === undefined)
116
+ return "null";
117
+ if (typeof value === "boolean")
118
+ return "boolean";
119
+ if (typeof value === "number")
120
+ return "number";
121
+ if (typeof value === "string")
122
+ return "string";
123
+ if (Array.isArray(value))
124
+ return "string[]";
125
+ if (typeof value === "object")
126
+ return "object";
127
+ return "unknown";
128
+ }
129
+ /** True if a value should be omitted under `emit: "whenSet"`. */
130
+ function isEmptyForEmit(value, type) {
131
+ if (value === null || value === undefined)
132
+ return true;
133
+ if (type === "string")
134
+ return value === "";
135
+ if (type === "string[]")
136
+ return !Array.isArray(value) || value.length === 0;
137
+ if (type === "object")
138
+ return (typeof value !== "object" ||
139
+ value === null ||
140
+ Object.keys(value).length === 0);
141
+ return false; // booleans (false) and numbers (0) are meaningful, never empty
142
+ }
143
+ /**
144
+ * Validate a push value against its descriptor type. Returns an error string
145
+ * (field-named) on mismatch, or `null` when the value is acceptable. Arrays are
146
+ * checked element-by-element so a `["a", 1]` mistype is caught.
147
+ */
148
+ function typeError(descriptor, value) {
149
+ const actual = typeOfValue(value);
150
+ if (actual === "null")
151
+ return null; // null clears; server owns clear semantics
152
+ if (descriptor.type === "string[]") {
153
+ if (!Array.isArray(value) || !value.every((v) => typeof v === "string")) {
154
+ return `[${descriptor.section}].${descriptor.key} must be an array of strings (got ${actual})`;
155
+ }
156
+ return null;
157
+ }
158
+ if (descriptor.type === "object") {
159
+ if (actual !== "object") {
160
+ return `[${descriptor.section}].${descriptor.key} must be a table (got ${actual})`;
161
+ }
162
+ return null;
163
+ }
164
+ if (actual !== descriptor.type) {
165
+ return `[${descriptor.section}].${descriptor.key} must be a ${descriptor.type} (got ${actual})`;
166
+ }
167
+ return null;
168
+ }
169
+ /**
170
+ * Build one `app.toml` section object from server settings (pull direction).
171
+ * Applies each field's `emit` rule; a `null` value is always omitted (TOML
172
+ * cannot encode null).
173
+ */
174
+ export function serializeSection(settings, section) {
175
+ const out = {};
176
+ for (const d of DESCRIPTOR_BY_SECTION.get(section) ?? []) {
177
+ const value = settings[d.field];
178
+ if (value === null || value === undefined)
179
+ continue;
180
+ if (d.emit === "whenSet" && isEmptyForEmit(value, d.type))
181
+ continue;
182
+ out[d.key] = value;
183
+ }
184
+ return out;
185
+ }
186
+ /**
187
+ * Build the full `app.toml` data object (all sections) from server settings.
188
+ * Empty sections are omitted, though in practice every section has at least one
189
+ * `emit: "always"` key so all four are present.
190
+ */
191
+ export function serializeAppSettingsToToml(settings) {
192
+ const data = {};
193
+ for (const section of APP_SETTINGS_SECTIONS) {
194
+ const obj = serializeSection(settings, section);
195
+ if (Object.keys(obj).length > 0)
196
+ data[section] = obj;
197
+ }
198
+ return data;
199
+ }
200
+ /**
201
+ * Translate a parsed `app.toml` object into a `PUT /settings` payload (push
202
+ * direction). Only keys present in the TOML are forwarded — an omitted key
203
+ * never overwrites server state. An unrecognized key or table and a type
204
+ * mismatch are both hard errors the caller must treat as abort-before-PUT
205
+ * (#2644 criterion 6: push rejects what it does not recognize, for every
206
+ * configuration surface, so a typo fails locally instead of being ignored).
207
+ *
208
+ * A `googleClientSecret` that is not a whole `{{secrets.KEY}}` reference is the
209
+ * server's rejection to make (#2256): the push forwards it and the `PUT` answers
210
+ * 400 with `GOOGLE_CLIENT_SECRET_MUST_BE_SECRET_REF`. Duplicating the shape rule
211
+ * here would put two definitions of "valid reference" in play.
212
+ *
213
+ * `isCrossAppPush` strips `name` so a cross-app push never overwrites the
214
+ * target app's name.
215
+ */
216
+ export function parseTomlToAppSettings(tomlData, options = {}) {
217
+ const settings = {};
218
+ const warnings = [];
219
+ const errors = [];
220
+ // #2644 criterion 6 — a top-level table the definition does not declare is a
221
+ // hard error, the same posture every per-entity file has. Silently ignoring
222
+ // it made a typo'd header (`[curs]`) push as though the section it meant were
223
+ // absent, so the settings it carried were never applied.
224
+ for (const key of findUnknownDocumentKeys(tomlData, APP_SETTINGS_SURFACE)) {
225
+ errors.push(`app.toml: unrecognized top-level table [${key}]. Check the spelling ` +
226
+ `against the tables app.toml accepts (${APP_SETTINGS_SECTIONS.map((s) => `[${s}]`).join(", ")}), or upgrade the CLI if the server is newer than this one.`);
227
+ }
228
+ for (const section of APP_SETTINGS_SECTIONS) {
229
+ const sectionData = tomlData?.[section];
230
+ if (sectionData === undefined || sectionData === null)
231
+ continue;
232
+ if (typeof sectionData !== "object" || Array.isArray(sectionData)) {
233
+ errors.push(`[${section}] must be a table`);
234
+ continue;
235
+ }
236
+ const descriptors = DESCRIPTOR_BY_SECTION.get(section) ?? [];
237
+ const byKey = new Map(descriptors.map((d) => [d.key, d]));
238
+ for (const key of Object.keys(sectionData)) {
239
+ const d = byKey.get(key);
240
+ if (!d) {
241
+ // #2644 criterion 6 — REJECTED, not warned-and-ignored. `app.toml` is a
242
+ // registered configuration surface like every other file, and an
243
+ // ignored key is a setting the author believes they changed.
244
+ errors.push(`app.toml: unrecognized key [${section}].${key}. Remove it or ` +
245
+ `upgrade the CLI if the server is newer than this one. ` +
246
+ `Recognized keys: ${descriptors.map((x) => x.key).join(", ")}.`);
247
+ continue;
248
+ }
249
+ if (options.isCrossAppPush && d.field === "name")
250
+ continue;
251
+ const value = sectionData[key];
252
+ const err = typeError(d, value);
253
+ if (err) {
254
+ errors.push(err);
255
+ continue;
256
+ }
257
+ settings[d.field] = value;
258
+ }
259
+ }
260
+ return { settings, warnings, errors };
261
+ }
262
+ //# sourceMappingURL=app-settings-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-settings-descriptor.js","sourceRoot":"","sources":["../../../src/lib/app-settings-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;AA8BlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAClC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC5C,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,KAAK;IAClB,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAsB;IAC/C,GAAG,EAAE,KAAK,CAAC,OAAO;IAClB,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAmB;IACvE,IAAI,EAAE,KAAK,CAAC,IAAI;CACjB,CAAC,CAAC,CACJ,CAAC;AAEJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAsB,CAClD,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MA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CAAC;YACD,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Credentials } from "../types/index.js";
2
+ interface AuthResult {
3
+ success: boolean;
4
+ credentials?: Credentials;
5
+ error?: string;
6
+ }
7
+ export declare function browserLogin(serverUrl: string): Promise<AuthResult>;
8
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared helpers for the CLI's batch-import commands
3
+ * (`databases import` and `databases import-csv`).
4
+ */
5
+ /** Split an array into fixed-size chunks. */
6
+ export declare function chunk<T>(items: T[], size: number): T[][];
7
+ export interface ParseBatchSizeOptions {
8
+ /** Largest batch size the caller will accept. */
9
+ max: number;
10
+ /** Message shown when the value exceeds `max`. */
11
+ overMaxMessage: string;
12
+ }
13
+ /**
14
+ * Parse and validate a `--batch-size` flag value.
15
+ *
16
+ * Returns the parsed integer on success, or a human-readable error message
17
+ * on failure (non-integer, `< 1`, or over the caller's ceiling). Callers
18
+ * decide how to surface the error — typically `error(msg); process.exit(1)`.
19
+ * Validating up front means a bad `--batch-size` fails before any write, so
20
+ * there are no partial imports.
21
+ */
22
+ export declare function parseBatchSize(raw: string, opts: ParseBatchSizeOptions): {
23
+ value: number;
24
+ } | {
25
+ error: string;
26
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Shared helpers for the CLI's batch-import commands
3
+ * (`databases import` and `databases import-csv`).
4
+ */
5
+ /** Split an array into fixed-size chunks. */
6
+ export function chunk(items, size) {
7
+ const out = [];
8
+ for (let i = 0; i < items.length; i += size) {
9
+ out.push(items.slice(i, i + size));
10
+ }
11
+ return out;
12
+ }
13
+ /**
14
+ * Parse and validate a `--batch-size` flag value.
15
+ *
16
+ * Returns the parsed integer on success, or a human-readable error message
17
+ * on failure (non-integer, `< 1`, or over the caller's ceiling). Callers
18
+ * decide how to surface the error — typically `error(msg); process.exit(1)`.
19
+ * Validating up front means a bad `--batch-size` fails before any write, so
20
+ * there are no partial imports.
21
+ */
22
+ export function parseBatchSize(raw, opts) {
23
+ const n = Number(raw);
24
+ if (!Number.isInteger(n) || n < 1) {
25
+ return { error: "--batch-size must be a positive integer." };
26
+ }
27
+ if (n > opts.max) {
28
+ return { error: opts.overMaxMessage };
29
+ }
30
+ return { value: n };
31
+ }
32
+ //# sourceMappingURL=batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.js","sourceRoot":"","sources":["../../../src/lib/batch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6CAA6C;AAC7C,MAAM,UAAU,KAAK,CAAI,KAAU,EAAE,IAAY;IAC/C,MAAM,GAAG,GAAU,EAAE,CAAC;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5C,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AASD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAW,EACX,IAA2B;IAE3B,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,KAAK,EAAE,0CAA0C,EAAE,CAAC;IAC/D,CAAC;IACD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjB,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;IACxC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Sync v2 "unified block" layout — issue #1183, Phase 3.
3
+ *
4
+ * The current (legacy) sync layout stores each managed block type in its own
5
+ * flat directory:
6
+ *
7
+ * config/
8
+ * prompts/<key>.toml
9
+ * integrations/<key>.toml
10
+ * workflows/<key>.toml
11
+ * transforms/<name>.rhai # scripts
12
+ *
13
+ * The v2 layout introduced by the unified block model groups every block type
14
+ * under one `blocks/` tree keyed by type and block key, with a single
15
+ * `block.toml` envelope per block (and a sibling `source.rhai` for scripts):
16
+ *
17
+ * config/
18
+ * blocks/
19
+ * prompts/<key>/block.toml
20
+ * integrations/<key>/block.toml
21
+ * workflows/<key>/block.toml
22
+ * scripts/<key>/block.toml
23
+ * scripts/<key>/source.rhai
24
+ *
25
+ * Per the proposal (docs/proposals/unified-block-model.md, "Phase 3: Sync v2"),
26
+ * the CLI must:
27
+ * - Read both legacy and v2 layouts.
28
+ * - Preserve the legacy layout as the default until v2 is proven.
29
+ * - Provide a migration command to convert legacy sync directories.
30
+ *
31
+ * This module is the pure, side-effect-light core of that work: the v2 path
32
+ * builders, the `block.toml` codec, layout detection, and the legacy -> v2
33
+ * migration. It stores the *verbatim* legacy TOML body under
34
+ * `[[versions]].spec`, so the transform is loss-free and a v2 block round-trips
35
+ * back to a byte-for-byte-equivalent legacy object (see `reconstructLegacyBlock`).
36
+ * That is what lets a later pass read a v2 directory through the same push path
37
+ * the legacy layout uses without re-deriving every type's field mapping.
38
+ */
39
+ export type BlockType = "prompt" | "integration" | "workflow" | "script";
40
+ export declare const BLOCK_TYPES: BlockType[];
41
+ /** The `schemaVersion` string written at the top of every v2 `block.toml`. */
42
+ export declare const BLOCK_SCHEMA_VERSION = "block/v1";
43
+ /** The filename of the script body written next to a v2 script `block.toml`. */
44
+ export declare const SCRIPT_SOURCE_FILENAME = "source.rhai";
45
+ export declare function isBlockType(value: unknown): value is BlockType;
46
+ /** `<configDir>/blocks` — the root of the v2 tree. */
47
+ export declare function v2BlocksRoot(configDir: string): string;
48
+ /** `<configDir>/blocks/<typeDir>/<key>` — a single v2 block's directory. */
49
+ export declare function v2BlockDir(configDir: string, type: BlockType, key: string): string;
50
+ /** `<configDir>/blocks/<typeDir>/<key>/block.toml`. */
51
+ export declare function v2BlockTomlPath(configDir: string, type: BlockType, key: string): string;
52
+ /** `<configDir>/blocks/scripts/<key>/source.rhai`. */
53
+ export declare function v2ScriptSourcePath(configDir: string, key: string): string;
54
+ /** `<configDir>/<legacyDir>` for a block type (flat layout). */
55
+ export declare function legacyBlockDir(configDir: string, type: BlockType): string;
56
+ export interface BlockVersionToml {
57
+ key: string;
58
+ status?: string;
59
+ contentHash?: string;
60
+ /** Verbatim type-native spec body (the legacy TOML object for this block). */
61
+ spec: Record<string, unknown>;
62
+ }
63
+ export interface BlockHeaderToml {
64
+ type: BlockType;
65
+ key: string;
66
+ displayName?: string;
67
+ description?: string;
68
+ status?: string;
69
+ activeVersion?: string;
70
+ }
71
+ export interface BlockToml {
72
+ schemaVersion: string;
73
+ block: BlockHeaderToml;
74
+ versions: BlockVersionToml[];
75
+ }
76
+ /**
77
+ * Serialize a v2 block into `block.toml` text. Key order is fixed
78
+ * (`schemaVersion`, `[block]`, `[[versions]]`) so a pull/migrate followed by a
79
+ * re-serialize is stable and produces no spurious diffs.
80
+ */
81
+ export declare function serializeBlockToml(block: BlockToml): string;
82
+ /**
83
+ * Parse `block.toml` text into a `BlockToml`. Throws with a clear message when
84
+ * the envelope is malformed (missing/invalid `[block].type`, no versions).
85
+ */
86
+ export declare function parseBlockToml(text: string): BlockToml;
87
+ /** `sha256:<hex>` content identity over the canonical JSON of a spec object. */
88
+ export declare function specContentHash(spec: unknown): string;
89
+ /**
90
+ * Wrap a parsed legacy block object into a v2 `BlockToml`. The full legacy
91
+ * object is stored verbatim as the single version's `spec`, so the transform
92
+ * loses nothing. The `[block]` header is a projection derived from the legacy
93
+ * header table for the unified vocabulary; the spec remains the source of truth
94
+ * for reconstructing the legacy file.
95
+ */
96
+ export declare function legacyObjectToBlock(type: Exclude<BlockType, "script">, legacy: Record<string, unknown>, fallbackKey: string): BlockToml;
97
+ /** Wrap a raw Rhai script body into a v2 script `BlockToml`. */
98
+ export declare function scriptSourceToBlock(key: string, source: string): BlockToml;
99
+ export interface ReconstructedLegacy {
100
+ /** For prompt/integration/workflow: the legacy `.toml` text. */
101
+ toml?: string;
102
+ /** For scripts: the raw `.rhai` body. */
103
+ rhai?: string;
104
+ }
105
+ /**
106
+ * Reverse `legacyObjectToBlock` / `scriptSourceToBlock`: rebuild the legacy
107
+ * on-disk content from a v2 block. This is the read half of dual-layout
108
+ * support — a v2 directory can be projected back to the exact legacy object a
109
+ * legacy consumer (e.g. the push path) expects. `sourceText` is required for
110
+ * scripts (the body lives in `source.rhai`, not the `block.toml`).
111
+ */
112
+ export declare function reconstructLegacyBlock(block: BlockToml, sourceText?: string): ReconstructedLegacy;
113
+ /**
114
+ * Report which layouts a config directory currently holds. A directory can
115
+ * hold both during/after a migration (legacy preserved, v2 written).
116
+ */
117
+ export declare function detectLayout(configDir: string): {
118
+ legacy: boolean;
119
+ v2: boolean;
120
+ };
121
+ export interface V2BlockRef {
122
+ type: BlockType;
123
+ key: string;
124
+ tomlPath: string;
125
+ sourcePath?: string;
126
+ }
127
+ /** Enumerate every v2 block present under `<configDir>/blocks/`. */
128
+ export declare function listV2Blocks(configDir: string): V2BlockRef[];
129
+ export interface MigratedBlock {
130
+ type: BlockType;
131
+ key: string;
132
+ tomlPath: string;
133
+ sourcePath?: string;
134
+ /** Number of test-case files copied into the v2 block's `tests/` dir. */
135
+ testsCopied: number;
136
+ }
137
+ export interface SkippedBlock {
138
+ type: BlockType;
139
+ key: string;
140
+ reason: string;
141
+ }
142
+ export interface MigrationResult {
143
+ blocks: MigratedBlock[];
144
+ skipped: SkippedBlock[];
145
+ dryRun: boolean;
146
+ }
147
+ export interface MigrateOptions {
148
+ /** Report what would happen without writing anything. */
149
+ dryRun?: boolean;
150
+ /** Overwrite an existing v2 `block.toml` instead of skipping it. */
151
+ force?: boolean;
152
+ }
153
+ /**
154
+ * Convert a legacy sync directory into the v2 `blocks/<type>/<key>/block.toml`
155
+ * layout. Non-destructive: the legacy files are left in place (the legacy
156
+ * layout stays the default until v2 is proven). Test-case directories
157
+ * (`<key>.tests/`) are copied verbatim into `blocks/<type>/<key>/tests/` so a
158
+ * tested block migrates without losing its cases.
159
+ */
160
+ export declare function migrateLegacyToV2(configDir: string, options?: MigrateOptions): MigrationResult;