- 软著3/4 源代码鉴别材料按当前 com.wanxiang.huijing 源码重新提取(gen_ru3/新增 gen_ru4,字节忠实) - 全量同步包名/路径/芋道目录标签;自研主张以 .game. 段为界,芋道(MIT)整体排除 - 总表 §一统计对齐各清单(123/10186、210/12841、9859、12/1650、461 文件);5.6万→约4.7万(纠无支撑数) - Codex 只读复核整改:高企表述加限定;专利4 权9 矛盾、专利1 manifest 口径修正;ru-6 便宜→低成本、七门九门→多门统一 - 新增双层复核报告对外洁净版 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
85 lines
5.1 KiB
Python
85 lines
5.1 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""ru-3 源代码鉴别材料 重生成器(确定性、字节忠实)。
|
||
规则取自 docs/ip/ruanzhu-3-cloud-gen-runtime/源文件清单.md §四 + .txt 头部:
|
||
四模块 aigc→project→runtime→studio,模块内按相对路径字典序;仅 src/main 下 .java;
|
||
每文件前置「// ==================== 文件: <相对game-cloud路径> ====================」;
|
||
文件间以源码自带尾换行形成的空行分隔;总拼接 = Σ(1分隔 + 文件含尾空行);取前1500+后1500。
|
||
只读源码,产物写 /tmp/ru3_new.txt;并打印清单所需的逐文件/分模块/总计数字。"""
|
||
import os, glob
|
||
from collections import OrderedDict
|
||
|
||
REPO = "/Users/lili/Project/games-development-ai"
|
||
CLOUD = os.path.join(REPO, "game-cloud")
|
||
MODULES = ["game-module-aigc", "game-module-project", "game-module-runtime", "game-module-studio"]
|
||
SEP = "// ==================== 文件: {rel} ===================="
|
||
|
||
files = [] # (module, rel_from_cloud, rel_from_module, wcl, split_lines)
|
||
no_trailing_nl = []
|
||
for m in MODULES:
|
||
found = []
|
||
for j in glob.glob(os.path.join(CLOUD, m, "game-module-*", "src", "main", "**", "*.java"), recursive=True):
|
||
found.append((os.path.relpath(j, CLOUD), j))
|
||
found.sort(key=lambda x: x[0])
|
||
for rel, j in found:
|
||
raw = open(j, encoding="utf-8").read()
|
||
wcl = raw.count("\n") # wc -l 口径(与现清单/Codex/Opus 一致)
|
||
if raw and not raw.endswith("\n"):
|
||
no_trailing_nl.append(rel)
|
||
files.append((m, rel, rel.split("/", 1)[1], wcl, raw.split("\n")))
|
||
|
||
# 拼接(字节忠实:split('\n') 后逐行,文件尾换行→末尾空元素=文件间空行)
|
||
concat = []
|
||
for m, rel, relm, wcl, sl in files:
|
||
concat.append(SEP.format(rel=rel))
|
||
concat.extend(sl)
|
||
total = len(concat)
|
||
front = concat[:1500]
|
||
back = concat[-1500:]
|
||
omit_from, omit_to, omit_cnt = 1501, total - 1500, total - 3000
|
||
|
||
nfiles = len(files)
|
||
nsrc = sum(f[3] for f in files)
|
||
mod = OrderedDict()
|
||
for m, rel, relm, wcl, sl in files:
|
||
e = mod.setdefault(m, [0, 0]); e[0] += 1; e[1] += wcl
|
||
|
||
header = [
|
||
"软件名称:绘境AI智能游戏生成与运行云服务系统 版本:V1.0",
|
||
"源代码鉴别材料(连续有效代码;按软著规范取前 1500 行 + 后 1500 行,每页≥50 行,转 PDF 时每页页眉标注「绘境AI智能游戏生成与运行云服务系统 V1.0」并加页码)",
|
||
"说明:本材料仅收录绘境AI自主开发的原创业务源代码(game-cloud 下 game-module-aigc / game-module-project / game-module-runtime / game-module-studio 四模块的 -api 与 -server 主干源码,共 %d 个 .java 文件、源码物理行合计 %d 行)。" % (nfiles, nsrc),
|
||
"已严格排除第三方开源与生成物:huijing-framework / huijing-gateway / huijing-module-system / huijing-module-infra / huijing-module-bpm / huijing-module-pay / huijing-server / huijing-dependencies 等芋道(Yudao Cloud,MIT)基座、LittleJS 引擎、node_modules、target/dist/build、*.min.js、自动生成代码、单元测试代码(src/test)。",
|
||
"拼接顺序:按模块目录字典序(aigc → project → runtime → studio),模块内按文件路径字典序;每个源文件以「// ==================== 文件: 相对路径 ====================」分隔。",
|
||
"本软件源代码连续有效合计约 %d 行(含文件分隔标识行),本材料收录其中前 1500 行与后 1500 行,合计 3000 行。" % total,
|
||
]
|
||
out = header + ["====================(以下为源代码前 1500 行)===================="] + front \
|
||
+ [""] + ["====================(中略:第 %d 行至第 %d 行从略,共省略 %d 行)====================" % (omit_from, omit_to, omit_cnt)] \
|
||
+ ["====================(以下为源代码后 1500 行)===================="] + back
|
||
open("/tmp/ru3_new.txt", "w", encoding="utf-8").write("\n".join(out) + "\n")
|
||
|
||
print("FILES=%d SRC_LINES=%d CONCAT=%d OMIT=%d (%d-%d) TXT_LINES=%d" % (nfiles, nsrc, total, omit_cnt, omit_from, omit_to, len(out)))
|
||
for m, (c, l) in mod.items():
|
||
print(" %-22s %d files / %d lines" % (m, c, l))
|
||
if no_trailing_nl:
|
||
print(" [WARN 无尾换行]", no_trailing_nl)
|
||
print(" BOUNDARY concat[1500]=%r" % (front[1499],))
|
||
print("--- 新增/关注文件是否在列 ---")
|
||
for kw in ("CallbackSignatureVerifier", "WorkerDispatchClient", "AigcExecutorConfiguration"):
|
||
for m, rel, relm, wcl, sl in files:
|
||
if kw in rel:
|
||
print(" %s %d 行 (%s)" % (kw, wcl, rel))
|
||
# 非空行统计 + 清单表体生成
|
||
nb_total = 0
|
||
nb_mod = OrderedDict()
|
||
for m, rel, relm, wcl, sl in files:
|
||
real = sl[:-1] if (sl and sl[-1] == "") else sl # 去掉尾换行造成的末空元素,得真实行
|
||
nb = sum(1 for x in real if x.strip() != "")
|
||
nb_total += nb
|
||
nb_mod[m] = nb_mod.get(m, 0) + nb
|
||
for mm in MODULES:
|
||
rows = ["| %s | %d |" % (relm, wcl) for (m, rel, relm, wcl, sl) in files if m == mm]
|
||
open("/tmp/ru3_tbl_%s.md" % mm, "w", encoding="utf-8").write("\n".join(rows) + "\n")
|
||
print("NONBLANK_TOTAL=%d" % nb_total)
|
||
for m, v in nb_mod.items():
|
||
print(" 非空 %-22s %d" % (m, v))
|