Skip to content

Commit 03d1969

Browse files
committed
Lint fixes, version bump
1 parent 79a954c commit 03d1969

File tree

5 files changed

+87
-82
lines changed

5 files changed

+87
-82
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ccstatusline",
3-
"version": "2.0.22",
3+
"version": "2.0.23",
44
"description": "A customizable status line formatter for Claude Code CLI",
55
"module": "src/ccstatusline.ts",
66
"type": "module",
Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,75 @@
1-
import { describe, expect, it } from "vitest";
2-
3-
import { getContextConfig } from "../model-context";
4-
5-
describe("getContextConfig", () => {
6-
describe("Sonnet 4.5 models with [1m] suffix", () => {
7-
it("should return 1M context window for claude-sonnet-4-5 with [1m] suffix", () => {
8-
const config = getContextConfig("claude-sonnet-4-5-20250929[1m]");
9-
10-
expect(config.maxTokens).toBe(1000000);
11-
expect(config.usableTokens).toBe(800000);
12-
});
13-
14-
it("should return 1M context window for AWS Bedrock format with [1m] suffix", () => {
15-
const config = getContextConfig(
16-
"us.anthropic.claude-sonnet-4-5-20250929-v1:0[1m]"
17-
);
18-
19-
expect(config.maxTokens).toBe(1000000);
20-
expect(config.usableTokens).toBe(800000);
1+
import {
2+
describe,
3+
expect,
4+
it
5+
} from 'vitest';
6+
7+
import { getContextConfig } from '../model-context';
8+
9+
describe('getContextConfig', () => {
10+
describe('Sonnet 4.5 models with [1m] suffix', () => {
11+
it('should return 1M context window for claude-sonnet-4-5 with [1m] suffix', () => {
12+
const config = getContextConfig('claude-sonnet-4-5-20250929[1m]');
13+
14+
expect(config.maxTokens).toBe(1000000);
15+
expect(config.usableTokens).toBe(800000);
16+
});
17+
18+
it('should return 1M context window for AWS Bedrock format with [1m] suffix', () => {
19+
const config = getContextConfig(
20+
'us.anthropic.claude-sonnet-4-5-20250929-v1:0[1m]'
21+
);
22+
23+
expect(config.maxTokens).toBe(1000000);
24+
expect(config.usableTokens).toBe(800000);
25+
});
26+
27+
it('should return 1M context window with uppercase [1M] suffix', () => {
28+
const config = getContextConfig('claude-sonnet-4-5-20250929[1M]');
29+
30+
expect(config.maxTokens).toBe(1000000);
31+
expect(config.usableTokens).toBe(800000);
32+
});
2133
});
2234

23-
it("should return 1M context window with uppercase [1M] suffix", () => {
24-
const config = getContextConfig("claude-sonnet-4-5-20250929[1M]");
35+
describe('Sonnet 4.5 models without [1m] suffix', () => {
36+
it('should return 200k context window for claude-sonnet-4-5 without [1m] suffix', () => {
37+
const config = getContextConfig('claude-sonnet-4-5-20250929');
2538

26-
expect(config.maxTokens).toBe(1000000);
27-
expect(config.usableTokens).toBe(800000);
28-
});
29-
});
30-
31-
describe("Sonnet 4.5 models without [1m] suffix", () => {
32-
it("should return 200k context window for claude-sonnet-4-5 without [1m] suffix", () => {
33-
const config = getContextConfig("claude-sonnet-4-5-20250929");
34-
35-
expect(config.maxTokens).toBe(200000);
36-
expect(config.usableTokens).toBe(160000);
37-
});
39+
expect(config.maxTokens).toBe(200000);
40+
expect(config.usableTokens).toBe(160000);
41+
});
3842

39-
it("should return 200k context window for AWS Bedrock format without [1m] suffix", () => {
40-
const config = getContextConfig(
41-
"us.anthropic.claude-sonnet-4-5-20250929-v1:0"
42-
);
43+
it('should return 200k context window for AWS Bedrock format without [1m] suffix', () => {
44+
const config = getContextConfig(
45+
'us.anthropic.claude-sonnet-4-5-20250929-v1:0'
46+
);
4347

44-
expect(config.maxTokens).toBe(200000);
45-
expect(config.usableTokens).toBe(160000);
48+
expect(config.maxTokens).toBe(200000);
49+
expect(config.usableTokens).toBe(160000);
50+
});
4651
});
47-
});
4852

49-
describe("Older/default models", () => {
50-
it("should return 200k context window for older Sonnet 3.5 model", () => {
51-
const config = getContextConfig("claude-3-5-sonnet-20241022");
53+
describe('Older/default models', () => {
54+
it('should return 200k context window for older Sonnet 3.5 model', () => {
55+
const config = getContextConfig('claude-3-5-sonnet-20241022');
5256

53-
expect(config.maxTokens).toBe(200000);
54-
expect(config.usableTokens).toBe(160000);
55-
});
57+
expect(config.maxTokens).toBe(200000);
58+
expect(config.usableTokens).toBe(160000);
59+
});
5660

57-
it("should return 200k context window when model ID is undefined", () => {
58-
const config = getContextConfig(undefined);
61+
it('should return 200k context window when model ID is undefined', () => {
62+
const config = getContextConfig(undefined);
5963

60-
expect(config.maxTokens).toBe(200000);
61-
expect(config.usableTokens).toBe(160000);
62-
});
64+
expect(config.maxTokens).toBe(200000);
65+
expect(config.usableTokens).toBe(160000);
66+
});
6367

64-
it("should return 200k context window for unknown model ID", () => {
65-
const config = getContextConfig("claude-unknown-model");
68+
it('should return 200k context window for unknown model ID', () => {
69+
const config = getContextConfig('claude-unknown-model');
6670

67-
expect(config.maxTokens).toBe(200000);
68-
expect(config.usableTokens).toBe(160000);
71+
expect(config.maxTokens).toBe(200000);
72+
expect(config.usableTokens).toBe(160000);
73+
});
6974
});
70-
});
71-
});
75+
});

src/utils/model-context.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
interface ModelContextConfig {
2-
maxTokens: number;
3-
usableTokens: number;
2+
maxTokens: number;
3+
usableTokens: number;
44
}
55

66
export function getContextConfig(modelId?: string): ModelContextConfig {
7-
// Default to 200k for older models
8-
const defaultConfig = {
9-
maxTokens: 200000,
10-
usableTokens: 160000,
11-
};
7+
// Default to 200k for older models
8+
const defaultConfig = {
9+
maxTokens: 200000,
10+
usableTokens: 160000
11+
};
1212

13-
if (!modelId) return defaultConfig;
13+
if (!modelId)
14+
return defaultConfig;
1415

15-
// Sonnet 4.5 variants with 1M context (requires [1m] suffix for long context beta)
16-
if (
17-
modelId.includes("claude-sonnet-4-5") &&
18-
modelId.toLowerCase().includes("[1m]")
19-
) {
20-
return {
21-
maxTokens: 1000000,
22-
usableTokens: 800000, // 80% of 1M
23-
};
24-
}
16+
// Sonnet 4.5 variants with 1M context (requires [1m] suffix for long context beta)
17+
if (
18+
modelId.includes('claude-sonnet-4-5')
19+
&& modelId.toLowerCase().includes('[1m]')
20+
) {
21+
return {
22+
maxTokens: 1000000,
23+
usableTokens: 800000 // 80% of 1M
24+
};
25+
}
2526

26-
// Add future models here as needed
27+
// Add future models here as needed
2728

28-
return defaultConfig;
29-
}
29+
return defaultConfig;
30+
}

src/utils/widgets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ export function isKnownWidgetType(type: string): boolean {
5252
return widgetRegistry.has(type)
5353
|| type === 'separator'
5454
|| type === 'flex-separator';
55-
}
55+
}

src/widgets/ClaudeSessionId.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ export class ClaudeSessionIdWidget implements Widget {
2828

2929
supportsRawValue(): boolean { return true; }
3030
supportsColors(item: WidgetItem): boolean { return true; }
31-
}
31+
}

0 commit comments

Comments
 (0)