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

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