@stacksjs/defaults 0.75.539 → 0.75.541

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 (152) hide show
  1. package/ai/AGENTS.md +2 -0
  2. package/ai/skills/stacks-actions/SKILL.md +1 -1
  3. package/ai/skills/stacks-auth/SKILL.md +8 -1
  4. package/ai/skills/stacks-dashboard/SKILL.md +196 -3
  5. package/ai/skills/stacks-dependencies/SKILL.md +46 -0
  6. package/ai/skills/stacks-development/SKILL.md +1 -1
  7. package/ai/skills/stacks-flow/SKILL.md +7 -0
  8. package/ai/skills/stacks-hq/SKILL.md +146 -0
  9. package/ai/skills/stacks-models/SKILL.md +21 -3
  10. package/ai/skills/stacks-native/CATALOG.md +22 -9
  11. package/ai/skills/stacks-new-app/SKILL.md +175 -0
  12. package/ai/skills/stacks-repl/SKILL.md +61 -43
  13. package/ai/skills/stacks-stx/SKILL.md +6 -2
  14. package/ai/skills/stacks-upstream/SKILL.md +188 -0
  15. package/ai/skills/stacks-writing-for-agents/SKILL.md +1 -1
  16. package/app/Actions/Dashboard/Data/UserIndexAction.ts +20 -2
  17. package/app/Actions/Dashboard/Models/ModelDestroyAction.ts +48 -12
  18. package/app/Actions/Dashboard/Models/ModelOptionsAction.ts +103 -0
  19. package/app/Actions/Dashboard/Models/ModelRelatedAction.ts +42 -0
  20. package/app/Actions/Dashboard/Models/ModelShowAction.ts +75 -12
  21. package/app/Actions/Dashboard/Models/ModelStoreAction.ts +7 -1
  22. package/app/Actions/Dashboard/Models/ModelUpdateAction.ts +16 -2
  23. package/app/Actions/Dashboard/Models/model-destroy.ts +75 -0
  24. package/app/Actions/Dashboard/Models/model-options.ts +56 -0
  25. package/app/Actions/Dashboard/Models/model-related.ts +202 -0
  26. package/app/Actions/Dashboard/Models/model-relations.ts +172 -0
  27. package/app/Actions/Dashboard/Models/model-write.ts +240 -51
  28. package/app/Actions/Dashboard/Users/UserInviteAction.ts +50 -0
  29. package/app/Actions/Dashboard/Users/user-invitation.ts +110 -0
  30. package/app/Models/Activity.ts +4 -0
  31. package/app/Models/AnalyticsEvent.ts +4 -0
  32. package/app/Models/Automation.ts +4 -0
  33. package/app/Models/AutomationRun.ts +4 -0
  34. package/app/Models/Board.ts +4 -1
  35. package/app/Models/BoardColumn.ts +4 -1
  36. package/app/Models/Campaign.ts +4 -0
  37. package/app/Models/CampaignSend.ts +4 -0
  38. package/app/Models/CampaignVariant.ts +4 -0
  39. package/app/Models/Card.ts +4 -1
  40. package/app/Models/CardAttachment.ts +4 -0
  41. package/app/Models/CommunicationSuppression.ts +4 -0
  42. package/app/Models/ConsentEvent.ts +4 -0
  43. package/app/Models/Deployment.ts +1 -0
  44. package/app/Models/EmailList.ts +4 -0
  45. package/app/Models/EmailListSubscriber.ts +4 -0
  46. package/app/Models/Error.ts +4 -0
  47. package/app/Models/FailedJob.ts +4 -0
  48. package/app/Models/FeedbackToken.ts +4 -0
  49. package/app/Models/GdprRequest.ts +4 -0
  50. package/app/Models/Job.ts +4 -0
  51. package/app/Models/Log.ts +4 -0
  52. package/app/Models/MagicLinkToken.ts +4 -0
  53. package/app/Models/MailPreference.ts +4 -0
  54. package/app/Models/Notification.ts +4 -0
  55. package/app/Models/NotificationDelivery.ts +4 -0
  56. package/app/Models/PersonalAccessToken.ts +4 -0
  57. package/app/Models/QueryLog.ts +4 -0
  58. package/app/Models/Referral.ts +4 -0
  59. package/app/Models/Release.ts +1 -0
  60. package/app/Models/Request.ts +4 -0
  61. package/app/Models/SenderDomain.ts +4 -0
  62. package/app/Models/Site.ts +1 -0
  63. package/app/Models/SiteDomain.ts +4 -0
  64. package/app/Models/SocialPost.ts +4 -0
  65. package/app/Models/StorageItemTask.ts +4 -1
  66. package/app/Models/Subscriber.ts +4 -0
  67. package/app/Models/Subscription.ts +4 -0
  68. package/app/Models/Team.ts +1 -0
  69. package/app/Models/TeamInvitation.ts +1 -0
  70. package/app/Models/TeamMember.ts +1 -0
  71. package/app/Models/UsageEvent.ts +4 -0
  72. package/app/Models/User.ts +15 -3
  73. package/functions/dashboard-model-record.test.ts +276 -18
  74. package/functions/dashboard-model-record.ts +412 -55
  75. package/functions/data.ts +2 -0
  76. package/ide/vscode/package.json +1 -1
  77. package/package.json +5 -5
  78. package/resources/components/Dashboard/Analytics/AnalyticsHub.stx +1 -1
  79. package/resources/components/Dashboard/Analytics/CampaignAnalytics.stx +1 -1
  80. package/resources/components/Dashboard/Analytics/EventAnalytics.stx +1 -1
  81. package/resources/components/Dashboard/Analytics/SalesAnalytics.stx +1 -1
  82. package/resources/components/Dashboard/Analytics/WebAnalyticsBreakdown.stx +1 -1
  83. package/resources/components/Dashboard/App/RequestsOverview.stx +1 -1
  84. package/resources/components/Dashboard/App/SourceInventory.stx +1 -1
  85. package/resources/components/Dashboard/Auth/AccessTokens.stx +1 -1
  86. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +1 -1
  87. package/resources/components/Dashboard/Ci/CiDashboard.stx +1 -1
  88. package/resources/components/Dashboard/Commerce/Delivery/DeliveryPagination.stx +1 -1
  89. package/resources/components/Dashboard/Commerce/ProductWaitlistDashboard.stx +1 -1
  90. package/resources/components/Dashboard/Commerce/RestaurantWaitlistDashboard.stx +1 -1
  91. package/resources/components/Dashboard/Content/BlogDashboard.stx +1 -1
  92. package/resources/components/Dashboard/DashboardLayout.stx +1 -1
  93. package/resources/components/Dashboard/Data/DataRecords.stx +43 -22
  94. package/resources/components/Dashboard/Data/UserInvite.stx +107 -0
  95. package/resources/components/Dashboard/Email/CapturedMailDashboard.stx +1 -1
  96. package/resources/components/Dashboard/Email/EmailActivityDashboard.stx +1 -1
  97. package/resources/components/Dashboard/Email/InboxDashboard.stx +1 -1
  98. package/resources/components/Dashboard/Email/InboxMessageDetail.stx +2 -2
  99. package/resources/components/Dashboard/Email/InboxSettingsDashboard.stx +1 -1
  100. package/resources/components/Dashboard/Home/DashboardHome.stx +6 -1
  101. package/resources/components/Dashboard/Infrastructure/CloudDashboard.stx +1 -1
  102. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +1 -1
  103. package/resources/components/Dashboard/Infrastructure/HealthDashboard.stx +1 -1
  104. package/resources/components/Dashboard/Infrastructure/InsightsDashboard.stx +1 -1
  105. package/resources/components/Dashboard/Infrastructure/LogsDashboard.stx +1 -1
  106. package/resources/components/Dashboard/Infrastructure/MailboxesDashboard.stx +1 -1
  107. package/resources/components/Dashboard/Infrastructure/ServerDetailsDashboard.stx +1 -1
  108. package/resources/components/Dashboard/Infrastructure/ServerlessDashboard.stx +1 -1
  109. package/resources/components/Dashboard/Infrastructure/ServersDashboard.stx +1 -1
  110. package/resources/components/Dashboard/Jobs/JobDetail.stx +1 -1
  111. package/resources/components/Dashboard/Jobs/JobTable.stx +2 -2
  112. package/resources/components/Dashboard/Kanban/KanbanBoardDashboard.stx +1 -1
  113. package/resources/components/Dashboard/Kanban/KanbanBoardsDashboard.stx +1 -1
  114. package/resources/components/Dashboard/Management/PermissionsDashboard.stx +1 -1
  115. package/resources/components/Dashboard/Marketing/AbandonedCartsDashboard.stx +1 -1
  116. package/resources/components/Dashboard/Marketing/CampaignsDashboard.stx +1 -1
  117. package/resources/components/Dashboard/Marketing/MarketingListsDashboard.stx +1 -1
  118. package/resources/components/Dashboard/Marketing/SocialPostsDashboard.stx +1 -1
  119. package/resources/components/Dashboard/Models/ModelFieldInputs.stx +125 -0
  120. package/resources/components/Dashboard/Models/ModelRecordCreate.stx +24 -66
  121. package/resources/components/Dashboard/Models/ModelRecordDetail.stx +36 -8
  122. package/resources/components/Dashboard/Models/ModelRecordEdit.stx +36 -32
  123. package/resources/components/Dashboard/Models/ModelRecordsDashboard.stx +72 -28
  124. package/resources/components/Dashboard/Models/ModelRelatedPanels.stx +99 -0
  125. package/resources/components/Dashboard/Models/ModelRelationPicker.stx +247 -0
  126. package/resources/components/Dashboard/Models/ModelsOverview.stx +1 -1
  127. package/resources/components/Dashboard/Notifications/NotificationDeliveries.stx +1 -1
  128. package/resources/components/Dashboard/Notifications/NotificationDeliveryHistory.stx +1 -1
  129. package/resources/components/Dashboard/Notifications/NotificationDeliveryOverview.stx +1 -1
  130. package/resources/components/Dashboard/Queries/QueryDashboard.stx +1 -1
  131. package/resources/components/Dashboard/Queries/QueryDetail.stx +1 -1
  132. package/resources/components/Dashboard/Queue/QueueDashboard.stx +1 -1
  133. package/resources/components/Dashboard/Realtime/RealtimeDashboard.stx +1 -1
  134. package/resources/components/Dashboard/Releases/ReleaseDashboard.stx +1 -1
  135. package/resources/components/Dashboard/Search/SearchEngineDashboard.stx +1 -1
  136. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +1 -1
  137. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +1 -1
  138. package/resources/components/Dashboard/Teams/TeamPeopleDashboard.stx +1 -1
  139. package/resources/components/Dashboard/UI/Drawer.stx +1 -1
  140. package/resources/components/Dashboard/UI/Input.stx +3 -2
  141. package/resources/components/Dashboard/UI/Modal.stx +1 -1
  142. package/resources/components/Dashboard/UI/Select.stx +8 -4
  143. package/resources/components/Dashboard/UI/Textarea.stx +18 -12
  144. package/resources/emails/password-reset.stx +3 -1
  145. package/routes/dashboard-api.ts +9 -0
  146. package/scaffold/config/analytics.ts +5 -3
  147. package/scaffold/resources/components/NextStep.stx +13 -0
  148. package/scaffold/resources/partials/head.stx +31 -0
  149. package/scaffold/resources/views/index.stx +23 -47
  150. package/scaffold/resources/views/layouts/default.stx +23 -0
  151. package/views/dashboard/data/users/invite.stx +8 -0
  152. package/views/dashboard/layouts/default.stx +21 -2
@@ -18,10 +18,10 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
18
18
  | `@stacksjs/api` | [`stacks-api`](../stacks-api/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/api/src/index.ts) | 12 |
19
19
  | `@stacksjs/arrays` | [`stacks-arrays`](../stacks-arrays/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/arrays/src/index.ts) | 12 |
20
20
  | `@stacksjs/audio` | [`stacks-audio`](../stacks-audio/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/audio/src/index.ts) | 3 |
21
- | `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 131 |
21
+ | `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 132 |
22
22
  | `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 10 |
23
23
  | `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 9 |
24
- | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 185 |
24
+ | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 190 |
25
25
  | `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 7 |
26
26
  | `@stacksjs/cache` | [`stacks-cache`](../stacks-cache/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cache/src/index.ts) | 24 |
27
27
  | `@stacksjs/calendar-api` | [`stacks-calendar`](../stacks-calendar/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/calendar-api/src/index.ts) | 5 |
@@ -35,7 +35,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
35
35
  | `@stacksjs/composables` | [`stacks-composables`](../stacks-composables/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/composables/src/index.ts) | 18 |
36
36
  | `@stacksjs/config` | [`stacks-config`](../stacks-config/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts) | 16 |
37
37
  | `@stacksjs/cron` | [`stacks-cron`](../stacks-cron/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cron/src/index.ts) | 6 |
38
- | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 144 |
38
+ | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 145 |
39
39
  | `@stacksjs/datetime` | [`stacks-datetime`](../stacks-datetime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/datetime/src/index.ts) | 22 |
40
40
  | `@stacksjs/defaults` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/package.json) | 3 |
41
41
  | `@stacksjs/deploy` | [`stacks-deploy`](../stacks-deploy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/deploy/package.json) | 1 |
@@ -55,6 +55,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
55
55
  | `@stacksjs/git` | [`stacks-git`](../stacks-git/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/git/src/index.ts) | 2 |
56
56
  | `@stacksjs/github` | [`stacks-git`](../stacks-git/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/github/src/index.ts) | 8 |
57
57
  | `@stacksjs/health` | [`stacks-health`](../stacks-health/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/health/src/index.ts) | 2 |
58
+ | `@stacksjs/hq` | [`stacks-hq`](../stacks-hq/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/src/index.ts) | 7 |
58
59
  | `@stacksjs/http` | [`stacks-http`](../stacks-http/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/http/src/index.ts) | 3 |
59
60
  | `@stacksjs/i18n` | [`stacks-i18n`](../stacks-i18n/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/i18n/src/index.ts) | 5 |
60
61
  | `@stacksjs/image` | [`stacks-image`](../stacks-image/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/image/src/index.ts) | 4 |
@@ -89,7 +90,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
89
90
  | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 50 |
90
91
  | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
91
92
  | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 24 |
92
- | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 1 |
93
+ | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 2 |
93
94
  | `@stacksjs/tunnel` | [`stacks-tunnel`](../stacks-tunnel/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tunnel/src/index.ts) | 1 |
94
95
  | `@stacksjs/types` | [`stacks-types`](../stacks-types/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/types/src/index.ts) | 2 |
95
96
  | `@stacksjs/ui` | [`stacks-ui`](../stacks-ui/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ui/src/index.ts) | 6 |
@@ -189,7 +190,7 @@ Declared runtime exports: `DEFAULT_ROLE_PACKS`, `adminEmails`, `createBqbRbacSto
189
190
 
190
191
  Local source modules: [src/admins.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/admins.ts), [src/authentication.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/authentication.ts), [src/authenticator.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/authenticator.ts), [src/authorizable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/authorizable.ts), [src/browser-session-store.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/browser-session-store.ts), [src/browser-session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/browser-session.ts), [src/client.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/client.ts), [src/cookie-auth.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/cookie-auth.ts), [src/credential-user.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/credential-user.ts), [src/email-verification.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/email-verification.ts), [src/gate.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/gate.ts), [src/impersonation-auth.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/impersonation-auth.ts), [src/impersonation-store.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/impersonation-store.ts), [src/impersonation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/impersonation.ts), [src/magic-link.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/magic-link.ts), [src/middleware.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/middleware.ts), [src/oauth-authorization-codes.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-authorization-codes.ts), [src/oauth-authorization-endpoint.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-authorization-endpoint.ts), [src/oauth-authorization-requests.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-authorization-requests.ts), [src/oauth-authorization-response.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-authorization-response.ts), [src/oauth-authorization.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-authorization.ts), [src/oauth-browser-session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-browser-session.ts), [src/oauth-client-registration.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-client-registration.ts), [src/oauth-consent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-consent.ts), [src/oauth-delegated-access.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-delegated-access.ts), [src/oauth-dynamic-registration.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-dynamic-registration.ts), [src/oauth-grants.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-grants.ts), [src/oauth-introspection.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-introspection.ts), [src/oauth-metadata.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-metadata.ts), [src/oauth-pkce.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-pkce.ts), [src/oauth-protected-resource.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-protected-resource.ts), [src/oauth-provider.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-provider.ts), [src/oauth-pruning.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-pruning.ts), [src/oauth-revocation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-revocation.ts), [src/oauth-server.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-server.ts), [src/oauth-token-endpoint.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-token-endpoint.ts), [src/oauth-token-exchange.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-token-exchange.ts), [src/oauth-token-request.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-token-request.ts), [src/oauth-token-response.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-token-response.ts), [src/oauth-userinfo.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/oauth-userinfo.ts), [src/page-gate.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/page-gate.ts), [src/passkey.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/passkey.ts), [src/passkeys.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/passkeys.ts), [src/password/reset-token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/password/reset-token.ts), [src/password/reset.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/password/reset.ts), [src/permissions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/permissions.ts), [src/policy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/policy.ts), [src/rate-limiter.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/rate-limiter.ts), [src/rbac-seed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/rbac-seed.ts), [src/rbac-store-bqb.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/rbac-store-bqb.ts), [src/rbac.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/rbac.ts), [src/referrals.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/referrals.ts), [src/register.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/register.ts), [src/request-token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/request-token.ts), [src/session-auth.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/session-auth.ts), [src/session-handoff.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/session-handoff.ts), [src/socials.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/socials.ts), [src/team.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/team.ts), [src/tokens.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/tokens.ts), [src/two-factor-recovery-codes.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/two-factor-recovery-codes.ts), [src/two-factor.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/two-factor.ts), [src/user.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/user.ts).
191
192
 
192
- Evidence directory: [131 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
193
+ Evidence directory: [132 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
193
194
 
194
195
  ### @stacksjs/browser
195
196
 
@@ -219,7 +220,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
219
220
 
220
221
  Local source modules: [src/commands/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/commands/index.ts).
221
222
 
222
- Evidence directory: [185 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
223
+ Evidence directory: [190 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
223
224
 
224
225
  ### @stacksjs/build
225
226
 
@@ -357,7 +358,7 @@ Declared runtime exports: `Database`, `EntityQueryBuilder`, `__flushAfterCommitN
357
358
 
358
359
  Local source modules: [src/affected-rows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/affected-rows.ts), [src/auth-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/auth-tables.ts), [src/custom/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/custom/index.ts), [src/database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/database.ts), [src/datetime-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/datetime-columns.ts), [src/ddl-constraints.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ddl-constraints.ts), [src/defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/defaults.ts), [src/dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/dialect.ts), [src/driver-config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/driver-config.ts), [src/drivers/dynamodb.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/dynamodb.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/index.ts), [src/ensure-database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ensure-database.ts), [src/erd.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/erd.ts), [src/fk-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/fk-audit.ts), [src/framework-renames.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-renames.ts), [src/framework-route-admission.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-route-admission.ts), [src/hand-written-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/hand-written-migrations.ts), [src/ignored-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ignored-migrations.ts), [src/index-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index-shape.ts), [src/managed-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/managed-columns.ts), [src/migration-dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-dialect.ts), [src/migration-ledger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-ledger.ts), [src/migration-names.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-names.ts), [src/migration-path.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-path.ts), [src/migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migrations.ts), [src/model-sources.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/model-sources.ts), [src/notification-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/notification-tables.ts), [src/package-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-migrations.ts), [src/package-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-models.ts), [src/query-logger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/query-logger.ts), [src/rbac-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/rbac-tables.ts), [src/relation-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/relation-columns.ts), [src/replicas.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/replicas.ts), [src/row-lease.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lease.ts), [src/row-lock.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lock.ts), [src/safe-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/safe-migrations.ts), [src/schema-align.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-align.ts), [src/schema-drift.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-drift.ts), [src/seeder.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/seeder.ts), [src/shadowed-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/shadowed-models.ts), [src/sql-helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/sql-helpers.ts), [src/table-exists.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/table-exists.ts), [src/trait-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/trait-tables.ts), [src/transaction-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-context.ts), [src/transaction-options.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-options.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/types.ts), [src/unique-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/unique-audit.ts), [src/utc-defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utc-defaults.ts), [src/utils.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utils.ts), [src/uuid-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/uuid-columns.ts), [src/vschema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/vschema.ts).
359
360
 
360
- Evidence directory: [144 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
361
+ Evidence directory: [145 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
361
362
 
362
363
  ### @stacksjs/datetime
363
364
 
@@ -539,6 +540,16 @@ Local source modules: [src/drivers/index.ts](https://github.com/stacksjs/stacks/
539
540
 
540
541
  Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/health/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
541
542
 
543
+ ### @stacksjs/hq
544
+
545
+ Guidance: [`stacks-hq`](../stacks-hq/SKILL.md). Source: [storage/framework/core/hq/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/src/index.ts).
546
+
547
+ Read the entrypoint and package export map for re-exported or type-only surfaces.
548
+
549
+ Local source modules: [src/client.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/src/client.ts), [src/meter.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/src/meter.ts), [src/service.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/src/service.ts).
550
+
551
+ Evidence directory: [7 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/hq/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
552
+
542
553
  ### @stacksjs/http
543
554
 
544
555
  Guidance: [`stacks-http`](../stacks-http/SKILL.md). Source: [storage/framework/core/http/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/http/src/index.ts).
@@ -869,9 +880,11 @@ Evidence directory: [24 retained tests](https://github.com/stacksjs/stacks/blob/
869
880
 
870
881
  Guidance: [`stacks-repl`](../stacks-repl/SKILL.md). Source: [storage/framework/core/tinker/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts).
871
882
 
872
- Declared runtime exports: `appendHistory`, `clearHistory`, `getHistoryPath`, `readHistory`, `startTinker`, `tinkerEval`, `tinkerPrint`.
883
+ Declared runtime exports: `appendHistory`, `clearHistory`, `getHistoryPath`, `isIncompleteSnippet`, `readHistory`, `renderValue`, `startTinker`, `tinkerEval`, `tinkerPrint`.
884
+
885
+ Local source modules: [src/protocol.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/protocol.ts), [src/serialize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/serialize.ts), [src/session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/session.ts).
873
886
 
874
- Evidence directory: [1 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
887
+ Evidence directory: [2 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
875
888
 
876
889
  ### @stacksjs/tunnel
877
890
 
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: stacks-new-app
3
+ description: Use when starting a Stacks app with buddy new or structuring one in its first days - choosing feature bundles, picking free dev ports, laying out layouts, partials, components and page data, setting theme tokens, placing plan limits, or running the first verification loop. Covers buddy new, the starter under resources/, config/ui.ts and config/css.ts.
4
+ license: MIT
5
+ compatibility: Bun >= 1.3.0, TypeScript
6
+ allowed-tools: Read Edit Write Bash Grep Glob
7
+ ---
8
+
9
+ # From buddy new to a structured app
10
+
11
+ The path from an empty directory to an app with a shape worth building on. Each
12
+ step ends on something you can observe. Subsystem detail lives in the skill each
13
+ step names.
14
+
15
+ ## 1. Scaffold
16
+
17
+ ```bash
18
+ buddy new my-app # dashboard, marketing, monitoring, queue, realtime on
19
+ buddy new my-app --minimal # none of them; add back with ./buddy <feature>:install
20
+ ```
21
+
22
+ `buddy new --help` lists the flags, and every one of them does something.
23
+ `./buddy list` shows the `<feature>:install` commands. Commerce, cms and forms
24
+ are off in every new app until you install them; `--minimal` turns the rest
25
+ off too. Start `--minimal` when the app needs no admin dashboard or queue yet:
26
+ a bundle brings models, migrations and dashboard pages you would otherwise
27
+ carry and seed for nothing.
28
+
29
+ A feature that is off has no tables. That is by design: `./buddy migrate` skips
30
+ its migrations and says so (`Skipping N migration(s) for disabled features`).
31
+
32
+ What you get: the framework from npm (no `storage/framework/core`), a
33
+ gitignored `storage/framework/defaults` link, `.env` with a generated `APP_KEY`,
34
+ SQLite as the database (`DB_CONNECTION=sqlite`, the file is `database/stacks.sqlite`),
35
+ app-shaped CI in `.github/`, an `AGENTS.md`, and one commit holding all of it.
36
+
37
+ What you do not get: a domain, a design, a `CONTEXT.md`, `docs/`, a blog, or any
38
+ analytics, mail server, DNS or cloud target. `config/analytics.ts`,
39
+ `config/cloud.ts`, `config/dns.ts`, `config/email.ts` and `config/team.ts` start
40
+ empty on purpose, so nothing reaches an outside service until you fill them in.
41
+
42
+ Done when `git log --oneline` shows the scaffold commit and `git status` is clean.
43
+
44
+ ## 2. Pick ports, then boot
45
+
46
+ Another project may already hold 3000. Check before the first boot, because a
47
+ taken port is reassigned with one warning line that is easy to miss:
48
+
49
+ ```bash
50
+ lsof -nP -iTCP:3000 -sTCP:LISTEN
51
+ ```
52
+
53
+ Set the three in `.env` (`config/ports.ts` reads them), in a block no other app
54
+ on the machine uses:
55
+
56
+ ```
57
+ PORT=3270
58
+ PORT_API=3278
59
+ PORT_BACKEND=3271
60
+ ```
61
+
62
+ Then `./buddy dev`. Done when the boot prints your ports, no `[stx]` warning
63
+ line, and the Site URL renders the starter page. `stacks-development` covers
64
+ the dev server, the reverse proxy and `./buddy setup:ssl` for a pretty URL.
65
+
66
+ ## 3. Read the starter before replacing it
67
+
68
+ Four files, one of each kind, wired together:
69
+
70
+ | File | Role |
71
+ |---|---|
72
+ | `resources/views/layouts/default.stx` | The document shell: `<head>`, skip link, `<main>`, the `content` section |
73
+ | `resources/partials/head.stx` | The shared `<head>`. Title and canonical URL come from `config/app.ts` |
74
+ | `resources/components/NextStep.stx` | A component, used by tag name, reading `$props` |
75
+ | `resources/views/index.stx` | A page: extends `default`, fills `content` |
76
+
77
+ A page names itself by declaring `pageTitle`, `pageDescription` or
78
+ `canonicalPath` in its `<script server>`; the head partial reads them and falls
79
+ back to the site. Keep that contract when you restyle. `config/ui.ts` pins the
80
+ three folders stx scans. Layouts live in `resources/views/layouts`, the one
81
+ folder scanned.
82
+
83
+ ## 4. Give the app its structure
84
+
85
+ - **Layouts.** One per document shape (marketing, app, auth), not one per page.
86
+ Navigation and footer are components the layout places.
87
+ - **Partials** for fragments a layout includes (`head`). **Components** for
88
+ anything a page places by tag. Group components in one subfolder per area
89
+ (`Marketing/SiteNav.stx`); the tag stays `<SiteNav />`.
90
+ - **Page content in `resources/data/*.ts`.** Navigation items, feature lists,
91
+ pricing rows and site identity each live in one typed module that pages and
92
+ components import with `~/resources/data/<name>`. A string that appears on
93
+ two pages is defined once. Restart `./buddy dev` after editing a data module:
94
+ a view reloads, a module it imported is cached for the life of the process.
95
+ - **Theme tokens as CSS custom properties.** Define each color once in a
96
+ stylesheet under `public/assets/styles/`, with the dark value under
97
+ `prefers-color-scheme` (or the `dark` class), then expose it in `config/css.ts`:
98
+
99
+ ```ts
100
+ theme: { extend: { colors: { surface: 'var(--surface)', ink: 'var(--ink)', accent: 'var(--accent)' } } }
101
+ ```
102
+
103
+ `bg-surface text-ink` then follows light and dark with one class and no
104
+ `dark:` twin. Read `stacks-ts-css` for the engine and `stacks-design-taste`
105
+ before choosing the values.
106
+ - **Plan limits in one file.** When the app has plans, put every limit (seats,
107
+ storage, sends per month) in one module, for example `app/Billing/limits.ts`,
108
+ keyed by plan. The pricing page, the upgrade prompt and the action that
109
+ enforces the limit all import it, so a displayed limit and an enforced limit
110
+ cannot disagree. Amounts are integer minor units. `stacks-payments` covers
111
+ the plans themselves and `stacks-hq` the usage counters that meter them.
112
+
113
+ Done when each of layouts, partials, components and data has one real file and
114
+ no page carries a literal the data modules own.
115
+
116
+ ## 5. Name the domain before the first model
117
+
118
+ Write `CONTEXT.md` with `stacks-domain-modeling`: the nouns, what each means
119
+ here, and the words you rejected. Model names, table names and route names come
120
+ from it, and a rename after the first migration costs a migration. Then build
121
+ the first slice with `stacks-new-feature`.
122
+
123
+ An app that serves several tenants by hostname decides that now: read
124
+ `stacks-sites` before the first tenant-owned model, because the owner column and
125
+ the query scoping belong in that model's first migration.
126
+
127
+ ## 6. Verify, every time
128
+
129
+ ```bash
130
+ ./buddy lint
131
+ ./buddy typecheck
132
+ ./buddy test
133
+ ```
134
+
135
+ Run tests with the Bun the project pins (`./buddy test`, or `./pantry/.bin/bun
136
+ test` where Pantry installed it); a different Bun on PATH invents failures. Then
137
+ load the changed page in a real browser with `stacks-browse`: a 200 with an
138
+ empty component or an unstyled page passes all three commands.
139
+
140
+ Done when all three are clean and the browser shows what you changed, in light
141
+ and dark.
142
+
143
+ ## 7. Ship
144
+
145
+ `stacks-deploy` owns the deploy and `stacks-cloud` the target. Before the first
146
+ one: `APP_URL` is the real host, `config/cloud.ts` names where it runs, the DNS
147
+ record for every hostname the app answers exists (`./buddy dns <domain>` shows
148
+ what resolves), and `ANALYTICSHQ_SITE_ID` is set if you want analytics.
149
+
150
+ ## Gotchas
151
+
152
+ - **A view has exactly one layout.** An `@if` around two `@extends` lines does
153
+ not choose between them. Extend one layout and let it branch on a variable
154
+ the page declares.
155
+ - **A public route never resolves the signed-in user.** No auth middleware runs
156
+ on it, so `request.user()` is empty there even with a valid session. A page
157
+ that shows signed-in state asks an endpoint of its own that carries the auth
158
+ middleware. `stacks-auth` and `stacks-middleware` cover both sides.
159
+ - **`hidden` loses to a display utility.** `<div hidden class="flex">` stays
160
+ visible, because `flex` sets `display` and the attribute's rule is weaker. Put
161
+ `[hidden] { display: none !important; }` in the app stylesheet once.
162
+ - **Your own `app/Models` turns the built-in models off.** Once the app has a
163
+ model of its own, migrations are generated from `app/Models` alone. Set
164
+ `database.models.includeFrameworkDefaults` in `config/database.ts` to keep
165
+ generating the built-in ones the app still uses (`User`, `Team`, ...).
166
+ - **Run `./buddy generate:db-types` after migrating.** It refreshes
167
+ `database/types.d.ts`; without it rows from `db.selectFrom` on a new table
168
+ come back untyped.
169
+
170
+ - **A new view answers 404 until the dev server restarts.** Routes are generated
171
+ at boot.
172
+ - **Stay off dynamic bracket access in templates** and keep directive names out
173
+ of layout comments. Both fail quietly; `stacks-stx` has the exact shapes.
174
+ - **A problem in the framework or one of its packages is fixed there.** Read
175
+ `stacks-upstream` instead of working around it in the app.
@@ -50,55 +50,73 @@ import type { TinkerConfig } from '@stacksjs/repl'
50
50
  ## CLI Commands
51
51
 
52
52
  ```bash
53
- buddy tinker # Start interactive REPL session
54
- buddy tinker --load file.ts # Preload a file before starting
53
+ buddy tinker # interactive prompt, app booted
54
+ buddy tinker --print 'await User.count()' # evaluate, print the value, exit
55
+ buddy tinker --eval 'await seed()' # evaluate, exit, print nothing
56
+ buddy tinker --project ../other-app # run in another project directory
57
+ buddy tinker --bare # plain Bun session, app not booted
58
+ buddy tinker --serve # frame protocol on stdio, for tools
59
+ buddy tinker --preload ./setup.ts,pkg # import modules as globals first
60
+ buddy tinker --verbose # also show queries and log lines
55
61
  ```
56
62
 
57
- ## Usage
63
+ There is no `--load` flag, and tinker is the only command: nothing is registered under the name repl.
58
64
 
59
- Inside the REPL, all framework modules are available:
65
+ ## How a session works
60
66
 
61
- ```typescript
62
- // Query the database
63
- const users = await db.selectFrom('users').get()
67
+ `createTinkerSession({ cwd, boot })` in `@stacksjs/tinker` runs in the current
68
+ process. It awaits `overridesReady` from `@stacksjs/config`, then calls
69
+ `injectGlobalAutoImports()` from `@stacksjs/server`, which is the same boot the
70
+ server, the scheduler and the desktop agent use. So the globals are exactly the
71
+ app's: its models, jobs and the framework helpers. Nothing extra is preloaded,
72
+ `faker` included; import what the app does not make global.
64
73
 
65
- // Use models
66
- const post = await Post.find(1)
74
+ `session.evaluate(code)` compiles TypeScript with Bun's REPL transform and
75
+ evaluates it at global scope:
67
76
 
68
- // Access config
69
- console.log(config.app.name)
77
+ - several statements work, and the last expression is the result;
78
+ - `const`, `let`, functions, classes and imports persist to the next call, and
79
+ a name can be declared again;
80
+ - top-level `await` works;
81
+ - a relative `import('./x')` resolves against the session's directory;
82
+ - nothing is written to the project.
70
83
 
71
- // Use faker for quick testing
72
- const email = faker.internet.email()
73
- ```
84
+ It resolves with `{ ok, value, thrown, frames, durationMs }` and never rejects
85
+ for the snippet's own failure. Frames are what happened, in order: `stdout`,
86
+ `stderr`, `log`, `query` (sql, params, duration, row count), `dump`, then
87
+ `result` or `error`, then `done`. Values in frames are described by
88
+ `serialize()`: a bounded, JSON-safe tree that keeps undefined, bigint, Date,
89
+ Map, Set, class names, cycles and errors, and records every cut.
90
+
91
+ `dump(value)` emits a frame. `dd(value)` dumps and stops the current run; it
92
+ does not exit the process.
93
+
94
+ ## The frame protocol (`--serve`)
95
+
96
+ One JSON request per line on stdin: `{ "op": "eval", "id": "a", "code": "..." }`,
97
+ `{ "op": "ping" }`, `{ "op": "exit" }`. One frame per line on stdout, each line
98
+ starting with the record separator `\x1E`; the first is `ready` with the
99
+ session info and protocol version. A line without the marker is stray output,
100
+ not a frame. Use `createFrameReader()` to split a stream. `--serve` with
101
+ `--eval` or `--print` evaluates once and exits, which suits `ssh -T`,
102
+ `docker exec -i` and `kubectl exec -i`.
74
103
 
75
104
  ## Gotchas
76
- - **Tinker is the user-facing command, REPL is the engine** - `buddy tinker` calls `startRepl()` under the hood
77
- - **All framework imports available** - models, database, config, faker, etc. are preloaded
78
- - **History is persisted** - REPL history is saved to disk via `getHistoryPath()`
79
- - **File loading** - loadFile is composed into eval in the current wrapper and may select non-interactive mode; inspect that contract before expecting a prompt
80
- - **Bun runtime** - the REPL runs in Bun's JavaScript runtime, not Node.js
81
-
82
-
83
- ## Native options and bootstrap limits
84
-
85
- ReplConfig also exposes bootstrap and showRoutes; startBunRepl delegates directly
86
- to startTinker. TinkerConfig supports eval/print, cwd, custom preload, history
87
- options and a banner setting. tinkerEval/tinkerPrint return the subprocess exit
88
- code, not the JavaScript expression's value. The configured database is real;
89
- REPL mutations are not automatically isolated test data.
90
-
91
- The current startRepl implementation combines loadFile/bootstrap/showRoutes
92
- into tinkerConfig.eval. startTinker treats nonempty eval as non-interactive,
93
- so do not promise those options perform setup and then leave a prompt open.
94
- Use a normal startRepl session and explicit imports when that behavior matters,
95
- or inspect the selected CLI wrapper before supplying an eval script.
96
-
97
- Preload globals are assembled by the REPL and may be absent when their import
98
- fails; this is a special interactive context, not the normal application's
99
- automatic-global list. History is persisted under getHistoryPath and defaults
100
- to .stacks_tinker_history in the home directory, with owner-only permissions
101
- when created. Avoid evaluating or retaining secrets in history.
102
-
103
- Source: `storage/framework/core/repl/src/index.ts` and core/tinker/src/index.ts.
104
- Tests: core/repl/tests/repl.test.ts and the tinker package's existing tests.
105
+
106
+ - **The database is real.** Mutations are not isolated or rolled back.
107
+ - **A returned model is described by its own fields**, hidden ones included.
108
+ Do not paste results from production data without looking.
109
+ - **Error positions refer to the compiled snippet**, not the typed source.
110
+ - **One evaluation at a time.** Calls queue; they share globals.
111
+ - **A session captures `console` and `process.stdout`/`stderr`** for its whole
112
+ life and changes the working directory. Run one per process and call
113
+ `dispose()` when embedding it.
114
+ - **History** is written by the interactive prompt to `getHistoryPath()`
115
+ (`~/.stacks_tinker_history`, owner-only). Avoid typing secrets.
116
+ - **`startRepl` options `loadFile`, `bootstrap` and `showRoutes`** are folded
117
+ into `eval`, so they run and exit instead of leaving a prompt open.
118
+ - `tinkerEval` and `tinkerPrint` resolve with an exit code, not the value. Use
119
+ a session when the value is wanted.
120
+
121
+ Source: `storage/framework/core/tinker/src/{index,session,serialize,protocol}.ts`
122
+ and `core/repl/src/index.ts`. Tests: `core/tinker/tests/session.test.ts`.
@@ -19,7 +19,7 @@ When the task is how a page should *look* (not just how stx renders), pair this
19
19
  - STX plugin: `bun-plugin-stx` (loaded via bunfig.toml)
20
20
  - STX build cache + route manifest: `storage/framework/stx/` (stx's `stateDir`, set in `config/ui.ts`)
21
21
  - Components: `resources/components/`
22
- - Layouts: `resources/layouts/`
22
+ - Layouts: `resources/views/layouts/` (the one folder scanned when it exists; `resources/layouts/` only in an app without it)
23
23
  - Partials: `resources/partials/`
24
24
  - Views: `resources/views/`
25
25
  - Package: `@stacksjs/stx`
@@ -153,7 +153,7 @@ import type { StxOptions } from '@stacksjs/stx'
153
153
 
154
154
  export default {
155
155
  componentsDir: 'components',
156
- layoutsDir: 'layouts',
156
+ layoutsDir: 'views/layouts',
157
157
  partialsDir: 'partials',
158
158
  } satisfies StxOptions
159
159
  ```
@@ -335,4 +335,8 @@ await addLayout('admin', { nav: true, footer: true })
335
335
  - **Pre-paint state** - use `@appearanceBootstrap`, never a raw browser script in the template
336
336
  - **Components go in `resources/`** - not in `app/` or `storage/`
337
337
  - **SEO directives take expressions** - `@seo(seo)`, `@meta('author', post.author)` and `@structuredData(product)` are evaluated; a failure shows up as an inline `<!-- [... Error] -->` comment plus a `[stx]` console warning naming the file, never as silent emptiness. Keep `@seo` inside `<head>`
338
+ - **Dynamic bracket access renders empty** - `{{ labels[item.key] }}` prints an empty string, because the safe evaluator rejects a bracket whose key is a member expression. A bare identifier key (`{{ labels[key] }}`) and dot access (`{{ labels.a }}`) work. The dev log says `stx warning: {{ labels[item.key] }} rendered as an empty string` and names the layout file, not the page. Compute the value in `<script server>` (`items.map(item => ({ ...item, label: labels[item.key] }))`) and interpolate the result. Verified on stx 0.2.842
339
+ - **`{{ value }}` inside `<script client>` is already serialized** - `const tags = {{ tags }}` arrives as `const tags = ["draft", "published"];`. Wrapping it, `{{ JSON.stringify(tags) }}`, hands the client the string `'["draft","published"]'`, which half-works: `.includes('draft')` matches a substring and `.length` counts characters. Interpolate the server value bare. Verified on stx 0.2.842
340
+ - **A layout comment is not inert before stx 0.2.854** - layout source is read for `@extends` and `@layout` before `{{-- --}}` comments are stripped, so a layout whose comment spells out its own extends line extends itself, and the first request spins the dev server at full CPU without answering. Describe directives in a comment without the at sign
341
+ - **A new view needs a dev-server restart** - routes are generated at boot, so a `.stx` file added under `resources/views` answers 404 until `./buddy dev` is restarted. Edits to an existing view reload
338
342
  - **118+ modules** - STX is a comprehensive framework covering rendering, routing, forms, i18n, SEO, PWA, and more