nai-xiaolong-codex-pet 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/bin/cli.js +123 -0
- package/package.json +35 -0
- package/pet/pet.json +6 -0
- package/pet/spritesheet.webp +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andonis75
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# 奶小龙 Codex 桌宠
|
|
2
|
+
|
|
3
|
+
奶小龙是一个给 Codex Desktop 用的自定义桌宠。它会出现在 Codex 的 Pets 功能里,根据 Codex 的空闲、等待、工作、审查、失败等状态切换动作。
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
它不是独立桌宠软件,需要先安装 Codex Desktop。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
### 方式一:npx
|
|
12
|
+
|
|
13
|
+
如果你安装了 Node.js,可以直接运行:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx nai-xiaolong-codex-pet install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
然后打开 Codex:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
Settings -> Appearance -> Pets -> Refresh -> Select 奶小龙 -> Wake Pet
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 方式二:下载 zip
|
|
26
|
+
|
|
27
|
+
下载 Release 里的 `nai-xiaolong-codex-pet-v1.0.0.zip`,解压后在 PowerShell 里运行:
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
powershell -ExecutionPolicy Bypass -File .\install.ps1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
然后打开 Codex:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
Settings -> Appearance -> Pets -> Refresh -> Select 奶小龙 -> Wake Pet
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
中文界面一般是:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
设置 -> 外观 -> Pets -> 刷新 -> 选择 奶小龙 -> Wake Pet
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 更新
|
|
46
|
+
|
|
47
|
+
下载新版 Release,重新运行 `install.ps1` 即可。脚本会在覆盖前保留旧版本备份。
|
|
48
|
+
|
|
49
|
+
## 卸载
|
|
50
|
+
|
|
51
|
+
如果是用 npx 安装的,可以运行:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx nai-xiaolong-codex-pet uninstall
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
在解压目录运行:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
powershell -ExecutionPolicy Bypass -File .\uninstall.ps1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
脚本会把已安装目录移动为备份,不会删除你的其他 Codex 文件。
|
|
64
|
+
|
|
65
|
+
## 文件结构
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
pet/
|
|
69
|
+
pet.json
|
|
70
|
+
spritesheet.webp
|
|
71
|
+
install.ps1
|
|
72
|
+
uninstall.ps1
|
|
73
|
+
README.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 兼容性
|
|
77
|
+
|
|
78
|
+
当前宠物包遵循 Codex Desktop 自定义宠物图集格式:
|
|
79
|
+
|
|
80
|
+
- 图集尺寸:`1536x1872`
|
|
81
|
+
- 网格:`8 列 x 9 行`
|
|
82
|
+
- 单格:`192x208`
|
|
83
|
+
- 背景:透明
|
|
84
|
+
|
|
85
|
+
## 说明
|
|
86
|
+
|
|
87
|
+
如果安装后没有看到奶小龙,先重启 Codex,或在 Pets 设置页点击 Refresh。
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const petId = "nai-xiaolong";
|
|
8
|
+
const displayName = "奶小龙";
|
|
9
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
10
|
+
const sourceDir = path.join(packageRoot, "pet");
|
|
11
|
+
const targetRoot = path.join(os.homedir(), ".codex", "pets");
|
|
12
|
+
const targetDir = path.join(targetRoot, petId);
|
|
13
|
+
|
|
14
|
+
function usage() {
|
|
15
|
+
console.log(`奶小龙 Codex Pet
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
npx nai-xiaolong-codex-pet install
|
|
19
|
+
npx nai-xiaolong-codex-pet uninstall
|
|
20
|
+
|
|
21
|
+
After install:
|
|
22
|
+
Codex -> Settings -> Appearance -> Pets -> Refresh -> Select ${displayName} -> Wake Pet
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function copyDir(src, dest) {
|
|
27
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
28
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
29
|
+
const srcPath = path.join(src, entry.name);
|
|
30
|
+
const destPath = path.join(dest, entry.name);
|
|
31
|
+
if (entry.isDirectory()) {
|
|
32
|
+
copyDir(srcPath, destPath);
|
|
33
|
+
} else {
|
|
34
|
+
fs.copyFileSync(srcPath, destPath);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function removeDir(dir) {
|
|
40
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function timestamp() {
|
|
44
|
+
const d = new Date();
|
|
45
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
46
|
+
return [
|
|
47
|
+
d.getFullYear(),
|
|
48
|
+
pad(d.getMonth() + 1),
|
|
49
|
+
pad(d.getDate()),
|
|
50
|
+
"-",
|
|
51
|
+
pad(d.getHours()),
|
|
52
|
+
pad(d.getMinutes()),
|
|
53
|
+
pad(d.getSeconds()),
|
|
54
|
+
].join("");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ensureSource() {
|
|
58
|
+
for (const file of ["pet.json", "spritesheet.webp"]) {
|
|
59
|
+
const filePath = path.join(sourceDir, file);
|
|
60
|
+
if (!fs.existsSync(filePath)) {
|
|
61
|
+
throw new Error(`Missing package asset: ${filePath}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function install() {
|
|
67
|
+
ensureSource();
|
|
68
|
+
fs.mkdirSync(targetRoot, { recursive: true });
|
|
69
|
+
|
|
70
|
+
if (fs.existsSync(targetDir)) {
|
|
71
|
+
const backupDir = `${targetDir}.backup-${timestamp()}`;
|
|
72
|
+
fs.cpSync(targetDir, backupDir, { recursive: true });
|
|
73
|
+
removeDir(targetDir);
|
|
74
|
+
console.log(`Existing installation backed up to: ${backupDir}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
copyDir(sourceDir, targetDir);
|
|
78
|
+
console.log(`Installed ${displayName} Codex pet.`);
|
|
79
|
+
console.log(`Path: ${targetDir}`);
|
|
80
|
+
console.log("");
|
|
81
|
+
console.log("Next:");
|
|
82
|
+
console.log(`1. Restart Codex, or open Settings -> Appearance -> Pets and click Refresh.`);
|
|
83
|
+
console.log(`2. Select ${displayName}.`);
|
|
84
|
+
console.log("3. Click Wake Pet.");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function uninstall() {
|
|
88
|
+
if (!fs.existsSync(targetDir)) {
|
|
89
|
+
console.log(`${displayName} is not installed at: ${targetDir}`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const removedDir = `${targetDir}.removed-${timestamp()}`;
|
|
93
|
+
fs.renameSync(targetDir, removedDir);
|
|
94
|
+
console.log(`Removed ${displayName} Codex pet.`);
|
|
95
|
+
console.log(`Backup kept at: ${removedDir}`);
|
|
96
|
+
console.log("Restart Codex or refresh the Pets settings page.");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function main() {
|
|
100
|
+
const command = process.argv[2] || "install";
|
|
101
|
+
if (command === "install") {
|
|
102
|
+
install();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (command === "uninstall" || command === "remove") {
|
|
106
|
+
uninstall();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (command === "help" || command === "--help" || command === "-h") {
|
|
110
|
+
usage();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
console.error(`Unknown command: ${command}`);
|
|
114
|
+
usage();
|
|
115
|
+
process.exitCode = 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
main();
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
122
|
+
process.exitCode = 1;
|
|
123
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nai-xiaolong-codex-pet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Codex desktop pet: 奶小龙",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Andonis75",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"bin": {
|
|
9
|
+
"nai-xiaolong-codex-pet": "bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"pet",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Andonis75/nai-xiaolong-codex-pet.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/Andonis75/nai-xiaolong-codex-pet/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/Andonis75/nai-xiaolong-codex-pet#readme",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"codex",
|
|
27
|
+
"codex-pet",
|
|
28
|
+
"desktop-pet",
|
|
29
|
+
"pet",
|
|
30
|
+
"nai-xiaolong"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"pack:check": "npm pack --dry-run"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/pet/pet.json
ADDED
|
Binary file
|