primitive-admin 1.1.0-alpha.8 → 1.1.0-alpha.81

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