cc-pets 2.1.2 → 2.2.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/CHANGELOG.md +17 -0
- package/CHANGELOG.zh-CN.md +17 -0
- package/CONTRIBUTING.md +54 -0
- package/CONTRIBUTING.zh-CN.md +45 -0
- package/README.md +31 -26
- package/README.zh-CN.md +22 -16
- package/Resources/Info.plist +3 -1
- package/Resources/en.lproj/InfoPlist.strings +1 -0
- package/Resources/phrases.default.en.txt +182 -0
- package/Resources/zh-Hans.lproj/InfoPlist.strings +1 -0
- package/Resources/zh-Hans.lproj/Localizable.strings +332 -0
- package/Sources/CCPets/CCPetsAppDelegate+AgentStatus.m +28 -28
- package/Sources/CCPets/CCPetsAppDelegate+Bridge.m +16 -14
- package/Sources/CCPets/CCPetsAppDelegate+Pets.m +7 -9
- package/Sources/CCPets/CCPetsAppDelegate+Private.h +3 -0
- package/Sources/CCPets/CCPetsAppDelegate+Settings.m +25 -4
- package/Sources/CCPets/CCPetsAppDelegate+Speech.m +1 -1
- package/Sources/CCPets/CCPetsAppDelegate+Update.m +36 -35
- package/Sources/CCPets/CCPetsAppDelegate.m +20 -14
- package/Sources/CCPets/CCPetsCleanup.m +9 -6
- package/Sources/CCPets/CCPetsEvents.m +4 -3
- package/Sources/CCPets/CCPetsL10n.h +55 -0
- package/Sources/CCPets/CCPetsL10n.m +219 -0
- package/Sources/CCPets/CCPetsPhrases.h +7 -1
- package/Sources/CCPets/CCPetsPhrases.m +86 -31
- package/Sources/CCPets/CCPetsPhrasesEditor.m +62 -64
- package/Sources/CCPets/CCPetsPreviews.m +7 -6
- package/Sources/CCPets/CCPetsVersion.h +7 -4
- package/Sources/CCPets/CCPetsVersion.m +14 -6
- package/Sources/CCPets/MenuToggleSwitch.m +3 -2
- package/Sources/CCPets/PetView.m +103 -74
- package/Sources/CCPets/QuotaDashboardView.m +122 -85
- package/Sources/CCPets/main.m +3 -1
- package/bin/cc-pets +21 -22
- package/bin/claude-with-pet +2 -1
- package/bin/codex-with-pet +2 -1
- package/package.json +3 -2
- package/scripts/bridge/cli.mjs +39 -38
- package/scripts/bridge/core.mjs +27 -26
- package/scripts/bridge/hook.mjs +7 -6
- package/scripts/bridge/install.mjs +24 -23
- package/scripts/bridge/mcp-server.mjs +79 -71
- package/scripts/bridge/options.mjs +7 -6
- package/scripts/bridge/reservations.mjs +6 -5
- package/scripts/bridge/store.mjs +10 -9
- package/scripts/build.sh +24 -5
- package/scripts/check-l10n.mjs +168 -0
- package/scripts/configure-updater.mjs +4 -3
- package/scripts/doctor.mjs +93 -79
- package/scripts/i18n.mjs +122 -0
- package/scripts/i18n.zsh +66 -0
- package/scripts/install-app.sh +3 -2
- package/scripts/install-claude-hooks.mjs +10 -9
- package/scripts/install-codex-hooks.mjs +7 -6
- package/scripts/install-shell-integration.sh +6 -5
- package/scripts/locales/zh-Hans.json +366 -0
- package/scripts/pet-store.mjs +45 -44
- package/scripts/uninstall-app.sh +4 -3
- package/scripts/uninstall-integrations.mjs +8 -7
- package/scripts/uninstall-shell-integration.sh +8 -7
- /package/Resources/{phrases.default.txt → phrases.default.zh-Hans.txt} +0 -0
package/scripts/pet-store.mjs
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import path from "node:path";
|
|
14
|
+
import { t } from "./i18n.mjs";
|
|
14
15
|
|
|
15
16
|
// 一个源的完整定义就是这几项。以后接自建 registry 时在这里加一行即可,
|
|
16
17
|
// 命令、目录结构和桌宠端都不用动。
|
|
@@ -40,7 +41,7 @@ const USER_AGENT = (() => {
|
|
|
40
41
|
})();
|
|
41
42
|
|
|
42
43
|
// 不能 add、只会出现在已装素材里的来源。桌宠的"导入 Codex 素材"开关会写 source: "codex"。
|
|
43
|
-
const LOCAL_SOURCE_LABELS = { codex: "Codex
|
|
44
|
+
const LOCAL_SOURCE_LABELS = { codex: t("Codex (imported)") };
|
|
44
45
|
const DEFAULT_SOURCE = process.env.CC_PETS_SOURCE || "petdex";
|
|
45
46
|
const SIDECAR_NAME = ".source.json";
|
|
46
47
|
const MANIFEST_TTL_MS = 6 * 60 * 60 * 1000;
|
|
@@ -86,7 +87,7 @@ function parseSpec(spec) {
|
|
|
86
87
|
const source = spec.slice(0, separator);
|
|
87
88
|
const slug = spec.slice(separator + 1);
|
|
88
89
|
if (!SOURCES[source]) {
|
|
89
|
-
fail(
|
|
90
|
+
fail(t('Unknown pet source "{source}". Available sources: {SOURCES}', { source, SOURCES: Object.keys(SOURCES).join(", ") }));
|
|
90
91
|
}
|
|
91
92
|
return { source, slug };
|
|
92
93
|
}
|
|
@@ -108,9 +109,9 @@ async function fetchManifest(sourceName, { refresh }) {
|
|
|
108
109
|
redirect: "follow",
|
|
109
110
|
headers: { "User-Agent": USER_AGENT }
|
|
110
111
|
});
|
|
111
|
-
if (!response.ok) fail(
|
|
112
|
+
if (!response.ok) fail(t("Failed to fetch the {label} pet list: HTTP {status}", { label: SOURCES[sourceName].label, status: response.status }));
|
|
112
113
|
const body = await response.json();
|
|
113
|
-
if (!Array.isArray(body?.pets)) fail(
|
|
114
|
+
if (!Array.isArray(body?.pets)) fail(t("The {label} pet list has an unexpected format", { label: SOURCES[sourceName].label }));
|
|
114
115
|
fs.mkdirSync(path.dirname(cache), { recursive: true });
|
|
115
116
|
fs.writeFileSync(cache, JSON.stringify(body));
|
|
116
117
|
return body.pets;
|
|
@@ -121,15 +122,15 @@ async function download(url, source) {
|
|
|
121
122
|
try {
|
|
122
123
|
parsed = new URL(url);
|
|
123
124
|
} catch {
|
|
124
|
-
throw new Error(
|
|
125
|
+
throw new Error(t("Invalid pet URL: {url}", { url }));
|
|
125
126
|
}
|
|
126
127
|
if (parsed.protocol !== "https:" || !source.assetHosts.includes(parsed.hostname)) {
|
|
127
|
-
throw new Error(
|
|
128
|
+
throw new Error(t("Untrusted pet source: {url}", { url: parsed.hostname || url }));
|
|
128
129
|
}
|
|
129
130
|
const response = await fetch(parsed, {
|
|
130
131
|
headers: { Referer: source.referer, "User-Agent": USER_AGENT }
|
|
131
132
|
});
|
|
132
|
-
if (!response.ok) throw new Error(
|
|
133
|
+
if (!response.ok) throw new Error(t("Download failed {pathname} -> HTTP {status}", { pathname: parsed.pathname, status: response.status }));
|
|
133
134
|
return Buffer.from(await response.arrayBuffer());
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -147,16 +148,16 @@ function assertInstallable(directory, sourceName, localName) {
|
|
|
147
148
|
if (!fs.existsSync(directory)) return;
|
|
148
149
|
const sidecar = readSidecar(directory);
|
|
149
150
|
if (sidecar?.source === sourceName) return;
|
|
150
|
-
const owner = sidecar ?
|
|
151
|
+
const owner = sidecar ? t("came from {source}", { source: sidecar.source }) : t("wasn't installed by cc-pets pet (no source record)");
|
|
151
152
|
throw new Error(
|
|
152
|
-
|
|
153
|
+
t("{localName} already exists and {owner}. Install it under another name: ", { localName, owner }) +
|
|
153
154
|
`cc-pets pet add ${sourceName}:${localName} --as ${localName}-${sourceName}`
|
|
154
155
|
);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
async function installPet(pet, sourceName, localName) {
|
|
158
159
|
const source = SOURCES[sourceName];
|
|
159
|
-
if (!isSafeSlug(pet.slug)) throw new Error(
|
|
160
|
+
if (!isSafeSlug(pet.slug)) throw new Error(t("Invalid pet name: {slug}", { slug: pet.slug }));
|
|
160
161
|
const directory = path.join(petsRoot(), localName);
|
|
161
162
|
assertInstallable(directory, sourceName, localName);
|
|
162
163
|
|
|
@@ -201,16 +202,16 @@ async function commandAdd(args) {
|
|
|
201
202
|
const refresh = args.includes("--refresh");
|
|
202
203
|
const asIndex = args.indexOf("--as");
|
|
203
204
|
const alias = asIndex === -1 ? null : args[asIndex + 1];
|
|
204
|
-
if (asIndex !== -1 && (!alias || alias.startsWith("--"))) fail("--as
|
|
205
|
-
if (alias && !isSafeLocalName(alias)) fail(
|
|
205
|
+
if (asIndex !== -1 && (!alias || alias.startsWith("--"))) fail(t("--as needs a name after it."));
|
|
206
|
+
if (alias && !isSafeLocalName(alias)) fail(t("Invalid --as name: {alias}", { alias }));
|
|
206
207
|
|
|
207
208
|
// asIndex 为 -1 时 asIndex + 1 是 0,会把第一个位置参数当成 --as 的取值吃掉。
|
|
208
209
|
const aliasValueIndex = asIndex === -1 ? -1 : asIndex + 1;
|
|
209
210
|
const positional = args.filter(
|
|
210
211
|
(value, index) => !value.startsWith("--") && index !== aliasValueIndex);
|
|
211
212
|
const specs = [...new Set(positional)];
|
|
212
|
-
if (specs.length === 0) fail(
|
|
213
|
-
if (alias && specs.length > 1) fail("--as
|
|
213
|
+
if (specs.length === 0) fail(t("Usage: {cyan}", { cyan: cyan(t("cc-pets pet add [source:]<name> [name...] [--as <local-name>]")) }));
|
|
214
|
+
if (alias && specs.length > 1) fail(t("--as can only rename one pet at a time."));
|
|
214
215
|
|
|
215
216
|
// 按源分组,同一个源只拉一次清单。
|
|
216
217
|
const wanted = specs.map(parseSpec);
|
|
@@ -229,7 +230,7 @@ async function commandAdd(args) {
|
|
|
229
230
|
const pet = index.get(slug);
|
|
230
231
|
if (!pet) {
|
|
231
232
|
failed += 1;
|
|
232
|
-
console.error(
|
|
233
|
+
console.error(t("{red} {sourceName}:{slug}: not in the pet list", { red: red("×"), sourceName, slug }));
|
|
233
234
|
continue;
|
|
234
235
|
}
|
|
235
236
|
const localName = alias ?? slug;
|
|
@@ -246,8 +247,8 @@ async function commandAdd(args) {
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
if (installed > 0) {
|
|
249
|
-
console.log(dim(
|
|
250
|
-
console.log(dim("
|
|
250
|
+
console.log(dim(t("Pets directory: {petsRoot}", { petsRoot: petsRoot() })));
|
|
251
|
+
console.log(dim(t("Click “Rescan” in the pet menu or restart the pet to see new pets.")));
|
|
251
252
|
}
|
|
252
253
|
if (failed > 0) process.exit(1);
|
|
253
254
|
}
|
|
@@ -267,23 +268,23 @@ async function commandSearch(args) {
|
|
|
267
268
|
? pets
|
|
268
269
|
: pets.filter((pet) =>
|
|
269
270
|
`${pet.slug} ${pet.displayName ?? ""} ${pet.submittedBy ?? ""}`.toLowerCase().includes(keyword));
|
|
270
|
-
if (matched.length === 0) fail(
|
|
271
|
+
if (matched.length === 0) fail(t('No pets on {label} match "{keyword}".', { label: SOURCES[sourceName].label, keyword }));
|
|
271
272
|
const shown = matched.slice(0, 60);
|
|
272
273
|
for (const pet of shown) {
|
|
273
274
|
const author = pet.submittedBy ? dim(` by ${pet.submittedBy}`) : "";
|
|
274
275
|
console.log(` ${cyan(pet.slug)} ${pet.displayName ?? ""}${author}`);
|
|
275
276
|
}
|
|
276
277
|
if (matched.length > shown.length) {
|
|
277
|
-
console.log(dim(
|
|
278
|
+
console.log(dim(t(" … {length} results, showing the first {shown}.", { length: matched.length, shown: shown.length })));
|
|
278
279
|
}
|
|
279
|
-
console.log(dim(
|
|
280
|
+
console.log(dim(t("Install one: cc-pets pet add {sourceName}:{slug}", { sourceName, slug: shown[0].slug })));
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
function commandList() {
|
|
283
284
|
const pets = installedPets();
|
|
284
285
|
if (pets.length === 0) {
|
|
285
|
-
console.log(dim(
|
|
286
|
-
console.log(dim("
|
|
286
|
+
console.log(dim(t("No pets in {petsRoot} yet.", { petsRoot: petsRoot() })));
|
|
287
|
+
console.log(dim(t("Try: cc-pets pet add boba")));
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
290
|
const groups = new Map();
|
|
@@ -300,7 +301,7 @@ function commandList() {
|
|
|
300
301
|
});
|
|
301
302
|
for (const key of keys) {
|
|
302
303
|
const label = key === "__unknown__"
|
|
303
|
-
? "
|
|
304
|
+
? t("Local pets (no source record)")
|
|
304
305
|
: SOURCES[key]?.label ?? LOCAL_SOURCE_LABELS[key] ?? key;
|
|
305
306
|
console.log(` ${label}`);
|
|
306
307
|
for (const pet of groups.get(key)) {
|
|
@@ -309,38 +310,38 @@ function commandList() {
|
|
|
309
310
|
console.log(` ${cyan(pet.name)}${origin}`);
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
|
-
console.log(dim(
|
|
313
|
+
console.log(dim(t("{length} in total, in {petsRoot}", { length: pets.length, petsRoot: petsRoot() })));
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
function commandRemove(args) {
|
|
316
317
|
const names = args.filter((value) => !value.startsWith("--"));
|
|
317
|
-
if (names.length === 0) fail(
|
|
318
|
+
if (names.length === 0) fail(t("Usage: {cyan}", { cyan: cyan(t("cc-pets pet remove <name> [name...]")) }));
|
|
318
319
|
const root = petsRoot();
|
|
319
320
|
let removed = 0;
|
|
320
321
|
for (const name of names) {
|
|
321
322
|
if (!isSafeLocalName(name)) {
|
|
322
|
-
console.error(
|
|
323
|
+
console.error(t("{red} {name}: invalid name", { red: red("×"), name }));
|
|
323
324
|
continue;
|
|
324
325
|
}
|
|
325
326
|
const directory = path.join(root, name);
|
|
326
327
|
if (!fs.existsSync(directory)) {
|
|
327
|
-
console.error(
|
|
328
|
+
console.error(t("{red} {name}: not installed", { red: red("×"), name }));
|
|
328
329
|
continue;
|
|
329
330
|
}
|
|
330
331
|
const sidecar = readSidecar(directory);
|
|
331
332
|
fs.rmSync(directory, { recursive: true, force: true });
|
|
332
333
|
removed += 1;
|
|
333
|
-
console.log(
|
|
334
|
+
console.log(t("{green} Removed {name}{source}", { green: green("✓"), name, source: sidecar ? dim(t(" (from {source})", { source: sidecar.source })) : "" }));
|
|
334
335
|
}
|
|
335
336
|
if (removed < names.length) process.exit(1);
|
|
336
337
|
}
|
|
337
338
|
|
|
338
339
|
function commandSource() {
|
|
339
340
|
for (const [name, source] of Object.entries(SOURCES)) {
|
|
340
|
-
const marker = name === DEFAULT_SOURCE ? green(" (
|
|
341
|
+
const marker = name === DEFAULT_SOURCE ? green(t(" (default)")) : "";
|
|
341
342
|
console.log(` ${cyan(name)}${marker} ${source.label} ${dim(source.homepage)}`);
|
|
342
343
|
}
|
|
343
|
-
console.log(dim("
|
|
344
|
+
console.log(dim(t("Change the default source with CC_PETS_SOURCE, or prefix a name with `source:`.")));
|
|
344
345
|
}
|
|
345
346
|
|
|
346
347
|
function commandDir() {
|
|
@@ -352,31 +353,31 @@ function commandDir() {
|
|
|
352
353
|
function usage() {
|
|
353
354
|
console.log([
|
|
354
355
|
"",
|
|
355
|
-
|
|
356
|
+
t(" {cyan} — install pets into cc-pets' own directory", { cyan: cyan("cc-pets pet") }),
|
|
356
357
|
"",
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
t(" {cyan} [source:]<name>... download pets to {petsRoot}", { cyan: cyan("add"), petsRoot: dim(petsRoot()) }),
|
|
359
|
+
t(" {cyan} [source:][keyword] search pets (no keyword lists all)", { cyan: cyan("search") }),
|
|
360
|
+
t(" {cyan} list installed pets, grouped by source", { cyan: cyan("list") }),
|
|
361
|
+
t(" {cyan} <name>... remove installed pets", { cyan: cyan("remove") }),
|
|
362
|
+
t(" {cyan} list available sources", { cyan: cyan("source") }),
|
|
363
|
+
t(" {cyan} print the pets directory", { cyan: cyan("dir") }),
|
|
363
364
|
"",
|
|
364
|
-
` ${dim("
|
|
365
|
-
` ${dim("--as
|
|
366
|
-
` ${dim("--refresh
|
|
367
|
-
` ${dim("CC_PETS_PETS_DIR
|
|
365
|
+
` ${dim(t("Names can have a source prefix (petdex:boba); otherwise the default source is used: ") + DEFAULT_SOURCE + t("."))}`,
|
|
366
|
+
` ${dim(t("--as <local-name> installs under another directory name (any language) to avoid name clashes."))}`,
|
|
367
|
+
` ${dim(t("--refresh forces a refresh of the pet list cache (cached for 6 hours by default)."))}`,
|
|
368
|
+
` ${dim(t("CC_PETS_PETS_DIR changes the pets directory; CC_PETS_SOURCE changes the default source."))}`,
|
|
368
369
|
"",
|
|
369
370
|
` ${dim("$")} cc-pets pet search otter`,
|
|
370
371
|
` ${dim("$")} cc-pets pet add boba`,
|
|
371
372
|
` ${dim("$")} cc-pets pet add petdex:boba --as boba-petdex`,
|
|
372
|
-
|
|
373
|
+
t(" {dim} cc-pets pet add boba --as bubble-tea", { dim: dim("$") }),
|
|
373
374
|
""
|
|
374
375
|
].join("\n"));
|
|
375
376
|
}
|
|
376
377
|
|
|
377
378
|
const [command, ...args] = process.argv.slice(2);
|
|
378
379
|
if (!SOURCES[DEFAULT_SOURCE]) {
|
|
379
|
-
fail(
|
|
380
|
+
fail(t('CC_PETS_SOURCE points to an unknown source "{DEFAULT_SOURCE}". Available sources: {SOURCES}', { DEFAULT_SOURCE, SOURCES: Object.keys(SOURCES).join(", ") }));
|
|
380
381
|
}
|
|
381
382
|
switch (command) {
|
|
382
383
|
case "add":
|
|
@@ -408,7 +409,7 @@ switch (command) {
|
|
|
408
409
|
usage();
|
|
409
410
|
break;
|
|
410
411
|
default:
|
|
411
|
-
console.error(red(
|
|
412
|
+
console.error(red(t("Unknown subcommand: {command}", { command })));
|
|
412
413
|
usage();
|
|
413
414
|
process.exit(2);
|
|
414
415
|
}
|
package/scripts/uninstall-app.sh
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/bin/zsh
|
|
2
2
|
set -eu
|
|
3
|
+
source "${0:A:h}/i18n.zsh"
|
|
3
4
|
|
|
4
5
|
APPLICATIONS_DIR="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}"
|
|
5
6
|
TARGET_APP="${APPLICATIONS_DIR}/CC Pets.app"
|
|
@@ -9,7 +10,7 @@ if [[ -e "${TARGET_APP}" ]]; then
|
|
|
9
10
|
BUNDLE_ID="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' \
|
|
10
11
|
"${TARGET_APP}/Contents/Info.plist" 2>/dev/null || true)"
|
|
11
12
|
if [[ "${BUNDLE_ID}" != "com.universewang.cc-pets" ]]; then
|
|
12
|
-
print -u2 "
|
|
13
|
+
print -u2 "$(cc_pets_t "Refusing to delete: {targetApp} isn't the CC Pets app (bundle ID mismatch)." targetApp="${TARGET_APP}")"
|
|
13
14
|
exit 2
|
|
14
15
|
fi
|
|
15
16
|
fi
|
|
@@ -20,7 +21,7 @@ fi
|
|
|
20
21
|
|
|
21
22
|
if [[ -e "${TARGET_APP}" ]]; then
|
|
22
23
|
rm -rf "${TARGET_APP}"
|
|
23
|
-
print "
|
|
24
|
+
print "$(cc_pets_t "App removed: {targetApp}" targetApp="${TARGET_APP}")"
|
|
24
25
|
else
|
|
25
|
-
print "
|
|
26
|
+
print "$(cc_pets_t "App not installed: {targetApp}" targetApp="${TARGET_APP}")"
|
|
26
27
|
fi
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
STATUS_LINE_MARKER, STATUS_LINE_START_MARKER, isManagedHookCommand, isManagedStatusLine,
|
|
10
10
|
resolveStatusLineScript
|
|
11
11
|
} from "./integration-markers.mjs";
|
|
12
|
+
import { t } from "./i18n.mjs";
|
|
12
13
|
|
|
13
14
|
const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
|
|
14
15
|
const claudeHome = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude");
|
|
@@ -85,7 +86,7 @@ function updateJSON(filePath, updater) {
|
|
|
85
86
|
try {
|
|
86
87
|
config = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
87
88
|
} catch (error) {
|
|
88
|
-
console.error(
|
|
89
|
+
console.error(t("Can't parse {filePath}, left unchanged: {message}", { filePath, message: error.message }));
|
|
89
90
|
process.exitCode = 1;
|
|
90
91
|
return false;
|
|
91
92
|
}
|
|
@@ -194,11 +195,11 @@ if (!preparingInstall) {
|
|
|
194
195
|
bridgeStore.setBridgeEnabled(false);
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
const action = preparingInstall ? "
|
|
198
|
-
if (codexChanged) console.log(
|
|
199
|
-
if (claudeChanged) console.log(
|
|
200
|
-
if (shellChanged) console.log(
|
|
201
|
-
if (shimChanged) console.log(
|
|
198
|
+
const action = preparingInstall ? t("Migrated") : t("Removed");
|
|
199
|
+
if (codexChanged) console.log(t("{action} the CC Pets hooks in {codexHooksPath}.", { action, codexHooksPath }));
|
|
200
|
+
if (claudeChanged) console.log(t("{action} the CC Pets hooks in {claudeSettingsPath} and restored the original status line.", { action, claudeSettingsPath }));
|
|
201
|
+
if (shellChanged) console.log(t("{action} the CC Pets shell integration in {shellRC}.", { action, shellRC }));
|
|
202
|
+
if (shimChanged) console.log(t("{action} the codex / claude shims in {shimDirectory}.", { action, shimDirectory }));
|
|
202
203
|
if (!codexChanged && !claudeChanged && !shellChanged && !shimChanged && !preparingInstall) {
|
|
203
|
-
console.log("
|
|
204
|
+
console.log(t("No CC Pets integrations to remove. "));
|
|
204
205
|
}
|
|
@@ -3,6 +3,7 @@ set -eu
|
|
|
3
3
|
|
|
4
4
|
SCRIPT_DIR="${0:A:h}"
|
|
5
5
|
PROJECT_DIR="${SCRIPT_DIR:h}"
|
|
6
|
+
source "${PROJECT_DIR}/scripts/i18n.zsh"
|
|
6
7
|
SHELL_RC="${ZDOTDIR:-${HOME}}/.zshrc"
|
|
7
8
|
PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
|
|
8
9
|
PET_APP_EXECUTABLE="${PROJECT_DIR}/.build/release/CC Pets.app/Contents/MacOS/cc-pets"
|
|
@@ -18,12 +19,12 @@ done
|
|
|
18
19
|
|
|
19
20
|
if (( PURGE && ! ASSUME_YES )); then
|
|
20
21
|
if [[ ! -t 0 ]]; then
|
|
21
|
-
print -u2 "
|
|
22
|
+
print -u2 "$(cc_pets_t "A full uninstall removes the app, quota history, updater config, logs and preferences (keeping pets and lines in ~/.cc-pets). Add --yes when running non-interactively.")"
|
|
22
23
|
exit 2
|
|
23
24
|
fi
|
|
24
|
-
print -u2 "
|
|
25
|
+
print -u2 "$(cc_pets_t "A full uninstall permanently removes the CC Pets app, quota history, updater config, logs and preferences; pets and lines in ~/.cc-pets are kept. Continue? [y/N] ")"
|
|
25
26
|
if ! read -r reply || [[ "${reply:l}" != "y" && "${reply:l}" != "yes" ]]; then
|
|
26
|
-
print "
|
|
27
|
+
print "$(cc_pets_t "Full uninstall canceled.")"
|
|
27
28
|
exit 0
|
|
28
29
|
fi
|
|
29
30
|
fi
|
|
@@ -46,7 +47,7 @@ if [[ "${CC_PETS_SKIP_APP_STOP:-0}" != "1" ]]; then
|
|
|
46
47
|
sleep 0.1
|
|
47
48
|
done
|
|
48
49
|
if (( running != 0 )); then
|
|
49
|
-
print -u2 "
|
|
50
|
+
print -u2 "$(cc_pets_t "Full uninstall failed: CC Pets didn't quit, so no integrations or local data were removed.")"
|
|
50
51
|
exit 1
|
|
51
52
|
fi
|
|
52
53
|
fi
|
|
@@ -56,13 +57,13 @@ node "${PROJECT_DIR}/scripts/uninstall-integrations.mjs" "${SHELL_RC}"
|
|
|
56
57
|
|
|
57
58
|
if (( PURGE )); then
|
|
58
59
|
if [[ ! -x "${PET_BIN}" ]]; then
|
|
59
|
-
print -u2 "
|
|
60
|
+
print -u2 "$(cc_pets_t "Full uninstall failed: {petBin} not found, so local data wasn't removed." petBin="${PET_BIN}")"
|
|
60
61
|
exit 1
|
|
61
62
|
fi
|
|
62
63
|
"${PET_BIN}" --purge-data
|
|
63
64
|
CC_PETS_SKIP_APP_STOP=1 "${PROJECT_DIR}/scripts/uninstall-app.sh"
|
|
64
|
-
print "
|
|
65
|
+
print "$(cc_pets_t "Full uninstall done. Pets and lines remain in ~/.cc-pets; delete them manually if you no longer need them. If the npm package is still installed, run npm uninstall -g cc-pets.")"
|
|
65
66
|
exit 0
|
|
66
67
|
fi
|
|
67
68
|
|
|
68
|
-
print "
|
|
69
|
+
print "$(cc_pets_t "Integrations removed. Run source {shellRc} to update this terminal; to remove the npm package, run npm uninstall -g cc-pets." shellRc="${(q)SHELL_RC}")"
|
|
File without changes
|