@stacksjs/defaults 0.70.206 → 0.70.208
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.
- package/TODO.md +21 -0
- package/ai/AGENTS.md +79 -0
- package/ai/README.md +45 -0
- package/ai/claude/launch.json +12 -0
- package/ai/skills/stacks-actions/SKILL.md +128 -0
- package/ai/skills/stacks-ai/SKILL.md +276 -0
- package/ai/skills/stacks-alias/SKILL.md +94 -0
- package/ai/skills/stacks-analytics/SKILL.md +91 -0
- package/ai/skills/stacks-api/SKILL.md +738 -0
- package/ai/skills/stacks-arrays/SKILL.md +277 -0
- package/ai/skills/stacks-auth/SKILL.md +422 -0
- package/ai/skills/stacks-auto-imports/SKILL.md +138 -0
- package/ai/skills/stacks-brandkit/SKILL.md +811 -0
- package/ai/skills/stacks-browse/SKILL.md +127 -0
- package/ai/skills/stacks-browse/scripts/browse.ts +492 -0
- package/ai/skills/stacks-browser/SKILL.md +145 -0
- package/ai/skills/stacks-buddy/SKILL.md +676 -0
- package/ai/skills/stacks-build/SKILL.md +163 -0
- package/ai/skills/stacks-cache/SKILL.md +125 -0
- package/ai/skills/stacks-calendar/SKILL.md +113 -0
- package/ai/skills/stacks-chat/SKILL.md +371 -0
- package/ai/skills/stacks-cli/SKILL.md +112 -0
- package/ai/skills/stacks-cloud/SKILL.md +192 -0
- package/ai/skills/stacks-cms/SKILL.md +217 -0
- package/ai/skills/stacks-collections/SKILL.md +82 -0
- package/ai/skills/stacks-commerce/SKILL.md +114 -0
- package/ai/skills/stacks-composables/SKILL.md +161 -0
- package/ai/skills/stacks-config/SKILL.md +144 -0
- package/ai/skills/stacks-configuration/SKILL.md +154 -0
- package/ai/skills/stacks-cron/SKILL.md +123 -0
- package/ai/skills/stacks-crosswind/SKILL.md +190 -0
- package/ai/skills/stacks-dashboard/SKILL.md +173 -0
- package/ai/skills/stacks-database/SKILL.md +286 -0
- package/ai/skills/stacks-datetime/SKILL.md +269 -0
- package/ai/skills/stacks-dependencies/SKILL.md +111 -0
- package/ai/skills/stacks-deploy/SKILL.md +102 -0
- package/ai/skills/stacks-design-brutalist/SKILL.md +110 -0
- package/ai/skills/stacks-design-minimalist/SKILL.md +115 -0
- package/ai/skills/stacks-design-output/SKILL.md +55 -0
- package/ai/skills/stacks-design-soft/SKILL.md +156 -0
- package/ai/skills/stacks-design-taste/SKILL.md +1012 -0
- package/ai/skills/stacks-design-taste-codex/SKILL.md +294 -0
- package/ai/skills/stacks-desktop/SKILL.md +78 -0
- package/ai/skills/stacks-development/SKILL.md +298 -0
- package/ai/skills/stacks-dns/SKILL.md +149 -0
- package/ai/skills/stacks-docs/SKILL.md +109 -0
- package/ai/skills/stacks-email/SKILL.md +236 -0
- package/ai/skills/stacks-enums/SKILL.md +100 -0
- package/ai/skills/stacks-env/SKILL.md +181 -0
- package/ai/skills/stacks-error-handling/SKILL.md +137 -0
- package/ai/skills/stacks-events/SKILL.md +228 -0
- package/ai/skills/stacks-faker/SKILL.md +158 -0
- package/ai/skills/stacks-git/SKILL.md +158 -0
- package/ai/skills/stacks-guard/SKILL.md +98 -0
- package/ai/skills/stacks-health/SKILL.md +75 -0
- package/ai/skills/stacks-http/SKILL.md +316 -0
- package/ai/skills/stacks-i18n/SKILL.md +198 -0
- package/ai/skills/stacks-image-to-code/SKILL.md +629 -0
- package/ai/skills/stacks-imagegen-mobile/SKILL.md +1474 -0
- package/ai/skills/stacks-imagegen-web/SKILL.md +998 -0
- package/ai/skills/stacks-investigate/SKILL.md +119 -0
- package/ai/skills/stacks-jobs/SKILL.md +136 -0
- package/ai/skills/stacks-lint/SKILL.md +184 -0
- package/ai/skills/stacks-listeners/SKILL.md +99 -0
- package/ai/skills/stacks-logging/SKILL.md +78 -0
- package/ai/skills/stacks-mail/SKILL.md +120 -0
- package/ai/skills/stacks-middleware/SKILL.md +249 -0
- package/ai/skills/stacks-migrations/SKILL.md +105 -0
- package/ai/skills/stacks-models/SKILL.md +267 -0
- package/ai/skills/stacks-new-feature/SKILL.md +206 -0
- package/ai/skills/stacks-notifications/SKILL.md +210 -0
- package/ai/skills/stacks-objects/SKILL.md +205 -0
- package/ai/skills/stacks-office-hours/SKILL.md +134 -0
- package/ai/skills/stacks-orm/SKILL.md +342 -0
- package/ai/skills/stacks-path/SKILL.md +118 -0
- package/ai/skills/stacks-payments/SKILL.md +373 -0
- package/ai/skills/stacks-plan-review/SKILL.md +152 -0
- package/ai/skills/stacks-plugins/SKILL.md +149 -0
- package/ai/skills/stacks-push/SKILL.md +376 -0
- package/ai/skills/stacks-query-builder/SKILL.md +128 -0
- package/ai/skills/stacks-queue/SKILL.md +559 -0
- package/ai/skills/stacks-realtime/SKILL.md +442 -0
- package/ai/skills/stacks-redesign/SKILL.md +182 -0
- package/ai/skills/stacks-registry/SKILL.md +58 -0
- package/ai/skills/stacks-repl/SKILL.md +80 -0
- package/ai/skills/stacks-retro/SKILL.md +122 -0
- package/ai/skills/stacks-review/SKILL.md +135 -0
- package/ai/skills/stacks-router/SKILL.md +231 -0
- package/ai/skills/stacks-routes/SKILL.md +105 -0
- package/ai/skills/stacks-scaffolding/SKILL.md +162 -0
- package/ai/skills/stacks-scheduler/SKILL.md +363 -0
- package/ai/skills/stacks-search-engine/SKILL.md +112 -0
- package/ai/skills/stacks-security/SKILL.md +129 -0
- package/ai/skills/stacks-security-audit/SKILL.md +128 -0
- package/ai/skills/stacks-server/SKILL.md +458 -0
- package/ai/skills/stacks-shell/SKILL.md +62 -0
- package/ai/skills/stacks-slug/SKILL.md +87 -0
- package/ai/skills/stacks-sms/SKILL.md +385 -0
- package/ai/skills/stacks-socials/SKILL.md +303 -0
- package/ai/skills/stacks-storage/SKILL.md +576 -0
- package/ai/skills/stacks-strings/SKILL.md +416 -0
- package/ai/skills/stacks-stx/SKILL.md +176 -0
- package/ai/skills/stacks-technical-diagrams/LICENSE +22 -0
- package/ai/skills/stacks-technical-diagrams/SKILL.md +290 -0
- package/ai/skills/stacks-technical-diagrams/agents/openai.yaml +4 -0
- package/ai/skills/stacks-technical-diagrams/assets/template.html +1252 -0
- package/ai/skills/stacks-technical-diagrams/bin/technical-diagrams.mjs +289 -0
- package/ai/skills/stacks-technical-diagrams/bunfig.toml +1 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-run.lifecycle.json +64 -0
- package/ai/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json +88 -0
- package/ai/skills/stacks-technical-diagrams/examples/cache-miss-request.sequence.json +75 -0
- package/ai/skills/stacks-technical-diagrams/examples/product-analytics.dataflow.json +70 -0
- package/ai/skills/stacks-technical-diagrams/examples/web-app.architecture.json +41 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/grid.mjs +62 -0
- package/ai/skills/stacks-technical-diagrams/renderers/architecture/render-architecture.mjs +371 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/README.md +82 -0
- package/ai/skills/stacks-technical-diagrams/renderers/dataflow/render-dataflow.mjs +295 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/README.md +91 -0
- package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/render-lifecycle.mjs +384 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/README.md +84 -0
- package/ai/skills/stacks-technical-diagrams/renderers/sequence/render-sequence.mjs +257 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/cli.mjs +42 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-validators.mjs +13 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/geometry.mjs +230 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/layout-report.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/utils.mjs +88 -0
- package/ai/skills/stacks-technical-diagrams/renderers/shared/validator.mjs +40 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/README.md +103 -0
- package/ai/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs +481 -0
- package/ai/skills/stacks-technical-diagrams/schemas/README.md +68 -0
- package/ai/skills/stacks-technical-diagrams/schemas/architecture.schema.json +121 -0
- package/ai/skills/stacks-technical-diagrams/schemas/common.schema.json +43 -0
- package/ai/skills/stacks-technical-diagrams/schemas/dataflow.schema.json +221 -0
- package/ai/skills/stacks-technical-diagrams/schemas/lifecycle.schema.json +241 -0
- package/ai/skills/stacks-technical-diagrams/schemas/sequence.schema.json +186 -0
- package/ai/skills/stacks-technical-diagrams/schemas/workflow.schema.json +332 -0
- package/ai/skills/stacks-technical-diagrams/scripts/check-render-output.mjs +297 -0
- package/ai/skills/stacks-technical-diagrams/scripts/render-examples.mjs +28 -0
- package/ai/skills/stacks-testing/SKILL.md +129 -0
- package/ai/skills/stacks-tunnel/SKILL.md +125 -0
- package/ai/skills/stacks-types/SKILL.md +178 -0
- package/ai/skills/stacks-ui/SKILL.md +246 -0
- package/ai/skills/stacks-utils/SKILL.md +444 -0
- package/ai/skills/stacks-validation/SKILL.md +371 -0
- package/ai/skills/stacks-whois/SKILL.md +315 -0
- package/assets/world-map-data.ts +121 -0
- package/bootstrap.ts +114 -0
- package/docs/api-examples.md +46 -0
- package/docs/index.md +24 -0
- package/docs/markdown-examples.md +87 -0
- package/functions/analytics.ts +97 -0
- package/functions/api.ts +143 -0
- package/functions/auth.ts +208 -0
- package/functions/billing/payments.ts +149 -0
- package/functions/blog.ts +120 -0
- package/functions/cms/categorizables.ts +107 -0
- package/functions/cms/pages.ts +108 -0
- package/functions/cms/posts.ts +100 -0
- package/functions/cms/taggables.ts +102 -0
- package/functions/commerce/coupons.ts +128 -0
- package/functions/commerce/customers.ts +128 -0
- package/functions/commerce/gift-cards.ts +119 -0
- package/functions/commerce/orders.ts +112 -0
- package/functions/commerce/payments.ts +119 -0
- package/functions/commerce/products/categories.ts +123 -0
- package/functions/commerce/products/manufacturers.ts +123 -0
- package/functions/commerce/products/products.ts +123 -0
- package/functions/commerce/products/reviews.ts +123 -0
- package/functions/commerce/products/units.ts +123 -0
- package/functions/commerce/products/variants.ts +123 -0
- package/functions/commerce/shippings/delivery-routes.ts +123 -0
- package/functions/commerce/shippings/digital-deliveries.ts +119 -0
- package/functions/commerce/shippings/drivers.ts +123 -0
- package/functions/commerce/shippings/license-keys.ts +123 -0
- package/functions/commerce/shippings/shipping-methods.ts +123 -0
- package/functions/commerce/shippings/shipping-rates.ts +119 -0
- package/functions/commerce/shippings/shipping-zones.ts +119 -0
- package/functions/commerce/taxes.ts +119 -0
- package/functions/commerce/waitlist/products.ts +123 -0
- package/functions/commerce/waitlist/restaurants.ts +123 -0
- package/functions/craft.ts +107 -0
- package/functions/dashboard.ts +153 -0
- package/functions/inbox.ts +95 -0
- package/functions/jobs.ts +86 -0
- package/functions/monitoring/errors.ts +295 -0
- package/functions/queue.ts +111 -0
- package/functions/realtime/websockets.ts +96 -0
- package/functions/realtime.ts +52 -0
- package/functions/releases.ts +49 -0
- package/functions/search.ts +126 -0
- package/functions/toasts.ts +95 -0
- package/functions/uploads.ts +216 -0
- package/ide/.gitignore +4 -0
- package/ide/cursor/rules/auto-imports.mdc +574 -0
- package/ide/cursor/rules/code-style.mdc +12 -0
- package/ide/cursor/rules/documentation.mdc +9 -0
- package/ide/cursor/rules/error-handling-validation.mdc +11 -0
- package/ide/cursor/rules/key-conventions.mdc +11 -0
- package/ide/cursor/rules/project-structure.mdc +169 -0
- package/ide/cursor/rules/readme.mdc +318 -0
- package/ide/cursor/rules/syntax-formatting.mdc +9 -0
- package/ide/cursor/rules/testing.mdc +10 -0
- package/ide/cursor/rules/typescript.mdc +9 -0
- package/ide/cursor/rules/ui-styling.mdc +0 -0
- package/ide/dictionary.txt +397 -0
- package/ide/jetbrains/.fleet/settings.json +4 -0
- package/ide/jetbrains/.idea/.gitignore +5 -0
- package/ide/jetbrains/.idea/.name +1 -0
- package/ide/jetbrains/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/ide/jetbrains/.idea/jsLinters/eslint.xml +7 -0
- package/ide/jetbrains/.idea/modules.xml +8 -0
- package/ide/jetbrains/.idea/stacks.iml +22 -0
- package/ide/jetbrains/.idea/vcs.xml +6 -0
- package/ide/jetbrains/.idea/webResources.xml +14 -0
- package/ide/jetbrains/IntelliJ IDEA Global Settings +0 -0
- package/ide/jetbrains/installed.txt +4 -0
- package/ide/jetbrains/options/github-copilot.xml +5 -0
- package/ide/jetbrains/options/nodejs.xml +7 -0
- package/ide/jetbrains/options/templates.xml +124 -0
- package/ide/jetbrains/templates/JavaScript.xml +6 -0
- package/ide/jetbrains/templates/Stacks.xml +8 -0
- package/ide/vscode/.vscode/README.md +23 -0
- package/ide/vscode/.vscode/extensions.json +5 -0
- package/ide/vscode/.vscode/settings.json +176 -0
- package/ide/vscode/.vscode/stacks.code-snippets +181 -0
- package/ide/vscode/LICENSE.md +21 -0
- package/ide/vscode/README.md +36 -0
- package/ide/vscode/logo.png +0 -0
- package/ide/vscode/package.json +79 -0
- package/ide/zed/.zed/settings.json +139 -0
- package/lang/README.md +28 -0
- package/lang/de.yml +14 -0
- package/lang/en.yml +15 -0
- package/package.json +19 -3
- package/project/bootstrap +161 -0
- package/project/buddy +175 -0
- package/project/storage/framework/tsconfig.app.json +50 -0
- package/project/storage/framework/tsconfig.base.json +58 -0
- package/routes/core.ts +78 -0
- package/routes/dashboard-api.ts +233 -0
- package/routes/dashboard.ts +739 -0
- package/routes/email.ts +129 -0
- package/stores/[name].stx +16 -0
- package/stores/git.ts +71 -0
- package/stores/payment.ts +474 -0
- package/stores/queue.ts +43 -0
- package/stores/user.ts +29 -0
- package/stx-components-plugin.ts +25 -0
- package/styles/design-tokens.css +597 -0
- package/types/dashboard.ts +70 -0
- package/types/defaults.ts +438 -0
- package/vcs/github/CODE_OF_CONDUCT.md +83 -0
- package/vcs/github/CONTRIBUTING.md +187 -0
- package/vcs/github/EXPLANATIONS.md +41 -0
- package/vcs/github/FUNDING.yml +1 -0
- package/vcs/github/ISSUE_TEMPLATE/bug_report.yml +49 -0
- package/vcs/github/ISSUE_TEMPLATE/config.yml +10 -0
- package/vcs/github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/vcs/github/SECURITY.md +70 -0
- package/vcs/github/renovate.json +5 -0
- package/vcs/github/stale.yml +14 -0
- package/vcs/github/workflows/README.md +16 -0
- package/vcs/github/workflows/ci.yml +114 -0
- package/vcs/github/workflows/export-size.yml +25 -0
- package/vcs/github/workflows/labeler.yml +13 -0
- package/vcs/github/workflows/release.yml +219 -0
- package/views/[...all].stx +8 -0
- package/views/about.md +3 -0
- package/views/auth/login.stx +1 -0
- package/views/auth/signup.stx +85 -0
- package/views/dashboard/.discovered-models.json +542 -0
- package/views/dashboard/AUDIT.md +904 -0
- package/views/dashboard/[...all].stx +89 -0
- package/views/dashboard/access-tokens/index.stx +177 -0
- package/views/dashboard/actions/index.stx +129 -0
- package/views/dashboard/analytics/blog/index.stx +356 -0
- package/views/dashboard/analytics/browsers/index.stx +263 -0
- package/views/dashboard/analytics/commerce/sales/index.stx +329 -0
- package/views/dashboard/analytics/commerce/web/index.stx +379 -0
- package/views/dashboard/analytics/countries/index.stx +289 -0
- package/views/dashboard/analytics/devices/index.stx +305 -0
- package/views/dashboard/analytics/events/index.stx +536 -0
- package/views/dashboard/analytics/index.stx +88 -0
- package/views/dashboard/analytics/marketing/index.stx +315 -0
- package/views/dashboard/analytics/pages/index.stx +271 -0
- package/views/dashboard/analytics/referrers/index.stx +319 -0
- package/views/dashboard/analytics/web/index.stx +356 -0
- package/views/dashboard/buddy/index.stx +198 -0
- package/views/dashboard/ci/index.stx +462 -0
- package/views/dashboard/cloud/index.stx +452 -0
- package/views/dashboard/commands/index.stx +295 -0
- package/views/dashboard/commerce/categories/index.stx +406 -0
- package/views/dashboard/commerce/coupons/index.stx +485 -0
- package/views/dashboard/commerce/customers/index.stx +410 -0
- package/views/dashboard/commerce/dashboard/index.stx +287 -0
- package/views/dashboard/commerce/delivery/delivery-routes.stx +305 -0
- package/views/dashboard/commerce/delivery/digital-delivery.stx +332 -0
- package/views/dashboard/commerce/delivery/drivers.stx +397 -0
- package/views/dashboard/commerce/delivery/index.stx +18 -0
- package/views/dashboard/commerce/delivery/license-keys.stx +380 -0
- package/views/dashboard/commerce/delivery/shipping-methods.stx +346 -0
- package/views/dashboard/commerce/delivery/shipping-rates.stx +338 -0
- package/views/dashboard/commerce/delivery/shipping-zones.stx +302 -0
- package/views/dashboard/commerce/delivery/tabs.ts +25 -0
- package/views/dashboard/commerce/gift-cards/index.stx +561 -0
- package/views/dashboard/commerce/manufacturers/index.stx +308 -0
- package/views/dashboard/commerce/orders/index.stx +247 -0
- package/views/dashboard/commerce/payments/index.stx +535 -0
- package/views/dashboard/commerce/pos/index.stx +653 -0
- package/views/dashboard/commerce/printers/devices/index.stx +273 -0
- package/views/dashboard/commerce/printers/receipts/index.stx +308 -0
- package/views/dashboard/commerce/products/detail.stx +563 -0
- package/views/dashboard/commerce/products/index.stx +370 -0
- package/views/dashboard/commerce/reviews/index.stx +656 -0
- package/views/dashboard/commerce/reviews/index.ts +0 -0
- package/views/dashboard/commerce/taxes/index.stx +377 -0
- package/views/dashboard/commerce/units/index.stx +317 -0
- package/views/dashboard/commerce/variants/index.stx +319 -0
- package/views/dashboard/commerce/waitlist/products.stx +942 -0
- package/views/dashboard/commerce/waitlist/restaurant.stx +1024 -0
- package/views/dashboard/components/index.stx +330 -0
- package/views/dashboard/composables/index.ts +19 -0
- package/views/dashboard/composables/useChart.ts +77 -0
- package/views/dashboard/composables/useNavigation.ts +99 -0
- package/views/dashboard/composables/useRole.ts +58 -0
- package/views/dashboard/composables/useTheme.ts +74 -0
- package/views/dashboard/content/authors/index.stx +171 -0
- package/views/dashboard/content/blog/index.stx +493 -0
- package/views/dashboard/content/categories/index.stx +169 -0
- package/views/dashboard/content/comments/index.stx +189 -0
- package/views/dashboard/content/dashboard.stx +383 -0
- package/views/dashboard/content/files/index.stx +706 -0
- package/views/dashboard/content/pages/index.stx +174 -0
- package/views/dashboard/content/posts/index.stx +269 -0
- package/views/dashboard/content/seo/index.stx +240 -0
- package/views/dashboard/content/tags/index.stx +167 -0
- package/views/dashboard/data/activity/index.stx +261 -0
- package/views/dashboard/data/dashboard/index.stx +116 -0
- package/views/dashboard/data/subscribers.stx +270 -0
- package/views/dashboard/data/teams.stx +275 -0
- package/views/dashboard/data/users.stx +279 -0
- package/views/dashboard/dependencies/index.stx +178 -0
- package/views/dashboard/deployments/[id].stx +234 -0
- package/views/dashboard/deployments/index.stx +9 -0
- package/views/dashboard/dns/index.stx +163 -0
- package/views/dashboard/environment/index.stx +283 -0
- package/views/dashboard/errors/index.stx +274 -0
- package/views/dashboard/forgot-password.stx +57 -0
- package/views/dashboard/functions/index.stx +159 -0
- package/views/dashboard/health/index.stx +248 -0
- package/views/dashboard/inbox/activity.stx +350 -0
- package/views/dashboard/inbox/index.stx +452 -0
- package/views/dashboard/inbox/settings.stx +290 -0
- package/views/dashboard/index.stx +252 -0
- package/views/dashboard/insights/index.stx +529 -0
- package/views/dashboard/jobs/[id].stx +430 -0
- package/views/dashboard/jobs/history.stx +222 -0
- package/views/dashboard/jobs/index.stx +214 -0
- package/views/dashboard/kanban/[id].stx +899 -0
- package/views/dashboard/kanban/index.stx +260 -0
- package/views/dashboard/layouts/default.stx +565 -0
- package/views/dashboard/layouts/guest.stx +10 -0
- package/views/dashboard/login.stx +48 -0
- package/views/dashboard/logs/index.stx +540 -0
- package/views/dashboard/mailboxes/index.stx +149 -0
- package/views/dashboard/management/permissions/index.stx +490 -0
- package/views/dashboard/marketing/campaigns/index.stx +604 -0
- package/views/dashboard/marketing/lists/index.stx +514 -0
- package/views/dashboard/marketing/reviews/index.stx +475 -0
- package/views/dashboard/marketing/social-posts/index.stx +560 -0
- package/views/dashboard/models/[model].stx +195 -0
- package/views/dashboard/models/index.stx +159 -0
- package/views/dashboard/monitoring/errors/index.stx +415 -0
- package/views/dashboard/notifications/dashboard.stx +383 -0
- package/views/dashboard/notifications/email.stx +336 -0
- package/views/dashboard/notifications/history.stx +373 -0
- package/views/dashboard/notifications/sms.stx +332 -0
- package/views/dashboard/packages/index.stx +195 -0
- package/views/dashboard/queries/[id].stx +381 -0
- package/views/dashboard/queries/history.stx +227 -0
- package/views/dashboard/queries/index.stx +335 -0
- package/views/dashboard/queries/slow.stx +318 -0
- package/views/dashboard/queue/index.stx +427 -0
- package/views/dashboard/realtime/index.stx +429 -0
- package/views/dashboard/register.stx +46 -0
- package/views/dashboard/releases/index.stx +389 -0
- package/views/dashboard/requests/index.stx +462 -0
- package/views/dashboard/serverless/index.stx +475 -0
- package/views/dashboard/servers/[id].stx +299 -0
- package/views/dashboard/servers/index.stx +483 -0
- package/views/dashboard/settings/billing.stx +50 -0
- package/views/dashboard/settings/index.stx +256 -0
- package/views/dashboard/settings/mail.stx +252 -0
- package/views/dashboard/stores/auth.ts +123 -0
- package/views/dashboard/stores/ci.ts +342 -0
- package/views/dashboard/stores/index.ts +129 -0
- package/views/dashboard/stores/kanban.ts +723 -0
- package/views/dashboard/stores/rbac.ts +350 -0
- package/views/dashboard/stx.config.ts +34 -0
- package/views/dashboard/teams/[id].stx +170 -0
- package/views/forum/category.stx +92 -0
- package/views/forum/index.stx +209 -0
- package/views/forum/new-topic.stx +113 -0
- package/views/forum/profile.stx +1 -0
- package/views/forum/topic.stx +143 -0
- package/views/hello-world/[name].stx +47 -0
- package/views/index.stx +21 -0
- package/views/system-tray/index.stx +147 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-registry
|
|
3
|
+
description: Use when working with the Stacks extension registry — framework extension metadata, package discovery, or the registry system. Covers @stacksjs/registry.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Registry
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Core package: `storage/framework/core/registry/src/`
|
|
13
|
+
- Config: `config/stacks.ts`
|
|
14
|
+
- Package: `@stacksjs/registry`
|
|
15
|
+
|
|
16
|
+
## Source Files
|
|
17
|
+
```
|
|
18
|
+
registry/src/
|
|
19
|
+
└── index.ts # Registry definition and exports
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { registry } from '@stacksjs/registry'
|
|
26
|
+
import type { Registry } from '@stacksjs/registry'
|
|
27
|
+
|
|
28
|
+
type Registry = StackExtensionRegistry
|
|
29
|
+
|
|
30
|
+
const registry: Registry = [
|
|
31
|
+
{
|
|
32
|
+
name: 'stacks',
|
|
33
|
+
url: 'stacksjs.com',
|
|
34
|
+
github: 'stacksjs/stacks',
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
export default registry
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The registry is a simple array of `StackExtensionRegistry` entries containing framework extension metadata — name, URL, and GitHub repository.
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { registry } from '@stacksjs/registry'
|
|
47
|
+
|
|
48
|
+
// Access extension metadata
|
|
49
|
+
registry.forEach(ext => {
|
|
50
|
+
console.log(ext.name, ext.url, ext.github)
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Gotchas
|
|
55
|
+
- **Minimal package** — currently just a static array with the core Stacks framework entry
|
|
56
|
+
- **Type comes from `@stacksjs/types`** — `StackExtensionRegistry` is defined in the types package
|
|
57
|
+
- **Used for framework metadata** — not a package manager or dependency registry
|
|
58
|
+
- **Config in `config/stacks.ts`** — the `StackExtensionRegistry` config is defined there
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-repl
|
|
3
|
+
description: Use when working with the Stacks REPL — interactive TypeScript sessions, tinker sessions, debugging, or exploring the framework interactively. Covers @stacksjs/repl and @stacksjs/tinker.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks REPL / Tinker
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- REPL package: `storage/framework/core/repl/src/`
|
|
13
|
+
- Tinker package: `storage/framework/core/tinker/src/`
|
|
14
|
+
- Packages: `@stacksjs/repl`, `@stacksjs/tinker`
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { startRepl } from '@stacksjs/repl'
|
|
20
|
+
|
|
21
|
+
interface ReplConfig extends TinkerConfig {
|
|
22
|
+
loadFile?: string // Path to file to preload before starting
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function startRepl(config: ReplConfig): Promise<{ exitCode: number }>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### How It Works
|
|
29
|
+
1. If `config.loadFile` is specified, reads the file content
|
|
30
|
+
2. Merges file content into `config.eval` for evaluation
|
|
31
|
+
3. Starts an interactive Bun REPL session with all framework modules available
|
|
32
|
+
4. Returns the process exit code when the session ends
|
|
33
|
+
|
|
34
|
+
## Re-exports from @stacksjs/tinker
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import {
|
|
38
|
+
startTinker, // Start a tinker session
|
|
39
|
+
tinkerEval, // Evaluate an expression
|
|
40
|
+
tinkerPrint, // Print a result
|
|
41
|
+
getHistoryPath, // Get REPL history file path
|
|
42
|
+
readHistory, // Read command history
|
|
43
|
+
appendHistory, // Append to command history
|
|
44
|
+
clearHistory, // Clear command history
|
|
45
|
+
} from '@stacksjs/repl'
|
|
46
|
+
|
|
47
|
+
import type { TinkerConfig } from '@stacksjs/repl'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## CLI Commands
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
buddy tinker # Start interactive REPL session
|
|
54
|
+
buddy tinker --load file.ts # Preload a file before starting
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
Inside the REPL, all framework modules are available:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Query the database
|
|
63
|
+
const users = await db.selectFrom('users').get()
|
|
64
|
+
|
|
65
|
+
// Use models
|
|
66
|
+
const post = await Post.find(1)
|
|
67
|
+
|
|
68
|
+
// Access config
|
|
69
|
+
console.log(config.app.name)
|
|
70
|
+
|
|
71
|
+
// Use faker for quick testing
|
|
72
|
+
const email = faker.internet.email()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 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 preloading** — use `loadFile` to run setup code before entering interactive mode
|
|
80
|
+
- **Bun runtime** — the REPL runs in Bun's JavaScript runtime, not Node.js
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-retro
|
|
3
|
+
description: Use for git-based session retrospectives — session detection, commit categorization, focus scores, streak counting, and behavioral observations. Invoke with /stacks-retro.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /stacks-retro — Session Retrospective
|
|
10
|
+
|
|
11
|
+
Generate a retrospective analysis of recent development work based on git history.
|
|
12
|
+
|
|
13
|
+
## Step 1: Session Detection
|
|
14
|
+
|
|
15
|
+
Detect sessions using a **45-minute gap threshold** between commits.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git log --all --format="%H|%ai|%an|%s" --since="7 days ago"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Adjust `--since` if user specifies a range ("today", "this week", etc.).
|
|
22
|
+
|
|
23
|
+
## Step 2: Commit Categorization
|
|
24
|
+
|
|
25
|
+
| Category | Indicators | Icon |
|
|
26
|
+
|----------|-----------|------|
|
|
27
|
+
| Feature | `feat:`, new files, new exports | 🟢 |
|
|
28
|
+
| Fix | `fix:`, corrective changes | 🔴 |
|
|
29
|
+
| Refactor | `refactor:`, structural changes | 🔵 |
|
|
30
|
+
| Test | `test:`, test file changes | 🟡 |
|
|
31
|
+
| Docs | `docs:`, README changes | 📝 |
|
|
32
|
+
| Chore | `chore:`, deps, config, CI | ⚙️ |
|
|
33
|
+
| Style | `style:`, formatting, lint | 🎨 |
|
|
34
|
+
|
|
35
|
+
Parse `gitlint`-style conventional commit prefixes. Stacks uses these scopes: `core`, `auth`, `database`, `router`, `buddy`, `ui`, `build`, etc.
|
|
36
|
+
|
|
37
|
+
## Step 3: Session Analysis
|
|
38
|
+
|
|
39
|
+
### Focus Score (0-100)
|
|
40
|
+
```
|
|
41
|
+
focus_score = (commits_in_primary_area / total_commits) × 100
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Primary area = most-touched `storage/framework/core/*/` package or top-level directory.
|
|
45
|
+
|
|
46
|
+
- **80-100**: Deep focus
|
|
47
|
+
- **50-79**: Moderate focus
|
|
48
|
+
- **0-49**: Scattered
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
### Session [N]: [start] → [end] ([duration])
|
|
52
|
+
**Focus**: [score]/100 — [assessment]
|
|
53
|
+
**Primary area**: [package/directory]
|
|
54
|
+
**Commits**: [count]
|
|
55
|
+
|
|
56
|
+
| Time | Category | Message | Files |
|
|
57
|
+
|------|----------|---------|-------|
|
|
58
|
+
|
|
59
|
+
**Observation**: [one behavioral insight]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Step 4: Streaks
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git log --all --format="%ad" --date=short | sort -u
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
## Streaks
|
|
70
|
+
🔥 Current streak: [N] days
|
|
71
|
+
📈 Longest streak: [N] days ([range])
|
|
72
|
+
📅 Active days: [N] / [total]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Step 5: Per-Contributor Metrics (if multiple)
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
| Contributor | Commits | Primary Focus | Top Category | Avg Focus |
|
|
79
|
+
|-------------|---------|---------------|--------------|-----------|
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Step 6: Behavioral Observations
|
|
83
|
+
|
|
84
|
+
2-4 observations backed by data:
|
|
85
|
+
|
|
86
|
+
- "You wrote 12 fix commits after the auth refactor — consider adding tests before next refactor session."
|
|
87
|
+
- "Focus score drops in afternoon sessions. Morning sessions average 85."
|
|
88
|
+
- "No test commits this week despite 8 feature commits. Test debt accumulating."
|
|
89
|
+
- "3/4 sessions started with chore commits. Consider batching into a maintenance session."
|
|
90
|
+
|
|
91
|
+
## Output
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
# Retrospective: [date range]
|
|
95
|
+
|
|
96
|
+
## Overview
|
|
97
|
+
- **Period**: [range]
|
|
98
|
+
- **Sessions**: [count]
|
|
99
|
+
- **Total commits**: [count]
|
|
100
|
+
|
|
101
|
+
## Category Breakdown
|
|
102
|
+
[icons and counts]
|
|
103
|
+
|
|
104
|
+
## Sessions
|
|
105
|
+
[session details]
|
|
106
|
+
|
|
107
|
+
## Streaks
|
|
108
|
+
[streak data]
|
|
109
|
+
|
|
110
|
+
## Observations
|
|
111
|
+
[behavioral insights]
|
|
112
|
+
|
|
113
|
+
## Suggested Focus for Next Session
|
|
114
|
+
[one specific suggestion]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Rules
|
|
118
|
+
|
|
119
|
+
- **Data-driven only.** Every observation backed by commits/metrics.
|
|
120
|
+
- **No judgment on work hours.** Don't comment on when someone works.
|
|
121
|
+
- **Default to 7 days** if no range specified.
|
|
122
|
+
- **Handle messy history gracefully.** Squash/merge/rebase can distort sessions.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-review
|
|
3
|
+
description: Use when reviewing code changes in the Stacks project — two-pass code review with critical issue detection, test coverage audit, and auto-fix workflow. Invoke with /stacks-review.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /stacks-review — Code Review
|
|
10
|
+
|
|
11
|
+
You are performing a structured two-pass code review for the Stacks framework. Be direct, specific, and opinionated. Every finding must reference a specific file and line number.
|
|
12
|
+
|
|
13
|
+
## Determine Scope
|
|
14
|
+
|
|
15
|
+
1. If the user provides a PR number or branch, review the diff against the base branch
|
|
16
|
+
2. If no scope is given, review staged changes (`git diff --cached`). If nothing staged, review unstaged (`git diff`)
|
|
17
|
+
3. If no changes at all, ask what to review
|
|
18
|
+
|
|
19
|
+
Read changed files in full to understand context around the changes.
|
|
20
|
+
|
|
21
|
+
## Pass 1: Critical Issues
|
|
22
|
+
|
|
23
|
+
Scan for issues that **must be fixed before merge**. Only flag with confidence 8/10+:
|
|
24
|
+
|
|
25
|
+
### Security
|
|
26
|
+
- SQL injection, XSS, command injection, path traversal
|
|
27
|
+
- Hardcoded secrets, API keys, tokens (check `config/services.ts`)
|
|
28
|
+
- Missing auth/authorization checks on API routes
|
|
29
|
+
- Unsafe deserialization or eval usage
|
|
30
|
+
- Improper input validation at system boundaries
|
|
31
|
+
|
|
32
|
+
### Correctness
|
|
33
|
+
- Race conditions, missing `await` on async calls
|
|
34
|
+
- Off-by-one errors, null/undefined access without guards
|
|
35
|
+
- Resource leaks (unclosed database connections, missing `db.close()`)
|
|
36
|
+
- Incorrect error handling (swallowed errors, wrong error types)
|
|
37
|
+
- Logic errors in ORM model definitions or migration files
|
|
38
|
+
|
|
39
|
+
### Stacks-Specific
|
|
40
|
+
- Incorrect model attribute definitions (wrong validator types, missing `factory` for seeder)
|
|
41
|
+
- Broken route definitions (missing middleware, wrong action paths)
|
|
42
|
+
- Misconfigured `config/*.ts` files
|
|
43
|
+
- Breaking changes to `@stacksjs/*` package exports
|
|
44
|
+
- Migration files that won't work on SQLite (check preprocessing quirks)
|
|
45
|
+
|
|
46
|
+
For each critical finding:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
🔴 CRITICAL: [title]
|
|
50
|
+
File: [path]:[line]
|
|
51
|
+
Issue: [specific description]
|
|
52
|
+
Impact: [what can go wrong]
|
|
53
|
+
Fix: [concrete fix, not "consider doing X"]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Pass 2: Informational
|
|
57
|
+
|
|
58
|
+
Scan for non-blocking issues:
|
|
59
|
+
|
|
60
|
+
- Run `bunx --bun pickier` compliance (don't flag what pickier catches)
|
|
61
|
+
- TypeScript best practices (avoid `any`, prefer discriminated unions, use `satisfies`)
|
|
62
|
+
- Naming clarity (misleading variable/function names)
|
|
63
|
+
- Missing error context (errors that lose stack traces)
|
|
64
|
+
- Test gaps (changed logic without corresponding test changes)
|
|
65
|
+
- Dead code introduced by the change
|
|
66
|
+
- Performance concerns (N+1 queries in ORM, unnecessary re-renders)
|
|
67
|
+
- Conventional commit compliance for the PR title (`gitlint` standards)
|
|
68
|
+
|
|
69
|
+
For each:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
🟡 INFO: [title]
|
|
73
|
+
File: [path]:[line]
|
|
74
|
+
Note: [observation]
|
|
75
|
+
Suggestion: [improvement]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Test Coverage Audit
|
|
79
|
+
|
|
80
|
+
1. Identify all changed functions/methods
|
|
81
|
+
2. Search for existing tests (`bun test` files)
|
|
82
|
+
3. List untested paths
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
## Test Coverage
|
|
86
|
+
|
|
87
|
+
| Changed Function | Test File | Covered? |
|
|
88
|
+
|-----------------|-----------|----------|
|
|
89
|
+
| [function] | [test file or "none"] | ✅ / ❌ |
|
|
90
|
+
|
|
91
|
+
Missing coverage:
|
|
92
|
+
- [untested path or edge case]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Auto-Fix Workflow
|
|
96
|
+
|
|
97
|
+
After presenting findings, ask:
|
|
98
|
+
|
|
99
|
+
> "Want me to fix the mechanical issues? (formatting, imports, simple type fixes)"
|
|
100
|
+
|
|
101
|
+
If yes, fix ONLY mechanical issues. After fixing, run `bunx --bun pickier . --fix`.
|
|
102
|
+
|
|
103
|
+
Do NOT auto-fix: architectural decisions, logic changes, anything with multiple valid approaches.
|
|
104
|
+
|
|
105
|
+
## Output Format
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
# Code Review: [brief description]
|
|
109
|
+
|
|
110
|
+
## Pass 1: Critical Issues
|
|
111
|
+
[findings or "No critical issues found."]
|
|
112
|
+
|
|
113
|
+
## Pass 2: Informational
|
|
114
|
+
[findings]
|
|
115
|
+
|
|
116
|
+
## Test Coverage
|
|
117
|
+
[table]
|
|
118
|
+
|
|
119
|
+
## Summary
|
|
120
|
+
- Critical: [count]
|
|
121
|
+
- Informational: [count]
|
|
122
|
+
- Test gaps: [count]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Rules
|
|
126
|
+
|
|
127
|
+
- Never say "consider" or "you might want to" — it's a problem or it isn't
|
|
128
|
+
- Every finding must have a concrete fix
|
|
129
|
+
- Don't flag style issues that `pickier` would catch
|
|
130
|
+
- Don't review generated files, lock files, or `storage/framework/types/` auto-generated types
|
|
131
|
+
- For Stacks monorepo changes, check cross-package impacts — a change in `core/` might affect 15+ downstream packages
|
|
132
|
+
|
|
133
|
+
## Downstream
|
|
134
|
+
|
|
135
|
+
> **Review complete.** Run `/stacks-browse` to QA in the browser, or `/stacks-retro` to reflect on this session.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-router
|
|
3
|
+
description: Use when working with routing in a Stacks application — defining routes, HTTP methods, route groups, middleware, named routes, URL generation, request enhancement (Laravel-style input/query/file helpers), response helpers, error responses, route model binding, or rate limiting. Covers @stacksjs/router, routes/, and app/Routes.ts.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Router
|
|
10
|
+
|
|
11
|
+
Built on `@stacksjs/bun-router` with `ts-rate-limiter`.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/router/src/`
|
|
15
|
+
- Route files: `routes/` (api.ts, v1.ts, buddy.ts, users.ts)
|
|
16
|
+
- Route registry: `app/Routes.ts`
|
|
17
|
+
- Generated route manifest: `storage/framework/stx/routes.ts` (written by the dev server)
|
|
18
|
+
- Generated action paths: `storage/framework/types/actions.d.ts`
|
|
19
|
+
|
|
20
|
+
## Route Definition
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { route } from '@stacksjs/router'
|
|
24
|
+
|
|
25
|
+
route.get('/users', handler)
|
|
26
|
+
route.post('/users', handler)
|
|
27
|
+
route.put('/users/{id}', handler)
|
|
28
|
+
route.patch('/users/{id}', handler)
|
|
29
|
+
route.delete('/users/{id}', handler)
|
|
30
|
+
route.options('/users', handler)
|
|
31
|
+
route.health() // GET /health endpoint
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Chainable Methods
|
|
35
|
+
```typescript
|
|
36
|
+
route.get('/admin', handler)
|
|
37
|
+
.middleware('auth')
|
|
38
|
+
.name('admin.dashboard')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Route Groups
|
|
42
|
+
```typescript
|
|
43
|
+
route.group({ prefix: '/api/v1', middleware: ['auth', 'throttle'] }, () => {
|
|
44
|
+
route.get('/users', listUsers)
|
|
45
|
+
route.post('/users', createUser)
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Handler Types
|
|
50
|
+
- Function: `(req: EnhancedRequest) => Response | Promise<Response>`
|
|
51
|
+
- Action string: `'Actions/CreateUser'` — auto-loads action
|
|
52
|
+
- Controller: `'Controllers/UserController@index'` — calls controller method
|
|
53
|
+
|
|
54
|
+
## Route Registry (app/Routes.ts)
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
export default {
|
|
58
|
+
'api': 'api', // routes/api.ts → /api/* (auto-prefixed; see #1835)
|
|
59
|
+
'v1': { path: 'v1', prefix: 'v1' }, // routes/v1.ts → /v1/*
|
|
60
|
+
'admin': { path: 'admin', prefix: 'admin', middleware: ['auth'] }
|
|
61
|
+
} satisfies Record<string, string | RouteDefinition>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Enhanced Request (Laravel-style)
|
|
65
|
+
|
|
66
|
+
### Input Methods
|
|
67
|
+
```typescript
|
|
68
|
+
req.get('name', 'default') // get input value
|
|
69
|
+
req.input('name', 'default') // alias
|
|
70
|
+
req.all() // all input
|
|
71
|
+
req.only(['name', 'email']) // specific fields
|
|
72
|
+
req.except(['password']) // all except
|
|
73
|
+
req.has('name') // exists?
|
|
74
|
+
req.has(['name', 'email']) // all exist?
|
|
75
|
+
req.hasAny(['name', 'email']) // any exist?
|
|
76
|
+
req.filled('name') // exists and not empty?
|
|
77
|
+
req.missing('name') // doesn't exist?
|
|
78
|
+
req.query // query parameters object
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Type Conversion
|
|
82
|
+
```typescript
|
|
83
|
+
req.string('name', '')
|
|
84
|
+
req.integer('page', 1)
|
|
85
|
+
req.float('price', 0.0)
|
|
86
|
+
req.boolean('active', false)
|
|
87
|
+
req.array('tags')
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### File Handling
|
|
91
|
+
```typescript
|
|
92
|
+
const file = req.file('avatar') // UploadedFile | null
|
|
93
|
+
const files = req.getFiles('images') // UploadedFile[]
|
|
94
|
+
req.hasFile('avatar') // boolean
|
|
95
|
+
const all = req.allFiles() // Record<string, UploadedFile[]>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Authentication
|
|
99
|
+
```typescript
|
|
100
|
+
const user = await req.user()
|
|
101
|
+
const token = await req.userToken()
|
|
102
|
+
await req.tokenCan('create-posts')
|
|
103
|
+
await req.tokenCant('delete-users')
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Response Helpers
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { response } from '@stacksjs/router'
|
|
110
|
+
|
|
111
|
+
response.json(data, { status: 200 })
|
|
112
|
+
response.created(data) // 201
|
|
113
|
+
response.noContent() // 204
|
|
114
|
+
response.badRequest(data) // 400
|
|
115
|
+
response.unauthorized() // 401
|
|
116
|
+
response.forbidden() // 403
|
|
117
|
+
response.notFound() // 404
|
|
118
|
+
response.error() // 500
|
|
119
|
+
response.redirect(url, 302)
|
|
120
|
+
response.text('hello')
|
|
121
|
+
response.html('<h1>Hi</h1>')
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Error Responses
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
createErrorResponse(error, request, options?)
|
|
128
|
+
createMiddlewareErrorResponse(error, request)
|
|
129
|
+
createValidationErrorResponse(errors, request)
|
|
130
|
+
createNotFoundResponse(path, request)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Error response body:
|
|
134
|
+
```typescript
|
|
135
|
+
{ error: string, message: string, status: number, timestamp: string, details?: Record<string, unknown> }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Request Context
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { getCurrentRequest, setCurrentRequest, runWithRequest, request } from '@stacksjs/router'
|
|
142
|
+
|
|
143
|
+
// Async context management
|
|
144
|
+
const req = getCurrentRequest()
|
|
145
|
+
runWithRequest(req, async () => {
|
|
146
|
+
// `request` proxy available here
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Middleware
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { Middleware } from '@stacksjs/router'
|
|
154
|
+
|
|
155
|
+
const logger = new Middleware({
|
|
156
|
+
name: 'logger',
|
|
157
|
+
priority: 5, // lower = runs first, default 10
|
|
158
|
+
handle: async (request: EnhancedRequest) => {
|
|
159
|
+
console.log(`${request.method} ${request.url}`)
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
route.use(logger)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Available Middleware Aliases (from app/Middleware.ts)
|
|
167
|
+
maintenance, auth, guest, api, team, logger, abilities, can, throttle, local, development, staging, production, env.local, env.development, env.staging, env.production, role, permission, verified
|
|
168
|
+
|
|
169
|
+
## Query Tracking
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
trackQuery(query, time?, connection?)
|
|
173
|
+
clearTrackedQueries()
|
|
174
|
+
clearMiddlewareCache()
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Default API Routes (routes/api.ts)
|
|
178
|
+
|
|
179
|
+
### Auth
|
|
180
|
+
- `POST /login`, `POST /register`, `POST /auth/refresh`, `POST /auth/token`
|
|
181
|
+
- `GET /auth/tokens`, `DELETE /auth/tokens/{id}` (auth)
|
|
182
|
+
- `GET /me`, `POST /logout` (auth)
|
|
183
|
+
|
|
184
|
+
### Email
|
|
185
|
+
- `POST /api/email/subscribe`, `GET /api/email/unsubscribe`
|
|
186
|
+
|
|
187
|
+
### AI
|
|
188
|
+
- `POST /ai/ask`, `POST /ai/summary`
|
|
189
|
+
|
|
190
|
+
### CMS
|
|
191
|
+
- `/cms/posts/*`, `/cms/authors/*`, `/cms/categories/*`, `/cms/tags/*`, `/cms/comments/*`
|
|
192
|
+
|
|
193
|
+
### Commerce
|
|
194
|
+
- `/commerce/products/*`, `/commerce/orders/*`, `/commerce/customers/*`, `/shipping/*`
|
|
195
|
+
|
|
196
|
+
### Monitoring
|
|
197
|
+
- `/monitoring/errors/*`
|
|
198
|
+
|
|
199
|
+
### Health
|
|
200
|
+
- `GET /health` — returns status, uptime, memory, PID, Bun version
|
|
201
|
+
|
|
202
|
+
## Server Integration
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { serve, serverResponse } from '@stacksjs/router'
|
|
206
|
+
|
|
207
|
+
await serve({ port: 3000 })
|
|
208
|
+
const response = await serverResponse(request)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## URL Generation
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
import { url } from '@stacksjs/router'
|
|
215
|
+
|
|
216
|
+
url('admin.dashboard') // '/admin/dashboard'
|
|
217
|
+
url('user.show', { id: 42 }) // '/users/42'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Gotchas
|
|
221
|
+
- Routes use `@stacksjs/bun-router` under the hood
|
|
222
|
+
- Rate limiting via `ts-rate-limiter` is built into the router
|
|
223
|
+
- Route registry in `app/Routes.ts` maps file names to URL prefixes
|
|
224
|
+
- String-based handlers (`'Actions/MyAction'`) are dynamically imported
|
|
225
|
+
- Middleware priority: lower number = runs first
|
|
226
|
+
- The `request` proxy uses AsyncLocalStorage for context — must be inside `runWithRequest()`
|
|
227
|
+
- EnhancedRequest extends the native Bun Request with Laravel-style helpers
|
|
228
|
+
- File uploads return `UploadedFile` objects with metadata
|
|
229
|
+
- Query tracking is for debug/profiling — call `clearTrackedQueries()` to free memory
|
|
230
|
+
- The dev server writes a route manifest to `storage/framework/stx/routes.ts` (stx's `stateDir`, set in `config/ui.ts`); it is a build artifact, not a file to edit
|
|
231
|
+
- The health endpoint returns uptime, memory, PID, and Bun version info
|