@oyolincc/create 0.4.0 → 0.5.1
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/package.json +2 -2
- package/templates/{monorepo/.agents/skills/grilling → hono-fullstack/.agents/skills/ask-grilling}/SKILL.md +1 -1
- package/templates/hono-fullstack/.agents/skills/build-api-and-interface-design/SKILL.md +369 -0
- package/templates/hono-fullstack/.agents/skills/build-context-engineering/SKILL.md +353 -0
- package/templates/hono-fullstack/.agents/skills/build-incremental-implementation/SKILL.md +249 -0
- package/templates/hono-fullstack/.agents/skills/build-observability-and-instrumentation/SKILL.md +239 -0
- package/templates/hono-fullstack/.agents/skills/plan-planning-and-task-breakdown/SKILL.md +257 -0
- package/templates/{monorepo/.agents/skills/prototype → hono-fullstack/.agents/skills/plan-prototype}/LOGIC.md +1 -1
- package/templates/{monorepo/.agents/skills/prototype → hono-fullstack/.agents/skills/plan-prototype}/SKILL.md +2 -2
- package/templates/hono-fullstack/.agents/skills/{prototype → plan-prototype}/UI.md +2 -2
- package/templates/{monorepo/.agents/skills/research → hono-fullstack/.agents/skills/plan-research}/SKILL.md +2 -2
- package/templates/hono-fullstack/.agents/skills/plan-using-agent-skills/SKILL.md +185 -0
- package/templates/{monorepo/.agents/skills/wayfinder → hono-fullstack/.agents/skills/plan-wayfinder}/SKILL.md +43 -29
- package/templates/hono-fullstack/.agents/skills/review-code-review-and-quality/SKILL.md +400 -0
- package/templates/hono-fullstack/.agents/skills/review-doubt-driven-development/SKILL.md +244 -0
- package/templates/hono-fullstack/.agents/skills/review-security-and-hardening/SKILL.md +216 -0
- package/templates/hono-fullstack/.agents/skills/review-security-and-hardening/references/hardening-patterns.md +331 -0
- package/templates/hono-fullstack/.agents/skills/ship-ci-cd-and-automation/SKILL.md +393 -0
- package/templates/hono-fullstack/.agents/skills/ship-deprecation-and-migration/SKILL.md +252 -0
- package/templates/hono-fullstack/.agents/skills/ship-documentation-and-adrs/SKILL.md +298 -0
- package/templates/hono-fullstack/.agents/skills/ship-git-workflow-and-versioning/SKILL.md +355 -0
- package/templates/hono-fullstack/.agents/skills/ship-shipping-and-launch/SKILL.md +336 -0
- package/templates/hono-fullstack/.agents/skills/simplify-code-simplification/SKILL.md +332 -0
- package/templates/hono-fullstack/.agents/skills/simplify-performance-optimization/SKILL.md +268 -0
- package/templates/hono-fullstack/.agents/skills/simplify-performance-optimization/references/optimization-patterns.md +250 -0
- package/templates/hono-fullstack/.agents/skills/spec-constraint-driven-development/SKILL.md +318 -0
- package/templates/hono-fullstack/.agents/skills/spec-constraint-driven-development/references/floor-guard.md +182 -0
- package/templates/hono-fullstack/.agents/skills/spec-constraint-driven-development/scripts/quality-gate.mjs +45 -0
- package/templates/hono-fullstack/.agents/skills/spec-driven-development/SKILL.md +261 -0
- package/templates/hono-fullstack/.agents/skills/test-browser-testing-with-devtools/SKILL.md +319 -0
- package/templates/hono-fullstack/.agents/skills/test-debugging-and-error-recovery/SKILL.md +300 -0
- package/templates/hono-fullstack/.agents/skills/test-driven-development/SKILL.md +400 -0
- package/templates/hono-fullstack/.codegraph/.gitignore +5 -0
- package/templates/hono-fullstack/AGENTS.md +9 -20
- package/templates/hono-fullstack/README.md +22 -1
- package/templates/hono-fullstack/_gitignore +1 -0
- package/templates/hono-fullstack/apps/server/package.json +7 -2
- package/templates/hono-fullstack/apps/server/src/adapters/cloudflare/entry.ts +4 -30
- package/templates/hono-fullstack/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
- package/templates/hono-fullstack/apps/server/src/adapters/nodejs/entry.ts +7 -57
- package/templates/hono-fullstack/apps/server/src/app.ts +37 -21
- package/templates/hono-fullstack/apps/server/src/config.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/di-container.ts +51 -0
- package/templates/hono-fullstack/apps/server/src/infra/logger/getter.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/infra/logger/pino.ts +21 -34
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/errors.ts +22 -0
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
- package/templates/{hono-server/apps/server/src/infra/work-runner/example → hono-fullstack/apps/server/src/infra/work-runner/piscina}/worker-entry.ts +6 -2
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/types.ts +2 -16
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
- package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/message.ts +5 -17
- package/templates/hono-fullstack/apps/server/src/middlewares/cors.ts +16 -22
- package/templates/hono-fullstack/apps/server/src/middlewares/logger.ts +34 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/module.ts +8 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/queries.ts +8 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/routes.ts +74 -68
- package/templates/hono-fullstack/apps/server/src/modules/example/service.test.ts +53 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/service.ts +54 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/types.ts +12 -0
- package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
- package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.ts +15 -46
- package/templates/hono-fullstack/apps/server/src/shared/errors/defs/index.ts +6 -1
- package/templates/hono-fullstack/apps/server/src/shared/errors/handler.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/shared/network/openapi/index.ts +1 -1
- package/templates/hono-fullstack/apps/server/src/shared/types/app.ts +51 -0
- package/templates/hono-fullstack/apps/server/src/shared/types/db.ts +126 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/check.ts +19 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/model.ts +47 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/params.ts +105 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
- package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.ts +236 -0
- package/templates/hono-fullstack/apps/server/vite.config.ts +2 -2
- package/templates/hono-fullstack/apps/server/wrangler.jsonc +1 -1
- package/templates/hono-fullstack/apps/stack/frontend/assets/styles.css +6 -0
- package/templates/hono-fullstack/apps/stack/frontend/components/general/ErrorMessage.tsx +3 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/AppLayout.tsx +2 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Header.tsx +14 -2
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Page.tsx +2 -1
- package/templates/hono-fullstack/apps/stack/frontend/components/layouts/PageContainer.tsx +4 -1
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/api.ts +16 -9
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleForm.tsx +25 -12
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleList.tsx +13 -4
- package/templates/hono-fullstack/apps/stack/frontend/modules/example/hooks/api-hooks.ts +3 -3
- package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
- package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +16 -4
- package/templates/hono-fullstack/apps/stack/package.json +9 -4
- package/templates/hono-fullstack/apps/stack/panda.config.ts +31 -0
- package/templates/hono-fullstack/apps/stack/tsconfig.json +1 -0
- package/templates/hono-fullstack/apps/stack/turbo.json +20 -0
- package/templates/hono-fullstack/apps/stack/vite.config.ts +48 -12
- package/templates/hono-fullstack/apps/stack/wrangler.jsonc +1 -1
- package/templates/hono-fullstack/envs/.env.example.sqlite-d1 +1 -0
- package/templates/hono-fullstack/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
- package/templates/hono-fullstack/libs/db/package.json +1 -0
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
- package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
- package/templates/hono-fullstack/libs/definition/README.md +81 -0
- package/templates/hono-fullstack/libs/definition/package.json +3 -1
- package/templates/hono-fullstack/libs/definition/src/constants/index.ts +1 -0
- package/templates/hono-fullstack/libs/definition/src/constants/pagination.ts +3 -0
- package/templates/hono-fullstack/libs/definition/src/modules/common-contracts.ts +24 -0
- package/templates/hono-fullstack/libs/definition/src/modules/example/contracts.ts +34 -0
- package/templates/hono-fullstack/libs/definition/src/modules/example/index.ts +1 -16
- package/templates/hono-fullstack/libs/definition/src/modules/index.ts +2 -0
- package/templates/hono-fullstack/libs/definition/src/modules/vo-generated-types.ts +12 -0
- package/templates/hono-fullstack/libs/ui/.storybook/main.ts +32 -0
- package/templates/hono-fullstack/libs/ui/.storybook/panda.config.ts +22 -0
- package/templates/hono-fullstack/libs/ui/.storybook/preview.tsx +79 -0
- package/templates/hono-fullstack/libs/ui/.storybook/styles.css +1 -0
- package/templates/hono-fullstack/libs/ui/.storybook/vite.config.ts +37 -0
- package/templates/hono-fullstack/libs/ui/components.json +15 -0
- package/templates/hono-fullstack/libs/ui/package.json +114 -0
- package/templates/hono-fullstack/libs/ui/panda.config.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/Tooltip.tsx +47 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/Button.tsx +80 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/CloseButton.tsx +15 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/IconButton.tsx +10 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Combobox.tsx +91 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Select.tsx +88 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/TreeView.tsx +142 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Avatar.tsx +64 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Badge.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Card.tsx +23 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Clipboard.tsx +77 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Icon.tsx +9 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Table.tsx +51 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Tag.tsx +23 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Timeline.tsx +33 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/date-and-time/DatePicker.tsx +255 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Accordion.tsx +48 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Breadcrumb.tsx +50 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Collapsible.tsx +34 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Pagination.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Steps.tsx +91 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Tabs.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Alert.tsx +52 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Progress.tsx +41 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/ProgressCircle.tsx +40 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Skeleton.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Spinner.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Toast.tsx +99 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Checkbox.tsx +95 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/ColorPicker.tsx +148 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Editable.tsx +44 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Field.tsx +36 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Fieldset.tsx +34 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/FileUpload.tsx +143 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Input.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputAddon.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputGroup.tsx +61 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NativeSelect.tsx +81 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NumberInput.tsx +63 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PasswordInput.tsx +76 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PinInput.tsx +36 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioCard.tsx +96 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioGroup.tsx +61 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RatingGroup.tsx +106 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/SegmentGroup.tsx +68 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Slider.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Switch.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/TagsInput.tsx +77 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Textarea.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/index.ts +98 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/AbsoluteCenter.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Loader.tsx +69 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Span.tsx +5 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/create-layout.ts +18 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Float.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Grid.tsx +17 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Group.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/ScrollArea.tsx +46 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Separator.tsx +26 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Stack.tsx +54 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Dialog.tsx +69 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Drawer.tsx +49 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/HoverCard.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Menu.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.test.ts +124 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.tsx +189 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Popover.tsx +57 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Tooltip.tsx +37 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Heading.tsx +6 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Link.tsx +7 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/LinkOverlay.tsx +21 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Text.tsx +6 -0
- package/templates/hono-fullstack/libs/ui/src/components/atoms/utilities/VisuallyHidden.tsx +13 -0
- package/templates/hono-fullstack/libs/ui/src/hooks.ts +242 -0
- package/templates/hono-fullstack/libs/ui/src/index.ts +19 -0
- package/templates/hono-fullstack/libs/ui/src/theme/animation-styles.ts +50 -0
- package/templates/hono-fullstack/libs/ui/src/theme/breakpoints.ts +7 -0
- package/templates/hono-fullstack/libs/ui/src/theme/conditions.ts +12 -0
- package/templates/hono-fullstack/libs/ui/src/theme/containers.ts +16 -0
- package/templates/hono-fullstack/libs/ui/src/theme/global-css.ts +12 -0
- package/templates/hono-fullstack/libs/ui/src/theme/keyframes.ts +157 -0
- package/templates/hono-fullstack/libs/ui/src/theme/layer-styles.ts +11 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/grid.ts +51 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/index.ts +60 -0
- package/templates/hono-fullstack/libs/ui/src/theme/patterns/stack.ts +46 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/absolute-center.ts +38 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/accordion.ts +68 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/alert.ts +83 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/avatar.ts +155 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/badge.ts +67 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/breadcrumb.ts +69 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/button.ts +149 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/card.ts +36 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/checkbox.ts +120 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/clipboard.ts +22 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/collapsible.ts +26 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/color-picker.ts +299 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/combobox.ts +141 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/date-picker.ts +302 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/dialog.ts +191 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/drawer.ts +170 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/editable.ts +64 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/field.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/fieldset.ts +47 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/file-upload.ts +86 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/group.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/heading.ts +24 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/hover-card.ts +47 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/icon.ts +25 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/index.ts +120 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-addon.ts +51 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-group.ts +77 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/input.ts +99 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/link.ts +36 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/menu.ts +114 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/native-select.ts +92 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/number-input.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/pagination.ts +9 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/pin-input.ts +33 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/popover.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress-circle.ts +50 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress.ts +112 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-card.ts +223 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-group.ts +78 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/rating-group.ts +98 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/scroll-area.ts +119 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/segment-group.ts +162 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/select.ts +157 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/separator.ts +25 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/skeleton.ts +65 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/slider.ts +164 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/spinner.ts +34 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/steps.ts +162 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/switch.ts +150 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/table.ts +150 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tabs.ts +128 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tag.ts +114 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tags-input.ts +201 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/text.ts +7 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/textarea.ts +90 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/timeline.ts +137 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/toast.ts +52 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tooltip.ts +44 -0
- package/templates/hono-fullstack/libs/ui/src/theme/recipes/tree-view.ts +200 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/amber.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/gray.ts +103 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/green.ts +88 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/index.ts +14 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/lime.ts +91 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/red.ts +88 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/index.ts +8 -0
- package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/shadows.ts +46 -0
- package/templates/hono-fullstack/libs/ui/src/theme/text-styles.ts +82 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/animations.ts +8 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/aspect-ratio.ts +6 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/borders.ts +5 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/colors.ts +35 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/durations.ts +11 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/easings.ts +9 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/index.ts +42 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/radii.ts +13 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/sizes.ts +27 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/spacing.ts +41 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/typography.ts +86 -0
- package/templates/hono-fullstack/libs/ui/src/theme/tokens/z-index.ts +43 -0
- package/templates/hono-fullstack/libs/ui/stories/README.md +107 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/Button.stories.tsx +260 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/Clipboard.stories.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/stories/actions/IconButton.stories.tsx +33 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/Combobox.stories.tsx +334 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/Select.stories.tsx +342 -0
- package/templates/hono-fullstack/libs/ui/stories/collections/TreeView.stories.tsx +252 -0
- package/templates/hono-fullstack/libs/ui/stories/color/ColorPicker.stories.tsx +217 -0
- package/templates/hono-fullstack/libs/ui/stories/date/DatePicker.stories.tsx +302 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Accordion.stories.tsx +105 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Collapsible.stories.tsx +55 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Steps.stories.tsx +208 -0
- package/templates/hono-fullstack/libs/ui/stories/disclosure/Tabs.stories.tsx +176 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Avatar.stories.tsx +108 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Badge.stories.tsx +90 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Card.stories.tsx +121 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Heading.stories.tsx +62 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Icon.stories.tsx +51 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Table.stories.tsx +222 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Tag.stories.tsx +168 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Text.stories.tsx +32 -0
- package/templates/hono-fullstack/libs/ui/stories/display/Timeline.stories.tsx +241 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Alert.stories.tsx +122 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Progress.stories.tsx +163 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/ProgressCircle.stories.tsx +176 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Skeleton.stories.tsx +75 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Spinner.stories.tsx +49 -0
- package/templates/hono-fullstack/libs/ui/stories/feedback/Toast.stories.tsx +145 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Checkbox.stories.tsx +281 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Editable.stories.tsx +94 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Field.stories.tsx +72 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Fieldset.stories.tsx +109 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/FileUpload.stories.tsx +115 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Form.stories.tsx +120 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Input.stories.tsx +155 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/InputGroup.stories.tsx +79 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/NativeSelect.stories.tsx +160 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/NumberInput.stories.tsx +149 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/PasswordInput.stories.tsx +141 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/PinInput.stories.tsx +155 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RadioCard.stories.tsx +265 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RadioGroup.stories.tsx +109 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/RatingGroup.stories.tsx +123 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/SegmentGroup.stories.tsx +130 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Slider.stories.tsx +190 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Switch.stories.tsx +124 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/TagsInput.stories.tsx +154 -0
- package/templates/hono-fullstack/libs/ui/stories/forms/Textarea.stories.tsx +148 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Grid.stories.tsx +60 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Positioning.stories.tsx +90 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/ScrollArea.stories.tsx +68 -0
- package/templates/hono-fullstack/libs/ui/stories/layout/Stack.stories.tsx +87 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Breadcrumb.stories.tsx +104 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Link.stories.tsx +62 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/LinkBox.stories.tsx +45 -0
- package/templates/hono-fullstack/libs/ui/stories/navigation/Pagination.stories.tsx +74 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Dialog.stories.tsx +255 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Drawer.stories.tsx +114 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/HoverCard.stories.tsx +47 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Menu.stories.tsx +133 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/OverlayManager.stories.tsx +206 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Popover.stories.tsx +73 -0
- package/templates/hono-fullstack/libs/ui/stories/overlays/Tooltip.stories.tsx +114 -0
- package/templates/hono-fullstack/libs/ui/stories/tsconfig.json +14 -0
- package/templates/hono-fullstack/libs/ui/tsconfig.build.json +5 -0
- package/templates/hono-fullstack/libs/ui/tsconfig.json +13 -0
- package/templates/hono-fullstack/libs/ui/turbo.json +28 -0
- package/templates/hono-fullstack/libs/ui/vite.config.ts +33 -0
- package/templates/hono-fullstack/oyo.config.json +30 -4
- package/templates/hono-fullstack/package.json +1 -0
- package/templates/hono-fullstack/pnpm-workspace.yaml +20 -10
- package/templates/hono-fullstack/turbo.json +10 -0
- package/templates/hono-server/.agents/skills/{grilling → ask-grilling}/SKILL.md +1 -1
- package/templates/hono-server/.agents/skills/build-api-and-interface-design/SKILL.md +369 -0
- package/templates/hono-server/.agents/skills/build-context-engineering/SKILL.md +353 -0
- package/templates/hono-server/.agents/skills/build-incremental-implementation/SKILL.md +249 -0
- package/templates/hono-server/.agents/skills/build-observability-and-instrumentation/SKILL.md +239 -0
- package/templates/hono-server/.agents/skills/plan-planning-and-task-breakdown/SKILL.md +257 -0
- package/templates/hono-server/.agents/skills/{prototype → plan-prototype}/LOGIC.md +1 -1
- package/templates/hono-server/.agents/skills/{prototype → plan-prototype}/SKILL.md +2 -2
- package/templates/{monorepo/.agents/skills/prototype → hono-server/.agents/skills/plan-prototype}/UI.md +2 -2
- package/templates/{hono-fullstack/.agents/skills/research → hono-server/.agents/skills/plan-research}/SKILL.md +2 -2
- package/templates/hono-server/.agents/skills/plan-using-agent-skills/SKILL.md +185 -0
- package/templates/{hono-fullstack/.agents/skills/wayfinder → hono-server/.agents/skills/plan-wayfinder}/SKILL.md +43 -29
- package/templates/hono-server/.agents/skills/review-code-review-and-quality/SKILL.md +400 -0
- package/templates/hono-server/.agents/skills/review-doubt-driven-development/SKILL.md +244 -0
- package/templates/hono-server/.agents/skills/review-security-and-hardening/SKILL.md +216 -0
- package/templates/hono-server/.agents/skills/review-security-and-hardening/references/hardening-patterns.md +331 -0
- package/templates/hono-server/.agents/skills/ship-ci-cd-and-automation/SKILL.md +393 -0
- package/templates/hono-server/.agents/skills/ship-deprecation-and-migration/SKILL.md +252 -0
- package/templates/hono-server/.agents/skills/ship-documentation-and-adrs/SKILL.md +298 -0
- package/templates/hono-server/.agents/skills/ship-git-workflow-and-versioning/SKILL.md +355 -0
- package/templates/hono-server/.agents/skills/ship-shipping-and-launch/SKILL.md +336 -0
- package/templates/hono-server/.agents/skills/simplify-code-simplification/SKILL.md +332 -0
- package/templates/hono-server/.agents/skills/simplify-performance-optimization/SKILL.md +268 -0
- package/templates/hono-server/.agents/skills/simplify-performance-optimization/references/optimization-patterns.md +250 -0
- package/templates/hono-server/.agents/skills/spec-constraint-driven-development/SKILL.md +318 -0
- package/templates/hono-server/.agents/skills/spec-constraint-driven-development/references/floor-guard.md +182 -0
- package/templates/hono-server/.agents/skills/spec-constraint-driven-development/scripts/quality-gate.mjs +45 -0
- package/templates/hono-server/.agents/skills/spec-driven-development/SKILL.md +261 -0
- package/templates/hono-server/.agents/skills/test-browser-testing-with-devtools/SKILL.md +319 -0
- package/templates/hono-server/.agents/skills/test-debugging-and-error-recovery/SKILL.md +300 -0
- package/templates/hono-server/.agents/skills/test-driven-development/SKILL.md +400 -0
- package/templates/hono-server/.codegraph/.gitignore +5 -0
- package/templates/hono-server/AGENTS.md +9 -20
- package/templates/hono-server/README.md +9 -1
- package/templates/hono-server/_gitignore +1 -0
- package/templates/hono-server/apps/server/package.json +7 -2
- package/templates/hono-server/apps/server/src/adapters/cloudflare/entry.ts +4 -30
- package/templates/hono-server/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
- package/templates/hono-server/apps/server/src/adapters/nodejs/entry.ts +7 -57
- package/templates/hono-server/apps/server/src/app.ts +37 -21
- package/templates/hono-server/apps/server/src/config.ts +1 -1
- package/templates/hono-server/apps/server/src/di-container.ts +51 -0
- package/templates/hono-server/apps/server/src/infra/logger/getter.ts +1 -1
- package/templates/hono-server/apps/server/src/infra/logger/pino.ts +21 -34
- package/templates/hono-server/apps/server/src/infra/work-runner/errors.ts +22 -0
- package/templates/hono-server/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
- package/templates/hono-server/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
- package/templates/{hono-fullstack/apps/server/src/infra/work-runner/example → hono-server/apps/server/src/infra/work-runner/piscina}/worker-entry.ts +6 -2
- package/templates/hono-server/apps/server/src/infra/work-runner/types.ts +2 -16
- package/templates/hono-server/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
- package/templates/hono-server/apps/server/src/infra/work-runner/utils/message.ts +5 -17
- package/templates/hono-server/apps/server/src/middlewares/cors.ts +16 -22
- package/templates/hono-server/apps/server/src/middlewares/logger.ts +34 -0
- package/templates/hono-server/apps/server/src/modules/example/module.ts +8 -0
- package/templates/hono-server/apps/server/src/modules/example/queries.ts +8 -0
- package/templates/hono-server/apps/server/src/modules/example/routes.ts +74 -68
- package/templates/hono-server/apps/server/src/modules/example/service.test.ts +53 -0
- package/templates/hono-server/apps/server/src/modules/example/service.ts +54 -0
- package/templates/hono-server/apps/server/src/modules/example/types.ts +12 -0
- package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
- package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.ts +15 -46
- package/templates/hono-server/apps/server/src/shared/errors/defs/index.ts +6 -1
- package/templates/hono-server/apps/server/src/shared/errors/handler.ts +1 -1
- package/templates/hono-server/apps/server/src/shared/network/openapi/index.ts +1 -1
- package/templates/hono-server/apps/server/src/shared/types/app.ts +51 -0
- package/templates/hono-server/apps/server/src/shared/types/db.ts +126 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/check.ts +19 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/model.ts +47 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/params.ts +105 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
- package/templates/hono-server/apps/server/src/shared/utils/data-access/query.ts +236 -0
- package/templates/hono-server/apps/server/vite.config.ts +2 -2
- package/templates/hono-server/apps/server/wrangler.jsonc +1 -1
- package/templates/hono-server/docker/README.md +1 -1
- package/templates/hono-server/envs/.env.example.sqlite-d1 +1 -0
- package/templates/hono-server/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
- package/templates/hono-server/libs/db/package.json +1 -0
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
- package/templates/hono-server/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
- package/templates/hono-server/libs/definition/README.md +81 -0
- package/templates/hono-server/libs/definition/package.json +3 -1
- package/templates/hono-server/libs/definition/src/constants/index.ts +1 -0
- package/templates/hono-server/libs/definition/src/constants/pagination.ts +3 -0
- package/templates/hono-server/libs/definition/src/modules/common-contracts.ts +24 -0
- package/templates/hono-server/libs/definition/src/modules/example/contracts.ts +34 -0
- package/templates/hono-server/libs/definition/src/modules/example/index.ts +1 -16
- package/templates/hono-server/libs/definition/src/modules/index.ts +2 -0
- package/templates/hono-server/libs/definition/src/modules/vo-generated-types.ts +12 -0
- package/templates/hono-server/oyo.config.json +30 -4
- package/templates/hono-server/package.json +1 -0
- package/templates/hono-server/pnpm-workspace.yaml +9 -7
- package/templates/hono-server/turbo.json +10 -0
- package/templates/{hono-fullstack/.agents/skills/grilling → monorepo/.agents/skills/ask-grilling}/SKILL.md +1 -1
- package/templates/monorepo/.agents/skills/build-api-and-interface-design/SKILL.md +369 -0
- package/templates/monorepo/.agents/skills/build-context-engineering/SKILL.md +353 -0
- package/templates/monorepo/.agents/skills/build-incremental-implementation/SKILL.md +249 -0
- package/templates/monorepo/.agents/skills/build-observability-and-instrumentation/SKILL.md +239 -0
- package/templates/monorepo/.agents/skills/plan-planning-and-task-breakdown/SKILL.md +257 -0
- package/templates/{hono-fullstack/.agents/skills/prototype → monorepo/.agents/skills/plan-prototype}/LOGIC.md +1 -1
- package/templates/{hono-fullstack/.agents/skills/prototype → monorepo/.agents/skills/plan-prototype}/SKILL.md +2 -2
- package/templates/{hono-server/.agents/skills/prototype → monorepo/.agents/skills/plan-prototype}/UI.md +2 -2
- package/templates/{hono-server/.agents/skills/research → monorepo/.agents/skills/plan-research}/SKILL.md +2 -2
- package/templates/monorepo/.agents/skills/plan-using-agent-skills/SKILL.md +185 -0
- package/templates/{hono-server/.agents/skills/wayfinder → monorepo/.agents/skills/plan-wayfinder}/SKILL.md +43 -29
- package/templates/monorepo/.agents/skills/review-code-review-and-quality/SKILL.md +400 -0
- package/templates/monorepo/.agents/skills/review-doubt-driven-development/SKILL.md +244 -0
- package/templates/monorepo/.agents/skills/review-security-and-hardening/SKILL.md +216 -0
- package/templates/monorepo/.agents/skills/review-security-and-hardening/references/hardening-patterns.md +331 -0
- package/templates/monorepo/.agents/skills/ship-ci-cd-and-automation/SKILL.md +393 -0
- package/templates/monorepo/.agents/skills/ship-deprecation-and-migration/SKILL.md +252 -0
- package/templates/monorepo/.agents/skills/ship-documentation-and-adrs/SKILL.md +298 -0
- package/templates/monorepo/.agents/skills/ship-git-workflow-and-versioning/SKILL.md +355 -0
- package/templates/monorepo/.agents/skills/ship-shipping-and-launch/SKILL.md +336 -0
- package/templates/monorepo/.agents/skills/simplify-code-simplification/SKILL.md +332 -0
- package/templates/monorepo/.agents/skills/simplify-performance-optimization/SKILL.md +268 -0
- package/templates/monorepo/.agents/skills/simplify-performance-optimization/references/optimization-patterns.md +250 -0
- package/templates/monorepo/.agents/skills/spec-constraint-driven-development/SKILL.md +318 -0
- package/templates/monorepo/.agents/skills/spec-constraint-driven-development/references/floor-guard.md +182 -0
- package/templates/monorepo/.agents/skills/spec-constraint-driven-development/scripts/quality-gate.mjs +45 -0
- package/templates/monorepo/.agents/skills/spec-driven-development/SKILL.md +261 -0
- package/templates/monorepo/.agents/skills/test-browser-testing-with-devtools/SKILL.md +319 -0
- package/templates/monorepo/.agents/skills/test-debugging-and-error-recovery/SKILL.md +300 -0
- package/templates/monorepo/.agents/skills/test-driven-development/SKILL.md +400 -0
- package/templates/monorepo/.codegraph/.gitignore +5 -0
- package/templates/monorepo/AGENTS.md +9 -20
- package/templates/monorepo/_gitignore +1 -0
- package/templates/monorepo/oyo.config.json +6 -4
- package/templates/monorepo/pnpm-workspace.yaml +4 -4
- package/templates/monorepo/turbo.json +10 -0
- package/templates/hono-fullstack/.agents/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/templates/hono-fullstack/.agents/skills/ask-matt/SKILL.md +0 -90
- package/templates/hono-fullstack/.agents/skills/ask-matt/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/code-review/SKILL.md +0 -87
- package/templates/hono-fullstack/.agents/skills/code-review/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/codebase-design/DEEPENING.md +0 -37
- package/templates/hono-fullstack/.agents/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/templates/hono-fullstack/.agents/skills/codebase-design/SKILL.md +0 -114
- package/templates/hono-fullstack/.agents/skills/codebase-design/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/confirm-requirements/SKILL.md +0 -25
- package/templates/hono-fullstack/.agents/skills/diagnosing-bugs/SKILL.md +0 -140
- package/templates/hono-fullstack/.agents/skills/diagnosing-bugs/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/templates/hono-fullstack/.agents/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/templates/hono-fullstack/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
- package/templates/hono-fullstack/.agents/skills/domain-modeling/SKILL.md +0 -74
- package/templates/hono-fullstack/.agents/skills/domain-modeling/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/grill-me/SKILL.md +0 -7
- package/templates/hono-fullstack/.agents/skills/grill-me/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/implement/SKILL.md +0 -15
- package/templates/hono-fullstack/.agents/skills/implement/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/templates/hono-fullstack/.agents/skills/improve-codebase-architecture/SKILL.md +0 -71
- package/templates/hono-fullstack/.agents/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/resolving-merge-conflicts/SKILL.md +0 -14
- package/templates/hono-fullstack/.agents/skills/resolving-merge-conflicts/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/scoped-code-review/SKILL.md +0 -113
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/SKILL.md +0 -116
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -45
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
- package/templates/hono-fullstack/.agents/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/templates/hono-fullstack/.agents/skills/tdd/SKILL.md +0 -38
- package/templates/hono-fullstack/.agents/skills/tdd/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/tdd/mocking.md +0 -59
- package/templates/hono-fullstack/.agents/skills/tdd/tests.md +0 -77
- package/templates/hono-fullstack/.agents/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/templates/hono-fullstack/.agents/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/templates/hono-fullstack/.agents/skills/teach/MISSION-FORMAT.md +0 -31
- package/templates/hono-fullstack/.agents/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/templates/hono-fullstack/.agents/skills/teach/SKILL.md +0 -140
- package/templates/hono-fullstack/.agents/skills/teach/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/to-questionnaire/SKILL.md +0 -53
- package/templates/hono-fullstack/.agents/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/triage/AGENT-BRIEF.md +0 -207
- package/templates/hono-fullstack/.agents/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/templates/hono-fullstack/.agents/skills/triage/SKILL.md +0 -112
- package/templates/hono-fullstack/.agents/skills/triage/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/wait-what/SKILL.md +0 -7
- package/templates/hono-fullstack/.agents/skills/wait-what/agents/openai.yaml +0 -5
- package/templates/hono-fullstack/.agents/skills/wizard/SKILL.md +0 -44
- package/templates/hono-fullstack/.agents/skills/wizard/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/.agents/skills/wizard/template.sh +0 -204
- package/templates/hono-fullstack/.agents/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/templates/hono-fullstack/.agents/skills/writing-for-agents/SKILL.md +0 -81
- package/templates/hono-fullstack/.agents/skills/writing-for-agents/agents/openai.yaml +0 -3
- package/templates/hono-fullstack/apps/server/src/modules/example/contracts.ts +0 -9
- package/templates/hono-fullstack/apps/server/src/shared/app/types.ts +0 -44
- package/templates/hono-fullstack/apps/stack/frontend/styles.css +0 -23
- package/templates/hono-fullstack/docs/agents/domain.md +0 -41
- package/templates/hono-fullstack/docs/agents/issue-tracker.md +0 -30
- package/templates/hono-fullstack/docs/agents/triage-labels.md +0 -15
- package/templates/hono-server/.agents/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/templates/hono-server/.agents/skills/ask-matt/SKILL.md +0 -90
- package/templates/hono-server/.agents/skills/ask-matt/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/code-review/SKILL.md +0 -87
- package/templates/hono-server/.agents/skills/code-review/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/codebase-design/DEEPENING.md +0 -37
- package/templates/hono-server/.agents/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/templates/hono-server/.agents/skills/codebase-design/SKILL.md +0 -114
- package/templates/hono-server/.agents/skills/codebase-design/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/confirm-requirements/SKILL.md +0 -25
- package/templates/hono-server/.agents/skills/diagnosing-bugs/SKILL.md +0 -140
- package/templates/hono-server/.agents/skills/diagnosing-bugs/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/templates/hono-server/.agents/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/templates/hono-server/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
- package/templates/hono-server/.agents/skills/domain-modeling/SKILL.md +0 -74
- package/templates/hono-server/.agents/skills/domain-modeling/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/grill-me/SKILL.md +0 -7
- package/templates/hono-server/.agents/skills/grill-me/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/implement/SKILL.md +0 -15
- package/templates/hono-server/.agents/skills/implement/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/templates/hono-server/.agents/skills/improve-codebase-architecture/SKILL.md +0 -71
- package/templates/hono-server/.agents/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/resolving-merge-conflicts/SKILL.md +0 -14
- package/templates/hono-server/.agents/skills/resolving-merge-conflicts/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/scoped-code-review/SKILL.md +0 -113
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/SKILL.md +0 -116
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -45
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
- package/templates/hono-server/.agents/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/templates/hono-server/.agents/skills/tdd/SKILL.md +0 -38
- package/templates/hono-server/.agents/skills/tdd/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/tdd/mocking.md +0 -59
- package/templates/hono-server/.agents/skills/tdd/tests.md +0 -77
- package/templates/hono-server/.agents/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/templates/hono-server/.agents/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/templates/hono-server/.agents/skills/teach/MISSION-FORMAT.md +0 -31
- package/templates/hono-server/.agents/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/templates/hono-server/.agents/skills/teach/SKILL.md +0 -140
- package/templates/hono-server/.agents/skills/teach/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/to-questionnaire/SKILL.md +0 -53
- package/templates/hono-server/.agents/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/triage/AGENT-BRIEF.md +0 -207
- package/templates/hono-server/.agents/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/templates/hono-server/.agents/skills/triage/SKILL.md +0 -112
- package/templates/hono-server/.agents/skills/triage/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/wait-what/SKILL.md +0 -7
- package/templates/hono-server/.agents/skills/wait-what/agents/openai.yaml +0 -5
- package/templates/hono-server/.agents/skills/wizard/SKILL.md +0 -44
- package/templates/hono-server/.agents/skills/wizard/agents/openai.yaml +0 -3
- package/templates/hono-server/.agents/skills/wizard/template.sh +0 -204
- package/templates/hono-server/.agents/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/templates/hono-server/.agents/skills/writing-for-agents/SKILL.md +0 -81
- package/templates/hono-server/.agents/skills/writing-for-agents/agents/openai.yaml +0 -3
- package/templates/hono-server/apps/server/src/modules/example/contracts.ts +0 -9
- package/templates/hono-server/apps/server/src/shared/app/types.ts +0 -44
- package/templates/hono-server/docs/agents/domain.md +0 -41
- package/templates/hono-server/docs/agents/issue-tracker.md +0 -30
- package/templates/hono-server/docs/agents/triage-labels.md +0 -15
- package/templates/monorepo/.agents/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/templates/monorepo/.agents/skills/ask-matt/SKILL.md +0 -90
- package/templates/monorepo/.agents/skills/ask-matt/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/code-review/SKILL.md +0 -87
- package/templates/monorepo/.agents/skills/code-review/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/codebase-design/DEEPENING.md +0 -37
- package/templates/monorepo/.agents/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/templates/monorepo/.agents/skills/codebase-design/SKILL.md +0 -114
- package/templates/monorepo/.agents/skills/codebase-design/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/confirm-requirements/SKILL.md +0 -25
- package/templates/monorepo/.agents/skills/diagnosing-bugs/SKILL.md +0 -140
- package/templates/monorepo/.agents/skills/diagnosing-bugs/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/templates/monorepo/.agents/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/templates/monorepo/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
- package/templates/monorepo/.agents/skills/domain-modeling/SKILL.md +0 -74
- package/templates/monorepo/.agents/skills/domain-modeling/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/grill-me/SKILL.md +0 -7
- package/templates/monorepo/.agents/skills/grill-me/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/implement/SKILL.md +0 -15
- package/templates/monorepo/.agents/skills/implement/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/templates/monorepo/.agents/skills/improve-codebase-architecture/SKILL.md +0 -71
- package/templates/monorepo/.agents/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/resolving-merge-conflicts/SKILL.md +0 -14
- package/templates/monorepo/.agents/skills/resolving-merge-conflicts/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/scoped-code-review/SKILL.md +0 -113
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/SKILL.md +0 -116
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -45
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
- package/templates/monorepo/.agents/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/templates/monorepo/.agents/skills/tdd/SKILL.md +0 -38
- package/templates/monorepo/.agents/skills/tdd/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/tdd/mocking.md +0 -59
- package/templates/monorepo/.agents/skills/tdd/tests.md +0 -77
- package/templates/monorepo/.agents/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/templates/monorepo/.agents/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/templates/monorepo/.agents/skills/teach/MISSION-FORMAT.md +0 -31
- package/templates/monorepo/.agents/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/templates/monorepo/.agents/skills/teach/SKILL.md +0 -140
- package/templates/monorepo/.agents/skills/teach/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/to-questionnaire/SKILL.md +0 -53
- package/templates/monorepo/.agents/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/triage/AGENT-BRIEF.md +0 -207
- package/templates/monorepo/.agents/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/templates/monorepo/.agents/skills/triage/SKILL.md +0 -112
- package/templates/monorepo/.agents/skills/triage/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/wait-what/SKILL.md +0 -7
- package/templates/monorepo/.agents/skills/wait-what/agents/openai.yaml +0 -5
- package/templates/monorepo/.agents/skills/wizard/SKILL.md +0 -44
- package/templates/monorepo/.agents/skills/wizard/agents/openai.yaml +0 -3
- package/templates/monorepo/.agents/skills/wizard/template.sh +0 -204
- package/templates/monorepo/.agents/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/templates/monorepo/.agents/skills/writing-for-agents/SKILL.md +0 -81
- package/templates/monorepo/.agents/skills/writing-for-agents/agents/openai.yaml +0 -3
- package/templates/monorepo/docs/agents/domain.md +0 -41
- package/templates/monorepo/docs/agents/issue-tracker.md +0 -30
- package/templates/monorepo/docs/agents/triage-labels.md +0 -15
- /package/templates/hono-fullstack/.agents/skills/{grilling → ask-grilling}/agents/openai.yaml +0 -0
- /package/templates/hono-fullstack/.agents/skills/{prototype → plan-prototype}/agents/openai.yaml +0 -0
- /package/templates/hono-fullstack/.agents/skills/{research → plan-research}/agents/openai.yaml +0 -0
- /package/templates/hono-fullstack/.agents/skills/{wayfinder → plan-wayfinder}/agents/openai.yaml +0 -0
- /package/templates/hono-server/.agents/skills/{grilling → ask-grilling}/agents/openai.yaml +0 -0
- /package/templates/hono-server/.agents/skills/{prototype → plan-prototype}/agents/openai.yaml +0 -0
- /package/templates/hono-server/.agents/skills/{research → plan-research}/agents/openai.yaml +0 -0
- /package/templates/hono-server/.agents/skills/{wayfinder → plan-wayfinder}/agents/openai.yaml +0 -0
- /package/templates/monorepo/.agents/skills/{grilling → ask-grilling}/agents/openai.yaml +0 -0
- /package/templates/monorepo/.agents/skills/{prototype → plan-prototype}/agents/openai.yaml +0 -0
- /package/templates/monorepo/.agents/skills/{research → plan-research}/agents/openai.yaml +0 -0
- /package/templates/monorepo/.agents/skills/{wayfinder → plan-wayfinder}/agents/openai.yaml +0 -0
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import { executeExampleTask } from '
|
|
1
|
+
import { executeExampleTask as runExampleTask } from '@/modules/example/work-task/tasks'
|
|
2
2
|
import { getLogger } from '@/infra/logger/getter'
|
|
3
3
|
import { WorkSubject } from '../constants'
|
|
4
|
+
import { serializeWorkerTaskError } from '../errors'
|
|
4
5
|
import type {
|
|
5
6
|
AppWorkRunner,
|
|
7
|
+
RunnerTaskInput,
|
|
6
8
|
RunnerTaskParams,
|
|
7
9
|
RunnerTaskRunOptions,
|
|
8
10
|
RunnerTaskRunResult,
|
|
9
|
-
WorkerMessage,
|
|
10
|
-
WorkerMessagePort,
|
|
11
11
|
} from '../types'
|
|
12
|
-
import { handleWorkerMessage } from '../utils/message'
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
close() {},
|
|
21
|
-
}
|
|
13
|
+
const taskMap = {
|
|
14
|
+
[WorkSubject.PROCESS_EXAMPLE]: runExampleTask,
|
|
15
|
+
} satisfies {
|
|
16
|
+
[TSubject in WorkSubject]?: (
|
|
17
|
+
input: RunnerTaskInput<TSubject>,
|
|
18
|
+
) => Promise<RunnerTaskRunResult<TSubject>>
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
export class
|
|
21
|
+
export class PassThroughRunner implements AppWorkRunner {
|
|
25
22
|
async run<TSubject extends WorkSubject>(
|
|
26
|
-
|
|
23
|
+
task: RunnerTaskParams<TSubject>,
|
|
27
24
|
options?: RunnerTaskRunOptions,
|
|
28
25
|
): Promise<RunnerTaskRunResult<TSubject>> {
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const targetTask = taskMap[task.subject]
|
|
27
|
+
if (!targetTask) {
|
|
28
|
+
throw new Error(`[PassThroughRunner] task name not found: ${String(task.subject)}`)
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const logger = getLogger().child({ subject: task.subject })
|
|
32
|
+
logger.debug('Task executing in current thread')
|
|
33
|
+
let result: RunnerTaskRunResult<TSubject>
|
|
34
|
+
try {
|
|
35
|
+
options?.signal?.throwIfAborted()
|
|
36
|
+
result = (await targetTask(task.input)) as RunnerTaskRunResult<TSubject>
|
|
37
|
+
} catch (error) {
|
|
38
|
+
result = { ok: false, error: serializeWorkerTaskError(error) }
|
|
39
|
+
}
|
|
40
|
+
logger[result.ok ? 'info' : 'error'](
|
|
41
|
+
{ subject: task.subject, ok: result.ok },
|
|
42
|
+
`Task ${result.ok ? 'completed' : 'failed'}`,
|
|
43
|
+
)
|
|
44
|
+
return result
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
async shutdown(): Promise<void> {}
|
|
@@ -8,18 +8,19 @@ import type {
|
|
|
8
8
|
WorkerMessage,
|
|
9
9
|
} from '../types'
|
|
10
10
|
import { WorkerErrorCode, WorkSubject } from '../constants'
|
|
11
|
-
import {
|
|
11
|
+
import { serializeWorkerTaskError, WorkerTaskError } from '../errors'
|
|
12
12
|
import Piscina from 'piscina'
|
|
13
13
|
import path from 'node:path'
|
|
14
14
|
import { MessageChannel, type MessagePort } from 'node:worker_threads'
|
|
15
15
|
import workersDir from 'virtual:workers'
|
|
16
16
|
import { getLogger } from '@/infra/logger/getter'
|
|
17
|
-
import type * as
|
|
17
|
+
import type * as PiscinaWorker from './worker-entry'
|
|
18
18
|
import { handleWorkerMessage } from '../utils/message'
|
|
19
|
+
import { extractTransferables } from '../utils/transfer'
|
|
19
20
|
|
|
20
21
|
const taskNameMap = {
|
|
21
22
|
[WorkSubject.PROCESS_EXAMPLE]: 'executeExampleTask',
|
|
22
|
-
} satisfies Partial<Record<WorkSubject, keyof typeof
|
|
23
|
+
} satisfies Partial<Record<WorkSubject, keyof typeof PiscinaWorker>>
|
|
23
24
|
|
|
24
25
|
export class PiscinaWorkRunner implements AppWorkRunner {
|
|
25
26
|
static #instance: PiscinaWorkRunner | null = null
|
|
@@ -31,7 +32,7 @@ export class PiscinaWorkRunner implements AppWorkRunner {
|
|
|
31
32
|
throw new Error('[PiscinaWorkRunner] config is required')
|
|
32
33
|
}
|
|
33
34
|
this.#pool = new Piscina({
|
|
34
|
-
filename: path.join(workersDir, '
|
|
35
|
+
filename: path.join(workersDir, 'piscina-worker.mjs'),
|
|
35
36
|
minThreads: config.minThreads,
|
|
36
37
|
maxThreads: config.maxThreads,
|
|
37
38
|
concurrentTasksPerWorker: config.concurrentTasksPerWorker,
|
|
@@ -61,15 +62,14 @@ export class PiscinaWorkRunner implements AppWorkRunner {
|
|
|
61
62
|
let result: RunnerTaskRunResult<TSubject>
|
|
62
63
|
let workerMessagePort: MessagePort | undefined
|
|
63
64
|
|
|
64
|
-
const { signal: optSignal
|
|
65
|
-
const logger = getLogger()
|
|
65
|
+
const { signal: optSignal } = options || {}
|
|
66
66
|
// pool当前状态
|
|
67
67
|
const poolStats = {
|
|
68
68
|
idleThreads: this.#pool.idleThreads,
|
|
69
69
|
threads: this.#pool.threads.length,
|
|
70
70
|
queueSize: this.#pool.queueSize,
|
|
71
71
|
}
|
|
72
|
-
logger.
|
|
72
|
+
const logger = getLogger().child({
|
|
73
73
|
pool: poolStats,
|
|
74
74
|
subject: taskParams.subject,
|
|
75
75
|
})
|
|
@@ -123,45 +123,22 @@ export class PiscinaWorkRunner implements AppWorkRunner {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// 开始调用
|
|
126
|
+
const { input, transferList } = extractTransferables(taskParams.input)
|
|
126
127
|
const invocation: RunnerTaskInvocation<(typeof taskParams)['input']> = {
|
|
127
|
-
input
|
|
128
|
+
input,
|
|
128
129
|
messagePort: workerMessagePort,
|
|
129
130
|
}
|
|
130
131
|
const taskPromise = this.#pool.run(invocation, {
|
|
131
132
|
name: targetName,
|
|
132
133
|
signal: taskSignal,
|
|
133
|
-
transferList: [...
|
|
134
|
+
transferList: [...transferList, workerMessagePort],
|
|
134
135
|
}) as Promise<RunnerTaskRunResult<TSubject>>
|
|
135
136
|
|
|
136
137
|
result = timeoutPromise
|
|
137
138
|
? await Promise.race([taskPromise, timeoutPromise])
|
|
138
139
|
: await taskPromise
|
|
139
140
|
} catch (error) {
|
|
140
|
-
|
|
141
|
-
result = {
|
|
142
|
-
ok: false,
|
|
143
|
-
error: error.serialize(),
|
|
144
|
-
}
|
|
145
|
-
} else if (error instanceof Error && error.name === 'AbortError') {
|
|
146
|
-
result = {
|
|
147
|
-
ok: false,
|
|
148
|
-
error: new WorkerTaskError(
|
|
149
|
-
WorkerErrorCode.TASK_ABORTED,
|
|
150
|
-
error.message,
|
|
151
|
-
undefined,
|
|
152
|
-
).serialize(),
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
result = {
|
|
156
|
-
ok: false,
|
|
157
|
-
error: new WorkerTaskError(
|
|
158
|
-
WorkerErrorCode.UNKNOWN,
|
|
159
|
-
'Worker task failed unexpectedly',
|
|
160
|
-
undefined,
|
|
161
|
-
error,
|
|
162
|
-
).serialize(),
|
|
163
|
-
}
|
|
164
|
-
}
|
|
141
|
+
result = { ok: false, error: serializeWorkerTaskError(error) }
|
|
165
142
|
} finally {
|
|
166
143
|
if (timeoutTimer) clearTimeout(timeoutTimer)
|
|
167
144
|
try {
|
|
@@ -5,9 +5,13 @@ import {
|
|
|
5
5
|
type ExampleRunnerTaskModel,
|
|
6
6
|
} from '@/modules/example/work-task/tasks'
|
|
7
7
|
|
|
8
|
-
export function executeExampleTask({
|
|
8
|
+
export async function executeExampleTask({
|
|
9
9
|
input,
|
|
10
10
|
messagePort,
|
|
11
11
|
}: RunnerTaskInvocation<ExampleRunnerTaskModel['input']>): ReturnType<typeof runExampleTask> {
|
|
12
|
-
|
|
12
|
+
try {
|
|
13
|
+
return await runExampleTask(input)
|
|
14
|
+
} finally {
|
|
15
|
+
messagePort.close()
|
|
16
|
+
}
|
|
13
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExampleRunnerTaskModel } from '@/modules/example/work-task/tasks'
|
|
2
|
-
import type {
|
|
2
|
+
import type { MessagePort } from 'node:worker_threads'
|
|
3
3
|
import type { WorkerErrorCode, WorkSubject } from './constants'
|
|
4
4
|
|
|
5
5
|
// export const WorkerInvocationType = Object.freeze({
|
|
@@ -43,7 +43,7 @@ export type RunnerTaskErrorCode<TSubject extends WorkSubject> =
|
|
|
43
43
|
|
|
44
44
|
export type RunnerTaskInvocation<TInput> = {
|
|
45
45
|
input: TInput
|
|
46
|
-
messagePort:
|
|
46
|
+
messagePort: MessagePort
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type RunnerTaskJsonValue =
|
|
@@ -69,19 +69,6 @@ export type WorkerMessage =
|
|
|
69
69
|
value: number
|
|
70
70
|
message?: string
|
|
71
71
|
}
|
|
72
|
-
| {
|
|
73
|
-
type: 'result'
|
|
74
|
-
data: RunnerTaskJsonValue
|
|
75
|
-
}
|
|
76
|
-
| {
|
|
77
|
-
type: 'error'
|
|
78
|
-
error: RunnerTaskError
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface WorkerMessagePort {
|
|
82
|
-
postMessage(message: WorkerMessage): void
|
|
83
|
-
close(): void
|
|
84
|
-
}
|
|
85
72
|
|
|
86
73
|
export type RunnerTaskError<TCode extends string = string> = {
|
|
87
74
|
code: TCode
|
|
@@ -102,7 +89,6 @@ export type RunnerTaskRunResult<TSubject extends WorkSubject> = RunnerTaskResult
|
|
|
102
89
|
|
|
103
90
|
export type RunnerTaskRunOptions = {
|
|
104
91
|
signal?: AbortSignal
|
|
105
|
-
transferList?: Transferable[]
|
|
106
92
|
}
|
|
107
93
|
|
|
108
94
|
export interface AppWorkRunner {
|
|
@@ -2,18 +2,23 @@ import { hasProp } from '@/shared/utils'
|
|
|
2
2
|
import type { RunnerTaskErrorDetails } from '../types'
|
|
3
3
|
|
|
4
4
|
export class WorkerTaskBusinessError extends Error {
|
|
5
|
-
readonly
|
|
5
|
+
declare readonly cause: {
|
|
6
|
+
type: 'WorkerTaskBusinessError'
|
|
7
|
+
details?: RunnerTaskErrorDetails
|
|
8
|
+
cause?: unknown
|
|
9
|
+
}
|
|
6
10
|
|
|
7
11
|
constructor(message: string, details?: RunnerTaskErrorDetails, cause?: unknown) {
|
|
8
|
-
super(message, { cause })
|
|
12
|
+
super(message, { cause: { type: 'WorkerTaskBusinessError', details, cause } })
|
|
9
13
|
this.name = 'WorkerTaskBusinessError'
|
|
10
|
-
this.details = details
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export function isWorkerTaskBusinessError(error: unknown): error is WorkerTaskBusinessError {
|
|
15
18
|
return (
|
|
16
|
-
error instanceof
|
|
17
|
-
|
|
19
|
+
error instanceof Error &&
|
|
20
|
+
!!error.cause &&
|
|
21
|
+
hasProp(error.cause, 'type') &&
|
|
22
|
+
error.cause.type === 'WorkerTaskBusinessError'
|
|
18
23
|
)
|
|
19
24
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { AppLogger } from '@/shared/app
|
|
2
|
-
import type { RunnerTaskErrorDetails, WorkerMessage
|
|
1
|
+
import type { AppLogger } from '@/shared/types/app'
|
|
2
|
+
import type { RunnerTaskErrorDetails, WorkerMessage } from '../types'
|
|
3
|
+
import type { MessagePort } from 'node:worker_threads'
|
|
3
4
|
import type { WorkSubject } from '../constants'
|
|
4
5
|
|
|
5
6
|
export function workerLog(
|
|
6
|
-
messagePort:
|
|
7
|
+
messagePort: MessagePort,
|
|
7
8
|
level: Extract<WorkerMessage, { type: 'log' }>['level'],
|
|
8
9
|
message: string,
|
|
9
10
|
data?: RunnerTaskErrorDetails,
|
|
@@ -11,11 +12,7 @@ export function workerLog(
|
|
|
11
12
|
messagePort.postMessage({ type: 'log', level, message, data } satisfies WorkerMessage)
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export function workerProgress(
|
|
15
|
-
messagePort: WorkerMessagePort,
|
|
16
|
-
value: number,
|
|
17
|
-
message?: string,
|
|
18
|
-
): void {
|
|
15
|
+
export function workerProgress(messagePort: MessagePort, value: number, message?: string): void {
|
|
19
16
|
messagePort.postMessage({ type: 'progress', value, message } satisfies WorkerMessage)
|
|
20
17
|
}
|
|
21
18
|
|
|
@@ -36,14 +33,5 @@ export function handleWorkerMessage(
|
|
|
36
33
|
message.message || 'Worker progress',
|
|
37
34
|
)
|
|
38
35
|
break
|
|
39
|
-
case 'result':
|
|
40
|
-
logger.debug({ subject: context.subject }, 'Worker result delivered')
|
|
41
|
-
break
|
|
42
|
-
case 'error':
|
|
43
|
-
logger.warn(
|
|
44
|
-
{ subject: context.subject, workerError: message.error },
|
|
45
|
-
'Worker error delivered',
|
|
46
|
-
)
|
|
47
|
-
break
|
|
48
36
|
}
|
|
49
37
|
}
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CORSConfig } from '@repo/definition/backend'
|
|
2
2
|
import { cors } from 'hono/cors'
|
|
3
|
-
import { createMiddleware } from 'hono/factory'
|
|
4
3
|
|
|
5
|
-
export const corsMiddleware = () => {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
allowHeaders: ['Content-Type'],
|
|
21
|
-
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
22
|
-
credentials: true,
|
|
23
|
-
})
|
|
24
|
-
return middleware(c, next)
|
|
4
|
+
export const corsMiddleware = ({ domains }: CORSConfig) => {
|
|
5
|
+
return cors({
|
|
6
|
+
origin: (origin) => {
|
|
7
|
+
const isAllowedDomain = domains.some((domain) => {
|
|
8
|
+
try {
|
|
9
|
+
return domain === '*' || new URL(origin).host === domain
|
|
10
|
+
} catch {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
return isAllowedDomain ? origin : null
|
|
15
|
+
},
|
|
16
|
+
allowHeaders: ['Content-Type'],
|
|
17
|
+
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
18
|
+
credentials: true,
|
|
25
19
|
})
|
|
26
20
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AppEnv } from '@/shared/types/app'
|
|
2
|
+
import { structuredLogger } from '@hono/structured-logger'
|
|
3
|
+
import type { Logger } from 'pino'
|
|
4
|
+
|
|
5
|
+
export const loggerMiddleware = (rootLogger: Logger) => {
|
|
6
|
+
const logResponse = (logger: Logger, response: Response, responseTime: number) => {
|
|
7
|
+
// access log 只记请求完成;错误细节由 onError 走 serializers.err。
|
|
8
|
+
// 错误请求仍记 info 级别的完成日志,避免与 globalErrorHandler 重复记录 error。
|
|
9
|
+
logger.info(
|
|
10
|
+
{
|
|
11
|
+
res: {
|
|
12
|
+
status: response.status,
|
|
13
|
+
headers: Object.fromEntries(response.headers),
|
|
14
|
+
},
|
|
15
|
+
responseTime: Math.round(responseTime),
|
|
16
|
+
},
|
|
17
|
+
'Request completed',
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return structuredLogger<AppEnv, Logger>({
|
|
22
|
+
createLogger: (c) =>
|
|
23
|
+
rootLogger.child({
|
|
24
|
+
req: {
|
|
25
|
+
url: c.req.path,
|
|
26
|
+
method: c.req.method,
|
|
27
|
+
headers: c.req.header(),
|
|
28
|
+
},
|
|
29
|
+
reqId: c.get('requestId'),
|
|
30
|
+
}),
|
|
31
|
+
onResponse: (logger, c, responseTime) => logResponse(logger, c.res, responseTime),
|
|
32
|
+
onError: (logger, _error, c, responseTime) => logResponse(logger, c.res, responseTime),
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Module, SpecMap } from '@inferdi/inferdi'
|
|
2
|
+
import type { Database } from '@/shared/types/db'
|
|
3
|
+
import { ExampleService } from './service'
|
|
4
|
+
|
|
5
|
+
export const exampleModule: Module<
|
|
6
|
+
SpecMap<{ database: Database }>,
|
|
7
|
+
SpecMap<{ exampleService: ExampleService }>
|
|
8
|
+
> = (container) => container.registerClass('exampleService', ExampleService, ['database'])
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { examples, vcExamples } from '@repo/db/sqlite/schema'
|
|
2
|
+
import { Model } from '@/shared/utils/data-access/model'
|
|
3
|
+
import { createQueries } from '@/shared/utils/data-access/query'
|
|
4
|
+
|
|
5
|
+
const model = new Model(examples, vcExamples)
|
|
6
|
+
const queries = createQueries(model, { orderBy: { id: 'asc' } })
|
|
7
|
+
|
|
8
|
+
export const { query, findOne, findPage, insert, update, deleteRecords } = queries
|
|
@@ -1,73 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { describeRoute } from 'hono-openapi'
|
|
3
|
-
import * as v from 'valibot'
|
|
4
|
-
import { examples, vcExamples, type SqliteDBType } from '@repo/db/sqlite/schema'
|
|
5
|
-
import type { AppEnv } from '@/shared/app/types'
|
|
1
|
+
import { Hono } from 'hono'
|
|
6
2
|
import { WorkSubject } from '@/infra/work-runner/constants'
|
|
7
3
|
import { E } from '@/shared/errors/defs'
|
|
8
|
-
import {
|
|
9
|
-
|
|
4
|
+
import type { AppEnv } from '@/shared/types/app'
|
|
5
|
+
|
|
6
|
+
import * as v from 'valibot'
|
|
7
|
+
import {
|
|
8
|
+
Example$CreateOne,
|
|
9
|
+
Example$UpdateOne,
|
|
10
|
+
Example$FindOne,
|
|
11
|
+
Example$FindMany,
|
|
12
|
+
Example$Process,
|
|
13
|
+
} from '@repo/definition/backend'
|
|
10
14
|
import { generalValidator } from '@/shared/network/validator'
|
|
11
|
-
import {
|
|
15
|
+
import { successJson } from '@/shared/network/utils'
|
|
16
|
+
|
|
17
|
+
export const routes = new Hono<AppEnv>()
|
|
18
|
+
|
|
19
|
+
routes.post('/', generalValidator('json', Example$CreateOne), async (c) => {
|
|
20
|
+
const body = c.req.valid('json')
|
|
21
|
+
const exampleService = c.var.di.get('exampleService')
|
|
22
|
+
return successJson(c, await exampleService.createOne(body))
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
routes.get('/', generalValidator('query', Example$FindMany), async (c) => {
|
|
26
|
+
const query = c.req.valid('query')
|
|
27
|
+
const exampleService = c.var.di.get('exampleService')
|
|
28
|
+
return successJson(c, await exampleService.findMany(query))
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
routes.get(
|
|
32
|
+
'/:id',
|
|
33
|
+
generalValidator('param', v.required(v.pick(Example$FindOne, ['id']))),
|
|
34
|
+
generalValidator('query', Example$FindOne),
|
|
35
|
+
async (c) => {
|
|
36
|
+
const { id } = c.req.valid('param')
|
|
37
|
+
const query = c.req.valid('query')
|
|
38
|
+
const exampleService = c.var.di.get('exampleService')
|
|
39
|
+
return successJson(c, await exampleService.findOne({ ...query, id }))
|
|
40
|
+
},
|
|
41
|
+
)
|
|
12
42
|
|
|
13
|
-
|
|
43
|
+
routes.patch(
|
|
44
|
+
'/:id',
|
|
45
|
+
generalValidator('param', v.required(v.pick(Example$FindOne, ['id']))),
|
|
46
|
+
generalValidator('json', Example$UpdateOne),
|
|
47
|
+
async (c) => {
|
|
48
|
+
const { id } = c.req.valid('param')
|
|
49
|
+
const body = c.req.valid('json')
|
|
50
|
+
const exampleService = c.var.di.get('exampleService')
|
|
51
|
+
return successJson(c, await exampleService.updateOneById(id, body))
|
|
52
|
+
},
|
|
53
|
+
)
|
|
54
|
+
routes.delete(
|
|
55
|
+
'/',
|
|
56
|
+
generalValidator(
|
|
57
|
+
'json',
|
|
58
|
+
v.object({ ids: v.array(v.required(v.pick(Example$FindOne, ['id'])).entries.id) }),
|
|
59
|
+
),
|
|
60
|
+
async (c) => {
|
|
61
|
+
const { ids } = c.req.valid('json')
|
|
62
|
+
const exampleService = c.var.di.get('exampleService')
|
|
63
|
+
return successJson(c, await exampleService.deleteRecords(ids))
|
|
64
|
+
},
|
|
65
|
+
)
|
|
14
66
|
|
|
15
|
-
|
|
16
|
-
.get(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
describeRoute({
|
|
29
|
-
operationId: 'listExamples',
|
|
30
|
-
tags: [OpenApiTags.Example],
|
|
31
|
-
summary: 'List example rows',
|
|
32
|
-
responses: { 200: { description: 'Example rows' } },
|
|
33
|
-
}),
|
|
34
|
-
async (c) => successJson(c, await getDb(c).select(vcExamples.default).from(examples)),
|
|
35
|
-
)
|
|
36
|
-
.post(
|
|
37
|
-
'/examples',
|
|
38
|
-
describeRoute({
|
|
39
|
-
operationId: 'createExample',
|
|
40
|
-
tags: [OpenApiTags.Example],
|
|
41
|
-
summary: 'Create an example row',
|
|
42
|
-
responses: { 200: { description: 'Created example row' } },
|
|
43
|
-
}),
|
|
44
|
-
generalValidator('json', createExampleInputSchema),
|
|
45
|
-
async (c) => {
|
|
46
|
-
const input = c.req.valid('json')
|
|
47
|
-
const [row] = await getDb(c).insert(examples).values(input).returning(vcExamples.default)
|
|
48
|
-
return successJson(c, row)
|
|
49
|
-
},
|
|
50
|
-
)
|
|
51
|
-
.post(
|
|
52
|
-
'/examples/process',
|
|
53
|
-
describeRoute({
|
|
54
|
-
operationId: 'processExample',
|
|
55
|
-
tags: [OpenApiTags.Example],
|
|
56
|
-
summary: 'Process an example message in the worker pool',
|
|
57
|
-
responses: { 200: jsonResponse(v.object({ data: v.object({ normalized: v.string() }) })) },
|
|
58
|
-
}),
|
|
59
|
-
generalValidator('json', processExampleInputSchema),
|
|
60
|
-
async (c) => {
|
|
61
|
-
const result = await c.get('workRunner').run({
|
|
62
|
-
subject: WorkSubject.PROCESS_EXAMPLE,
|
|
63
|
-
input: c.req.valid('json'),
|
|
64
|
-
})
|
|
65
|
-
if (!result.ok) {
|
|
66
|
-
throw E.NORMAL.INTERNAL.create({
|
|
67
|
-
cause: result.error,
|
|
68
|
-
extensions: { workerCode: result.error.code },
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
return successJson(c, result.data)
|
|
72
|
-
},
|
|
73
|
-
)
|
|
67
|
+
routes.post('/process', generalValidator('json', Example$Process), async (c) => {
|
|
68
|
+
const result = await c.var.di.get('workRunner').run({
|
|
69
|
+
subject: WorkSubject.PROCESS_EXAMPLE,
|
|
70
|
+
input: c.req.valid('json'),
|
|
71
|
+
})
|
|
72
|
+
if (!result.ok) {
|
|
73
|
+
throw E.NORMAL.INTERNAL.create({
|
|
74
|
+
cause: result.error,
|
|
75
|
+
extensions: { workerCode: result.error.code },
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
return successJson(c, result.data)
|
|
79
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vite-plus/test'
|
|
2
|
+
import { Container } from '@inferdi/inferdi'
|
|
3
|
+
import { createSqliteClient } from '@repo/db/sqlite/sqlite'
|
|
4
|
+
import { sql } from 'drizzle-orm'
|
|
5
|
+
import { exampleModule } from './module'
|
|
6
|
+
import { ExampleService } from './service'
|
|
7
|
+
|
|
8
|
+
describe('ExampleService', () => {
|
|
9
|
+
let client: ReturnType<typeof createSqliteClient>
|
|
10
|
+
let service: ExampleService
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
client = createSqliteClient(':memory:')
|
|
14
|
+
client.db.run(sql`
|
|
15
|
+
CREATE TABLE examples (
|
|
16
|
+
id INTEGER PRIMARY KEY,
|
|
17
|
+
message TEXT NOT NULL,
|
|
18
|
+
created_at INTEGER NOT NULL DEFAULT 0,
|
|
19
|
+
updated_at INTEGER NOT NULL DEFAULT 0
|
|
20
|
+
)
|
|
21
|
+
`)
|
|
22
|
+
service = new Container()
|
|
23
|
+
.registerValue('database', { db: client.db })
|
|
24
|
+
.use(exampleModule)
|
|
25
|
+
.get('exampleService')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
client?.close()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('分页返回总数,不存在的示例返回 null', async () => {
|
|
33
|
+
await service.createOne({ message: 'A' })
|
|
34
|
+
await service.createOne({ message: 'B' })
|
|
35
|
+
const page = await service.findMany({ page: 2, limit: 1 })
|
|
36
|
+
expect(page.results.map((example) => example.message)).toEqual(['B'])
|
|
37
|
+
expect(page.meta).toMatchObject({ total: 2, offset: 1, limit: 1 })
|
|
38
|
+
const filtered = await service.findMany({ page: 1, limit: 10, message: 'B' })
|
|
39
|
+
expect(filtered.results.map((example) => example.message)).toEqual(['B'])
|
|
40
|
+
expect(filtered.meta.total).toBe(1)
|
|
41
|
+
expect(await service.findOne({ message: 'missing' })).toBeNull()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('更新不存在的记录或提交空更新均抛错', async () => {
|
|
45
|
+
await expect(service.updateOneById('999', { message: 'missing' })).rejects.toMatchObject({
|
|
46
|
+
problemDetails: { type: 'EXAMPLES.NOT_FOUND' },
|
|
47
|
+
})
|
|
48
|
+
const {
|
|
49
|
+
result: [example],
|
|
50
|
+
} = await service.createOne({ message: 'Example' })
|
|
51
|
+
await expect(service.updateOneById(example!.id, {})).rejects.toThrow('no update fields')
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { IExamplesIdVO } from '@repo/definition/backend'
|
|
2
|
+
import { E } from '@/shared/errors/defs'
|
|
3
|
+
import type { Database } from '@/shared/types/db'
|
|
4
|
+
import * as exampleQueries from './queries'
|
|
5
|
+
import type {
|
|
6
|
+
CreateOneExampleDto,
|
|
7
|
+
FindManyExamplesDto,
|
|
8
|
+
FindOneExampleDto,
|
|
9
|
+
UpdateOneExampleDto,
|
|
10
|
+
} from './types'
|
|
11
|
+
|
|
12
|
+
export class ExampleService {
|
|
13
|
+
private readonly db: Database['db']
|
|
14
|
+
|
|
15
|
+
constructor(database: Database) {
|
|
16
|
+
this.db = database.db
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async createOne(params: CreateOneExampleDto) {
|
|
20
|
+
return exampleQueries.insert(this.db, {
|
|
21
|
+
values: { message: params.message },
|
|
22
|
+
voType: 'id',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async findMany({ page, limit, ...whereParams }: FindManyExamplesDto) {
|
|
27
|
+
return exampleQueries.findPage(this.db, {
|
|
28
|
+
page,
|
|
29
|
+
limit,
|
|
30
|
+
where: whereParams,
|
|
31
|
+
voType: 'list',
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async findOne(whereParams: FindOneExampleDto) {
|
|
36
|
+
return exampleQueries.findOne(this.db, { where: whereParams, voType: 'list' })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async updateOneById(id: IExamplesIdVO['id'], params: UpdateOneExampleDto) {
|
|
40
|
+
const current = await exampleQueries.findOne(this.db, { where: { id }, voType: 'id' })
|
|
41
|
+
if (!current) throw E.EXAMPLES.NOT_FOUND.create()
|
|
42
|
+
const result = await exampleQueries.update(this.db, {
|
|
43
|
+
where: { id },
|
|
44
|
+
value: { message: params.message },
|
|
45
|
+
})
|
|
46
|
+
if (!result.updated) throw E.EXAMPLES.NOT_FOUND.create()
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async deleteRecords(ids: IExamplesIdVO['id'][]) {
|
|
51
|
+
if (!ids.length) return { deleted: 0 }
|
|
52
|
+
return exampleQueries.deleteRecords(this.db, { where: { id: { in: ids } } })
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as v from 'valibot'
|
|
2
|
+
import type {
|
|
3
|
+
Example$CreateOne,
|
|
4
|
+
Example$UpdateOne,
|
|
5
|
+
Example$FindOne,
|
|
6
|
+
Example$FindMany,
|
|
7
|
+
} from '@repo/definition/backend'
|
|
8
|
+
|
|
9
|
+
export type CreateOneExampleDto = v.InferOutput<typeof Example$CreateOne>
|
|
10
|
+
export type UpdateOneExampleDto = v.InferOutput<typeof Example$UpdateOne>
|
|
11
|
+
export type FindOneExampleDto = v.InferOutput<typeof Example$FindOne>
|
|
12
|
+
export type FindManyExamplesDto = v.InferOutput<typeof Example$FindMany>
|