@gong-ym/ai-spec-auto 0.2.3
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/.agents/commands/README.md +33 -0
- package/.agents/commands/claude/spec-start-review.md +88 -0
- package/.agents/commands/codex/spec-continue.md +74 -0
- package/.agents/commands/codex/spec-orchestrate.md +35 -0
- package/.agents/commands/codex/spec-start-review.md +88 -0
- package/.agents/commands/codex/spec-start.md +67 -0
- package/.agents/commands/codex/spec-status.md +22 -0
- package/.agents/commands/codex/spec-stop.md +29 -0
- package/.agents/commands/codex/spec-update.md +40 -0
- package/.agents/commands/common/branch-review.md +117 -0
- package/.agents/commands/common/project-init.md +25 -0
- package/.agents/commands/common/spec-continue.md +74 -0
- package/.agents/commands/common/spec-orchestrate.md +35 -0
- package/.agents/commands/common/spec-start-review.md +82 -0
- package/.agents/commands/common/spec-start.md +67 -0
- package/.agents/commands/common/spec-status.md +22 -0
- package/.agents/commands/common/spec-stop.md +29 -0
- package/.agents/commands/common/spec-update.md +40 -0
- package/.agents/commands/cursor/opsx-apply.md +55 -0
- package/.agents/commands/cursor/opsx-archive.md +48 -0
- package/.agents/commands/cursor/opsx-explore.md +45 -0
- package/.agents/commands/cursor/opsx-propose.md +59 -0
- package/.agents/commands/cursor/spec-continue.md +63 -0
- package/.agents/commands/cursor/spec-orchestrate.md +53 -0
- package/.agents/commands/cursor/spec-start-review.md +78 -0
- package/.agents/commands/cursor/spec-start.md +59 -0
- package/.agents/commands/cursor/spec-status.md +30 -0
- package/.agents/commands/cursor/spec-stop.md +29 -0
- package/.agents/commands/cursor/spec-update.md +41 -0
- package/.agents/flows/FRONTMATTER.md +263 -0
- package/.agents/flows/RUN_OUTPUT.md +263 -0
- package/.agents/flows/common/README.md +29 -0
- package/.agents/flows/common/bugfix-to-verification.md +95 -0
- package/.agents/flows/common/change-to-architecture-review.md +89 -0
- package/.agents/flows/common/change-to-release.md +94 -0
- package/.agents/flows/common/prd-to-delivery.md +184 -0
- package/.agents/flows/common/requirement-to-observability.md +97 -0
- package/.agents/orchestration/README.md +22 -0
- package/.agents/orchestration/expert-dispatch-spec.md +155 -0
- package/.agents/orchestration/expert-executor-spec.md +84 -0
- package/.agents/orchestration/expert-runtime-action-spec.md +73 -0
- package/.agents/orchestration/runtime-state-handoff-spec.md +264 -0
- package/.agents/orchestration/task-anchor-spec.md +212 -0
- package/.agents/orchestration/task-orchestrator-adapter-payload.md +153 -0
- package/.agents/orchestration/task-orchestrator-bootstrap-payload.md +145 -0
- package/.agents/orchestration/task-orchestrator-output-extractor-spec.md +93 -0
- package/.agents/orchestration/task-orchestrator-run-plan-template.md +312 -0
- package/.agents/orchestration/task-orchestrator-runtime-hooks.md +214 -0
- package/.agents/registry/README.md +63 -0
- package/.agents/registry/flows.json +125 -0
- package/.agents/registry/profiles.json +101 -0
- package/.agents/registry/roles.json +1266 -0
- package/.agents/registry/rules.json +148 -0
- package/.agents/registry/scenario-packages.json +123 -0
- package/.agents/registry/skills.json +130 -0
- package/.agents/roles/INDEX.md +346 -0
- package/.agents/roles/common/README.md +76 -0
- package/.agents/roles/common/archive-change.md +80 -0
- package/.agents/roles/common/backend-implementer.md +92 -0
- package/.agents/roles/common/code-guardian.md +151 -0
- package/.agents/roles/common/frontend-implementer.md +146 -0
- package/.agents/roles/common/requirement-analyst.md +138 -0
- package/.agents/roles/common/task-orchestrator-routing.md +301 -0
- package/.agents/roles/common/task-orchestrator.md +224 -0
- package/.agents/roles/common/tooling-implementer.md +92 -0
- package/.agents/roles/domains/README.md +35 -0
- package/.agents/roles/domains/delivery/README.md +11 -0
- package/.agents/roles/domains/delivery/container-specialist.md +50 -0
- package/.agents/roles/domains/delivery/deployment-specialist.md +50 -0
- package/.agents/roles/domains/delivery/pipeline-specialist.md +50 -0
- package/.agents/roles/domains/demand-design/README.md +16 -0
- package/.agents/roles/domains/demand-design/api-contract-specialist.md +52 -0
- package/.agents/roles/domains/demand-design/design-collaborator.md +58 -0
- package/.agents/roles/domains/documentation/README.md +11 -0
- package/.agents/roles/domains/documentation/api-doc-specialist.md +50 -0
- package/.agents/roles/domains/documentation/component-doc-specialist.md +49 -0
- package/.agents/roles/domains/documentation/technical-writing-specialist.md +48 -0
- package/.agents/roles/domains/engineering/README.md +17 -0
- package/.agents/roles/domains/engineering/architecture-advisor.md +53 -0
- package/.agents/roles/domains/engineering/build-specialist.md +51 -0
- package/.agents/roles/domains/engineering/dependency-governor.md +52 -0
- package/.agents/roles/domains/governance/README.md +17 -0
- package/.agents/roles/domains/governance/api-governance-specialist.md +51 -0
- package/.agents/roles/domains/governance/lint-policy-specialist.md +49 -0
- package/.agents/roles/domains/governance/route-governance-specialist.md +52 -0
- package/.agents/roles/domains/observability/README.md +11 -0
- package/.agents/roles/domains/observability/error-tracker.md +50 -0
- package/.agents/roles/domains/observability/event-instrumentation-specialist.md +51 -0
- package/.agents/roles/domains/observability/rum-analyst.md +50 -0
- package/.agents/roles/domains/performance/README.md +11 -0
- package/.agents/roles/domains/performance/asset-optimizer.md +50 -0
- package/.agents/roles/domains/performance/performance-auditor.md +56 -0
- package/.agents/roles/domains/performance/vitals-analyst.md +50 -0
- package/.agents/roles/domains/security-a11y/README.md +11 -0
- package/.agents/roles/domains/security-a11y/a11y-auditor.md +50 -0
- package/.agents/roles/domains/security-a11y/aria-specialist.md +51 -0
- package/.agents/roles/domains/security-a11y/security-reviewer.md +49 -0
- package/.agents/roles/domains/testing/README.md +12 -0
- package/.agents/roles/domains/testing/coverage-analyst.md +50 -0
- package/.agents/roles/domains/testing/e2e-test-specialist.md +51 -0
- package/.agents/roles/domains/testing/unit-test-specialist.md +56 -0
- package/.agents/roles/domains/testing/verification-reviewer.md +67 -0
- package/.agents/rules/README.md +87 -0
- package/.agents/rules/common/02-/347/274/226/347/240/201/350/247/204/350/214/203.md +45 -0
- package/.agents/rules/common/08-/351/200/232/347/224/250/347/272/246/346/235/237.md +63 -0
- package/.agents/rules/common/10-/346/226/207/346/241/243/350/247/204/350/214/203.md +101 -0
- package/.agents/rules/common/12-Superpowers/346/211/247/350/241/214/350/247/204/350/214/203.md +46 -0
- package/.agents/rules/common/14-/345/256/241/350/256/241/346/261/207/346/212/245/350/247/204/350/214/203.md +107 -0
- package/.agents/rules/common/15-visual-gate-wait.md +90 -0
- package/.agents/rules/profiles/nestjs/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +27 -0
- package/.agents/rules/profiles/nestjs/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +20 -0
- package/.agents/rules/profiles/nestjs/04-/346/250/241/345/235/227/347/273/223/346/236/204/350/247/204/350/214/203.md +24 -0
- package/.agents/rules/profiles/nestjs/05-/346/216/245/345/217/243/344/270/216/345/245/221/347/272/246/350/247/204/350/214/203.md +24 -0
- package/.agents/rules/profiles/nestjs/06-/346/225/260/346/215/256/350/256/277/351/227/256/350/247/204/350/214/203.md +24 -0
- package/.agents/rules/profiles/nestjs/07-/351/205/215/347/275/256/344/270/216/350/277/220/350/241/214/346/227/266/350/247/204/350/214/203.md +20 -0
- package/.agents/rules/profiles/nestjs/09-/345/274/202/345/270/270/344/270/216/346/227/245/345/277/227/350/247/204/350/214/203.md +20 -0
- package/.agents/rules/profiles/nestjs/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +24 -0
- package/.agents/rules/profiles/nestjs/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +20 -0
- package/.agents/rules/profiles/node-tooling/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +30 -0
- package/.agents/rules/profiles/node-tooling/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +37 -0
- package/.agents/rules/profiles/node-tooling/04-CLI/344/270/216/346/250/241/345/235/227/350/247/204/350/214/203.md +42 -0
- package/.agents/rules/profiles/node-tooling/05-Contract/344/270/216Schema/350/247/204/350/214/203.md +42 -0
- package/.agents/rules/profiles/node-tooling/06-/350/277/220/350/241/214/346/227/266/346/226/207/344/273/266/350/247/204/350/214/203.md +30 -0
- package/.agents/rules/profiles/node-tooling/07-/346/227/245/345/277/227/344/270/216/351/224/231/350/257/257/345/244/204/347/220/206/350/247/204/350/214/203.md +60 -0
- package/.agents/rules/profiles/node-tooling/09-/350/204/232/346/234/254/344/270/216/345/205/245/345/217/243/350/247/204/350/214/203.md +45 -0
- package/.agents/rules/profiles/node-tooling/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +41 -0
- package/.agents/rules/profiles/node-tooling/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +55 -0
- package/.agents/rules/profiles/react/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +29 -0
- package/.agents/rules/profiles/react/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +104 -0
- package/.agents/rules/profiles/react/04-/347/273/204/344/273/266/350/247/204/350/214/203.md +46 -0
- package/.agents/rules/profiles/react/05-API/350/247/204/350/214/203.md +67 -0
- package/.agents/rules/profiles/react/06-/350/267/257/347/224/261/350/247/204/350/214/203.md +54 -0
- package/.agents/rules/profiles/react/07-/347/212/266/346/200/201/347/256/241/347/220/206.md +226 -0
- package/.agents/rules/profiles/react/09-/346/240/267/345/274/217/350/247/204/350/214/203.md +71 -0
- package/.agents/rules/profiles/react/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +80 -0
- package/.agents/rules/profiles/react/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +159 -0
- package/.agents/rules/profiles/springboot/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +31 -0
- package/.agents/rules/profiles/springboot/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +37 -0
- package/.agents/rules/profiles/springboot/04-/345/210/206/345/261/202/350/247/204/350/214/203.md +33 -0
- package/.agents/rules/profiles/springboot/05-/346/216/245/345/217/243/344/270/216/345/245/221/347/272/246/350/247/204/350/214/203.md +51 -0
- package/.agents/rules/profiles/springboot/06-/346/225/260/346/215/256/350/256/277/351/227/256/350/247/204/350/214/203.md +34 -0
- package/.agents/rules/profiles/springboot/07-/351/205/215/347/275/256/344/270/216/350/277/220/350/241/214/346/227/266/350/247/204/350/214/203.md +38 -0
- package/.agents/rules/profiles/springboot/09-/345/274/202/345/270/270/344/270/216/346/227/245/345/277/227/350/247/204/350/214/203.md +48 -0
- package/.agents/rules/profiles/springboot/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +43 -0
- package/.agents/rules/profiles/springboot/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +48 -0
- package/.agents/rules/profiles/vue/01-/351/241/271/347/233/256/346/246/202/350/277/260.md +47 -0
- package/.agents/rules/profiles/vue/03-/351/241/271/347/233/256/347/273/223/346/236/204.md +106 -0
- package/.agents/rules/profiles/vue/04-/347/273/204/344/273/266/350/247/204/350/214/203.md +61 -0
- package/.agents/rules/profiles/vue/05-API/350/247/204/350/214/203.md +67 -0
- package/.agents/rules/profiles/vue/06-/350/267/257/347/224/261/350/247/204/350/214/203.md +69 -0
- package/.agents/rules/profiles/vue/07-/347/212/266/346/200/201/347/256/241/347/220/206.md +93 -0
- package/.agents/rules/profiles/vue/09-/346/240/267/345/274/217/350/247/204/350/214/203.md +67 -0
- package/.agents/rules/profiles/vue/11-/346/265/213/350/257/225/350/247/204/350/214/203.md +80 -0
- package/.agents/rules/profiles/vue/13-/344/273/243/347/240/201/346/240/274/345/274/217/345/214/226/344/270/216/346/243/200/346/237/245.md +159 -0
- package/.agents/skills/README.md +171 -0
- package/.agents/skills/common/archive-change/SKILL.md +180 -0
- package/.agents/skills/common/branch-code-reviewer/SKILL.md +459 -0
- package/.agents/skills/common/branch-code-reviewer/references/business-risk-guide.md +293 -0
- package/.agents/skills/common/branch-code-reviewer/references/html-template-guide.md +121 -0
- package/.agents/skills/common/config-and-secret-scan/SKILL.md +99 -0
- package/.agents/skills/common/create-proposal/SKILL.md +192 -0
- package/.agents/skills/common/create-proposal/evals/evals.json +16 -0
- package/.agents/skills/common/create-proposal/evals/train_queries.json +18 -0
- package/.agents/skills/common/create-proposal/evals/validation_queries.json +18 -0
- package/.agents/skills/common/create-proposal/references/interaction-spec-template.md +42 -0
- package/.agents/skills/common/create-test/SKILL.md +292 -0
- package/.agents/skills/common/dependency-impact-graph/SKILL.md +80 -0
- package/.agents/skills/common/execute-task/SKILL.md +206 -0
- package/.agents/skills/common/execute-task/evals/evals.json +16 -0
- package/.agents/skills/common/execute-task/evals/train_queries.json +18 -0
- package/.agents/skills/common/execute-task/evals/validation_queries.json +18 -0
- package/.agents/skills/common/find-skills/SKILL.md +144 -0
- package/.agents/skills/common/install-ai-spec-auto/SKILL.md +260 -0
- package/.agents/skills/common/install-ai-spec-auto/evals/evals.json +17 -0
- package/.agents/skills/common/install-ai-spec-auto/evals/train_queries.json +18 -0
- package/.agents/skills/common/install-ai-spec-auto/evals/validation_queries.json +18 -0
- package/.agents/skills/common/project-init/SKILL.md +178 -0
- package/.agents/skills/common/project-init/evals/evals.json +16 -0
- package/.agents/skills/common/project-init/evals/train_queries.json +18 -0
- package/.agents/skills/common/project-init/evals/validation_queries.json +18 -0
- package/.agents/skills/common/project-init/references/custom-rule-generation.md +89 -0
- package/.agents/skills/common/project-init/references/deep-scan-rules.md +67 -0
- package/.agents/skills/common/project-init/references/output-contracts.md +71 -0
- package/.agents/skills/common/project-init/references/repo-fact-gathering.md +83 -0
- package/.agents/skills/common/project-init/references/scope-resolution.md +76 -0
- package/.agents/skills/common/project-init/scripts/inspect-project.js +112 -0
- package/.agents/skills/common/skill-creator/LICENSE.txt +202 -0
- package/.agents/skills/common/skill-creator/SKILL.md +370 -0
- package/.agents/skills/common/skill-creator/evals/evals.json +16 -0
- package/.agents/skills/common/skill-creator/evals/train_queries.json +18 -0
- package/.agents/skills/common/skill-creator/evals/validation_queries.json +18 -0
- package/.agents/skills/common/skill-creator/references/output-patterns.md +82 -0
- package/.agents/skills/common/skill-creator/references/workflows.md +28 -0
- package/.agents/skills/common/skill-creator/scripts/init_skill.py +209 -0
- package/.agents/skills/common/skill-creator/scripts/package_skill.py +110 -0
- package/.agents/skills/common/skill-creator/scripts/quick_validate.py +51 -0
- package/.agents/skills/common/skill-optimizer/SKILL.md +102 -0
- package/.agents/skills/common/skill-optimizer/evals/evals.json +16 -0
- package/.agents/skills/common/skill-optimizer/evals/train_queries.json +18 -0
- package/.agents/skills/common/skill-optimizer/evals/validation_queries.json +18 -0
- package/.agents/skills/common/skill-optimizer/references/design-patterns.md +26 -0
- package/.agents/skills/common/skill-optimizer/references/review-checklist.md +22 -0
- package/.agents/skills/common/using-superpowers/SKILL.md +151 -0
- package/.agents/skills/common/wait-for-gate-signal/SKILL.md +85 -0
- package/.agents/skills/domains/README.md +19 -0
- package/.agents/skills/domains/ui-ux-pro-max/SKILL.md +58 -0
- package/.agents/skills/domains/web/design-analysis/SKILL.md +89 -0
- package/.agents/skills/domains/web/design-analysis/rules/analysis-order.md +61 -0
- package/.agents/skills/domains/web/design-analysis/rules/analysis-priorities.md +136 -0
- package/.agents/skills/domains/web/design-analysis/rules/checklist-common-misses.md +107 -0
- package/.agents/skills/domains/web/design-analysis/rules/implementation-common-errors.md +204 -0
- package/.agents/skills/domains/web/design-analysis/rules/implementation-guidelines.md +211 -0
- package/.agents/skills/domains/web/design-analysis/rules/output-analysis-checklist.md +247 -0
- package/.agents/skills/domains/web/design-analysis/rules/tools-design-guidelines.md +108 -0
- package/.agents/skills/domains/web/design-analysis/rules/workflow-element-extraction.md +162 -0
- package/.agents/skills/domains/web/design-analysis/rules/workflow-layout-map.md +131 -0
- package/.agents/skills/domains/web/design-analysis/rules/workflow-output-checklist.md +70 -0
- package/.agents/skills/domains/web/design-analysis/rules/workflow-style-summary.md +91 -0
- package/.agents/skills/domains/web/route-permission-map/SKILL.md +103 -0
- package/.agents/skills/domains/web/ui-verification/SKILL.md +114 -0
- package/.agents/skills/domains/web/ui-verification/evals/evals.json +16 -0
- package/.agents/skills/domains/web/ui-verification/evals/train_queries.json +18 -0
- package/.agents/skills/domains/web/ui-verification/evals/validation_queries.json +18 -0
- package/.agents/skills/domains/web/ui-verification/rules/comparison-content-image.md +34 -0
- package/.agents/skills/domains/web/ui-verification/rules/comparison-content-text.md +30 -0
- package/.agents/skills/domains/web/ui-verification/rules/comparison-hierarchy.md +33 -0
- package/.agents/skills/domains/web/ui-verification/rules/comparison-layout.md +35 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-alignment.md +42 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-button-dimensions.md +28 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-button-position.md +25 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-css-priority.md +50 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-flex-column-width.md +46 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-flex-layout.md +46 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-grid-container-width.md +44 -0
- package/.agents/skills/domains/web/ui-verification/rules/errors-page-container-width.md +39 -0
- package/.agents/skills/domains/web/ui-verification/rules/tools-browser-navigation.md +53 -0
- package/.agents/skills/domains/web/ui-verification/rules/tools-design-guidelines.md +53 -0
- package/.agents/skills/domains/web/ui-verification/rules/workflow-checklist.md +27 -0
- package/.agents/skills/domains/web/ui-verification/rules/workflow-problem-list.md +56 -0
- package/.agents/skills/domains/web/ui-verification/rules/workflow-reflection.md +44 -0
- package/.agents/skills/domains/web/ui-verification/rules/writing-alignment.md +44 -0
- package/.agents/skills/domains/web/ui-verification/rules/writing-element-completeness.md +63 -0
- package/.agents/skills/domains/web/ui-verification/rules/writing-list-layout.md +75 -0
- package/.agents/skills/domains/web/ui-verification/rules/writing-page-container-width.md +37 -0
- package/.agents/skills/domains/web/web-design-guidelines/SKILL.md +40 -0
- package/.agents/skills/profiles/nestjs/README.md +4 -0
- package/.agents/skills/profiles/node-tooling/README.md +9 -0
- package/.agents/skills/profiles/react/create-api/SKILL.md +145 -0
- package/.agents/skills/profiles/react/create-component/SKILL.md +160 -0
- package/.agents/skills/profiles/react/create-route/SKILL.md +168 -0
- package/.agents/skills/profiles/react/create-store/SKILL.md +262 -0
- package/.agents/skills/profiles/react/theme-variables/SKILL.md +82 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/AGENTS.md +899 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/SKILL.md +81 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-context-interface.md +191 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/.agents/skills/profiles/react/vercel-composition-patterns/rules/state-lift-state.md +125 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/AGENTS.md +2934 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/SKILL.md +136 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/.agents/skills/profiles/react/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/.agents/skills/profiles/springboot/README.md +10 -0
- package/.agents/skills/profiles/vue/create-api/SKILL.md +105 -0
- package/.agents/skills/profiles/vue/create-component/SKILL.md +76 -0
- package/.agents/skills/profiles/vue/create-route/SKILL.md +141 -0
- package/.agents/skills/profiles/vue/create-store/SKILL.md +97 -0
- package/.agents/skills/profiles/vue/create-view/SKILL.md +81 -0
- package/.agents/skills/profiles/vue/theme-variables/SKILL.md +73 -0
- package/.agents/skills/profiles/vue/vue-best-practices/SKILL.md +166 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/animation-class-based-technique.md +254 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/animation-state-driven-technique.md +291 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-async.md +97 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-data-flow.md +307 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-fallthrough-attrs.md +174 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-keep-alive.md +137 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-slots.md +216 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-suspense.md +228 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-teleport.md +108 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-transition-group.md +128 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/component-transition.md +125 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/composables.md +290 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/directives.md +162 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-avoid-component-abstraction-in-lists.md +159 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-v-once-v-memo-directives.md +182 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/perf-virtualize-large-lists.md +187 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/plugins.md +166 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/reactivity.md +344 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/render-functions.md +201 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/sfc.md +310 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/state-management.md +135 -0
- package/.agents/skills/profiles/vue/vue-best-practices/references/updated-hook-performance.md +187 -0
- package/.agents/templates/common/README.md +23 -0
- package/.agents/templates/common/bugfix.md +22 -0
- package/.agents/templates/common/create-expert-package.md +458 -0
- package/.agents/templates/common/mock-page.md +28 -0
- package/.agents/templates/common/new-component.md +25 -0
- package/.agents/templates/common/new-page.md +31 -0
- package/.cursor/mcp.json +36 -0
- package/.qoder/README.md +114 -0
- package/.qoder/commands +1 -0
- package/.qoder/mcp.json +26 -0
- package/.qoder/rules +1 -0
- package/.qoder/skills +1 -0
- package/LICENSE +21 -0
- package/README.md +433 -0
- package/bin/archive-change.js +474 -0
- package/bin/check-command.js +62 -0
- package/bin/cli.js +295 -0
- package/bin/command-template-renderer.js +40 -0
- package/bin/context-command.js +102 -0
- package/bin/demo-runtime-smoke.js +760 -0
- package/bin/execution-semantics.js +821 -0
- package/bin/executor-command.js +93 -0
- package/bin/expert-dispatch.js +334 -0
- package/bin/expert-executor.js +1148 -0
- package/bin/guard-command.js +52 -0
- package/bin/hub-command.js +876 -0
- package/bin/ide-command.js +242 -0
- package/bin/init-command.js +193 -0
- package/bin/install-workflow.js +2983 -0
- package/bin/manifest-export.js +34 -0
- package/bin/profile-registry.js +90 -0
- package/bin/protocol-workflow.js +446 -0
- package/bin/repair-command.js +161 -0
- package/bin/repo-map.js +177 -0
- package/bin/report-command.js +236 -0
- package/bin/runtime-bootstrap.js +428 -0
- package/bin/runtime-embedded.js +101 -0
- package/bin/runtime-fallback.js +106 -0
- package/bin/runtime-launcher.js +116 -0
- package/bin/runtime-paths.js +177 -0
- package/bin/runtime-registry.js +289 -0
- package/bin/runtime-state.js +2541 -0
- package/bin/scan.js +96 -0
- package/bin/self-upgrade.js +206 -0
- package/bin/skill-spec-validator.js +457 -0
- package/bin/spec-command.js +366 -0
- package/bin/superpowers.js +384 -0
- package/bin/sync-command.js +59 -0
- package/bin/sync.js +1904 -0
- package/bin/task-orchestrator-adapter.js +341 -0
- package/bin/task-orchestrator-extractor.js +274 -0
- package/bin/task-orchestrator-runner.js +1208 -0
- package/bin/telemetry/README.md +66 -0
- package/bin/telemetry/aspect.js +153 -0
- package/bin/telemetry/collect.js +67 -0
- package/bin/telemetry/config.js +114 -0
- package/bin/telemetry/defaults.json +5 -0
- package/bin/telemetry/healthcheck.js +195 -0
- package/bin/telemetry/identity.js +53 -0
- package/bin/telemetry/index.js +25 -0
- package/bin/telemetry/reporter.js +83 -0
- package/bin/telemetry/safe.js +39 -0
- package/bin/validate-registry.js +740 -0
- package/bin/visual-bridge-config.js +117 -0
- package/bin/visual-bridge.js +287 -0
- package/bin/visual-command.js +432 -0
- package/bin/worktree-command.js +194 -0
- package/configs/common/.editorconfig +15 -0
- package/configs/common/.husky/commit-msg +4 -0
- package/configs/common/.husky/pre-commit +4 -0
- package/configs/common/.lintstagedrc +11 -0
- package/configs/common/.prettierignore +11 -0
- package/configs/common/.prettierrc.json +11 -0
- package/configs/common/.stylelintignore +14 -0
- package/configs/common/.stylelintrc.json +21 -0
- package/configs/common/commitlint.config.js +3 -0
- package/configs/profiles/nestjs/.gitkeep +1 -0
- package/configs/profiles/node-tooling/.gitkeep +1 -0
- package/configs/profiles/react/.eslintignore +6 -0
- package/configs/profiles/react/.eslintrc.js +16 -0
- package/configs/profiles/react/.stylelintrc.json +18 -0
- package/configs/profiles/springboot/.gitkeep +1 -0
- package/configs/profiles/vue/.eslintignore +7 -0
- package/configs/profiles/vue/.eslintrc.cjs +17 -0
- package/contracts/README.md +28 -0
- package/contracts/fixtures/asset-package.fixture.json +26 -0
- package/contracts/fixtures/asset-usage-feedback.fixture.json +14 -0
- package/contracts/fixtures/evidence-report.fixture.json +28 -0
- package/contracts/fixtures/manifest.fixture.json +20 -0
- package/contracts/fixtures/run-event.fixture.json +15 -0
- package/contracts/schemas/asset-package.schema.json +76 -0
- package/contracts/schemas/asset-usage-feedback.schema.json +57 -0
- package/contracts/schemas/evidence-report.schema.json +60 -0
- package/contracts/schemas/manifest.schema.json +63 -0
- package/contracts/schemas/run-event.schema.json +72 -0
- package/install.ps1 +35 -0
- package/install.sh +17 -0
- package/internal/ai-protocol-workflow.js +5600 -0
- package/internal/hub-client.js +98 -0
- package/internal/hub-sync-selection.js +69 -0
- package/internal/visual-hooks/README.md +481 -0
- package/internal/visual-hooks/config-loader.js +218 -0
- package/internal/visual-hooks/control-puller.js +206 -0
- package/internal/visual-hooks/gate-signal.js +150 -0
- package/internal/visual-hooks/inbox-consumer.js +469 -0
- package/internal/visual-hooks/index.js +197 -0
- package/internal/visual-hooks/push-client.js +189 -0
- package/internal/visual-hooks/receipt-pusher.js +176 -0
- package/internal/visual-hooks/runtime-state-pusher.js +128 -0
- package/openspec/changes/.gitkeep +0 -0
- package/openspec/changes/archive/.gitkeep +0 -0
- package/openspec/config.yaml.template +52 -0
- package/openspec/schemas/expert-delivery/schema.yaml +68 -0
- package/openspec/schemas/expert-delivery/templates/checklist.md +39 -0
- package/openspec/schemas/expert-delivery/templates/design.md +61 -0
- package/openspec/schemas/expert-delivery/templates/iterations.md +25 -0
- package/openspec/schemas/expert-delivery/templates/proposal.md +45 -0
- package/openspec/schemas/expert-delivery/templates/spec.md +29 -0
- package/openspec/schemas/expert-delivery/templates/tasks.md +24 -0
- package/openspec/specs/.gitkeep +0 -0
- package/package.json +73 -0
- package/scripts/acceptance-zero-intrusion.sh +168 -0
- package/scripts/hub-sync-assets.config.example.json +296 -0
- package/scripts/hub-sync-assets.js +2038 -0
- package/scripts/local-verify.sh +280 -0
- package/scripts/post-publish-auto-fix-check.js +404 -0
- package/scripts/post-publish-verify.sh +175 -0
- package/scripts/setup-cursor-manual-test.sh +107 -0
- package/scripts/setup-cursor-spec-archive-test.sh +111 -0
- package/scripts/setup-visual-integration.sh +225 -0
- package/scripts/test-integration.sh +176 -0
- package/scripts/update-test-project.sh +93 -0
- package/scripts/upload-four-web.sh +57 -0
- package/scripts/verify-install-ps1-bom.js +26 -0
- package/src/agent/agent-context.js +259 -0
- package/src/agent/agent-profile.js +185 -0
- package/src/agent/agent-templates.js +161 -0
- package/src/agent/agent-types.js +108 -0
- package/src/agent/collaboration-protocol.js +333 -0
- package/src/agent/conflict-handler.js +364 -0
- package/src/agent/file-permission.js +121 -0
- package/src/agent/index.js +38 -0
- package/src/agent/permission-audit.js +151 -0
- package/src/agent/review-repair-loop.js +270 -0
- package/src/agent/tool-permission.js +101 -0
- package/src/asset/asset-dependency.js +322 -0
- package/src/asset/asset-feedback.js +350 -0
- package/src/asset/asset-fork.js +300 -0
- package/src/asset/asset-install.js +278 -0
- package/src/asset/asset-installer.js +497 -0
- package/src/asset/asset-lifecycle.js +324 -0
- package/src/asset/asset-manager.js +245 -0
- package/src/asset/asset-package-manager.js +349 -0
- package/src/asset/asset-package.js +186 -0
- package/src/asset/asset-quality.js +262 -0
- package/src/asset/asset-registry.js +387 -0
- package/src/asset/asset-version.js +293 -0
- package/src/asset/index.js +86 -0
- package/src/cache/agent-profile-cache.js +59 -0
- package/src/cache/asset-cache.js +63 -0
- package/src/cache/global-cache.js +61 -0
- package/src/cache/manifest-cache.js +30 -0
- package/src/check/check-service.js +32 -0
- package/src/config/config-layer.js +343 -0
- package/src/config/config-loader.js +60 -0
- package/src/config/defaults.js +49 -0
- package/src/connectors/hub/asset-package.js +72 -0
- package/src/connectors/hub/asset-usage-feedback.js +46 -0
- package/src/connectors/hub/hub-connector.js +44 -0
- package/src/connectors/hub/index.js +21 -0
- package/src/connectors/visual/evidence-report.js +49 -0
- package/src/connectors/visual/index.js +15 -0
- package/src/connectors/visual/queue.js +41 -0
- package/src/connectors/visual/run-event.js +81 -0
- package/src/connectors/visual/visual-connector.js +77 -0
- package/src/context/context-budget.js +59 -0
- package/src/context/context-builder.js +285 -0
- package/src/context/context-loader.js +116 -0
- package/src/context/context-planner.js +158 -0
- package/src/context/types.js +96 -0
- package/src/contracts/index.js +63 -0
- package/src/executor/executor-registry.js +78 -0
- package/src/executor/executor-result-parser.js +44 -0
- package/src/executor/executor-runner.js +141 -0
- package/src/executor/executor-selector.js +139 -0
- package/src/executor/executor-timeout.js +36 -0
- package/src/executor/providers/base-provider-utils.js +189 -0
- package/src/executor/providers/claude-code-executor-provider.js +128 -0
- package/src/executor/providers/codex-executor-provider.js +126 -0
- package/src/executor/providers/cursor-executor-provider.js +99 -0
- package/src/executor/types.js +137 -0
- package/src/git/branch-manager.js +71 -0
- package/src/git/dirty-checker.js +43 -0
- package/src/git/dirty-strategy-handler.js +29 -0
- package/src/git/git-command.js +37 -0
- package/src/git/git-repository-detector.js +45 -0
- package/src/git/multi-repo-worktree-planner.js +88 -0
- package/src/git/policy.js +19 -0
- package/src/git/strategies/block-dirty-strategy.js +34 -0
- package/src/git/strategies/ignore-dirty-strategy.js +33 -0
- package/src/git/strategies/patch-snapshot-strategy.js +53 -0
- package/src/git/strategies/wip-commit-strategy.js +38 -0
- package/src/git/types.js +71 -0
- package/src/git/worktree-manager.js +85 -0
- package/src/governance/asset-review.js +351 -0
- package/src/governance/audit-log.js +368 -0
- package/src/governance/gray-release.js +312 -0
- package/src/governance/index.js +31 -0
- package/src/governance/policy-types.js +56 -0
- package/src/governance/rbac-types.js +171 -0
- package/src/governance/rbac.js +382 -0
- package/src/governance/rollback.js +360 -0
- package/src/governance/security-policy.js +354 -0
- package/src/hook/hook-config-writer.js +125 -0
- package/src/hub/hub-client.js +186 -0
- package/src/hub/hub-config.js +39 -0
- package/src/hub/project-facts.js +31 -0
- package/src/hub/runtime-feedback-reporter.js +55 -0
- package/src/ide/adapters/adapter-protocol.js +385 -0
- package/src/ide/adapters/claude-adapter.js +419 -0
- package/src/ide/adapters/codex-adapter.js +60 -0
- package/src/ide/adapters/cursor-adapter.js +484 -0
- package/src/ide/adapters/index.js +24 -0
- package/src/ide/anchors/markdown-anchor-writer.js +152 -0
- package/src/ide/ide-service.js +270 -0
- package/src/ide/ide-types.js +94 -0
- package/src/ide/links/link-mode-resolver.js +160 -0
- package/src/ide/registry/ide-registry-builder.js +165 -0
- package/src/incident/incident-writer.js +47 -0
- package/src/incident/types.js +22 -0
- package/src/init/ide-linker.js +126 -0
- package/src/init/ide-pointer-injector.js +75 -0
- package/src/init/init-applier.js +197 -0
- package/src/init/init-plan.js +294 -0
- package/src/init/init-service.js +65 -0
- package/src/init/manifest-installer.js +302 -0
- package/src/init/types.js +26 -0
- package/src/project/config-writer.js +83 -0
- package/src/project/context-index-writer.js +82 -0
- package/src/project/json-utils.js +72 -0
- package/src/project/local-state-writer.js +50 -0
- package/src/project/lock-file-writer.js +98 -0
- package/src/project/manifest-writer.js +126 -0
- package/src/project/policy-config-writer.js +91 -0
- package/src/project/project-config-writer.js +74 -0
- package/src/project/project-files.js +39 -0
- package/src/project/registry-index-writer.js +43 -0
- package/src/project/workspace-config-writer.js +63 -0
- package/src/run/index.js +11 -0
- package/src/run/run-id.js +32 -0
- package/src/run/run-service.js +269 -0
- package/src/run/run-store.js +80 -0
- package/src/scanner/aggregator/detection-aggregator.js +23 -0
- package/src/scanner/boundary/boundary-resolver.js +229 -0
- package/src/scanner/detectors/detector-registry.js +44 -0
- package/src/scanner/detectors/fastapi-detector.js +46 -0
- package/src/scanner/detectors/go-detector.js +46 -0
- package/src/scanner/detectors/nestjs-detector.js +57 -0
- package/src/scanner/detectors/nextjs-detector.js +52 -0
- package/src/scanner/detectors/react-vite-detector.js +52 -0
- package/src/scanner/detectors/react-webpack-detector.js +57 -0
- package/src/scanner/detectors/springboot-detector.js +46 -0
- package/src/scanner/detectors/springcloud-detector.js +46 -0
- package/src/scanner/detectors/springmvc-detector.js +46 -0
- package/src/scanner/detectors/vue-vite-detector.js +52 -0
- package/src/scanner/engine.js +72 -0
- package/src/scanner/facts/fact-extractor.js +211 -0
- package/src/scanner/types.js +30 -0
- package/src/security/asset-tamper-checker.js +188 -0
- package/src/security/checksum.js +40 -0
- package/src/spec/spec-writer.js +302 -0
- package/src/state-machine/circuit-breaker.js +112 -0
- package/src/state-machine/escape-hatch.js +49 -0
- package/src/state-machine/stage-runner.js +281 -0
- package/src/state-machine/state-machine.js +24 -0
- package/src/state-machine/transition-guard.js +36 -0
- package/src/state-machine/types.js +37 -0
- package/src/sync/sync-service.js +192 -0
- package/src/visual/agent-visual.js +142 -0
- package/src/visual/event-gateway.js +357 -0
- package/src/visual/event-mapper.js +128 -0
- package/src/visual/hook-dashboard.js +216 -0
- package/src/visual/index.js +27 -0
- package/src/visual/metrics.js +287 -0
- package/src/visual/privacy-filter.js +100 -0
- package/src/visual/risk-board.js +252 -0
- package/src/visual/timeline.js +245 -0
- package/src/visual/visual-client.js +94 -0
- package/src/visual/visual-config.js +40 -0
- package/src/visual/visual-reporter.js +88 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: Node.js 工具仓的代码格式化与静态检查规范,包括 ESLint、Prettier 的工具链职责、配置约定与开发流程集成。当配置或调整 lint/format 工具时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 代码格式化与检查(Node.js Tooling)
|
|
7
|
+
|
|
8
|
+
## 工具链
|
|
9
|
+
|
|
10
|
+
| 工具 | 职责 | 配置文件 |
|
|
11
|
+
|------|------|----------|
|
|
12
|
+
| **Prettier** | 代码格式化(缩进、引号、分号等) | `.prettierrc.json` |
|
|
13
|
+
| **ESLint** | 代码质量与风格检查 | `eslint.config.js` / `.eslintrc.cjs` |
|
|
14
|
+
|
|
15
|
+
## Prettier 规则
|
|
16
|
+
|
|
17
|
+
| 配置项 | 值 | 说明 |
|
|
18
|
+
|--------|-----|------|
|
|
19
|
+
| `semi` | `true` | 语句末尾加分号 |
|
|
20
|
+
| `tabWidth` | `2` | 缩进 2 空格 |
|
|
21
|
+
| `singleQuote` | `true` | 使用单引号 |
|
|
22
|
+
| `printWidth` | `100` | 单行最大宽度 |
|
|
23
|
+
| `trailingComma` | `"es5"` | 对象/数组末尾加逗号 |
|
|
24
|
+
| `endOfLine` | `"auto"` | 自动适配换行符 |
|
|
25
|
+
|
|
26
|
+
## ESLint 核心规则
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
// eslint.config.js(ESLint 9 flat config)
|
|
30
|
+
export default [
|
|
31
|
+
{
|
|
32
|
+
files: ['src/**/*.ts'],
|
|
33
|
+
rules: {
|
|
34
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
35
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
36
|
+
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 开发流程集成
|
|
43
|
+
|
|
44
|
+
### 提交前自动检查(husky + lint-staged)
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"*.{ts,js,json}": ["eslint --fix", "prettier --write"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### CI 集成
|
|
53
|
+
|
|
54
|
+
- CI 流水线必须包含 `lint`、`typecheck`、`test` 三个检查步骤
|
|
55
|
+
- 任一步骤失败则阻断 PR 合并
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: 项目定位与技术栈概览。当需要了解项目背景、使用的技术栈时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 项目概述
|
|
7
|
+
|
|
8
|
+
## 项目定位
|
|
9
|
+
|
|
10
|
+
一个基于 React + TypeScript 的单页应用(SPA)。
|
|
11
|
+
|
|
12
|
+
> **与 JavaScript 存量项目的关系**:本文件默认描述团队推荐的 **React + TypeScript**。若 `package.json` 的 `dependencies` / `devDependencies` 中**未**声明 `typescript`,以「初始化项目规范」技能生成的 **01-项目概述.md** 为准,并遵循 **02-编码规范** 中的 JavaScript 小节。
|
|
13
|
+
|
|
14
|
+
## 技术栈
|
|
15
|
+
|
|
16
|
+
| 领域 | 技术 | 说明 |
|
|
17
|
+
|------|------|------|
|
|
18
|
+
| UI 框架 | React ^18.3.1 | 强制使用 |
|
|
19
|
+
| 类型系统 | TypeScript 5.x | 推荐;新代码优先 TS。纯 JS 项目见 02-编码规范 |
|
|
20
|
+
| 构建工具 | Vite 5.x | 通过 @shentu/cli 封装 |
|
|
21
|
+
| 路由管理 | React Router ^6.30.2 | - |
|
|
22
|
+
| 状态管理 | Zustand ^5.0.8 | Zustand(推荐)或 Redux,详见 07-状态管理 |
|
|
23
|
+
| 组件库 | Ant Design 6.1.0+ | 所有交互 UI 必须基于 Antd 二次封装 |
|
|
24
|
+
| 样式方案 | SCSS Modules, classnames | 强制使用,禁止全局样式 |
|
|
25
|
+
| HTTP 请求 | @koi-design/vix-tools (request) | 统一请求封装,详见 05-API规范 |
|
|
26
|
+
| 基础库 | @shentu/cli, @shentu/core | 脚手架与核心工具库 |
|
|
27
|
+
| Hooks 工具 | ahooks 3.9.6 | 编写或封装 hooks 时,优先考虑是否有可使用的 ahooks |
|
|
28
|
+
| 工具函数 | lodash-es 4.17.21 | 编写或封装 函数 时,优先考虑是否有可使用的 lodash 函数 |
|
|
29
|
+
| 时间工具 | dayjs 1.11.19 | 涉及日期时间的处理统一用 dayjs |
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: 项目的目录结构规范,定义了 src 目录下各目录的用途与约束(禁止新建非标准目录)。当需要确定代码应放在哪个目录时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 项目结构(NON-NEGOTIABLE)
|
|
7
|
+
|
|
8
|
+
## 目录结构
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
src/
|
|
12
|
+
├── api/ # 接口封装,按业务模块划分
|
|
13
|
+
├── assets/ # 静态资源,按模块分子目录(如 login/、icon/、common/)
|
|
14
|
+
├── components/ # 可复用 UI 组件
|
|
15
|
+
├── config/ # 配置文件(如 requestConfig.ts)
|
|
16
|
+
├── constants/ # 业务常量、枚举
|
|
17
|
+
├── hooks/ # 自定义 Hook
|
|
18
|
+
├── layouts/ # 布局组件(如 BasicLayout、BlankLayout)
|
|
19
|
+
├── libs/ # 独立封装模块(如 crypto、富文本适配等较重的功能模块)
|
|
20
|
+
├── mock/ # Mock 数据,按业务模块划分
|
|
21
|
+
├── pages/ # 页面视图
|
|
22
|
+
├── router/ # 路由配置与导航守卫(modules/ 按模块拆分)
|
|
23
|
+
├── store/ # 状态管理(Zustand 或 Redux,二选一)
|
|
24
|
+
│ └── modules/ # 按业务模块划分,每个模块含 index.ts + type.ts
|
|
25
|
+
├── styles/ # 全局样式、变量、mixins
|
|
26
|
+
├── types/ # 全局类型声明与 DTO
|
|
27
|
+
├── utils/ # 通用工具函数
|
|
28
|
+
└── 根级文件 # App.tsx / App.jsx、main.tsx / main.js 等(以仓库实际为准)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 结构约束(禁止在 src 下新建非标准目录)
|
|
32
|
+
|
|
33
|
+
| 类型 | 目录 | 规范 |
|
|
34
|
+
|------|------|------|
|
|
35
|
+
| 接口 | `src/api/` | 按模块划分,每个模块含请求函数;类型定义放 `src/api/types/` |
|
|
36
|
+
| 静态资源 | `src/assets/<module>/` | 按模块分子目录,如 `login/`、`icon/`、`common/` |
|
|
37
|
+
| 组件 | `src/components/` | 每个组件独立目录,导出到 `index.ts` |
|
|
38
|
+
| 配置 | `src/config/` | 配置文件,如 `requestConfig.ts` |
|
|
39
|
+
| 常量 | `src/constants/` | 按模块划分,所有模块导出到 `index.ts` |
|
|
40
|
+
| Hook | `src/hooks/` | 自定义 Hook,`useXxx.ts` 命名 |
|
|
41
|
+
| 布局 | `src/layouts/` | 布局组件(如 BasicLayout、BlankLayout),供路由配置引用 |
|
|
42
|
+
| 脚本模块 | `src/libs/` | 独立封装的较重功能模块,每个模块 `<lib-name>/index.ts` |
|
|
43
|
+
| Mock | `src/mock/` | Mock 数据,按业务模块划分 `<module>.ts` |
|
|
44
|
+
| 页面 | `src/pages/` | 每个页面独立目录,使用 `kebab-case` 命名 |
|
|
45
|
+
| 路由 | `src/router/modules/` | 按业务模块拆分路由配置,每个模块一个 `.ts` 文件 |
|
|
46
|
+
| 状态 | `src/store/modules/` | 按业务模块划分子目录,每个含 `index.ts` + `type.ts`(Zustand 暴露 `useXxxStore` / Redux 导出 reducer + actions) |
|
|
47
|
+
| 全局样式 | `src/styles/` | 全局样式、变量、mixins |
|
|
48
|
+
| 全局类型 | `src/types/` | 全局共享类型与 DTO,模块私有类型就近放置 |
|
|
49
|
+
| 工具 | `src/utils/` | 轻量工具函数,按功能模块划分,所有模块导出到 `index.ts` |
|
|
50
|
+
|
|
51
|
+
## 页面目录内的组件放置规则
|
|
52
|
+
|
|
53
|
+
页面专用组件放在 `src/pages/<page-name>/components/` 目录:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
src/pages/<page-name>/
|
|
57
|
+
├─ components/ # 仅供当前页面使用的子组件
|
|
58
|
+
│ └─ xxx/
|
|
59
|
+
│ ├─ index.tsx
|
|
60
|
+
│ └─ index.module.scss
|
|
61
|
+
├─ index.tsx # 页面主组件
|
|
62
|
+
└─ index.module.scss # 页面样式
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**判断标准**:
|
|
66
|
+
|
|
67
|
+
- 通用组件:多处复用、业务无关 → `src/components/`
|
|
68
|
+
- 页面级组件:仅单页使用 → 页面目录下的 `components/`
|
|
69
|
+
|
|
70
|
+
**约束**:`src/components/` 只存放通用组件,禁止将仅单页使用的组件放入。
|
|
71
|
+
|
|
72
|
+
## Mock 数据策略
|
|
73
|
+
|
|
74
|
+
当后端接口未完成时:
|
|
75
|
+
|
|
76
|
+
### 目录结构
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
src/
|
|
80
|
+
├─ mock/
|
|
81
|
+
│ └─ <module>.ts # mock 数据文件,按业务模块划分
|
|
82
|
+
├─ api/
|
|
83
|
+
│ └─ <module>.ts # 请求函数(调用 mock 数据或真实接口)
|
|
84
|
+
└─ types/
|
|
85
|
+
└─ <module>.ts # 全局类型定义
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 原则
|
|
89
|
+
|
|
90
|
+
1. Mock 数据:创建 `src/mock/<module>.ts`,存放模拟数据
|
|
91
|
+
2. 接口文件:创建 `src/api/<module>.ts`,包含请求函数(开发阶段可引用 mock)
|
|
92
|
+
3. 类型定义:使用 `src/types/<module>.ts`(单文件),不创建目录
|
|
93
|
+
4. 状态管理:不创建独立 store,必要时使用组件内 state
|
|
94
|
+
5. 优先级:UI 还原度优先于功能完整
|
|
95
|
+
|
|
96
|
+
### 禁止
|
|
97
|
+
|
|
98
|
+
- 禁止创建复杂的 mock 数据结构
|
|
99
|
+
- 禁止创建独立的 store(接口未完成时)
|
|
100
|
+
- 禁止预留过多扩展字段
|
|
101
|
+
|
|
102
|
+
## 脚本与入口扩展名
|
|
103
|
+
|
|
104
|
+
上表与目录树中的 `.ts`、`.tsx` 为 TypeScript 示例。**纯 JavaScript 项目**将对应文件改为 `.js` / `.jsx`。入口、路由、API、Mock、`types` 等路径须与 `src/` 实际一致;使用「初始化项目规范」技能时以扫描结果为准。
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
globs: ["**/*.tsx", "**/*.jsx", "**/components/**"]
|
|
4
|
+
description: 项目的组件规范,包括组件目录结构、SCSS Modules 使用、组件层级规划(通用 vs 页面级)。当创建、修改、重写、重构或拆分组件,或涉及 .tsx/.jsx 文件时读取此规则。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 组件规范
|
|
8
|
+
|
|
9
|
+
## 组件结构
|
|
10
|
+
|
|
11
|
+
- 组件目录在 `src/components` 下,每个组件单独一个目录
|
|
12
|
+
- 组件文件名为 `index.tsx`,样式文件为 `index.module.scss`
|
|
13
|
+
- 所有组件必须导入到 `src/components/index.ts` 中集中导出
|
|
14
|
+
- 组件必须使用 SCSS Modules,禁止使用全局样式
|
|
15
|
+
- 交互组件库二次封装必须使用 Ant Design 组件
|
|
16
|
+
- 组件必须使用清晰的 TS 类型定义,Props 接口必须明确
|
|
17
|
+
- 使用 `classnames` 负责动态 class 管理
|
|
18
|
+
|
|
19
|
+
如需查看创建组件的完整示例与拆分步骤,请使用技能文件:
|
|
20
|
+
|
|
21
|
+
- `.agents/skills/create-component/SKILL.md`
|
|
22
|
+
|
|
23
|
+
## 组件层级规划
|
|
24
|
+
|
|
25
|
+
- 单个 `.tsx` 文件建议不超过 400 行(作为拆分的参考阈值)
|
|
26
|
+
- 遵循单一职责原则,每个组件应有明确的职责边界
|
|
27
|
+
- **页面级组件**:仅在当前页面使用 → 放在 `src/pages/<page>/components/`
|
|
28
|
+
- **通用组件**:跨页面复用 → 提取到 `src/components/`
|
|
29
|
+
|
|
30
|
+
## 组件放置决策树
|
|
31
|
+
|
|
32
|
+
新增组件时,按以下流程判断放置位置:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
组件需要在多个页面使用吗?
|
|
36
|
+
├─ YES → 通用组件 → 放在 `src/components/<name>/`
|
|
37
|
+
└─ NO → 仅在单页使用 → 放在 `src/pages/<page>/components/<name>/`
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**示例**:
|
|
41
|
+
|
|
42
|
+
- `ErrorBoundary`(多处使用)→ `src/components/error-boundary/`
|
|
43
|
+
- `HomeHeader`(仅首页使用)→ `src/pages/home/components/header/`
|
|
44
|
+
- `CraftSheetCard`(仅工艺单页面使用)→ `src/pages/craft-sheet/components/craft-sheet-card/`
|
|
45
|
+
|
|
46
|
+
**约束**:`src/components/` 中的组件必须是真正通用的,业务耦合组件禁止放入。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: React 项目的 API 规范,包括接口目录结构、请求封装、函数命名约定、类型定义、错误处理原则。当新增、修改、重构或重写接口时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API 规范(React)
|
|
7
|
+
|
|
8
|
+
## 目录结构
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
src/
|
|
12
|
+
├── api/ # 接口请求函数
|
|
13
|
+
│ ├── login.ts
|
|
14
|
+
│ ├── order.ts
|
|
15
|
+
│ └── types/ # 请求/响应类型定义
|
|
16
|
+
│ ├── login.ts
|
|
17
|
+
│ └── order.ts
|
|
18
|
+
└── config/
|
|
19
|
+
└── requestConfig.ts # 请求全局配置
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- 所有接口请求函数集中在 `src/api/<name>.ts` 中,按业务模块拆分文件
|
|
23
|
+
- 请求/响应类型定义放在 `src/api/types/<name>.ts` 中
|
|
24
|
+
- 禁止在组件、页面、store 中直接调用 `request`,必须通过 `src/api/` 下的函数
|
|
25
|
+
|
|
26
|
+
## 接口请求规范
|
|
27
|
+
|
|
28
|
+
- 使用 `@koi-design/vix-tools` 的 `request` 发起请求
|
|
29
|
+
- 请求全局配置(超时、成功码、鉴权失败处理等)集中在 `src/config/requestConfig.ts`
|
|
30
|
+
- 应用入口通过 `request.init(requestConfig)` 完成初始化
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { request } from '@koi-design/vix-tools';
|
|
34
|
+
|
|
35
|
+
export function getOrderListApi(data: GetOrderListParams): Promise<GetOrderListResult> {
|
|
36
|
+
return request({
|
|
37
|
+
url: '/api/order/page',
|
|
38
|
+
method: 'post',
|
|
39
|
+
data,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
如需查看完整示例与落地步骤,请使用技能文件:
|
|
45
|
+
|
|
46
|
+
- `.agents/skills/create-api/SKILL.md`
|
|
47
|
+
|
|
48
|
+
## 接口函数命名(NON-NEGOTIABLE)
|
|
49
|
+
|
|
50
|
+
| 操作 | 命名规则 | 示例 |
|
|
51
|
+
|------|----------|------|
|
|
52
|
+
| 获取列表 | getXxxListApi | `getOrderListApi` |
|
|
53
|
+
| 获取详情 | getXxxDetailApi | `getOrderDetailApi` |
|
|
54
|
+
| 创建 | createXxxApi | `createOrderApi` |
|
|
55
|
+
| 更新 | updateXxxApi | `updateOrderApi` |
|
|
56
|
+
| 删除 | deleteXxxApi | `deleteOrderApi` |
|
|
57
|
+
|
|
58
|
+
- 统一使用 `Api` 后缀,区分接口函数与业务函数
|
|
59
|
+
- **禁止**使用 `fetch` 前缀或匈牙利命名法
|
|
60
|
+
|
|
61
|
+
## 接口错误处理(NON-NEGOTIABLE)
|
|
62
|
+
|
|
63
|
+
`requestConfig` 中的 `API_RESPONSE_TRANSFER_METHOD` 和 `API_RESPONSE_ERROR_METHOD` 已统一处理接口错误,业务代码中**禁止重复添加** `message.error` 等错误提示:
|
|
64
|
+
|
|
65
|
+
- 接口错误由请求配置统一处理,业务代码只需处理成功逻辑
|
|
66
|
+
- 前端表单验证错误和业务逻辑检查错误可以保留
|
|
67
|
+
- 成功提示可以保留(业务逻辑的成功反馈)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: 项目的路由规范,包括路由目录结构、模块配置、懒加载与路由集中管理原则。当新增、修改页面或配置路由时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 路由规范(NON-NEGOTIABLE)
|
|
7
|
+
|
|
8
|
+
## 路由结构
|
|
9
|
+
|
|
10
|
+
- 路由配置统一在 `src/router/` 目录下管理
|
|
11
|
+
- 页面组件统一在 `src/pages/` 目录下,使用 `kebab-case` 命名
|
|
12
|
+
- 路由按业务模块拆分到 `src/router/modules/` 目录
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
src/router/
|
|
16
|
+
├── index.ts # 创建路由实例、注册全局守卫
|
|
17
|
+
└── modules/ # 按业务模块拆分路由配置
|
|
18
|
+
├── dashboard.ts
|
|
19
|
+
├── user-manage.ts
|
|
20
|
+
└── settings.ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- 入口文件:`src/router/index.ts`
|
|
24
|
+
- 模块文件:`src/router/modules/<module-name>.ts`,文件名使用 `kebab-case`
|
|
25
|
+
|
|
26
|
+
## 懒加载(NON-NEGOTIABLE)
|
|
27
|
+
|
|
28
|
+
所有页面级路由必须使用 `React.lazy` 实现懒加载:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// src/router/modules/user-manage.ts
|
|
32
|
+
import { lazy } from 'react'
|
|
33
|
+
|
|
34
|
+
const UserManage = lazy(() => import('@/pages/user-manage'))
|
|
35
|
+
|
|
36
|
+
const routes = [
|
|
37
|
+
{
|
|
38
|
+
path: '/user-manage',
|
|
39
|
+
element: <UserManage />,
|
|
40
|
+
meta: { title: '用户管理', requiresAuth: true },
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
export default routes
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- 禁止在路由配置中静态导入页面组件
|
|
48
|
+
- 布局组件(`src/layouts/`)允许静态导入
|
|
49
|
+
|
|
50
|
+
## 路由与菜单规范(NON-NEGOTIABLE)
|
|
51
|
+
|
|
52
|
+
- **禁止多处维护路由**:路由配置集中在 `src/router/modules/` 管理,禁止散落在其他目录
|
|
53
|
+
- **避免重复注册**:同一页面组件只允许被一条路由引用
|
|
54
|
+
- **路由命名唯一**:每条路由的标识必须全局唯一
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
description: 项目的状态管理规范,支持 Zustand 或经典 Redux(二选一)。当新增、修改或重构状态管理时读取此规则。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 状态管理规范(NON-NEGOTIABLE)
|
|
7
|
+
|
|
8
|
+
## 基础规范
|
|
9
|
+
|
|
10
|
+
- 状态管理使用 **Zustand** 或 **经典 Redux**,同一项目**禁止混用**
|
|
11
|
+
- 所有 store 文件必须放在 `src/store/modules/` 目录下,按业务模块划分子目录
|
|
12
|
+
- **禁止在 `src` 下新建其他目录存放 store**
|
|
13
|
+
|
|
14
|
+
## 目录结构
|
|
15
|
+
|
|
16
|
+
无论使用哪种方案,模块化目录结构保持一致:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/store/
|
|
20
|
+
├── index.ts # Zustand: 统一导出 / Redux: createStore + combineReducers
|
|
21
|
+
└── modules/
|
|
22
|
+
├── user/
|
|
23
|
+
│ ├── index.ts # Zustand: useUserStore / Redux: reducer + action creators
|
|
24
|
+
│ └── type.ts # 类型定义
|
|
25
|
+
├── theme/
|
|
26
|
+
│ ├── index.ts
|
|
27
|
+
│ └── type.ts
|
|
28
|
+
└── ai-editor/
|
|
29
|
+
├── index.ts
|
|
30
|
+
└── type.ts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- 每个业务模块独立一个目录,目录名使用 `kebab-case`
|
|
34
|
+
- 目录内必须包含 `index.ts`(store / reducer 定义)和 `type.ts`(类型定义)
|
|
35
|
+
- `src/store/index.ts` 负责统一导出或创建 store 实例
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 方案 A:Zustand
|
|
40
|
+
|
|
41
|
+
### Store 编写规范
|
|
42
|
+
|
|
43
|
+
- 每个模块暴露 `useXxxStore` Hook
|
|
44
|
+
- Store 中不要直接耦合具体 UI 组件,只存纯数据与业务行为
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// src/store/modules/theme/type.ts
|
|
48
|
+
export enum ThemeMode {
|
|
49
|
+
LIGHT = 'light',
|
|
50
|
+
DARK = 'dark',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ThemeState {
|
|
54
|
+
theme: ThemeMode
|
|
55
|
+
setTheme: (theme: ThemeMode) => void
|
|
56
|
+
toggleTheme: () => void
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// src/store/modules/theme/index.ts
|
|
62
|
+
import { create } from 'zustand'
|
|
63
|
+
import { ThemeMode } from './type'
|
|
64
|
+
import type { ThemeState } from './type'
|
|
65
|
+
|
|
66
|
+
export const useThemeStore = create<ThemeState>((set) => ({
|
|
67
|
+
theme: ThemeMode.LIGHT,
|
|
68
|
+
setTheme: (theme) => set({ theme }),
|
|
69
|
+
toggleTheme: () =>
|
|
70
|
+
set((state) => ({
|
|
71
|
+
theme: state.theme === ThemeMode.LIGHT ? ThemeMode.DARK : ThemeMode.LIGHT,
|
|
72
|
+
})),
|
|
73
|
+
}))
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 持久化
|
|
77
|
+
|
|
78
|
+
当状态需要跨页面刷新保留时,使用 `zustand/middleware` 的 `persist`:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { create } from 'zustand'
|
|
82
|
+
import { persist } from 'zustand/middleware'
|
|
83
|
+
import type { ThemeState } from './type'
|
|
84
|
+
|
|
85
|
+
export const useThemeStore = create<ThemeState>()(
|
|
86
|
+
persist(
|
|
87
|
+
(set) => ({
|
|
88
|
+
theme: ThemeMode.LIGHT,
|
|
89
|
+
setTheme: (theme) => set({ theme }),
|
|
90
|
+
}),
|
|
91
|
+
{ name: 'app-theme' },
|
|
92
|
+
),
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 入口文件
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// src/store/index.ts
|
|
100
|
+
export { useThemeStore } from './modules/theme'
|
|
101
|
+
export { useUserStore } from './modules/user'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 组件中使用
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
const { theme, toggleTheme } = useThemeStore()
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 方案 B:经典 Redux
|
|
113
|
+
|
|
114
|
+
### Store 编写规范
|
|
115
|
+
|
|
116
|
+
- 每个模块默认导出 reducer,具名导出 action creators
|
|
117
|
+
- State 类型和 Action 类型统一放在 `type.ts`
|
|
118
|
+
- Action type 常量定义在 `type.ts` 中,使用 `模块名/动作名` 格式
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// src/store/modules/user/type.ts
|
|
122
|
+
export interface UserInfo {
|
|
123
|
+
id: string
|
|
124
|
+
name: string
|
|
125
|
+
avatar: string
|
|
126
|
+
roles: string[]
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface UserState {
|
|
130
|
+
userInfo: UserInfo | null
|
|
131
|
+
token: string
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const SET_USER = 'user/SET_USER'
|
|
135
|
+
export const SET_TOKEN = 'user/SET_TOKEN'
|
|
136
|
+
export const RESET_USER = 'user/RESET_USER'
|
|
137
|
+
|
|
138
|
+
export type UserAction =
|
|
139
|
+
| { type: typeof SET_USER; payload: UserInfo }
|
|
140
|
+
| { type: typeof SET_TOKEN; payload: string }
|
|
141
|
+
| { type: typeof RESET_USER }
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// src/store/modules/user/index.ts
|
|
146
|
+
import type { UserInfo, UserState, UserAction } from './type'
|
|
147
|
+
import { SET_USER, SET_TOKEN, RESET_USER } from './type'
|
|
148
|
+
|
|
149
|
+
const initialState: UserState = {
|
|
150
|
+
userInfo: null,
|
|
151
|
+
token: '',
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const setUser = (payload: UserInfo): UserAction => ({ type: SET_USER, payload })
|
|
155
|
+
export const setToken = (payload: string): UserAction => ({ type: SET_TOKEN, payload })
|
|
156
|
+
export const resetUser = (): UserAction => ({ type: RESET_USER })
|
|
157
|
+
|
|
158
|
+
export default function userReducer(state = initialState, action: UserAction): UserState {
|
|
159
|
+
switch (action.type) {
|
|
160
|
+
case SET_USER:
|
|
161
|
+
return { ...state, userInfo: action.payload }
|
|
162
|
+
case SET_TOKEN:
|
|
163
|
+
return { ...state, token: action.payload }
|
|
164
|
+
case RESET_USER:
|
|
165
|
+
return { ...state, userInfo: null, token: '' }
|
|
166
|
+
default:
|
|
167
|
+
return state
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 入口文件
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// src/store/index.ts
|
|
176
|
+
import { createStore, combineReducers } from 'redux'
|
|
177
|
+
import userReducer from './modules/user'
|
|
178
|
+
import themeReducer from './modules/theme'
|
|
179
|
+
|
|
180
|
+
const rootReducer = combineReducers({
|
|
181
|
+
user: userReducer,
|
|
182
|
+
theme: themeReducer,
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
export type RootState = ReturnType<typeof rootReducer>
|
|
186
|
+
export type AppDispatch = typeof store.dispatch
|
|
187
|
+
|
|
188
|
+
const store = createStore(rootReducer)
|
|
189
|
+
export default store
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 类型化 Hook
|
|
193
|
+
|
|
194
|
+
在 `src/hooks/` 下定义类型化的 `useAppSelector` 和 `useAppDispatch`,组件中统一使用:
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
// src/hooks/useRedux.ts
|
|
198
|
+
import { useSelector, useDispatch } from 'react-redux'
|
|
199
|
+
import type { TypedUseSelectorHook } from 'react-redux'
|
|
200
|
+
import type { RootState, AppDispatch } from '@/store'
|
|
201
|
+
|
|
202
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
|
|
203
|
+
export const useAppDispatch = () => useDispatch<AppDispatch>()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 组件中使用
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { useAppSelector, useAppDispatch } from '@/hooks/useRedux'
|
|
210
|
+
import { setUser } from '@/store/modules/user'
|
|
211
|
+
|
|
212
|
+
const userInfo = useAppSelector((state) => state.user.userInfo)
|
|
213
|
+
const dispatch = useAppDispatch()
|
|
214
|
+
|
|
215
|
+
dispatch(setUser({ id: '1', name: 'Admin', avatar: '', roles: ['admin'] }))
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 通用约束
|
|
221
|
+
|
|
222
|
+
- 按业务领域拆分,每个模块单独一个目录
|
|
223
|
+
- 禁止创建巨型 store / reducer,单个模块的 `index.ts` 不超过 **200 行**
|
|
224
|
+
- 模块之间禁止循环依赖
|
|
225
|
+
- 模块私有类型放在模块目录下的 `type.ts`,全局共享类型放在 `src/types/`
|
|
226
|
+
- Store 中不要直接耦合具体 UI 组件,只存纯数据与业务行为
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: false
|
|
3
|
+
globs: ["**/*.tsx", "**/*.jsx", "**/*.scss", "**/*.module.scss"]
|
|
4
|
+
description: 项目的样式规范,包括 SCSS Modules 使用、Ant Design 与自定义主题 CSS 变量。当编写、修改组件样式或主题适配,或涉及 .tsx/.jsx/.scss 文件时读取此规则。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 样式规范
|
|
8
|
+
|
|
9
|
+
## 基础原则
|
|
10
|
+
|
|
11
|
+
- 组件库使用 Ant Design
|
|
12
|
+
- 组件样式采用 SCSS Modules(`index.module.scss`)
|
|
13
|
+
- 全局样式(变量、reset、mixins)统一在 `src/styles/` 目录下定义,禁止在组件中使用无作用域的全局样式
|
|
14
|
+
- `classnames` 负责动态 class 管理
|
|
15
|
+
- UI 交互保持 Antd + 自研组件体验一致
|
|
16
|
+
|
|
17
|
+
## 主题色 CSS 变量(NON-NEGOTIABLE)
|
|
18
|
+
|
|
19
|
+
在未使用 Ant Design 组件的场景下,自定义样式**必须**使用主题色 CSS 变量,**严格禁止**硬编码颜色值:
|
|
20
|
+
|
|
21
|
+
- **Ant Design 变量**:`var(--ant-color-primary)`、`var(--ant-color-text)`、`var(--ant-color-bg-container)`、`var(--ant-color-border)`
|
|
22
|
+
- **自定义变量**:`var(--shentu-card-bg)`、`var(--shentu-border-radius)`、`var(--shentu-cn-family)`
|
|
23
|
+
|
|
24
|
+
确保自定义组件能够正确响应主题切换(浅色/暗色模式)。
|
|
25
|
+
|
|
26
|
+
如需了解主题变量的具体使用方式,请使用技能文件:
|
|
27
|
+
|
|
28
|
+
- `.agents/skills/theme-variables/SKILL.md`
|
|
29
|
+
|
|
30
|
+
## 设计稿颜色提取规范
|
|
31
|
+
|
|
32
|
+
### 常见颜色属性
|
|
33
|
+
|
|
34
|
+
| 属性 | 含义 | 示例 |
|
|
35
|
+
|------|------|------|
|
|
36
|
+
| `fill` | 背景色 | `"#13131c73"` |
|
|
37
|
+
| `stroke` | 边框色 | `"#5f50ffff"` |
|
|
38
|
+
| `opacity` | 透明度 | `0.5` |
|
|
39
|
+
|
|
40
|
+
### 特殊效果
|
|
41
|
+
|
|
42
|
+
| 属性 | 含义 | 提取方式 |
|
|
43
|
+
|------|------|----------|
|
|
44
|
+
| `background_blur` | 毛玻璃效果 | CSS `backdrop-filter: blur()` |
|
|
45
|
+
| `shadow` | 阴影效果 | CSS `box-shadow` |
|
|
46
|
+
| `cornerRadius` | 圆角 | CSS `border-radius` |
|
|
47
|
+
|
|
48
|
+
### 提取步骤
|
|
49
|
+
|
|
50
|
+
1. 定位目标元素(按钮、卡片等)
|
|
51
|
+
2. 查找 `fill` 属性获取背景色
|
|
52
|
+
3. 查找 `effect` 字段(模糊、阴影等)
|
|
53
|
+
4. 记录文字颜色(通常在 `children` 的 `text` 元素中)
|
|
54
|
+
|
|
55
|
+
### 示例
|
|
56
|
+
|
|
57
|
+
设计稿按钮:
|
|
58
|
+
```
|
|
59
|
+
"fill": "#13131c73",
|
|
60
|
+
"effect": {"type": "background_blur", "radius": 17.5}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
对应 CSS:
|
|
64
|
+
```scss
|
|
65
|
+
.button {
|
|
66
|
+
background-color: rgba(19, 19, 28, 0.45);
|
|
67
|
+
backdrop-filter: blur(17.5px);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**注意**:带有透明度的颜色需要转换为 RGBA 格式。例如 `#13131c73` 中 `73` 是透明度(十六进制),转换为十进制约 0.45。
|