@stacksjs/defaults 0.70.207 → 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,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-events
|
|
3
|
+
description: Use when working with the event system in a Stacks application — dispatching events, listening for events, model events, wildcard listeners, the event emitter, or event-driven architecture. Covers @stacksjs/events, app/Events.ts, app/Listener.ts, and app/Listeners/.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Events
|
|
10
|
+
|
|
11
|
+
Tiny (~200b) functional event emitter based on mitt, with Stacks-specific model events and action-based listener resolution.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/events/src/index.ts` (single file -- entire implementation)
|
|
15
|
+
- Application events: `app/Events.ts`
|
|
16
|
+
- Listener setup: `app/Listener.ts`
|
|
17
|
+
- Listeners: `app/Listeners/`
|
|
18
|
+
- Event types: `storage/framework/types/events.ts`
|
|
19
|
+
|
|
20
|
+
## Core mitt Implementation (index.ts)
|
|
21
|
+
|
|
22
|
+
The entire event system is a single `mitt()` factory function that returns an `Emitter<Events>` object:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
export default function mitt<Events>(all?: EventHandlerMap<Events>): Emitter<Events>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Emitter Interface
|
|
29
|
+
```typescript
|
|
30
|
+
interface Emitter<Events> {
|
|
31
|
+
all: EventHandlerMap<Events> // Map<keyof Events | '*', Handler[]>
|
|
32
|
+
|
|
33
|
+
on<Key>(type: Key, handler: Handler<Events[Key]>): void
|
|
34
|
+
on(type: '*', handler: WildcardHandler<Events>): void
|
|
35
|
+
|
|
36
|
+
off<Key>(type: Key, handler?: Handler<Events[Key]>): void
|
|
37
|
+
off(type: '*', handler?: WildcardHandler<Events>): void
|
|
38
|
+
|
|
39
|
+
emit<Key>(type: Key, event?: Events[Key]): void
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### How emit() Works
|
|
44
|
+
1. Gets handlers array from `all.get(type)` -- calls each with `handler(event)`
|
|
45
|
+
2. Gets wildcard handlers from `all.get('*')` -- calls each with `handler(type, event)`
|
|
46
|
+
3. Handlers are called via `.slice()` copy to avoid mutation during iteration
|
|
47
|
+
4. Each handler is wrapped in try-catch with `console.error` logging
|
|
48
|
+
5. Error in one handler does NOT prevent other handlers from executing
|
|
49
|
+
6. Both type-matched AND wildcard handlers run (wildcards run second)
|
|
50
|
+
7. If `event` is `undefined`, handlers are NOT called
|
|
51
|
+
|
|
52
|
+
### on() / off() Behavior
|
|
53
|
+
- `on(type, handler)`: pushes to handlers array (creates array if first handler)
|
|
54
|
+
- `off(type, handler)`: splices handler from array by index
|
|
55
|
+
- `off(type)` (no handler): replaces handlers array with empty `[]`
|
|
56
|
+
- Handler maps use `Map<string, Array<Handler>>` internally
|
|
57
|
+
|
|
58
|
+
## Stacks Event System Exports
|
|
59
|
+
|
|
60
|
+
The package creates a single `mitt<StacksEvents>()` instance and exports multiple aliases:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { dispatch, listen, off, emitter, events, useEvent, useListen, useEvents, all } from '@stacksjs/events'
|
|
64
|
+
|
|
65
|
+
// Dispatch an event
|
|
66
|
+
dispatch('user:registered', { id: 1, email: 'user@example.com' })
|
|
67
|
+
|
|
68
|
+
// Listen for an event
|
|
69
|
+
listen('user:registered', (data) => {
|
|
70
|
+
console.log('New user:', data.email)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// Wildcard listener (catches ALL events)
|
|
74
|
+
listen('*', (type, data) => {
|
|
75
|
+
console.log(`Event ${type}:`, data)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
// Remove a specific listener
|
|
79
|
+
off('user:registered', handler)
|
|
80
|
+
|
|
81
|
+
// Direct emitter access
|
|
82
|
+
emitter.on('event', handler)
|
|
83
|
+
emitter.off('event', handler)
|
|
84
|
+
emitter.emit('event', data)
|
|
85
|
+
emitter.all // Map of all handlers
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Export Aliases
|
|
89
|
+
| Export | Maps To |
|
|
90
|
+
|--------|---------|
|
|
91
|
+
| `dispatch` | `emitter.emit` |
|
|
92
|
+
| `useEvent` | `emitter.emit` (alias for `dispatch`) |
|
|
93
|
+
| `listen` | `emitter.on` |
|
|
94
|
+
| `useListen` | `emitter.on` (alias for `listen`) |
|
|
95
|
+
| `off` | `emitter.off` |
|
|
96
|
+
| `emitter` | the mitt instance |
|
|
97
|
+
| `events` | the mitt instance (alias for `emitter`) |
|
|
98
|
+
| `useEvents` | the mitt instance (alias for `emitter`) |
|
|
99
|
+
| `all` | `emitter.all` (the handler Map) |
|
|
100
|
+
| `mitt` | the factory function itself |
|
|
101
|
+
|
|
102
|
+
### Type Aliases
|
|
103
|
+
```typescript
|
|
104
|
+
type Dispatch = <Key extends keyof StacksEvents>(type: Key, event: StacksEvents[Key]) => void
|
|
105
|
+
type Listen = <Key extends keyof StacksEvents>(type: Key, handler: Handler<StacksEvents[Key]>) => void
|
|
106
|
+
type Off = <Key extends keyof StacksEvents>(type: Key, handler?: Handler<StacksEvents[Key]>) => void
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Built-in Event Types (StacksEvents)
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
interface StacksEvents extends ModelEvents, Record<EventType, unknown> {
|
|
113
|
+
'user:registered': Record<string, any>
|
|
114
|
+
'user:logged-in': Record<string, any>
|
|
115
|
+
'user:logged-out': Record<string, any>
|
|
116
|
+
'user:password-reset': Record<string, any>
|
|
117
|
+
'user:password-changed': Record<string, any>
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The `Record<EventType, unknown>` intersection allows arbitrary event names beyond the declared ones.
|
|
122
|
+
|
|
123
|
+
## Model Events
|
|
124
|
+
|
|
125
|
+
Every model with `observe: true` trait (in defineModel) emits via `afterCreate`/`afterUpdate`/`afterDelete` hooks:
|
|
126
|
+
- `'{model}:created'` -- after insert
|
|
127
|
+
- `'{model}:updated'` -- after update
|
|
128
|
+
- `'{model}:deleted'` -- after delete
|
|
129
|
+
|
|
130
|
+
Model name is lowercased: `'user:created'`, `'post:updated'`, `'order:deleted'`
|
|
131
|
+
|
|
132
|
+
Events are dispatched via lazy `import('@stacksjs/events').then(({ dispatch }) => dispatch(...))` to avoid circular dependencies. If the import fails (e.g., browser context), errors are silently caught.
|
|
133
|
+
|
|
134
|
+
The `observe` trait can be:
|
|
135
|
+
- `true` -- emits all three events (create, update, delete)
|
|
136
|
+
- `['create', 'update']` -- emits only specified events
|
|
137
|
+
- `false` / undefined -- no events
|
|
138
|
+
|
|
139
|
+
Full model list (45+ with events defined in `storage/framework/types/events.ts`):
|
|
140
|
+
Author, Page, Post, User, Activity, Campaign, Cart, CartItem, Category, Comment, Coupon, Customer, DeliveryRoute, DigitalDelivery, Driver, EmailList, GiftCard, LicenseKey, LoyaltyPoint, LoyaltyReward, Manufacturer, Notification, Order, OrderItem, Payment, PrintDevice, Product, ProductUnit, ProductVariant, Receipt, Review, ShippingMethod, ShippingRate, ShippingZone, SocialPost, Subscription, Tag, TaxRate, Transaction, WaitlistProduct, WaitlistRestaurant, Websocket
|
|
141
|
+
|
|
142
|
+
## Event-to-Listener Mapping (app/Events.ts)
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import type { Events } from '@stacksjs/types'
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
'user:registered': ['SendWelcomeEmail'],
|
|
149
|
+
'user:created': ['NotifyUser'],
|
|
150
|
+
} satisfies Events
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Keys are event names (must match StacksEvents keys). Values are arrays of **Action names** -- these correspond to files in `app/Actions/`.
|
|
154
|
+
|
|
155
|
+
## Listener Resolution (app/Listener.ts)
|
|
156
|
+
|
|
157
|
+
The `handleEvents()` function sets up the entire event-to-action pipeline:
|
|
158
|
+
|
|
159
|
+
### Setup
|
|
160
|
+
```typescript
|
|
161
|
+
export async function handleEvents() {
|
|
162
|
+
emitter.on('*', listenEvents as WildcardHandler<StacksEvents>)
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
Subscribes a single wildcard handler that intercepts ALL events.
|
|
166
|
+
|
|
167
|
+
### Event Processing Flow
|
|
168
|
+
1. **Fast path**: `eventTypes` Set (pre-computed from `Object.keys(events)`) provides O(1) lookup. Events not in the map are skipped immediately.
|
|
169
|
+
2. **Listener resolution**: For each listener name in the array, `resolveAction(listener)` is called:
|
|
170
|
+
- Checks `actionCache` Map (in-memory module cache)
|
|
171
|
+
- Checks `pendingImports` Map (deduplicates concurrent imports of the same action)
|
|
172
|
+
- Dynamically imports `app/Actions/{listener}.ts`
|
|
173
|
+
- Validates the module exports a `handle(event)` method
|
|
174
|
+
- Caches the resolved module in `actionCache`
|
|
175
|
+
3. **Execution**: `processListeners()` iterates listeners sequentially (`for...of`), awaiting each action's `handle(event)` method
|
|
176
|
+
4. **Error handling**: Errors are caught per-listener via `handleError()` from `@stacksjs/error-handling` -- one listener failure does not prevent others
|
|
177
|
+
|
|
178
|
+
### Caching Details
|
|
179
|
+
```typescript
|
|
180
|
+
const actionCache = new Map<string, { handle: (event: any) => Promise<any> | any }>()
|
|
181
|
+
const pendingImports = new Map<string, Promise<...>>()
|
|
182
|
+
const eventTypes = new Set(Object.keys(events)) // pre-computed at module load
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- `actionCache`: stores resolved action modules permanently
|
|
186
|
+
- `pendingImports`: prevents double-importing when multiple events fire simultaneously for the same listener
|
|
187
|
+
- `eventTypes`: O(1) lookup to skip events with no registered listeners
|
|
188
|
+
|
|
189
|
+
### Listener Type Support
|
|
190
|
+
The listener can also be a function (not just a string):
|
|
191
|
+
```typescript
|
|
192
|
+
if (typeof listener === 'function') {
|
|
193
|
+
await listener(event)
|
|
194
|
+
continue
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Implementation Details
|
|
199
|
+
|
|
200
|
+
### Thread Safety
|
|
201
|
+
- mitt handlers are stored in arrays -- `emit()` calls `.slice()` before iterating to safely handle additions/removals during iteration
|
|
202
|
+
- Wildcard handler registration happens once in `handleEvents()` -- the single handler routes all events
|
|
203
|
+
|
|
204
|
+
### Synchronous vs Asynchronous
|
|
205
|
+
- **mitt itself is synchronous**: `emit()` calls handlers directly, does not await them
|
|
206
|
+
- **Listener resolution is asynchronous**: `processListeners()` uses `async/await` for dynamic imports and action execution
|
|
207
|
+
- The wildcard handler in `app/Listener.ts` calls `processListeners()` as fire-and-forget (no await) since mitt doesn't support async wildcard handlers
|
|
208
|
+
|
|
209
|
+
### Memory
|
|
210
|
+
- The emitter is a module-level singleton -- created once at import time
|
|
211
|
+
- Action modules are cached permanently in `actionCache` -- hot-reloading new actions requires server restart
|
|
212
|
+
- The `pendingImports` Map entries are cleaned up in the `finally` block of each import
|
|
213
|
+
|
|
214
|
+
## Gotchas
|
|
215
|
+
- Events are functional, not class-based -- no need to create event classes
|
|
216
|
+
- The emitter is a **singleton** -- shared across the entire application process
|
|
217
|
+
- Wildcard `'*'` listeners receive `(type, event)` -- regular handlers receive just `(event)`
|
|
218
|
+
- Listeners in `app/Events.ts` are **Action names** (strings), not file paths or handler functions
|
|
219
|
+
- The action module must export a default with a `handle(event)` method
|
|
220
|
+
- Event dispatch via mitt is **synchronous** but listener action resolution (dynamic import) is **asynchronous**
|
|
221
|
+
- Model events only fire when the model has `observe: true` (or array) trait set
|
|
222
|
+
- The event system is ~200 bytes total -- it is intentionally minimal
|
|
223
|
+
- Listener caching means hot-reloading new actions requires server restart
|
|
224
|
+
- If `evt` is `undefined`, handlers are NOT called (mitt checks `if (evt !== undefined)`)
|
|
225
|
+
- The `'*'` event type cannot be manually emitted -- it only receives forwarded events
|
|
226
|
+
- `off(type)` without a handler argument clears ALL handlers for that type (sets to empty array, not delete)
|
|
227
|
+
- The `StacksEvents` interface extends `Record<EventType, unknown>` allowing any string as an event name
|
|
228
|
+
- Error logging in mitt uses `console.error` (not `@stacksjs/logging`) to avoid circular dependencies
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-faker
|
|
3
|
+
description: Use when working with fake data generation in a Stacks application — seeding databases, generating test data, model factories, or using faker utilities. Covers @stacksjs/faker (wrapper around ts-mocker) and its integration with the database seeder.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Faker
|
|
10
|
+
|
|
11
|
+
`@stacksjs/faker` wraps `ts-mocker` with a `@faker-js/faker`-compatible API plus enhanced modules for vehicle, company, lorem, location, datatype, and helpers.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/faker/src/`
|
|
15
|
+
- Source: `storage/framework/core/faker/src/index.ts` (265 lines)
|
|
16
|
+
- Tests: `storage/framework/core/faker/tests/faker.test.ts`
|
|
17
|
+
- Seeder integration: `storage/framework/core/database/src/seeder.ts`
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { faker } from '@stacksjs/faker'
|
|
23
|
+
|
|
24
|
+
faker.person.fullName() // 'John Smith'
|
|
25
|
+
faker.internet.email() // 'john.smith@example.com'
|
|
26
|
+
faker.lorem.sentence() // 'Lorem ipsum dolor sit amet.'
|
|
27
|
+
faker.number.int({ min: 1, max: 100 }) // 42
|
|
28
|
+
faker.datatype.uuid() // 'a1b2c3d4-...'
|
|
29
|
+
faker.vehicle.vrm() // 'AB12 CDE'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Modules
|
|
33
|
+
|
|
34
|
+
### datatype (Compatibility Layer)
|
|
35
|
+
```typescript
|
|
36
|
+
faker.datatype.boolean(): boolean
|
|
37
|
+
faker.datatype.number(options?: { min?: number, max?: number }): number
|
|
38
|
+
faker.datatype.float(options?: { min?: number, max?: number, precision?: number }): number
|
|
39
|
+
faker.datatype.uuid(): string
|
|
40
|
+
faker.datatype.string(length?: number): string // default: 10
|
|
41
|
+
faker.datatype.array<T>(generator: () => T, length?: number): T[]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### location
|
|
45
|
+
```typescript
|
|
46
|
+
faker.location.street(): string
|
|
47
|
+
faker.location.streetAddress(useFullAddress?: boolean): string
|
|
48
|
+
faker.location.city(): string
|
|
49
|
+
faker.location.state(): string
|
|
50
|
+
faker.location.stateAbbr(): string
|
|
51
|
+
faker.location.country(): string
|
|
52
|
+
faker.location.countryCode(): string
|
|
53
|
+
faker.location.zipCode(): string
|
|
54
|
+
faker.location.latitude(options?: { min?, max?, precision? }): number
|
|
55
|
+
faker.location.longitude(options?: { min?, max?, precision? }): number
|
|
56
|
+
faker.location.direction(): string
|
|
57
|
+
faker.location.buildingNumber(): string
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### company
|
|
61
|
+
```typescript
|
|
62
|
+
faker.company.name(): string
|
|
63
|
+
faker.company.catchPhrase(): string
|
|
64
|
+
faker.company.buzzPhrase(): string
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### vehicle (Fully Custom)
|
|
68
|
+
```typescript
|
|
69
|
+
faker.vehicle.vrm(): string // UK Registration: 'AB12 CDE'
|
|
70
|
+
faker.vehicle.vehicle(): string // 'Toyota Camry'
|
|
71
|
+
faker.vehicle.type(): string // Sedan, SUV, Truck, Van, Coupe, etc.
|
|
72
|
+
faker.vehicle.manufacturer(): string // Toyota, Honda, Ford, BMW, Tesla, etc.
|
|
73
|
+
faker.vehicle.model(): string // Camry, Accord, F-150, Model 3, etc.
|
|
74
|
+
faker.vehicle.fuel(): string // Gasoline, Diesel, Electric, Hybrid
|
|
75
|
+
faker.vehicle.vin(): string // 17-character VIN
|
|
76
|
+
faker.vehicle.color(): string // Black, White, Silver, Red, Blue, etc.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### helpers
|
|
80
|
+
```typescript
|
|
81
|
+
faker.helpers.arrayElement<T>(array: T[]): T
|
|
82
|
+
faker.helpers.arrayElements<T>(array: T[], count?: number): T[]
|
|
83
|
+
faker.helpers.shuffle<T>(array: T[]): T[]
|
|
84
|
+
faker.helpers.maybe<T>(cb: () => T, options?: { probability?: number }): T | undefined
|
|
85
|
+
faker.helpers.objectKey<T>(obj: T): keyof T
|
|
86
|
+
faker.helpers.objectValue<T>(obj: T): T[keyof T]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### lorem
|
|
90
|
+
```typescript
|
|
91
|
+
faker.lorem.word(): string
|
|
92
|
+
faker.lorem.words(count?: number): string // default: 3
|
|
93
|
+
faker.lorem.sentence(maxWords?: number): string // default: 3-10 words
|
|
94
|
+
faker.lorem.sentences(count?, separator?): string // default: 3, sep: ' '
|
|
95
|
+
faker.lorem.paragraph(sentenceCount?): string
|
|
96
|
+
faker.lorem.paragraphs(count?, separator?): string // default: 3, sep: '\n\n'
|
|
97
|
+
faker.lorem.text(length?: number): string // default: 200 chars
|
|
98
|
+
faker.lorem.slug(wordCount?: number): string // URL-safe, default: 3
|
|
99
|
+
faker.lorem.lines(count?: number): string // default: 3
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Inherited from ts-mocker
|
|
103
|
+
```typescript
|
|
104
|
+
faker.commerce.department() / .price() / .productName() / .productDescription()
|
|
105
|
+
faker.date.past() / .future() / .recent() / .soon()
|
|
106
|
+
faker.finance.creditCardNumber()
|
|
107
|
+
faker.image.avatar() / .url()
|
|
108
|
+
faker.internet.email() / .ip() / .mac() / .url() / .userAgent()
|
|
109
|
+
faker.number.int() / .float()
|
|
110
|
+
faker.person.fullName()
|
|
111
|
+
faker.phone.number()
|
|
112
|
+
faker.string.alpha() / .alphanumeric() / .numeric() / .uuid()
|
|
113
|
+
faker.system.fileName() / .filePath() / .fileType()
|
|
114
|
+
faker.word.adjective() / .noun()
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Seeder Integration
|
|
118
|
+
|
|
119
|
+
Model attributes declare a `factory` function receiving `faker`:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
{
|
|
123
|
+
name: {
|
|
124
|
+
validator: { rule: 'string', min: 3, max: 255 },
|
|
125
|
+
factory: faker => faker.company.name(),
|
|
126
|
+
},
|
|
127
|
+
status: {
|
|
128
|
+
validator: { rule: 'enum', options: ['active', 'inactive'] },
|
|
129
|
+
factory: faker => faker.helpers.arrayElement(['active', 'inactive']),
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### How Seeding Works
|
|
135
|
+
1. Model needs `traits: { useSeeder: { count: N } }`
|
|
136
|
+
2. `generateRecord()` calls `attr.factory(faker)` for each attribute
|
|
137
|
+
3. Falls back to `attr.default` if factory fails
|
|
138
|
+
4. Converts camelCase → snake_case for DB columns
|
|
139
|
+
5. Auto-hashes password fields (bcrypt)
|
|
140
|
+
6. Inserts in batches of 100
|
|
141
|
+
7. Order: User (0), Team (1), Project (2), everything else (10)
|
|
142
|
+
|
|
143
|
+
### Smart Default Inference (no factory defined)
|
|
144
|
+
- `is*`, `has*`, `*able` → `false`
|
|
145
|
+
- `*count`, `*amount`, `*quantity` → `0`
|
|
146
|
+
- `*url`, `*link` → `'https://example.com'`
|
|
147
|
+
- `*email` → `faker.internet.email()`
|
|
148
|
+
- `*name` → `faker.person.fullName()`
|
|
149
|
+
- Unknown → `null`
|
|
150
|
+
|
|
151
|
+
## Gotchas
|
|
152
|
+
- **Not @faker-js/faker** — wrapper around `ts-mocker`. Most APIs compatible but not all
|
|
153
|
+
- **Custom modules override base** — lorem, datatype, location, company, vehicle, helpers are custom
|
|
154
|
+
- **Vehicle module is fully custom** — hardcoded manufacturer/model lists, not from ts-mocker
|
|
155
|
+
- **Factory receives faker** — signature is `(faker: Faker) => value`, not `() => value`
|
|
156
|
+
- **Password detection is heuristic** — by name pattern or `hidden: true` attribute
|
|
157
|
+
- **Seeder batch size is 100** — records inserted in chunks
|
|
158
|
+
- **Model seeding order matters** — User first, then Team, Project, everything else
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-git
|
|
3
|
+
description: Use when working with git in a Stacks application — commit conventions, git hooks, changelog generation, commit scopes/types, or GitHub API types. Covers @stacksjs/git, config/git.ts, config/commit.ts, and the git hooks system.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Git
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Core package: `storage/framework/core/git/`
|
|
13
|
+
- Git config: `config/git.ts`
|
|
14
|
+
- Commit config: `config/commit.ts`
|
|
15
|
+
- Git hooks config: `storage/framework/core/git-hooks.config.ts`
|
|
16
|
+
- Git utilities: `storage/framework/core/utils/src/git.ts`
|
|
17
|
+
- Commit action: `storage/framework/core/actions/src/commit.ts`
|
|
18
|
+
- Buddy commands: `storage/framework/core/buddy/src/commands/commit.ts`, `changelog.ts`
|
|
19
|
+
- GitHub API types: `storage/framework/types/git.ts`
|
|
20
|
+
- Core types: `storage/framework/core/types/src/git.ts`
|
|
21
|
+
|
|
22
|
+
## Git Configuration (config/git.ts)
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
interface GitOptions {
|
|
26
|
+
hooks: GitHooks
|
|
27
|
+
scopes: string[]
|
|
28
|
+
types: { value: string, name: string, emoji: string }[]
|
|
29
|
+
messages: {
|
|
30
|
+
type: string, scope: string, customScope: string, subject: string
|
|
31
|
+
body: string, breaking: string, footer: string, confirmCommit: string
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Hooks
|
|
37
|
+
```typescript
|
|
38
|
+
hooks: {
|
|
39
|
+
'pre-commit': 'lint-staged'
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Commit Types
|
|
44
|
+
|
|
45
|
+
| Value | Emoji | Description |
|
|
46
|
+
|-------|-------|-------------|
|
|
47
|
+
| feat | ✨ | A new feature |
|
|
48
|
+
| fix | 🐛 | A bug fix |
|
|
49
|
+
| docs | 📝 | Documentation only changes |
|
|
50
|
+
| style | 💄 | Changes that don't affect meaning |
|
|
51
|
+
| refactor | ♻️ | Code change without fix or feature |
|
|
52
|
+
| perf | ⚡️ | Performance improvement |
|
|
53
|
+
| test | ✅ | Adding/adjusting tests |
|
|
54
|
+
| build | 📦️ | Build system or dependencies |
|
|
55
|
+
| ci | 🎡 | CI configuration changes |
|
|
56
|
+
| chore | 🔨 | Other changes not affecting src/test |
|
|
57
|
+
| revert | ⏪️ | Reverts previous commit |
|
|
58
|
+
|
|
59
|
+
### Commit Scopes
|
|
60
|
+
|
|
61
|
+
`ci`, `deps`, `dx`, `release`, `docs`, `test`, `core`, `actions`, `arrays`, `auth`, `build`, `cache`, `cli`, `cloud`, `collections`, `config`, `database`, `datetime`, `errors`, `git`, `lint`, `modules`, `notifications`, `objects`, `path`, `realtime`, `router`, `buddy`, `security`, `server`, `storage`, `strings`, `tests`, `types`, `ui`, `utils`
|
|
62
|
+
|
|
63
|
+
## Commit Configuration (config/commit.ts)
|
|
64
|
+
|
|
65
|
+
Based on `cz-git` UserConfig:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
{
|
|
69
|
+
rules: { 'scope-enum': [2, 'always', [...scopes]] },
|
|
70
|
+
prompt: {
|
|
71
|
+
useEmoji: false,
|
|
72
|
+
allowCustomScopes: true,
|
|
73
|
+
allowEmptyScopes: true,
|
|
74
|
+
allowBreakingChanges: ['feat', 'fix'],
|
|
75
|
+
breaklineNumber: 100,
|
|
76
|
+
breaklineChar: '|',
|
|
77
|
+
issuePrefixs: [{ value: 'closed', name: 'closed: ISSUES has been processed' }],
|
|
78
|
+
maxHeaderLength: Infinity,
|
|
79
|
+
maxSubjectLength: Infinity,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Git Utilities
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { isGitClean } from '@stacksjs/utils'
|
|
88
|
+
|
|
89
|
+
function isGitClean(): boolean
|
|
90
|
+
// Uses: git diff-index --quiet HEAD --
|
|
91
|
+
// Returns true if clean, false if dirty
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## CLI Commands
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
buddy commit # Interactive conventional commit
|
|
98
|
+
buddy commit --verbose
|
|
99
|
+
buddy commit -p [project] # Target specific project
|
|
100
|
+
|
|
101
|
+
buddy changelog # Generate changelog
|
|
102
|
+
buddy changelog --quiet
|
|
103
|
+
buddy changelog --dry-run # Preview without writing
|
|
104
|
+
buddy changelog -p [project]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## GitHub API Types
|
|
108
|
+
|
|
109
|
+
### GitHubCommit
|
|
110
|
+
```typescript
|
|
111
|
+
interface GitHubCommit {
|
|
112
|
+
sha: string
|
|
113
|
+
commit: {
|
|
114
|
+
author: { name: string, email: string, date: string }
|
|
115
|
+
committer: { name: string, email: string, date: string }
|
|
116
|
+
message: string
|
|
117
|
+
verification: { verified: boolean, reason: string }
|
|
118
|
+
}
|
|
119
|
+
url: string, html_url: string
|
|
120
|
+
author: { login: string, id: number, avatar_url: string }
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### WorkflowRun
|
|
125
|
+
```typescript
|
|
126
|
+
interface WorkflowRun {
|
|
127
|
+
id: number, name: string, head_branch: string, head_sha: string
|
|
128
|
+
run_number: number, event: string, status: string, conclusion: string
|
|
129
|
+
workflow_id: number, created_at: string, updated_at: string
|
|
130
|
+
actor: { login: string, id: number }
|
|
131
|
+
run_attempt: number, run_started_at: string
|
|
132
|
+
jobs_url: string, logs_url: string, artifacts_url: string
|
|
133
|
+
head_commit: { id: string, message: string, timestamp: string }
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Package Dependencies
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"name": "@stacksjs/git",
|
|
142
|
+
"devDependencies": {
|
|
143
|
+
"@stacksjs/gitlint": "^0.1.5",
|
|
144
|
+
"@stacksjs/gitit": "^0.2.5",
|
|
145
|
+
"bun-git-hooks": "^0.3.1"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Gotchas
|
|
151
|
+
- **`@stacksjs/git` is mostly re-exports** — actual functionality in `@stacksjs/gitlint`, `@stacksjs/gitit`, `bun-git-hooks`
|
|
152
|
+
- **Pre-commit runs lint-staged** — the only default hook
|
|
153
|
+
- **Emoji disabled by default** — `useEmoji: false` but emoji mappings exist for each type
|
|
154
|
+
- **`buddy commit` runs `npm run commit`** — delegates to commitizen/cz-git flow
|
|
155
|
+
- **Scopes dynamically extended** — component and function names merged into scopes at runtime
|
|
156
|
+
- **Breaking changes only for feat/fix** — `allowBreakingChanges: ['feat', 'fix']`
|
|
157
|
+
- **No max header length** — `maxHeaderLength: Infinity`
|
|
158
|
+
- **Git hooks config re-exports** — `git-hooks.config.ts` just re-exports from `config/git.ts`
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-guard
|
|
3
|
+
description: Use for safety rails — warns on destructive commands (rm -rf, DROP TABLE, force-push, git reset --hard) and provides freeze mode for focused debugging. Invoke with /stacks-guard.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /stacks-guard — Safety Rails
|
|
10
|
+
|
|
11
|
+
Prevent destructive actions and enforce focus during debugging sessions.
|
|
12
|
+
|
|
13
|
+
## Destructive Command Detection
|
|
14
|
+
|
|
15
|
+
### 🔴 CRITICAL — Block and require confirmation
|
|
16
|
+
|
|
17
|
+
| Pattern | Risk |
|
|
18
|
+
|---------|------|
|
|
19
|
+
| `rm -rf /`, `rm -rf ~`, `rm -rf .` | Catastrophic file deletion |
|
|
20
|
+
| `DROP TABLE`, `DROP DATABASE`, `TRUNCATE` | Irreversible data loss |
|
|
21
|
+
| `git push --force` to `main`/`master` | Overwrites shared history |
|
|
22
|
+
| `git reset --hard` with uncommitted changes | Loses uncommitted work |
|
|
23
|
+
| `git clean -fd` | Deletes untracked files permanently |
|
|
24
|
+
| `buddy migrate:fresh` on production | Drops ALL tables |
|
|
25
|
+
| `buddy seed --fresh` on production | Truncates all data |
|
|
26
|
+
|
|
27
|
+
Response:
|
|
28
|
+
```
|
|
29
|
+
🔴 GUARD: Destructive command detected
|
|
30
|
+
Command: [command]
|
|
31
|
+
Risk: [what will be destroyed]
|
|
32
|
+
Reversible: [yes/no]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 🟡 WARNING — Warn but allow
|
|
36
|
+
|
|
37
|
+
| Pattern | Risk |
|
|
38
|
+
|---------|------|
|
|
39
|
+
| `git push --force` (non-main) | Overwrites remote branch |
|
|
40
|
+
| `rm -rf [specific dir]` | Deletes directory tree |
|
|
41
|
+
| `bun remove [core dep]` | May break build |
|
|
42
|
+
| `git checkout -- .` | Discards all unstaged changes |
|
|
43
|
+
| Bulk file moves/renames | May break imports/aliases |
|
|
44
|
+
| Modifying `config/services.ts` | Contains API keys |
|
|
45
|
+
| Modifying `storage/framework/core/*/src/index.ts` | Public package API |
|
|
46
|
+
|
|
47
|
+
### 🟢 INFORMATIONAL — Note but don't block
|
|
48
|
+
|
|
49
|
+
| Pattern | Note |
|
|
50
|
+
|---------|------|
|
|
51
|
+
| `git rebase` | History rewrite — ensure not shared |
|
|
52
|
+
| `bun update` (major versions) | May introduce breaking changes |
|
|
53
|
+
| Modifying CI/CD config | Affects deployment pipeline |
|
|
54
|
+
| Changing auth/permissions code | Security-sensitive |
|
|
55
|
+
| Modifying migration files | Database schema change |
|
|
56
|
+
|
|
57
|
+
## Freeze Mode
|
|
58
|
+
|
|
59
|
+
Restrict edits during focused debugging.
|
|
60
|
+
|
|
61
|
+
### Activate
|
|
62
|
+
```
|
|
63
|
+
/stacks-guard freeze [file or directory pattern]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
When active:
|
|
67
|
+
1. **Block edits outside the freeze scope**
|
|
68
|
+
2. **Track all changes** made during the session
|
|
69
|
+
3. **Warn if changes grow large** (>5 files or >50 lines)
|
|
70
|
+
|
|
71
|
+
### Deactivate
|
|
72
|
+
```
|
|
73
|
+
/stacks-guard thaw
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Produces a summary of all changes.
|
|
77
|
+
|
|
78
|
+
## Pre-Commit Safety
|
|
79
|
+
|
|
80
|
+
Before commits, scan for:
|
|
81
|
+
1. **Secrets**: API keys, tokens, passwords in staged files
|
|
82
|
+
2. **Debug artifacts**: `console.log`, `debugger`, `TODO: remove`
|
|
83
|
+
3. **Large files**: >1MB being committed
|
|
84
|
+
4. **Lockfile consistency**: `package.json` changed → `bun.lock` should too
|
|
85
|
+
|
|
86
|
+
## Stacks-Specific Guards
|
|
87
|
+
|
|
88
|
+
- **Don't edit `storage/framework/types/*.d.ts`** — these are auto-generated
|
|
89
|
+
- **Don't edit `storage/framework/defaults/app/Models/`** without also generating migrations
|
|
90
|
+
- **Don't modify `config/services.ts` in commits** — contains API keys
|
|
91
|
+
- **Check `storage/framework/core/*/package.json` versions** — workspace packages should stay in sync
|
|
92
|
+
|
|
93
|
+
## Rules
|
|
94
|
+
|
|
95
|
+
- **Never silently allow destructive commands.**
|
|
96
|
+
- **Don't be annoying.** `rm file.txt` doesn't need a warning. `rm -rf node_modules` is fine — it's regenerable.
|
|
97
|
+
- **Respect user intent.** After warning once, if confirmed, proceed.
|
|
98
|
+
- **Context matters.** Force-push to personal branch ≠ force-push to main.
|