🔄 卡若AI 同步 2026-02-22 10:57 | 更新:卡土、总索引与入口、运营中枢工作台 | 排除 >20MB: 8 个
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]}")
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
| 2 | **技能注册表** `SKILL_REGISTRY.md` | 查找用户需求对应的技能和路径 |
|
||||
| 3 | **对应技能的 SKILL.md** | 拿到具体执行指令(只读匹配到的那个) |
|
||||
|
||||
**基因胶囊(内部查阅)**:需要快速查阅本地胶囊清单或继承能力时,读 `卡若Ai的文件夹/导出/基因胶囊/README_基因胶囊导出说明.md`(含全量技能胶囊清单、流程图、用法)。亦可用 `gene_capsule.py list` 列出胶囊。
|
||||
|
||||
> **注意**:不需要一开始就读总索引、协同规范、交互流程等大文件。这些是参考文档,需要时再查。
|
||||
|
||||
---
|
||||
|
||||
@@ -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` | 收支记录、财务报表 |
|
||||
|
||||
@@ -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 个 |
|
||||
|
||||
@@ -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) |
|
||||
|
||||
Reference in New Issue
Block a user