﻿F401 [*] `pathlib.Path` imported but unused
  --> tests\test_self_update.py:12:21
   |
10 | import json
11 | import time
12 | from pathlib import Path
   |                     ^^^^
13 |
14 | import pytest
   |
help: Remove unused import: `pathlib.Path`
   |
11 | import time
   - from pathlib import Path
12 |
   |

F401 [*] `pytest` imported but unused
  --> tests\test_self_update.py:14:8
   |
12 | from pathlib import Path
13 |
14 | import pytest
   |        ^^^^^^
15 |
16 | from codewiki.utils import self_update
   |
help: Remove unused import: `pytest`
   |
13 |
   - import pytest
14 |
   |

Found 2 errors.
[*] 2 fixable with the `--fix` option.
unformatted: File would be reformatted
   --> codewiki\cli\commands\sync_commands.py:154:15
    |
153 | @click.command(name="sync-commands")
    - @click.option("--lang", type=click.Choice(["zh", "en"]), default=None,
    -               help="命令文件语言（文件名+标题/描述）；默认按 i18n 解析（config.lang > CODEWIKI_LANG > OS locale > zh）")
    - @click.option("--ide", type=str, default=None,
    -               help="显式指定宿主 IDE（如 qoder/trae）；默认枚举仓库根 IDE 配置目录，排除 codebuddy")
154 + @click.option(
155 +     "--lang",
156 +     type=click.Choice(["zh", "en"]),
157 +     default=None,
158 +     help="命令文件语言（文件名+标题/描述）；默认按 i18n 解析（config.lang > CODEWIKI_LANG > OS locale > zh）",
159 + )
160 + @click.option(
161 +     "--ide",
162 +     type=str,
163 +     default=None,
164 +     help="显式指定宿主 IDE（如 qoder/trae）；默认枚举仓库根 IDE 配置目录，排除 codebuddy",
165 + )
166 | @click.option("--dry-run", is_flag=True, help="只预览目标与文件清单，不写盘")
--------------------------------------------------------------------------------
185 |     click.secho(f"Target repo: {repo_path}", fg="blue", bold=True)
    -     click.echo(f"Language: {current} | Prompts: {len(rendered)} | "
    -                f"Targets: {', '.join(targets)}" + (" | DRY-RUN" if dry_run else ""))
186 +     click.echo(
187 +         f"Language: {current} | Prompts: {len(rendered)} | "
188 +         f"Targets: {', '.join(targets)}" + (" | DRY-RUN" if dry_run else "")
189 +     )
190 |
    |

unformatted: File would be reformatted
   --> codewiki\utils\self_update.py:72:31
    |
71  |         STATE_DIR.mkdir(parents=True, exist_ok=True)
    -         STATE_FILE.write_text(
    -             json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8"
    -         )
72  +         STATE_FILE.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")
73  |     except OSError:
--------------------------------------------------------------------------------
346 |         subprocess.Popen(
    -             [sys.executable, str(script_path), str(STATE_FILE), PACKAGE_NAME,
    -              __version__, str(WAIT_FOR_EXIT_TIMEOUT)],
    -             stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
    -             stderr=subprocess.DEVNULL, **kwargs,
347 +             [
348 +                 sys.executable,
349 +                 str(script_path),
350 +                 str(STATE_FILE),
351 +                 PACKAGE_NAME,
352 +                 __version__,
353 +                 str(WAIT_FOR_EXIT_TIMEOUT),
354 +             ],
355 +             stdin=subprocess.DEVNULL,
356 +             stdout=subprocess.DEVNULL,
357 +             stderr=subprocess.DEVNULL,
358 +             **kwargs,
359 |         )
--------------------------------------------------------------------------------
381 |             subprocess.run(
    -                 [sys.executable, "-m", "pip", "install", "--force-reinstall",
    -                  f"{PACKAGE_NAME}=={meta_v}"],
    -                 capture_output=True, timeout=1800,
382 +                 [
383 +                     sys.executable,
384 +                     "-m",
385 +                     "pip",
386 +                     "install",
387 +                     "--force-reinstall",
388 +                     f"{PACKAGE_NAME}=={meta_v}",
389 +                 ],
390 +                 capture_output=True,
391 +                 timeout=1800,
392 |             )
--------------------------------------------------------------------------------
498 |         r = subprocess.run(
    -             [sys.executable, "-m", "pip", "install", "--upgrade",
    -              f"{PACKAGE_NAME}=={latest}"],
499 +             [sys.executable, "-m", "pip", "install", "--upgrade", f"{PACKAGE_NAME}=={latest}"],
500 |         )
    |

unformatted: File would be reformatted
  --> tests\test_init_wiki.py:32:18
   |
31 |     schema = repo / "repowiki" / "schema.yaml"
   -     customized = "purpose: \"my custom purpose 自定义\""
   -     schema.write_text(schema.read_text(encoding="utf-8").replace("purpose: \"\"", customized, 1), encoding="utf-8")
32 +     customized = 'purpose: "my custom purpose 自定义"'
33 +     schema.write_text(
34 +         schema.read_text(encoding="utf-8").replace('purpose: ""', customized, 1), encoding="utf-8"
35 +     )
36 |
--------------------------------------------------------------------------------
47 |     # 预置一个"已自定义"的 schema.yaml
   -     (dest / "schema.yaml").write_text("purpose: \"keep me\"\n", encoding="utf-8")
48 +     (dest / "schema.yaml").write_text('purpose: "keep me"\n', encoding="utf-8")
49 |
   |

unformatted: File would be reformatted
   --> tests\test_self_update.py:65:47
    |
64  |         monkeypatch.setattr(self_update, "STATE_DIR", tmp_path)
    -         (tmp_path / "config.json").write_text(
    -             json.dumps({"autoupdate": False}), encoding="utf-8"
    -         )
65  +         (tmp_path / "config.json").write_text(json.dumps({"autoupdate": False}), encoding="utf-8")
66  |         assert self_update._autoupdate_disabled() is True
--------------------------------------------------------------------------------
205 |         monkeypatch.setattr(
    -             self_update, "_health_check_if_needed", lambda: (_ for _ in ()).throw(RuntimeError("boom"))
206 +             self_update,
207 +             "_health_check_if_needed",
208 +             lambda: (_ for _ in ()).throw(RuntimeError("boom")),
209 |         )
--------------------------------------------------------------------------------
233 |         self_update._write_state({"last_result": "upgraded"})
    -         monkeypatch.setattr(
    -             "subprocess.run", lambda *a, **kw: type("R", (), {"returncode": 0})()
    -         )
234 +         monkeypatch.setattr("subprocess.run", lambda *a, **kw: type("R", (), {"returncode": 0})())
235 |         self_update._health_check_if_needed()
    |

4 files would be reformatted, 1185 files already formatted
