@gengjiawen/os-init 1.26.2 → 1.27.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 +15 -0
- package/README.md +3 -4
- package/bin/bin.js +6 -8
- package/build/all-agents.d.ts +0 -1
- package/build/codex.d.ts +1 -2
- package/build/codex.js +11 -12
- package/libs/all-agents.test.ts +0 -1
- package/libs/all-agents.ts +1 -1
- package/libs/codex.test.ts +27 -9
- package/libs/codex.ts +17 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.27.0](https://github.com/gengjiawen/os-init/compare/v1.26.3...v1.27.0) (2026-07-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* bump default Codex model to gpt-5.6-sol ([710f188](https://github.com/gengjiawen/os-init/commit/710f1887607b50027d653d2b910ed48d45d7353e))
|
|
9
|
+
|
|
10
|
+
## [1.26.3](https://github.com/gengjiawen/os-init/compare/v1.26.2...v1.26.3) (2026-06-18)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* disable codex update check on startup ([43a4c68](https://github.com/gengjiawen/os-init/commit/43a4c68eede37d2b5d73ee199d8dded86f6a61b9))
|
|
16
|
+
* use codex bearer token config ([38a49de](https://github.com/gengjiawen/os-init/commit/38a49de58af44040507ee87205f326a5fa5eeacb))
|
|
17
|
+
|
|
3
18
|
## [1.26.2](https://github.com/gengjiawen/os-init/compare/v1.26.1...v1.26.2) (2026-06-11)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -135,13 +135,12 @@ Configures Claude Code with your API key. This command will:
|
|
|
135
135
|
### Configure Codex CLI
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
pnpx @gengjiawen/os-init set-codex <
|
|
138
|
+
pnpx @gengjiawen/os-init set-codex <BEARER_TOKEN>
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
Configures Codex CLI with your
|
|
141
|
+
Configures Codex CLI with your bearer token. This command will:
|
|
142
142
|
|
|
143
|
-
- Write `~/.codex/config.toml`
|
|
144
|
-
- Write `~/.codex/auth.json`
|
|
143
|
+
- Write `~/.codex/config.toml` with `experimental_bearer_token`
|
|
145
144
|
- Install global tool: `@openai/codex`
|
|
146
145
|
|
|
147
146
|
### Configure OpenCode CLI
|
package/bin/bin.js
CHANGED
|
@@ -56,18 +56,17 @@ program
|
|
|
56
56
|
|
|
57
57
|
program
|
|
58
58
|
.command('set-codex')
|
|
59
|
-
.description('setup codex cli config
|
|
60
|
-
.argument('<
|
|
61
|
-
.action(async (
|
|
62
|
-
if (!
|
|
63
|
-
console.error('Missing required argument: <
|
|
59
|
+
.description('setup codex cli config')
|
|
60
|
+
.argument('<bearerToken>', 'Bearer token to set for Codex')
|
|
61
|
+
.action(async (bearerToken) => {
|
|
62
|
+
if (!bearerToken || String(bearerToken).trim().length === 0) {
|
|
63
|
+
console.error('Missing required argument: <bearerToken>')
|
|
64
64
|
program.help({ error: true })
|
|
65
65
|
return
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
|
-
const { configPath
|
|
68
|
+
const { configPath } = writeCodexConfig(bearerToken)
|
|
69
69
|
console.log(`Codex config written to: ${configPath}`)
|
|
70
|
-
console.log(`Codex auth written to: ${authPath}`)
|
|
71
70
|
await installCodexDeps()
|
|
72
71
|
} catch (err) {
|
|
73
72
|
console.error('Failed to setup Codex:', err.message)
|
|
@@ -132,7 +131,6 @@ program
|
|
|
132
131
|
|
|
133
132
|
console.log('\nCodex:')
|
|
134
133
|
console.log(` Config written to: ${result.codex.configPath}`)
|
|
135
|
-
console.log(` Auth written to: ${result.codex.authPath}`)
|
|
136
134
|
|
|
137
135
|
if (result.opencode) {
|
|
138
136
|
console.log('\nOpenCode:')
|
package/build/all-agents.d.ts
CHANGED
package/build/codex.d.ts
CHANGED
package/build/codex.js
CHANGED
|
@@ -12,19 +12,20 @@ const CODEX_BASE_URL = 'https://ai.gengjiawen.com/api/openai';
|
|
|
12
12
|
function getCodexConfigDir() {
|
|
13
13
|
return path.join(os.homedir(), '.codex');
|
|
14
14
|
}
|
|
15
|
-
function getCodexConfigTomlTemplate() {
|
|
15
|
+
function getCodexConfigTomlTemplate(bearerToken) {
|
|
16
16
|
return `model_provider = "jw"
|
|
17
|
-
model = "gpt-5.
|
|
17
|
+
model = "gpt-5.6-sol"
|
|
18
18
|
model_reasoning_effort = "high"
|
|
19
19
|
plan_mode_reasoning_effort = "high"
|
|
20
20
|
model_auto_compact_token_limit = 131072
|
|
21
21
|
disable_response_storage = true
|
|
22
|
-
|
|
22
|
+
check_for_update_on_startup = false
|
|
23
23
|
|
|
24
24
|
[model_providers.jw]
|
|
25
25
|
name = "jw"
|
|
26
26
|
base_url = "${CODEX_BASE_URL}"
|
|
27
27
|
wire_api = "responses"
|
|
28
|
+
experimental_bearer_token = ${JSON.stringify(bearerToken)}
|
|
28
29
|
`;
|
|
29
30
|
}
|
|
30
31
|
function isTomlTable(value) {
|
|
@@ -50,26 +51,24 @@ function stripModelCatalogJsonFromToml(content) {
|
|
|
50
51
|
.filter((line) => !/^\s*model_catalog_json\s*=/.test(line))
|
|
51
52
|
.join('\n');
|
|
52
53
|
}
|
|
53
|
-
function getMergedCodexConfig(existingContent) {
|
|
54
|
+
function getMergedCodexConfig(existingContent, bearerToken) {
|
|
54
55
|
const sanitizedContent = stripModelCatalogJsonFromToml(existingContent);
|
|
55
56
|
const existingConfig = TOML.parse(sanitizedContent);
|
|
56
|
-
const templateConfig = TOML.parse(getCodexConfigTomlTemplate());
|
|
57
|
+
const templateConfig = TOML.parse(getCodexConfigTomlTemplate(bearerToken));
|
|
57
58
|
delete existingConfig.service_tier;
|
|
58
59
|
delete existingConfig.model_catalog_json;
|
|
60
|
+
delete existingConfig.preferred_auth_method;
|
|
59
61
|
return TOML.stringify(mergeTomlTables(existingConfig, templateConfig));
|
|
60
62
|
}
|
|
61
|
-
function writeCodexConfig(
|
|
63
|
+
function writeCodexConfig(bearerToken) {
|
|
62
64
|
const configDir = getCodexConfigDir();
|
|
63
65
|
(0, utils_1.ensureDir)(configDir);
|
|
64
66
|
const configPath = path.join(configDir, 'config.toml');
|
|
65
67
|
const configContent = fs.existsSync(configPath)
|
|
66
|
-
? getMergedCodexConfig(fs.readFileSync(configPath, 'utf8'))
|
|
67
|
-
: getCodexConfigTomlTemplate();
|
|
68
|
+
? getMergedCodexConfig(fs.readFileSync(configPath, 'utf8'), bearerToken)
|
|
69
|
+
: getCodexConfigTomlTemplate(bearerToken);
|
|
68
70
|
fs.writeFileSync(configPath, configContent);
|
|
69
|
-
|
|
70
|
-
const authContent = JSON.stringify({ OPENAI_API_KEY: apiKey }, null, 2);
|
|
71
|
-
fs.writeFileSync(authPath, authContent);
|
|
72
|
-
return { configPath, authPath };
|
|
71
|
+
return { configPath };
|
|
73
72
|
}
|
|
74
73
|
async function installCodexDeps() {
|
|
75
74
|
const packages = ['@openai/codex'];
|
package/libs/all-agents.test.ts
CHANGED
|
@@ -39,7 +39,6 @@ describe('writeAllAgentsConfig', () => {
|
|
|
39
39
|
|
|
40
40
|
expect(fs.existsSync(result.claude.settingsPath)).toBe(true)
|
|
41
41
|
expect(fs.existsSync(result.codex.configPath)).toBe(true)
|
|
42
|
-
expect(fs.existsSync(result.codex.authPath)).toBe(true)
|
|
43
42
|
expect(result.opencode).toBeUndefined()
|
|
44
43
|
})
|
|
45
44
|
|
package/libs/all-agents.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface AllAgentsOptions {
|
|
|
16
16
|
|
|
17
17
|
export interface AllAgentsResult {
|
|
18
18
|
claude: { settingsPath: string; vscodeSettingsPath: string }
|
|
19
|
-
codex: { configPath: string
|
|
19
|
+
codex: { configPath: string }
|
|
20
20
|
opencode?: { configPath: string }
|
|
21
21
|
}
|
|
22
22
|
|
package/libs/codex.test.ts
CHANGED
|
@@ -23,15 +23,26 @@ describe('writeCodexConfig', () => {
|
|
|
23
23
|
fs.rmSync(tempHome, { recursive: true, force: true })
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
-
test('writes config with 128k auto compact threshold', () => {
|
|
26
|
+
test('writes config with bearer token and 128k auto compact threshold', () => {
|
|
27
27
|
const result = writeCodexConfig('test-api-key')
|
|
28
|
+
const configPath = path.join(tempHome, '.codex', 'config.toml')
|
|
29
|
+
const authPath = path.join(tempHome, '.codex', 'auth.json')
|
|
28
30
|
const config = TOML.parse(fs.readFileSync(result.configPath, 'utf8')) as {
|
|
29
31
|
model_auto_compact_token_limit: number
|
|
32
|
+
model_providers: {
|
|
33
|
+
jw: {
|
|
34
|
+
experimental_bearer_token: string
|
|
35
|
+
}
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
|
|
39
|
+
expect(result.configPath).toBe(configPath)
|
|
32
40
|
expect(config.model_auto_compact_token_limit).toBe(131072)
|
|
41
|
+
expect(config.model_providers.jw.experimental_bearer_token).toBe(
|
|
42
|
+
'test-api-key'
|
|
43
|
+
)
|
|
33
44
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
34
|
-
expect(fs.existsSync(
|
|
45
|
+
expect(fs.existsSync(authPath)).toBe(false)
|
|
35
46
|
})
|
|
36
47
|
|
|
37
48
|
test('writes codex reasoning efforts as high', () => {
|
|
@@ -65,11 +76,11 @@ custom_model = "keep-me"
|
|
|
65
76
|
const config = TOML.parse(fs.readFileSync(configPath, 'utf8')) as {
|
|
66
77
|
custom_flag: boolean
|
|
67
78
|
model: string
|
|
68
|
-
preferred_auth_method: string
|
|
69
79
|
model_providers: {
|
|
70
80
|
jw: {
|
|
71
81
|
base_url: string
|
|
72
82
|
custom_model: string
|
|
83
|
+
experimental_bearer_token: string
|
|
73
84
|
name: string
|
|
74
85
|
}
|
|
75
86
|
}
|
|
@@ -78,12 +89,15 @@ custom_model = "keep-me"
|
|
|
78
89
|
expect(config).not.toHaveProperty('service_tier')
|
|
79
90
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
80
91
|
expect(config.custom_flag).toBe(true)
|
|
81
|
-
expect(config.model).toBe('gpt-5.
|
|
82
|
-
expect(config
|
|
92
|
+
expect(config.model).toBe('gpt-5.6-sol')
|
|
93
|
+
expect(config).not.toHaveProperty('preferred_auth_method')
|
|
83
94
|
expect(config.model_providers.jw.base_url).toBe(
|
|
84
95
|
'https://ai.gengjiawen.com/api/openai'
|
|
85
96
|
)
|
|
86
97
|
expect(config.model_providers.jw.custom_model).toBe('keep-me')
|
|
98
|
+
expect(config.model_providers.jw.experimental_bearer_token).toBe(
|
|
99
|
+
'test-api-key'
|
|
100
|
+
)
|
|
87
101
|
expect(config.model_providers.jw.name).toBe('jw')
|
|
88
102
|
})
|
|
89
103
|
|
|
@@ -95,6 +109,7 @@ custom_model = "keep-me"
|
|
|
95
109
|
fs.writeFileSync(
|
|
96
110
|
configPath,
|
|
97
111
|
`service_tier = "slow"
|
|
112
|
+
preferred_auth_method = "apikey"
|
|
98
113
|
|
|
99
114
|
[model_providers.jw]
|
|
100
115
|
base_url = "https://example.com"
|
|
@@ -104,19 +119,22 @@ base_url = "https://example.com"
|
|
|
104
119
|
writeCodexConfig('test-api-key')
|
|
105
120
|
const config = TOML.parse(fs.readFileSync(configPath, 'utf8')) as {
|
|
106
121
|
model: string
|
|
107
|
-
preferred_auth_method: string
|
|
108
122
|
model_providers: {
|
|
109
123
|
jw: {
|
|
110
124
|
name: string
|
|
111
125
|
base_url: string
|
|
126
|
+
experimental_bearer_token: string
|
|
112
127
|
}
|
|
113
128
|
}
|
|
114
129
|
}
|
|
115
130
|
|
|
116
|
-
expect(config.model).toBe('gpt-5.
|
|
131
|
+
expect(config.model).toBe('gpt-5.6-sol')
|
|
117
132
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
118
|
-
expect(config
|
|
133
|
+
expect(config).not.toHaveProperty('preferred_auth_method')
|
|
119
134
|
expect(config.model_providers.jw.name).toBe('jw')
|
|
135
|
+
expect(config.model_providers.jw.experimental_bearer_token).toBe(
|
|
136
|
+
'test-api-key'
|
|
137
|
+
)
|
|
120
138
|
expect(config).not.toHaveProperty('service_tier')
|
|
121
139
|
})
|
|
122
140
|
|
|
@@ -142,6 +160,6 @@ base_url = "https://example.com"
|
|
|
142
160
|
>
|
|
143
161
|
|
|
144
162
|
expect(config).not.toHaveProperty('model_catalog_json')
|
|
145
|
-
expect(config.model).toBe('gpt-5.
|
|
163
|
+
expect(config.model).toBe('gpt-5.6-sol')
|
|
146
164
|
})
|
|
147
165
|
})
|
package/libs/codex.ts
CHANGED
|
@@ -14,19 +14,20 @@ function getCodexConfigDir(): string {
|
|
|
14
14
|
return path.join(os.homedir(), '.codex')
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function getCodexConfigTomlTemplate(): string {
|
|
17
|
+
function getCodexConfigTomlTemplate(bearerToken: string): string {
|
|
18
18
|
return `model_provider = "jw"
|
|
19
|
-
model = "gpt-5.
|
|
19
|
+
model = "gpt-5.6-sol"
|
|
20
20
|
model_reasoning_effort = "high"
|
|
21
21
|
plan_mode_reasoning_effort = "high"
|
|
22
22
|
model_auto_compact_token_limit = 131072
|
|
23
23
|
disable_response_storage = true
|
|
24
|
-
|
|
24
|
+
check_for_update_on_startup = false
|
|
25
25
|
|
|
26
26
|
[model_providers.jw]
|
|
27
27
|
name = "jw"
|
|
28
28
|
base_url = "${CODEX_BASE_URL}"
|
|
29
29
|
wire_api = "responses"
|
|
30
|
+
experimental_bearer_token = ${JSON.stringify(bearerToken)}
|
|
30
31
|
`
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -65,35 +66,36 @@ function stripModelCatalogJsonFromToml(content: string): string {
|
|
|
65
66
|
.join('\n')
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function getMergedCodexConfig(
|
|
69
|
+
function getMergedCodexConfig(
|
|
70
|
+
existingContent: string,
|
|
71
|
+
bearerToken: string
|
|
72
|
+
): string {
|
|
69
73
|
const sanitizedContent = stripModelCatalogJsonFromToml(existingContent)
|
|
70
74
|
const existingConfig = TOML.parse(sanitizedContent) as TomlTable
|
|
71
|
-
const templateConfig = TOML.parse(
|
|
75
|
+
const templateConfig = TOML.parse(
|
|
76
|
+
getCodexConfigTomlTemplate(bearerToken)
|
|
77
|
+
) as TomlTable
|
|
72
78
|
delete existingConfig.service_tier
|
|
73
79
|
delete existingConfig.model_catalog_json
|
|
80
|
+
delete existingConfig.preferred_auth_method
|
|
74
81
|
|
|
75
82
|
return TOML.stringify(mergeTomlTables(existingConfig, templateConfig))
|
|
76
83
|
}
|
|
77
84
|
|
|
78
|
-
/** Write Codex config.toml
|
|
79
|
-
export function writeCodexConfig(
|
|
85
|
+
/** Write Codex config.toml */
|
|
86
|
+
export function writeCodexConfig(bearerToken: string): {
|
|
80
87
|
configPath: string
|
|
81
|
-
authPath: string
|
|
82
88
|
} {
|
|
83
89
|
const configDir = getCodexConfigDir()
|
|
84
90
|
ensureDir(configDir)
|
|
85
91
|
|
|
86
92
|
const configPath = path.join(configDir, 'config.toml')
|
|
87
93
|
const configContent = fs.existsSync(configPath)
|
|
88
|
-
? getMergedCodexConfig(fs.readFileSync(configPath, 'utf8'))
|
|
89
|
-
: getCodexConfigTomlTemplate()
|
|
94
|
+
? getMergedCodexConfig(fs.readFileSync(configPath, 'utf8'), bearerToken)
|
|
95
|
+
: getCodexConfigTomlTemplate(bearerToken)
|
|
90
96
|
fs.writeFileSync(configPath, configContent)
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
const authContent = JSON.stringify({ OPENAI_API_KEY: apiKey }, null, 2)
|
|
94
|
-
fs.writeFileSync(authPath, authContent)
|
|
95
|
-
|
|
96
|
-
return { configPath, authPath }
|
|
98
|
+
return { configPath }
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
/** Install Codex dependency */
|