codepet 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/codepet.js +4 -3
  2. package/package.json +1 -1
package/bin/codepet.js CHANGED
@@ -483,9 +483,10 @@ function doPopup() {
483
483
  const escapedScript = script.replace(/'/g, "'\\''");
484
484
  execSync(`osascript -e 'tell application "Terminal" to do script "export HISTFILE=/dev/null && export BASH_SILENCE_DEPRECATION_WARNING=1 && export PS1=\\\"\\\" && clear && ${PYTHON} \\\"${escapedScript}\\\" ${pet.character} ${scene} 40 2>/dev/null && printf \\\"\\\\033[?25l\\\" && cat > /dev/null"' -e 'tell application "Terminal" to activate' &`, { shell: true, stdio: 'ignore' });
485
485
  } else if (process.platform === 'win32') {
486
- // Windows: 弹新 PowerShell 窗口显示彩色像素画拍立得
487
- const script = path.join(__dirname, '..', 'scripts', 'polaroid.py').replace(/\\/g, '\\\\');
488
- const psCmd = `${PYTHON} \\"${script}\\" ${pet.character} ${scene} 40 2>$null; Read-Host`;
486
+ // Windows: 弹新 PowerShell 窗口,自动开启 ANSI 彩色支持
487
+ const script = path.join(__dirname, '..', 'scripts', 'polaroid.py').replace(/\\/g, '/');
488
+ const enableAnsi = `[Console]::OutputEncoding=[Text.Encoding]::UTF8; $Host.UI.RawUI.WindowTitle='📸 Ai小蓝鲸照相馆'; Set-ItemProperty HKCU:\\\\Console VirtualTerminalLevel -Type DWORD -Value 1 -ErrorAction SilentlyContinue;`;
489
+ const psCmd = `${enableAnsi} ${PYTHON} '${script}' ${pet.character} ${scene} 40 2>$null; Read-Host '按回车关闭'`;
489
490
  execSync(`start powershell -NoProfile -Command "${psCmd}"`, { shell: true, stdio: 'ignore' });
490
491
  } else {
491
492
  // Linux: 尝试终端弹窗
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codepet",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "在编程软件里养电子宠物 — 支持 Claude Code / Codex / Cursor / VS Code 等 10+ 平台",
5
5
  "main": "core/index.js",
6
6
  "bin": {