@askrjs/cli 0.0.2
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/LICENSE +201 -0
- package/README.md +140 -0
- package/dist/add-DqhqRzBQ.js +555 -0
- package/dist/add-DqhqRzBQ.js.map +1 -0
- package/dist/add.js +3 -0
- package/dist/cli.js +91 -0
- package/dist/cli.js.map +1 -0
- package/dist/create.js +923 -0
- package/dist/create.js.map +1 -0
- package/dist/is-direct-execution-Cdlr-ZUl.js +20 -0
- package/dist/is-direct-execution-Cdlr-ZUl.js.map +1 -0
- package/dist/openapi.js +127 -0
- package/dist/openapi.js.map +1 -0
- package/dist/skills/askr-accessibility/SKILL.md +68 -0
- package/dist/skills/askr-accessibility/agents/openai.yaml +4 -0
- package/dist/skills/askr-agent-execution/SKILL.md +85 -0
- package/dist/skills/askr-agent-execution/agents/openai.yaml +4 -0
- package/dist/skills/askr-agent-workflows/SKILL.md +57 -0
- package/dist/skills/askr-agent-workflows/agents/openai.yaml +4 -0
- package/dist/skills/askr-api-integration/SKILL.md +79 -0
- package/dist/skills/askr-api-integration/agents/openai.yaml +4 -0
- package/dist/skills/askr-app-builder/SKILL.md +99 -0
- package/dist/skills/askr-app-builder/agents/openai.yaml +4 -0
- package/dist/skills/askr-auth-access/SKILL.md +74 -0
- package/dist/skills/askr-auth-access/agents/openai.yaml +4 -0
- package/dist/skills/askr-cli-vite/SKILL.md +76 -0
- package/dist/skills/askr-cli-vite/agents/openai.yaml +4 -0
- package/dist/skills/askr-dashboard-charts/SKILL.md +82 -0
- package/dist/skills/askr-dashboard-charts/agents/openai.yaml +4 -0
- package/dist/skills/askr-design-system/SKILL.md +86 -0
- package/dist/skills/askr-design-system/agents/openai.yaml +4 -0
- package/dist/skills/askr-env-config/SKILL.md +74 -0
- package/dist/skills/askr-env-config/agents/openai.yaml +4 -0
- package/dist/skills/askr-error-loading-empty/SKILL.md +89 -0
- package/dist/skills/askr-error-loading-empty/agents/openai.yaml +4 -0
- package/dist/skills/askr-file-upload-artifacts/SKILL.md +77 -0
- package/dist/skills/askr-file-upload-artifacts/agents/openai.yaml +4 -0
- package/dist/skills/askr-forms-tables-crud/SKILL.md +98 -0
- package/dist/skills/askr-forms-tables-crud/agents/openai.yaml +4 -0
- package/dist/skills/askr-mental-model/SKILL.md +109 -0
- package/dist/skills/askr-mental-model/agents/openai.yaml +4 -0
- package/dist/skills/askr-migration-react/SKILL.md +81 -0
- package/dist/skills/askr-migration-react/agents/openai.yaml +4 -0
- package/dist/skills/askr-observability-debugging/SKILL.md +83 -0
- package/dist/skills/askr-observability-debugging/agents/openai.yaml +4 -0
- package/dist/skills/askr-project-structure/SKILL.md +79 -0
- package/dist/skills/askr-project-structure/agents/openai.yaml +4 -0
- package/dist/skills/askr-query-mutation/SKILL.md +115 -0
- package/dist/skills/askr-query-mutation/agents/openai.yaml +4 -0
- package/dist/skills/askr-realtime-streaming/SKILL.md +76 -0
- package/dist/skills/askr-realtime-streaming/agents/openai.yaml +4 -0
- package/dist/skills/askr-resources-data/SKILL.md +100 -0
- package/dist/skills/askr-resources-data/agents/openai.yaml +4 -0
- package/dist/skills/askr-routing-layouts/SKILL.md +107 -0
- package/dist/skills/askr-routing-layouts/agents/openai.yaml +4 -0
- package/dist/skills/askr-runtime-reactivity/SKILL.md +92 -0
- package/dist/skills/askr-runtime-reactivity/agents/openai.yaml +4 -0
- package/dist/skills/askr-ssr-ssg/SKILL.md +76 -0
- package/dist/skills/askr-ssr-ssg/agents/openai.yaml +4 -0
- package/dist/skills/askr-testing-determinism/SKILL.md +75 -0
- package/dist/skills/askr-testing-determinism/agents/openai.yaml +4 -0
- package/dist/skills/askr-theming/SKILL.md +86 -0
- package/dist/skills/askr-theming/agents/openai.yaml +4 -0
- package/dist/skills/askr-ui-composition/SKILL.md +92 -0
- package/dist/skills/askr-ui-composition/agents/openai.yaml +4 -0
- package/dist/skills-Bh0mEhIx.js +682 -0
- package/dist/skills-Bh0mEhIx.js.map +1 -0
- package/dist/skills.js +3 -0
- package/dist/ssg.js +188 -0
- package/dist/ssg.js.map +1 -0
- package/dist/templates/full-stack/AGENTS.md +12 -0
- package/dist/templates/full-stack/README.md +18 -0
- package/dist/templates/full-stack/gitignore.template +4 -0
- package/dist/templates/full-stack/index.html +14 -0
- package/dist/templates/full-stack/package.json +37 -0
- package/dist/templates/full-stack/server.ts +13 -0
- package/dist/templates/full-stack/src/action-authorizations.ts +10 -0
- package/dist/templates/full-stack/src/actions/create-message.ts +10 -0
- package/dist/templates/full-stack/src/i18n.ts +8 -0
- package/dist/templates/full-stack/src/main.tsx +12 -0
- package/dist/templates/full-stack/src/pages/home.tsx +25 -0
- package/dist/templates/full-stack/src/pages/layout.tsx +33 -0
- package/dist/templates/full-stack/src/pages/not-found.tsx +4 -0
- package/dist/templates/full-stack/src/routes.tsx +20 -0
- package/dist/templates/full-stack/src/schemas.ts +11 -0
- package/dist/templates/full-stack/src/server/action-registry.ts +12 -0
- package/dist/templates/full-stack/src/server/actions/create-message.ts +14 -0
- package/dist/templates/full-stack/src/server/app.ts +66 -0
- package/dist/templates/full-stack/src/server/dependencies.ts +55 -0
- package/dist/templates/full-stack/src/server/entry-server.ts +8 -0
- package/dist/templates/full-stack/src/telemetry.ts +4 -0
- package/dist/templates/full-stack/src/vite-server.d.ts +6 -0
- package/dist/templates/full-stack/tests/actions/create-message.test.ts +13 -0
- package/dist/templates/full-stack/tsconfig.json +16 -0
- package/dist/templates/full-stack/vite.config.ts +11 -0
- package/dist/templates/spa/AGENTS.md +60 -0
- package/dist/templates/spa/README.md +96 -0
- package/dist/templates/spa/gitignore.template +16 -0
- package/dist/templates/spa/index.html +13 -0
- package/dist/templates/spa/package.json +35 -0
- package/dist/templates/spa/src/adapters/operations-client.ts +90 -0
- package/dist/templates/spa/src/components/shared/metric-card.tsx +27 -0
- package/dist/templates/spa/src/components/shared/status-badge.tsx +24 -0
- package/dist/templates/spa/src/features/operations/operations.query.ts +9 -0
- package/dist/templates/spa/src/main.tsx +10 -0
- package/dist/templates/spa/src/pages/_layout.tsx +9 -0
- package/dist/templates/spa/src/pages/_routes.tsx +27 -0
- package/dist/templates/spa/src/pages/app/_layout.tsx +94 -0
- package/dist/templates/spa/src/pages/app/_routes.tsx +10 -0
- package/dist/templates/spa/src/pages/app/admin-home.tsx +152 -0
- package/dist/templates/spa/src/pages/app/agent-runs.tsx +93 -0
- package/dist/templates/spa/src/pages/app/settings.tsx +91 -0
- package/dist/templates/spa/src/pages/auth/_layout.tsx +38 -0
- package/dist/templates/spa/src/pages/auth/_routes.tsx +6 -0
- package/dist/templates/spa/src/pages/auth/login.tsx +63 -0
- package/dist/templates/spa/src/pages/not-found.tsx +22 -0
- package/dist/templates/spa/src/pages/public/_layout.tsx +47 -0
- package/dist/templates/spa/src/pages/public/_routes.tsx +6 -0
- package/dist/templates/spa/src/pages/public/home.tsx +143 -0
- package/dist/templates/spa/src/shared/format.ts +12 -0
- package/dist/templates/spa/src/shared/navigation.ts +15 -0
- package/dist/templates/spa/src/styles/components.css +49 -0
- package/dist/templates/spa/src/styles/layout.css +192 -0
- package/dist/templates/spa/src/styles/reset.css +44 -0
- package/dist/templates/spa/src/styles/theme.css +57 -0
- package/dist/templates/spa/src/styles/tokens.css +20 -0
- package/dist/templates/spa/src/styles.css +7 -0
- package/dist/templates/spa/src/styles.d.ts +1 -0
- package/dist/templates/spa/tests/app.test.tsx +37 -0
- package/dist/templates/spa/tests/components/shared.test.tsx +12 -0
- package/dist/templates/spa/tests/resources.test.ts +22 -0
- package/dist/templates/spa/tsconfig.json +20 -0
- package/dist/templates/spa/tsconfig.node.json +10 -0
- package/dist/templates/spa/vite.config.ts +24 -0
- package/dist/templates/spa/vitest.config.ts +17 -0
- package/dist/templates/ssg/AGENTS.md +55 -0
- package/dist/templates/ssg/README.md +39 -0
- package/dist/templates/ssg/gitignore.template +17 -0
- package/dist/templates/ssg/index.html +13 -0
- package/dist/templates/ssg/package.json +35 -0
- package/dist/templates/ssg/src/app.tsx +14 -0
- package/dist/templates/ssg/src/components/badge.tsx +3 -0
- package/dist/templates/ssg/src/components/counter.tsx +30 -0
- package/dist/templates/ssg/src/components/site-shell.tsx +111 -0
- package/dist/templates/ssg/src/jsx.d.ts +23 -0
- package/dist/templates/ssg/src/main.tsx +8 -0
- package/dist/templates/ssg/src/pages/about.tsx +82 -0
- package/dist/templates/ssg/src/pages/content.tsx +63 -0
- package/dist/templates/ssg/src/pages/example.tsx +97 -0
- package/dist/templates/ssg/src/pages/home.tsx +51 -0
- package/dist/templates/ssg/src/resources/user.ts +15 -0
- package/dist/templates/ssg/src/routes.tsx +15 -0
- package/dist/templates/ssg/src/styles.css +89 -0
- package/dist/templates/ssg/src/vite-env.d.ts +5 -0
- package/dist/templates/ssg/ssg.config.ts +34 -0
- package/dist/templates/ssg/tests/app.test.tsx +19 -0
- package/dist/templates/ssg/tests/components/counter.test.tsx +18 -0
- package/dist/templates/ssg/tests/resources.test.ts +11 -0
- package/dist/templates/ssg/tests/ssg-config.test.ts +11 -0
- package/dist/templates/ssg/tsconfig.json +20 -0
- package/dist/templates/ssg/tsconfig.node.json +10 -0
- package/dist/templates/ssg/vite.config.ts +24 -0
- package/dist/templates/ssg/vitest.config.ts +17 -0
- package/dist/templates/ssr/AGENTS.md +28 -0
- package/dist/templates/ssr/README.md +38 -0
- package/dist/templates/ssr/gitignore.template +16 -0
- package/dist/templates/ssr/index.html +13 -0
- package/dist/templates/ssr/package.json +34 -0
- package/dist/templates/ssr/server.ts +16 -0
- package/dist/templates/ssr/src/app.tsx +21 -0
- package/dist/templates/ssr/src/components/counter.tsx +26 -0
- package/dist/templates/ssr/src/entry-server.tsx +10 -0
- package/dist/templates/ssr/src/main.tsx +11 -0
- package/dist/templates/ssr/src/pages/about.tsx +75 -0
- package/dist/templates/ssr/src/pages/example.tsx +113 -0
- package/dist/templates/ssr/src/pages/home.tsx +56 -0
- package/dist/templates/ssr/src/resources/user.ts +15 -0
- package/dist/templates/ssr/src/routes.tsx +13 -0
- package/dist/templates/ssr/src/styles.css +148 -0
- package/dist/templates/ssr/src/vite-server.d.ts +7 -0
- package/dist/templates/ssr/tests/app.test.tsx +24 -0
- package/dist/templates/ssr/tests/components/counter.test.tsx +13 -0
- package/dist/templates/ssr/tests/resources.test.ts +11 -0
- package/dist/templates/ssr/tsconfig.json +22 -0
- package/dist/templates/ssr/tsconfig.node.json +10 -0
- package/dist/templates/ssr/tsconfig.server.json +15 -0
- package/dist/templates/ssr/vite.config.ts +25 -0
- package/dist/templates/ssr/vitest.config.ts +13 -0
- package/dist/templates/startkit/AGENTS.md +77 -0
- package/dist/templates/startkit/README.md +192 -0
- package/dist/templates/startkit/gitignore.template +16 -0
- package/dist/templates/startkit/index.html +13 -0
- package/dist/templates/startkit/package.json +35 -0
- package/dist/templates/startkit/src/components/app-header.tsx +93 -0
- package/dist/templates/startkit/src/components/app-sidebar.tsx +95 -0
- package/dist/templates/startkit/src/components/data-table.tsx +80 -0
- package/dist/templates/startkit/src/components/empty-state.tsx +13 -0
- package/dist/templates/startkit/src/components/page-header.tsx +23 -0
- package/dist/templates/startkit/src/components/stat-card.tsx +24 -0
- package/dist/templates/startkit/src/features/accounts/account-filters.tsx +61 -0
- package/dist/templates/startkit/src/features/accounts/account-table.tsx +79 -0
- package/dist/templates/startkit/src/lib/format.ts +31 -0
- package/dist/templates/startkit/src/lib/mock-data.ts +441 -0
- package/dist/templates/startkit/src/lib/routes.ts +116 -0
- package/dist/templates/startkit/src/main.tsx +12 -0
- package/dist/templates/startkit/src/pages/_layout.tsx +56 -0
- package/dist/templates/startkit/src/pages/auth/_layout.tsx +7 -0
- package/dist/templates/startkit/src/pages/auth/login.tsx +129 -0
- package/dist/templates/startkit/src/pages/home.tsx +83 -0
- package/dist/templates/startkit/src/pages/not-found.tsx +24 -0
- package/dist/templates/startkit/src/pages/workspace/_layout.tsx +17 -0
- package/dist/templates/startkit/src/pages/workspace/accounts/index.tsx +217 -0
- package/dist/templates/startkit/src/pages/workspace/dashboard.tsx +118 -0
- package/dist/templates/startkit/src/pages/workspace/settings.tsx +218 -0
- package/dist/templates/startkit/src/router.tsx +7 -0
- package/dist/templates/startkit/src/routes/auth-config.ts +38 -0
- package/dist/templates/startkit/src/routes/auth.ts +8 -0
- package/dist/templates/startkit/src/routes/index.ts +28 -0
- package/dist/templates/startkit/src/routes/public.ts +8 -0
- package/dist/templates/startkit/src/routes/workspace/accounts.ts +8 -0
- package/dist/templates/startkit/src/routes/workspace/index.ts +14 -0
- package/dist/templates/startkit/src/styles/components.css +396 -0
- package/dist/templates/startkit/src/styles/layout.css +192 -0
- package/dist/templates/startkit/src/styles/reset.css +38 -0
- package/dist/templates/startkit/src/styles/theme.css +76 -0
- package/dist/templates/startkit/src/styles/tokens.css +67 -0
- package/dist/templates/startkit/src/styles.css +7 -0
- package/dist/templates/startkit/src/toast.ts +55 -0
- package/dist/templates/startkit/src/utils/join-classes.ts +4 -0
- package/dist/templates/startkit/src/vite-env.d.ts +5 -0
- package/dist/templates/startkit/tests/app.test.tsx +32 -0
- package/dist/templates/startkit/tests/preferences.test.ts +43 -0
- package/dist/templates/startkit/tests/resources.test.ts +82 -0
- package/dist/templates/startkit/tsconfig.json +20 -0
- package/dist/templates/startkit/tsconfig.node.json +10 -0
- package/dist/templates/startkit/vite.config.ts +32 -0
- package/dist/templates/startkit/vitest.config.ts +13 -0
- package/dist/update-DyW1na5V.js +1140 -0
- package/dist/update-DyW1na5V.js.map +1 -0
- package/dist/update.js +3 -0
- package/package.json +84 -0
- package/skills/askr-accessibility/SKILL.md +68 -0
- package/skills/askr-accessibility/agents/openai.yaml +4 -0
- package/skills/askr-agent-execution/SKILL.md +85 -0
- package/skills/askr-agent-execution/agents/openai.yaml +4 -0
- package/skills/askr-agent-workflows/SKILL.md +57 -0
- package/skills/askr-agent-workflows/agents/openai.yaml +4 -0
- package/skills/askr-api-integration/SKILL.md +79 -0
- package/skills/askr-api-integration/agents/openai.yaml +4 -0
- package/skills/askr-app-builder/SKILL.md +99 -0
- package/skills/askr-app-builder/agents/openai.yaml +4 -0
- package/skills/askr-auth-access/SKILL.md +74 -0
- package/skills/askr-auth-access/agents/openai.yaml +4 -0
- package/skills/askr-cli-vite/SKILL.md +76 -0
- package/skills/askr-cli-vite/agents/openai.yaml +4 -0
- package/skills/askr-dashboard-charts/SKILL.md +82 -0
- package/skills/askr-dashboard-charts/agents/openai.yaml +4 -0
- package/skills/askr-design-system/SKILL.md +86 -0
- package/skills/askr-design-system/agents/openai.yaml +4 -0
- package/skills/askr-env-config/SKILL.md +74 -0
- package/skills/askr-env-config/agents/openai.yaml +4 -0
- package/skills/askr-error-loading-empty/SKILL.md +89 -0
- package/skills/askr-error-loading-empty/agents/openai.yaml +4 -0
- package/skills/askr-file-upload-artifacts/SKILL.md +77 -0
- package/skills/askr-file-upload-artifacts/agents/openai.yaml +4 -0
- package/skills/askr-forms-tables-crud/SKILL.md +98 -0
- package/skills/askr-forms-tables-crud/agents/openai.yaml +4 -0
- package/skills/askr-mental-model/SKILL.md +109 -0
- package/skills/askr-mental-model/agents/openai.yaml +4 -0
- package/skills/askr-migration-react/SKILL.md +81 -0
- package/skills/askr-migration-react/agents/openai.yaml +4 -0
- package/skills/askr-observability-debugging/SKILL.md +83 -0
- package/skills/askr-observability-debugging/agents/openai.yaml +4 -0
- package/skills/askr-project-structure/SKILL.md +79 -0
- package/skills/askr-project-structure/agents/openai.yaml +4 -0
- package/skills/askr-query-mutation/SKILL.md +115 -0
- package/skills/askr-query-mutation/agents/openai.yaml +4 -0
- package/skills/askr-realtime-streaming/SKILL.md +76 -0
- package/skills/askr-realtime-streaming/agents/openai.yaml +4 -0
- package/skills/askr-resources-data/SKILL.md +100 -0
- package/skills/askr-resources-data/agents/openai.yaml +4 -0
- package/skills/askr-routing-layouts/SKILL.md +107 -0
- package/skills/askr-routing-layouts/agents/openai.yaml +4 -0
- package/skills/askr-runtime-reactivity/SKILL.md +92 -0
- package/skills/askr-runtime-reactivity/agents/openai.yaml +4 -0
- package/skills/askr-ssr-ssg/SKILL.md +76 -0
- package/skills/askr-ssr-ssg/agents/openai.yaml +4 -0
- package/skills/askr-testing-determinism/SKILL.md +75 -0
- package/skills/askr-testing-determinism/agents/openai.yaml +4 -0
- package/skills/askr-theming/SKILL.md +86 -0
- package/skills/askr-theming/agents/openai.yaml +4 -0
- package/skills/askr-ui-composition/SKILL.md +92 -0
- package/skills/askr-ui-composition/agents/openai.yaml +4 -0
- package/templates/full-stack/AGENTS.md +12 -0
- package/templates/full-stack/README.md +18 -0
- package/templates/full-stack/gitignore.template +4 -0
- package/templates/full-stack/index.html +14 -0
- package/templates/full-stack/package.json +37 -0
- package/templates/full-stack/server.ts +13 -0
- package/templates/full-stack/src/action-authorizations.ts +10 -0
- package/templates/full-stack/src/actions/create-message.ts +10 -0
- package/templates/full-stack/src/i18n.ts +8 -0
- package/templates/full-stack/src/main.tsx +12 -0
- package/templates/full-stack/src/pages/home.tsx +25 -0
- package/templates/full-stack/src/pages/layout.tsx +33 -0
- package/templates/full-stack/src/pages/not-found.tsx +4 -0
- package/templates/full-stack/src/routes.tsx +20 -0
- package/templates/full-stack/src/schemas.ts +11 -0
- package/templates/full-stack/src/server/action-registry.ts +12 -0
- package/templates/full-stack/src/server/actions/create-message.ts +14 -0
- package/templates/full-stack/src/server/app.ts +66 -0
- package/templates/full-stack/src/server/dependencies.ts +55 -0
- package/templates/full-stack/src/server/entry-server.ts +8 -0
- package/templates/full-stack/src/telemetry.ts +4 -0
- package/templates/full-stack/src/vite-server.d.ts +6 -0
- package/templates/full-stack/tests/actions/create-message.test.ts +13 -0
- package/templates/full-stack/tsconfig.json +16 -0
- package/templates/full-stack/vite.config.ts +11 -0
- package/templates/spa/AGENTS.md +60 -0
- package/templates/spa/README.md +96 -0
- package/templates/spa/gitignore.template +16 -0
- package/templates/spa/index.html +13 -0
- package/templates/spa/package.json +35 -0
- package/templates/spa/src/adapters/operations-client.ts +90 -0
- package/templates/spa/src/components/shared/metric-card.tsx +27 -0
- package/templates/spa/src/components/shared/status-badge.tsx +24 -0
- package/templates/spa/src/features/operations/operations.query.ts +9 -0
- package/templates/spa/src/main.tsx +10 -0
- package/templates/spa/src/pages/_layout.tsx +9 -0
- package/templates/spa/src/pages/_routes.tsx +27 -0
- package/templates/spa/src/pages/app/_layout.tsx +94 -0
- package/templates/spa/src/pages/app/_routes.tsx +10 -0
- package/templates/spa/src/pages/app/admin-home.tsx +152 -0
- package/templates/spa/src/pages/app/agent-runs.tsx +93 -0
- package/templates/spa/src/pages/app/settings.tsx +91 -0
- package/templates/spa/src/pages/auth/_layout.tsx +38 -0
- package/templates/spa/src/pages/auth/_routes.tsx +6 -0
- package/templates/spa/src/pages/auth/login.tsx +63 -0
- package/templates/spa/src/pages/not-found.tsx +22 -0
- package/templates/spa/src/pages/public/_layout.tsx +47 -0
- package/templates/spa/src/pages/public/_routes.tsx +6 -0
- package/templates/spa/src/pages/public/home.tsx +143 -0
- package/templates/spa/src/shared/format.ts +12 -0
- package/templates/spa/src/shared/navigation.ts +15 -0
- package/templates/spa/src/styles/components.css +49 -0
- package/templates/spa/src/styles/layout.css +192 -0
- package/templates/spa/src/styles/reset.css +44 -0
- package/templates/spa/src/styles/theme.css +57 -0
- package/templates/spa/src/styles/tokens.css +20 -0
- package/templates/spa/src/styles.css +7 -0
- package/templates/spa/src/styles.d.ts +1 -0
- package/templates/spa/tests/app.test.tsx +37 -0
- package/templates/spa/tests/components/shared.test.tsx +12 -0
- package/templates/spa/tests/resources.test.ts +22 -0
- package/templates/spa/tsconfig.json +20 -0
- package/templates/spa/tsconfig.node.json +10 -0
- package/templates/spa/vite.config.ts +24 -0
- package/templates/spa/vitest.config.ts +17 -0
- package/templates/ssg/AGENTS.md +55 -0
- package/templates/ssg/README.md +39 -0
- package/templates/ssg/gitignore.template +17 -0
- package/templates/ssg/index.html +13 -0
- package/templates/ssg/package.json +35 -0
- package/templates/ssg/src/app.tsx +14 -0
- package/templates/ssg/src/components/badge.tsx +3 -0
- package/templates/ssg/src/components/counter.tsx +30 -0
- package/templates/ssg/src/components/site-shell.tsx +111 -0
- package/templates/ssg/src/jsx.d.ts +23 -0
- package/templates/ssg/src/main.tsx +8 -0
- package/templates/ssg/src/pages/about.tsx +82 -0
- package/templates/ssg/src/pages/content.tsx +63 -0
- package/templates/ssg/src/pages/example.tsx +97 -0
- package/templates/ssg/src/pages/home.tsx +51 -0
- package/templates/ssg/src/resources/user.ts +15 -0
- package/templates/ssg/src/routes.tsx +15 -0
- package/templates/ssg/src/styles.css +89 -0
- package/templates/ssg/src/vite-env.d.ts +5 -0
- package/templates/ssg/ssg.config.ts +34 -0
- package/templates/ssg/tests/app.test.tsx +19 -0
- package/templates/ssg/tests/components/counter.test.tsx +18 -0
- package/templates/ssg/tests/resources.test.ts +11 -0
- package/templates/ssg/tests/ssg-config.test.ts +11 -0
- package/templates/ssg/tsconfig.json +20 -0
- package/templates/ssg/tsconfig.node.json +10 -0
- package/templates/ssg/vite.config.ts +24 -0
- package/templates/ssg/vitest.config.ts +17 -0
- package/templates/ssr/AGENTS.md +28 -0
- package/templates/ssr/README.md +38 -0
- package/templates/ssr/gitignore.template +16 -0
- package/templates/ssr/index.html +13 -0
- package/templates/ssr/package.json +34 -0
- package/templates/ssr/server.ts +16 -0
- package/templates/ssr/src/app.tsx +21 -0
- package/templates/ssr/src/components/counter.tsx +26 -0
- package/templates/ssr/src/entry-server.tsx +10 -0
- package/templates/ssr/src/main.tsx +11 -0
- package/templates/ssr/src/pages/about.tsx +75 -0
- package/templates/ssr/src/pages/example.tsx +113 -0
- package/templates/ssr/src/pages/home.tsx +56 -0
- package/templates/ssr/src/resources/user.ts +15 -0
- package/templates/ssr/src/routes.tsx +13 -0
- package/templates/ssr/src/styles.css +148 -0
- package/templates/ssr/src/vite-server.d.ts +7 -0
- package/templates/ssr/tests/app.test.tsx +24 -0
- package/templates/ssr/tests/components/counter.test.tsx +13 -0
- package/templates/ssr/tests/resources.test.ts +11 -0
- package/templates/ssr/tsconfig.json +22 -0
- package/templates/ssr/tsconfig.node.json +10 -0
- package/templates/ssr/tsconfig.server.json +15 -0
- package/templates/ssr/vite.config.ts +25 -0
- package/templates/ssr/vitest.config.ts +13 -0
- package/templates/startkit/AGENTS.md +77 -0
- package/templates/startkit/README.md +192 -0
- package/templates/startkit/gitignore.template +16 -0
- package/templates/startkit/index.html +13 -0
- package/templates/startkit/package.json +35 -0
- package/templates/startkit/src/components/app-header.tsx +93 -0
- package/templates/startkit/src/components/app-sidebar.tsx +95 -0
- package/templates/startkit/src/components/data-table.tsx +80 -0
- package/templates/startkit/src/components/empty-state.tsx +13 -0
- package/templates/startkit/src/components/page-header.tsx +23 -0
- package/templates/startkit/src/components/stat-card.tsx +24 -0
- package/templates/startkit/src/features/accounts/account-filters.tsx +61 -0
- package/templates/startkit/src/features/accounts/account-table.tsx +79 -0
- package/templates/startkit/src/lib/format.ts +31 -0
- package/templates/startkit/src/lib/mock-data.ts +441 -0
- package/templates/startkit/src/lib/routes.ts +116 -0
- package/templates/startkit/src/main.tsx +12 -0
- package/templates/startkit/src/pages/_layout.tsx +56 -0
- package/templates/startkit/src/pages/auth/_layout.tsx +7 -0
- package/templates/startkit/src/pages/auth/login.tsx +129 -0
- package/templates/startkit/src/pages/home.tsx +83 -0
- package/templates/startkit/src/pages/not-found.tsx +24 -0
- package/templates/startkit/src/pages/workspace/_layout.tsx +17 -0
- package/templates/startkit/src/pages/workspace/accounts/index.tsx +217 -0
- package/templates/startkit/src/pages/workspace/dashboard.tsx +118 -0
- package/templates/startkit/src/pages/workspace/settings.tsx +218 -0
- package/templates/startkit/src/router.tsx +7 -0
- package/templates/startkit/src/routes/auth-config.ts +38 -0
- package/templates/startkit/src/routes/auth.ts +8 -0
- package/templates/startkit/src/routes/index.ts +28 -0
- package/templates/startkit/src/routes/public.ts +8 -0
- package/templates/startkit/src/routes/workspace/accounts.ts +8 -0
- package/templates/startkit/src/routes/workspace/index.ts +14 -0
- package/templates/startkit/src/styles/components.css +396 -0
- package/templates/startkit/src/styles/layout.css +192 -0
- package/templates/startkit/src/styles/reset.css +38 -0
- package/templates/startkit/src/styles/theme.css +76 -0
- package/templates/startkit/src/styles/tokens.css +67 -0
- package/templates/startkit/src/styles.css +7 -0
- package/templates/startkit/src/toast.ts +55 -0
- package/templates/startkit/src/utils/join-classes.ts +4 -0
- package/templates/startkit/src/vite-env.d.ts +5 -0
- package/templates/startkit/tests/app.test.tsx +32 -0
- package/templates/startkit/tests/preferences.test.ts +43 -0
- package/templates/startkit/tests/resources.test.ts +82 -0
- package/templates/startkit/tsconfig.json +20 -0
- package/templates/startkit/tsconfig.node.json +10 -0
- package/templates/startkit/vite.config.ts +32 -0
- package/templates/startkit/vitest.config.ts +13 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-file-upload-artifacts
|
|
3
|
+
description: Use when building Askr file uploads, generated artifacts, progress, previews, validation, storage adapters, downloads, open flows, virus-scan or processing states, and event-sourced artifact readiness.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr File Upload Artifacts
|
|
7
|
+
|
|
8
|
+
Use this for uploads, downloads, previews, and generated files. The goal is one clear upload workflow, explicit processing truth, and no loss of progress or readiness state.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- You need file selection, upload, processing, preview, or download flows.
|
|
13
|
+
- Artifacts may be generated asynchronously after upload.
|
|
14
|
+
- You need progress, retry, cancellation, or readiness reconciliation.
|
|
15
|
+
- Validation rules include type, size, count, privacy, or retention.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- Adapter support for upload URLs, multipart uploads, or artifact APIs
|
|
20
|
+
- Feature workflow for create, upload, process, and download
|
|
21
|
+
- File validation rules: type, size, count, privacy, retention
|
|
22
|
+
- Artifact processing states and event stream support
|
|
23
|
+
|
|
24
|
+
## Choose The Boundary
|
|
25
|
+
|
|
26
|
+
- `src/adapters`: upload transport, signed URL calls, artifact downloads.
|
|
27
|
+
- `src/features/<feature>`: validation, upload workflow, and artifact query or mutation state.
|
|
28
|
+
- `src/components/shared`: reusable file picker, progress list, and preview shell.
|
|
29
|
+
- `src/shared`: size formatting, safe filename helpers, and error normalization.
|
|
30
|
+
|
|
31
|
+
## Do This In Order
|
|
32
|
+
|
|
33
|
+
1. Keep file validation explicit before upload starts.
|
|
34
|
+
2. Model selection, uploading, processing, ready, and failure as separate states.
|
|
35
|
+
3. Preserve upload ID, artifact ID, processing job ID, and last event ID when readiness is asynchronous.
|
|
36
|
+
4. Treat upload completion and artifact readiness as separate truths.
|
|
37
|
+
5. Allow retry or refresh without duplicating uploads where possible.
|
|
38
|
+
|
|
39
|
+
## Copy This Shape
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
type ArtifactStatus =
|
|
43
|
+
| "selected"
|
|
44
|
+
| "uploading"
|
|
45
|
+
| "processing"
|
|
46
|
+
| "ready"
|
|
47
|
+
| "failed-validation"
|
|
48
|
+
| "failed-upload"
|
|
49
|
+
| "failed-processing";
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Never Do These
|
|
53
|
+
|
|
54
|
+
- Pretending an artifact is ready immediately after upload when processing is asynchronous.
|
|
55
|
+
- Client-only validation as the only protection.
|
|
56
|
+
- Losing progress and error state on route-local rerenders.
|
|
57
|
+
- Download links without accessible names or file metadata.
|
|
58
|
+
|
|
59
|
+
## Validate
|
|
60
|
+
|
|
61
|
+
- Validation, upload, processing, ready, and failure states are visible.
|
|
62
|
+
- Upload cancellation or retry behavior is explicit.
|
|
63
|
+
- Large files and unsupported types fail clearly.
|
|
64
|
+
- Artifact readiness is reconciled from server state.
|
|
65
|
+
|
|
66
|
+
## Done When
|
|
67
|
+
|
|
68
|
+
- Upload completion and artifact readiness are modeled separately.
|
|
69
|
+
- Progress and error state survive the owning workflow.
|
|
70
|
+
- Artifact metadata is preserved for retries and reconciliation.
|
|
71
|
+
- Users can understand whether a file is uploaded, processing, ready, or failed.
|
|
72
|
+
|
|
73
|
+
## Handoff
|
|
74
|
+
|
|
75
|
+
- Use `askr-api-integration` when signed URLs or artifact APIs are the hard part.
|
|
76
|
+
- Use `askr-error-loading-empty` when the hard part is presenting processing and failure truth.
|
|
77
|
+
- Use `askr-testing-determinism` before closing upload and retry behavior.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-forms-tables-crud
|
|
3
|
+
description: Use when building askr CRUD screens, forms, validation, filters, tables, pagination, selection, bulk actions, confirmation dialogs, row actions, resource/query data flow, and feature folder boundaries.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Forms Tables CRUD
|
|
7
|
+
|
|
8
|
+
Use this for create, read, update, archive, filter, paginate, and edit workflows. The goal is a predictable split between route composition, feature workflow state, and transport boundaries.
|
|
9
|
+
|
|
10
|
+
## Inspect First
|
|
11
|
+
|
|
12
|
+
- The nearest page that owns a table or form.
|
|
13
|
+
- The nearest feature folder for the same domain.
|
|
14
|
+
- The adapter or service that owns transport.
|
|
15
|
+
- Existing tests that cover filtering, submission, or destructive actions.
|
|
16
|
+
|
|
17
|
+
## Use This When
|
|
18
|
+
|
|
19
|
+
- You are adding a list, detail, create, edit, archive, or bulk-action flow.
|
|
20
|
+
- You need filters, pagination, selection, or row actions.
|
|
21
|
+
- You need field validation and server validation errors.
|
|
22
|
+
- You need a safe destructive action flow.
|
|
23
|
+
|
|
24
|
+
## Pick The Owner
|
|
25
|
+
|
|
26
|
+
- The route or page composes the screen.
|
|
27
|
+
- The feature folder owns filters, form state, table columns, queries, and mutations.
|
|
28
|
+
- The adapter owns fetch, update, archive, and DTO mapping.
|
|
29
|
+
- Shared helpers own cross-cutting formatting and validation helpers when reused.
|
|
30
|
+
|
|
31
|
+
## Copy This Shape
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
src/pages/app/users.tsx
|
|
35
|
+
src/features/users/user-table.tsx
|
|
36
|
+
src/features/users/user-filters.tsx
|
|
37
|
+
src/features/users/user-form.tsx
|
|
38
|
+
src/features/users/users.query.ts
|
|
39
|
+
src/features/users/users.mutation.ts
|
|
40
|
+
src/adapters/users-client.ts
|
|
41
|
+
src/shared/format.ts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Routes compose the screen. Features own domain UI and workflow state. Adapters own transport. Shared helpers own cross-cutting formatting or validation utilities.
|
|
45
|
+
|
|
46
|
+
## Do This In Order
|
|
47
|
+
|
|
48
|
+
1. Choose the async owner first: `resource()` for route-owned reads, `createQuery()` for shared keyed reads, and `createMutation()` for writes.
|
|
49
|
+
2. Keep filters, pagination, dialog state, and selected IDs in local `state()` pairs, and read or write each one through its `[getter, setter]` pair.
|
|
50
|
+
3. Keep field validation and submit handling explicit in the feature layer.
|
|
51
|
+
4. Confirm destructive actions before archive or delete.
|
|
52
|
+
5. Refresh or invalidate after create, update, archive, or delete.
|
|
53
|
+
|
|
54
|
+
## Table Rules
|
|
55
|
+
|
|
56
|
+
- Use stable row keys, never index keys for records.
|
|
57
|
+
- Put feature-specific columns in the feature folder.
|
|
58
|
+
- Use `selector()` for keyed row selection fanout when the table is large or hot.
|
|
59
|
+
- Provide loading, empty, error, and disabled action states.
|
|
60
|
+
- Keep formatting in `src/shared/format.ts` or a domain feature helper.
|
|
61
|
+
|
|
62
|
+
## Form Rules
|
|
63
|
+
|
|
64
|
+
- Keep form state local unless multiple routes need it.
|
|
65
|
+
- Put validation rules in `src/features/<feature>` when domain-specific, or `src/shared` when cross-cutting.
|
|
66
|
+
- Use `@askrjs/ui` form controls for behavior and accessibility.
|
|
67
|
+
- Disable submit while pending and surface field or form errors explicitly.
|
|
68
|
+
|
|
69
|
+
- API clients in table, form, or generic UI components.
|
|
70
|
+
- Bound live or frequently updating rows so tables and timelines do not churn the whole DOM.
|
|
71
|
+
- Keep filtering, sorting, and pagination state together in the feature workflow instead of scattering it across route files.
|
|
72
|
+
- Business rules in reusable primitives.
|
|
73
|
+
- Hidden destructive actions without confirmation.
|
|
74
|
+
- Duplicated pagination/filter logic across route files.
|
|
75
|
+
- A table component that imports a raw API client and mutates records directly from row actions.
|
|
76
|
+
- A form that shows only a toast on submit failure and never maps field errors back to inputs.
|
|
77
|
+
- Pagination, sorting, and filter state duplicated in multiple route pages.
|
|
78
|
+
|
|
79
|
+
## Validate
|
|
80
|
+
|
|
81
|
+
- CRUD ownership boundaries are obvious.
|
|
82
|
+
- Every async path has loading, error, retry, or disabled feedback.
|
|
83
|
+
- Selection, bulk actions, and destructive actions are keyboard reachable.
|
|
84
|
+
- Submit handlers preserve pending state and field or form errors.
|
|
85
|
+
- Record rows use stable keys.
|
|
86
|
+
|
|
87
|
+
## Done When
|
|
88
|
+
|
|
89
|
+
- Form, table, mutation, and adapter ownership are separated.
|
|
90
|
+
- Field errors, form errors, pending state, and success state are all visible.
|
|
91
|
+
- Selection, filters, sorting, and destructive actions are keyboard reachable.
|
|
92
|
+
- Rows keep stable identity and large updates do not force whole-list churn.
|
|
93
|
+
|
|
94
|
+
## Handoff
|
|
95
|
+
|
|
96
|
+
- Use `askr-query-mutation` when the form or table state becomes shared keyed state across screens.
|
|
97
|
+
- Use `askr-accessibility` when validation, focus, or destructive-action UX is the hard part.
|
|
98
|
+
- Use `askr-testing-determinism` to validate submit, retry, selection, and list identity behavior.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-mental-model
|
|
3
|
+
description: Use when an AI agent or developer needs the canonical Askr mental model, including what Askr is, what it is not, how core primitives fit together, and which React-style assumptions must be rejected.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Mental Model
|
|
7
|
+
|
|
8
|
+
Use this before building or reviewing Askr code when primitive choice is unclear. This skill exists to keep agents on the native Askr path and off React-shaped defaults.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- Primitive choice is unclear.
|
|
13
|
+
- The task looks like React, hooks, or a generic SPA by default.
|
|
14
|
+
- You need to decide who owns local state, async reads, or writes.
|
|
15
|
+
- You need one obvious Askr-native shape before editing.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- `AGENTS.md` when it exists
|
|
20
|
+
- `src/main.tsx`
|
|
21
|
+
- The nearest route file and layout file
|
|
22
|
+
- The nearest existing feature that solves a similar problem
|
|
23
|
+
- Existing tests for the touched surface
|
|
24
|
+
|
|
25
|
+
## What Askr Expects
|
|
26
|
+
|
|
27
|
+
- Route-first ownership.
|
|
28
|
+
- Synchronous route components.
|
|
29
|
+
- Explicit runtime primitives for state, derived state, lifecycle-owned async work, shared server state, and writes.
|
|
30
|
+
- Honest UI for loading, empty, error, stale, and pending-write states.
|
|
31
|
+
|
|
32
|
+
## What Askr Is Not
|
|
33
|
+
|
|
34
|
+
- Not a React hooks runtime.
|
|
35
|
+
- Not a place to default to `useEffect` data loading.
|
|
36
|
+
- Not a reason to add React Router, TanStack Query, or a global state library first.
|
|
37
|
+
- Not a place to clone solved `Button`, `Card`, `Sidebar`, `EmptyState`, or shell primitives before checking the existing theme and UI layers.
|
|
38
|
+
|
|
39
|
+
## Pick The Primitive
|
|
40
|
+
|
|
41
|
+
- Local mutable UI state: use `state()` as a `[getter, setter]` pair.
|
|
42
|
+
- Computed value from reactive reads: use `derive()`.
|
|
43
|
+
- One source fans out to many keyed readers: use `selector()`.
|
|
44
|
+
- One route or container owns an async read lifecycle: use `resource()`.
|
|
45
|
+
- Shared keyed server state used across screens: use `createQuery()`.
|
|
46
|
+
- Writes with pending, error, and reconciliation state: use `createMutation()`.
|
|
47
|
+
- Keyed or dynamic list identity matters: use `For`.
|
|
48
|
+
|
|
49
|
+
## Copy This Shape
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { derive, selector, state } from "@askrjs/askr";
|
|
53
|
+
import { For } from "@askrjs/askr/control";
|
|
54
|
+
|
|
55
|
+
const [selectedId, setSelectedId] = state<string | null>(null);
|
|
56
|
+
const isSelected = selector(selectedId);
|
|
57
|
+
const items = derive(() => [
|
|
58
|
+
{ id: "queued", label: "Queued" },
|
|
59
|
+
{ id: "running", label: "Running" },
|
|
60
|
+
{ id: "done", label: "Done" },
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
export default function RunFilterBar() {
|
|
64
|
+
return (
|
|
65
|
+
<nav aria-label="Run status filters">
|
|
66
|
+
<For each={items()} by={(item) => item.id}>
|
|
67
|
+
{(item) => (
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
aria-pressed={isSelected(item.id)}
|
|
71
|
+
onClick={() => setSelectedId(item.id)}
|
|
72
|
+
>
|
|
73
|
+
{item.label}
|
|
74
|
+
</button>
|
|
75
|
+
)}
|
|
76
|
+
</For>
|
|
77
|
+
</nav>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Reject These Shapes
|
|
83
|
+
|
|
84
|
+
- React imports or hook-shaped state as the default solution.
|
|
85
|
+
- Effect-driven loading when the UI depends on the async result.
|
|
86
|
+
- Treating getters like plain values instead of callable reads.
|
|
87
|
+
- Creating runtime helpers conditionally.
|
|
88
|
+
- Defaulting to `.map()` for large or dynamic keyed lists where `For` should own identity.
|
|
89
|
+
- Hiding data transport, mapping, and mutations inside pages or presentational components.
|
|
90
|
+
|
|
91
|
+
## Validate
|
|
92
|
+
|
|
93
|
+
- Primitive choice is explainable in one sentence.
|
|
94
|
+
- Route components remain synchronous.
|
|
95
|
+
- Keyed UI uses stable IDs.
|
|
96
|
+
- No React runtime imports or hook defaults slipped in.
|
|
97
|
+
- Async state truth is explicit where the user can observe it.
|
|
98
|
+
|
|
99
|
+
## Done When
|
|
100
|
+
|
|
101
|
+
- The code reads like Askr, not like translated React.
|
|
102
|
+
- No invented primitives or parallel state layers were added.
|
|
103
|
+
- The next narrower skill is obvious from the changed surface.
|
|
104
|
+
|
|
105
|
+
## Handoff
|
|
106
|
+
|
|
107
|
+
- Use `askr-routing-layouts` when the next step is route ownership or shell structure.
|
|
108
|
+
- Use `askr-resources-data` or `askr-query-mutation` when the next step is async ownership.
|
|
109
|
+
- Use `askr-runtime-reactivity` when the next step is local state or keyed rendering behavior.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-migration-react
|
|
3
|
+
description: Use when translating React-shaped code, habits, or component designs into idiomatic Askr, including replacing useState/useEffect patterns, JSX assumptions, data fetching, routing, context, component APIs, and UI primitive choices.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Migration React
|
|
7
|
+
|
|
8
|
+
Use this only when a task, sample, or codebase slice is React-shaped and must be translated into idiomatic Askr. It is a transition skill, not a default entrypoint for normal Askr feature work.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- The input code or prompt uses React hooks, React Router, or React-only UI assumptions.
|
|
13
|
+
- A generated design mirrors React patterns that need translation before implementation.
|
|
14
|
+
- A migration task needs native Askr ownership for state, async work, routing, or primitives.
|
|
15
|
+
- The fastest path is to convert a known React shape instead of designing from scratch.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- The current app's Askr imports and component patterns
|
|
20
|
+
- The route tree and feature boundaries already present in the repo
|
|
21
|
+
- The React-shaped state, async, routing, and primitive assumptions you are replacing
|
|
22
|
+
|
|
23
|
+
## Choose The Replacement
|
|
24
|
+
|
|
25
|
+
- React `useState` -> Askr `state()` as a `[getter, setter]` pair.
|
|
26
|
+
- React `useMemo` -> Askr `derive()` when a reactive computation is needed.
|
|
27
|
+
- React `useEffect` data loading -> Askr `resource()` or `createQuery()` based on ownership.
|
|
28
|
+
- React Router component routes -> Askr route registration with `group()`, `page()`, `route()`, and `fallback()`.
|
|
29
|
+
- React context -> Askr `defineScope()` and `readScope()`.
|
|
30
|
+
- React keyed list `.map` -> `For` when identity or dynamic list updates matter.
|
|
31
|
+
|
|
32
|
+
## Do This In Order
|
|
33
|
+
|
|
34
|
+
1. Identify whether the React-shaped code is really local state, shared data, routing, context, or primitive behavior.
|
|
35
|
+
2. Remove React imports and hook assumptions before translating line by line.
|
|
36
|
+
3. Replace state, async, routing, and context with the owning Askr primitives.
|
|
37
|
+
4. Move feature logic to the correct route, feature, adapter, or shared boundary.
|
|
38
|
+
5. Replace React-only UI libraries with Askr-compatible primitives when behavior matters.
|
|
39
|
+
6. Validate call order, async truth, and route registration before closing the migration.
|
|
40
|
+
|
|
41
|
+
## Copy This Shape
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { state } from "@askrjs/askr";
|
|
45
|
+
import { resource } from "@askrjs/askr/resources";
|
|
46
|
+
|
|
47
|
+
const [open, setOpen] = state(false);
|
|
48
|
+
const user = resource(({ signal }) => loadUser(id, { signal }), [id]);
|
|
49
|
+
|
|
50
|
+
<button onClick={() => setOpen((value) => !value)}>{open() ? "Close" : "Open"}</button>;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Never Do These
|
|
54
|
+
|
|
55
|
+
- Importing React hooks or React runtime helpers.
|
|
56
|
+
- Treating state getters like values instead of functions.
|
|
57
|
+
- Porting React Router route components directly.
|
|
58
|
+
- Hiding async work in effects when the UI depends on it.
|
|
59
|
+
- Assuming third-party React component packages are compatible.
|
|
60
|
+
|
|
61
|
+
## Validate
|
|
62
|
+
|
|
63
|
+
- No React imports remain unless the project intentionally embeds React separately.
|
|
64
|
+
- Runtime helper call order is stable.
|
|
65
|
+
- Async work has cancellation and visible loading or error states.
|
|
66
|
+
- Routing uses Askr route registration.
|
|
67
|
+
- Interactive UI uses Askr-compatible primitives.
|
|
68
|
+
|
|
69
|
+
## Done When
|
|
70
|
+
|
|
71
|
+
- The translated code reads like Askr instead of line-by-line React porting.
|
|
72
|
+
- State, async work, routing, and context use native Askr ownership.
|
|
73
|
+
- Feature logic sits in the right file boundaries.
|
|
74
|
+
- Remaining UI assumptions are compatible with the app's existing primitives.
|
|
75
|
+
|
|
76
|
+
## Handoff
|
|
77
|
+
|
|
78
|
+
- Use `askr-mental-model` when primitive choice is still unclear.
|
|
79
|
+
- Use `askr-project-structure` when the migration requires moving files or ownership boundaries.
|
|
80
|
+
- Use `askr-query-mutation` or `askr-resources-data` when async ownership is the real blocker.
|
|
81
|
+
- Use `askr-testing-determinism` before closing migrated behavior.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-observability-debugging
|
|
3
|
+
description: Use when adding Askr observability, debugging, structured logs, request IDs, trace IDs, query and mutation diagnostics, event-sourced replay context, agent-run audit trails, and dev-only diagnostics.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Observability Debugging
|
|
7
|
+
|
|
8
|
+
Use this when failures must be explainable to users, developers, or operators. The goal is preserved correlation data, safe user-facing errors, and diagnosable stale or event-driven failures.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- A failure needs request, trace, command, run, or event correlation.
|
|
13
|
+
- You need safe user-visible error copy plus deeper operator diagnostics.
|
|
14
|
+
- The UI depends on stale-state or eventual-consistency diagnostics.
|
|
15
|
+
- An agent workflow, realtime flow, or write path needs audit-friendly tracing.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- Existing error normalization and logging helpers in `src/shared`
|
|
20
|
+
- API request and response metadata available from adapters
|
|
21
|
+
- Query and mutation consistency or error states
|
|
22
|
+
- Agent run IDs, command IDs, event IDs, and audit requirements
|
|
23
|
+
|
|
24
|
+
## Preserve These IDs
|
|
25
|
+
|
|
26
|
+
- Request ID or trace ID.
|
|
27
|
+
- User, session, or workspace ID where safe.
|
|
28
|
+
- Command ID, idempotency key, aggregate ID, version, event ID, or projection cursor.
|
|
29
|
+
- Query key and invalidation prefix.
|
|
30
|
+
- Run ID, tool call ID, approval ID, and artifact ID for agentic workflows.
|
|
31
|
+
|
|
32
|
+
## Do This In Order
|
|
33
|
+
|
|
34
|
+
1. Preserve correlation metadata at the adapter boundary.
|
|
35
|
+
2. Normalize errors into a user-safe message plus structured diagnostics.
|
|
36
|
+
3. Show safe copy to users and deeper context only in logs or dev-only panels.
|
|
37
|
+
4. Preserve stale-state, projection, or replay context when eventual consistency matters.
|
|
38
|
+
5. Add focused tests for duplicate-event, stale-state, or correlation behavior when the flow depends on it.
|
|
39
|
+
|
|
40
|
+
## Copy This Shape
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const normalized = normalizeApiError(error, {
|
|
44
|
+
requestId,
|
|
45
|
+
commandId,
|
|
46
|
+
eventId,
|
|
47
|
+
queryKey: "accounts:list",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
logError("accounts.refresh.failed", normalized.diagnostics);
|
|
51
|
+
return {
|
|
52
|
+
message: "Unable to refresh accounts.",
|
|
53
|
+
diagnostics: normalized.diagnostics,
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Never Do These
|
|
58
|
+
|
|
59
|
+
- Swallowing errors in async handlers.
|
|
60
|
+
- Console-only diagnostics for production-critical flows.
|
|
61
|
+
- Showing raw stack traces or transport payloads to users.
|
|
62
|
+
- Losing correlation IDs between adapters, features, and UI errors.
|
|
63
|
+
- Logging private prompts, tokens, or sensitive request bodies to preserve debugging context.
|
|
64
|
+
|
|
65
|
+
## Validate
|
|
66
|
+
|
|
67
|
+
- Errors include user-safe copy and developer-useful context.
|
|
68
|
+
- Eventual-consistency states are diagnosable.
|
|
69
|
+
- Agent workflows have audit-friendly run and event IDs.
|
|
70
|
+
- Logs do not contain secrets or private prompts.
|
|
71
|
+
|
|
72
|
+
## Done When
|
|
73
|
+
|
|
74
|
+
- User-facing failures stay safe and intelligible.
|
|
75
|
+
- Operators have enough correlation data to trace the issue.
|
|
76
|
+
- Stale or event-sourced failures are diagnosable separately from command success.
|
|
77
|
+
- No logs or diagnostics leak secrets or private prompts.
|
|
78
|
+
|
|
79
|
+
## Handoff
|
|
80
|
+
|
|
81
|
+
- Use `askr-api-integration` when metadata is being dropped before it reaches the feature layer.
|
|
82
|
+
- Use `askr-agent-workflows` when run IDs, tool calls, approvals, or artifacts need user-facing traceability.
|
|
83
|
+
- Use `askr-testing-determinism` to prove duplicate-event, stale-state, or error-correlation behavior.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-project-structure
|
|
3
|
+
description: Use when deciding where Askr app files belong, naming components, separating route-first pages, layouts, features, shared helpers, adapters, reusable UI, tests, and package-owned responsibilities.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Project Structure
|
|
7
|
+
|
|
8
|
+
Use this before creating, moving, or splitting files. The goal is one obvious owner per file and no parallel architecture.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- You need to add a new file.
|
|
13
|
+
- You are tempted to put logic in a page because it is nearby.
|
|
14
|
+
- The repo already has routes, features, adapters, or shared helpers and you need the right owner.
|
|
15
|
+
- You want to avoid duplicate structures for the same concern.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- The existing route registry and nearest `_layout.tsx` owner.
|
|
20
|
+
- The nearest existing feature folder for the same domain.
|
|
21
|
+
- The nearest adapter, shared helper, and reusable component folder.
|
|
22
|
+
- Existing tests for the same surface.
|
|
23
|
+
|
|
24
|
+
## Keep The Existing App Shape
|
|
25
|
+
|
|
26
|
+
- If the repo uses `src/pages/**/_routes.tsx`, keep using it.
|
|
27
|
+
- If the repo uses `src/routes/*`, keep using it.
|
|
28
|
+
- If the repo uses `src/shared`, keep shared helpers there.
|
|
29
|
+
- If the repo uses `src/lib` for shared helpers, keep using it.
|
|
30
|
+
- Do not create a second route tree, a second shared layer, or a second feature layout because one file looked easier.
|
|
31
|
+
|
|
32
|
+
## Pick The Owner
|
|
33
|
+
|
|
34
|
+
- URL reachability: nearest route registry file.
|
|
35
|
+
- Shell chrome or persistent branch UI: matching `_layout.tsx`.
|
|
36
|
+
- Domain workflow, queries, mutations, and feature UI: `src/features/<feature>/`.
|
|
37
|
+
- Reusable display-only pieces: the repo's shared components folder.
|
|
38
|
+
- Cross-cutting helpers such as formatting or parsing: the repo's shared helper folder.
|
|
39
|
+
- Generated clients, raw fetch wrappers, and DTO mapping: `src/adapters/`.
|
|
40
|
+
- Visual styling and tokens: CSS or theme layer, not runtime logic.
|
|
41
|
+
|
|
42
|
+
## Copy This Shape
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
src/pages/app/billing.tsx # route-owned page shell
|
|
46
|
+
src/features/billing/billing-form.tsx
|
|
47
|
+
src/features/billing/billing.query.ts
|
|
48
|
+
src/adapters/billing-client.ts
|
|
49
|
+
src/shared/format-money.ts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Reject These Shapes
|
|
53
|
+
|
|
54
|
+
- `src/pages/app/billing.tsx` importing a generated API client directly.
|
|
55
|
+
- `src/components/shared/billing-table.tsx` owning billing mutations and route redirects.
|
|
56
|
+
- `src/shared/billing.tsx` containing JSX and transport code together.
|
|
57
|
+
- API clients in components or UI primitives.
|
|
58
|
+
- Business logic or transport code in `src/pages`.
|
|
59
|
+
- JSX in `src/shared` or `src/adapters`.
|
|
60
|
+
- Duplicate shells across pages.
|
|
61
|
+
- One component that owns routing, fetching, mutation, and styling.
|
|
62
|
+
- Parallel abstractions for a concern Askr already owns.
|
|
63
|
+
|
|
64
|
+
## Validate
|
|
65
|
+
|
|
66
|
+
- Another agent could predict where the file belongs.
|
|
67
|
+
- No page directly owns raw transport or DTO mapping.
|
|
68
|
+
- No JSX leaked into adapters or shared helper files.
|
|
69
|
+
- New folders match the existing repo shape instead of creating a second one.
|
|
70
|
+
|
|
71
|
+
## Done When
|
|
72
|
+
|
|
73
|
+
- No duplicate structure was introduced for the same concern.
|
|
74
|
+
|
|
75
|
+
## Handoff
|
|
76
|
+
|
|
77
|
+
- Use `askr-routing-layouts` when the hard part is URL ownership.
|
|
78
|
+
- Use `askr-resources-data` or `askr-query-mutation` when the hard part is async ownership.
|
|
79
|
+
- Use `askr-testing-determinism` once ownership is settled and you need validation.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: askr-query-mutation
|
|
3
|
+
description: Use when modeling shared server state in Askr with createQuery, createMutation, invalidate, service boundaries, consistency states, pending writes, cache keys, event-sourced read models, and explicit read/write coordination.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Askr Query Mutation
|
|
7
|
+
|
|
8
|
+
Use this for shared keyed reads and writes that must coordinate across screens or survive beyond one render. The goal is deliberate keys, narrow invalidation, and truthful write reconciliation.
|
|
9
|
+
|
|
10
|
+
## Use This When
|
|
11
|
+
|
|
12
|
+
- Multiple screens need the same keyed server state.
|
|
13
|
+
- A write must invalidate or reconcile shared reads.
|
|
14
|
+
- The UI needs pending, error, stale, or pending-write truth after a mutation.
|
|
15
|
+
- Event-sourced or eventually consistent data needs explicit reconciliation.
|
|
16
|
+
|
|
17
|
+
## Inspect First
|
|
18
|
+
|
|
19
|
+
- Existing query keys and invalidation prefixes.
|
|
20
|
+
- The nearest feature owner for the data.
|
|
21
|
+
- The adapter or service boundary that should receive `signal`.
|
|
22
|
+
- Existing stale, syncing, or pending-write UI on the same surface.
|
|
23
|
+
|
|
24
|
+
## Pick The Data Owner First
|
|
25
|
+
|
|
26
|
+
- One route or container owns the read and no other screen shares it: use `askr-resources-data`.
|
|
27
|
+
- Shared keyed read that multiple screens can refresh or invalidate: use `createQuery()`.
|
|
28
|
+
- Write with visible pending, error, result, and invalidation behavior: use `createMutation()`.
|
|
29
|
+
|
|
30
|
+
## Do This In Order
|
|
31
|
+
|
|
32
|
+
1. Design a stable, prefix-friendly query key.
|
|
33
|
+
2. Keep fetch and mutation transport in an adapter or service boundary.
|
|
34
|
+
3. Use `createQuery()` for the shared read and `createMutation()` for the write.
|
|
35
|
+
4. Invalidate only the affected key or prefix after success.
|
|
36
|
+
5. Preserve version, event ID, cursor, or command metadata when the UI must reason about projection lag.
|
|
37
|
+
|
|
38
|
+
## Copy This Shape
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createQuery, invalidate } from "@askrjs/askr/data";
|
|
42
|
+
|
|
43
|
+
const user = createQuery({
|
|
44
|
+
key: `user:${id}`,
|
|
45
|
+
fetch: ({ signal }) => userService.getUser(id, { signal }),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await user.refresh();
|
|
49
|
+
invalidate("user:");
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Mutation Shape
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { createMutation } from "@askrjs/askr/data";
|
|
56
|
+
|
|
57
|
+
const saveUser = createMutation({
|
|
58
|
+
action: (input, { signal }) => userService.updateUser(input, { signal }),
|
|
59
|
+
affects: (input) => [`user:${input.id}`, "users:"],
|
|
60
|
+
afterSuccess: "invalidate",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await saveUser.execute({ id, name });
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Only use optimistic updates when rollback or refetch behavior is explicit.
|
|
67
|
+
- If the backend is event-sourced, prefer truthful `pending-write` or `syncing` UI over pretending the projection already caught up.
|
|
68
|
+
- Keep optimistic local intent separate from confirmed read-model state.
|
|
69
|
+
|
|
70
|
+
## Event-Sourced Consistency
|
|
71
|
+
|
|
72
|
+
Use this pattern when writes append events and reads come from projections:
|
|
73
|
+
|
|
74
|
+
- Command success means the write was accepted, not necessarily that every read model is caught up.
|
|
75
|
+
- Include command ID, aggregate ID, expected version, observed version, event ID, or projection cursor in mutation results when the backend exposes them.
|
|
76
|
+
- Use `affects` and `afterSuccess: 'invalidate'` to mark affected queries as `pending-write` and refresh them.
|
|
77
|
+
- Keep the old query data visible while `consistency` is `pending-write`, `refreshing`, or `stale`.
|
|
78
|
+
- On stream reconnect or cursor gaps, invalidate the affected query prefix instead of replaying uncertain local state.
|
|
79
|
+
- Use `isConsistent` to compare returned read data against expected versions or event IDs.
|
|
80
|
+
- Use `reconcile` to retry while a projection is behind, with user-visible stale/syncing feedback.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const account = createQuery({
|
|
84
|
+
key: `account:${id}`,
|
|
85
|
+
fetch: ({ signal }) => accountsService.getAccount(id, { signal }),
|
|
86
|
+
isConsistent: (data) => data.version >= expectedVersion(),
|
|
87
|
+
reconcile: () => true,
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- Fetching directly in many leaf components.
|
|
92
|
+
- Hiding writes inside presentational UI.
|
|
93
|
+
- Cache keys that cannot be invalidated predictably.
|
|
94
|
+
- Generic query clients or global state abstractions unless the app already owns one.
|
|
95
|
+
- Optimistic updates without rollback or refetch.
|
|
96
|
+
- Treating write acknowledgement as read-model convergence in event-sourced systems.
|
|
97
|
+
- Cache keys that mix route-local UI state with shared server-state identity.
|
|
98
|
+
|
|
99
|
+
## Validate
|
|
100
|
+
|
|
101
|
+
- Query keys are stable and prefix-friendly.
|
|
102
|
+
- `signal` reaches the service boundary.
|
|
103
|
+
- Mutation pending and error states are visible outside the button that triggered them.
|
|
104
|
+
- Success invalidates only the affected read model.
|
|
105
|
+
- Event or version metadata is preserved when the UI needs to reason about catch-up.
|
|
106
|
+
|
|
107
|
+
## Done When
|
|
108
|
+
|
|
109
|
+
- The feature did not grow a second cache or state layer.
|
|
110
|
+
|
|
111
|
+
## Handoff
|
|
112
|
+
|
|
113
|
+
- Use `askr-api-integration` when DTO mapping or transport details are the real blocker.
|
|
114
|
+
- Use `askr-error-loading-empty` when the hard part is presenting stale, syncing, or retry truth.
|
|
115
|
+
- Use `askr-realtime-streaming` when queries must reconcile with live events.
|