ohos-devloop 0.1.2__py3-none-any.whl
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.
- ohos_devloop/__init__.py +2 -0
- ohos_devloop/_version.py +24 -0
- ohos_devloop/agents/skills/collab-delegate/SKILL.md +79 -0
- ohos_devloop/agents/skills/loop-iterate/SKILL.md +54 -0
- ohos_devloop/agents/skills/openharmony-ci/SKILL.md +71 -0
- ohos_devloop/agents/skills/openharmony-ci/agents/openai.yaml +4 -0
- ohos_devloop/agents/skills/openharmony-ci/scripts/openharmony_ci.py +520 -0
- ohos_devloop/agents/skills/pool-status/SKILL.md +47 -0
- ohos_devloop/config/e2e-cases.yaml +31 -0
- ohos_devloop/config/e2e-hap.yaml +54 -0
- ohos_devloop/config/inventory-template.yaml +35 -0
- ohos_devloop/config/inventory.yaml +68 -0
- ohos_devloop/config/report-templates/analysis-report.md +48 -0
- ohos_devloop/config/report-templates/impl-report.md +47 -0
- ohos_devloop/config/task-template.md +21 -0
- ohos_devloop/config/tdd-board.yaml +31 -0
- ohos_devloop/config/tdd-coverage.yaml +47 -0
- ohos_devloop/config/tdd-emulator.yaml +36 -0
- ohos_devloop/config/tdd-host.yaml +26 -0
- ohos_devloop/config/tdd-suites.yaml +34 -0
- ohos_devloop/config/templates/agents-user.md +11 -0
- ohos_devloop/config/templates/quickstart.md +82 -0
- ohos_devloop/config/verify.yaml +45 -0
- ohos_devloop/examples/anchor-e2e.yaml +55 -0
- ohos_devloop/examples/assert-smoke.yaml +33 -0
- ohos_devloop/examples/diffcov-fixture/cov.json +6688 -0
- ohos_devloop/examples/diffcov-fixture/diff.txt +24 -0
- ohos_devloop/examples/diffcov-smoke.yaml +32 -0
- ohos_devloop/examples/e2e-emu-smoke.yaml +45 -0
- ohos_devloop/examples/layout-fixture.norm.json +1 -0
- ohos_devloop/examples/smoke.yaml +27 -0
- ohos_devloop/ohos_cli.py +131 -0
- ohos_devloop/scripts/agent-run-v3.sh +149 -0
- ohos_devloop/scripts/apply.py +1448 -0
- ohos_devloop/scripts/check_env.py +284 -0
- ohos_devloop/scripts/collab.py +303 -0
- ohos_devloop/scripts/diffcov.py +211 -0
- ohos_devloop/scripts/flash.py +511 -0
- ohos_devloop/scripts/mount_ws.py +192 -0
- ohos_devloop/scripts/release.py +2645 -0
- ohos_devloop/scripts/release_audit.py +260 -0
- ohos_devloop/scripts/release_metadata.py +397 -0
- ohos_devloop/scripts/release_smoke.py +287 -0
- ohos_devloop/scripts/report_draft.py +234 -0
- ohos_devloop/scripts/server_init.py +310 -0
- ohos_devloop/scripts/sgrep.py +82 -0
- ohos_devloop/scripts/sign_hap.py +256 -0
- ohos_devloop/scripts/telemetry.py +260 -0
- ohos_devloop/scripts/ui_probe.py +396 -0
- ohos_devloop/scripts/verify_frame_diff.py +138 -0
- ohos_devloop/scripts/ws_init.py +131 -0
- ohos_devloop/scripts/wsroot.py +192 -0
- ohos_devloop-0.1.2.dist-info/METADATA +177 -0
- ohos_devloop-0.1.2.dist-info/RECORD +58 -0
- ohos_devloop-0.1.2.dist-info/WHEEL +5 -0
- ohos_devloop-0.1.2.dist-info/entry_points.txt +2 -0
- ohos_devloop-0.1.2.dist-info/licenses/LICENSE +202 -0
- ohos_devloop-0.1.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""帧差突变标记管线 — 提升 AI 验收准确率的本地工具。
|
|
3
|
+
|
|
4
|
+
原理:瞬态缺陷(如占位壳 1 帧残影)无法靠均匀抽样捕获(0.4s 截图命中率 <15%)。
|
|
5
|
+
本管线对帧序列做全量扫描:计算每帧在关注区域内的"占位特征像素数"(红色文字)
|
|
6
|
+
与相邻帧差,自动标记所有突变事件帧,供 AI 定向审查 —— 覆盖从"随机命中"到
|
|
7
|
+
"穷尽突变"。
|
|
8
|
+
|
|
9
|
+
用法:
|
|
10
|
+
python scripts/verify_frame_diff.py <frames_dir> [--out-dir <dir>]
|
|
11
|
+
frames_dir 内按字典序命名的帧图(png/jpeg,任意帧率来源均可:视频抽帧/连拍)。
|
|
12
|
+
--region y1,y2 关注区域(默认 240,1060 = 列表区)
|
|
13
|
+
--red-hue 占位特征色阈值(默认检测红/橙文字像素)
|
|
14
|
+
--contact 输出接触表(突变帧拼贴)路径,默认 <out-dir>/contact_sheet.png
|
|
15
|
+
--video <mp4> 若给出,先用 ffmpeg 抽全帧到临时目录再分析(需本机 ffmpeg)
|
|
16
|
+
|
|
17
|
+
输出: <out-dir>/flags.txt(每行: 帧号 红像素数 帧差 事件类型)+ 接触表。
|
|
18
|
+
|
|
19
|
+
事件分类:
|
|
20
|
+
appear : 红像素从无到有(壳挂载)
|
|
21
|
+
vanish : 红像素从有到无(壳退役/替换完成)
|
|
22
|
+
move : 红像素显著位移/倍增(壳位置突变 = 叠画/堆叠候选)
|
|
23
|
+
判定阈值基于同类测试校准(load=5 用例红壳约 200-300px² 每壳)。
|
|
24
|
+
"""
|
|
25
|
+
import argparse
|
|
26
|
+
import math
|
|
27
|
+
import os
|
|
28
|
+
import subprocess
|
|
29
|
+
import sys
|
|
30
|
+
import tempfile
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
from PIL import Image
|
|
34
|
+
except ImportError:
|
|
35
|
+
sys.exit("需要 Pillow: python -m pip install Pillow")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def extract_frames(video: str, out_dir: str) -> list:
|
|
39
|
+
"""ffmpeg 抽全帧到 out_dir,返回帧文件列表。"""
|
|
40
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
41
|
+
pat = os.path.join(out_dir, "f_%05d.png")
|
|
42
|
+
subprocess.run(["ffmpeg", "-y", "-i", video, "-vsync", "0", pat],
|
|
43
|
+
check=True, capture_output=True)
|
|
44
|
+
return sorted(os.listdir(out_dir))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def red_pixel_count(img: Image.Image, y1: int, y2: int) -> int:
|
|
48
|
+
"""关注区域内近似"占位红色文字"的像素数(R 显著高于 G/B 且 R 够亮)。"""
|
|
49
|
+
w, h = img.size
|
|
50
|
+
y1 = max(0, min(y1, h))
|
|
51
|
+
y2 = max(y1, min(y2, h))
|
|
52
|
+
region = img.crop((0, y1, w, y2)).convert("RGB")
|
|
53
|
+
px = region.load()
|
|
54
|
+
cnt = 0
|
|
55
|
+
for yy in range(region.size[1]):
|
|
56
|
+
for xx in range(region.size[0]):
|
|
57
|
+
r, g, b = px[xx, yy]
|
|
58
|
+
if r > 150 and r > g * 1.6 and r > b * 1.6:
|
|
59
|
+
cnt += 1
|
|
60
|
+
return cnt
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def frame_diff(a: Image.Image, b: Image.Image, y1: int, y2: int) -> float:
|
|
64
|
+
"""关注区域两帧差(归一化 0-1)。"""
|
|
65
|
+
wa, ha = a.size
|
|
66
|
+
ra = a.crop((0, y1, wa, y2)).convert("L").resize((180, 90))
|
|
67
|
+
rb = b.crop((0, y1, wa, y2)).convert("L").resize((180, 90))
|
|
68
|
+
pa, pb = ra.load(), rb.load()
|
|
69
|
+
total = 0
|
|
70
|
+
n = 0
|
|
71
|
+
for yy in range(90):
|
|
72
|
+
for xx in range(180):
|
|
73
|
+
total += abs(pa[xx, yy] - pb[xx, yy])
|
|
74
|
+
n += 1
|
|
75
|
+
return total / (n * 255.0)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def main():
|
|
79
|
+
ap = argparse.ArgumentParser()
|
|
80
|
+
ap.add_argument("frames_dir")
|
|
81
|
+
ap.add_argument("--region", default="240,1060")
|
|
82
|
+
ap.add_argument("--contact", default=None)
|
|
83
|
+
ap.add_argument("--video", default=None)
|
|
84
|
+
args = ap.parse_args()
|
|
85
|
+
|
|
86
|
+
y1, y2 = [int(v) for v in args.region.split(",")]
|
|
87
|
+
work = args.frames_dir
|
|
88
|
+
if args.video:
|
|
89
|
+
work = tempfile.mkdtemp(prefix="vf_frames_")
|
|
90
|
+
extract_frames(args.video, work)
|
|
91
|
+
|
|
92
|
+
names = sorted(n for n in os.listdir(work)
|
|
93
|
+
if n.lower().endswith((".png", ".jpg", ".jpeg")))
|
|
94
|
+
if not names:
|
|
95
|
+
sys.exit("目录内无帧图")
|
|
96
|
+
out_dir = args.contact and os.path.dirname(args.contact) or work
|
|
97
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
98
|
+
|
|
99
|
+
prev_img = None
|
|
100
|
+
prev_red = -1
|
|
101
|
+
flags = []
|
|
102
|
+
reds = []
|
|
103
|
+
for i, name in enumerate(names):
|
|
104
|
+
img = Image.open(os.path.join(work, name))
|
|
105
|
+
red = red_pixel_count(img, y1, y2)
|
|
106
|
+
d = frame_diff(prev_img, img, y1, y2) if prev_img else 0.0
|
|
107
|
+
reds.append((name, red))
|
|
108
|
+
if prev_red >= 0:
|
|
109
|
+
d_red = red - prev_red
|
|
110
|
+
if prev_red <= 20 and red > 80:
|
|
111
|
+
flags.append((name, red, d, "appear"))
|
|
112
|
+
elif prev_red > 80 and red <= 20:
|
|
113
|
+
flags.append((name, red, d, "vanish"))
|
|
114
|
+
elif abs(d_red) > 60 or d > 0.18:
|
|
115
|
+
flags.append((name, red, d, "move"))
|
|
116
|
+
prev_img, prev_red = img, red
|
|
117
|
+
|
|
118
|
+
flag_file = os.path.join(out_dir, "flags.txt")
|
|
119
|
+
with open(flag_file, "w", encoding="utf-8") as f:
|
|
120
|
+
for name, red, d, kind in flags:
|
|
121
|
+
f.write(f"{name}\tred={red}\tdiff={d:.2f}\t{kind}\n")
|
|
122
|
+
f.write(f"# total frames={len(names)} flagged={len(flags)}\n")
|
|
123
|
+
print(f"flagged {len(flags)}/{len(names)} -> {flag_file}")
|
|
124
|
+
|
|
125
|
+
if args.contact and flags:
|
|
126
|
+
imgs = [Image.open(os.path.join(work, n)).convert("RGB") for n, *_ in flags[:20]]
|
|
127
|
+
tw, th = 360, 640
|
|
128
|
+
cols = 4
|
|
129
|
+
rows = math.ceil(len(imgs) / cols)
|
|
130
|
+
sheet = Image.new("RGB", (cols * tw, rows * th), "black")
|
|
131
|
+
for k, im in enumerate(imgs):
|
|
132
|
+
sheet.paste(im.resize((tw, th)), ((k % cols) * tw, (k // cols) * th))
|
|
133
|
+
sheet.save(args.contact)
|
|
134
|
+
print(f"contact sheet -> {args.contact}")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if __name__ == "__main__":
|
|
138
|
+
main()
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""ohos-devloop init 底层——生成用户工作区(ROADMAP M6 脚手架)。
|
|
4
|
+
|
|
5
|
+
用法:
|
|
6
|
+
ohos-devloop init [目录] # 缺省 ./ohos-work
|
|
7
|
+
ohos-devloop init my-ws --force # 目标非空时须显式 --force
|
|
8
|
+
ohos-devloop init my-ws --no-skills # 跳过技能展开到 ~/.agents/skills/
|
|
9
|
+
|
|
10
|
+
生成:
|
|
11
|
+
ohos-workspace.yaml 工作区 marker(wsroot 解析依据;记录 schema/创建时间/工具版本)
|
|
12
|
+
config/inventory.yaml ← config/inventory-template.yaml(占位符 + 填写指引注释)
|
|
13
|
+
AGENTS.md ← config/templates/agents-user.md(跨 agent 通用的用户版)
|
|
14
|
+
QUICKSTART.md ← config/templates/quickstart.md(用户手册入口)
|
|
15
|
+
tasks/ runs/ 留档目录(不进 git;runs 由 apply.py 写入)
|
|
16
|
+
~/.agents/skills/ ← agents/skills/ 逐字复制(agent 技能副本,用户级 D-01 显式例外;
|
|
17
|
+
同名已存在跳过、--force 也不覆盖;--no-skills 关)
|
|
18
|
+
"""
|
|
19
|
+
import argparse
|
|
20
|
+
import datetime
|
|
21
|
+
import shutil
|
|
22
|
+
import sys
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
import yaml
|
|
26
|
+
|
|
27
|
+
# 版本单点(D-08):正本在 ohos_cli.version(metadata → git 兜底(仅裸跑)→ unknown)。
|
|
28
|
+
# 机制 (a):插入包根后裸 import——sys.path[0]=脚本目录的裸跑形态也可解析。
|
|
29
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
30
|
+
import ohos_cli # noqa: E402
|
|
31
|
+
tool_version = ohos_cli.version
|
|
32
|
+
|
|
33
|
+
PKG = Path(__file__).resolve().parent.parent
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def expand_agent_skills(skip: bool) -> tuple[list[str], list[str]]:
|
|
37
|
+
"""包内 agent 技能展开到用户级 ~/.agents/skills/(D-01 显式例外:工具资产副本,非用户数据)。
|
|
38
|
+
|
|
39
|
+
目录级 copies 语义(D-03,推广自下方模板 copies 循环):目标同名目录已存在 →
|
|
40
|
+
跳过(--force 也不覆盖用户已改副本);shutil.copytree 按字节复制(技能树
|
|
41
|
+
.py/.yaml/.md 混合,不做 EOL 归一——逐字语义)。纯字节复制、零解释执行
|
|
42
|
+
(展开不是安装钩子,不跑任何 .py/.sh,supply-chain 面收窄为复制)。
|
|
43
|
+
写入面仅此一处用户层白名单(T-3-03),不得以此为先例给其他用户数据开洞。
|
|
44
|
+
"""
|
|
45
|
+
if skip:
|
|
46
|
+
print("跳过技能展开(--no-skills):agent 技能未复制到 ~/.agents/skills/(正本在包内)")
|
|
47
|
+
return [], []
|
|
48
|
+
src_root = PKG / "agents" / "skills"
|
|
49
|
+
if not src_root.is_dir(): # 防御:wheel 缺技能资产——warn 不报错
|
|
50
|
+
print(f"WARN: 包内技能资产缺失({src_root}),跳过技能展开", file=sys.stderr)
|
|
51
|
+
return [], []
|
|
52
|
+
dst_root = Path.home() / ".agents" / "skills"
|
|
53
|
+
made, kept = [], []
|
|
54
|
+
for skill in sorted(p for p in src_root.iterdir() if p.is_dir()):
|
|
55
|
+
dst = dst_root / skill.name
|
|
56
|
+
if dst.exists():
|
|
57
|
+
kept.append(f".agents/skills/{skill.name}")
|
|
58
|
+
continue
|
|
59
|
+
shutil.copytree(skill, dst)
|
|
60
|
+
made.append(f".agents/skills/{skill.name}")
|
|
61
|
+
return made, kept
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main() -> int:
|
|
65
|
+
ap = argparse.ArgumentParser(description="生成用户工作区(ohos-devloop init)")
|
|
66
|
+
ap.add_argument("dir", nargs="?", default="ohos-work", help="目标目录(缺省 ./ohos-work)")
|
|
67
|
+
ap.add_argument("--force", action="store_true", help="目标非空时仍初始化(不覆盖已有同名文件)")
|
|
68
|
+
ap.add_argument("--no-skills", action="store_true", help="跳过技能展开到 ~/.agents/skills/")
|
|
69
|
+
args = ap.parse_args()
|
|
70
|
+
|
|
71
|
+
ws = (Path.cwd() / args.dir).resolve()
|
|
72
|
+
if ws.exists() and not ws.is_dir(): # IN-06:file 目标原先裸崩 NotADirectoryError → 显式报错 rc==2
|
|
73
|
+
print(f"ERROR: {ws} 已存在且不是目录——init 需要目录目标", file=sys.stderr)
|
|
74
|
+
return 2
|
|
75
|
+
if ws.exists() and any(ws.iterdir()) and not args.force:
|
|
76
|
+
print(f"ERROR: {ws} 非空——换目录或 --force(已有同名文件不会被覆盖)", file=sys.stderr)
|
|
77
|
+
return 2
|
|
78
|
+
|
|
79
|
+
(ws / "config").mkdir(parents=True, exist_ok=True)
|
|
80
|
+
for d in ("tasks", "runs"):
|
|
81
|
+
(ws / d).mkdir(exist_ok=True)
|
|
82
|
+
|
|
83
|
+
marker = {
|
|
84
|
+
"workspace": "ohos-devloop",
|
|
85
|
+
# 过渡期双键:schema 为旧键(0.1.x 旧轮只写它,读取侧回退兼容);下一破坏性格式变更时删旧键
|
|
86
|
+
"schema": 1,
|
|
87
|
+
"schema_version": 1, # 版本戳(UPGR-01 规范键,wsroot.marker_schema 优先读)
|
|
88
|
+
"created": datetime.datetime.now().astimezone().isoformat(timespec="seconds"),
|
|
89
|
+
"tool": tool_version(),
|
|
90
|
+
}
|
|
91
|
+
(ws / "ohos-workspace.yaml").write_text(
|
|
92
|
+
yaml.dump(marker, allow_unicode=True, sort_keys=False), encoding="utf-8")
|
|
93
|
+
|
|
94
|
+
copies = { # (包内模板 → 工作区落点);已存在的跳过(--force 也不覆盖用户已改文件)
|
|
95
|
+
"config/inventory-template.yaml": "config/inventory.yaml",
|
|
96
|
+
"config/templates/agents-user.md": "AGENTS.md",
|
|
97
|
+
"config/templates/quickstart.md": "QUICKSTART.md",
|
|
98
|
+
}
|
|
99
|
+
made, kept = [], []
|
|
100
|
+
for src, dst in copies.items():
|
|
101
|
+
s, d = PKG / src, ws / dst
|
|
102
|
+
if d.exists():
|
|
103
|
+
kept.append(dst)
|
|
104
|
+
continue
|
|
105
|
+
d.write_text(s.read_text(encoding="utf-8"), encoding="utf-8", newline="\n")
|
|
106
|
+
made.append(dst)
|
|
107
|
+
|
|
108
|
+
# 技能展开(D-01 用户级例外):包内 agents/skills → ~/.agents/skills(目录级 copies 语义)
|
|
109
|
+
skills_made, skills_kept = expand_agent_skills(args.no_skills)
|
|
110
|
+
made.extend(skills_made)
|
|
111
|
+
kept.extend(skills_kept)
|
|
112
|
+
|
|
113
|
+
print(f"工作区已就位: {ws}")
|
|
114
|
+
for line in made:
|
|
115
|
+
print(f" 生成 {line}")
|
|
116
|
+
for line in kept:
|
|
117
|
+
print(f" 保留已有 {line}(未覆盖)")
|
|
118
|
+
print("\n下一步:")
|
|
119
|
+
print(f" 1. 编辑 {ws/'config'/'inventory.yaml'}(服务器/板卡/本机 hdc——注释里有逐项指引)")
|
|
120
|
+
print(" 2. cd 到工作区后: ohos-devloop check-env → ohos-devloop server init(部署验收,smoke 跑绿)")
|
|
121
|
+
print(" 3. 日常流程见 QUICKSTART.md;在此目录内命令自动解析到本工作区(或设 OHOS_WS 指路)")
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
try:
|
|
127
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace", line_buffering=True)
|
|
128
|
+
sys.stderr.reconfigure(encoding="utf-8", errors="replace", line_buffering=True)
|
|
129
|
+
except Exception:
|
|
130
|
+
pass
|
|
131
|
+
sys.exit(main())
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""工作区解析层(ROADMAP M6:工具包与用户工作区分离,CLI 即契约的地基)。
|
|
4
|
+
|
|
5
|
+
两种形态:
|
|
6
|
+
- 维护者形态(现状不变):仓 = 工作区,config/tasks/runs/workspace_pool 都在仓里。
|
|
7
|
+
- 用户形态(pipx/wheel 安装):`ohos-devloop init` 在任意目录生成工作区(marker =
|
|
8
|
+
ohos-workspace.yaml),本机数据(inventory/任务留档/run 档案/工作区池)归工作区,
|
|
9
|
+
包资产(worker 脚本/自测 spec/注册表缺省/模板)归工具正本仓。
|
|
10
|
+
|
|
11
|
+
解析顺序(双模语义):$OHOS_WS(须为合法工作区,否则告警忽略)→ 从 cwd 逐级向上找
|
|
12
|
+
marker `ohos-workspace.yaml` → 向上找包形目录(`ohos_devloop/scripts/` 与
|
|
13
|
+
`ohos_devloop/config/inventory.yaml` 并存,且带仓根签名——site-packages 形状不认)→
|
|
14
|
+
兜底两分支:源码仓态(PKG.parent 有仓根签名)回落仓根 PKG.parent(仓 = 工作区);
|
|
15
|
+
安装态回落 None——用户数据写入必须经 require_ws(),无工作区时报错引导
|
|
16
|
+
`ohos-devloop init`,绝不写包目录/site-packages。
|
|
17
|
+
|
|
18
|
+
注册表继承:工作区 config/<name> 存在则深合并覆盖包内缺省(tdd-suites/e2e-cases
|
|
19
|
+
按顶层键合并——工作区可加条目/改钉数,不动包缺省)。
|
|
20
|
+
|
|
21
|
+
marker 版本戳(UPGR-01 前置):工作区 marker 写双键——schema_version(规范键)+ 旧
|
|
22
|
+
schema 键(过渡期,下一破坏性格式变更时删)。读取经 marker_schema()(优先规范键、
|
|
23
|
+
回退旧键——旧 wheel 建的工作区照常解析,绝不因缺戳拒绝);ensure_schema_supported()
|
|
24
|
+
对超版本工作区 stderr 告警(经 require_ws() 接入写路径;未来破坏性变更时升级为拒绝)。
|
|
25
|
+
"""
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
import os
|
|
29
|
+
import sys
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
import yaml
|
|
33
|
+
|
|
34
|
+
PKG = Path(__file__).resolve().parent.parent # 工具正本仓(包资产)
|
|
35
|
+
MARKER = "ohos-workspace.yaml"
|
|
36
|
+
SOURCE_SIGNATURES = (".git", "pyproject.toml", "AGENTS.md") # 仓根签名:源码仓态任一在、安装态全无(实测判别干净)
|
|
37
|
+
SUPPORTED_SCHEMA = 1 # 本工具支持的工作区 marker 格式版本(正整数递增;仅破坏性格式变更时 bump——UPGR-01)
|
|
38
|
+
|
|
39
|
+
_cached: Path | None = None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class WorkspaceRequiredError(Exception):
|
|
43
|
+
"""安装态无工作区时的引导式错误(文案含 'ohos-devloop init <目录>' 与 OHOS_WS 指路)。"""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _is_source_checkout() -> bool:
|
|
47
|
+
"""源码仓形态判别:PKG.parent 上有仓根签名文件(clone/zip 导出/editable 都满足;
|
|
48
|
+
site-packages 全无——实测两态判别干净)。"""
|
|
49
|
+
return any((PKG.parent / s).exists() for s in SOURCE_SIGNATURES)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _looks_like_ws(p: Path) -> bool:
|
|
53
|
+
"""工作区判定(D-03 包形收紧):marker 优先;包形须「scripts/ + config/inventory.yaml
|
|
54
|
+
并存 + 仓根签名任一存在」——site-packages 形状(有包形无签名)判 False(实测)。"""
|
|
55
|
+
return (p / MARKER).is_file() or \
|
|
56
|
+
((p / "ohos_devloop" / "scripts").is_dir() and
|
|
57
|
+
(p / "ohos_devloop" / "config" / "inventory.yaml").is_file() and
|
|
58
|
+
any((p / s).exists() for s in SOURCE_SIGNATURES))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def marker_schema(ws: Path) -> int | None:
|
|
62
|
+
"""marker 版本读取(兼容读红线):优先 schema_version(规范键,int 化容错)、回退旧
|
|
63
|
+
schema 键(旧 wheel 0.1.1 只写它——绝不因缺规范键拒绝工作区)。两键皆缺且 marker
|
|
64
|
+
文件存在 → None + 一次 WARN「按 v1 兼容读」;marker 不存在(源码仓态仓根)→ None
|
|
65
|
+
且静默(不制造噪声)。"""
|
|
66
|
+
path = ws / MARKER
|
|
67
|
+
if not path.is_file():
|
|
68
|
+
return None
|
|
69
|
+
try:
|
|
70
|
+
data = yaml.safe_load(path.read_text(encoding="utf-8")) or {}
|
|
71
|
+
except (OSError, yaml.YAMLError):
|
|
72
|
+
return None # 读不了的 marker 等同无版本戳(兼容读;不在此处硬失败)
|
|
73
|
+
for key in ("schema_version", "schema"):
|
|
74
|
+
value = data.get(key) if isinstance(data, dict) else None
|
|
75
|
+
if value is None:
|
|
76
|
+
continue
|
|
77
|
+
try:
|
|
78
|
+
return int(value)
|
|
79
|
+
except (TypeError, ValueError):
|
|
80
|
+
continue
|
|
81
|
+
print(f"WARN: 工作区 marker 无版本戳({path} 缺 schema_version/schema),按 v1 兼容读",
|
|
82
|
+
file=sys.stderr)
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def ensure_schema_supported(ws: Path) -> None:
|
|
87
|
+
"""超版本工作区告警钩子(UPGR-01 校验点,经 require_ws 接入写路径):marker 版本高于
|
|
88
|
+
本工具支持 → stderr 告警(未来破坏性变更落地时升级为拒绝写入);无戳/无 marker/v1 → 静默。"""
|
|
89
|
+
ms = marker_schema(ws)
|
|
90
|
+
if ms is not None and ms > SUPPORTED_SCHEMA:
|
|
91
|
+
print(f"WARN: 工作区 schema_version {ms} 高于本工具支持 {SUPPORTED_SCHEMA}"
|
|
92
|
+
"——后续版本将拒绝写入", file=sys.stderr)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def ws_root() -> Path | None:
|
|
96
|
+
"""工作区根(双模):$OHOS_WS / cwd 向上扫描命中 → 该目录;否则源码仓态回落仓根
|
|
97
|
+
PKG.parent,安装态回落 None(写入走 require_ws() 引导 init,绝不回落包目录)。"""
|
|
98
|
+
global _cached
|
|
99
|
+
if _cached is not None:
|
|
100
|
+
return _cached
|
|
101
|
+
env = os.environ.get("OHOS_WS")
|
|
102
|
+
if env:
|
|
103
|
+
p = Path(env).expanduser().resolve()
|
|
104
|
+
if _looks_like_ws(p):
|
|
105
|
+
_cached = p
|
|
106
|
+
return p
|
|
107
|
+
print(f"WARN: OHOS_WS={env} 不是工作区(缺 {MARKER},或包形目录缺仓根签名——"
|
|
108
|
+
f"site-packages 不算工作区),忽略", file=sys.stderr)
|
|
109
|
+
d = Path.cwd().resolve()
|
|
110
|
+
for cand in (d, *d.parents):
|
|
111
|
+
if _looks_like_ws(cand): # marker 优先于仓形(嵌套时用户区胜出);包形须带仓根签名
|
|
112
|
+
_cached = cand
|
|
113
|
+
return cand
|
|
114
|
+
if _is_source_checkout():
|
|
115
|
+
_cached = PKG.parent # 源码仓态:仓根 = 工作区(修漂移:旧回落 PKG 会把 runs/ 写进包目录)
|
|
116
|
+
else:
|
|
117
|
+
_cached = None # 安装态:无工作区 → require_ws() 报错引导 init,绝不写包目录
|
|
118
|
+
return _cached
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def require_ws() -> Path:
|
|
122
|
+
"""写入侧单一出口:无工作区(安装态)抛 WorkspaceRequiredError 引导 init,绝不回落包目录;
|
|
123
|
+
返回前经 ensure_schema_supported() 做版本校验(超版本告警钩子;源态无 marker → 静默)。"""
|
|
124
|
+
ws = ws_root()
|
|
125
|
+
if ws is None:
|
|
126
|
+
raise WorkspaceRequiredError(
|
|
127
|
+
"未找到工作区(安装态禁止向包目录写入用户数据)。"
|
|
128
|
+
"先运行 ohos-devloop init <目录> 生成工作区,然后在工作区内运行命令,"
|
|
129
|
+
"或设置 OHOS_WS=<工作区路径> 指路。")
|
|
130
|
+
ensure_schema_supported(ws) # 写路径版本校验点(UPGR-01:超版本工作区先告警,破坏性变更落地时升级为拒绝)
|
|
131
|
+
return ws
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def reset_cache() -> None:
|
|
135
|
+
"""清空进程级解析缓存(ws_root() memo)——测试隔离与显式重解析的出口。"""
|
|
136
|
+
global _cached
|
|
137
|
+
_cached = None
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def inventory_path() -> Path:
|
|
141
|
+
"""用户资源清单(唯一事实来源)——工作区优先,源码仓形态下回落包内清单(D-03:仓=工作区,
|
|
142
|
+
config/inventory.yaml 已随包目录迁移到 ohos_devloop/config/,与 config_path 同款回退语义)。
|
|
143
|
+
安装态无工作区时直取包缺省(读路径不受 require_ws 门约束,PACK-02 资产读全程可用)。"""
|
|
144
|
+
ws = ws_root()
|
|
145
|
+
if ws is not None:
|
|
146
|
+
cand = ws / "config" / "inventory.yaml"
|
|
147
|
+
if cand.is_file():
|
|
148
|
+
return cand
|
|
149
|
+
return PKG / "config" / "inventory.yaml"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def config_path(name: str) -> Path:
|
|
153
|
+
"""模板/单文件类配置:工作区存在则用工作区的,否则包缺省(task-template.md 等)。"""
|
|
154
|
+
ws = ws_root()
|
|
155
|
+
if ws is not None:
|
|
156
|
+
cand = ws / "config" / name
|
|
157
|
+
if cand.is_file():
|
|
158
|
+
return cand
|
|
159
|
+
return PKG / "config" / name
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def config_dir(name: str) -> Path:
|
|
163
|
+
"""目录型配置(report-templates 等):同 config_path 语义。"""
|
|
164
|
+
ws = ws_root()
|
|
165
|
+
if ws is not None:
|
|
166
|
+
cand = ws / "config" / name
|
|
167
|
+
if cand.is_dir():
|
|
168
|
+
return cand
|
|
169
|
+
return PKG / "config" / name
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _deep_merge(base: dict, over: dict) -> dict:
|
|
173
|
+
for k, v in over.items():
|
|
174
|
+
if isinstance(v, dict) and isinstance(base.get(k), dict):
|
|
175
|
+
_deep_merge(base[k], v)
|
|
176
|
+
else:
|
|
177
|
+
base[k] = v
|
|
178
|
+
return base
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def load_registry(name: str, top: str) -> dict:
|
|
182
|
+
"""中央注册表随包分发 + 工作区覆写:包 config/<name> 为底,工作区同名文件深合并。
|
|
183
|
+
返回 <top> 键下的映射(如 tdd-suites.yaml 的 suites / e2e-cases.yaml 的 cases)。"""
|
|
184
|
+
data: dict = yaml.safe_load((PKG / "config" / name).read_text(encoding="utf-8")) or {}
|
|
185
|
+
base = dict(data.get(top) or {})
|
|
186
|
+
ws = ws_root()
|
|
187
|
+
if ws is not None:
|
|
188
|
+
over_path = ws / "config" / name
|
|
189
|
+
if over_path.is_file():
|
|
190
|
+
over = yaml.safe_load(over_path.read_text(encoding="utf-8")) or {}
|
|
191
|
+
_deep_merge(base, dict(over.get(top) or {}))
|
|
192
|
+
return base
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ohos-devloop
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: 面向 OpenHarmony 的 Agent 驱动设备开发与验证闭环
|
|
5
|
+
Author-email: guozejun <guozejun@huawei.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://gitcode.com/guozejun/ohos-devloop
|
|
8
|
+
Project-URL: Repository, https://gitcode.com/guozejun/ohos-devloop
|
|
9
|
+
Project-URL: Source, https://gitcode.com/guozejun/ohos-devloop/tree/v0.1.2
|
|
10
|
+
Project-URL: Release Notes, https://gitcode.com/guozejun/ohos-devloop/releases/v0.1.2
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: PyYAML>=6
|
|
23
|
+
Requires-Dist: Pillow>=9
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Changelog
|
|
27
|
+
|
|
28
|
+
本文件记录 ohos-devloop 对外版本的变化([Keep a Changelog 1.1.0](https://keepachangelog.com/zh-CN/1.1.0/) 风格,newest-first)。
|
|
29
|
+
分类:Added / Changed / Fixed / Security;日期为 ISO 8601。首个公开版本从 0.1.x 线的下一干净 tag 起,
|
|
30
|
+
不回填内部打包验证使用过的 v0.1.0 / v0.1.1 测试 tag。
|
|
31
|
+
|
|
32
|
+
## [Unreleased]
|
|
33
|
+
|
|
34
|
+
## [0.1.2] - 2026-11-18
|
|
35
|
+
|
|
36
|
+
首个公开发布候选:在 Windows 本机用 USB 直连开发板(rk3568 等),代码定位与编译交给自己的 Linux
|
|
37
|
+
构建服务器,本机负责推板、取证与判定的 Agent 驱动开发闭环。CLI 是唯一契约——任何能执行命令行的
|
|
38
|
+
Coding Agent 都能担任主 Agent。
|
|
39
|
+
|
|
40
|
+
> 如实声明:本条目描述的能力已由仓内自动化测试与真实构建/推板链验证;**真实公开 PyPI / GitCode
|
|
41
|
+
> Release 首发与匿名 URL 可达性验证尚未执行**(发布链的独立后续步骤),本条目不以上线证据自居;
|
|
42
|
+
> 遥测看板登录加固仅由单测覆盖,未做公网渗透测试。
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
|
|
46
|
+
- 统一 CLI 入口 `ohos-devloop`(13 个子命令)与 pipx 安装形态;`init` 生成用户工作区
|
|
47
|
+
(inventory 模板 / QUICKSTART / 用户级 agent 技能展开),用户数据与安装目录彻底分离。
|
|
48
|
+
- 服务器 code-worker 部署与验收链(体检 → md5 回验部署 → smoke)与任务契约生命周期
|
|
49
|
+
(collab new/push/run/status/log/fetch/artifacts/close):改码经任务契约交远端重模型,
|
|
50
|
+
worker 只在本地分支提交、禁 push。
|
|
51
|
+
- 验证链调度器 `apply`:verify / e2e-hap / tdd 双通道(宿主机快反馈 + 板端强制门)/
|
|
52
|
+
差分覆盖率 job;推板前目标文件自动备份;断言步骤统一判定。
|
|
53
|
+
- UI 树证据层(dumpLayout 标准化 + 选择器断言/点击)、hap 测试应用离线签名
|
|
54
|
+
(debug/release)与取证帧像素级差异比对。
|
|
55
|
+
- 发布前审计门 `release-audit`:twine check --strict + wheel 允许清单对账 + 敏感值
|
|
56
|
+
黑名单扫描 + METADATA 公开要素断言,四步 fail-closed,任何上传前必跑。
|
|
57
|
+
- 发布预检命令 `release`(裸模式):精确 tag / 干净树 → wheel-only 构建归档 → 审计 →
|
|
58
|
+
给定归档 wheel 的真实安装态 smoke → 只读双面预检,打印后停止(零上传)。
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- 对外品牌与命令统一为 ohos-devloop;README 改为面向外部使用者的四节结构
|
|
63
|
+
(安装 / 升级 / 数据位置 / 排障),内部运维内容收敛到 RUNBOOK。
|
|
64
|
+
- 公开元数据按 PEP 639 落地:SPDX license 表达式(Apache-2.0)+ license-files,
|
|
65
|
+
移除弃用的 `License ::` classifier。
|
|
66
|
+
- 发布形态确定为 wheel-only(零 sdist):运行面资产经 package-data 随包分发,
|
|
67
|
+
wheel 内容由 packaging/wheel-manifest.yaml 白名单锚定;PyPI 项目正文由
|
|
68
|
+
CHANGELOG 当前版本条目 + README 合成(当前版本说明在前)。
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
- 安装态无工作区时调度与维护者工具给出 `ohos-devloop init` 引导硬错误,
|
|
73
|
+
不再误写安装目录或静默失败。
|
|
74
|
+
- 脏树构建防线:本地 `__pycache__` / `*.pyc` 不再进入 wheel(打包配置漂移 fail-closed)。
|
|
75
|
+
- 升级只换工具本体:工作区 marker 带 schema_version 戳,旧工作区按 v1 兼容读、
|
|
76
|
+
缺戳不拒绝、超版本只告警;inventory / tasks / runs / 工作区池登记原样保留。
|
|
77
|
+
|
|
78
|
+
### Security
|
|
79
|
+
|
|
80
|
+
- 内网坐标占位化:真实服务器 / 板卡 / 本机参数的唯一载体是仓根 gitignored
|
|
81
|
+
覆写位(config/inventory.yaml),包内只随占位模板分发,绝不携带真实坐标。
|
|
82
|
+
- 遥测默认关闭(opt-in);开启后只收事件形状不收内容,端点与协议见 RUNBOOK「遥测」。
|
|
83
|
+
- 发布凭据只经环境变量注入,不进仓 / 不进日志 / 不进发布回执;构建产物敏感值
|
|
84
|
+
由独立黑名单门 fail-closed 扫描(twine strict 之外的第二道门)。
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
**面向 OpenHarmony 的 Agent 驱动设备开发与验证闭环。**
|
|
89
|
+
|
|
90
|
+
> 从任务到真机验证,自动闭环。
|
|
91
|
+
|
|
92
|
+
DevLoop 把「改 OpenHarmony 代码 → 编译 → 推开发板 → 取证判定」串成一条 Agent 可驱动的闭环:你在 Windows 本机用 USB 直连开发板(rk3568 等),代码定位与编译交给你自己的 Linux 构建服务器,本机负责推板、取证与结果判定。CLI 是唯一契约——任何能执行命令行的 Coding Agent(Claude、Codex、opencode……)都能担任主 Agent,不依赖特定客户端的私有 API。
|
|
93
|
+
|
|
94
|
+
## 它怎么工作
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
- **改码走任务契约**:`ohos-devloop collab` 把任务(task.md + 证据 context)上推给构建服务器上的 code-worker——一个与大仓、构建工具链同机的重模型 Agent,负责定位、修改、`fix/*` 分支提交并触发构建;report 与产物清单自动回收。worker 只在本地分支提交,不 push。
|
|
99
|
+
- **验证走本机**:`ohos-devloop apply` 流水线取回构建产物、推板、截图/hilog 取证;TDD 双通道(宿主机快反馈 + 板端强制门)守住每次改码。
|
|
100
|
+
- **固件与基线对齐**:`ohos-devloop flash` 解包固件、按镜像 manifest 把服务器大仓同步到同一提交点——板上系统与大仓代码不混基线。
|
|
101
|
+
|
|
102
|
+
一轮迭代的完整旅程(init → check-env → 服务器部署 → 任务契约 → 验证链)由 `ohos-devloop init` 生成的 QUICKSTART.md 承载,跟着走即可。协作协议细节、踩坑实录与操作铁律在 [RUNBOOK.md](https://gitcode.com/guozejun/ohos-devloop/blob/v0.1.2/RUNBOOK.md)(维护者手册),面向 Agent 的仓库地图在 [AGENTS.md](https://gitcode.com/guozejun/ohos-devloop/blob/v0.1.2/AGENTS.md)。
|
|
103
|
+
|
|
104
|
+
## 安装
|
|
105
|
+
|
|
106
|
+
### 前置组件
|
|
107
|
+
|
|
108
|
+
| 组件 | 版本要求 | 用途 | 验证 |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| Windows | 10+ | 本机环境(板卡宿主、工具运行处) | — |
|
|
111
|
+
| Python | ≥ 3.10 | CLI 与全部工具脚本 | `python --version` |
|
|
112
|
+
| pipx | 最新 | 隔离安装 ohos-devloop | `pipx --version` |
|
|
113
|
+
| OpenSSH 客户端 | — | 连构建服务器(Windows 系统内置) | `ssh -V` |
|
|
114
|
+
| DevEco Studio | ≥ 6.0 | OpenHarmony SDK / hdc / 签名材料 | — |
|
|
115
|
+
| 开发板 | rk3568 等 | USB 直连本机 | `hdc list targets` |
|
|
116
|
+
| 构建服务器 | 自备 Linux | OpenHarmony 大仓 + 构建工具链;code-worker 由工具部署 | ssh 免密可达 |
|
|
117
|
+
| Node.js + deveco-cli | ≥ 22 | **可选**:测试应用构建/装板 | `devecocli --version` |
|
|
118
|
+
|
|
119
|
+
### 安装步骤
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# 1. 安装工具(独立 venv,PATH 出现 ohos-devloop 命令)
|
|
123
|
+
pipx install ohos-devloop
|
|
124
|
+
ohos-devloop version # 应输出包版本
|
|
125
|
+
|
|
126
|
+
# 2. 生成你的工作区(用户数据都归这里,不进安装目录)
|
|
127
|
+
ohos-devloop init <目录>
|
|
128
|
+
# 编辑 <目录>/config/inventory.yaml:构建服务器 ssh 参数、板卡序列号与基线版本、本机 hdc 路径
|
|
129
|
+
|
|
130
|
+
# 3. 环境自证:逐项 PASS/WARN/FAIL,FAIL 清零再继续
|
|
131
|
+
ohos-devloop check-env
|
|
132
|
+
|
|
133
|
+
# 4. 部署构建服务器侧 code-worker(体检 → 部署(md5 回验)→ smoke 验收)
|
|
134
|
+
ohos-devloop server init
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
agent 技能随 init 展开到用户级 `~/.agents/skills/`(Coding Agent 框架天然发现;`--no-skills` 可关)。
|
|
138
|
+
|
|
139
|
+
## 升级
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
pipx upgrade ohos-devloop
|
|
143
|
+
# 本地 wheel 安装的形态:pipx install <新 wheel 路径> --force
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- **数据不变式**:升级只换工具本体。工作区(inventory / tasks / runs / 工作区池登记)原样保留,不需要迁移,也不会被覆写。
|
|
147
|
+
- **工作区兼容承诺**:工作区 marker(`ohos-workspace.yaml`)带 `schema_version` 戳——旧工作区缺戳按 v1 兼容读,绝不拒绝;戳高于当前工具版本只告警、不阻断。跨大版本升级可放心先升后看。
|
|
148
|
+
|
|
149
|
+
## 数据位置
|
|
150
|
+
|
|
151
|
+
| 数据 | 位置 | 说明 |
|
|
152
|
+
|---|---|---|
|
|
153
|
+
| 工作区 | 你 `init` 的目录 | `config/inventory.yaml`(你的机器参数)、`tasks/`(任务留档)、`runs/`(执行档案与取证)、`workspace_pool.yaml`(大仓工作区池登记)——卸载/升级都不碰这里 |
|
|
154
|
+
| agent 技能副本 | `~/.agents/skills/` | init 从包内展开(collab-delegate / loop-iterate / openharmony-ci / pool-status);正本在包里,已改过的副本不会被覆盖 |
|
|
155
|
+
| 遥测 | `~/.ohos-devloop/telemetry/` | opt-in,**默认关**;开启后只收事件形状不收内容(协议见 RUNBOOK「遥测」) |
|
|
156
|
+
|
|
157
|
+
安装目录(pipx venv)里只有工具本体,没有你的数据——出问题时删掉重装即可,工作区无损。
|
|
158
|
+
|
|
159
|
+
## 排障
|
|
160
|
+
|
|
161
|
+
第一条命令永远是环境自证:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
ohos-devloop check-env # 逐项 PASS/WARN/FAIL,按提示修 FAIL;--offline 只查本机
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
常见的新用户坑(均有记录与解法,见 [RUNBOOK.md](https://gitcode.com/guozejun/ohos-devloop/blob/v0.1.2/RUNBOOK.md)「常见问题」与各节坑位实录):
|
|
168
|
+
|
|
169
|
+
- **装测试应用报 grant request permissions failed**:板上无 RTC,重启后时钟回退导致 profile 判定失败——先校时再装(RUNBOOK)。
|
|
170
|
+
- **板上行为与预期不符**:先核对板上系统版本与构建基线是否一致(不混基线;`flash extract` + `sync-repo` 对齐)。
|
|
171
|
+
- **hdc 手工操作退出码不可信**:以产物校验(md5/文件存在)为准——工具脚本已内置,手工操作注意(RUNBOOK)。
|
|
172
|
+
|
|
173
|
+
深入问题(协作协议、服务器部署配方、TDD 板端门、模拟器大循环等)全部在 [RUNBOOK.md](https://gitcode.com/guozejun/ohos-devloop/blob/v0.1.2/RUNBOOK.md)。离线/内网环境可用本地 wheel 安装:`pipx install <wheel 路径>`。
|
|
174
|
+
|
|
175
|
+
## 许可证
|
|
176
|
+
|
|
177
|
+
[Apache-2.0](https://gitcode.com/guozejun/ohos-devloop/blob/v0.1.2/LICENSE)
|