primitive-admin 1.1.0-alpha.7 → 1.1.0-alpha.71

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 (438) hide show
  1. package/README.md +404 -80
  2. package/assets/skill/skills/primitive-platform/SKILL.md +808 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +294 -21
  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 +544 -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 +51 -96
  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 +565 -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 +46 -0
  34. package/dist/src/commands/config.js +479 -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 +265 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-type-configs.d.ts +2 -0
  43. package/dist/src/commands/database-type-configs.js +171 -0
  44. package/dist/src/commands/database-type-configs.js.map +1 -0
  45. package/dist/src/commands/database-types.d.ts +2 -0
  46. package/dist/src/commands/database-types.js +471 -0
  47. package/dist/src/commands/database-types.js.map +1 -0
  48. package/dist/src/commands/databases.d.ts +65 -0
  49. package/dist/src/commands/databases.js +2140 -112
  50. package/dist/src/commands/databases.js.map +1 -1
  51. package/dist/src/commands/documents.d.ts +2 -0
  52. package/dist/src/commands/documents.js +1357 -19
  53. package/dist/src/commands/documents.js.map +1 -1
  54. package/dist/src/commands/email-templates.d.ts +2 -0
  55. package/dist/src/commands/email-templates.js +174 -0
  56. package/dist/src/commands/email-templates.js.map +1 -0
  57. package/dist/src/commands/env.d.ts +23 -0
  58. package/dist/src/commands/env.js +333 -0
  59. package/dist/src/commands/env.js.map +1 -0
  60. package/dist/src/commands/feature-flags.d.ts +14 -0
  61. package/dist/src/commands/feature-flags.js +116 -0
  62. package/dist/src/commands/feature-flags.js.map +1 -0
  63. package/dist/src/commands/group-type-configs.d.ts +2 -0
  64. package/dist/src/commands/group-type-configs.js +86 -0
  65. package/dist/src/commands/group-type-configs.js.map +1 -0
  66. package/dist/src/commands/groups.d.ts +2 -0
  67. package/dist/src/commands/groups.js +38 -99
  68. package/dist/src/commands/groups.js.map +1 -1
  69. package/dist/src/commands/guides.d.ts +223 -0
  70. package/dist/src/commands/guides.js +617 -65
  71. package/dist/src/commands/guides.js.map +1 -1
  72. package/dist/src/commands/init.d.ts +25 -0
  73. package/dist/src/commands/init.js +1605 -208
  74. package/dist/src/commands/init.js.map +1 -1
  75. package/dist/src/commands/integrations.d.ts +2 -0
  76. package/dist/src/commands/integrations.js +380 -178
  77. package/dist/src/commands/integrations.js.map +1 -1
  78. package/dist/src/commands/llm.d.ts +2 -0
  79. package/dist/src/commands/llm.js +4 -2
  80. package/dist/src/commands/llm.js.map +1 -1
  81. package/dist/src/commands/locks.d.ts +8 -0
  82. package/dist/src/commands/locks.js +160 -0
  83. package/dist/src/commands/locks.js.map +1 -0
  84. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  85. package/dist/src/commands/metadata-category-configs.js +112 -0
  86. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  87. package/dist/src/commands/metadata.d.ts +2 -0
  88. package/dist/src/commands/metadata.js +281 -0
  89. package/dist/src/commands/metadata.js.map +1 -0
  90. package/dist/src/commands/prompts.d.ts +2 -0
  91. package/dist/src/commands/prompts.js +225 -584
  92. package/dist/src/commands/prompts.js.map +1 -1
  93. package/dist/src/commands/rule-sets.d.ts +3 -0
  94. package/dist/src/commands/rule-sets.js +272 -0
  95. package/dist/src/commands/rule-sets.js.map +1 -0
  96. package/dist/src/commands/scripts.d.ts +20 -0
  97. package/dist/src/commands/scripts.js +554 -0
  98. package/dist/src/commands/scripts.js.map +1 -0
  99. package/dist/src/commands/secrets.d.ts +2 -0
  100. package/dist/src/commands/secrets.js +108 -0
  101. package/dist/src/commands/secrets.js.map +1 -0
  102. package/dist/src/commands/sessions.d.ts +2 -0
  103. package/dist/src/commands/sessions.js +75 -0
  104. package/dist/src/commands/sessions.js.map +1 -0
  105. package/dist/src/commands/skill.d.ts +2 -0
  106. package/dist/src/commands/skill.js +29 -0
  107. package/dist/src/commands/skill.js.map +1 -0
  108. package/dist/src/commands/sync-app-settings.d.ts +158 -0
  109. package/dist/src/commands/sync-app-settings.js +330 -0
  110. package/dist/src/commands/sync-app-settings.js.map +1 -0
  111. package/dist/src/commands/sync.d.ts +2323 -0
  112. package/dist/src/commands/sync.js +15065 -843
  113. package/dist/src/commands/sync.js.map +1 -1
  114. package/dist/src/commands/tokens.d.ts +2 -0
  115. package/dist/src/commands/tokens.js +130 -21
  116. package/dist/src/commands/tokens.js.map +1 -1
  117. package/dist/src/commands/users.d.ts +2 -0
  118. package/dist/src/commands/users.js +532 -23
  119. package/dist/src/commands/users.js.map +1 -1
  120. package/dist/src/commands/vars.d.ts +8 -0
  121. package/dist/src/commands/vars.js +96 -0
  122. package/dist/src/commands/vars.js.map +1 -0
  123. package/dist/src/commands/waitlist.d.ts +2 -0
  124. package/dist/src/commands/waitlist.js +10 -10
  125. package/dist/src/commands/waitlist.js.map +1 -1
  126. package/dist/src/commands/webhooks.d.ts +2 -0
  127. package/dist/src/commands/webhooks.js +562 -0
  128. package/dist/src/commands/webhooks.js.map +1 -0
  129. package/dist/src/commands/workflows.d.ts +116 -0
  130. package/dist/src/commands/workflows.js +1583 -681
  131. package/dist/src/commands/workflows.js.map +1 -1
  132. package/dist/src/lib/access-rule-display.d.ts +21 -0
  133. package/dist/src/lib/access-rule-display.js +34 -0
  134. package/dist/src/lib/access-rule-display.js.map +1 -0
  135. package/dist/src/lib/api-client.d.ts +1936 -0
  136. package/dist/src/lib/api-client.js +1826 -138
  137. package/dist/src/lib/api-client.js.map +1 -1
  138. package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
  139. package/dist/src/lib/app-settings-descriptor.js +575 -0
  140. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  141. package/dist/src/lib/auth-flow.d.ts +8 -0
  142. package/dist/src/lib/batch.d.ts +26 -0
  143. package/dist/src/lib/batch.js +32 -0
  144. package/dist/src/lib/batch.js.map +1 -0
  145. package/dist/src/lib/block-layout.d.ts +160 -0
  146. package/dist/src/lib/block-layout.js +451 -0
  147. package/dist/src/lib/block-layout.js.map +1 -0
  148. package/dist/src/lib/canonical-json.d.ts +12 -0
  149. package/dist/src/lib/canonical-json.js +35 -0
  150. package/dist/src/lib/canonical-json.js.map +1 -0
  151. package/dist/src/lib/channel.d.ts +30 -0
  152. package/dist/src/lib/channel.js +68 -0
  153. package/dist/src/lib/channel.js.map +1 -0
  154. package/dist/src/lib/cli-manifest.d.ts +68 -0
  155. package/dist/src/lib/cli-manifest.js +71 -0
  156. package/dist/src/lib/cli-manifest.js.map +1 -0
  157. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
  158. package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
  159. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  160. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  161. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  162. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  163. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  164. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  165. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  166. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  167. package/dist/src/lib/config-object-descriptor.js +658 -0
  168. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  169. package/dist/src/lib/config-payload.d.ts +85 -0
  170. package/dist/src/lib/config-payload.js +116 -0
  171. package/dist/src/lib/config-payload.js.map +1 -0
  172. package/dist/src/lib/config-surface.d.ts +130 -0
  173. package/dist/src/lib/config-surface.js +300 -0
  174. package/dist/src/lib/config-surface.js.map +1 -0
  175. package/dist/src/lib/config-toml.d.ts +10 -0
  176. package/dist/src/lib/config-toml.js +42 -0
  177. package/dist/src/lib/config-toml.js.map +1 -0
  178. package/dist/src/lib/config.d.ts +53 -0
  179. package/dist/src/lib/config.js +92 -53
  180. package/dist/src/lib/config.js.map +1 -1
  181. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  182. package/dist/src/lib/confirm-prompt.js +110 -0
  183. package/dist/src/lib/confirm-prompt.js.map +1 -0
  184. package/dist/src/lib/constants.d.ts +11 -0
  185. package/dist/src/lib/constants.js +12 -0
  186. package/dist/src/lib/constants.js.map +1 -0
  187. package/dist/src/lib/crash-handlers.d.ts +20 -0
  188. package/dist/src/lib/crash-handlers.js +49 -0
  189. package/dist/src/lib/crash-handlers.js.map +1 -0
  190. package/dist/src/lib/credentials-store.d.ts +89 -0
  191. package/dist/src/lib/credentials-store.js +330 -0
  192. package/dist/src/lib/credentials-store.js.map +1 -0
  193. package/dist/src/lib/csv.d.ts +47 -0
  194. package/dist/src/lib/csv.js +172 -0
  195. package/dist/src/lib/csv.js.map +1 -0
  196. package/dist/src/lib/data-input.d.ts +23 -0
  197. package/dist/src/lib/data-input.js +50 -0
  198. package/dist/src/lib/data-input.js.map +1 -0
  199. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  200. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  201. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  202. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  203. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  204. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  205. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  206. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  207. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  208. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  209. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  210. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  211. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  212. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  213. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  214. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  215. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  216. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  217. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  218. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  219. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  220. package/dist/src/lib/env-resolver-core.d.ts +147 -0
  221. package/dist/src/lib/env-resolver-core.js +265 -0
  222. package/dist/src/lib/env-resolver-core.js.map +1 -0
  223. package/dist/src/lib/env-resolver.d.ts +84 -0
  224. package/dist/src/lib/env-resolver.js +133 -0
  225. package/dist/src/lib/env-resolver.js.map +1 -0
  226. package/dist/src/lib/fetch.d.ts +5 -0
  227. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  228. package/dist/src/lib/generated-allowlist.js +277 -0
  229. package/dist/src/lib/generated-allowlist.js.map +1 -0
  230. package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
  231. package/dist/src/lib/generated-config-surfaces.js +4058 -0
  232. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  233. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  234. package/dist/src/lib/generated-template-lint.js +624 -0
  235. package/dist/src/lib/generated-template-lint.js.map +1 -0
  236. package/dist/src/lib/init-adopt.d.ts +16 -0
  237. package/dist/src/lib/init-adopt.js +34 -0
  238. package/dist/src/lib/init-adopt.js.map +1 -0
  239. package/dist/src/lib/init-assets.d.ts +39 -0
  240. package/dist/src/lib/init-assets.js +97 -0
  241. package/dist/src/lib/init-assets.js.map +1 -0
  242. package/dist/src/lib/init-config.d.ts +98 -0
  243. package/dist/src/lib/init-config.js +186 -0
  244. package/dist/src/lib/init-config.js.map +1 -0
  245. package/dist/src/lib/init-ios-links.d.ts +50 -0
  246. package/dist/src/lib/init-ios-links.js +153 -0
  247. package/dist/src/lib/init-ios-links.js.map +1 -0
  248. package/dist/src/lib/init-plan.d.ts +80 -0
  249. package/dist/src/lib/init-plan.js +95 -0
  250. package/dist/src/lib/init-plan.js.map +1 -0
  251. package/dist/src/lib/init-production-env.d.ts +48 -0
  252. package/dist/src/lib/init-production-env.js +59 -0
  253. package/dist/src/lib/init-production-env.js.map +1 -0
  254. package/dist/src/lib/init-schema.d.ts +74 -0
  255. package/dist/src/lib/init-schema.js +358 -0
  256. package/dist/src/lib/init-schema.js.map +1 -0
  257. package/dist/src/lib/init-xcode.d.ts +33 -0
  258. package/dist/src/lib/init-xcode.js +114 -0
  259. package/dist/src/lib/init-xcode.js.map +1 -0
  260. package/dist/src/lib/integration-request-config.d.ts +30 -0
  261. package/dist/src/lib/integration-request-config.js +145 -0
  262. package/dist/src/lib/integration-request-config.js.map +1 -0
  263. package/dist/src/lib/local-state.d.ts +55 -0
  264. package/dist/src/lib/local-state.js +167 -0
  265. package/dist/src/lib/local-state.js.map +1 -0
  266. package/dist/src/lib/log-inspection.d.ts +568 -0
  267. package/dist/src/lib/log-inspection.js +639 -0
  268. package/dist/src/lib/log-inspection.js.map +1 -0
  269. package/dist/src/lib/migration-nag.d.ts +49 -0
  270. package/dist/src/lib/migration-nag.js +163 -0
  271. package/dist/src/lib/migration-nag.js.map +1 -0
  272. package/dist/src/lib/object-status-filter.d.ts +22 -0
  273. package/dist/src/lib/object-status-filter.js +45 -0
  274. package/dist/src/lib/object-status-filter.js.map +1 -0
  275. package/dist/src/lib/output.d.ts +109 -0
  276. package/dist/src/lib/output.js +191 -8
  277. package/dist/src/lib/output.js.map +1 -1
  278. package/dist/src/lib/package-manager.d.ts +140 -0
  279. package/dist/src/lib/package-manager.js +305 -0
  280. package/dist/src/lib/package-manager.js.map +1 -0
  281. package/dist/src/lib/paginate.d.ts +83 -0
  282. package/dist/src/lib/paginate.js +95 -0
  283. package/dist/src/lib/paginate.js.map +1 -0
  284. package/dist/src/lib/platform-owned.d.ts +63 -0
  285. package/dist/src/lib/platform-owned.js +85 -0
  286. package/dist/src/lib/platform-owned.js.map +1 -0
  287. package/dist/src/lib/project-config.d.ts +97 -0
  288. package/dist/src/lib/project-config.js +217 -0
  289. package/dist/src/lib/project-config.js.map +1 -0
  290. package/dist/src/lib/query-operators.d.ts +43 -0
  291. package/dist/src/lib/query-operators.js +80 -0
  292. package/dist/src/lib/query-operators.js.map +1 -0
  293. package/dist/src/lib/record-filter.d.ts +18 -0
  294. package/dist/src/lib/record-filter.js +55 -0
  295. package/dist/src/lib/record-filter.js.map +1 -0
  296. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  297. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  298. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  299. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  300. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  301. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  302. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  303. package/dist/src/lib/resolve-init-server.js +77 -0
  304. package/dist/src/lib/resolve-init-server.js.map +1 -0
  305. package/dist/src/lib/resolve-platform.d.ts +74 -0
  306. package/dist/src/lib/resolve-platform.js +105 -0
  307. package/dist/src/lib/resolve-platform.js.map +1 -0
  308. package/dist/src/lib/run-status.d.ts +19 -0
  309. package/dist/src/lib/run-status.generated.d.ts +39 -0
  310. package/dist/src/lib/run-status.generated.js +66 -0
  311. package/dist/src/lib/run-status.generated.js.map +1 -0
  312. package/dist/src/lib/run-status.js +19 -0
  313. package/dist/src/lib/run-status.js.map +1 -0
  314. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  315. package/dist/src/lib/server-text-normalization.js +90 -0
  316. package/dist/src/lib/server-text-normalization.js.map +1 -0
  317. package/dist/src/lib/server-url.d.ts +22 -0
  318. package/dist/src/lib/server-url.js +33 -0
  319. package/dist/src/lib/server-url.js.map +1 -0
  320. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  321. package/dist/src/lib/signing-secret-status.js +116 -0
  322. package/dist/src/lib/signing-secret-status.js.map +1 -0
  323. package/dist/src/lib/skill-installer.d.ts +25 -0
  324. package/dist/src/lib/skill-installer.js +266 -0
  325. package/dist/src/lib/skill-installer.js.map +1 -0
  326. package/dist/src/lib/snapshots.d.ts +99 -0
  327. package/dist/src/lib/snapshots.js +357 -0
  328. package/dist/src/lib/snapshots.js.map +1 -0
  329. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
  330. package/dist/src/lib/swift-codegen/dbGenerator.js +914 -0
  331. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  332. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  333. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  334. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  335. package/dist/src/lib/swift-codegen/generator.d.ts +94 -0
  336. package/dist/src/lib/swift-codegen/generator.js +440 -0
  337. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  338. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  339. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  340. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  341. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
  342. package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
  343. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  344. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  345. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  346. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  347. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  348. package/dist/src/lib/sync-dir-selector.js +30 -0
  349. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  350. package/dist/src/lib/sync-paths.d.ts +111 -0
  351. package/dist/src/lib/sync-paths.js +198 -0
  352. package/dist/src/lib/sync-paths.js.map +1 -0
  353. package/dist/src/lib/sync-resource-types.d.ts +544 -0
  354. package/dist/src/lib/sync-resource-types.js +975 -0
  355. package/dist/src/lib/sync-resource-types.js.map +1 -0
  356. package/dist/src/lib/sync-selectors.d.ts +95 -0
  357. package/dist/src/lib/sync-selectors.js +228 -0
  358. package/dist/src/lib/sync-selectors.js.map +1 -0
  359. package/dist/src/lib/template.d.ts +170 -0
  360. package/dist/src/lib/template.js +484 -68
  361. package/dist/src/lib/template.js.map +1 -1
  362. package/dist/src/lib/test-case-keys.d.ts +29 -0
  363. package/dist/src/lib/test-case-keys.js +55 -0
  364. package/dist/src/lib/test-case-keys.js.map +1 -0
  365. package/dist/src/lib/test-case-variables.d.ts +15 -0
  366. package/dist/src/lib/test-case-variables.js +29 -0
  367. package/dist/src/lib/test-case-variables.js.map +1 -0
  368. package/dist/src/lib/token-inject.d.ts +56 -0
  369. package/dist/src/lib/token-inject.js +204 -0
  370. package/dist/src/lib/token-inject.js.map +1 -0
  371. package/dist/src/lib/toml-database-config.d.ts +123 -0
  372. package/dist/src/lib/toml-database-config.js +527 -0
  373. package/dist/src/lib/toml-database-config.js.map +1 -0
  374. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  375. package/dist/src/lib/toml-metadata-config.js +476 -0
  376. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  377. package/dist/src/lib/toml-native-form.d.ts +46 -0
  378. package/dist/src/lib/toml-native-form.js +78 -0
  379. package/dist/src/lib/toml-native-form.js.map +1 -0
  380. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  381. package/dist/src/lib/toml-params-validator.js +298 -0
  382. package/dist/src/lib/toml-params-validator.js.map +1 -0
  383. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  384. package/dist/src/lib/toml-scalar-edit.js +283 -0
  385. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  386. package/dist/src/lib/user-selector.d.ts +24 -0
  387. package/dist/src/lib/user-selector.js +33 -0
  388. package/dist/src/lib/user-selector.js.map +1 -0
  389. package/dist/src/lib/version-check.d.ts +35 -0
  390. package/dist/src/lib/version-check.js +241 -0
  391. package/dist/src/lib/version-check.js.map +1 -0
  392. package/dist/src/lib/watch.d.ts +121 -0
  393. package/dist/src/lib/watch.js +169 -0
  394. package/dist/src/lib/watch.js.map +1 -0
  395. package/dist/src/lib/workflow-apply.d.ts +110 -0
  396. package/dist/src/lib/workflow-apply.js +164 -0
  397. package/dist/src/lib/workflow-apply.js.map +1 -0
  398. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  399. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  400. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  401. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  402. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  403. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  404. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
  405. package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
  406. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  407. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  408. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  409. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  410. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  411. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  412. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  413. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  414. package/dist/src/lib/workflow-config-apply.js +137 -0
  415. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  416. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  417. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  418. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  419. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  420. package/dist/src/lib/workflow-defaults.js +41 -0
  421. package/dist/src/lib/workflow-defaults.js.map +1 -0
  422. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  423. package/dist/src/lib/workflow-fragments.js +342 -0
  424. package/dist/src/lib/workflow-fragments.js.map +1 -0
  425. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  426. package/dist/src/lib/workflow-include-preserve.js +286 -0
  427. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  428. package/dist/src/lib/workflow-payload.d.ts +98 -0
  429. package/dist/src/lib/workflow-payload.js +178 -0
  430. package/dist/src/lib/workflow-payload.js.map +1 -0
  431. package/dist/src/lib/workflow-toml-validator.d.ts +202 -0
  432. package/dist/src/lib/workflow-toml-validator.js +757 -0
  433. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  434. package/dist/src/types/index.d.ts +581 -0
  435. package/dist/src/validators.d.ts +65 -0
  436. package/dist/src/validators.js +64 -0
  437. package/dist/src/validators.js.map +1 -0
  438. package/package.json +32 -8
@@ -0,0 +1,808 @@
1
+ ---
2
+ name: primitive-platform
3
+ description: >
4
+ Expert guide for building applications on the Primitive platform. MUST be used whenever the user
5
+ is writing code that uses js-bao, js-bao-wss-client, primitive-app components, or any Primitive
6
+ platform feature (documents, databases, workflows, prompts, integrations, blobs, authentication,
7
+ users/groups). Also trigger whenever about to run any `primitive` CLI command (e.g., primitive config, primitive integrations, primitive apps, primitive env) to ensure Step 0 CLI verification is performed first. After writing or modifying code that touches Primitive
8
+ APIs, this skill cross-references the implementation against official guides and automatically
9
+ corrects common mistakes. Use this skill even if the user doesn't explicitly ask for it —
10
+ any Primitive-related code should be validated against current best practices. Also use it
11
+ when something looks like a platform bug or missing platform capability, to decide whether
12
+ (and how) to file a platform issue. Also trigger whenever the user wants to upgrade or update
13
+ the app to a newer platform version — bumping js-bao, js-bao-wss-client, primitive-app, or the
14
+ primitive CLI — which follows the "Upgrading Platform Libraries" workflow below.
15
+ allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Agent
16
+ ---
17
+
18
+ # Primitive Platform Development Guide
19
+
20
+ You are an expert on the Primitive platform. Your job is to help developers write correct,
21
+ idiomatic Primitive code by leveraging the CLI's built-in guide system and enforcing best practices.
22
+
23
+ **The CLI guides are the single source of truth.** Never hardcode or memorize guide content —
24
+ always fetch the latest from the CLI.
25
+
26
+ ## Step 0: Verify CLI Configuration
27
+
28
+ The Primitive CLI is **project-scoped**, and project mode is **strongly preferred** for any work
29
+ inside a repo. Each project has a `.primitive/config.json` (committed to the repo) that defines
30
+ named environments (`dev`, `prod`, `staging`, …), where each environment binds an `apiUrl` and
31
+ (optionally) an `appId`. Per-environment auth tokens live in `.primitive/credentials.json`
32
+ (gitignored). There is no global "currently active app" — the active environment determines the
33
+ server *and* the app.
34
+
35
+ The legacy global fallback (`~/.primitive/credentials.json`) exists only for one-off use outside a
36
+ project. **Inside a project, treat its absence as a setup gap to fix, not a mode to operate in.**
37
+
38
+ **Before running any CLI commands**, your *first* check is whether the project is in project mode:
39
+
40
+ ```bash
41
+ ls .primitive/config.json # exists at project root or any ancestor?
42
+ ```
43
+
44
+ The two branches below are not equivalent — pick the one that matches reality and follow it.
45
+
46
+ ### Branch A — `.primitive/config.json` exists (project mode)
47
+
48
+ The active environment is resolved in this order:
49
+ 1. `--env <name>` flag on the command
50
+ 2. `PRIMITIVE_ENV` environment variable
51
+ 3. This machine's selection in `.primitive/local.json` (written by `primitive env use`, gitignored)
52
+ 4. `defaultEnvironment` in `.primitive/config.json` — the committed team default
53
+ 5. The sole environment, if exactly one is defined
54
+
55
+ `primitive env use <name>` does NOT edit the committed config: pointing this
56
+ machine at a different backend never shows up as a file change. `env list`
57
+ shows the resolved current environment and the committed team default
58
+ separately, and reports a corrupt or dangling selection rather than falling
59
+ back to the default.
60
+
61
+ Confirm you're targeting the correct environment:
62
+
63
+ 1. **Read the CLI header.** Every command prints `Env | App | Server` at the top of its output —
64
+ verify these match the project's intended target.
65
+ 2. **Inspect the project config:**
66
+
67
+ ```bash
68
+ primitive env list # All environments (CURRENT and TEAM DEFAULT shown separately)
69
+ primitive env show # Details for the currently-resolved env
70
+ primitive whoami # Authenticated user + resolved server/app
71
+ ```
72
+
73
+ **To switch environments** for a one-off command, pass `--env <name>`. To point this machine at
74
+ a different environment, run `primitive env use <name>` (local state; the committed
75
+ `defaultEnvironment` is unchanged). To switch the *app* an env points at, edit the env's
76
+ `appId` in `.primitive/config.json` (or re-run `primitive env add`). `primitive use <app>` is a
77
+ no-op when the active env already pins an `appId`.
78
+
79
+ ### Branch B — no `.primitive/config.json` (project mode NOT set up)
80
+
81
+ Without project config the CLI silently falls back to global state in `~/.primitive/credentials.json`
82
+ (legacy mode). Commands run against whatever app/server happens to be globally active — which the
83
+ agent didn't set and the user may have forgotten about. **This is a footgun, not a supported way to
84
+ work inside a project.** Do not proceed silently, and do not treat the global fallback as the
85
+ default path.
86
+
87
+ **Your default action is to set up project mode.** Stop and prompt the user to create the project
88
+ config before doing anything else. Don't bury the recommendation behind an equal-weight "or proceed
89
+ against global state" option — make setting up project config the clear, recommended next step.
90
+
91
+ First gather the context you'll propose (so the prompt is concrete, not abstract):
92
+
93
+ ```bash
94
+ primitive whoami # current global server + app, if any — shows what the fallback WOULD target
95
+ ```
96
+
97
+ Then prompt the user, e.g.:
98
+
99
+ > "This project has no `.primitive/config.json`, so the CLI isn't in project mode. I recommend
100
+ > setting up project-scoped config so this repo pins its own environment instead of relying on your
101
+ > global state (currently `<server>` / `<app from whoami>`, which I didn't set). I'll add an env
102
+ > with:
103
+ >
104
+ > ```bash
105
+ > primitive env add dev --api-url <url> --app-id <id>
106
+ > ```
107
+ >
108
+ > Does this look right, or should I adjust the env name / URL / app?"
109
+
110
+ If you need the user to pick the env name, server, or app, ask them. Confirm the values before
111
+ running `env add` — but the question to resolve is *which* project config to create, not *whether*
112
+ to create one.
113
+
114
+ `primitive env add` is additive and safe — it only writes an entry to `.primitive/config.json`
115
+ (creating the file if needed). It does not touch source code, create apps on the server, or install
116
+ dependencies.
117
+
118
+ **Only fall back to global state if the user explicitly declines project setup** after you've
119
+ recommended it. Even then, name the exact server/app the command will hit and get clear
120
+ confirmation before running anything mutating (`primitive config push`, `primitive apps create`, etc.).
121
+ A read-only command (`whoami`, `guides list`) against global state is fine while you're still
122
+ working out the config.
123
+
124
+ Do not rely on `.env` files like `PRIMITIVE_API_URL` to control CLI targeting — those are not
125
+ read by the CLI in project mode, and the project config is the source of truth.
126
+
127
+ **Why this matters:** If the CLI is pointed at the wrong environment (e.g., prod instead of dev),
128
+ commands like `primitive config push` will modify the wrong server. Silent fallback to global state
129
+ makes this exact mistake easy to commit. Setting up project config is the durable fix — verify and
130
+ surface before running mutating operations.
131
+
132
+ ## Step 1: Discover Available Guides
133
+
134
+ Before writing or reviewing any Primitive code, run:
135
+
136
+ ```bash
137
+ primitive guides list
138
+ ```
139
+
140
+ This returns the full list of available guide topics with descriptions, keywords, and use cases.
141
+ The `COMBINATIONS` column shows which `(language, platform)` variants each guide is available in
142
+ (e.g. `ts; swift`). Use this output to determine which guides are relevant to the current task —
143
+ and which language/platform variant to request in Step 2.
144
+
145
+ ### Determine the project's language and platform
146
+
147
+ Figure out what the project you're working in targets, then request the matching variant when
148
+ fetching guides:
149
+
150
+ - A `Package.swift`, `*.xcodeproj`, or `project.yml` → `--language swift` (plus `--platform ios`
151
+ or `--platform macos` as appropriate).
152
+ - A Vite/React/Node web app (`package.json`, `js-bao-wss-client`) → `--language ts --platform web`.
153
+
154
+ If you can't tell, omit the flags — every guide has a default variant, so a bare
155
+ `primitive guides get <topic>` always returns something useful.
156
+
157
+ ## Step 2: Fetch the Relevant Guides
158
+
159
+ For each relevant topic identified in Step 1, fetch the full guide, passing the project's
160
+ language/platform so you get the right variant:
161
+
162
+ ```bash
163
+ primitive guides get <topic> --language <ts|swift> --platform <web|ios|macos>
164
+ # or, when the project's language/platform is unknown or doesn't matter:
165
+ primitive guides get <topic>
166
+ ```
167
+
168
+ `--language` accepts aliases (`typescript`/`javascript`/`js` → `ts`). These flags **never fail**:
169
+ an unknown value or an unavailable combination falls back to the guide's default variant rather
170
+ than erroring, so it's always safe to pass your best guess.
171
+
172
+ **Always fetch guide(s) BEFORE writing code.** If multiple features are involved, fetch multiple
173
+ guides. The guides contain:
174
+ - Complete API documentation with method signatures
175
+ - Working code examples in the requested language (e.g. TypeScript or Swift)
176
+ - Common patterns and anti-patterns
177
+ - Configuration examples (TOML files for `primitive config`)
178
+ - Decision frameworks for architecture choices
179
+
180
+ **Do not guess or assume API patterns.** If you're unsure about a method signature, parameter,
181
+ or pattern, fetch the guide. The guides are comprehensive and authoritative.
182
+
183
+ ## Step 3: Write Code Following Guide Patterns
184
+
185
+ When writing Primitive code:
186
+
187
+ 1. **Follow the patterns from the fetched guides exactly** — method names, argument order, lifecycle patterns
188
+ 2. **Use `primitive config`** for all backend configuration (workflows, prompts, integrations, databases)
189
+ 3. **Configuration lives in TOML files** in version control, pushed via `primitive config push` — including test cases, authored as sidecars at `prompts/<key>.tests/`, `workflows/<key>.tests/`, `transforms/<name>.tests/` and `integrations/<key>.tests/` (one `[test]` file per case, with its attachments in a directory of the same name). A case file's name is its identity: `config pull` writes it back under that name and renaming it renames the case, so the checked-in tree reconciles on a fresh clone instead of duplicating
190
+ 4. **Run `pnpm codegen`** after creating or modifying js-bao models
191
+
192
+ ## Step 4: Post-Code Review (Automatic)
193
+
194
+ After writing or modifying Primitive-related code, **automatically perform this review**:
195
+
196
+ ### 4a. Identify What Was Written
197
+ Determine which Primitive features the new/modified code touches by scanning for:
198
+ - Import statements from `js-bao`, `js-bao-wss-client`, or `primitive-app`
199
+ - Primitive API calls (documents.open, databases.connect, workflows, etc.)
200
+ - Model definitions, schemas, queries
201
+ - Configuration files (TOML for sync)
202
+
203
+ ### 4b. Fetch and Cross-Reference
204
+ Run `primitive guides list` to identify which guides cover the features used, then fetch each one
205
+ in the project's language/platform:
206
+ ```bash
207
+ primitive guides get <topic> --language <ts|swift> --platform <web|ios|macos>
208
+ ```
209
+
210
+ Compare the written code against the guide content:
211
+ - **API usage patterns** — Are methods called correctly with proper arguments?
212
+ - **Lifecycle management** — Are documents opened before queries? Is auth checked first?
213
+ - **Access control** — Are CEL expressions or permissions configured properly?
214
+ - **Anti-patterns** — Does the code do anything the guide explicitly warns against?
215
+ - **Untyped workflow invocation** — Is `client.workflows.start`/`runSync` called with a string-literal `workflowKey` and a hand-typed/cast `input`/`output` (e.g. `result.output as {...}`) instead of a generated invoker? That's a finding whenever the workflow has an `inputSchema`/`outputSchema` to generate from — regenerate with `primitive workflows codegen` (`--lang swift` for iOS/macOS) and call through the factory it emits instead, per the workflows guide's "Typed invocation (codegen)" section.
216
+ - **Missing steps** — Does the code need `pnpm codegen`, `primitive workflows codegen`, `primitive config push`, or other follow-up?
217
+
218
+ ### 4c. Report and Fix
219
+ If issues are found:
220
+ 1. **Explain the issue** — cite the specific guide section that applies
221
+ 2. **Show the fix** — provide corrected code
222
+ 3. **Apply the fix** — edit the file directly (don't just suggest, actually fix it)
223
+ 4. **Note any CLI commands needed** — e.g., `pnpm codegen` or `primitive config push`
224
+
225
+ If no issues are found, briefly confirm the code follows best practices.
226
+
227
+ ## CLI Quick Reference
228
+
229
+ Remind users of these essential commands when relevant:
230
+
231
+ ```bash
232
+ # Verify current configuration (DO THIS FIRST)
233
+ primitive env list # List environments (CURRENT vs committed TEAM DEFAULT)
234
+ primitive env show # Details for the currently-resolved env (api URL, app ID)
235
+ primitive whoami # Authenticated user + resolved server/app
236
+
237
+ # Switching environments
238
+ primitive env use <name> # Select this machine's environment (gitignored local state)
239
+ primitive --env <name> <command> # One-off override for a single command
240
+ PRIMITIVE_ENV=<name> <command> # Override via env var (useful in scripts/CI)
241
+
242
+ # Setup — existing project (most common: adopting Primitive in an existing repo)
243
+ pnpm add -g primitive-admin # Install CLI (pnpm preferred; npm works too)
244
+ primitive env add dev --api-url <url> --app-id <id> # Add env to .primitive/config.json
245
+ primitive env add prod --api-url <url> --app-id <id> # (creates the file if missing)
246
+ primitive login # Authenticate (tokens stored per-env)
247
+
248
+ # Setup — brand-new project (greenfield only)
249
+ primitive init my-new-app # Scaffolds template, creates a new app
250
+ # on the server, runs pnpm install.
251
+ primitive init my-new-app --platform web,ios # One app, a web client AND a native
252
+ # client: web/ and ios/, with the project
253
+ # config, git repo and the shared
254
+ # models/models.toml at the root.
255
+
256
+ # Setup — adding a client to an app that already exists
257
+ primitive init ios --platform ios # Run INSIDE the app's repo: adds the
258
+ # client to the app the nearest ancestor
259
+ # .primitive/config.json targets. Writes
260
+ # no nested .primitive/ or .git/ and makes
261
+ # no commit — review with `git status`.
262
+ # Read the multi-client guide first.
263
+
264
+ # Guides (the most important commands for development)
265
+ primitive guides list # See all guides: topics, descriptions, available (lang,platform) combinations
266
+ primitive guides get <topic> # Read a guide's default variant
267
+ primitive guides get <topic> --language swift --platform ios # Read a specific language/platform variant
268
+
269
+ # Configuration as Code
270
+ primitive config init --dir ./config # Initialize config directory
271
+ primitive config pull --dir ./config # Pull config from server
272
+ primitive config push --dir ./config # Push config to server
273
+ primitive config diff --dir ./config # Preview changes before push
274
+
275
+ # Taking something out of service (or putting it back)
276
+ primitive workflows disable <key> # same verb pair on every type that has one
277
+ primitive cron-triggers disable <id>
278
+ primitive webhooks disable <id>
279
+ primitive integrations disable <key>
280
+ primitive prompts disable <key>
281
+ primitive users disable <user-id> # a person, not an object — reversible
282
+ primitive feature-flags disable <key> # super-admin platform toggle
283
+
284
+ # Retiring an object (soft delete; NOT the same as disable)
285
+ primitive workflows archive <key> # same verb on the five types that carry
286
+ primitive cron-triggers archive <id> # `archived`; confirms first, -y skips
287
+ primitive webhooks archive <id>
288
+ primitive integrations archive <id> # the ID column of `integrations list`
289
+ primitive prompts archive <id> # the ID column of `prompts list`
290
+
291
+ # Common operations
292
+ primitive apps list # List apps on the active env's server
293
+ primitive apps create "Name" # Create an app (does NOT auto-bind to an env;
294
+ # edit .primitive/config.json or use `env add` to bind)
295
+ ```
296
+
297
+ **Availability is not configuration.** Whether a workflow, cron trigger,
298
+ webhook, integration or prompt is in service is one server-owned `status`
299
+ field, changed only by `<noun> enable|disable` (or the matching console
300
+ action) and by the delete flow, whose CLI spelling is `<noun> archive` on those
301
+ same five types. It is not a TOML key: `config pull` does not emit it,
302
+ `config push` never sends it, and a file that still carries a `status` line
303
+ fails the push with a message naming the verbs. So a push cannot put something back in service
304
+ that an operator took out of it, and a fresh environment stood up from config
305
+ has everything active. Anything newly created or pushed is active; there is no
306
+ `draft` state on any object.
307
+
308
+ **`archive` retires, `--prune` destroys.** `<noun> archive <id>` writes the
309
+ third value, `archived`: the delete lifecycle rather than availability. The row
310
+ is kept so its history still resolves, it goes on holding its key — and, for
311
+ webhooks and cron triggers, its slot against the per-app cap — `enable` refuses
312
+ it, and there is no un-archive. Reclaiming the key means a hard delete: remove
313
+ the object's TOML file and run a confirmed `primitive config push --prune`, then
314
+ re-add the file and push. There is no `--hard` flag and no per-type `delete`
315
+ verb; prune-by-push is the CLI's only hard delete. `users` and `admins` carry
316
+ `enable`/`disable` but no `archive` — people are not configuration objects.
317
+
318
+ Per-VERSION status is a different thing and stays in TOML: a prompt, workflow
319
+ or script config retires a named version with `status = "archived"` inside its
320
+ `[[configs]]` entry, which says which version is live, not whether the object
321
+ is serving.
322
+
323
+ ## Debugging and inspection
324
+
325
+ The CLI is the reference surface for inspecting a running app — reading what
326
+ happened without opening the admin UI. The inspection commands share one set of
327
+ conventions so they behave predictably across resources.
328
+
329
+ ```bash
330
+ # Workflow runs (the reference tailing command)
331
+ primitive workflows runs list <workflow-id> # recent runs
332
+ primitive workflows runs list <workflow-id> --json # normalized inspection items
333
+ primitive workflows runs list <workflow-id> --watch # re-render the list every 2s (snapshot)
334
+ primitive workflows runs list <workflow-id> --follow # append runs as they start or change (tail)
335
+ primitive workflows runs list --user-id <user-id> # one user's runs, across every workflow
336
+ primitive workflows runs steps <workflow-id> <run-id> # every step run of one run
337
+ primitive workflows runs status <workflow-id> <run-id> # one run's status + step results
338
+
339
+ # The other log-shaped views
340
+ primitive integrations logs <integration-id> # outbound calls: status, timing, actor
341
+ primitive webhooks events <webhook-id> # inbound deliveries and how they were handled
342
+ primitive analytics events # app activity events
343
+
344
+ # Per-subject analytics — one home, the analytics noun
345
+ primitive analytics workflows --window-days 7 # top workflows by runs
346
+ primitive analytics prompts --window-days 7 # top prompts by executions
347
+ primitive analytics integrations # calls, error rate, latency
348
+
349
+ # Blob storage
350
+ primitive blob-buckets list # buckets in the app (app-scoped: no selector)
351
+ primitive blob-buckets head <bucket> <key> # object metadata without downloading
352
+
353
+ # Live connections and sessions
354
+ primitive connections list --user-id <id> # active WebSocket connections
355
+ primitive sessions list --user-id <id> # auth sessions
356
+
357
+ # Database records and app documents
358
+ primitive databases records query <database> ... # read records
359
+ primitive databases records get <database> <model-name> <record-id>
360
+ primitive documents records query <document> <model-name> [--filter '{...}']
361
+ primitive documents records get <document> <model-name> <record-id>
362
+ primitive documents dump <document-id> # every model's records as JSON
363
+ primitive documents export <document-id> # dump a document's contents
364
+ primitive documents create "<title>" [--owner <user-id-or-email>] # mint a document (--owner needs a super-admin or assigned-console-admin token; app-role admins create as themselves)
365
+ primitive documents delete <document-id> [-y] [--json] # delete a document (document owner / app owner / super-admin or assigned-console-admin; app-role admins only via a containing collection's document.delete rule)
366
+
367
+ # Metadata
368
+ primitive metadata get <type> <id> <category> # resource metadata VALUES
369
+ primitive metadata-category-configs list # category DEFINITIONS (schema + read/write rules)
370
+ primitive metadata-category-configs get <type> <category>
371
+ ```
372
+
373
+ **Uniform flags across every inspection command:**
374
+
375
+ - `--app <id>` — target app (falls back to the resolved env's app).
376
+ - `--json` — the output you parse in scripts. Most commands print the endpoint
377
+ payload as-is; the log views below normalize theirs into the shared item
378
+ shape. Either way it is a JSON document, never a bare array — except the
379
+ type-config readers (`group-type-configs`, `collection-type-configs`,
380
+ `metadata-category-configs`), whose `list --json` prints the configs as a
381
+ bare array (`jq '.[]'`). Data goes to
382
+ stdout; status, warnings and the `CLI Version: …` banner go to stderr — so
383
+ even the always-JSON commands that take no `--json` flag pipe cleanly
384
+ (`primitive documents dump <doc> | jq .`).
385
+ - `--limit <n>` / `--cursor <c>` — paged reads. The response envelope is always
386
+ `{ items, hasMore, nextCursor? }`. Both `records query` verbs print that
387
+ envelope whatever shape their endpoint returns, and neither emits the
388
+ deprecated `cursor` alias — read `nextCursor`. Aggregate reads walk the
389
+ `nextCursor` chain.
390
+ - `list` always requires a **selector** (`--user-id`, `--owner`, a resource id, …)
391
+ so it never enumerates the whole app — **except** genuinely app-scoped
392
+ resources like `blob-buckets list`, which lists the app's buckets directly.
393
+ `--user-id` is the spelling on every list/inspection selector; `connections
394
+ list`, `sessions list` and `tokens list` still accept `--user` as a
395
+ deprecated alias that prints a notice on stderr.
396
+
397
+ **One `--json` item shape across the log views.** `workflows runs list`,
398
+ `workflows runs steps`, `integrations logs`, `webhooks events` and `analytics
399
+ events` all emit the same item envelope inside their endpoint's pagination
400
+ envelope — never a bare array:
401
+
402
+ ```json
403
+ {
404
+ "items": [
405
+ {
406
+ "source": "workflow-run",
407
+ "timestamp": "2026-07-24T18:03:11.204Z",
408
+ "outcome": "error",
409
+ "nativeStatus": "failed",
410
+ "correlation": { "runId": "01J…", "workflowId": "01J…", "userId": "01J…" },
411
+ "detail": { "workflowKey": "summarize", "errorMessage": "…" }
412
+ }
413
+ ],
414
+ "hasMore": false
415
+ }
416
+ ```
417
+
418
+ - `source` is the discriminator: `workflow-run`, `workflow-step`,
419
+ `integration`, `webhook`, `activity`.
420
+ - `outcome` is the normalized verdict — `ok`, `error`, `pending`, or `neutral`
421
+ — and `nativeStatus` keeps the source's own value (an HTTP integer, `failed`,
422
+ `duplicate`, …) verbatim, so filtering on the raw value stays possible. A
423
+ webhook that was accepted but matched no active workflow is `ok` with
424
+ `nativeStatus: "workflow_inactive"` — a non-dispatch, not a failure.
425
+ - `correlation` carries the pivot keys that let you follow one operation
426
+ between views (`runId`, `stepId`, `traceId`, `workflowId`, `webhookId`,
427
+ `userId`) plus the row's own id (`stepRunId`, `eventId`), so a row you
428
+ printed can always be looked up again.
429
+ - `detail` is a per-source allowlist of operator-facing fields, not the whole
430
+ stored record.
431
+ - Pagination rides alongside `items`: `hasMore` plus `nextCursor` where the
432
+ endpoint pages by cursor, `page`/`pageSize`/`totalRows` for `analytics
433
+ events`. `integrations logs` returns `{ items }` — it filters within a
434
+ bounded scan rather than paging.
435
+ - The normalization is `--json`-only: the human tables stay per-view because
436
+ each shows columns the shared shape has no room for (queue delay, inter-step
437
+ gap, token counts, event id). `--watch --json` reprints the same envelope
438
+ each tick; `--follow --json` emits one item per line (newline-delimited
439
+ JSON), since a tail has no closing bracket to wait for.
440
+
441
+ **Per-user inspection.** Two views can be keyed on a user:
442
+
443
+ ```bash
444
+ primitive workflows runs list --user-id <user-id> # every run that user started
445
+ primitive analytics events --user-id <user-id> # that user's activity events
446
+ ```
447
+
448
+ `workflows runs list --user-id` makes `<workflow-id>` optional — it lists the
449
+ user's runs across every workflow. Pass both to narrow to one workflow.
450
+ `integrations logs` and `webhooks events` have no `--user-id`: an integration
451
+ invocation records the actor but is indexed by integration, and a webhook event
452
+ carries no user identity at all. To follow a user through those, take the
453
+ `runId`/`traceId` from that user's workflow runs and match it in the
454
+ integration logs.
455
+
456
+ **`--watch` vs `--follow` (both poll — there is no server push):**
457
+
458
+ - `--watch` re-fetches the current snapshot each interval and re-renders the whole
459
+ view (a periodic re-`list`/`get`). It works on any list command with no server
460
+ change.
461
+ - `--follow` tails: it appends new/changed rows since a server-owned checkpoint,
462
+ like `tail -f`. It is offered **only** where the endpoint supports the resume
463
+ contract (today: `workflows runs list`); other commands offer only `--watch`
464
+ until their endpoint adds it. Passing `--follow` where it isn't supported fails
465
+ with a clear message.
466
+ - `--interval <seconds>` sets the poll interval (minimum 1s, default 2s).
467
+ - `--watch` and `--follow` are mutually exclusive.
468
+ - `--json --follow` emits **NDJSON** (one JSON object per new row per line) — a
469
+ tail is an unbounded stream, so it can't be one array; pipe it to `jq -c`.
470
+ `--json --watch` emits one array per redraw.
471
+ - Ctrl-C stops a tail cleanly (exit 0).
472
+
473
+ **`--follow` shows the latest observed version of a row, not every state change.**
474
+ It re-emits a run when a newer version is observed between polls, so a run you
475
+ already saw can reappear at its new position after its status changes — that is
476
+ expected, not a duplicate. Fast transitions that happen between two polls collapse
477
+ to the latest stored version. This is near-lossless observed-version tailing:
478
+ rows sharing a timestamp, or a delayed index update, can occasionally be skipped
479
+ or re-shown. Use it to watch activity, not as an exactly-once event log.
480
+
481
+ ## When the User is Starting a New Feature
482
+
483
+ If the user describes a new feature they want to build:
484
+
485
+ 1. **Verify CLI configuration** per Step 0 — confirm the active environment in
486
+ `.primitive/config.json` (and its bound `apiUrl` / `appId`) match the project's intended target
487
+ before running any commands
488
+ 2. **Run `primitive guides list`** to discover available topics and their `(language, platform)` combinations
489
+ 3. **Identify which guides are relevant** to their feature from the list output
490
+ 4. **Fetch those guides** with `primitive guides get <topic> --language <lang> --platform <platform>`
491
+ (using the project's language/platform; omit the flags if unknown)
492
+ 5. **Recommend a data modeling approach** based on the guide content. If requirements are unclear or ambiguous, **ask the user clarifying questions before proceeding** — it's much easier to get the data model right upfront than to migrate later
493
+ 6. **Outline the implementation steps** referencing specific patterns from the guides
494
+ 7. **Write the code** following the patterns exactly
495
+ 8. **Review automatically** per Step 4 above
496
+
497
+ ## When the User Asks "How Do I...?"
498
+
499
+ For any question about Primitive platform capabilities:
500
+
501
+ 1. **Run `primitive guides list`** to find the relevant topic (and its available language/platform combinations)
502
+ 2. **Fetch the guide**: `primitive guides get <topic> --language <lang> --platform <platform>` (omit the flags if the language/platform is unknown)
503
+ 3. **Answer from the guide content** — don't guess or make up APIs
504
+ 4. **Include working code examples** from the guide
505
+ 5. **Point the user to the guide** for further reading: "You can see more examples by running `primitive guides get <topic>`"
506
+
507
+ ## Upgrading Platform Libraries
508
+
509
+ When the user asks to upgrade the app to a newer platform version, follow this workflow.
510
+ An upgrade is not just a version bump: after the libraries move, workarounds built for old
511
+ platform bugs should come out, the starter template the app was scaffolded from has usually
512
+ moved too, and new platform capabilities should be considered. The refreshed guides are the
513
+ source of truth for what the platform can do now.
514
+
515
+ The backend is upgraded by the platform team, not by the app — the app only chooses which
516
+ environment it points at (Step 0). A library upgrade against the production environment
517
+ needs no server-side changes.
518
+
519
+ ### 1. Snapshot the current state
520
+
521
+ - Read `package.json` and note the installed versions of the platform packages the app
522
+ uses: `js-bao`, `js-bao-wss-client`, `primitive-app`, and `primitive-admin` (the CLI).
523
+ - Check what's available: `pnpm view <pkg> dist-tags` for each. Compare the target tag's
524
+ version against what's installed — a dist-tag can lag (or even point behind another
525
+ tag), so confirm the upgrade actually moves forward before proceeding.
526
+ - Locate the app's platform feedback doc (convention below). Note its upgrade stamp and
527
+ the tracked workarounds — Step 5 revisits each one.
528
+
529
+ ### 2. Upgrade the CLI first
530
+
531
+ ```bash
532
+ pnpm add -g primitive-admin@latest # pnpm preferred; use npm if that's how the CLI was installed
533
+ ```
534
+
535
+ Upgrading the CLI first matters for two reasons:
536
+
537
+ - The CLI bundles this skill and silently refreshes the installed copy on its next run.
538
+ After upgrading, **re-read this skill file** — the guidance itself may have changed.
539
+ - The CLI serves the guides, and guides are cached at `~/.primitive/guides/` with a
540
+ 24-hour TTL. Nothing invalidates that cache when packages update, so after any upgrade
541
+ pass `--refresh` on the first `primitive guides list` / `primitive guides get` calls
542
+ (or clear the cache: `rm -rf ~/.primitive/guides`). Otherwise you may be reading
543
+ yesterday's guides against today's libraries.
544
+
545
+ ### 3. Upgrade the app's libraries
546
+
547
+ ```bash
548
+ # pnpm by default (use npm only if the app already uses npm), for the packages the app uses:
549
+ pnpm add js-bao@latest js-bao-wss-client@latest primitive-app@latest
550
+ ```
551
+
552
+ Upgrade the libraries **before** fetching guides: the guides system selects its version
553
+ channel from the *installed* `js-bao-wss-client` major, so fetching first returns guides
554
+ for the old version. Then refetch the guides for every feature area the app uses,
555
+ passing `--refresh` on the first call.
556
+
557
+ ### 4. Fix breaking changes
558
+
559
+ Run the app's typecheck/build. For every error, consult the refreshed guide for that
560
+ feature area and migrate the code to the current API — don't pin back or suppress. A
561
+ major version bump means breaking changes are expected; treat the migration as part of
562
+ the upgrade, not an optional follow-up.
563
+
564
+ ### 5. Retire resolved workarounds
565
+
566
+ For each workaround tracked in the feedback doc, re-test the underlying platform
567
+ behavior against the upgraded libraries (a small repro, or the app test that covers it).
568
+ If the platform now behaves correctly, remove the workaround code and move the item to
569
+ Resolved. If not, keep it and note the version it was last checked against. Stale
570
+ workarounds are a real cost — they mask platform behavior and confuse later readers —
571
+ so default to removing them the moment they're unnecessary.
572
+
573
+ ### 6. Adopt template updates
574
+
575
+ The app was scaffolded by `primitive init` from a starter template —
576
+ `Primitive-Labs/primitive-vue-template` for web apps, `Primitive-Labs/primitive-swift-template`
577
+ for iOS. Those templates keep moving with the platform: config, setup, and wiring fixes
578
+ land there and never reach an app generated months earlier. Scan the template the app came
579
+ from (both, if the app has a web and an iOS client) and pull forward what applies. Fetch
580
+ the branch matching the channel you're upgrading to — `main` for production, `alpha` for
581
+ alpha:
582
+
583
+ ```bash
584
+ # Vue
585
+ curl -sL https://github.com/Primitive-Labs/primitive-vue-template/archive/refs/heads/main.tar.gz \
586
+ | tar -xz -C /tmp
587
+ # Swift
588
+ gh api repos/Primitive-Labs/primitive-swift-template/tarball/main > /tmp/swift-template.tgz
589
+ ```
590
+
591
+ Then compare the template against the app file by file:
592
+
593
+ - **The app never changed it → move it over.** Where the app still carries the template's
594
+ version unchanged, take the newer one. That includes files the template has added since
595
+ the app was scaffolded. No need to ask.
596
+ - **The app removed it → leave it removed.** A file or block the app deleted was deleted
597
+ on purpose. Never restore it.
598
+ - **Both changed it → ask.** Where the app has its own edits to something the template
599
+ also changed, don't overwrite. Say what the template's change does and why it landed,
600
+ then ask whether to merge it in. Ask once per coherent change, not per hunk.
601
+
602
+ Telling those three cases apart needs a baseline: the template commit the app last synced
603
+ from, recorded in the feedback doc (below). With it, diff baseline→template to see what
604
+ the template changed and baseline→app to see what the app changed; only files in both
605
+ sets need a question. Without a stamp you can't tell an app edit from a template edit, so
606
+ treat every differing file as "ask" — and record the stamp this time.
607
+
608
+ ### 7. Adopt and suggest new features
609
+
610
+ Re-run `primitive guides list` (topics appear and grow over time) and skim the refreshed
611
+ guides for the app's feature areas. Compare against what the app actually does:
612
+
613
+ - Where a new platform capability clearly replaces app-level code (less code, same
614
+ behavior), adopt it as part of the upgrade.
615
+ - Where a capability opens something new but needs a product decision, don't build it —
616
+ report it as a suggestion with a pointer to the relevant guide section.
617
+
618
+ ### 8. Verify and stamp
619
+
620
+ Run the app's tests, apply the Step 4 post-code review to everything modified, and
621
+ update the feedback doc's upgrade stamp (date, channel, versions, and the template
622
+ commit synced in Step 6).
623
+
624
+ ### The platform feedback doc
625
+
626
+ Convention: a `PRIMITIVE-FEEDBACK.md` at the app root tracks the app's relationship to the
627
+ platform — when it was last upgraded, and which workarounds exist for platform issues.
628
+ This is what makes upgrades mechanical instead of archaeological. If the app doesn't
629
+ have one, create it during the first upgrade:
630
+
631
+ ```markdown
632
+ # Platform Feedback
633
+
634
+ ## Upgrade stamp
635
+ - Last upgraded: 2026-07-21
636
+ - Channel: production
637
+ - Versions: js-bao-wss-client 2.0.6, primitive-app 3.0.5, js-bao 0.5.1, primitive-admin 1.0.55
638
+ - Template: primitive-vue-template @ main 0f1c2d3
639
+
640
+ ## Open items
641
+ - [#1234] Symptom or missing capability. Workaround: `src/lib/foo.ts:42` (retry loop).
642
+
643
+ ## Resolved
644
+ - [#1101] Symptom. Workaround removed 2026-07-21.
645
+ ```
646
+
647
+ Issue numbers refer to platform issues where known (Primitive-Labs members); items
648
+ without an issue number are fine — the doc is useful even when the issue tracker isn't
649
+ accessible.
650
+
651
+ ## Filing Platform Issues
652
+
653
+ Sometimes the problem is in the platform itself — a bug in js-bao, the client library,
654
+ the CLI, or a capability the platform doesn't have — rather than in the user's app.
655
+ Platform work is tracked as GitHub issues on `Primitive-Labs/js-bao-wss`.
656
+
657
+ **Gate: only suggest filing an issue if the signed-in GitHub user is a member of the
658
+ Primitive-Labs org.** Check silently before ever raising the option:
659
+
660
+ ```bash
661
+ gh api user/memberships/orgs/Primitive-Labs --jq .state 2>/dev/null
662
+ ```
663
+
664
+ If this doesn't print `active` (not a member, or `gh` is missing or unauthenticated),
665
+ don't mention filing an issue at all — help the user work around the problem instead.
666
+
667
+ ### Tracker hygiene (issues and comments alike)
668
+
669
+ Everything you write to the tracker — new issues and follow-up comments on existing
670
+ ones — is read by an agent pipeline and by maintainers who have none of your session's
671
+ context. What you write is all they get, and investigating is the assignee's job —
672
+ yours is to state the problem clearly.
673
+
674
+ - **Brevity and clarity win over verbosity.** Keep the prose to 1000 characters or
675
+ less. Fenced code blocks (repro commands, config, verbatim error output) don't count
676
+ toward the cap — precision there is what makes an issue reproducible. If the prose
677
+ doesn't fit, you're including solution detail or context the assignee can rediscover.
678
+ - **Self-contained.** Assume the reader knows nothing about the user's app and has no
679
+ internal knowledge of the platform. Reference related issues by number, but inline
680
+ whatever context is needed to read the issue standalone.
681
+ - **Describe the problem, not the solution.** Don't prescribe the fix or assume a
682
+ particular implementation.
683
+ - **Don't relitigate decisions rejected in earlier issues** — carry forward the
684
+ discovered tradeoffs, stated neutrally.
685
+
686
+ ### Bugs (an existing platform feature not working as designed)
687
+
688
+ Body template — fill each section with as much precision as possible, so the issue is
689
+ easy to reproduce on the first try:
690
+
691
+ ```
692
+ ## Repro steps
693
+ <numbered, precise, minimal: exact API calls, config, versions. The test:
694
+ someone with no context reproduces it on the first try>
695
+
696
+ ## Observed behavior
697
+ <what actually happens, with verbatim error text / response bodies in fenced
698
+ blocks>
699
+
700
+ ## Expected behavior
701
+ <what should happen instead, stated as an observable outcome — this is what
702
+ "fixed" means, and what a fix will be tested against>
703
+
704
+ ## Design review needed?
705
+ <tick any that apply; leave all unticked if the fix looks self-contained>
706
+
707
+ - [ ] Involves a critical security decision (auth, permissions, CEL, secrets, webhook
708
+ verification, DO routing)
709
+ - [ ] Risks a performance regression on a per-request, per-message or per-connection path
710
+ - [ ] Requires a data model or index change (`models.yaml`)
711
+ - [ ] Breaks an existing API contract (removes or retypes something in `openapi.json`, or
712
+ changes a `src/client` public signature non-additively)
713
+ ```
714
+
715
+ Write "Expected behavior" as the acceptance criterion: the observable outcome that
716
+ defines the bug as fixed. If prior investigation exists (an earlier thread, a
717
+ session's debugging), link it — don't inline a root-cause theory as fact.
718
+
719
+ The "Design review needed?" checkboxes decide the bug's route: any tick sends it
720
+ through the design gate; all unticked sends it straight to implementation, with
721
+ "Expected behavior" as the acceptance criteria. When unsure, leave a box unticked —
722
+ the worker re-checks against its own diff and routes itself back if one applies.
723
+
724
+ Labels: `type:bug` only.
725
+
726
+ ### Features / enhancements / platform extensions
727
+
728
+ ```
729
+ ## Problem
730
+ <the application-level problem being solved, and who hits it — a concrete
731
+ scenario, not an abstraction, and not a solution>
732
+
733
+ ## What I tried
734
+ <existing platform features attempted, and why each falls short — omit if none apply>
735
+
736
+ ## What a solution needs to enable
737
+ <the outcomes a solution must make possible, as bullets — capabilities from
738
+ the consumer's perspective, not designs>
739
+ ```
740
+
741
+ Keep "What a solution needs to enable" outcome-shaped: "an app can resume a follow
742
+ from the last event it saw across restarts" — not "add a `resumeAfter` token to the
743
+ list endpoint". If you have a design idea worth preserving, put it in a comment,
744
+ clearly labeled as an idea — never in the body.
745
+
746
+ Labels: `type:feature` only.
747
+
748
+ ### Filing
749
+
750
+ Use only `type:bug` or `type:feature` (e.g. file performance problems as `type:bug`
751
+ with measurements in the repro steps). Search open issues for duplicates first:
752
+
753
+ ```bash
754
+ gh issue list --repo Primitive-Labs/js-bao-wss --search "<keywords>" --state open \
755
+ --json number,title
756
+ ```
757
+
758
+ Then create the issue with exactly one `type:*` label and nothing else — **no
759
+ assignee** (triage assigns sponsors; unassigned is the correct starting state), no
760
+ priority labels, no `state:*` label, and no `dispatch-v3` (state and dispatch labels
761
+ are added together by triage once it judges the filing complete — never by the
762
+ filer; an issue waiting for triage is the correct starting state):
763
+
764
+ ```bash
765
+ gh issue create --repo Primitive-Labs/js-bao-wss \
766
+ --title "<one-line symptom or need>" \
767
+ --label "type:bug" \
768
+ --body "<template body>"
769
+ ```
770
+
771
+ The templates above mirror the canonical ones in the js-bao-wss repo at
772
+ `.claude/skills/_shared/templates/` (`bug-filing.md`, `feature-filing.md`,
773
+ `docs-filing.md`), which the pipeline validates against with
774
+ `.claude/skills/_shared/check-filing.sh` before an issue can be picked up — a body
775
+ missing a required section stalls in triage until a human repairs it. If the
776
+ templates here and the repo's ever disagree, the repo's win. When working inside a
777
+ js-bao-wss checkout, don't file by hand at all: use that repo's `/file-issue` skill,
778
+ which interviews for the sections, validates the draft offline, and files with the
779
+ right labels.
780
+
781
+ ### Follow-up comments on existing issues
782
+
783
+ When the duplicate search finds an issue that already covers the problem, comment
784
+ there instead of filing. A comment is a **delta on the thread, not a fresh report** —
785
+ the hygiene rules above (1000-character prose cap, fenced blocks exempt, problem not
786
+ solution, self-contained) apply to it unchanged, plus:
787
+
788
+ - **Lead with what's new**: a repro, a counterexample, a version/deployment where the
789
+ behavior changed, a confirmation that it no longer reproduces. Don't restate what
790
+ the thread already establishes — reference it.
791
+ - **Evidence goes in fenced blocks**, exactly as in an issue body: numbered repro
792
+ steps, exact commands and API calls, verbatim errors, versions and app/resource
793
+ ids. Prose interprets the evidence; it must not be the container for it.
794
+ - **One comment, one issue's scope.** Evidence that implicates a *different* issue
795
+ belongs in a separate comment on that issue, cross-referenced by number — not
796
+ folded into this one.
797
+ - **State facts; leave triage to the maintainers.** Stage, priority, closure, and
798
+ duplicate-of verdicts are theirs. If the evidence points at a next step (re-test
799
+ after X lands, likely duplicate of #N), one closing sentence may say so — never
800
+ more.
801
+
802
+ ### Record the issue in the app
803
+
804
+ After filing, add an entry to the app's `PRIMITIVE-FEEDBACK.md` (see "The platform feedback doc"
805
+ above) under **Open items**: the issue number, a one-line symptom, and — if you built a
806
+ workaround in the app — where it lives (`file:line`). This is what lets a future upgrade
807
+ find and remove the workaround once the platform fix ships. If a workaround is added
808
+ later for an already-filed issue, update the entry then.