create-dwy 0.5.1 → 0.6.0

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.
Files changed (156) hide show
  1. package/bin/index.js +1 -1
  2. package/package.json +2 -2
  3. package/src/create.js +61 -37
  4. package/src/sync.js +212 -61
  5. package/templates/claude-global/CLAUDE.md +92 -0
  6. package/templates/claude-global/rules/dwy-android-core.md +610 -0
  7. package/templates/claude-global/rules/dwy-api-design.md +110 -0
  8. package/templates/claude-global/rules/dwy-db-migration.md +46 -0
  9. package/templates/claude-global/rules/dwy-flutter-core.md +564 -0
  10. package/templates/claude-global/rules/dwy-flutter-network.md +222 -0
  11. package/templates/claude-global/rules/dwy-flutter-router.md +97 -0
  12. package/templates/claude-global/rules/dwy-flutter-testing.md +94 -0
  13. package/templates/claude-global/rules/dwy-git-commit-convention.md +82 -0
  14. package/templates/claude-global/rules/dwy-git-security.md +53 -0
  15. package/templates/claude-global/rules/dwy-payload-limits.md +178 -0
  16. package/templates/claude-global/rules/{prefer-open-source.md → dwy-prefer-open-source.md} +4 -0
  17. package/templates/claude-global/rules/dwy-project-structure.md +181 -0
  18. package/templates/claude-global/rules/{python-code-style.md → dwy-python-core.md} +292 -358
  19. package/templates/claude-global/rules/dwy-python-fastapi.md +272 -0
  20. package/templates/claude-global/rules/dwy-python-orm.md +61 -0
  21. package/templates/claude-global/rules/{backend-security.md → dwy-python-security.md} +99 -72
  22. package/templates/claude-global/rules/dwy-python-testing.md +53 -0
  23. package/templates/claude-global/rules/{server-security.md → dwy-server-security.md} +1 -2
  24. package/templates/claude-global/rules/dwy-tdd-development.md +70 -0
  25. package/templates/claude-global/rules/dwy-tech-stack.md +60 -0
  26. package/templates/claude-global/rules/dwy-vue-api.md +146 -0
  27. package/templates/claude-global/rules/{vue-code-style.md → dwy-vue-core.md} +338 -152
  28. package/templates/claude-global/rules/dwy-vue-pinia.md +75 -0
  29. package/templates/claude-global/rules/dwy-vue-testing.md +102 -0
  30. package/templates/claude-global/skills/dwy-deploy-audit/SKILL.md +481 -0
  31. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-data.md +117 -0
  32. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-network.md +74 -0
  33. package/templates/claude-global/skills/dwy-deploy-audit/references/checks-runtime.md +184 -0
  34. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_base.sh +39 -0
  35. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_capacity.sh +278 -0
  36. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_db.sh +122 -0
  37. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_docker.sh +249 -0
  38. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_env.sh +64 -0
  39. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_https.sh +60 -0
  40. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_logs.sh +209 -0
  41. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_nginx.sh +92 -0
  42. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_resilience.sh +157 -0
  43. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_secrets.sh +327 -0
  44. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_services.sh +77 -0
  45. package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_ssh.sh +56 -0
  46. package/templates/claude-global/skills/dwy-deploy-audit/scripts/run_all.sh +105 -0
  47. package/templates/claude-global/skills/dwy-docker/SKILL.md +187 -0
  48. package/templates/claude-global/skills/dwy-docker/references/ask-templates.md +142 -0
  49. package/templates/claude-global/skills/dwy-docker/references/templates.md +479 -0
  50. package/templates/claude-global/skills/dwy-docker/references/version-rules.md +76 -0
  51. package/templates/claude-global/skills/dwy-docker/scripts/query_dockerhub.py +204 -0
  52. package/templates/claude-global/skills/dwy-docker/scripts/scan_images.sh +185 -0
  53. package/templates/claude-global/skills/dwy-eapi/SKILL.md +433 -0
  54. package/templates/claude-global/skills/dwy-eapi/references/tasks-integration-guide.md +387 -0
  55. package/templates/claude-global/skills/dwy-ekit/SKILL.md +85 -0
  56. package/templates/claude-global/skills/dwy-ekit/references/data.md +135 -0
  57. package/templates/claude-global/skills/dwy-ekit/references/form.md +68 -0
  58. package/templates/claude-global/skills/dwy-ekit/references/request.md +183 -0
  59. package/templates/claude-global/skills/dwy-ekit/references/ui.md +109 -0
  60. package/templates/claude-global/skills/{dwy-frontend-eui → dwy-eui}/SKILL.md +129 -15
  61. package/templates/claude-global/skills/dwy-eui/references/eui-design-guide.md +257 -0
  62. package/templates/claude-global/skills/dwy-eui/references/eui-integration-guide.md +302 -0
  63. package/templates/claude-global/skills/dwy-eui/references/eui-landing-design-guide.md +437 -0
  64. package/templates/claude-global/skills/dwy-fullstack-scaffold/SKILL.md +214 -0
  65. package/templates/claude-global/skills/dwy-mirror-source/SKILL.md +275 -0
  66. package/templates/claude-global/skills/dwy-mirror-source/references/dockerfile-snippets.md +228 -0
  67. package/templates/claude-global/skills/dwy-mirror-source/references/mirror-providers.md +150 -0
  68. package/templates/claude-global/skills/dwy-mirror-source/scripts/__pycache__/check_mirrors.cpython-313.pyc +0 -0
  69. package/templates/claude-global/skills/dwy-mirror-source/scripts/apply_mirrors.py +666 -0
  70. package/templates/claude-global/skills/dwy-mirror-source/scripts/check_mirrors.py +868 -0
  71. package/templates/claude-global/skills/dwy-pentest/SKILL.md +344 -0
  72. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__init__.py +1 -0
  73. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/__init__.cpython-311.pyc +0 -0
  74. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/config.cpython-311.pyc +0 -0
  75. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/executor.cpython-311.pyc +0 -0
  76. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/severity.cpython-311.pyc +0 -0
  77. package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/validator.cpython-311.pyc +0 -0
  78. package/templates/claude-global/skills/dwy-pentest/scripts/lib/config.py +109 -0
  79. package/templates/claude-global/skills/dwy-pentest/scripts/lib/executor.py +157 -0
  80. package/templates/claude-global/skills/dwy-pentest/scripts/lib/severity.py +96 -0
  81. package/templates/claude-global/skills/dwy-pentest/scripts/lib/validator.py +113 -0
  82. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_auth.py +289 -0
  83. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_recon.py +217 -0
  84. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_report.py +343 -0
  85. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_scan.py +205 -0
  86. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_ssl.py +208 -0
  87. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_vuln.py +205 -0
  88. package/templates/claude-global/skills/dwy-pentest/scripts/pentest_web.py +330 -0
  89. package/templates/claude-global/skills/dwy-pentest/scripts/pyproject.toml +14 -0
  90. package/templates/claude-global/skills/dwy-pentest/scripts/setup_tools.sh +97 -0
  91. package/templates/claude-global/skills/dwy-pentest/scripts/uv.lock +415 -0
  92. package/templates/claude-global/skills/{dwy-release → dwy-publish}/SKILL.md +42 -18
  93. package/templates/claude-global/skills/dwy-vue-core/SKILL.md +890 -0
  94. package/templates/project/backend/.dwy.hbs +5 -0
  95. package/templates/project/backend/.python-version +1 -0
  96. package/templates/project/backend/CLAUDE.md.hbs +40 -0
  97. package/templates/project/{web/backend → backend}/alembic/script.py.mako +2 -0
  98. package/templates/project/{web/backend → backend}/alembic.ini.hbs +0 -1
  99. package/templates/project/backend/deploy.sh.hbs +18 -0
  100. package/templates/project/{web → backend}/docker-compose.prod.yml.hbs +1 -1
  101. package/templates/project/{web/backend → backend}/pyproject.toml.hbs +4 -5
  102. package/templates/project/{web/backend → backend}/src/app/config.py.hbs +1 -1
  103. package/templates/project/backend/src/app/database.py +10 -0
  104. package/templates/project/backend/src/app/dependencies.py +5 -0
  105. package/templates/project/{web/backend → backend}/src/app/main.py.hbs +3 -3
  106. package/templates/project/backend/src/app/models/base.py +5 -0
  107. package/templates/project/web/CLAUDE.md.hbs +29 -36
  108. package/templates/project/web/{frontend → apps/web}/index.html.hbs +1 -0
  109. package/templates/project/web/{frontend → apps/web}/package.json.hbs +4 -3
  110. package/templates/project/web/apps/web/src/App.vue +9 -0
  111. package/templates/project/web/apps/web/src/api/client.ts +5 -0
  112. package/templates/project/web/apps/web/src/composables/.gitkeep +0 -0
  113. package/templates/project/web/apps/web/src/layouts/DefaultLayout.vue +8 -0
  114. package/templates/project/web/{frontend → apps/web}/src/router/index.ts +1 -1
  115. package/templates/project/web/{frontend → apps/web}/src/stores/auth.ts +4 -2
  116. package/templates/project/web/apps/web/src/style.css +2 -0
  117. package/templates/project/web/apps/web/src/types/router.d.ts +8 -0
  118. package/templates/project/web/apps/web/src/views/HomeView.vue +8 -0
  119. package/templates/project/web/apps/web/tsconfig.app.json +18 -0
  120. package/templates/project/web/apps/web/tsconfig.json +6 -0
  121. package/templates/project/web/{frontend → apps/web}/vite.config.ts.hbs +7 -1
  122. package/templates/project/web/package.json.hbs +16 -0
  123. package/templates/project/web/packages/.gitkeep +0 -0
  124. package/templates/project/web/pnpm-workspace.yaml +3 -0
  125. package/templates/claude-global/hooks/post-sync-claude-global.sh +0 -72
  126. package/templates/claude-global/rules/agent-team-execution.md +0 -138
  127. package/templates/claude-global/rules/agent-team-patterns.md +0 -157
  128. package/templates/claude-global/rules/git-commit-convention.md +0 -106
  129. package/templates/claude-global/rules/git-security.md +0 -144
  130. package/templates/claude-global/skills/dwy-backend-base/SKILL.md +0 -279
  131. package/templates/claude-global/skills/dwy-frontend-core/SKILL.md +0 -181
  132. package/templates/project/web/.claude/commands/deploy.md +0 -4
  133. package/templates/project/web/backend/src/app/models/base.py +0 -5
  134. package/templates/project/web/deploy.sh.hbs +0 -113
  135. package/templates/project/web/frontend/src/App.vue +0 -3
  136. package/templates/project/web/frontend/src/api/client.ts +0 -13
  137. package/templates/project/web/frontend/src/style.css +0 -1
  138. package/templates/project/web/frontend/src/views/HomeView.vue +0 -5
  139. package/templates/project/web/frontend/tsconfig.app.json +0 -14
  140. package/templates/project/web/frontend/tsconfig.json +0 -4
  141. /package/templates/{project/web/backend → claude-global/skills/dwy-pentest/scripts}/.python-version +0 -0
  142. /package/templates/project/{web/backend → backend}/Dockerfile +0 -0
  143. /package/templates/project/{web/backend → backend}/alembic/env.py.hbs +0 -0
  144. /package/templates/{claude-global/skills → project/backend/alembic/versions}/.gitkeep +0 -0
  145. /package/templates/project/{web → backend}/docker-compose.dev.yml.hbs +0 -0
  146. /package/templates/project/{web/backend → backend}/src/app/__init__.py +0 -0
  147. /package/templates/project/{web/backend → backend}/src/app/models/__init__.py +0 -0
  148. /package/templates/project/{web/backend → backend}/src/app/routers/__init__.py +0 -0
  149. /package/templates/project/{web/backend → backend}/src/app/routers/health.py +0 -0
  150. /package/templates/project/{web/backend → backend}/src/app/schemas/__init__.py +0 -0
  151. /package/templates/project/{web/backend → backend}/src/app/services/__init__.py +0 -0
  152. /package/templates/project/{web/backend → backend}/tests/__init__.py +0 -0
  153. /package/templates/project/{web/backend → backend}/tests/conftest.py.hbs +0 -0
  154. /package/templates/project/{web/backend/alembic/versions → mobile}/.gitkeep +0 -0
  155. /package/templates/project/web/{frontend → apps/web}/src/components/.gitkeep +0 -0
  156. /package/templates/project/web/{frontend → apps/web}/src/main.ts +0 -0
@@ -0,0 +1,5 @@
1
+ {
2
+ "template": "{{template}}",
3
+ "dwy_version": "{{dwyVersion}}",
4
+ "created_at": "{{createdAt}}"
5
+ }
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,40 @@
1
+ # {{projectName}}
2
+
3
+ {{projectDescription}}
4
+
5
+ ## Commands
6
+
7
+ ```bash
8
+ # 开发环境
9
+ docker compose -f docker-compose.dev.yml up -d # 启动 PostgreSQL + Redis
10
+ uv venv && uv pip install -e ".[dev]" # 安装依赖
11
+ uvicorn app.main:app --reload # 启动开发服务器
12
+
13
+ # 数据库迁移
14
+ alembic revision --autogenerate -m "描述" # 生成迁移
15
+ alembic upgrade head # 执行迁移
16
+
17
+ # 测试
18
+ pytest tests/ -v
19
+
20
+ # Lint
21
+ ruff check src/ && ruff format --check src/
22
+
23
+ # 部署
24
+ ./deploy.sh
25
+ ```
26
+
27
+ ## Architecture
28
+
29
+ FastAPI 后端服务,基于 dwyeapi 基础设施。
30
+
31
+ | 层 | 目录 | 职责 |
32
+ |---|---|---|
33
+ | routers | src/app/routers/ | 接收请求、调用 service、返回响应 |
34
+ | services | src/app/services/ | 业务逻辑 |
35
+ | models | src/app/models/ | ORM 模型 |
36
+ | schemas | src/app/schemas/ | Pydantic 请求/响应 |
37
+
38
+ ## Git Commit Scope
39
+
40
+ 本项目的 scope 枚举:`api` | `model` | `service` | `config`
@@ -3,6 +3,7 @@
3
3
  Revision ID: ${up_revision}
4
4
  Revises: ${down_revision | comma,n}
5
5
  Create Date: ${create_date}
6
+
6
7
  """
7
8
  from typing import Sequence, Union
8
9
 
@@ -10,6 +11,7 @@ from alembic import op
10
11
  import sqlalchemy as sa
11
12
  ${imports if imports else ""}
12
13
 
14
+ # revision identifiers, used by Alembic.
13
15
  revision: str = ${repr(up_revision)}
14
16
  down_revision: Union[str, None] = ${repr(down_revision)}
15
17
  branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
@@ -1,6 +1,5 @@
1
1
  [alembic]
2
2
  script_location = alembic
3
- sqlalchemy.url = driver://user:pass@localhost/dbname
4
3
 
5
4
  [loggers]
6
5
  keys = root,sqlalchemy,alembic
@@ -0,0 +1,18 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ PROJECT="{{projectName}}"
5
+ SSH_ALIAS="{{sshAlias}}"
6
+ REMOTE_DIR="/opt/$PROJECT"
7
+
8
+ echo "Deploying $PROJECT..."
9
+
10
+ git push origin master
11
+
12
+ ssh $SSH_ALIAS "cd $REMOTE_DIR && git pull"
13
+
14
+ ssh $SSH_ALIAS "cd $REMOTE_DIR && docker compose -f docker-compose.prod.yml exec backend alembic upgrade head"
15
+
16
+ ssh $SSH_ALIAS "cd $REMOTE_DIR && docker compose -f docker-compose.prod.yml up -d --build backend"
17
+
18
+ ssh $SSH_ALIAS "curl -sf http://127.0.0.1:{{backendPort}}/api/health" && echo "Deploy success" || echo "Health check failed"
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  backend:
3
- build: ./backend
3
+ build: .
4
4
  ports:
5
5
  - "127.0.0.1:{{backendPort}}:8000"
6
6
  env_file: .env
@@ -4,15 +4,14 @@ version = "0.1.0"
4
4
  description = "{{projectDescription}}"
5
5
  requires-python = ">=3.11"
6
6
  dependencies = [
7
- "danweiyuan-base>=0.1.0",
7
+ "dwyeapi>=0.2.0",
8
8
  "fastapi>=0.115.0",
9
9
  "uvicorn[standard]>=0.34.0",
10
10
  "sqlalchemy[asyncio]>=2.0.0",
11
11
  "asyncpg>=0.30.0",
12
- "pydantic-settings>=2.7.0",
13
12
  "alembic>=1.13.0",
14
- "python-jose[cryptography]>=3.3.0",
15
- "passlib[bcrypt]>=1.7.0",
13
+ # 需要异步任务处理时取消注释:
14
+ # "dwyeapi[tasks]>=0.2.0",
16
15
  ]
17
16
 
18
17
  [project.optional-dependencies]
@@ -49,4 +48,4 @@ index-url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
49
48
  extra-index-url = ["https://pypi.org/simple/"]
50
49
 
51
50
  [tool.uv.sources]
52
- danweiyuan-base = { index = "https://pypi.org/simple/" }
51
+ dwyeapi = { index = "https://pypi.org/simple/" }
@@ -1,6 +1,6 @@
1
1
  """{{projectName}} configuration."""
2
2
 
3
- from danweiyuan_base.config import BaseSettings
3
+ from dwyeapi.config import BaseSettings
4
4
 
5
5
 
6
6
  class Settings(BaseSettings):
@@ -0,0 +1,10 @@
1
+ """Database engine and session factory."""
2
+
3
+ from dwyeapi.database import create_async_engine_factory, create_session_factory
4
+ from dwyeapi.dependencies import create_get_db
5
+
6
+ from app.config import settings
7
+
8
+ engine = create_async_engine_factory(settings.database_url)
9
+ session_factory = create_session_factory(engine)
10
+ get_db = create_get_db(session_factory)
@@ -0,0 +1,5 @@
1
+ """FastAPI dependencies."""
2
+
3
+ from app.database import get_db
4
+
5
+ __all__ = ["get_db"]
@@ -3,9 +3,9 @@
3
3
  from collections.abc import AsyncGenerator
4
4
  from contextlib import asynccontextmanager
5
5
 
6
- from danweiyuan_base.cache import close_redis, configure
7
- from danweiyuan_base.database import create_async_engine_factory, create_session_factory
8
- from danweiyuan_base.exceptions import register_exception_handlers
6
+ from dwyeapi.cache import close_redis, configure
7
+ from dwyeapi.database import create_async_engine_factory, create_session_factory
8
+ from dwyeapi.exceptions import register_exception_handlers
9
9
  from fastapi import FastAPI
10
10
  from fastapi.middleware.cors import CORSMiddleware
11
11
 
@@ -0,0 +1,5 @@
1
+ """ORM model base — re-exports from dwyeapi."""
2
+
3
+ from dwyeapi.database import Base, TimestampMixin
4
+
5
+ __all__ = ["Base", "TimestampMixin"]
@@ -2,51 +2,44 @@
2
2
 
3
3
  {{projectDescription}}
4
4
 
5
- ## Tech Stack
6
-
7
- - Frontend: Vue 3 + TypeScript + Tailwind CSS 4 + Vite
8
- - Backend: Python 3.11 + FastAPI + SQLAlchemy 2.0 (async)
9
- - Database: PostgreSQL 16 + Redis 7
10
- - Shared: @danweiyuan/eui, @danweiyuan/core, danweiyuan-base
11
-
12
5
  ## Commands
13
6
 
14
- ### Development
15
-
16
7
  ```bash
17
- # Infrastructure
18
- docker compose -f docker-compose.dev.yml up -d
19
-
20
- # Backend
21
- cd backend
22
- uv run uvicorn app.main:app --reload --port 8000
8
+ # 安装依赖
9
+ pnpm install
23
10
 
24
- # Frontend
25
- cd frontend
11
+ # 开发
26
12
  pnpm dev
27
- ```
28
13
 
29
- ### Deploy
14
+ # 构建
15
+ pnpm build
30
16
 
31
- ```bash
32
- ./deploy.sh # Full deploy
33
- ./deploy.sh --frontend # Frontend only
34
- ./deploy.sh --backend # Backend only
17
+ # 类型检查
18
+ pnpm typecheck
35
19
  ```
36
20
 
37
- ### Test
21
+ ## Architecture
38
22
 
39
- ```bash
40
- cd backend && uv run pytest tests/ -v
41
- ```
23
+ pnpm monorepo 前端项目,基于 Vue 3 + TypeScript。
42
24
 
43
- ## Architecture
25
+ | 目录 | 说明 |
26
+ |---|---|
27
+ | apps/web/ | 主应用 |
28
+ | packages/ | 共享包(按需添加) |
44
29
 
45
- ```
46
- frontend/ → Vue 3 SPA
47
- backend/ → FastAPI (src/app/)
48
- routers/ → HTTP endpoints
49
- services/ → Business logic
50
- models/ → SQLAlchemy ORM
51
- schemas/ → Pydantic request/response
52
- ```
30
+ ### apps/web/ 结构
31
+
32
+ | 目录 | 说明 |
33
+ |---|---|
34
+ | views/ | 页面组件(一个路由对应一个文件) |
35
+ | components/ | 可复用业务组件 |
36
+ | composables/ | 组合式函数(use* 开头) |
37
+ | layouts/ | 布局组件 |
38
+ | stores/ | Pinia 状态管理 |
39
+ | router/ | Vue Router 配置 |
40
+ | api/ | API 请求模块 |
41
+ | types/ | 共享类型定义 |
42
+
43
+ ## Git Commit Scope
44
+
45
+ 本项目的 scope 枚举:`web` | `shared`
@@ -2,6 +2,7 @@
2
2
  <html lang="zh-CN">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
5
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
7
  <title>{{projectName}}</title>
7
8
  </head>
@@ -1,16 +1,17 @@
1
1
  {
2
- "name": "{{projectName}}-frontend",
2
+ "name": "@{{projectName}}/web",
3
3
  "private": true,
4
4
  "version": "0.0.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "vue-tsc -b && vite build",
9
+ "typecheck": "vue-tsc --noEmit",
9
10
  "preview": "vite preview"
10
11
  },
11
12
  "dependencies": {
12
- "@danweiyuan/core": "^0.1.0",
13
- "@danweiyuan/eui": "^0.2.0",
13
+ "@dwydev/ekit": "^0.2.1",
14
+ "@dwydev/eui": "^1.2.7",
14
15
  "axios": "^1.13.0",
15
16
  "lucide-vue-next": "^0.500.0",
16
17
  "pinia": "^3.0.0",
@@ -0,0 +1,9 @@
1
+ <script setup lang="ts">
2
+ import DefaultLayout from '@/layouts/DefaultLayout.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <DefaultLayout>
7
+ <router-view />
8
+ </DefaultLayout>
9
+ </template>
@@ -0,0 +1,5 @@
1
+ import { createRequest } from '@dwydev/ekit'
2
+
3
+ const request = createRequest({ baseURL: '/api' })
4
+
5
+ export default request
@@ -0,0 +1,8 @@
1
+ <script setup lang="ts">
2
+ </script>
3
+
4
+ <template>
5
+ <div class="min-h-screen bg-background text-foreground">
6
+ <slot />
7
+ </div>
8
+ </template>
@@ -6,7 +6,7 @@ const router = createRouter({
6
6
  {
7
7
  path: '/',
8
8
  name: 'home',
9
- component: () => import('../views/HomeView.vue'),
9
+ component: () => import('@/views/HomeView.vue'),
10
10
  },
11
11
  ],
12
12
  })
@@ -1,10 +1,12 @@
1
1
  import { defineStore } from 'pinia'
2
- import { ref } from 'vue'
2
+ import { computed, ref } from 'vue'
3
3
 
4
4
  export const useAuthStore = defineStore('auth', () => {
5
5
  const token = ref<string | null>(localStorage.getItem('token'))
6
6
  const user = ref<Record<string, unknown> | null>(null)
7
7
 
8
+ const isLoggedIn = computed(() => !!token.value)
9
+
8
10
  function setToken(t: string) {
9
11
  token.value = t
10
12
  localStorage.setItem('token', t)
@@ -16,5 +18,5 @@ export const useAuthStore = defineStore('auth', () => {
16
18
  localStorage.removeItem('token')
17
19
  }
18
20
 
19
- return { token, user, setToken, logout }
21
+ return { token, user, isLoggedIn, setToken, logout }
20
22
  })
@@ -0,0 +1,2 @@
1
+ @import "tailwindcss";
2
+ @import "@dwydev/eui/theme/tokens.css";
@@ -0,0 +1,8 @@
1
+ import 'vue-router'
2
+
3
+ declare module 'vue-router' {
4
+ interface RouteMeta {
5
+ requiresAuth?: boolean
6
+ title?: string
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ <script setup lang="ts">
2
+ </script>
3
+
4
+ <template>
5
+ <div class="flex items-center justify-center min-h-screen">
6
+ <h1 class="text-4xl font-bold">Welcome</h1>
7
+ </div>
8
+ </template>
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "moduleResolution": "bundler",
7
+ "strict": true,
8
+ "noUnusedLocals": true,
9
+ "noUnusedParameters": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "jsx": "preserve",
12
+ "paths": {
13
+ "@/*": ["./src/*"]
14
+ },
15
+ "types": ["vite/client"]
16
+ },
17
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
18
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" }
5
+ ]
6
+ }
@@ -1,14 +1,20 @@
1
+ import { fileURLToPath, URL } from 'node:url'
1
2
  import { defineConfig } from 'vite'
2
3
  import vue from '@vitejs/plugin-vue'
3
4
  import tailwindcss from '@tailwindcss/vite'
4
5
 
5
6
  export default defineConfig({
6
7
  plugins: [vue(), tailwindcss()],
8
+ resolve: {
9
+ alias: {
10
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
11
+ },
12
+ },
7
13
  server: {
8
14
  port: 5173,
9
15
  proxy: {
10
16
  '/api': {
11
- target: 'http://127.0.0.1:8000',
17
+ target: '{{apiProxy}}',
12
18
  changeOrigin: true,
13
19
  },
14
20
  },
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "pnpm -F @{{projectName}}/web dev",
8
+ "build": "pnpm -F @{{projectName}}/web build",
9
+ "typecheck": "pnpm -F @{{projectName}}/web typecheck",
10
+ "preview": "pnpm -F @{{projectName}}/web preview"
11
+ },
12
+ "engines": {
13
+ "node": ">=18",
14
+ "pnpm": ">=9"
15
+ }
16
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - 'apps/*'
3
+ - 'packages/*'
@@ -1,72 +0,0 @@
1
- #!/bin/bash
2
- # Claude Code PostToolUse Hook
3
- # 当 Edit/Write 修改了 claude-global 模板文件时,自动同步到 ~/.claude/
4
-
5
- # 快速路径检查:不含模板目录标记则直接退出
6
- TEMPLATE_MARKER="claude-cli/templates/claude-global/"
7
- echo "$TOOL_INPUT" | grep -q "$TEMPLATE_MARKER" || exit 0
8
-
9
- # 用 python3 提取 file_path 并执行同步
10
- python3 -c "
11
- import json, sys, os, shutil
12
-
13
- tool_input = os.environ.get('TOOL_INPUT', '')
14
- if not tool_input:
15
- sys.exit(0)
16
-
17
- try:
18
- data = json.loads(tool_input)
19
- except (json.JSONDecodeError, TypeError):
20
- sys.exit(0)
21
-
22
- file_path = data.get('file_path', '')
23
- marker = '$TEMPLATE_MARKER'
24
-
25
- if marker not in file_path:
26
- sys.exit(0)
27
-
28
- # 提取相对路径
29
- rel_path = file_path.split(marker, 1)[1]
30
- if not rel_path or '..' in rel_path:
31
- sys.exit(0)
32
-
33
- target_dir = os.path.expanduser('~/.claude')
34
- dest_path = os.path.join(target_dir, rel_path)
35
-
36
- # settings.json: 两层深合并
37
- if rel_path == 'settings.json':
38
- try:
39
- with open(file_path) as f:
40
- new_settings = json.load(f)
41
- except Exception:
42
- sys.exit(0)
43
-
44
- if os.path.exists(dest_path):
45
- try:
46
- with open(dest_path) as f:
47
- existing = json.load(f)
48
- except Exception:
49
- existing = {}
50
- # 两层深合并:顶层 merge + dict value 二级 merge
51
- merged = dict(existing)
52
- for key, value in new_settings.items():
53
- if key in merged and isinstance(merged[key], dict) and isinstance(value, dict):
54
- merged[key] = {**merged[key], **value}
55
- else:
56
- merged[key] = value
57
- else:
58
- os.makedirs(target_dir, exist_ok=True)
59
- merged = new_settings
60
-
61
- with open(dest_path, 'w') as f:
62
- json.dump(merged, f, indent=2, ensure_ascii=False)
63
- f.write('\n')
64
- print(f'[sync] Merged settings.json -> {dest_path}')
65
- else:
66
- # 其他文件:直接复制
67
- os.makedirs(os.path.dirname(dest_path), exist_ok=True)
68
- shutil.copy2(file_path, dest_path) # copy2 保留权限和时间戳
69
- print(f'[sync] Copied {rel_path} -> {dest_path}')
70
- "
71
-
72
- exit 0
@@ -1,138 +0,0 @@
1
- # Agent 团队并行执行规则
2
-
3
- 收到任务后,必须先评估是否可以通过 Agent 并行加速执行。这是强制检查,不可跳过。
4
-
5
- ## 一、可并行性评估
6
-
7
- 收到任务后立即判断:
8
-
9
- | 条件 | 判定 |
10
- |------|------|
11
- | 任务可拆为 2+ 个**无依赖**子任务 | → 任务级并行 |
12
- | 单个任务内有 2+ 个**独立步骤** | → 步骤级并行 |
13
- | 任务只有单一线性流程 | → 正常执行,不并行 |
14
-
15
- **核心原则:只有真正无依赖的工作才并行。** 如果子任务 B 需要子任务 A 的输出,它们必须串行。
16
-
17
- ## 二、风险分级与自主度
18
-
19
- 根据任务风险决定执行方式:
20
-
21
- ### 低风险 — 直接并行执行
22
-
23
- - 只读操作(代码研究、搜索、文档查阅)
24
- - 新建独立文件(写 demo、写测试、写新组件)
25
- - 独立的 lint / format / 类型检查
26
- - 查询外部文档或 API
27
-
28
- **执行方式:** 直接派 Agent 并行,完成后汇报结果。
29
-
30
- ### 中风险 — 确认后并行执行
31
-
32
- - 修改已有文件
33
- - 添加/升级依赖
34
- - 修改构建配置或路由配置
35
-
36
- **执行方式:** 先展示拆分计划(哪些 Agent、各做什么、修改哪些文件),用户确认后并行执行。
37
-
38
- ### 高风险 — 确认 + 强制 Review
39
-
40
- - 删除文件或代码
41
- - 修改核心模块(数据库/认证/路由守卫/支付)
42
- - 架构重构
43
- - 涉及 git 操作(rebase / merge / force push)
44
-
45
- **执行方式:** 展示详细计划 + 影响分析,用户确认后执行,完成后**必须**触发 review + auto-fix 闭环。
46
-
47
- ## 三、Agent 派遣协议
48
-
49
- ### 任务级并行
50
-
51
- 将大任务拆分为独立子任务,每个子任务派一个 Agent:
52
-
53
- 1. 识别独立子任务,创建 TaskCreate 追踪
54
- 2. 在**同一条消息**中派出所有 Agent(确保真正并行)
55
- 3. 每个 Agent 的 prompt 必须包含:完整的任务上下文、要操作的文件范围、相关的代码规范要求
56
- 4. 涉及文件修改的 Agent 使用 `isolation: "worktree"` 避免冲突
57
- 5. 所有 Agent 完成后汇总结果
58
-
59
- ### 步骤级并行
60
-
61
- 在单个任务执行中,将独立步骤并行化:
62
-
63
- 1. 识别当前步骤中哪些操作互不依赖
64
- 2. 在同一条消息中发起多个工具调用(Agent、Bash、Grep、Glob 等均可并行)
65
- 3. 等结果返回后再进入依赖这些结果的下一步
66
-
67
- ### Agent Prompt 要求
68
-
69
- 派遣 Agent 时,prompt 必须包含以下要素(不可省略):
70
-
71
- - **目标:** 这个 Agent 具体要完成什么
72
- - **上下文:** 为什么要做这件事,整体任务的背景
73
- - **范围:** 要操作的文件/目录,明确边界
74
- - **规范:** 需遵循的代码规范(引用具体规则文件或关键约束)
75
- - **产出:** 期望的输出形式(代码、报告、修复等)
76
-
77
- **禁止:** 写模糊的 prompt 如"基于你的研究结果实现它"。每个 Agent 的 prompt 必须自包含。
78
-
79
- ## 四、Review + Auto-Fix 闭环
80
-
81
- 所有并行 Agent 完成后,执行质量保障流程:
82
-
83
- ### 触发条件
84
-
85
- 以下情况**必须**触发 review 闭环:
86
-
87
- - 任何高风险任务完成后
88
- - 3 个或以上 Agent 并行修改代码后
89
- - 用户明确要求 review 时
90
-
91
- 以下情况**可跳过** review:
92
-
93
- - 纯只读研究任务
94
- - 单个低风险文件创建
95
-
96
- ### Review 流程
97
-
98
- ```
99
- Agent 完成 → code-reviewer Agent 审查 → 发现问题?
100
- ├─ 否 → 汇报结果,完成
101
- └─ 是 → 自动修复 → 再次 review → 通过?
102
- ├─ 否 → 报告给用户,人工介入
103
- └─ 是 → 汇报结果,完成
104
- ```
105
-
106
- 1. 启动 `superpowers:code-reviewer` Agent,审查所有变更
107
- 2. 如发现问题,直接修复(不需再次确认)
108
- 3. 修复后再次 review,最多循环 **2 轮**
109
- 4. 2 轮后仍有问题,向用户报告剩余问题,交由人工判断
110
-
111
- ### Review Agent 的 Prompt 要求
112
-
113
- - 说明本次变更的整体目标
114
- - 列出所有被修改/新建的文件
115
- - 引用相关的代码规范规则
116
- - 要求 review 聚焦:正确性、规范符合度、是否引入 bug
117
-
118
- ## 五、执行报告
119
-
120
- 并行任务全部完成后,向用户输出简洁的执行报告:
121
-
122
- ```
123
- ## 执行报告
124
- - **并行 Agent 数量:** N 个
125
- - **完成情况:** 全部完成 / X 个成功、Y 个失败
126
- - **Review 结果:** 通过 / 修复了 N 个问题
127
- - **变更文件:** 列出所有新建/修改的文件
128
- ```
129
-
130
- 仅在多 Agent 并行任务时输出报告,单 Agent 执行不需要。
131
-
132
- ## 六、禁止事项
133
-
134
- - **禁止**派 Agent 做需要用户交互的操作(如需要用户输入、选择)
135
- - **禁止**多个 Agent 修改同一个文件(必须用 worktree 隔离或拆分为串行)
136
- - **禁止**在 Agent prompt 中省略上下文让 Agent "自己去查"
137
- - **禁止**跳过风险评估直接并行执行
138
- - **禁止**忽略 Agent 的失败结果,必须处理或报告