@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
package/TODO.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# TODO
|
|
2
|
+
|
|
3
|
+
"Defaults" are the Stacks way of handling stubs.
|
|
4
|
+
|
|
5
|
+
- [ ] create `buddy publish:defaults` command
|
|
6
|
+
- [ ] stubs should be customizable when stubs are published
|
|
7
|
+
- [ ] action
|
|
8
|
+
- [ ] command
|
|
9
|
+
- [ ] job
|
|
10
|
+
- [ ] middleware
|
|
11
|
+
- [ ] model
|
|
12
|
+
- [ ] notification
|
|
13
|
+
- [ ] view (alias page)
|
|
14
|
+
- [ ] test
|
|
15
|
+
- [ ] mail
|
|
16
|
+
- [ ] store
|
|
17
|
+
- [ ] module
|
|
18
|
+
- [ ] type
|
|
19
|
+
- [ ] layout
|
|
20
|
+
- [ ] component
|
|
21
|
+
- [ ] function
|
package/ai/AGENTS.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for AI coding agents (Claude Code, OpenAI Codex CLI, Cursor, and others)
|
|
4
|
+
working in this Stacks application. Every agent reads this file, so it is the one
|
|
5
|
+
place to record project-specific rules.
|
|
6
|
+
|
|
7
|
+
This is the starter version `buddy setup:ai` writes when a project has no
|
|
8
|
+
`AGENTS.md` yet. Edit it freely - it is yours, and it is committed so the whole
|
|
9
|
+
team (and every agent) sees the same rules.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Project conventions
|
|
14
|
+
|
|
15
|
+
### Linting
|
|
16
|
+
|
|
17
|
+
- Use **pickier**, never eslint directly.
|
|
18
|
+
- Lint: `bunx --bun pickier .` Auto-fix: `bunx --bun pickier . --fix`
|
|
19
|
+
- For unused variables, prefer `// eslint-disable-next-line` over an underscore
|
|
20
|
+
prefix.
|
|
21
|
+
|
|
22
|
+
### Frontend
|
|
23
|
+
|
|
24
|
+
- Use **stx** for templating. Never vanilla JS (`var`, `document.*`, `window.*`)
|
|
25
|
+
inside stx templates - use signals (`state` / `derived` / `effect`) and
|
|
26
|
+
composables.
|
|
27
|
+
- Use **Crosswind** utility classes for styling.
|
|
28
|
+
- Icons are Iconify classes (`i-{collection}-{name}`). Never hand-roll SVG paths
|
|
29
|
+
and never add an icon npm package.
|
|
30
|
+
- Stacks ships no animation library. Use Crosswind transitions, CSS keyframes,
|
|
31
|
+
scroll-driven animations, and the motion composables.
|
|
32
|
+
|
|
33
|
+
### Commits
|
|
34
|
+
|
|
35
|
+
- Conventional commit messages (`fix:`, `feat:`, `chore:`, ...).
|
|
36
|
+
- Only commit or push when asked.
|
|
37
|
+
|
|
38
|
+
### Requirements
|
|
39
|
+
|
|
40
|
+
Bun >= 1.3.0, SQLite >= 3.47.2, TypeScript throughout.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Repository map
|
|
45
|
+
|
|
46
|
+
| Path | What lives here |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `app/` | Your code: `Actions/`, `Jobs/`, `Listeners/`, `Middleware/`, `Mail/`, `Commands/`, `Models/`, `Skills/`, plus `Routes.ts`, `Events.ts`, `Gates.ts`, `Scheduler.ts` |
|
|
49
|
+
| `routes/` | Route files, registered via `app/Routes.ts` |
|
|
50
|
+
| `config/` | Typed configuration, one file per subsystem |
|
|
51
|
+
| `database/` | Migrations, seeders, local SQLite files |
|
|
52
|
+
| `resources/` | stx frontend: `views/`, `components/`, `layouts/`, `partials/` |
|
|
53
|
+
| `storage/framework/` | Framework internals and defaults. Read-only reference |
|
|
54
|
+
| `tests/` | Bun test suites |
|
|
55
|
+
|
|
56
|
+
### The `app/` override model
|
|
57
|
+
|
|
58
|
+
Stacks resolves files from `app/` first and falls back to
|
|
59
|
+
`storage/framework/defaults/app/`. To customize a framework default, create the
|
|
60
|
+
same path under `app/` and it wins.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Skills
|
|
65
|
+
|
|
66
|
+
The framework ships a skill per subsystem under
|
|
67
|
+
`storage/framework/defaults/ai/skills`, each documenting that area
|
|
68
|
+
authoritatively. Read the relevant `SKILL.md` before doing non-trivial work
|
|
69
|
+
rather than guessing at an API.
|
|
70
|
+
|
|
71
|
+
Add your own with `app/Skills/<name>/SKILL.md`, then re-run `buddy setup:ai`.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Before finishing
|
|
76
|
+
|
|
77
|
+
- Lint: `bunx --bun pickier .` (fix with `--fix`)
|
|
78
|
+
- Type check: `bun run typecheck:app`
|
|
79
|
+
- Test: `buddy test`
|
package/ai/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# AI agent defaults
|
|
2
|
+
|
|
3
|
+
Templates that `buddy setup:ai` uses to wire a project up for whichever AI coding
|
|
4
|
+
agent you use. Nothing here is read at runtime - it is scaffolding, in the same
|
|
5
|
+
spirit as `storage/framework/defaults/ide/`.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
ai/
|
|
9
|
+
├── AGENTS.md starter guidance, copied to the project root if absent
|
|
10
|
+
├── claude/
|
|
11
|
+
│ └── launch.json Claude Code run configurations, copied to .claude/
|
|
12
|
+
└── skills/ the framework's agent skills (agentskills.io format)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Why the generated directories are not committed
|
|
16
|
+
|
|
17
|
+
`AGENTS.md` is the one file every agent reads, so it lives in the project root
|
|
18
|
+
and is committed - it is shared guidance, and it belongs in review.
|
|
19
|
+
|
|
20
|
+
Everything else is per-developer. Which agent you use is a personal choice, so
|
|
21
|
+
`.claude/`, `.codex/`, `.cursor/`, `.gemini/` and
|
|
22
|
+
`.github/copilot-instructions.md` are gitignored and generated on demand:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
buddy setup:ai # pick an agent interactively
|
|
26
|
+
buddy setup:ai claude # or name it
|
|
27
|
+
buddy setup:ai claude --copy # copy the skills instead of symlinking them
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Skills
|
|
31
|
+
|
|
32
|
+
`skills/` holds the framework's agent skills, one directory per skill, each with
|
|
33
|
+
a `SKILL.md` carrying `name` and `description` frontmatter. They document the
|
|
34
|
+
framework subsystem by subsystem, so an agent can read the authoritative
|
|
35
|
+
reference for a task instead of guessing at an API.
|
|
36
|
+
|
|
37
|
+
`buddy setup:ai` writes one entry per skill into the agent's directory, and
|
|
38
|
+
symlinks by default so skills stay in sync when you upgrade the framework. Pass
|
|
39
|
+
`--copy` if you would rather edit them per project.
|
|
40
|
+
|
|
41
|
+
To add a project-specific skill, or to shadow a bundled one, create
|
|
42
|
+
`app/Skills/<name>/SKILL.md`. `@stacksjs/skills` searches `app/Skills` first and
|
|
43
|
+
falls back to this directory - the same app-overrides-defaults model the rest of
|
|
44
|
+
the framework uses - and `setup:ai` links the winner, so a project skill also
|
|
45
|
+
wins in the agent's directory.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-actions
|
|
3
|
+
description: Use when working with Stacks server actions — creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 80+ default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Actions
|
|
10
|
+
|
|
11
|
+
Server actions are reusable business logic units invoked from routes, events, or CLI commands.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/actions/src/`
|
|
15
|
+
- Application actions: `app/Actions/`
|
|
16
|
+
- Default framework actions: `storage/framework/defaults/app/Actions/`
|
|
17
|
+
- Framework actions (generated): `storage/framework/actions/`
|
|
18
|
+
|
|
19
|
+
## Creating an Action
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// app/Actions/NotifyUser.ts
|
|
23
|
+
export default {
|
|
24
|
+
name: 'NotifyUser',
|
|
25
|
+
description: 'Notify user after creation',
|
|
26
|
+
|
|
27
|
+
async handle(request: any) {
|
|
28
|
+
const id = request.get('id')
|
|
29
|
+
const name = request.get('name')
|
|
30
|
+
console.log(`User ${name} (${id}) created`)
|
|
31
|
+
return { success: true }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Auto-Generated API Actions (useApi Trait)
|
|
37
|
+
|
|
38
|
+
When a model defines `useApi`, the framework auto-generates REST actions:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
defineModel({
|
|
42
|
+
name: 'Product',
|
|
43
|
+
traits: {
|
|
44
|
+
useApi: {
|
|
45
|
+
uri: 'products',
|
|
46
|
+
routes: ['index', 'store', 'show', 'update', 'destroy']
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This generates:
|
|
53
|
+
- `GET /api/products` → Index action (list all)
|
|
54
|
+
- `POST /api/products` → Store action (create)
|
|
55
|
+
- `GET /api/products/{id}` → Show action (get one)
|
|
56
|
+
- `PUT /api/products/{id}` → Update action
|
|
57
|
+
- `DELETE /api/products/{id}` → Destroy action
|
|
58
|
+
|
|
59
|
+
## Default Framework Actions (80+)
|
|
60
|
+
|
|
61
|
+
### Authentication Actions
|
|
62
|
+
- `LoginAction` — POST /login (validates email + password, returns token + user)
|
|
63
|
+
- `RegisterAction` — POST /register
|
|
64
|
+
- `LogoutAction` — POST /logout (auth required)
|
|
65
|
+
- `RefreshTokenAction` — POST /auth/refresh
|
|
66
|
+
- `CreateTokenAction` — POST /auth/token
|
|
67
|
+
- `ListTokensAction` — GET /auth/tokens (auth required)
|
|
68
|
+
- `RevokeTokenAction` — DELETE /auth/tokens/{id}
|
|
69
|
+
- `GetMeAction` — GET /me (auth required)
|
|
70
|
+
- `PasskeyRegistrationAction` — passkey authentication options
|
|
71
|
+
|
|
72
|
+
### Dashboard Settings Actions (40+)
|
|
73
|
+
For each settings category (AI, Analytics, App, Cache, Cloud, Database, DNS, Email, Environment, FileSystems, Hashing, Library, Logging, Notifications, Payment, Ports, Queue, SearchEngine, Security, Services, Storage, Team, UI):
|
|
74
|
+
- `Get{Category}SettingsAction` — read current settings
|
|
75
|
+
- `Update{Category}SettingsAction` — update settings
|
|
76
|
+
|
|
77
|
+
### Commerce Actions
|
|
78
|
+
- CRUD actions for: Products, Orders, Customers, Payments, Coupons, GiftCards, Reviews, Shipping, DeliveryRoutes, TaxRates, LicenseKeys, etc.
|
|
79
|
+
|
|
80
|
+
### Content Actions
|
|
81
|
+
- CRUD actions for: Posts, Pages, Authors, Categories, Tags, Comments
|
|
82
|
+
|
|
83
|
+
### System Actions
|
|
84
|
+
- `HealthAction` — GET /health (returns status, uptime, memory, PID, Bun version)
|
|
85
|
+
- `GetUserCountAction` — user count for dashboard
|
|
86
|
+
- `GetSubscriberCountAction` — subscriber count
|
|
87
|
+
- Deployment CRUD actions
|
|
88
|
+
- Job monitoring actions
|
|
89
|
+
- Notification actions
|
|
90
|
+
- Request analytics actions
|
|
91
|
+
|
|
92
|
+
## Action Handler Pattern
|
|
93
|
+
|
|
94
|
+
Actions receive the enhanced request object:
|
|
95
|
+
```typescript
|
|
96
|
+
async handle(request: EnhancedRequest) {
|
|
97
|
+
const name = request.get('name') // input value
|
|
98
|
+
const email = request.input('email') // alias
|
|
99
|
+
const all = request.all() // all input
|
|
100
|
+
const user = await request.user() // authenticated user
|
|
101
|
+
|
|
102
|
+
return { success: true, data: { ... } }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Using Actions in Routes
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// String-based (auto-loaded)
|
|
110
|
+
route.post('/users', 'Actions/CreateUser')
|
|
111
|
+
|
|
112
|
+
// In events (app/Events.ts)
|
|
113
|
+
{ 'user:registered': ['SendWelcomeEmail'] } // action name as listener
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## CLI Commands
|
|
117
|
+
- `buddy make:action [name]` — scaffold a new action
|
|
118
|
+
|
|
119
|
+
## Gotchas
|
|
120
|
+
- Application actions go in `app/Actions/`
|
|
121
|
+
- Framework default actions are in `storage/framework/defaults/app/Actions/`
|
|
122
|
+
- The `handle()` method is required — it receives the request object
|
|
123
|
+
- Actions used as event listeners also have a `handle(event)` method
|
|
124
|
+
- The `useApi` model trait auto-generates CRUD actions + routes
|
|
125
|
+
- Actions are resolved dynamically at runtime via string names
|
|
126
|
+
- The HealthAction at `/health` is useful for container health checks
|
|
127
|
+
- Login action returns `{ token: string, user: { id, email, name } }`
|
|
128
|
+
- All dashboard settings actions read/write from the corresponding config files
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-ai
|
|
3
|
+
description: Use when integrating AI capabilities into a Stacks application — using Anthropic/OpenAI/Ollama/AWS Bedrock drivers, image generation (DALL-E), vision analysis, RAG/vector search, embeddings, MCP (Model Context Protocol) clients, text summarization, sentiment analysis, content classification, personalization, or the buddy AI assistant. Covers @stacksjs/ai and config/ai.ts.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks AI
|
|
10
|
+
|
|
11
|
+
Comprehensive AI/LLM integration with 4 provider drivers, image generation, vision, RAG, MCP support, and personalization.
|
|
12
|
+
|
|
13
|
+
## Key Paths
|
|
14
|
+
- Core package: `storage/framework/core/ai/src/`
|
|
15
|
+
- Configuration: `config/ai.ts`
|
|
16
|
+
|
|
17
|
+
## Source Files
|
|
18
|
+
```
|
|
19
|
+
ai/src/
|
|
20
|
+
├── drivers/
|
|
21
|
+
│ ├── anthropic.ts # Claude driver
|
|
22
|
+
│ ├── openai.ts # GPT + DALL-E + Whisper + TTS
|
|
23
|
+
│ ├── ollama.ts # Local LLM driver
|
|
24
|
+
│ └── bedrock.ts # AWS Bedrock utilities
|
|
25
|
+
├── image.ts # Image generation & vision
|
|
26
|
+
├── search.ts # RAG, embeddings, vector index
|
|
27
|
+
├── mcp.ts # Model Context Protocol client
|
|
28
|
+
├── personalization.ts # Sentiment, classification, recommendations
|
|
29
|
+
├── buddy.ts # AI coding assistant
|
|
30
|
+
├── claude-agent.ts # Claude CLI agent (local & EC2)
|
|
31
|
+
├── claude-agent-sdk.ts # Claude Agent SDK driver
|
|
32
|
+
└── text.ts # Bedrock text summarization
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Anthropic Driver
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { anthropic } from '@stacksjs/ai'
|
|
39
|
+
|
|
40
|
+
anthropic.configure({ apiKey: '...', model: 'claude-sonnet-4-20250514', maxTokens: 4096 })
|
|
41
|
+
const result = await anthropic.chat([{ role: 'user', content: 'Hello' }])
|
|
42
|
+
const stream = await anthropic.streamChat(messages, options)
|
|
43
|
+
const response = await anthropic.prompt('Summarize this text...')
|
|
44
|
+
const tokens = anthropic.estimateTokens(text)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## OpenAI Driver
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { openai } from '@stacksjs/ai'
|
|
51
|
+
|
|
52
|
+
openai.configure({ apiKey: '...', model: 'gpt-4o', embeddingModel: 'text-embedding-3-small' })
|
|
53
|
+
const result = await openai.chat(messages, { temperature: 0.7 })
|
|
54
|
+
const stream = await openai.streamChat(messages)
|
|
55
|
+
const embeddings = await openai.embed('text to embed')
|
|
56
|
+
const image = await openai.generateImage('a sunset over mountains')
|
|
57
|
+
const transcription = await openai.transcribe(audioFile)
|
|
58
|
+
const speech = await openai.textToSpeech('Hello world')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Ollama Driver (Local LLMs)
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { ollama } from '@stacksjs/ai'
|
|
65
|
+
|
|
66
|
+
ollama.configure({ host: 'http://localhost:11434', model: 'llama3' })
|
|
67
|
+
const result = await ollama.chat(messages)
|
|
68
|
+
const stream = await ollama.streamChat(messages)
|
|
69
|
+
const text = await ollama.generate('Write a poem')
|
|
70
|
+
const embeddings = await ollama.embed('text')
|
|
71
|
+
const models = await ollama.listModels()
|
|
72
|
+
await ollama.pullModel('llama3', (progress) => console.log(progress))
|
|
73
|
+
await ollama.deleteModel('old-model')
|
|
74
|
+
const info = await ollama.showModel('llama3')
|
|
75
|
+
const running = await ollama.isRunning()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Image Generation
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { generateImage, editImage, createImageVariation, analyzeImage, analyzeImages } from '@stacksjs/ai'
|
|
82
|
+
|
|
83
|
+
// Generate (DALL-E 3)
|
|
84
|
+
const result = await generateImage('a cat in space', {
|
|
85
|
+
model: 'dall-e-3', size: '1024x1024', quality: 'hd', style: 'vivid', n: 1
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Edit (DALL-E 2)
|
|
89
|
+
await editImage(imageInput, 'add a hat', { mask: maskInput })
|
|
90
|
+
|
|
91
|
+
// Variations
|
|
92
|
+
await createImageVariation(imageInput, { n: 3 })
|
|
93
|
+
|
|
94
|
+
// Vision (GPT-4 Vision / Claude)
|
|
95
|
+
const analysis = await analyzeImage({ url: 'https://...' }, 'What is in this image?')
|
|
96
|
+
const multiAnalysis = await analyzeImages([img1, img2], 'Compare these')
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Image inputs: `{ url: string }`, `{ base64: string }`, `{ file: string }` (auto-converted)
|
|
100
|
+
|
|
101
|
+
## RAG & Vector Search
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { createEmbedding, rag, VectorIndex, chunkText, indexText } from '@stacksjs/ai'
|
|
105
|
+
|
|
106
|
+
// Create embeddings
|
|
107
|
+
const embedding = await createEmbedding('text to embed')
|
|
108
|
+
|
|
109
|
+
// Vector similarity
|
|
110
|
+
cosineSimilarity(vecA, vecB)
|
|
111
|
+
dotProduct(vecA, vecB)
|
|
112
|
+
euclideanDistance(vecA, vecB)
|
|
113
|
+
|
|
114
|
+
// Text chunking
|
|
115
|
+
const chunks = chunkText(longText, { chunkSize: 500, overlap: 50 })
|
|
116
|
+
|
|
117
|
+
// Build index
|
|
118
|
+
const index = await indexText(text, { chunkSize: 500 })
|
|
119
|
+
|
|
120
|
+
// RAG query
|
|
121
|
+
const answer = await rag('What is X?', index, { model: 'claude-sonnet-4-20250514', maxTokens: 1000 })
|
|
122
|
+
|
|
123
|
+
// VectorIndex class
|
|
124
|
+
const idx = new VectorIndex({ dimensions: 1536 })
|
|
125
|
+
await idx.add([{ id: '1', content: 'Hello', metadata: {} }])
|
|
126
|
+
const results = await idx.search('greeting', 5)
|
|
127
|
+
const results2 = await idx.searchByVector(queryEmbedding, 5)
|
|
128
|
+
idx.remove('1')
|
|
129
|
+
idx.clear()
|
|
130
|
+
idx.size // number of documents
|
|
131
|
+
idx.ids // all document IDs
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## MCP (Model Context Protocol)
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { MCPClient, MCPManager, connectStdio, connectHTTP } from '@stacksjs/ai'
|
|
138
|
+
|
|
139
|
+
// Single server
|
|
140
|
+
const client = new MCPClient({ name: 'my-server', transport: 'stdio', command: 'npx', args: ['my-mcp-server'] })
|
|
141
|
+
await client.connect()
|
|
142
|
+
const tools = await client.listTools()
|
|
143
|
+
const resources = await client.listResources()
|
|
144
|
+
const prompts = await client.listPrompts()
|
|
145
|
+
const result = await client.callTool('tool-name', { arg: 'value' })
|
|
146
|
+
const resource = await client.readResource('resource://path')
|
|
147
|
+
const prompt = await client.getPrompt('prompt-name', { arg: 'value' })
|
|
148
|
+
const anthropicTools = client.toAnthropicTools()
|
|
149
|
+
const openaiTools = client.toOpenAITools()
|
|
150
|
+
|
|
151
|
+
// Multiple servers
|
|
152
|
+
const manager = new MCPManager()
|
|
153
|
+
manager.addServer({ name: 'server1', transport: 'stdio', command: '...' })
|
|
154
|
+
manager.addServer({ name: 'server2', transport: 'streamable-http', url: '...' })
|
|
155
|
+
const allTools = await manager.getAllTools()
|
|
156
|
+
await manager.callTool('server1/tool-name', args)
|
|
157
|
+
await manager.disconnectAll()
|
|
158
|
+
|
|
159
|
+
// Convenience functions
|
|
160
|
+
const client = await connectStdio('name', 'command', ['args'])
|
|
161
|
+
const client = await connectHTTP('name', 'https://server.com', headers)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Transport types: `'stdio'` | `'sse'` | `'streamable-http'`
|
|
165
|
+
|
|
166
|
+
## Personalization
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { analyzeSentiment, classifyText, summarize, recommend, createProfile } from '@stacksjs/ai'
|
|
170
|
+
|
|
171
|
+
const sentiment = await analyzeSentiment('I love this product!')
|
|
172
|
+
// { sentiment: 'positive', score: 0.95, confidence: 0.98, aspects: [...] }
|
|
173
|
+
|
|
174
|
+
const classification = await classifyText('Fix the login bug', ['bug', 'feature', 'question'])
|
|
175
|
+
// { label: 'bug', confidence: 0.92, allLabels: [...] }
|
|
176
|
+
|
|
177
|
+
const summary = await summarize(longText, { maxLength: 100, style: 'bullet' })
|
|
178
|
+
|
|
179
|
+
const profile = createProfile('user-123', ['tech', 'gaming'])
|
|
180
|
+
recordInteraction(profile, { type: 'view', itemId: 'article-1', weight: 1.0 })
|
|
181
|
+
const recs = await recommend(profile, contentItems, { limit: 10 })
|
|
182
|
+
const interests = await extractUserInterests(profile, items)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Buddy AI Assistant
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { processCommand, buddyProcessStreaming, buddyStreamSimple, getAvailableDrivers } from '@stacksjs/ai'
|
|
189
|
+
|
|
190
|
+
const drivers = getAvailableDrivers() // ['anthropic', 'openai', 'ollama']
|
|
191
|
+
const context = await getRepoContext('/path/to/repo')
|
|
192
|
+
await processCommand('Add error handling to auth.ts', 'anthropic')
|
|
193
|
+
// Streaming
|
|
194
|
+
for await (const chunk of buddyProcessStreaming('Refactor this function', 'openai', history)) {
|
|
195
|
+
process.stdout.write(chunk)
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Compact Project Context
|
|
200
|
+
|
|
201
|
+
Use the native context contract instead of sending dependency internals, lockfiles,
|
|
202
|
+
or an arbitrary repository dump to a coding model:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
buddy ai:context
|
|
206
|
+
buddy ai:context --json
|
|
207
|
+
buddy ai:context --json --output storage/framework/runtime/ai-context.json
|
|
208
|
+
buddy ai:context --max-chars 4000 --model claude-sonnet-4
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Programmatic callers use `buildProjectContext(projectRoot, options)`. Existing
|
|
212
|
+
`getRepoContext(projectRoot)` calls return its compact text payload. The contract
|
|
213
|
+
is deterministic, reports a heuristic token estimate, and describes canonical
|
|
214
|
+
Model-View-Action roles, application overrides, instruction files, scripts,
|
|
215
|
+
dependency names, and representative application files. It excludes
|
|
216
|
+
`node_modules`, build output, caches, lockfiles, environment files, credentials,
|
|
217
|
+
private keys, and secret files by default.
|
|
218
|
+
|
|
219
|
+
The character budget applies to the prompt payload. JSON adds a versioned metadata
|
|
220
|
+
envelope for tools. Token estimates are planning heuristics, not provider billing
|
|
221
|
+
counts or evidence that model output is correct.
|
|
222
|
+
|
|
223
|
+
## Claude Agent
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
import { createClaudeLocalAgent, createClaudeEC2Agent } from '@stacksjs/ai'
|
|
227
|
+
|
|
228
|
+
const agent = createClaudeLocalAgent({ cwd: '/project' })
|
|
229
|
+
for await (const chunk of agent.processCommandStreaming('Fix the tests')) {
|
|
230
|
+
process.stdout.write(chunk)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Remote EC2 agent
|
|
234
|
+
const remoteAgent = createClaudeEC2Agent({ ec2Host: '...', ec2User: '...', ec2Key: '...' })
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Claude Agent SDK
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
import { createClaudeAgentSDKDriver } from '@stacksjs/ai'
|
|
241
|
+
|
|
242
|
+
const driver = createClaudeAgentSDKDriver({
|
|
243
|
+
maxTurns: 10, cwd: '/project', permissionMode: 'auto',
|
|
244
|
+
allowedTools: ['Read', 'Write', 'Edit', 'Bash'],
|
|
245
|
+
customSystemPrompt: 'You are a Stacks expert'
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
for await (const chunk of driver.processStreaming('Build a user registration flow')) {
|
|
249
|
+
process.stdout.write(chunk)
|
|
250
|
+
}
|
|
251
|
+
const sessionId = driver.getLastSessionId()
|
|
252
|
+
await driver.resumeSession(sessionId, 'Add validation')
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## config/ai.ts
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
{
|
|
259
|
+
default: 'meta.llama2-70b-chat-v1',
|
|
260
|
+
models: ['meta.llama2-70b-chat-v1', ...], // AWS Bedrock models
|
|
261
|
+
deploy: true
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Gotchas
|
|
266
|
+
- API keys should be in `.env` — `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`
|
|
267
|
+
- Ollama requires a local server running on port 11434
|
|
268
|
+
- Image generation uses OpenAI DALL-E by default
|
|
269
|
+
- Vision supports both GPT-4V and Claude models
|
|
270
|
+
- VectorIndex is in-memory — not persisted between restarts
|
|
271
|
+
- RAG combines chunking + embedding + vector search + LLM generation
|
|
272
|
+
- MCP supports stdio (subprocess), SSE, and HTTP transports
|
|
273
|
+
- The buddy assistant has git integration (commit, push, apply changes)
|
|
274
|
+
- Claude Agent SDK wraps the Claude Code CLI for agentic workflows
|
|
275
|
+
- Bedrock utilities are for AWS-hosted model invocation
|
|
276
|
+
- Sentiment/classification use AI models — they're not rule-based
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stacks-alias
|
|
3
|
+
description: Use when working with path aliases in a Stacks project — import resolution, module aliasing, or debugging import paths. Covers @stacksjs/alias which defines 260+ path mappings for the entire framework.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
|
+
allowed-tools: Read Edit Write Bash Grep Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Stacks Path Aliases
|
|
10
|
+
|
|
11
|
+
## Key Paths
|
|
12
|
+
- Core package: `storage/framework/core/alias/src/`
|
|
13
|
+
- Source: `storage/framework/core/alias/src/index.ts`
|
|
14
|
+
- Package: `@stacksjs/alias`
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { alias } from '@stacksjs/alias'
|
|
20
|
+
|
|
21
|
+
const alias: Record<string, string> // 260+ entries
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Alias Categories
|
|
25
|
+
|
|
26
|
+
### Framework Module Aliases
|
|
27
|
+
Maps `@stacksjs/*` and `stacks/*` imports to their source files:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
'@stacksjs/ai': 'storage/framework/core/ai/src/index.ts'
|
|
31
|
+
'@stacksjs/auth': 'storage/framework/core/auth/src/index.ts'
|
|
32
|
+
'@stacksjs/database': 'storage/framework/core/database/src/index.ts'
|
|
33
|
+
'@stacksjs/router': 'storage/framework/core/router/src/index.ts'
|
|
34
|
+
'@stacksjs/cache': 'storage/framework/core/cache/src/index.ts'
|
|
35
|
+
'@stacksjs/cli': 'storage/framework/core/buddy/src/index.ts'
|
|
36
|
+
'@stacksjs/config': 'storage/framework/core/config/src/index.ts'
|
|
37
|
+
// ... all core packages
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Both `@stacksjs/` and `stacks/` prefixes are supported:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
'stacks/auth': 'storage/framework/core/auth/src/index.ts'
|
|
44
|
+
'stacks/database': 'storage/framework/core/database/src/index.ts'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Config Aliases
|
|
48
|
+
Maps `~/config/*` to config files:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
'~/config/database': 'config/database.ts'
|
|
52
|
+
'~/config/dns': 'config/dns.ts'
|
|
53
|
+
'~/config/docs': 'config/docs.ts'
|
|
54
|
+
'~/config/email': 'config/email.ts'
|
|
55
|
+
// ... all 44 config files
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Resource Aliases
|
|
59
|
+
Maps `~/` paths to project directories:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
'~/app/*': 'app/*'
|
|
63
|
+
'~/components/*': 'resources/components/*'
|
|
64
|
+
'~/functions/*': 'resources/functions/*'
|
|
65
|
+
'~/views/*': 'resources/views/*'
|
|
66
|
+
'~/lang/*': 'locales/*'
|
|
67
|
+
'~/*': '*'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Framework Aliases
|
|
71
|
+
```typescript
|
|
72
|
+
'framework/*': 'storage/framework/*'
|
|
73
|
+
'@/*': '*'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
Aliases are automatically resolved by Bun at runtime and by the build system for production:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// These all work because of aliases
|
|
82
|
+
import { db } from '@stacksjs/database'
|
|
83
|
+
import { route } from '@stacksjs/router'
|
|
84
|
+
import { auth } from 'stacks/auth'
|
|
85
|
+
import dbConfig from '~/config/database'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Gotchas
|
|
89
|
+
- **260+ entries** — covers every core package, config file, and resource directory
|
|
90
|
+
- **Dual prefixes** — both `@stacksjs/` and `stacks/` resolve to the same source files
|
|
91
|
+
- **Runtime resolution** — Bun resolves these at runtime via `bunfig.toml` preloading
|
|
92
|
+
- **Build-time resolution** — the build system resolves aliases to actual paths for production
|
|
93
|
+
- **Always use aliases** — never use relative paths between packages in the monorepo
|
|
94
|
+
- **Adding new packages** — requires adding alias entries for both `@stacksjs/` and `stacks/` prefixes
|