gitcode-cli 0.15.0__tar.gz → 0.17.0__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.
- {gitcode_cli-0.15.0/gitcode_cli.egg-info → gitcode_cli-0.17.0}/PKG-INFO +10 -10
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/README.md +9 -9
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gc_cli/__init__.py +1 -1
- gitcode_cli-0.17.0/gc_cli/bin/gc-darwin-amd64 +0 -0
- gitcode_cli-0.17.0/gc_cli/bin/gc-darwin-arm64 +0 -0
- gitcode_cli-0.15.0/gc_cli/bin/gc-darwin-arm64 → gitcode_cli-0.17.0/gc_cli/bin/gc-linux-amd64 +0 -0
- gitcode_cli-0.15.0/gc_cli/bin/gc-darwin-amd64 → gitcode_cli-0.17.0/gc_cli/bin/gc-linux-arm64 +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gc_cli/bin/gc-windows-amd64.exe +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0/gitcode_cli.egg-info}/PKG-INFO +10 -10
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gitcode_cli.egg-info/SOURCES.txt +1 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/pyproject.toml +1 -1
- gitcode_cli-0.17.0/tests/test_validate_ai_record.py +147 -0
- gitcode_cli-0.15.0/gc_cli/bin/gc-linux-amd64 +0 -0
- gitcode_cli-0.15.0/gc_cli/bin/gc-linux-arm64 +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/LICENSE +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/MANIFEST.in +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gc_cli/__main__.py +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gc_cli/bin/.gitkeep +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gc_cli/wrapper.py +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gitcode_cli.egg-info/dependency_links.txt +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gitcode_cli.egg-info/entry_points.txt +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/gitcode_cli.egg-info/top_level.txt +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/setup.cfg +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/tests/test_verify_remote_facts.py +0 -0
- {gitcode_cli-0.15.0 → gitcode_cli-0.17.0}/tests/test_wrapper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.0
|
|
4
4
|
Summary: GitCode CLI - Command line tool for GitCode
|
|
5
5
|
Author-email: GitCode CLI Contributors <support@gitcode.com>
|
|
6
6
|
Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
|
|
@@ -91,10 +91,10 @@ npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@lat
|
|
|
91
91
|
CI、审计或版本复现可固定版本:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.
|
|
94
|
+
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.17.0 install
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.
|
|
97
|
+
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.17.0 install`)
|
|
98
98
|
|
|
99
99
|
不要使用 `npm i atomgit-cli` 或 `npm install atomgit-cli` 安装全局 CLI;这两条命令只会把包加入当前项目的 `node_modules`,不会更新 PATH 中已有的 `gitcode`。需要由 npm global prefix 管理入口时,可改用:
|
|
100
100
|
|
|
@@ -149,10 +149,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
151
|
# 从 Releases 下载 .deb 包
|
|
152
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
152
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc_0.17.0_amd64.deb
|
|
153
153
|
|
|
154
154
|
# 安装
|
|
155
|
-
sudo dpkg -i gc_0.
|
|
155
|
+
sudo dpkg -i gc_0.17.0_amd64.deb
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -161,10 +161,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
# 从 Releases 下载 .rpm 包
|
|
164
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
164
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc-0.17.0-1.x86_64.rpm
|
|
165
165
|
|
|
166
166
|
# 安装
|
|
167
|
-
sudo rpm -i gc-0.
|
|
167
|
+
sudo rpm -i gc-0.17.0-1.x86_64.rpm
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -180,7 +180,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
180
180
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
181
181
|
|
|
182
182
|
# 安装(一行命令)
|
|
183
|
-
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
183
|
+
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gitcode_cli-0.17.0-py3-none-any.whl
|
|
184
184
|
|
|
185
185
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
186
186
|
gitcode version
|
|
@@ -210,7 +210,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
210
210
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
211
211
|
|
|
212
212
|
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
213
|
-
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.
|
|
213
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.17.0
|
|
214
214
|
|
|
215
215
|
# Windows PowerShell 中推荐使用 gitcode
|
|
216
216
|
gitcode version
|
|
@@ -349,7 +349,7 @@ gitcode auth login
|
|
|
349
349
|
|
|
350
350
|
说明:
|
|
351
351
|
- `gc auth login` 会将认证信息持久化到本地配置目录
|
|
352
|
-
-
|
|
352
|
+
- 默认主机 `gitcode.com` 下,如果设置了环境变量,环境变量会覆盖本地配置;非默认主机使用该主机本地配置
|
|
353
353
|
- `gc auth logout` 只清理本地配置,不会自动取消环境变量
|
|
354
354
|
- 详细规则见 [docs/AUTH.md](./docs/AUTH.md)
|
|
355
355
|
|
|
@@ -62,10 +62,10 @@ npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@lat
|
|
|
62
62
|
CI、审计或版本复现可固定版本:
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.
|
|
65
|
+
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.17.0 install
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.
|
|
68
|
+
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.17.0 install`)
|
|
69
69
|
|
|
70
70
|
不要使用 `npm i atomgit-cli` 或 `npm install atomgit-cli` 安装全局 CLI;这两条命令只会把包加入当前项目的 `node_modules`,不会更新 PATH 中已有的 `gitcode`。需要由 npm global prefix 管理入口时,可改用:
|
|
71
71
|
|
|
@@ -120,10 +120,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
122
|
# 从 Releases 下载 .deb 包
|
|
123
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
123
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc_0.17.0_amd64.deb
|
|
124
124
|
|
|
125
125
|
# 安装
|
|
126
|
-
sudo dpkg -i gc_0.
|
|
126
|
+
sudo dpkg -i gc_0.17.0_amd64.deb
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -132,10 +132,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
134
|
# 从 Releases 下载 .rpm 包
|
|
135
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
135
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc-0.17.0-1.x86_64.rpm
|
|
136
136
|
|
|
137
137
|
# 安装
|
|
138
|
-
sudo rpm -i gc-0.
|
|
138
|
+
sudo rpm -i gc-0.17.0-1.x86_64.rpm
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -151,7 +151,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
151
151
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
152
152
|
|
|
153
153
|
# 安装(一行命令)
|
|
154
|
-
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
154
|
+
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gitcode_cli-0.17.0-py3-none-any.whl
|
|
155
155
|
|
|
156
156
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
157
157
|
gitcode version
|
|
@@ -181,7 +181,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
181
181
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
182
182
|
|
|
183
183
|
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
184
|
-
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.
|
|
184
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.17.0
|
|
185
185
|
|
|
186
186
|
# Windows PowerShell 中推荐使用 gitcode
|
|
187
187
|
gitcode version
|
|
@@ -320,7 +320,7 @@ gitcode auth login
|
|
|
320
320
|
|
|
321
321
|
说明:
|
|
322
322
|
- `gc auth login` 会将认证信息持久化到本地配置目录
|
|
323
|
-
-
|
|
323
|
+
- 默认主机 `gitcode.com` 下,如果设置了环境变量,环境变量会覆盖本地配置;非默认主机使用该主机本地配置
|
|
324
324
|
- `gc auth logout` 只清理本地配置,不会自动取消环境变量
|
|
325
325
|
- 详细规则见 [docs/AUTH.md](./docs/AUTH.md)
|
|
326
326
|
|
|
Binary file
|
|
Binary file
|
gitcode_cli-0.15.0/gc_cli/bin/gc-darwin-arm64 → gitcode_cli-0.17.0/gc_cli/bin/gc-linux-amd64
RENAMED
|
Binary file
|
gitcode_cli-0.15.0/gc_cli/bin/gc-darwin-amd64 → gitcode_cli-0.17.0/gc_cli/bin/gc-linux-arm64
RENAMED
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.0
|
|
4
4
|
Summary: GitCode CLI - Command line tool for GitCode
|
|
5
5
|
Author-email: GitCode CLI Contributors <support@gitcode.com>
|
|
6
6
|
Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
|
|
@@ -91,10 +91,10 @@ npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@lat
|
|
|
91
91
|
CI、审计或版本复现可固定版本:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.
|
|
94
|
+
npx --yes --ignore-scripts --registry=https://registry.npmjs.org atomgit-cli@0.17.0 install
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.
|
|
97
|
+
(scoped 坐标锁定形式:`npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.17.0 install`)
|
|
98
98
|
|
|
99
99
|
不要使用 `npm i atomgit-cli` 或 `npm install atomgit-cli` 安装全局 CLI;这两条命令只会把包加入当前项目的 `node_modules`,不会更新 PATH 中已有的 `gitcode`。需要由 npm global prefix 管理入口时,可改用:
|
|
100
100
|
|
|
@@ -149,10 +149,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
151
|
# 从 Releases 下载 .deb 包
|
|
152
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
152
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc_0.17.0_amd64.deb
|
|
153
153
|
|
|
154
154
|
# 安装
|
|
155
|
-
sudo dpkg -i gc_0.
|
|
155
|
+
sudo dpkg -i gc_0.17.0_amd64.deb
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -161,10 +161,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
# 从 Releases 下载 .rpm 包
|
|
164
|
-
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
164
|
+
wget https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gc-0.17.0-1.x86_64.rpm
|
|
165
165
|
|
|
166
166
|
# 安装
|
|
167
|
-
sudo rpm -i gc-0.
|
|
167
|
+
sudo rpm -i gc-0.17.0-1.x86_64.rpm
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -180,7 +180,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
180
180
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
181
181
|
|
|
182
182
|
# 安装(一行命令)
|
|
183
|
-
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.
|
|
183
|
+
pip install https://gitcode.com/atomgit-cli/cli/releases/download/v0.17.0/gitcode_cli-0.17.0-py3-none-any.whl
|
|
184
184
|
|
|
185
185
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
186
186
|
gitcode version
|
|
@@ -210,7 +210,7 @@ source .venv/bin/activate # Linux/macOS
|
|
|
210
210
|
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
211
211
|
|
|
212
212
|
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
213
|
-
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.
|
|
213
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.17.0
|
|
214
214
|
|
|
215
215
|
# Windows PowerShell 中推荐使用 gitcode
|
|
216
216
|
gitcode version
|
|
@@ -349,7 +349,7 @@ gitcode auth login
|
|
|
349
349
|
|
|
350
350
|
说明:
|
|
351
351
|
- `gc auth login` 会将认证信息持久化到本地配置目录
|
|
352
|
-
-
|
|
352
|
+
- 默认主机 `gitcode.com` 下,如果设置了环境变量,环境变量会覆盖本地配置;非默认主机使用该主机本地配置
|
|
353
353
|
- `gc auth logout` 只清理本地配置,不会自动取消环境变量
|
|
354
354
|
- 详细规则见 [docs/AUTH.md](./docs/AUTH.md)
|
|
355
355
|
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import sys
|
|
3
|
+
import tempfile
|
|
4
|
+
import unittest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
# validate-ai-record.py has a hyphen in its name so it cannot be imported
|
|
8
|
+
# normally; load it via importlib (same pattern as test_verify_remote_facts).
|
|
9
|
+
_spec = importlib.util.spec_from_file_location(
|
|
10
|
+
"validate_ai_record",
|
|
11
|
+
Path(__file__).parent.parent / "scripts" / "validate-ai-record.py",
|
|
12
|
+
)
|
|
13
|
+
var = importlib.util.module_from_spec(_spec)
|
|
14
|
+
sys.modules["validate_ai_record"] = var
|
|
15
|
+
_spec.loader.exec_module(var)
|
|
16
|
+
|
|
17
|
+
TEMPLATES = Path(__file__).parent.parent / "docs" / "ai-templates"
|
|
18
|
+
|
|
19
|
+
FILLED_RECORD = """## 背景与证据
|
|
20
|
+
|
|
21
|
+
### 问题
|
|
22
|
+
|
|
23
|
+
真实问题。
|
|
24
|
+
|
|
25
|
+
### 证据
|
|
26
|
+
|
|
27
|
+
- pkg/foo/bar.go:42
|
|
28
|
+
|
|
29
|
+
## 改动建议
|
|
30
|
+
|
|
31
|
+
按 A 方案修复。
|
|
32
|
+
|
|
33
|
+
## 验收标准
|
|
34
|
+
|
|
35
|
+
输出与文档一致。
|
|
36
|
+
|
|
37
|
+
## 影响范围
|
|
38
|
+
|
|
39
|
+
pkg/foo/
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class SectionContentTests(unittest.TestCase):
|
|
44
|
+
"""record-mode section semantics for heading-style fields (issue 629).
|
|
45
|
+
|
|
46
|
+
These branches are exercised by CI only through this file: the make
|
|
47
|
+
targets run template mode, so a regression in section_content would
|
|
48
|
+
otherwise be completely silent.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
def test_body_returns_real_content_until_next_heading(self):
|
|
52
|
+
lines = ["## 一段", "", "真实内容", "## 二段", "其他"]
|
|
53
|
+
self.assertEqual(var.section_content(lines, "## 一段"), "真实内容")
|
|
54
|
+
|
|
55
|
+
def test_comments_do_not_count_as_content(self):
|
|
56
|
+
lines = ["## 一段", "<!-- guidance -->", ""]
|
|
57
|
+
self.assertEqual(var.section_content(lines, "## 一段"), "")
|
|
58
|
+
|
|
59
|
+
def test_whole_line_placeholder_does_not_count_as_content(self):
|
|
60
|
+
lines = ["## 一段", "(问题描述)"]
|
|
61
|
+
self.assertEqual(var.section_content(lines, "## 一段"), "")
|
|
62
|
+
|
|
63
|
+
def test_list_form_placeholder_does_not_count_as_content(self):
|
|
64
|
+
# The evidence section's placeholder ships as a list item; the
|
|
65
|
+
# placeholder rule must cover both shapes (fb27983).
|
|
66
|
+
lines = ["## 一段", "- (file:line / 命令输出 / 引用)"]
|
|
67
|
+
self.assertEqual(var.section_content(lines, "## 一段"), "")
|
|
68
|
+
|
|
69
|
+
def test_mixed_list_line_with_parenthetical_still_counts(self):
|
|
70
|
+
# Real evidence lines keep their content: only entire values wrapped
|
|
71
|
+
# in full-width parens are placeholders.
|
|
72
|
+
lines = ["## 一段", "- pkg/foo/bar.go:42(实证)"]
|
|
73
|
+
self.assertEqual(var.section_content(lines, "## 一段"), "- pkg/foo/bar.go:42(实证)")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ParseFieldsTests(unittest.TestCase):
|
|
77
|
+
def test_list_and_heading_fields_coexist(self):
|
|
78
|
+
lines = ["- 列表字段: 值", "## 标题字段", "- 另一列表: v"]
|
|
79
|
+
found = var.parse_fields(lines)
|
|
80
|
+
self.assertEqual(found["列表字段"], "值")
|
|
81
|
+
self.assertEqual(found["另一列表"], "v")
|
|
82
|
+
self.assertIn("## 标题字段", found)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ValidateRecordModeTests(unittest.TestCase):
|
|
86
|
+
def _validate(self, text: str, kind: str = "issue-create"):
|
|
87
|
+
with tempfile.NamedTemporaryFile(
|
|
88
|
+
"w", suffix=".md", delete=False, encoding="utf-8"
|
|
89
|
+
) as handle:
|
|
90
|
+
handle.write(text)
|
|
91
|
+
path = handle.name
|
|
92
|
+
try:
|
|
93
|
+
return var.validate(Path(path), kind, "record")
|
|
94
|
+
finally:
|
|
95
|
+
Path(path).unlink()
|
|
96
|
+
|
|
97
|
+
def test_filled_record_passes(self):
|
|
98
|
+
self.assertEqual(self._validate(FILLED_RECORD), [])
|
|
99
|
+
|
|
100
|
+
def test_emptied_section_is_reported(self):
|
|
101
|
+
broken = FILLED_RECORD.replace("按 A 方案修复。", "")
|
|
102
|
+
self.assertIn("empty value: ## 改动建议", self._validate(broken))
|
|
103
|
+
|
|
104
|
+
def test_comment_only_section_is_reported(self):
|
|
105
|
+
broken = FILLED_RECORD.replace(
|
|
106
|
+
"按 A 方案修复。", "<!-- guidance only -->"
|
|
107
|
+
)
|
|
108
|
+
self.assertIn("empty value: ## 改动建议", self._validate(broken))
|
|
109
|
+
|
|
110
|
+
def test_unreplaced_placeholder_is_reported(self):
|
|
111
|
+
broken = FILLED_RECORD.replace("按 A 方案修复。", "(待填)")
|
|
112
|
+
self.assertIn("empty value: ## 改动建议", self._validate(broken))
|
|
113
|
+
|
|
114
|
+
def test_mixed_draft_with_evidence_placeholder_is_reported(self):
|
|
115
|
+
# Every section filled except the evidence placeholder: the exact
|
|
116
|
+
# partial-draft bypass that three reviewers converged on.
|
|
117
|
+
broken = FILLED_RECORD.replace(
|
|
118
|
+
"- pkg/foo/bar.go:42", "- (file:line / 命令输出 / 引用)"
|
|
119
|
+
)
|
|
120
|
+
self.assertIn("empty value: ### 证据", self._validate(broken))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class AsShippedTemplateTests(unittest.TestCase):
|
|
124
|
+
"""The factory behaviour: templates as shipped must fail record mode,
|
|
125
|
+
matching the ten list-style kinds (whose empty fields always did)."""
|
|
126
|
+
|
|
127
|
+
def test_issue_create_template_as_shipped_fails_record(self):
|
|
128
|
+
errors = var.validate(
|
|
129
|
+
TEMPLATES / "issue-create.md", "issue-create", "record"
|
|
130
|
+
)
|
|
131
|
+
self.assertTrue(errors, "as-shipped template must not pass record mode")
|
|
132
|
+
|
|
133
|
+
def test_list_style_template_as_shipped_fails_record(self):
|
|
134
|
+
errors = var.validate(
|
|
135
|
+
TEMPLATES / "pr-self-check.md", "pr-self-check", "record"
|
|
136
|
+
)
|
|
137
|
+
self.assertTrue(errors, "as-shipped list template must not pass record mode")
|
|
138
|
+
|
|
139
|
+
def test_issue_create_template_passes_template_mode(self):
|
|
140
|
+
errors = var.validate(
|
|
141
|
+
TEMPLATES / "issue-create.md", "issue-create", "template"
|
|
142
|
+
)
|
|
143
|
+
self.assertEqual(errors, [])
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if __name__ == "__main__":
|
|
147
|
+
unittest.main()
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|