diff --git a/README.md b/README.md index 94df9cd..561bb0c 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ AI 修改框架代码或文档时优先读: 框架本地开发: ```bash -./scripts/iti.sh install +./iti.sh install ``` Windows: ```bat -scripts\iti.cmd install +iti.cmd install ``` 业务项目依赖: @@ -66,7 +66,7 @@ app = create_app( 运行: ```bash -./scripts/iti.sh serve 8000 +./iti.sh serve 8000 ``` 该命令会启动框架最小应用,可用于验证 `/health`、`/ready`。 @@ -74,7 +74,7 @@ app = create_app( ## 业务项目生成 ```bash -./scripts/iti.sh make-app ../my-business-app my_business_app +./iti.sh make-app ../my-business-app my_business_app cd ../my-business-app ./app.sh init ./app.sh serve 8000 @@ -91,7 +91,7 @@ cd ../my-business-app 带 `iti-system`: ```bash -./scripts/iti.sh make-system-app ../my-system-app my_system_app +./iti.sh make-system-app ../my-system-app my_system_app cd ../my-system-app ./app.sh init-system ``` @@ -99,22 +99,22 @@ cd ../my-system-app 所有脚本都带中文 help: ```bash -./scripts/iti.sh help +./iti.sh help ./app.sh help ``` 发布框架: ```bash -./scripts/iti.sh release -./scripts/iti.sh release v0.2.2 +./iti.sh release +./iti.sh release v0.2.2 ``` Windows: ```bat -scripts\iti.cmd release -scripts\iti.cmd release v0.2.2 +iti.cmd release +iti.cmd release v0.2.2 ``` ## 文档 diff --git a/docs/COPIER_TEMPLATE.md b/docs/COPIER_TEMPLATE.md index 6517dc7..b33db63 100644 --- a/docs/COPIER_TEMPLATE.md +++ b/docs/COPIER_TEMPLATE.md @@ -23,7 +23,7 @@ copier-template/.codex/skills/{{ project_slug | lower | replace('_', '-') }}-pro ## 生成 ```bash -./scripts/iti.sh make-app ../my-business-app my_business_app +./iti.sh make-app ../my-business-app my_business_app cd ../my-business-app ./app.sh init ./app.sh serve 8000 @@ -32,7 +32,7 @@ cd ../my-business-app Windows: ```bat -scripts\iti.cmd make-app ..\my-business-app my_business_app +iti.cmd make-app ..\my-business-app my_business_app cd ..\my-business-app app.cmd init app.cmd serve 8000 diff --git a/docs/README.md b/docs/README.md index bd9ed91..7b512e6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,10 +16,10 @@ AI 修改框架时优先读 `.codex/skills/iti-flask-framework/SKILL.md`。 ## 命令 ```bash -./scripts/iti.sh install -./scripts/iti.sh test -./scripts/iti.sh check -./scripts/iti.sh make-app ../my-business-app my_business_app -./scripts/iti.sh make-system-app ../my-system-app my_system_app -./scripts/iti.sh release +./iti.sh install +./iti.sh test +./iti.sh check +./iti.sh make-app ../my-business-app my_business_app +./iti.sh make-system-app ../my-system-app my_system_app +./iti.sh release ``` diff --git a/iti.cmd b/iti.cmd new file mode 100644 index 0000000..6d40736 --- /dev/null +++ b/iti.cmd @@ -0,0 +1,6 @@ +@echo off +setlocal + +set "SCRIPT_DIR=%~dp0" +call "%SCRIPT_DIR%scripts\iti.cmd" %* +exit /b %ERRORLEVEL% diff --git a/iti.sh b/iti.sh new file mode 100644 index 0000000..ab14b12 --- /dev/null +++ b/iti.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +set -eu + +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +exec sh "$SCRIPT_DIR/scripts/iti.sh" "$@" diff --git a/scripts/iti.cmd b/scripts/iti.cmd index dacc8d1..e8750b5 100644 --- a/scripts/iti.cmd +++ b/scripts/iti.cmd @@ -40,7 +40,7 @@ goto help_error echo iTi-Flask 开发脚本 echo. echo 用法: -echo scripts\iti.cmd ^<命令^> [参数] +echo iti.cmd ^<命令^> [参数] echo. echo 常用命令: echo help 显示帮助 @@ -57,11 +57,11 @@ echo make-system-app ^<目录^> [包名] 生成带 iti-system 的业务项目 echo release [版本] 发布框架:测试、改版本、提交、打 tag、推送 echo. echo 示例: -echo scripts\iti.cmd install -echo scripts\iti.cmd test -echo scripts\iti.cmd serve 8000 -echo scripts\iti.cmd make-app ..\hsyh-erp hsyh_erp -echo scripts\iti.cmd make-system-app ..\hsyh-mes-phase2 hsyh_mes_phase2 +echo iti.cmd install +echo iti.cmd test +echo iti.cmd serve 8000 +echo iti.cmd make-app ..\hsyh-erp hsyh_erp +echo iti.cmd make-system-app ..\hsyh-mes-phase2 hsyh_mes_phase2 popd >nul exit /b 0 @@ -96,7 +96,7 @@ goto end :migration set "MESSAGE=%~1" if "%MESSAGE%"=="" ( - echo 缺少 migration 说明。示例:scripts\iti.cmd migration "alice add order table" 1>&2 + echo 缺少 migration 说明。示例:iti.cmd migration "alice add order table" 1>&2 exit /b 2 ) uv run alembic revision --autogenerate -m "%MESSAGE%" @@ -139,7 +139,7 @@ goto make_project set "TARGET=%~1" set "PACKAGE=%~2" if "%TARGET%"=="" ( - echo 缺少目标目录。示例:scripts\iti.cmd make-app ..\my-app my_app 1>&2 + echo 缺少目标目录。示例:iti.cmd make-app ..\my-app my_app 1>&2 exit /b 2 ) if "%PACKAGE%"=="" ( diff --git a/scripts/iti.sh b/scripts/iti.sh index cb671bd..83843f4 100644 --- a/scripts/iti.sh +++ b/scripts/iti.sh @@ -18,7 +18,7 @@ show_help() { iTi-Flask 开发脚本 用法: - ./scripts/iti.sh <命令> [参数] + ./iti.sh <命令> [参数] 常用命令: help 显示帮助 @@ -35,11 +35,11 @@ iTi-Flask 开发脚本 release [版本] 发布框架:测试、改版本、提交、打 tag、推送 示例: - ./scripts/iti.sh install - ./scripts/iti.sh test - ./scripts/iti.sh serve 8000 - ./scripts/iti.sh make-app ../hsyh-erp hsyh_erp - ./scripts/iti.sh make-system-app ../hsyh-mes-phase2 hsyh_mes_phase2 + ./iti.sh install + ./iti.sh test + ./iti.sh serve 8000 + ./iti.sh make-app ../hsyh-erp hsyh_erp + ./iti.sh make-system-app ../hsyh-mes-phase2 hsyh_mes_phase2 说明: - 默认生成项目使用 copier-template 里的 Git 依赖配置。 @@ -74,7 +74,7 @@ case "$command" in migration) message=${1:-} if [ -z "$message" ]; then - echo "缺少 migration 说明。示例:./scripts/iti.sh migration \"alice add order table\"" >&2 + echo "缺少 migration 说明。示例:./iti.sh migration \"alice add order table\"" >&2 exit 2 fi uv run alembic revision --autogenerate -m "$message" @@ -92,7 +92,7 @@ case "$command" in target=${1:-} package=${2:-} if [ -z "$target" ]; then - echo "缺少目标目录。示例:./scripts/iti.sh make-app ../my-app my_app" >&2 + echo "缺少目标目录。示例:./iti.sh make-app ../my-app my_app" >&2 exit 2 fi if [ -z "$package" ]; then diff --git a/scripts/release.sh b/scripts/release.sh index bd0ddee..936f278 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -47,13 +47,16 @@ bump_patch() { } version_is_newer() { - current_parts=$(parse_version "$1") + current_version=$1 + target_version=$2 + + current_parts=$(parse_version "$current_version") set -- $current_parts current_major=$1 current_minor=$2 current_patch=$3 - target_parts=$(parse_version "$2") + target_parts=$(parse_version "$target_version") set -- $target_parts target_major=$1 target_minor=$2