reportify-cli 0.1.26__tar.gz → 0.1.28__tar.gz

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 (41) hide show
  1. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/PKG-INFO +1 -1
  2. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/pyproject.toml +1 -1
  3. reportify_cli-0.1.28/scripts/bump_version.sh +181 -0
  4. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/skills/reportify-agent/SKILL.md +1 -1
  5. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/skills/reportify-ai/references/API_REFERENCE.md +10 -4
  6. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/quant.py +1 -1
  7. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/stock.py +3 -0
  8. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/params.py +12 -5
  9. reportify_cli-0.1.26/scripts/bump_version.sh +0 -132
  10. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/.gitignore +0 -0
  11. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/Makefile +0 -0
  12. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/README.md +0 -0
  13. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/scripts/README.md +0 -0
  14. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/scripts/publish.sh +0 -0
  15. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/skills/reportify-ai/SKILL.md +0 -0
  16. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/skills/reportify-ai/references/COMMANDS.md +0 -0
  17. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/__init__.py +0 -0
  18. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/client.py +0 -0
  19. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/__init__.py +0 -0
  20. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/agent.py +0 -0
  21. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/channels.py +0 -0
  22. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/concepts.py +0 -0
  23. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/docs.py +0 -0
  24. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/following.py +0 -0
  25. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/kb.py +0 -0
  26. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/macro.py +0 -0
  27. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/search.py +0 -0
  28. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/timeline.py +0 -0
  29. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/commands/user.py +0 -0
  30. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/main.py +0 -0
  31. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/output.py +0 -0
  32. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/settings.py +0 -0
  33. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/src/utils.py +0 -0
  34. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/__init__.py +0 -0
  35. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/integration/test_docs_integration.py +0 -0
  36. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/integration/test_stock_integration.py +0 -0
  37. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/test_commands/__init__.py +0 -0
  38. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/test_commands/test_docs.py +0 -0
  39. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/test_commands/test_quant.py +0 -0
  40. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/tests/test_commands/test_search.py +0 -0
  41. {reportify_cli-0.1.26 → reportify_cli-0.1.28}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reportify-cli
3
- Version: 0.1.26
3
+ Version: 0.1.28
4
4
  Summary: CLI wrapper for Reportify SDK - Access Reportify API through command line
5
5
  Project-URL: Homepage, https://reportify.ai
6
6
  Project-URL: Documentation, https://docs.reportify.ai
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "reportify-cli"
3
- version = "0.1.26"
3
+ version = "0.1.28"
4
4
  description = "CLI wrapper for Reportify SDK - Access Reportify API through command line"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # 改为非严格模式,手动控制错误退出,便于调试
4
+ set -eo pipefail
5
+
6
+ # Colors for output
7
+ RED='\033[0;31m'
8
+ GREEN='\033[0;32m'
9
+ YELLOW='\033[1;33m'
10
+ BLUE='\033[0;34m'
11
+ NC='\033[0m' # No Color
12
+
13
+ # 错误处理函数
14
+ error_exit() {
15
+ echo -e "${RED}❌ $1${NC}"
16
+ exit 1
17
+ }
18
+
19
+ # Get the directory of this script
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
22
+
23
+ cd "$PROJECT_DIR/" || error_exit "Failed to enter project directory: $PROJECT_DIR"
24
+
25
+ echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
26
+ echo -e "${BLUE} Reportify CLI - Version Bump Script${NC}"
27
+ echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
28
+ echo ""
29
+
30
+ # Check if we're in the right directory
31
+ if [ ! -f "pyproject.toml" ]; then
32
+ error_exit "pyproject.toml not found. Are you in the right directory?"
33
+ fi
34
+
35
+ # Extract current version from pyproject.toml
36
+ CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
37
+ if [ -z "$CURRENT_VERSION" ]; then
38
+ error_exit "Failed to extract current version from pyproject.toml"
39
+ fi
40
+ echo -e "${YELLOW}Current version: ${CURRENT_VERSION}${NC}"
41
+ echo ""
42
+
43
+ # Parse version components
44
+ IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
45
+ if [ "${#VERSION_PARTS[@]}" -ne 3 ]; then
46
+ error_exit "Invalid version format: $CURRENT_VERSION (expected MAJOR.MINOR.PATCH)"
47
+ fi
48
+ MAJOR="${VERSION_PARTS[0]}"
49
+ MINOR="${VERSION_PARTS[1]}"
50
+ PATCH="${VERSION_PARTS[2]}"
51
+
52
+ # Determine bump type
53
+ BUMP_TYPE="${1:-patch}"
54
+ case "$BUMP_TYPE" in
55
+ major)
56
+ MAJOR=$((MAJOR + 1))
57
+ MINOR=0
58
+ PATCH=0
59
+ ;;
60
+ minor)
61
+ MINOR=$((MINOR + 1))
62
+ PATCH=0
63
+ ;;
64
+ patch)
65
+ PATCH=$((PATCH + 1))
66
+ ;;
67
+ *)
68
+ error_exit "Invalid bump type. Use 'major', 'minor', or 'patch'\nUsage: $0 [major|minor|patch]"
69
+ ;;
70
+ esac
71
+
72
+ NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
73
+ echo -e "${GREEN}New version: ${NEW_VERSION}${NC}"
74
+ echo ""
75
+
76
+ # ===================== 核心修复:先处理分支,再修改版本号 =====================
77
+ # 仅在CI环境下执行分支切换(避免本地运行时干扰)
78
+ if [ -n "${CI_COMMIT_REF_NAME}" ]; then
79
+ echo -e "${YELLOW}CI环境:先切换到目标分支并同步远程代码${NC}"
80
+
81
+ # 暂存当前所有修改(解决checkout时的文件覆盖问题)
82
+ git stash push -u -m "temp stash for version bump" || true
83
+
84
+ # 切换到目标分支
85
+ git checkout "${CI_COMMIT_REF_NAME}" || error_exit "Failed to checkout branch ${CI_COMMIT_REF_NAME}"
86
+
87
+ # 拉取远程最新版本(确保分支是最新的)
88
+ git fetch origin "${CI_COMMIT_REF_NAME}" || error_exit "Failed to fetch remote branch"
89
+ git reset --hard "origin/${CI_COMMIT_REF_NAME}" || error_exit "Failed to reset branch to remote latest"
90
+
91
+ # 恢复暂存的修改(但此时暂存的是旧版本的修改,后续会重新更新版本号)
92
+ git stash pop || true
93
+ fi
94
+
95
+ # ===================== 再更新版本号 =====================
96
+ # Update version in pyproject.toml
97
+ echo -e "${BLUE}Updating pyproject.toml...${NC}"
98
+ if [[ "$OSTYPE" == "darwin"* ]]; then
99
+ # macOS (sed requires empty -i flag)
100
+ sed -i '' "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml || error_exit "Failed to update pyproject.toml (macOS)"
101
+ else
102
+ # Linux
103
+ sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml || error_exit "Failed to update pyproject.toml (Linux)"
104
+ fi
105
+ echo -e "${GREEN}✓ Updated pyproject.toml${NC}"
106
+ echo ""
107
+
108
+ # Show the diff
109
+ echo -e "${BLUE}Changes:${NC}"
110
+ git diff pyproject.toml || true
111
+ echo ""
112
+
113
+ # 仅当 pyproject.toml 有变更时,执行提交推送逻辑
114
+ if [ -n "$(git status --porcelain pyproject.toml)" ]; then
115
+ echo -e "${YELLOW}Starting version commit & push...${NC}"
116
+
117
+ # 配置git信息(仅本地生效,避免污染全局)
118
+ git config --local user.name "GitLab Runner Bot"
119
+ git config --local user.email "gitlab-runner-arm@xiaobangtouzi.com"
120
+
121
+ # 更新远程仓库地址(带CI token认证)
122
+ if [ -n "${GITLAB_PUSHER_TOKEN}" ] && [ -n "${CI_SERVER_HOST}" ] && [ -n "${CI_PROJECT_PATH}" ]; then
123
+ git remote set-url origin "https://gitlab-ci-token:${GITLAB_PUSHER_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" || error_exit "Failed to set remote URL"
124
+ fi
125
+
126
+ # 同步远程代码(处理冲突)
127
+ echo -e "${YELLOW}Syncing remote code...${NC}"
128
+ git fetch origin "${CI_COMMIT_REF_NAME}" || error_exit "Failed to fetch remote branch"
129
+ if ! git merge "origin/${CI_COMMIT_REF_NAME}" --no-edit; then
130
+ echo -e "${RED}Merge conflict detected! Aborting...${NC}"
131
+ git merge --abort
132
+ error_exit "Please resolve conflicts manually and retry"
133
+ fi
134
+
135
+ # 仅添加版本文件,避免误提交其他变更
136
+ git add pyproject.toml || error_exit "Failed to add pyproject.toml"
137
+
138
+ # 检查是否有可提交的变更(避免无变更时commit失败)
139
+ if git diff --cached --quiet; then
140
+ echo -e "${YELLOW}⚠️ No changes to commit (pyproject.toml unchanged)${NC}"
141
+ exit 0
142
+ fi
143
+
144
+ # 提交变更(仅提交版本文件,不带-a避免误提交)
145
+ git commit -m "chore: bump version to ${NEW_VERSION} [ci skip]" || error_exit "Failed to commit changes"
146
+ echo -e "${GREEN}✓ Changes committed${NC}"
147
+ echo ""
148
+
149
+ # 推送变更(CI环境带ci.skip避免循环触发)
150
+ if [ -n "${CI_COMMIT_REF_NAME}" ]; then
151
+ git push origin -o ci.skip "${CI_COMMIT_REF_NAME}" || error_exit "Failed to push changes to remote"
152
+ echo -e "${GREEN}✓ Changes pushed to remote: ${CI_COMMIT_REF_NAME}${NC}"
153
+ else
154
+ # 非CI环境,提示手动推送
155
+ echo -e "${YELLOW}⚠️ Not in CI environment, skip push. Please push manually.${NC}"
156
+ fi
157
+ else
158
+ echo -e "${YELLOW}⚠️ No changes to pyproject.toml, skip commit & push${NC}"
159
+ fi
160
+
161
+ # 最终状态检查(友好提示,不强制退出)
162
+ if [ -n "$(git status --porcelain)" ]; then
163
+ echo -e "${YELLOW}⚠️ There are uncommitted changes (non-version files), please check${NC}"
164
+ git status --short
165
+ else
166
+ echo -e "${GREEN}✓ Working directory clean${NC}"
167
+ fi
168
+
169
+ echo ""
170
+ echo -e "${GREEN}═══════════════════════════════════════════════${NC}"
171
+ echo -e "${GREEN} ✓ Version Bumped Successfully!${NC}"
172
+ echo -e "${GREEN}═══════════════════════════════════════════════${NC}"
173
+ echo ""
174
+ echo -e "Old version: ${YELLOW}${CURRENT_VERSION}${NC}"
175
+ echo -e "New version: ${GREEN}${NEW_VERSION}${NC}"
176
+ echo ""
177
+ echo -e "Next steps:"
178
+ echo -e " 1. Run tests: ${YELLOW}make test${NC}"
179
+ echo -e " 2. Publish to test PyPI: ${YELLOW}./scripts/publish.sh test${NC}"
180
+ echo -e " 3. Publish to prod PyPI: ${YELLOW}./scripts/publish.sh prod${NC}"
181
+ echo ""
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: reportify-agent
3
- description: Delegate complex financial research and stock screening tasks to the Reportify Agent for autonomous execution. Use when the task requires multi-step analysis that cannot be completed with a single CLI command — such as earnings call transcript analysis across multiple quarters, complex stock screening with custom logic beyond formula expressions, or any research question that needs document retrieval + synthesis. Triggers include deep financial research questions, cross-quarter comparisons, screening with output to Excel, and questions about specific statements in earnings calls or FOMC meetings.
3
+ description: Delegate complex financial research and stock screening tasks to the Reportify Agent for autonomous execution. Use `$agent` (shortcut for `reportify-cli agent`) to interact. Use when the task requires multi-step analysis that cannot be completed with a single CLI command — such as earnings call transcript analysis across multiple quarters, complex stock screening with custom logic beyond formula expressions, or any research question that needs document retrieval + synthesis. Triggers include deep financial research questions, cross-quarter comparisons, screening with output to Excel, and questions about specific statements in earnings calls or FOMC meetings.
4
4
  ---
5
5
 
6
6
  # Reportify Agent
@@ -131,7 +131,7 @@ Stock symbols must use `market:ticker` format:
131
131
  ### stock overview
132
132
  | Parameter | Type | Required | Default | Description |
133
133
  |-----------|------|----------|---------|-------------|
134
- | `symbols` | string | | - | Stock symbols, comma-separated (e.g., "AAPL,00700,600519") |
134
+ | `symbols` | string | | - | Stock symbols, comma-separated (e.g., "AAPL,00700,600519"). Also accepts `symbol` for single stock |
135
135
  | `names` | string | | - | Stock names, comma-separated (e.g., "Tencent,Apple") |
136
136
 
137
137
  ### stock quote
@@ -269,16 +269,22 @@ Stock symbols must use `market:ticker` format:
269
269
  ### quant backtest
270
270
  | Parameter | Type | Required | Default | Description |
271
271
  |-----------|------|----------|---------|-------------|
272
- | `symbol` | str | ✓ | - | Stock symbol |
273
272
  | `start_date` | str | ✓ | - | Backtest start |
274
273
  | `end_date` | str | ✓ | - | Backtest end |
275
- | `entry_formula` | str | | - | Entry signal formula. Both sides of &/\|/AND/OR must be wrapped in () |
274
+ | `symbols` | list[str] | | - | Stock symbols (optional if filter_formula is provided) |
275
+ | `filter_formula` | str | | - | Pre-filter formula |
276
+ | `entry_formula` | str | | - | Entry signal formula. Both sides of &/\|/AND/OR must be wrapped in () |
277
+ | `strategy_code` | str | | - | Custom strategy python code |
276
278
  | `exit_formula` | str | | - | Exit signal formula. Both sides of &/\|/AND/OR must be wrapped in () |
277
279
  | `market` | str | | cn | Market |
278
280
  | `initial_cash` | float | | 100000 | Initial capital |
279
281
  | `commission` | float | | 0 | Commission rate |
280
282
  | `stop_loss` | float | | 0 | Stop loss % (0=disabled) |
281
- | `sizer_percent` | int | | 99 | Position size % |
283
+ | `position_size` | float | | 0.2 | Max position size ratio per stock (based on total assets) |
284
+ | `max_positions` | int | | 5 | Max number of holding stocks |
285
+ | `min_volume` | int | | 100 | Minimum trading volume |
286
+ | `auto_close` | bool | | true | Auto close positions |
287
+ | `indicator` | dict | | - | Indicator dict for returning values |
282
288
 
283
289
  ### quant factors_screen
284
290
  | Parameter | Type | Required | Default | Description |
@@ -172,7 +172,7 @@ def ohlcv_batch(
172
172
  epilog=generate_epilog(
173
173
  params.QUANT_BACKTEST_PARAMS,
174
174
  [
175
- 'reportify-cli quant backtest --input \'{"symbol": "000001", "start_date": "2023-01-01", "end_date": "2024-01-01", "entry_formula": "MA(CLOSE, 5) > MA(CLOSE, 20)"}\'',
175
+ 'reportify-cli quant backtest --input \'{"symbols": ["000001"], "start_date": "2023-01-01", "end_date": "2024-01-01", "entry_formula": "MA(CLOSE, 5) > MA(CLOSE, 20)"}\'',
176
176
  ],
177
177
  )
178
178
  )
@@ -28,6 +28,9 @@ def overview(
28
28
  """Get company overview: name, industry, main business"""
29
29
  try:
30
30
  params_dict = parse_json_input(input)
31
+ # Accept "symbol" as alias for "symbols"
32
+ if "symbol" in params_dict and "symbols" not in params_dict:
33
+ params_dict["symbols"] = params_dict.pop("symbol")
31
34
  client = get_client()
32
35
  result = client.stock.overview(**params_dict)
33
36
  format_output(result, format)
@@ -259,7 +259,7 @@ DOCS_DELETE_PARAMS = [
259
259
 
260
260
  # Stock module parameters
261
261
  STOCK_OVERVIEW_PARAMS = [
262
- ParamDef("symbols", "string", "Stock symbols, comma-separated, e.g. 'AAPL,00700'"),
262
+ ParamDef("symbols", "string", "Stock symbols, comma-separated, e.g. 'AAPL,00700' (also accepts 'symbol' for single stock)"),
263
263
  ParamDef("names", "string", "Stock names, comma-separated, e.g. 'Tencent,Apple'"),
264
264
  ]
265
265
 
@@ -472,13 +472,18 @@ QUANT_OHLCV_BATCH_PARAMS = [
472
472
  QUANT_BACKTEST_PARAMS = [
473
473
  ParamDef("start_date", "str", "Backtest start date (YYYY-MM-DD)", required=True),
474
474
  ParamDef("end_date", "str", "Backtest end date (YYYY-MM-DD)", required=True),
475
- ParamDef("symbol", "str", "Stock symbol", required=True),
475
+ ParamDef("symbols", "list[str]", "Stock symbols (optional if filter_formula is provided)"),
476
+ ParamDef("filter_formula", "str", "Pre-filter formula, e.g., 'NOT(IS_ST)'"),
476
477
  ParamDef("market", "str", "Market (cn/hk/us)", default="cn"),
477
478
  ParamDef(
478
479
  "entry_formula",
479
480
  "str",
480
481
  "Entry formula (result > 0 triggers buy), logical operators must be wrapped in ()",
481
- required=True,
482
+ ),
483
+ ParamDef(
484
+ "strategy_code",
485
+ "str",
486
+ "Custom backtest strategy Python code",
482
487
  ),
483
488
  ParamDef(
484
489
  "exit_formula",
@@ -488,9 +493,11 @@ QUANT_BACKTEST_PARAMS = [
488
493
  ParamDef("initial_cash", "float", "Initial capital", default=100000),
489
494
  ParamDef("commission", "float", "Commission rate", default=0),
490
495
  ParamDef("stop_loss", "float", "Stop loss ratio (0 to disable)", default=0),
491
- ParamDef("sizer_percent", "int", "Position size percentage", default=99),
496
+ ParamDef("position_size", "float", "Max position size ratio per stock based on total assets", default=0.2),
497
+ ParamDef("max_positions", "int", "Max number of holding stocks", default=5),
498
+ ParamDef("min_volume", "int", "Minimum trading volume", default=100),
492
499
  ParamDef("auto_close", "bool", "Auto close positions", default=True),
493
- ParamDef("labels", "dict[str, str]", "Label dict, returns extra indicator values"),
500
+ ParamDef("indicator", "dict[str, str]", "Indicator dict for custom strategy pre-computation or returning values"),
494
501
  ]
495
502
 
496
503
  QUANT_KLINE_1M_PARAMS = [
@@ -1,132 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- # Colors for output
6
- RED='\033[0;31m'
7
- GREEN='\033[0;32m'
8
- YELLOW='\033[1;33m'
9
- BLUE='\033[0;34m'
10
- NC='\033[0m' # No Color
11
-
12
- # Get the directory of this script
13
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14
- PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
15
-
16
- cd "$PROJECT_DIR/"
17
-
18
- echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
19
- echo -e "${BLUE} Reportify CLI - Version Bump Script${NC}"
20
- echo -e "${BLUE}═══════════════════════════════════════════════${NC}"
21
- echo ""
22
-
23
- # Check if we're in the right directory
24
- if [ ! -f "pyproject.toml" ]; then
25
- echo -e "${RED}Error: pyproject.toml not found. Are you in the right directory?${NC}"
26
- exit 1
27
- fi
28
-
29
- # Extract current version from pyproject.toml
30
- CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
31
- echo -e "${YELLOW}Current version: ${CURRENT_VERSION}${NC}"
32
- echo ""
33
-
34
- # Parse version components
35
- IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
36
- MAJOR="${VERSION_PARTS[0]}"
37
- MINOR="${VERSION_PARTS[1]}"
38
- PATCH="${VERSION_PARTS[2]}"
39
-
40
- # Determine bump type
41
- BUMP_TYPE="${1:-patch}"
42
-
43
- case "$BUMP_TYPE" in
44
- major)
45
- MAJOR=$((MAJOR + 1))
46
- MINOR=0
47
- PATCH=0
48
- ;;
49
- minor)
50
- MINOR=$((MINOR + 1))
51
- PATCH=0
52
- ;;
53
- patch)
54
- PATCH=$((PATCH + 1))
55
- ;;
56
- *)
57
- echo -e "${RED}Error: Invalid bump type. Use 'major', 'minor', or 'patch'${NC}"
58
- echo "Usage: $0 [major|minor|patch]"
59
- exit 1
60
- ;;
61
- esac
62
-
63
- NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
64
- echo -e "${GREEN}New version: ${NEW_VERSION}${NC}"
65
- echo ""
66
-
67
- # Confirm the change
68
- #read -p "Bump version from ${CURRENT_VERSION} to ${NEW_VERSION}? (y/n): " CONFIRM
69
- #if [ "$CONFIRM" != "y" ]; then
70
- # echo -e "${YELLOW}Version bump cancelled${NC}"
71
- # exit 0
72
- #fi
73
-
74
- # Update version in pyproject.toml
75
- echo -e "${BLUE}Updating pyproject.toml...${NC}"
76
- if [[ "$OSTYPE" == "darwin"* ]]; then
77
- # macOS
78
- sed -i '' "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml
79
- else
80
- # Linux
81
- sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml
82
- fi
83
- echo -e "${GREEN}✓ Updated pyproject.toml${NC}"
84
- echo ""
85
-
86
- # Show the diff
87
- echo -e "${BLUE}Changes:${NC}"
88
- git diff pyproject.toml
89
- echo ""
90
-
91
- # Ask if we should commit
92
-
93
- if [ -n "$(git status --porcelain)" ]; then
94
- echo -e "${RED}提交版本修改记录"
95
- # 配置git信息
96
- git config --global user.name "GitLab Runner Bot"
97
- git config --global user.email "gitlab-runner-arm@xiaobangtouzi.com"
98
- git remote set-url origin "https://gitlab-ci-token:${GITLAB_PUSHER_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
99
- # 推送代码前先同步一次代码
100
- echo -e "${YELLOW}同步代码"
101
- git pull origin HEAD:${CI_COMMIT_REF_NAME}
102
- # 提交和推送代码逻辑
103
- git add pyproject.toml
104
- git commit -am "chore: bump version to ${NEW_VERSION} [ci skip]"
105
- echo -e "${GREEN}✓ Changes committed${NC}"
106
- echo ""
107
- git push origin -o ci.skip HEAD:${CI_COMMIT_REF_NAME}
108
- echo -e "${GREEN}✓ Changes pushed to remote${NC}"
109
- fi
110
-
111
- if [ -n "$(git status --porcelain)" ]; then
112
- echo -e "${RED}Error: You have uncommitted changes. Please commit or stash them first.${NC}"
113
- git status --short
114
- exit 1
115
- else
116
- echo -e "${GREEN}✓ No uncommitted changes${NC}"
117
- fi
118
-
119
- echo ""
120
- echo -e "${GREEN}═══════════════════════════════════════════════${NC}"
121
- echo -e "${GREEN} ✓ Version Bumped Successfully!${NC}"
122
- echo -e "${GREEN}═══════════════════════════════════════════════${NC}"
123
- echo ""
124
- echo -e "Old version: ${YELLOW}${CURRENT_VERSION}${NC}"
125
- echo -e "New version: ${GREEN}${NEW_VERSION}${NC}"
126
- echo ""
127
- echo -e "Next steps:"
128
- echo -e " 1. Run tests: ${YELLOW}make test${NC}"
129
- echo -e " 2. Publish to test PyPI: ${YELLOW}./scripts/publish.sh test${NC}"
130
- echo -e " 3. Publish to prod PyPI: ${YELLOW}./scripts/publish.sh prod${NC}"
131
- echo ""
132
-
File without changes
File without changes
File without changes