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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "QuotaDashboardView.h"
|
|
2
|
+
#import "CCPetsL10n.h"
|
|
2
3
|
|
|
3
4
|
const CGFloat QuotaLogicalWidth = 760;
|
|
4
5
|
const CGFloat QuotaLogicalHeight = 590;
|
|
@@ -77,7 +78,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
77
78
|
}
|
|
78
79
|
- (NSRect)logicalSummaryRect {
|
|
79
80
|
return NSMakeRect(20, [self logicalHeight] - QuotaHeaderHeight - QuotaSummaryHeight,
|
|
80
|
-
QuotaLogicalWidth - 40, QuotaSummaryHeight);
|
|
81
|
+
QuotaLogicalWidth - 40, QuotaSummaryHeight + 1 / QuotaScale);
|
|
81
82
|
}
|
|
82
83
|
// 刷新时间挪去了右上角,这一版块整宽留给两个统计格,各占一半。
|
|
83
84
|
- (NSRect)logicalSummaryCellRectAtIndex:(NSUInteger)index {
|
|
@@ -116,14 +117,14 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
116
117
|
- (NSDictionary *)comparisonForCurrent:(double)current previous:(double)previous
|
|
117
118
|
color:(NSColor *)color {
|
|
118
119
|
if (previous <= 0) {
|
|
119
|
-
return @{ @"text": current > 0 ? @"
|
|
120
|
+
return @{ @"text": current > 0 ? L(@"vs last month: new") : L(@"vs last month: flat"),
|
|
120
121
|
@"color": current > 0 ? color : self.secondaryColor };
|
|
121
122
|
}
|
|
122
123
|
double change = (current - previous) * 100.0 / previous;
|
|
123
124
|
if (fabs(change) < 0.05) {
|
|
124
|
-
return @{ @"text": @"
|
|
125
|
+
return @{ @"text": L(@"vs last month: flat"), @"color": self.secondaryColor };
|
|
125
126
|
}
|
|
126
|
-
return @{ @"text": [NSString stringWithFormat
|
|
127
|
+
return @{ @"text": [NSString stringWithFormat:L(@"vs last month %@%.1f%%"),
|
|
127
128
|
change > 0 ? @"↑" : @"↓", fabs(change)], @"color": color };
|
|
128
129
|
}
|
|
129
130
|
// 输入取 total - output,而不是把几个 input_* 字段加起来:两家的包含关系是相反的。
|
|
@@ -177,8 +178,8 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
177
178
|
// 原生玻璃下字号更大,完整说明在单元格里放不下,只留起始日期。
|
|
178
179
|
formatter.dateFormat = self.usesLiquidGlass ? @"M/d" : @"yyyy-MM-dd";
|
|
179
180
|
NSString *date = [formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:start.doubleValue]];
|
|
180
|
-
return self.usesLiquidGlass ? [NSString stringWithFormat
|
|
181
|
-
: [NSString stringWithFormat
|
|
181
|
+
return self.usesLiquidGlass ? [NSString stringWithFormat:L(@"Last 7 days (since %@)"), date]
|
|
182
|
+
: [NSString stringWithFormat:L(@"Last 7 days (since %@, rolling)"), date];
|
|
182
183
|
}
|
|
183
184
|
// 在线 = 这一家还有活着的客户端,和有没有额度数据无关:额度会一直缓存着,
|
|
184
185
|
// 拿它当在线信号会恒亮。身份不明的老客户端无法归属到某一家,保守地都算在线。
|
|
@@ -276,12 +277,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
276
277
|
return used ? @(fmax(0, fmin(100, used.doubleValue))) : nil;
|
|
277
278
|
}
|
|
278
279
|
- (NSString *)refreshAgeText {
|
|
279
|
-
if (self.lastUpdatedAt <= 0) return @"
|
|
280
|
+
if (self.lastUpdatedAt <= 0) return L(@"Waiting for data");
|
|
280
281
|
NSTimeInterval age = fmax(0, NSDate.date.timeIntervalSince1970 - self.lastUpdatedAt);
|
|
281
|
-
if (age < 5) return @"
|
|
282
|
-
if (age < 60) return [NSString stringWithFormat
|
|
283
|
-
if (age < 3600) return [NSString stringWithFormat
|
|
284
|
-
return [NSString stringWithFormat
|
|
282
|
+
if (age < 5) return L(@"just now");
|
|
283
|
+
if (age < 60) return [NSString stringWithFormat:L(@"%.0fs ago"), age];
|
|
284
|
+
if (age < 3600) return [NSString stringWithFormat:L(@"%.0fm ago"), floor(age / 60)];
|
|
285
|
+
return [NSString stringWithFormat:L(@"%.0fh ago"), floor(age / 3600)];
|
|
285
286
|
}
|
|
286
287
|
// 原生玻璃下背景可以是任意壁纸,面板按 0.58 缩放后小字只有 6–7pt,细笔画很容易被
|
|
287
288
|
// 背后的纹理吃掉。所以 liquid 模式统一收紧文字:小字放大一点、加粗一级;灰字不低于
|
|
@@ -304,7 +305,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
304
305
|
- (void)drawText:(NSString *)text inRect:(NSRect)rect size:(CGFloat)size
|
|
305
306
|
weight:(NSFontWeight)weight color:(NSColor *)color dotColor:(NSColor *)dotColor {
|
|
306
307
|
if (!self.usesLiquidGlass) {
|
|
307
|
-
|
|
308
|
+
NSMutableDictionary *attributes = [[self textAttributesWithSize:size color:color
|
|
309
|
+
weight:weight] mutableCopy];
|
|
310
|
+
NSMutableParagraphStyle *style = [NSMutableParagraphStyle new];
|
|
311
|
+
style.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
312
|
+
attributes[NSParagraphStyleAttributeName] = style;
|
|
313
|
+
[text drawInRect:rect withAttributes:[self attributes:attributes fittingText:text
|
|
314
|
+
inWidth:NSWidth(rect)]];
|
|
308
315
|
return;
|
|
309
316
|
}
|
|
310
317
|
NSMutableDictionary *attributes = [[self textAttributesWithSize:size color:color
|
|
@@ -313,23 +320,43 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
313
320
|
style.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
314
321
|
attributes[NSParagraphStyleAttributeName] = style;
|
|
315
322
|
NSFont *font = attributes[NSFontAttributeName];
|
|
316
|
-
CGFloat diameter = 9;
|
|
317
|
-
// drawInRect: 从矩形顶部开始排版,圆点对齐到首行小写字母的中线。
|
|
318
|
-
CGFloat baselineMid = NSMaxY(rect) - font.ascender + font.xHeight / 2.0;
|
|
319
|
-
[NSGraphicsContext saveGraphicsState];
|
|
320
|
-
[[NSShadow new] set];
|
|
321
|
-
[dotColor setFill];
|
|
322
|
-
[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(rect), baselineMid - diameter / 2.0,
|
|
323
|
-
diameter, diameter)] fill];
|
|
324
|
-
[NSGraphicsContext restoreGraphicsState];
|
|
325
323
|
NSRect textRect = rect;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
if (dotColor) {
|
|
325
|
+
CGFloat diameter = 9;
|
|
326
|
+
// drawInRect: 从矩形顶部开始排版,圆点对齐到首行小写字母的中线。
|
|
327
|
+
CGFloat baselineMid = NSMaxY(rect) - font.ascender + font.xHeight / 2.0;
|
|
328
|
+
[NSGraphicsContext saveGraphicsState];
|
|
329
|
+
[[NSShadow new] set];
|
|
330
|
+
[dotColor setFill];
|
|
331
|
+
[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(rect), baselineMid - diameter / 2.0,
|
|
332
|
+
diameter, diameter)] fill];
|
|
333
|
+
[NSGraphicsContext restoreGraphicsState];
|
|
334
|
+
textRect.origin.x += diameter + 6;
|
|
335
|
+
textRect.size.width -= diameter + 6;
|
|
336
|
+
}
|
|
337
|
+
[text drawInRect:textRect withAttributes:[self attributes:attributes fittingText:text
|
|
338
|
+
inWidth:NSWidth(textRect)]];
|
|
329
339
|
}
|
|
330
|
-
//
|
|
340
|
+
// 译文长短差得多,固定宽度的格子迟早有放不下的语言。放不下时先把字号往下收,最多收 2pt
|
|
341
|
+
// (liquid 下即从 14 收到 12)——比截成"…"好认;还放不下才交给截断。放得下就原样返回,
|
|
342
|
+
// 中文和多数英文不受影响。
|
|
343
|
+
- (NSDictionary *)attributes:(NSDictionary *)attributes fittingText:(NSString *)text
|
|
344
|
+
inWidth:(CGFloat)width {
|
|
345
|
+
NSFont *font = attributes[NSFontAttributeName];
|
|
346
|
+
if (!font || text.length == 0 || [text sizeWithAttributes:attributes].width <= width) {
|
|
347
|
+
return attributes;
|
|
348
|
+
}
|
|
349
|
+
NSMutableDictionary *fitted = [attributes mutableCopy];
|
|
350
|
+
for (CGFloat size = font.pointSize - 0.5; size >= font.pointSize - 2; size -= 0.5) {
|
|
351
|
+
fitted[NSFontAttributeName] = [NSFont fontWithDescriptor:font.fontDescriptor size:size];
|
|
352
|
+
if ([text sizeWithAttributes:fitted].width <= width) break;
|
|
353
|
+
}
|
|
354
|
+
return fitted;
|
|
355
|
+
}
|
|
356
|
+
// 风险提示只保留文字,和 Max / Now 使用同一条左边界。
|
|
331
357
|
- (void)drawTip:(NSString *)text inRect:(NSRect)rect color:(NSColor *)color {
|
|
332
|
-
|
|
358
|
+
if (text.length == 0) return;
|
|
359
|
+
[self drawText:text inRect:rect size:11 weight:NSFontWeightMedium color:color dotColor:nil];
|
|
333
360
|
}
|
|
334
361
|
- (void)fillLiquidScrim:(NSBezierPath *)path {
|
|
335
362
|
[NSGraphicsContext saveGraphicsState];
|
|
@@ -488,7 +515,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
488
515
|
- (NSDictionary *)paceStatusForQuota:(NSDictionary *)quota currentUsed:(NSNumber *)currentUsed
|
|
489
516
|
color:(NSColor *)providerColor {
|
|
490
517
|
if (!currentUsed) {
|
|
491
|
-
return @{@"label": @"
|
|
518
|
+
return @{@"label": L(@"Not enough data"), @"tip": L(@"Waiting for data"),
|
|
492
519
|
@"color": self.secondaryColor};
|
|
493
520
|
}
|
|
494
521
|
NSNumber *reset = [quota[@"resets_at"] isKindOfClass:NSNumber.class]
|
|
@@ -517,10 +544,10 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
517
544
|
// 四个档位从轻到重排成阶梯,后面的仲裁只在这上面挪档位,不再各写一套 label/tip/color。
|
|
518
545
|
double remaining = 100.0 - currentUsed.doubleValue;
|
|
519
546
|
NSArray<NSArray *> *ladder = @[
|
|
520
|
-
@[@"
|
|
521
|
-
@[@"
|
|
522
|
-
@[@"
|
|
523
|
-
@[@"
|
|
547
|
+
@[L(@"Plenty"), CCPetsLanguageIsSource() ? @"" : L(@"Plenty of quota left"), NSColor.systemGreenColor],
|
|
548
|
+
@[L(@"Steady"), CCPetsLanguageIsSource() ? @"" : L(@"Quota is holding steady"), providerColor],
|
|
549
|
+
@[L(@"Watch"), L(@"Watch usage"), NSColor.systemOrangeColor],
|
|
550
|
+
@[L(@"At risk"), L(@"Quota low"), NSColor.systemRedColor]
|
|
524
551
|
];
|
|
525
552
|
NSUInteger baseRank = remaining >= 70 ? 0
|
|
526
553
|
: (remaining >= 40 ? 1 : (remaining >= 15 ? 2 : 3));
|
|
@@ -531,13 +558,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
531
558
|
if (!isnan(projectedRemaining)) {
|
|
532
559
|
if (remaining <= 5 || projectedRemaining < 0) {
|
|
533
560
|
projectedRank = 3;
|
|
534
|
-
projectedTip = @"
|
|
561
|
+
projectedTip = L(@"Runs out early");
|
|
535
562
|
} else if (projectedRemaining < 10) {
|
|
536
563
|
projectedRank = 2;
|
|
537
|
-
projectedTip = @"
|
|
564
|
+
projectedTip = L(@"Ease off a bit");
|
|
538
565
|
} else if (projectedRemaining >= 30) {
|
|
539
566
|
projectedRank = 0;
|
|
540
|
-
projectedTip = @"
|
|
567
|
+
projectedTip = L(@"Plenty to spare");
|
|
541
568
|
}
|
|
542
569
|
}
|
|
543
570
|
|
|
@@ -555,7 +582,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
555
582
|
|
|
556
583
|
NSString *label = ladder[rank][0];
|
|
557
584
|
NSString *tip = ladder[rank][1];
|
|
558
|
-
if (demotedByFact) tip = @"
|
|
585
|
+
if (demotedByFact) tip = L(@"Burning fast");
|
|
559
586
|
else if (projectedRank >= 0 && rank == (NSUInteger)projectedRank) tip = projectedTip;
|
|
560
587
|
return @{@"label": label, @"tip": tip, @"color": ladder[rank][2]};
|
|
561
588
|
}
|
|
@@ -627,8 +654,8 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
627
654
|
withAttributes:[self textAttributesWithSize:22 color:primary weight:NSFontWeightBold]];
|
|
628
655
|
// 四态:额度被拒 → 额度受限(百分比仍是上次官方快照);没有任何额度数据 → 等待数据;
|
|
629
656
|
// 有数据但客户端已退出 → 离线;两者都有 → 在线。
|
|
630
|
-
NSString *statusText = (!apiMode && exhausted) ? @"
|
|
631
|
-
: (!hasData ? @"
|
|
657
|
+
NSString *statusText = (!apiMode && exhausted) ? L(@"Rate limited")
|
|
658
|
+
: (!hasData ? L(@"Waiting for data") : (online ? L(@"● Online") : L(@"Offline")));
|
|
632
659
|
NSColor *statusColor = (!apiMode && exhausted) ? NSColor.systemOrangeColor
|
|
633
660
|
: (online && hasData ? NSColor.systemGreenColor : secondary);
|
|
634
661
|
if (self.usesLiquidGlass) {
|
|
@@ -648,12 +675,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
648
675
|
if (apiMode) {
|
|
649
676
|
CGFloat callX = NSMinX(card) + 214;
|
|
650
677
|
CGFloat tokenX = NSMinX(card) + 394;
|
|
651
|
-
[@"
|
|
678
|
+
[L(@"Calls this month") drawInRect:NSMakeRect(callX, NSMinY(card) + 114, 130, 20)
|
|
652
679
|
withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
|
|
653
|
-
[@"
|
|
680
|
+
[L(@"Tokens this month") drawInRect:NSMakeRect(tokenX, NSMinY(card) + 114, 130, 20)
|
|
654
681
|
withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
|
|
655
682
|
|
|
656
|
-
NSString *requests = [NSString stringWithFormat
|
|
683
|
+
NSString *requests = [NSString stringWithFormat:L(@"%@ calls"),
|
|
657
684
|
[self formattedRequestCount:monthTokens ?: @{}]];
|
|
658
685
|
[requests drawInRect:NSMakeRect(callX, NSMinY(card) + 75, 150, 34)
|
|
659
686
|
withAttributes:[self textAttributesWithSize:24 color:primary weight:NSFontWeightBold]];
|
|
@@ -667,20 +694,20 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
667
694
|
NSNumber *requestCount = [monthTokens[@"request_count"] isKindOfClass:NSNumber.class]
|
|
668
695
|
? monthTokens[@"request_count"] : nil;
|
|
669
696
|
NSString *average = requestCount
|
|
670
|
-
? [NSString stringWithFormat
|
|
697
|
+
? [NSString stringWithFormat:L(@"%@/day avg"),
|
|
671
698
|
[NSNumberFormatter localizedStringFromNumber:
|
|
672
699
|
@(llround(requestCount.doubleValue / elapsedDays))
|
|
673
700
|
numberStyle:NSNumberFormatterDecimalStyle]]
|
|
674
|
-
: @"
|
|
701
|
+
: L(@"--/day avg");
|
|
675
702
|
[average drawInRect:NSMakeRect(callX, NSMinY(card) + 48, 150, 20)
|
|
676
703
|
withAttributes:[self textAttributesWithSize:12 color:secondary weight:NSFontWeightRegular]];
|
|
677
704
|
|
|
678
705
|
// 这里不再重复"本月消耗"的合计:输入与输出各自的量级才是按量计费时要看的东西,
|
|
679
706
|
// 合计随时可以由这两个数得到,而它原先占掉了最显眼的一行。
|
|
680
707
|
NSArray<NSDictionary *> *splits = @[
|
|
681
|
-
@{@"label": @"
|
|
708
|
+
@{@"label": L(@"Input"), @"value": [self formattedTokenSplit:monthTokens ?: @{}
|
|
682
709
|
wantsOutput:NO], @"y": @(NSMinY(card) + 76)},
|
|
683
|
-
@{@"label": @"
|
|
710
|
+
@{@"label": L(@"Output"), @"value": [self formattedTokenSplit:monthTokens ?: @{}
|
|
684
711
|
wantsOutput:YES], @"y": @(NSMinY(card) + 48)}
|
|
685
712
|
];
|
|
686
713
|
for (NSDictionary *split in splits) {
|
|
@@ -709,17 +736,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
709
736
|
CGFloat trendX = NSMinX(card) + 564;
|
|
710
737
|
// 「按日 Token」跟在标题后面,与标题同一行:它是标题的限定语,单独占一行既浪费
|
|
711
738
|
// 竖向空间,也把曲线和脚注挤得没法与左边两列对齐。
|
|
712
|
-
[@"
|
|
739
|
+
[L(@"Month") drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
|
|
713
740
|
withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
|
|
714
741
|
if (self.usesLiquidGlass) {
|
|
715
|
-
[self drawText
|
|
742
|
+
[self drawText:L(@"Daily tokens") inRect:NSMakeRect(trendX + 62, NSMinY(card) + 114, 96, 20)
|
|
716
743
|
size:11 weight:NSFontWeightSemibold color:color dotColor:color];
|
|
717
744
|
} else {
|
|
718
745
|
NSDictionary *pillAttributes = [self textAttributesWithSize:11 color:color
|
|
719
746
|
weight:NSFontWeightSemibold];
|
|
720
747
|
NSRect pill = NSMakeRect(trendX + 59, NSMinY(card) + 113, 76, 22);
|
|
721
748
|
[self fillRoundedRect:pill radius:11 color:[color colorWithAlphaComponent:0.14]];
|
|
722
|
-
[@"
|
|
749
|
+
[L(@"Daily tokens") drawInRect:NSInsetRect(pill, 9, 3) withAttributes:pillAttributes];
|
|
723
750
|
}
|
|
724
751
|
NSRect curveRect = NSMakeRect(trendX, NSMinY(card) + 62, 135, 38);
|
|
725
752
|
[self drawMonthlyTokenCurve:monthDaily inRect:curveRect color:color];
|
|
@@ -733,17 +760,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
733
760
|
todayTotals = totals;
|
|
734
761
|
}
|
|
735
762
|
NSString *peakText = recordedDays > 0
|
|
736
|
-
? [NSString stringWithFormat
|
|
763
|
+
? [NSString stringWithFormat:L(@"Peak %@"), [self formattedTokenValue:peak]] : L(@"Peak --");
|
|
737
764
|
NSString *todayText = todayTotals
|
|
738
|
-
? [NSString stringWithFormat
|
|
739
|
-
[self formattedTokenValue:[todayTotals[@"total_tokens"] doubleValue]]] : @"
|
|
765
|
+
? [NSString stringWithFormat:L(@"Today %@"),
|
|
766
|
+
[self formattedTokenValue:[todayTotals[@"total_tokens"] doubleValue]]] : L(@"Today --");
|
|
740
767
|
[peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42, 74, 16)
|
|
741
768
|
withAttributes:[self textAttributesWithSize:10 color:secondary weight:NSFontWeightRegular]];
|
|
742
769
|
[todayText drawInRect:NSMakeRect(trendX + 61, NSMinY(card) + 42, 74, 16)
|
|
743
770
|
withAttributes:[self rightAlignedTextAttributesWithSize:10 color:secondary
|
|
744
771
|
weight:NSFontWeightRegular]];
|
|
745
772
|
// 与左边两列的"较上月同期"同一条基线(+22),三列脚注才在一条水平线上。
|
|
746
|
-
[[NSString stringWithFormat
|
|
773
|
+
[[NSString stringWithFormat:L(@"%lu / %lu days recorded"),
|
|
747
774
|
(unsigned long)recordedDays, (unsigned long)monthDaily.count]
|
|
748
775
|
drawInRect:NSMakeRect(trendX, NSMinY(card) + 22, 145, 18)
|
|
749
776
|
withAttributes:[self textAttributesWithSize:11 color:color weight:NSFontWeightMedium]];
|
|
@@ -753,12 +780,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
753
780
|
// 层级:官方剩余额度是订阅限额的权威值,占主位;本机 Token 是参考量,降一级并用
|
|
754
781
|
// 强调色区分;重置时间最小。反过来会让最抢眼的数字恰好是最不该照着做决定的那个。
|
|
755
782
|
NSArray<NSDictionary *> *windows = @[
|
|
756
|
-
@{@"x": @(NSMinX(card) + 214), @"title": @"
|
|
783
|
+
@{@"x": @(NSMinX(card) + 214), @"title": L(@"5h window"), @"quota": five ?: @{},
|
|
757
784
|
@"tokens": fiveTokens ?: @{}, @"used": fiveUsed ?: NSNull.null,
|
|
758
|
-
@"rolling": @"
|
|
759
|
-
@{@"x": @(NSMinX(card) + 394), @"title": @"
|
|
785
|
+
@"rolling": L(@"Waiting for refresh")},
|
|
786
|
+
@{@"x": @(NSMinX(card) + 394), @"title": L(@"7d window"), @"quota": week ?: @{},
|
|
760
787
|
@"tokens": weekTokens ?: @{}, @"used": weekUsed ?: NSNull.null,
|
|
761
|
-
@"rolling": @"
|
|
788
|
+
@"rolling": L(@"Waiting for refresh")}
|
|
762
789
|
];
|
|
763
790
|
for (NSDictionary *window in windows) {
|
|
764
791
|
CGFloat x = [window[@"x"] doubleValue];
|
|
@@ -777,7 +804,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
777
804
|
withAttributes:valueAttributes];
|
|
778
805
|
// 没有数字可标时不给口径标签:"-- 剩余"看起来像一个真实的 0 值,而实际上是
|
|
779
806
|
// 官方快照待刷新。下方的状态文字会说明它为何不可用。
|
|
780
|
-
NSString *valueLabel = !used ? @"" : (exhausted ? @"
|
|
807
|
+
NSString *valueLabel = !used ? @"" : (exhausted ? L(@"Snapshot") : L(@"Left"));
|
|
781
808
|
if (valueLabel.length > 0) {
|
|
782
809
|
[valueLabel drawInRect:NSMakeRect(x + valueWidth + 7, NSMinY(card) + 78, 60, 20)
|
|
783
810
|
withAttributes:[self textAttributesWithSize:12 color:secondary
|
|
@@ -787,13 +814,13 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
787
814
|
// 说清楚这一行的口径,比留一个 `--` 让人以为是渲染坏了要好。
|
|
788
815
|
NSString *resetValue = [self resetText:window[@"quota"]];
|
|
789
816
|
NSString *reset = [resetValue isEqualToString:@"--"]
|
|
790
|
-
? window[@"rolling"] : [NSString stringWithFormat
|
|
817
|
+
? window[@"rolling"] : [NSString stringWithFormat:L(@"Resets %@"), resetValue];
|
|
791
818
|
[reset drawInRect:NSMakeRect(x, NSMinY(card) + 46, 150, 18)
|
|
792
819
|
withAttributes:[self textAttributesWithSize:11 color:secondary weight:NSFontWeightRegular]];
|
|
793
820
|
// 原生玻璃下字更大、前面还有圆点,这一栏放不下"Token"一词;脚注里已说明
|
|
794
821
|
// Token 即本机统计的已用量。
|
|
795
822
|
NSString *tokenText = [NSString stringWithFormat:
|
|
796
|
-
self.usesLiquidGlass ? @"
|
|
823
|
+
self.usesLiquidGlass ? L(@"Used %@") : L(@"Used tokens %@"),
|
|
797
824
|
[self formattedTokenCount:window[@"tokens"]]];
|
|
798
825
|
[self drawText:tokenText inRect:NSMakeRect(x, NSMinY(card) + 22, 150, 22) size:14
|
|
799
826
|
weight:NSFontWeightSemibold color:color dotColor:color];
|
|
@@ -801,7 +828,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
801
828
|
|
|
802
829
|
CGFloat trendX = NSMinX(card) + 564;
|
|
803
830
|
// 与 API 卡同一套骨架:标题行带 pill、中间曲线、脚注和左边两列齐平。
|
|
804
|
-
[@"
|
|
831
|
+
[L(@"Trend") drawInRect:NSMakeRect(trendX, NSMinY(card) + 114, 60, 20)
|
|
805
832
|
withAttributes:[self textAttributesWithSize:13 color:secondary weight:NSFontWeightRegular]];
|
|
806
833
|
NSArray<NSDictionary *> *history = [name isEqualToString:@"Codex"]
|
|
807
834
|
? self.codexHistory : self.claudeHistory;
|
|
@@ -813,7 +840,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
813
840
|
// 矛盾。所以只有 7 天窗口自己确实没有百分比时才退回"待刷新"。
|
|
814
841
|
BOOL weekUnknown = exhausted && currentUsed == nil;
|
|
815
842
|
NSDictionary *pace = weekUnknown
|
|
816
|
-
? @{ @"label": @"
|
|
843
|
+
? @{ @"label": L(@"Stale"), @"tip": L(@"Awaiting refresh"),
|
|
817
844
|
@"color": NSColor.systemOrangeColor }
|
|
818
845
|
: [self paceStatusForQuota:week currentUsed:currentUsed color:color];
|
|
819
846
|
NSColor *paceColor = pace[@"color"];
|
|
@@ -822,7 +849,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
822
849
|
NSString *paceTip = pace[@"tip"];
|
|
823
850
|
NSColor *tipColor = paceColor;
|
|
824
851
|
if (exhausted && !weekUnknown) {
|
|
825
|
-
paceTip = @"
|
|
852
|
+
paceTip = L(@"Limited until reset");
|
|
826
853
|
tipColor = NSColor.systemOrangeColor;
|
|
827
854
|
}
|
|
828
855
|
if (self.usesLiquidGlass) {
|
|
@@ -844,16 +871,17 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
844
871
|
double peak = 0;
|
|
845
872
|
for (NSDictionary *point in points) peak = fmax(peak, [point[@"used"] doubleValue]);
|
|
846
873
|
NSString *peakText = points.count > 0
|
|
847
|
-
? [NSString stringWithFormat
|
|
874
|
+
? [NSString stringWithFormat:L(@"Max %.0f%%"), peak] : L(@"Max --");
|
|
848
875
|
NSString *currentText = currentUsed
|
|
849
|
-
? [NSString stringWithFormat
|
|
850
|
-
[peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42, 72, 16)
|
|
876
|
+
? [NSString stringWithFormat:L(@"Now %.0f%%"), currentUsed.doubleValue] : L(@"Now --");
|
|
877
|
+
[peakText drawInRect:NSMakeRect(trendX, NSMinY(card) + 42 - 2 / QuotaScale, 72, 16)
|
|
851
878
|
withAttributes:[self textAttributesWithSize:10 color:secondary weight:NSFontWeightRegular]];
|
|
852
|
-
[currentText drawInRect:NSMakeRect(trendX + 66, NSMinY(card) + 42, 69, 16)
|
|
879
|
+
[currentText drawInRect:NSMakeRect(trendX + 66, NSMinY(card) + 42 - 2 / QuotaScale, 69, 16)
|
|
853
880
|
withAttributes:[self rightAlignedTextAttributesWithSize:10 color:secondary
|
|
854
881
|
weight:NSFontWeightRegular]];
|
|
855
882
|
// 与左边两列的"已用 Token"同一条基线(+22),也和 API 卡的脚注行对齐。
|
|
856
|
-
[self drawTip:paceTip inRect:NSMakeRect(trendX, NSMinY(card) + 22
|
|
883
|
+
[self drawTip:paceTip inRect:NSMakeRect(trendX, NSMinY(card) + 22 - 2 / QuotaScale,
|
|
884
|
+
145, 18) color:tipColor];
|
|
857
885
|
}
|
|
858
886
|
- (void)drawRect:(NSRect)dirtyRect {
|
|
859
887
|
[NSGraphicsContext saveGraphicsState];
|
|
@@ -923,20 +951,25 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
923
951
|
NSColor *agentColor = self.agentStatusColor;
|
|
924
952
|
[@"Agent Usage" drawInRect:NSMakeRect(28, height - 65, 260, 42)
|
|
925
953
|
withAttributes:[self textAttributesWithSize:30 color:primary weight:NSFontWeightBold]];
|
|
926
|
-
|
|
927
|
-
|
|
954
|
+
NSDictionary *liveStatusAttributes = [self textAttributesWithSize:14 color:secondary
|
|
955
|
+
weight:NSFontWeightRegular];
|
|
956
|
+
NSString *liveStatusText = L(@"Live status");
|
|
957
|
+
[liveStatusText drawInRect:NSMakeRect(30, height - 94, self.usesLiquidGlass ? 142 : 130, 22)
|
|
958
|
+
withAttributes:liveStatusAttributes];
|
|
959
|
+
CGFloat agentIndicatorX = 30 + [liveStatusText sizeWithAttributes:liveStatusAttributes].width + 12;
|
|
928
960
|
[agentColor setFill];
|
|
929
|
-
[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(
|
|
961
|
+
[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(agentIndicatorX, height - 88, 9, 9)] fill];
|
|
930
962
|
NSString *agentText = self.activeAgentCount > 0
|
|
931
|
-
? [NSString stringWithFormat
|
|
932
|
-
|
|
933
|
-
|
|
963
|
+
? [NSString stringWithFormat:self.activeAgentCount != 1 ? L(@"%ld Agents online")
|
|
964
|
+
: L(@"%ld Agent online"), (long)self.activeAgentCount]
|
|
965
|
+
: L(@"No Agents online");
|
|
966
|
+
[agentText drawInRect:NSMakeRect(agentIndicatorX + 16, height - 95, 160, 22)
|
|
934
967
|
withAttributes:[self textAttributesWithSize:14 color:agentColor weight:NSFontWeightMedium]];
|
|
935
968
|
[self drawSystemMetricsEndingAtX:QuotaLogicalWidth - 28 y:height - 95];
|
|
936
969
|
|
|
937
970
|
// 用量由定时器自动刷新,面板不再提供手动刷新按钮;右上角只留上次刷新的时间,
|
|
938
971
|
// 与下一行的系统指标右边对齐。放回汇总条里会挤掉一整格 Provider 数据。
|
|
939
|
-
[[NSString stringWithFormat
|
|
972
|
+
[[NSString stringWithFormat:L(@"Updated %@"), [self refreshAgeText]]
|
|
940
973
|
drawInRect:NSMakeRect(QuotaLogicalWidth - 28 - 200, height - 45, 200, 18)
|
|
941
974
|
withAttributes:[self rightAlignedTextAttributesWithSize:11 color:secondary
|
|
942
975
|
weight:NSFontWeightRegular]];
|
|
@@ -970,12 +1003,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
970
1003
|
// 解决的是另一件事——Agent 动画,以及 Claude 额度(statusline 是它唯一的来源)。
|
|
971
1004
|
// 把两者写成一句会让人以为不执行 install 卡片就不出现。
|
|
972
1005
|
CGFloat noticeTop = height - QuotaHeaderHeight;
|
|
973
|
-
[@"
|
|
1006
|
+
[L(@"No Codex / Claude Code CLI detected") drawInRect:NSMakeRect(28, noticeTop - 30, 460, 26)
|
|
974
1007
|
withAttributes:[self textAttributesWithSize:17 color:primary weight:NSFontWeightMedium]];
|
|
975
|
-
[@"
|
|
1008
|
+
[L(@"Quota cards appear once Codex or Claude Code is installed")
|
|
976
1009
|
drawInRect:NSMakeRect(28, noticeTop - 52, 560, 20)
|
|
977
1010
|
withAttributes:[self textAttributesWithSize:12 color:secondary weight:NSFontWeightRegular]];
|
|
978
|
-
[@"
|
|
1011
|
+
[L(@"Run cc-pets install again to enable Agent animations and Claude quota tracking")
|
|
979
1012
|
drawInRect:NSMakeRect(28, noticeTop - 72, 560, 18)
|
|
980
1013
|
withAttributes:[self textAttributesWithSize:11
|
|
981
1014
|
color:[NSColor colorWithWhite:0.52 alpha:1] weight:NSFontWeightRegular]];
|
|
@@ -983,12 +1016,12 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
983
1016
|
BOOL hasAPICard = ([visibleProviders containsObject:@"Codex"] && self.codexShowsAPIUsage) ||
|
|
984
1017
|
([visibleProviders containsObject:@"Claude"] && self.claudeShowsAPIUsage);
|
|
985
1018
|
NSString *footer = visibleProviders.count == 0
|
|
986
|
-
? @"ⓘ
|
|
1019
|
+
? L(@"ⓘ The pet and system status still work; quota cards only show for detected CLIs")
|
|
987
1020
|
: (hasAPICard
|
|
988
|
-
? @"ⓘ API
|
|
989
|
-
: (self.usesLiquidGlass
|
|
990
|
-
? @"ⓘ
|
|
991
|
-
: @"ⓘ
|
|
1021
|
+
? L(@"ⓘ API usage = local session stats (input includes cache reads/writes); compared with the same point last month")
|
|
1022
|
+
: (self.usesLiquidGlass || CCPetsLanguageIsSource()
|
|
1023
|
+
? L(@"ⓘ % = official quota left; tokens = local usage (incl. cache reads/writes)")
|
|
1024
|
+
: L(@"ⓘ % = share of official plan quota left; tokens = locally counted usage (input incl. cache reads/writes). They measure different things")));
|
|
992
1025
|
// 最后一块的底边距面板底 QuotaFooterHeight:脚注与其留约 8pt,底部留白 16pt,
|
|
993
1026
|
// 和顶部标题的留白大致对称。
|
|
994
1027
|
[footer drawInRect:NSMakeRect(28, 16, 650, 20)
|
|
@@ -1017,7 +1050,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
1017
1050
|
|
|
1018
1051
|
NSArray<NSDictionary *> *cells = @[
|
|
1019
1052
|
@{@"icon": @"◔", @"headerSymbol": @"calendar", @"key": @"today",
|
|
1020
|
-
@"label": @"
|
|
1053
|
+
@"label": L(@"Today")},
|
|
1021
1054
|
@{@"icon": @"◉", @"headerSymbol": @"calendar.badge.clock", @"key": @"recentWeek",
|
|
1022
1055
|
@"label": [self recentWeekUsageLabel]}
|
|
1023
1056
|
];
|
|
@@ -1055,6 +1088,9 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
1055
1088
|
NSFont *headerFont = [self fontWithSize:11 weight:NSFontWeightRegular];
|
|
1056
1089
|
NSDictionary *headerAttributes = @{NSFontAttributeName: headerFont,
|
|
1057
1090
|
NSForegroundColorAttributeName: [self textColor:secondary]};
|
|
1091
|
+
NSDictionary *titleAttributes = @{NSFontAttributeName:
|
|
1092
|
+
[self fontWithSize:11 weight:NSFontWeightBold],
|
|
1093
|
+
NSForegroundColorAttributeName: [self textColor:secondary]};
|
|
1058
1094
|
NSImage *headerIcon = [NSImage imageWithSystemSymbolName:cell[@"headerSymbol"]
|
|
1059
1095
|
accessibilityDescription:cell[@"label"]];
|
|
1060
1096
|
NSImageSymbolConfiguration *headerIconConfiguration =
|
|
@@ -1074,7 +1110,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
1074
1110
|
[header appendAttributedString:[[NSAttributedString alloc]
|
|
1075
1111
|
initWithString:@" " attributes:headerAttributes]];
|
|
1076
1112
|
[header appendAttributedString:[[NSAttributedString alloc]
|
|
1077
|
-
initWithString:cell[@"label"] attributes:
|
|
1113
|
+
initWithString:cell[@"label"] attributes:titleAttributes]];
|
|
1078
1114
|
[header drawInRect:NSMakeRect(x + 24, NSMinY(summary) + 89,
|
|
1079
1115
|
NSWidth([self logicalSummaryCellRectAtIndex:index]) - 48, 18)];
|
|
1080
1116
|
for (NSDictionary *row in rows) {
|
|
@@ -1083,6 +1119,7 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
1083
1119
|
CGFloat iconY = NSMinY(summary) + [row[@"iconY"] doubleValue];
|
|
1084
1120
|
CGFloat nameY = NSMinY(summary) + [row[@"nameY"] doubleValue];
|
|
1085
1121
|
CGFloat labelY = NSMinY(summary) + [row[@"labelY"] doubleValue];
|
|
1122
|
+
if (CCPetsLanguageIsSource()) labelY += 2 / QuotaScale;
|
|
1086
1123
|
CGFloat valueY = NSMinY(summary) + [row[@"valueY"] doubleValue];
|
|
1087
1124
|
// 这是图标字形不是文字,原生玻璃下也保留颜色:它负责标出这一行是哪一家。
|
|
1088
1125
|
[cell[@"icon"] drawInRect:NSMakeRect(x + 20, iconY, 42, 42)
|
|
@@ -1091,9 +1128,9 @@ NSImage *OfficialAppIcon(NSString *bundleIdentifier, NSString *resourceName) {
|
|
|
1091
1128
|
[row[@"name"] drawInRect:NSMakeRect(x + 66, nameY, 76, 22)
|
|
1092
1129
|
withAttributes:[self textAttributesWithSize:14 color:rowColor
|
|
1093
1130
|
weight:NSFontWeightMedium]];
|
|
1094
|
-
[@"
|
|
1131
|
+
[L(@"Input") drawInRect:NSMakeRect(inputX, labelY, 76, 16)
|
|
1095
1132
|
withAttributes:headerAttributes];
|
|
1096
|
-
[@"
|
|
1133
|
+
[L(@"Output") drawInRect:NSMakeRect(outputX, labelY, 76, 16)
|
|
1097
1134
|
withAttributes:headerAttributes];
|
|
1098
1135
|
NSDictionary *valueAttributes = [self textAttributesWithSize:16 color:primary
|
|
1099
1136
|
weight:NSFontWeightBold];
|
package/Sources/CCPets/main.m
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#import "CCPetsL10n.h"
|
|
1
2
|
#import <Cocoa/Cocoa.h>
|
|
2
3
|
#import "CCPetsAppDelegate.h"
|
|
3
4
|
#import "CCPetsEvents.h"
|
|
@@ -109,7 +110,8 @@ int main(int argc, const char *argv[]) {
|
|
|
109
110
|
if (strcmp(argv[index], launchFlags[flag]) == 0) known = YES;
|
|
110
111
|
}
|
|
111
112
|
if (known) continue;
|
|
112
|
-
fprintf(stderr, "
|
|
113
|
+
fprintf(stderr, "%s\n", [NSString stringWithFormat:L(@"Unknown argument: %@\nRun cc-pets --help for usage."),
|
|
114
|
+
@(argv[index])].UTF8String);
|
|
113
115
|
return 2;
|
|
114
116
|
}
|
|
115
117
|
|
package/bin/cc-pets
CHANGED
|
@@ -6,32 +6,31 @@ PROJECT_DIR="${SCRIPT_DIR:h}"
|
|
|
6
6
|
PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
|
|
7
7
|
BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
|
|
8
8
|
INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
|
|
9
|
+
source "${PROJECT_DIR}/scripts/i18n.zsh"
|
|
9
10
|
|
|
10
11
|
# 只列面向用户的命令。--hook / --claude-usage / --provider-event / --render-* 等是
|
|
11
12
|
# hooks、statusline 和测试调用的内部入口,列出来只会让人误用。
|
|
12
13
|
print_usage() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
cc-pets
|
|
17
|
-
cc-pets
|
|
18
|
-
cc-pets uninstall
|
|
19
|
-
cc-pets uninstall
|
|
20
|
-
cc-pets
|
|
21
|
-
cc-pets
|
|
22
|
-
cc-pets
|
|
23
|
-
cc-pets
|
|
24
|
-
cc-pets
|
|
25
|
-
cc-pets
|
|
26
|
-
cc-pets
|
|
27
|
-
cc-pets --
|
|
28
|
-
cc-pets --
|
|
29
|
-
cc-pets --
|
|
30
|
-
cc-pets -
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
codex-with-pet / claude-with-pet 会在启动 CLI 的同时拉起桌宠。
|
|
34
|
-
USAGE
|
|
14
|
+
print -r -- "$(cc_pets_t "Usage: cc-pets [command]
|
|
15
|
+
|
|
16
|
+
cc-pets Start the pet (prefers the copy installed in ~/Applications)
|
|
17
|
+
cc-pets install Install or repair the shell / Claude Code / Codex integrations
|
|
18
|
+
cc-pets uninstall Remove the integrations and restore the status line
|
|
19
|
+
cc-pets uninstall --purge Also delete the app, app data and preferences (asks first; keeps pets and lines in ~/.cc-pets)
|
|
20
|
+
cc-pets uninstall-app Only delete ~/Applications/CC Pets.app
|
|
21
|
+
cc-pets build Rebuild
|
|
22
|
+
cc-pets clean Clear caches (quit the pet first)
|
|
23
|
+
cc-pets doctor Check the installation and integrations, with suggested fixes
|
|
24
|
+
cc-pets paths [--json] List where settings, caches and data live, and their sizes
|
|
25
|
+
cc-pets pet <command> Manage pet sprites; see cc-pets pet help
|
|
26
|
+
cc-pets bridge <command> CC Bridge cross-session messaging; see cc-pets bridge --help
|
|
27
|
+
cc-pets --status Print the current Codex quota
|
|
28
|
+
cc-pets --history Print quota history (JSON)
|
|
29
|
+
cc-pets --foreground Run the pet in the foreground (for debugging)
|
|
30
|
+
cc-pets -v, --version Show the version
|
|
31
|
+
cc-pets -h, --help Show this help
|
|
32
|
+
|
|
33
|
+
codex-with-pet / claude-with-pet start the pet along with the CLI.")"
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" || "${1:-}" == "help" ]]; then
|
package/bin/claude-with-pet
CHANGED
|
@@ -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
|
PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
|
|
7
8
|
BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
|
|
8
9
|
INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
|
|
@@ -28,7 +29,7 @@ if [[ -z "${REAL_CLAUDE}" ]]; then
|
|
|
28
29
|
done
|
|
29
30
|
fi
|
|
30
31
|
if [[ -z "${REAL_CLAUDE}" || ! -x "${REAL_CLAUDE}" ]]; then
|
|
31
|
-
print -u2 "
|
|
32
|
+
print -u2 "$(cc_pets_t "No executable Claude Code CLI found. Install claude, or set CLAUDE_REAL_BIN to its real path.")"
|
|
32
33
|
exit 127
|
|
33
34
|
fi
|
|
34
35
|
|
package/bin/codex-with-pet
CHANGED
|
@@ -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
|
PET_BIN="${PROJECT_DIR}/.build/release/cc-pets"
|
|
7
8
|
BUILD_APP="${PROJECT_DIR}/.build/release/CC Pets.app"
|
|
8
9
|
INSTALLED_APP="${CC_PETS_APPLICATIONS_DIR:-${HOME}/Applications}/CC Pets.app"
|
|
@@ -26,7 +27,7 @@ if [[ -z "${REAL_CODEX}" ]]; then
|
|
|
26
27
|
done
|
|
27
28
|
fi
|
|
28
29
|
if [[ -z "${REAL_CODEX}" || ! -x "${REAL_CODEX}" ]]; then
|
|
29
|
-
print -u2 "
|
|
30
|
+
print -u2 "$(cc_pets_t "No executable Codex CLI found. Install codex, or set CODEX_REAL_BIN to its real path.")"
|
|
30
31
|
exit 127
|
|
31
32
|
fi
|
|
32
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-pets",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A native macOS desktop pet for Codex CLI and Claude Code",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Sunnyshiny",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"scripts",
|
|
35
35
|
"Resources/Info.plist",
|
|
36
36
|
"Resources/AppIcon.icns",
|
|
37
|
-
"Resources/phrases.default
|
|
37
|
+
"Resources/phrases.default.*.txt",
|
|
38
|
+
"Resources/*.lproj/*",
|
|
38
39
|
"Sources/CCPets",
|
|
39
40
|
"README.md",
|
|
40
41
|
"README.zh-CN.md",
|