(in_path: Path, out_dir: Path, debug: bool = False)
| 128 | return '\n'.join(lines) |
| 129 | |
| 130 | def process_file(in_path: Path, out_dir: Path, debug: bool = False) -> bool: |
| 131 | try: |
| 132 | for enc in ['utf-8', 'utf-8-sig', 'latin-1']: |
| 133 | try: |
| 134 | text = in_path.read_text(encoding=enc) |
| 135 | break |
| 136 | except UnicodeDecodeError: |
| 137 | continue |
| 138 | else: |
| 139 | return False |
| 140 | |
| 141 | meta = parse_skill(text, in_path) |
| 142 | |
| 143 | if debug: |
| 144 | print(f"\n🔍 DEBUG {in_path.name}") |
| 145 | print(f" Name: {meta['name']}") |
| 146 | print(f" Folder: {meta['folder']}") |
| 147 | print(f" Desc: {meta['description'][:120]}...") |
| 148 | print(f" Trig: {meta['triggers'][:3]}... ({len(meta['triggers'])} total)") |
| 149 | print(f" Src: {meta['source']}") |
| 150 | print(f" Body preview: {meta['body'][:100]}...") |
| 151 | return True |
| 152 | |
| 153 | yaml_block = build_yaml(meta) |
| 154 | final = f"{yaml_block}\n\n{meta['body']}\n" |
| 155 | |
| 156 | out = out_dir / meta['name'] |
| 157 | out.mkdir(parents=True, exist_ok=True) |
| 158 | (out / 'SKILL.md').write_text(final, encoding='utf-8', newline='\n') |
| 159 | print(f"✅ {in_path.parent.name:35} → {meta['name']}/SKILL.md (Triggers: {len(meta['triggers'])})") |
| 160 | return True |
| 161 | except Exception as e: |
| 162 | print(f"❌ {in_path.name}: {e}") |
| 163 | import traceback |
| 164 | traceback.print_exc() |
| 165 | return False |
| 166 | |
| 167 | def create_zips(conv_dir: Path, zip_dir: Path): |
| 168 | zip_dir.mkdir(parents=True, exist_ok=True) |
no test coverage detected