@gengjiawen/os-init 1.10.0 → 1.11.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 +7 -0
- package/README.md +2 -3
- package/bin/bin.js +3 -4
- package/build/index.d.ts +0 -1
- package/build/index.js +3 -33
- package/libs/index.ts +4 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.11.0](https://github.com/gengjiawen/os-init/compare/v1.10.0...v1.11.0) (2025-12-31)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update model version in Codex config template from gpt-5.1 to gpt-5.2 ([56c36d3](https://github.com/gengjiawen/os-init/commit/56c36d3da5c3732100c090c4df3318b5cdd003cf))
|
|
9
|
+
|
|
3
10
|
## [1.10.0](https://github.com/gengjiawen/os-init/compare/v1.9.1...v1.10.0) (2025-12-06)
|
|
4
11
|
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -80,11 +80,10 @@ pnpx @gengjiawen/os-init set-fish
|
|
|
80
80
|
pnpx @gengjiawen/os-init set-cc <API_KEY>
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
Configures Claude Code
|
|
83
|
+
Configures Claude Code with your API key. This command will:
|
|
84
84
|
|
|
85
|
-
- Write `~/.claude-code-router/config.json`
|
|
86
85
|
- Write `~/.claude/settings.json`
|
|
87
|
-
- Install global
|
|
86
|
+
- Install global tool: `@anthropic-ai/claude-code`
|
|
88
87
|
|
|
89
88
|
### Configure Codex CLI
|
|
90
89
|
|
package/bin/bin.js
CHANGED
|
@@ -16,7 +16,7 @@ const program = new Command()
|
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('set-cc')
|
|
19
|
-
.description('setup
|
|
19
|
+
.description('setup Claude Code')
|
|
20
20
|
.argument('<apiKey>', 'API key to set')
|
|
21
21
|
.action(async (apiKey) => {
|
|
22
22
|
// Ensure apiKey is provided
|
|
@@ -26,8 +26,7 @@ program
|
|
|
26
26
|
return
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
29
|
-
const {
|
|
30
|
-
console.log(`Claude router config written to: ${routerConfigPath}`)
|
|
29
|
+
const { settingsPath } = writeClaudeConfig(apiKey)
|
|
31
30
|
console.log(`Claude settings written to: ${settingsPath}`)
|
|
32
31
|
await installDeps()
|
|
33
32
|
} catch (err) {
|
|
@@ -35,7 +34,7 @@ program
|
|
|
35
34
|
process.exit(1)
|
|
36
35
|
}
|
|
37
36
|
console.log(
|
|
38
|
-
'Claude
|
|
37
|
+
'Claude Code is ready, use `claude` in terminal to start building'
|
|
39
38
|
)
|
|
40
39
|
})
|
|
41
40
|
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -10,31 +10,9 @@ const fs = require("fs");
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const os = require("os");
|
|
12
12
|
const execa_1 = require("execa");
|
|
13
|
-
function getDefaultConfigDir() {
|
|
14
|
-
return path.join(os.homedir(), '.claude-code-router');
|
|
15
|
-
}
|
|
16
13
|
function ensureDir(dirPath) {
|
|
17
14
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
18
15
|
}
|
|
19
|
-
const DEFAULT_TEMPLATE = `{
|
|
20
|
-
"Providers": [
|
|
21
|
-
{
|
|
22
|
-
"name": "jw",
|
|
23
|
-
"api_base_url": "https://ai.gengjiawen.com/api/openai/v1/chat/completions",
|
|
24
|
-
"api_key": "API_KEY_PLACEHOLDER",
|
|
25
|
-
"models": ["code", "free"],
|
|
26
|
-
"transformer": {
|
|
27
|
-
"use": ["openrouter"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
"Router": {
|
|
32
|
-
"default": "jw,code",
|
|
33
|
-
"background": "jw,code",
|
|
34
|
-
"think": "jw,code",
|
|
35
|
-
"longContext": "jw,code"
|
|
36
|
-
}
|
|
37
|
-
}`;
|
|
38
16
|
function getClaudeSettingsDir() {
|
|
39
17
|
return path.join(os.homedir(), '.claude');
|
|
40
18
|
}
|
|
@@ -54,17 +32,12 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
54
32
|
}
|
|
55
33
|
}`;
|
|
56
34
|
function writeClaudeConfig(apiKey) {
|
|
57
|
-
const routerConfigDir = getDefaultConfigDir();
|
|
58
|
-
const routerConfigPath = path.join(routerConfigDir, 'config.json');
|
|
59
|
-
ensureDir(routerConfigDir);
|
|
60
|
-
const routerContent = DEFAULT_TEMPLATE.replace('API_KEY_PLACEHOLDER', apiKey);
|
|
61
|
-
fs.writeFileSync(routerConfigPath, routerContent);
|
|
62
35
|
const settingsDir = getClaudeSettingsDir();
|
|
63
36
|
const settingsPath = path.join(settingsDir, 'settings.json');
|
|
64
37
|
ensureDir(settingsDir);
|
|
65
38
|
const settingsContent = CLAUDE_SETTINGS_TEMPLATE.replace(/API_KEY_PLACEHOLDER/g, apiKey);
|
|
66
39
|
fs.writeFileSync(settingsPath, settingsContent);
|
|
67
|
-
return {
|
|
40
|
+
return { settingsPath };
|
|
68
41
|
}
|
|
69
42
|
async function commandExists(command) {
|
|
70
43
|
try {
|
|
@@ -79,10 +52,7 @@ async function commandExists(command) {
|
|
|
79
52
|
}
|
|
80
53
|
}
|
|
81
54
|
async function installDeps() {
|
|
82
|
-
const packages = [
|
|
83
|
-
'@anthropic-ai/claude-code',
|
|
84
|
-
'@musistudio/claude-code-router',
|
|
85
|
-
];
|
|
55
|
+
const packages = ['@anthropic-ai/claude-code'];
|
|
86
56
|
const usePnpm = await commandExists('pnpm');
|
|
87
57
|
if (usePnpm) {
|
|
88
58
|
console.log('pnpm detected. Installing dependencies with pnpm...');
|
|
@@ -98,7 +68,7 @@ function getCodexConfigDir() {
|
|
|
98
68
|
return path.join(os.homedir(), '.codex');
|
|
99
69
|
}
|
|
100
70
|
const CODEX_CONFIG_TOML_TEMPLATE = `model_provider = "jw"
|
|
101
|
-
model = "gpt-5.
|
|
71
|
+
model = "gpt-5.2"
|
|
102
72
|
model_reasoning_effort = "high"
|
|
103
73
|
disable_response_storage = true
|
|
104
74
|
preferred_auth_method = "apikey"
|
package/libs/index.ts
CHANGED
|
@@ -3,37 +3,11 @@ import * as path from 'path'
|
|
|
3
3
|
import * as os from 'os'
|
|
4
4
|
import { execa } from 'execa'
|
|
5
5
|
|
|
6
|
-
/** Return default configuration directory path */
|
|
7
|
-
function getDefaultConfigDir(): string {
|
|
8
|
-
return path.join(os.homedir(), '.claude-code-router')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
/** Ensure directory exists */
|
|
12
7
|
function ensureDir(dirPath: string): void {
|
|
13
8
|
fs.mkdirSync(dirPath, { recursive: true })
|
|
14
9
|
}
|
|
15
10
|
|
|
16
|
-
/** Template string used for simple string replacement */
|
|
17
|
-
const DEFAULT_TEMPLATE = `{
|
|
18
|
-
"Providers": [
|
|
19
|
-
{
|
|
20
|
-
"name": "jw",
|
|
21
|
-
"api_base_url": "https://ai.gengjiawen.com/api/openai/v1/chat/completions",
|
|
22
|
-
"api_key": "API_KEY_PLACEHOLDER",
|
|
23
|
-
"models": ["code", "free"],
|
|
24
|
-
"transformer": {
|
|
25
|
-
"use": ["openrouter"]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"Router": {
|
|
30
|
-
"default": "jw,code",
|
|
31
|
-
"background": "jw,code",
|
|
32
|
-
"think": "jw,code",
|
|
33
|
-
"longContext": "jw,code"
|
|
34
|
-
}
|
|
35
|
-
}`
|
|
36
|
-
|
|
37
11
|
/** Return Claude settings directory path */
|
|
38
12
|
function getClaudeSettingsDir(): string {
|
|
39
13
|
return path.join(os.homedir(), '.claude')
|
|
@@ -56,18 +30,10 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
|
56
30
|
}
|
|
57
31
|
}`
|
|
58
32
|
|
|
59
|
-
/** Write Claude config files
|
|
33
|
+
/** Write Claude config files */
|
|
60
34
|
export function writeClaudeConfig(apiKey: string): {
|
|
61
|
-
routerConfigPath: string
|
|
62
35
|
settingsPath: string
|
|
63
36
|
} {
|
|
64
|
-
// Write claude-code-router config
|
|
65
|
-
const routerConfigDir = getDefaultConfigDir()
|
|
66
|
-
const routerConfigPath = path.join(routerConfigDir, 'config.json')
|
|
67
|
-
ensureDir(routerConfigDir)
|
|
68
|
-
const routerContent = DEFAULT_TEMPLATE.replace('API_KEY_PLACEHOLDER', apiKey)
|
|
69
|
-
fs.writeFileSync(routerConfigPath, routerContent)
|
|
70
|
-
|
|
71
37
|
// Write Claude settings
|
|
72
38
|
const settingsDir = getClaudeSettingsDir()
|
|
73
39
|
const settingsPath = path.join(settingsDir, 'settings.json')
|
|
@@ -78,7 +44,7 @@ export function writeClaudeConfig(apiKey: string): {
|
|
|
78
44
|
)
|
|
79
45
|
fs.writeFileSync(settingsPath, settingsContent)
|
|
80
46
|
|
|
81
|
-
return {
|
|
47
|
+
return { settingsPath }
|
|
82
48
|
}
|
|
83
49
|
|
|
84
50
|
/** Check if a command exists */
|
|
@@ -98,10 +64,7 @@ async function commandExists(command: string): Promise<boolean> {
|
|
|
98
64
|
|
|
99
65
|
/** Install global dependencies */
|
|
100
66
|
export async function installDeps(): Promise<void> {
|
|
101
|
-
const packages = [
|
|
102
|
-
'@anthropic-ai/claude-code',
|
|
103
|
-
'@musistudio/claude-code-router',
|
|
104
|
-
]
|
|
67
|
+
const packages = ['@anthropic-ai/claude-code']
|
|
105
68
|
const usePnpm = await commandExists('pnpm')
|
|
106
69
|
|
|
107
70
|
if (usePnpm) {
|
|
@@ -121,7 +84,7 @@ function getCodexConfigDir(): string {
|
|
|
121
84
|
|
|
122
85
|
/** Template for Codex config.toml */
|
|
123
86
|
const CODEX_CONFIG_TOML_TEMPLATE = `model_provider = "jw"
|
|
124
|
-
model = "gpt-5.
|
|
87
|
+
model = "gpt-5.2"
|
|
125
88
|
model_reasoning_effort = "high"
|
|
126
89
|
disable_response_storage = true
|
|
127
90
|
preferred_auth_method = "apikey"
|