From e26046eda09821906375c112d51be45ff6ad4020 Mon Sep 17 00:00:00 2001 From: karuo Date: Sun, 22 Feb 2026 10:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20=E5=8D=A1=E8=8B=A5AI=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=202026-02-22=2010:57=20|=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A=E5=8D=A1=E5=9C=9F=E3=80=81=E6=80=BB=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E4=B8=8E=E5=85=A5=E5=8F=A3=E3=80=81=E8=BF=90=E8=90=A5=E4=B8=AD?= =?UTF-8?q?=E6=9E=A2=E5=B7=A5=E4=BD=9C=E5=8F=B0=20|=20=E6=8E=92=E9=99=A4?= =?UTF-8?q?=20>20MB:=208=20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md | 13 +++- .../土砖_技能复制/基因胶囊/脚本/gene_capsule.py | 68 +++++++++++++++++-- BOOTSTRAP.md | 2 + SKILL_REGISTRY.md | 4 +- 运营中枢/工作台/gitea_push_log.md | 1 + 运营中枢/工作台/代码管理.md | 1 + 6 files changed, 80 insertions(+), 9 deletions(-) diff --git a/05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md b/05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md index 90926665..e3bf543c 100644 --- a/05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md +++ b/05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md @@ -2,7 +2,7 @@ name: 基因胶囊 description: 将验证过的 Skill 打包为可遗传的能力单元(基因胶囊),支持 pack/unpack/list。触发词:基因胶囊、打包技能、解包胶囊、继承能力。 group: 土 -triggers: 基因胶囊、打包技能、解包胶囊、继承能力、胶囊列表 +triggers: 基因胶囊、打包技能、解包胶囊、继承能力、胶囊列表、查胶囊、pack-all、全量导出 owner: 土砖 version: "1.0" updated: "2026-02-22" @@ -49,7 +49,16 @@ python3 .../gene_capsule.py unpack 技能工厂_abc12345.json -o 02_卡人(水 - 默认按胶囊内 `manifest.skill_path` 写回 - 可选 `-o` 指定目录,则写入该目录下的 `SKILL.md` -### 2.3 列表 +### 2.3 全量导出(所有 Skill → 基因胶囊) + +```bash +cd /Users/karuo/Documents/个人/卡若AI +python3 "05_卡土(土)/土砖_技能复制/基因胶囊/脚本/gene_capsule.py" pack-all +``` + +将 SKILL_REGISTRY 中**所有技能**批量打包为基因胶囊,并更新导出说明文档。 + +### 2.4 列表 ```bash python3 .../gene_capsule.py list diff --git a/05_卡土(土)/土砖_技能复制/基因胶囊/脚本/gene_capsule.py b/05_卡土(土)/土砖_技能复制/基因胶囊/脚本/gene_capsule.py index bcb38cd8..dd0b5cb2 100644 --- a/05_卡土(土)/土砖_技能复制/基因胶囊/脚本/gene_capsule.py +++ b/05_卡土(土)/土砖_技能复制/基因胶囊/脚本/gene_capsule.py @@ -230,8 +230,8 @@ def _write_export_readme() -> str: return str(readme_path) -def pack(skill_ref: str, include_audit: bool = True) -> str: - """打包:将 SKILL 转为基因胶囊 JSON,并生成导出说明文档(含流程图)""" +def pack(skill_ref: str, include_audit: bool = True, write_readme: bool = True) -> str: + """打包:将 SKILL 转为基因胶囊 JSON,并生成导出说明文档(含流程图)。pack_all 时 write_readme=False。""" skill_path = _find_skill_path(skill_ref) content = skill_path.read_text(encoding="utf-8") rel_path = str(skill_path.relative_to(KARUO_AI_ROOT)) @@ -270,9 +270,11 @@ def pack(skill_ref: str, include_audit: bool = True) -> str: out_file = EXPORT_DIR / f"{safe_name}_{capsule_id[7:15]}.json" out_file.write_text(json.dumps(capsule, ensure_ascii=False, indent=2), encoding="utf-8") - # 生成导出说明文档(含完整流程图) - readme_path = _write_export_readme() - return str(out_file) + "\n📄 说明文档: " + readme_path + # 生成导出说明文档(含完整流程图);pack_all 时由调用方统一写入 + if write_readme: + readme_path = _write_export_readme() + return str(out_file) + "\n📄 说明文档: " + readme_path + return str(out_file) def unpack(capsule_path: str, target_dir: str | None = None) -> str: @@ -331,6 +333,45 @@ def list_capsules() -> list[dict]: return result +def _extract_skill_paths_from_registry() -> list[str]: + """从 SKILL_REGISTRY.md 提取所有 SKILL 路径""" + import re + registry = KARUO_AI_ROOT / "SKILL_REGISTRY.md" + if not registry.exists(): + return [] + text = registry.read_text(encoding="utf-8") + # 匹配 `01_xxx/xxx/SKILL.md` 格式 + pattern = r"`([^`]+SKILL\.md)`" + matches = re.findall(pattern, text) + seen = set() + out = [] + for m in matches: + m = m.strip() + if m and m not in seen and (KARUO_AI_ROOT / m).exists(): + seen.add(m) + out.append(m) + return out + + +def pack_all(include_audit: bool = True) -> tuple[int, int, list[str]]: + """全量打包:将 SKILL_REGISTRY 中所有技能导出为基因胶囊。返回 (成功数, 失败数, 失败列表)""" + paths = _extract_skill_paths_from_registry() + ok, fail = 0, 0 + failed = [] + for i, rel_path in enumerate(paths, 1): + try: + pack(rel_path, include_audit=include_audit, write_readme=False) + ok += 1 + print(f" [{i}/{len(paths)}] ✅ {Path(rel_path).parent.name}") + except Exception as e: + fail += 1 + failed.append(f"{rel_path}: {e}") + print(f" [{i}/{len(paths)}] ❌ {Path(rel_path).parent.name}: {e}") + # 最后统一更新说明文档(避免每次 pack 都覆盖,这里只调用一次) + _write_export_readme() + return ok, fail, failed + + def main(): parser = argparse.ArgumentParser(description="基因胶囊 · pack/unpack/list") sub = parser.add_subparsers(dest="cmd", required=True) @@ -344,9 +385,24 @@ def main(): p_unpack.add_argument("-o", "--output", help="输出目录,默认按 manifest.skill_path") # list p_list = sub.add_parser("list", help="列出本地胶囊") + # pack-all + p_pack_all = sub.add_parser("pack-all", help="全量导出:将 SKILL_REGISTRY 中所有技能打包为基因胶囊") + p_pack_all.add_argument("--no-audit", action="store_true", help="不包含审计信息") args = parser.parse_args() - if args.cmd == "pack": + if args.cmd == "pack-all": + paths = _extract_skill_paths_from_registry() + print(f"📦 全量导出 {len(paths)} 个技能...") + ok, fail, failed = pack_all(include_audit=not getattr(args, "no_audit", False)) + print(f"\n✅ 成功: {ok} | ❌ 失败: {fail}") + print(f"📄 说明文档: {EXPORT_DIR / EXPORT_README}") + if failed: + print("\n失败项:") + for f in failed[:10]: + print(f" - {f}") + if len(failed) > 10: + print(f" ... 等 {len(failed)} 项") + elif args.cmd == "pack": out = pack(args.skill, include_audit=not args.no_audit) parts = out.split("\n") print(f"✅ 已打包: {parts[0]}") diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index a57885ed..beef3f0c 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -38,6 +38,8 @@ | 2 | **技能注册表** `SKILL_REGISTRY.md` | 查找用户需求对应的技能和路径 | | 3 | **对应技能的 SKILL.md** | 拿到具体执行指令(只读匹配到的那个) | +**基因胶囊(内部查阅)**:需要快速查阅本地胶囊清单或继承能力时,读 `卡若Ai的文件夹/导出/基因胶囊/README_基因胶囊导出说明.md`(含全量技能胶囊清单、流程图、用法)。亦可用 `gene_capsule.py list` 列出胶囊。 + > **注意**:不需要一开始就读总索引、协同规范、交互流程等大文件。这些是参考文档,需要时再查。 --- diff --git a/SKILL_REGISTRY.md b/SKILL_REGISTRY.md index c89db91a..38c58678 100644 --- a/SKILL_REGISTRY.md +++ b/SKILL_REGISTRY.md @@ -14,6 +14,8 @@ 多技能匹配时按 **金→水→木→火→土** 优先级。用户可用 `@成员名` 指定。 +**基因胶囊查阅**:所有技能均已导出为基因胶囊,可于 `卡若Ai的文件夹/导出/基因胶囊/README_基因胶囊导出说明.md` 查看全量胶囊清单、流程图及 unpack 用法。支持「查胶囊」「胶囊列表」「继承能力」等触发。 + --- ## 金组 · 卡资(基础设施守护) @@ -84,7 +86,7 @@ |:--|:---|:---|:---|:---|:---| | E01 | 商业工具集 | 土基 | 商业分析、竞品 | `05_卡土(土)/土基_商业分析/商业工具集/SKILL.md` | 竞品分析、商业画布 | | E02 | 技能工厂 | 土砖 | 创建技能、生成Skill | `05_卡土(土)/土砖_技能复制/技能工厂/SKILL.md` | 批量创建/复制 SKILL | -| E07 | 基因胶囊 | 土砖 | **基因胶囊、打包技能、解包胶囊、继承能力** | `05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md` | Skill 打包为可遗传胶囊,pack/unpack/list | +| E07 | 基因胶囊 | 土砖 | **基因胶囊、打包技能、解包胶囊、继承能力、查胶囊、胶囊列表、pack-all** | `05_卡土(土)/土砖_技能复制/基因胶囊/SKILL.md` | Skill 打包为可遗传胶囊,pack/unpack/list/pack-all | | E03 | 流量自动化 | 土渠 | 刷流量、SEO | `05_卡土(土)/土渠_流量招商/流量自动化/SKILL.md` | SEO、流量投放自动化 | | E04 | 手机流量自动操作 | 土渠 | 手机自动化、AutoGLM | `05_卡土(土)/土渠_流量招商/手机与网页流量自动操作/SKILL.md` | 手机 App 自动化操作 | | E05 | 财务管理 | 土簿 | 财务、报表、银行 | `05_卡土(土)/土簿_财务管理/财务管理/SKILL.md` | 收支记录、财务报表 | diff --git a/运营中枢/工作台/gitea_push_log.md b/运营中枢/工作台/gitea_push_log.md index 2ace6bcb..1c705d22 100644 --- a/运营中枢/工作台/gitea_push_log.md +++ b/运营中枢/工作台/gitea_push_log.md @@ -77,3 +77,4 @@ | 2026-02-22 10:43:14 | 🔄 卡若AI 同步 2026-02-22 10:43 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | | 2026-02-22 10:48:02 | 🔄 卡若AI 同步 2026-02-22 10:48 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | | 2026-02-22 10:50:57 | 🔄 卡若AI 同步 2026-02-22 10:50 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | +| 2026-02-22 10:56:22 | 🔄 卡若AI 同步 2026-02-22 10:56 | 更新:卡土、总索引与入口、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 8 个 | diff --git a/运营中枢/工作台/代码管理.md b/运营中枢/工作台/代码管理.md index b2bd87e4..9f552556 100644 --- a/运营中枢/工作台/代码管理.md +++ b/运营中枢/工作台/代码管理.md @@ -80,3 +80,4 @@ | 2026-02-22 10:43:14 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 10:43 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-22 10:48:02 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 10:48 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-22 10:50:57 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 10:50 | 更新:运营中枢工作台 | 排除 >20MB: 8 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | +| 2026-02-22 10:56:22 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 10:56 | 更新:卡土、总索引与入口、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 8 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |