create-dwy 0.5.0 → 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.
- package/bin/index.js +1 -1
- package/package.json +2 -2
- package/src/create.js +61 -37
- package/src/sync.js +213 -53
- package/templates/claude-global/CLAUDE.md +92 -0
- package/templates/claude-global/rules/dwy-android-core.md +610 -0
- package/templates/claude-global/rules/dwy-api-design.md +110 -0
- package/templates/claude-global/rules/dwy-db-migration.md +46 -0
- package/templates/claude-global/rules/dwy-flutter-core.md +564 -0
- package/templates/claude-global/rules/dwy-flutter-network.md +222 -0
- package/templates/claude-global/rules/dwy-flutter-router.md +97 -0
- package/templates/claude-global/rules/dwy-flutter-testing.md +94 -0
- package/templates/claude-global/rules/dwy-git-commit-convention.md +82 -0
- package/templates/claude-global/rules/dwy-git-security.md +53 -0
- package/templates/claude-global/rules/dwy-payload-limits.md +178 -0
- package/templates/claude-global/rules/{prefer-open-source.md → dwy-prefer-open-source.md} +4 -0
- package/templates/claude-global/rules/dwy-project-structure.md +181 -0
- package/templates/claude-global/rules/{python-code-style.md → dwy-python-core.md} +314 -357
- package/templates/claude-global/rules/dwy-python-fastapi.md +272 -0
- package/templates/claude-global/rules/dwy-python-orm.md +61 -0
- package/templates/claude-global/rules/{backend-security.md → dwy-python-security.md} +116 -79
- package/templates/claude-global/rules/dwy-python-testing.md +53 -0
- package/templates/claude-global/rules/{server-security.md → dwy-server-security.md} +1 -2
- package/templates/claude-global/rules/dwy-tdd-development.md +70 -0
- package/templates/claude-global/rules/dwy-tech-stack.md +60 -0
- package/templates/claude-global/rules/dwy-vue-api.md +146 -0
- package/templates/claude-global/rules/{vue-code-style.md → dwy-vue-core.md} +361 -152
- package/templates/claude-global/rules/dwy-vue-pinia.md +75 -0
- package/templates/claude-global/rules/dwy-vue-testing.md +102 -0
- package/templates/claude-global/settings.json +20 -0
- package/templates/claude-global/skills/dwy-deploy-audit/SKILL.md +481 -0
- package/templates/claude-global/skills/dwy-deploy-audit/references/checks-data.md +117 -0
- package/templates/claude-global/skills/dwy-deploy-audit/references/checks-network.md +74 -0
- package/templates/claude-global/skills/dwy-deploy-audit/references/checks-runtime.md +184 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_base.sh +39 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_capacity.sh +278 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_db.sh +122 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_docker.sh +249 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_env.sh +64 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_https.sh +60 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_logs.sh +209 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_nginx.sh +92 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_resilience.sh +157 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_secrets.sh +327 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_services.sh +77 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/check_ssh.sh +56 -0
- package/templates/claude-global/skills/dwy-deploy-audit/scripts/run_all.sh +105 -0
- package/templates/claude-global/skills/dwy-docker/SKILL.md +187 -0
- package/templates/claude-global/skills/dwy-docker/references/ask-templates.md +142 -0
- package/templates/claude-global/skills/dwy-docker/references/templates.md +479 -0
- package/templates/claude-global/skills/dwy-docker/references/version-rules.md +76 -0
- package/templates/claude-global/skills/dwy-docker/scripts/query_dockerhub.py +204 -0
- package/templates/claude-global/skills/dwy-docker/scripts/scan_images.sh +185 -0
- package/templates/claude-global/skills/dwy-eapi/SKILL.md +433 -0
- package/templates/claude-global/skills/dwy-eapi/references/tasks-integration-guide.md +387 -0
- package/templates/claude-global/skills/dwy-ekit/SKILL.md +85 -0
- package/templates/claude-global/skills/dwy-ekit/references/data.md +135 -0
- package/templates/claude-global/skills/dwy-ekit/references/form.md +68 -0
- package/templates/claude-global/skills/dwy-ekit/references/request.md +183 -0
- package/templates/claude-global/skills/dwy-ekit/references/ui.md +109 -0
- package/templates/claude-global/skills/{dwy-frontend-eui → dwy-eui}/SKILL.md +129 -15
- package/templates/claude-global/skills/dwy-eui/references/eui-design-guide.md +257 -0
- package/templates/claude-global/skills/dwy-eui/references/eui-integration-guide.md +302 -0
- package/templates/claude-global/skills/dwy-eui/references/eui-landing-design-guide.md +437 -0
- package/templates/claude-global/skills/dwy-fullstack-scaffold/SKILL.md +214 -0
- package/templates/claude-global/skills/dwy-mirror-source/SKILL.md +275 -0
- package/templates/claude-global/skills/dwy-mirror-source/references/dockerfile-snippets.md +228 -0
- package/templates/claude-global/skills/dwy-mirror-source/references/mirror-providers.md +150 -0
- package/templates/claude-global/skills/dwy-mirror-source/scripts/__pycache__/check_mirrors.cpython-313.pyc +0 -0
- package/templates/claude-global/skills/dwy-mirror-source/scripts/apply_mirrors.py +666 -0
- package/templates/claude-global/skills/dwy-mirror-source/scripts/check_mirrors.py +868 -0
- package/templates/claude-global/skills/dwy-pentest/SKILL.md +344 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__init__.py +1 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/__init__.cpython-311.pyc +0 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/config.cpython-311.pyc +0 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/executor.cpython-311.pyc +0 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/severity.cpython-311.pyc +0 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/__pycache__/validator.cpython-311.pyc +0 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/config.py +109 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/executor.py +157 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/severity.py +96 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/lib/validator.py +113 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_auth.py +289 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_recon.py +217 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_report.py +343 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_scan.py +205 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_ssl.py +208 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_vuln.py +205 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pentest_web.py +330 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/pyproject.toml +14 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/setup_tools.sh +97 -0
- package/templates/claude-global/skills/dwy-pentest/scripts/uv.lock +415 -0
- package/templates/claude-global/skills/dwy-publish/SKILL.md +135 -0
- package/templates/claude-global/skills/dwy-vue-core/SKILL.md +890 -0
- package/templates/project/backend/.dwy.hbs +5 -0
- package/templates/project/backend/.python-version +1 -0
- package/templates/project/backend/CLAUDE.md.hbs +40 -0
- package/templates/project/{web/backend → backend}/alembic/script.py.mako +2 -0
- package/templates/project/{web/backend → backend}/alembic.ini.hbs +0 -1
- package/templates/project/backend/deploy.sh.hbs +18 -0
- package/templates/project/{web → backend}/docker-compose.prod.yml.hbs +1 -1
- package/templates/project/{web/backend → backend}/pyproject.toml.hbs +4 -5
- package/templates/project/{web/backend → backend}/src/app/config.py.hbs +1 -1
- package/templates/project/backend/src/app/database.py +10 -0
- package/templates/project/backend/src/app/dependencies.py +5 -0
- package/templates/project/{web/backend → backend}/src/app/main.py.hbs +3 -3
- package/templates/project/backend/src/app/models/base.py +5 -0
- package/templates/project/web/CLAUDE.md.hbs +29 -36
- package/templates/project/web/{frontend → apps/web}/index.html.hbs +1 -0
- package/templates/project/web/{frontend → apps/web}/package.json.hbs +4 -3
- package/templates/project/web/apps/web/src/App.vue +9 -0
- package/templates/project/web/apps/web/src/api/client.ts +5 -0
- package/templates/project/web/apps/web/src/composables/.gitkeep +0 -0
- package/templates/project/web/apps/web/src/layouts/DefaultLayout.vue +8 -0
- package/templates/project/web/{frontend → apps/web}/src/router/index.ts +1 -1
- package/templates/project/web/{frontend → apps/web}/src/stores/auth.ts +4 -2
- package/templates/project/web/apps/web/src/style.css +2 -0
- package/templates/project/web/apps/web/src/types/router.d.ts +8 -0
- package/templates/project/web/apps/web/src/views/HomeView.vue +8 -0
- package/templates/project/web/apps/web/tsconfig.app.json +18 -0
- package/templates/project/web/apps/web/tsconfig.json +6 -0
- package/templates/project/web/{frontend → apps/web}/vite.config.ts.hbs +7 -1
- package/templates/project/web/package.json.hbs +16 -0
- package/templates/project/web/packages/.gitkeep +0 -0
- package/templates/project/web/pnpm-workspace.yaml +3 -0
- package/templates/claude-global/rules/agent-team-execution.md +0 -138
- package/templates/claude-global/rules/agent-team-patterns.md +0 -157
- package/templates/claude-global/rules/git-security.md +0 -144
- package/templates/claude-global/skills/dwy-auto-sync/SKILL.md +0 -52
- package/templates/claude-global/skills/dwy-backend-base/SKILL.md +0 -279
- package/templates/claude-global/skills/dwy-frontend-core/SKILL.md +0 -181
- package/templates/project/web/.claude/commands/deploy.md +0 -4
- package/templates/project/web/backend/src/app/models/base.py +0 -5
- package/templates/project/web/deploy.sh.hbs +0 -113
- package/templates/project/web/frontend/src/App.vue +0 -3
- package/templates/project/web/frontend/src/api/client.ts +0 -13
- package/templates/project/web/frontend/src/style.css +0 -1
- package/templates/project/web/frontend/src/views/HomeView.vue +0 -5
- package/templates/project/web/frontend/tsconfig.app.json +0 -14
- package/templates/project/web/frontend/tsconfig.json +0 -4
- /package/templates/{project/web/backend → claude-global/skills/dwy-pentest/scripts}/.python-version +0 -0
- /package/templates/project/{web/backend → backend}/Dockerfile +0 -0
- /package/templates/project/{web/backend → backend}/alembic/env.py.hbs +0 -0
- /package/templates/{claude-global/skills → project/backend/alembic/versions}/.gitkeep +0 -0
- /package/templates/project/{web → backend}/docker-compose.dev.yml.hbs +0 -0
- /package/templates/project/{web/backend → backend}/src/app/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/src/app/models/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/src/app/routers/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/src/app/routers/health.py +0 -0
- /package/templates/project/{web/backend → backend}/src/app/schemas/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/src/app/services/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/tests/__init__.py +0 -0
- /package/templates/project/{web/backend → backend}/tests/conftest.py.hbs +0 -0
- /package/templates/project/{web/backend/alembic/versions → mobile}/.gitkeep +0 -0
- /package/templates/project/web/{frontend → apps/web}/src/components/.gitkeep +0 -0
- /package/templates/project/web/{frontend → apps/web}/src/main.ts +0 -0
|
@@ -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)}
|
|
@@ -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"
|
|
@@ -4,15 +4,14 @@ version = "0.1.0"
|
|
|
4
4
|
description = "{{projectDescription}}"
|
|
5
5
|
requires-python = ">=3.11"
|
|
6
6
|
dependencies = [
|
|
7
|
-
"
|
|
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
|
-
|
|
15
|
-
"
|
|
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
|
-
|
|
51
|
+
dwyeapi = { index = "https://pypi.org/simple/" }
|
|
@@ -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)
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from collections.abc import AsyncGenerator
|
|
4
4
|
from contextlib import asynccontextmanager
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
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
|
|
|
@@ -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
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Backend
|
|
21
|
-
cd backend
|
|
22
|
-
uv run uvicorn app.main:app --reload --port 8000
|
|
8
|
+
# 安装依赖
|
|
9
|
+
pnpm install
|
|
23
10
|
|
|
24
|
-
#
|
|
25
|
-
cd frontend
|
|
11
|
+
# 开发
|
|
26
12
|
pnpm dev
|
|
27
|
-
```
|
|
28
13
|
|
|
29
|
-
|
|
14
|
+
# 构建
|
|
15
|
+
pnpm build
|
|
30
16
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
./deploy.sh --frontend # Frontend only
|
|
34
|
-
./deploy.sh --backend # Backend only
|
|
17
|
+
# 类型检查
|
|
18
|
+
pnpm typecheck
|
|
35
19
|
```
|
|
36
20
|
|
|
37
|
-
|
|
21
|
+
## Architecture
|
|
38
22
|
|
|
39
|
-
|
|
40
|
-
cd backend && uv run pytest tests/ -v
|
|
41
|
-
```
|
|
23
|
+
pnpm monorepo 前端项目,基于 Vue 3 + TypeScript。
|
|
42
24
|
|
|
43
|
-
|
|
25
|
+
| 目录 | 说明 |
|
|
26
|
+
|---|---|
|
|
27
|
+
| apps/web/ | 主应用 |
|
|
28
|
+
| packages/ | 共享包(按需添加) |
|
|
44
29
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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`
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{projectName}}
|
|
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
|
-
"@
|
|
13
|
-
"@
|
|
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",
|
|
File without changes
|
|
@@ -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,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
|
+
}
|
|
@@ -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: '
|
|
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
|
|
@@ -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 的失败结果,必须处理或报告
|