@gengjiawen/os-init 1.20.0 → 1.22.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.22.0](https://github.com/gengjiawen/os-init/compare/v1.21.0...v1.22.0) (2026-04-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * **codex:** set model reasoning effort to xhigh ([41d1b75](https://github.com/gengjiawen/os-init/commit/41d1b75536646ccda8bb6b509de88cd2152be3b7))
9
+ * **set-agents:** include OpenCode only with --full ([92e01b4](https://github.com/gengjiawen/os-init/commit/92e01b4aea467bcd42cc6ae922147b383e1fc4ad))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * remove service tier from codex config ([f618abd](https://github.com/gengjiawen/os-init/commit/f618abd92a877d457006fae1765ed6f3fe323a29))
15
+ * remove unused service_tier configuration from Codex TOML template ([bfa6f1a](https://github.com/gengjiawen/os-init/commit/bfa6f1a091e9e5bb2b733dacee2247fda457918b))
16
+
17
+ ## [1.21.0](https://github.com/gengjiawen/os-init/compare/v1.20.0...v1.21.0) (2026-03-31)
18
+
19
+
20
+ ### Features
21
+
22
+ * limit claude code context defaults ([bc40196](https://github.com/gengjiawen/os-init/commit/bc40196bbb4be0187ebbd2ed6a695808636b3554))
23
+
3
24
  ## [1.20.0](https://github.com/gengjiawen/os-init/compare/v1.19.0...v1.20.0) (2026-03-27)
4
25
 
5
26
 
package/bin/bin.js CHANGED
@@ -128,10 +128,10 @@ program
128
128
  program
129
129
  .command('set-agents')
130
130
  .description(
131
- 'setup Claude Code, Codex, and OpenCode at once (use --full to include Gemini CLI)'
131
+ 'setup Claude Code and Codex at once (use --full to include OpenCode and Gemini CLI)'
132
132
  )
133
133
  .argument('<apiKey>', 'API key to set for agents')
134
- .option('--full', 'Also setup Gemini CLI')
134
+ .option('--full', 'Also setup OpenCode and Gemini CLI')
135
135
  .action(async (apiKey, options) => {
136
136
  if (!apiKey || String(apiKey).trim().length === 0) {
137
137
  console.error('Missing required argument: <apiKey>')
@@ -145,7 +145,7 @@ program
145
145
  console.log(
146
146
  full
147
147
  ? 'Setting up Claude Code + Codex + OpenCode + Gemini CLI...\n'
148
- : 'Setting up Claude Code + Codex + OpenCode...\n'
148
+ : 'Setting up Claude Code + Codex...\n'
149
149
  )
150
150
 
151
151
  const result = await writeAllAgentsConfig(apiKey, { full })
@@ -161,8 +161,10 @@ program
161
161
  console.log(` Auth written to: ${result.codex.authPath}`)
162
162
  console.log(` Model catalog written to: ${result.codex.catalogPath}`)
163
163
 
164
- console.log('\nOpenCode:')
165
- console.log(` Config written to: ${result.opencode.configPath}`)
164
+ if (result.opencode) {
165
+ console.log('\nOpenCode:')
166
+ console.log(` Config written to: ${result.opencode.configPath}`)
167
+ }
166
168
 
167
169
  if (result.gemini) {
168
170
  console.log('\nGemini CLI:')
@@ -180,8 +182,10 @@ program
180
182
  console.log('\nSetup complete!')
181
183
  console.log(' - Use `claude` for Claude Code')
182
184
  console.log(' - Use `codex` for Codex')
183
- console.log(' - Use `opencode` for OpenCode')
184
- if (full) console.log(' - Use `gemini` for Gemini CLI')
185
+ if (full) {
186
+ console.log(' - Use `opencode` for OpenCode')
187
+ console.log(' - Use `gemini` for Gemini CLI')
188
+ }
185
189
  })
186
190
 
187
191
  program
@@ -11,7 +11,7 @@ export interface AllAgentsResult {
11
11
  authPath: string;
12
12
  catalogPath: string;
13
13
  };
14
- opencode: {
14
+ opencode?: {
15
15
  configPath: string;
16
16
  };
17
17
  gemini?: {
@@ -9,20 +9,20 @@ const opencode_1 = require("./opencode");
9
9
  async function writeAllAgentsConfig(apiKey, options = {}) {
10
10
  const claudeResult = (0, claude_code_1.writeClaudeConfig)(apiKey);
11
11
  const codexResult = await (0, codex_1.writeCodexConfig)(apiKey);
12
- const opencodeResult = (0, opencode_1.writeOpencodeConfig)(apiKey);
13
12
  const result = {
14
13
  claude: claudeResult,
15
14
  codex: codexResult,
16
- opencode: opencodeResult,
17
15
  };
18
16
  if (options.full) {
17
+ result.opencode = (0, opencode_1.writeOpencodeConfig)(apiKey);
19
18
  result.gemini = (0, gemini_cli_1.writeGeminiConfig)(apiKey);
20
19
  }
21
20
  return result;
22
21
  }
23
22
  async function installAllAgentsDeps(options = {}) {
24
- const installers = [(0, claude_code_1.installDeps)(), (0, codex_1.installCodexDeps)(), (0, opencode_1.installOpencodeDeps)()];
25
- if (options.full)
26
- installers.push((0, gemini_cli_1.installGeminiDeps)());
23
+ const installers = [(0, claude_code_1.installDeps)(), (0, codex_1.installCodexDeps)()];
24
+ if (options.full) {
25
+ installers.push((0, opencode_1.installOpencodeDeps)(), (0, gemini_cli_1.installGeminiDeps)());
26
+ }
27
27
  await Promise.all(installers);
28
28
  }
@@ -9,6 +9,8 @@ const execa_1 = require("execa");
9
9
  const jsonc_parser_1 = require("jsonc-parser");
10
10
  const utils_1 = require("./utils");
11
11
  const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/';
12
+ const CLAUDE_AUTO_COMPACT_WINDOW = '128000';
13
+ const CLAUDE_DISABLE_1M_CONTEXT = '1';
12
14
  function getClaudeSettingsDir() {
13
15
  return path.join(os.homedir(), '.claude');
14
16
  }
@@ -29,7 +31,9 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
29
31
  "OTEL_METRICS_EXPORTER": "otlp",
30
32
  "ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
31
33
  "ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
32
- "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
34
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
35
+ "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
36
+ "CLAUDE_CODE_DISABLE_1M_CONTEXT": "${CLAUDE_DISABLE_1M_CONTEXT}"
33
37
  },
34
38
  "includeCoAuthoredBy": false,
35
39
  "apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
@@ -63,6 +67,14 @@ function writeVSCodeClaudePluginConfig(apiKey) {
63
67
  { name: 'ANTHROPIC_BASE_URL', value: CLAUDE_BASE_URL },
64
68
  { name: 'ANTHROPIC_AUTH_TOKEN', value: apiKey },
65
69
  { name: 'CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC', value: '1' },
70
+ {
71
+ name: 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',
72
+ value: CLAUDE_AUTO_COMPACT_WINDOW,
73
+ },
74
+ {
75
+ name: 'CLAUDE_CODE_DISABLE_1M_CONTEXT',
76
+ value: CLAUDE_DISABLE_1M_CONTEXT,
77
+ },
66
78
  ], {
67
79
  formattingOptions: {
68
80
  insertSpaces: true,
package/build/codex.js CHANGED
@@ -25,12 +25,11 @@ function getCodexModelCatalogConfigPath() {
25
25
  function getCodexConfigTomlTemplate() {
26
26
  return `model_provider = "jw"
27
27
  model = "gpt-5.4"
28
- model_reasoning_effort = "high"
28
+ model_reasoning_effort = "xhigh"
29
29
  plan_mode_reasoning_effort = "xhigh"
30
30
  model_auto_compact_token_limit = 131072
31
31
  disable_response_storage = true
32
32
  preferred_auth_method = "apikey"
33
- service_tier = "fast"
34
33
  model_catalog_json = ${JSON.stringify(getCodexModelCatalogConfigPath())}
35
34
 
36
35
  [model_providers.jw]
@@ -59,6 +58,7 @@ function mergeTomlTables(existingConfig, templateConfig) {
59
58
  function getMergedCodexConfig(existingContent) {
60
59
  const existingConfig = TOML.parse(existingContent);
61
60
  const templateConfig = TOML.parse(getCodexConfigTomlTemplate());
61
+ delete existingConfig.service_tier;
62
62
  return TOML.stringify(mergeTomlTables(existingConfig, templateConfig));
63
63
  }
64
64
  async function refreshCodexModelCatalog(apiKey) {
@@ -41,20 +41,22 @@ describe('writeAllAgentsConfig', () => {
41
41
  fs.rmSync(tempHome, { recursive: true, force: true })
42
42
  })
43
43
 
44
- test('writes Claude, Codex and OpenCode config by default', async () => {
44
+ test('writes Claude and Codex config by default', async () => {
45
45
  const result = await writeAllAgentsConfig('test-api-key')
46
46
 
47
47
  expect(fs.existsSync(result.claude.settingsPath)).toBe(true)
48
48
  expect(fs.existsSync(result.codex.configPath)).toBe(true)
49
49
  expect(fs.existsSync(result.codex.authPath)).toBe(true)
50
50
  expect(fs.existsSync(result.codex.catalogPath)).toBe(true)
51
- expect(fs.existsSync(result.opencode.configPath)).toBe(true)
51
+ expect(result.opencode).toBeUndefined()
52
52
  expect(result.gemini).toBeUndefined()
53
53
  })
54
54
 
55
- test('includes Gemini config when full option is enabled', async () => {
55
+ test('includes OpenCode and Gemini config when full option is enabled', async () => {
56
56
  const result = await writeAllAgentsConfig('test-api-key', { full: true })
57
57
 
58
+ expect(result.opencode).toBeDefined()
59
+ expect(fs.existsSync(result.opencode!.configPath)).toBe(true)
58
60
  expect(result.gemini).toBeDefined()
59
61
  expect(fs.existsSync(result.gemini!.envPath)).toBe(true)
60
62
  expect(fs.existsSync(result.gemini!.settingsPath)).toBe(true)
@@ -4,44 +4,45 @@ import { writeGeminiConfig, installGeminiDeps } from './gemini-cli'
4
4
  import { writeOpencodeConfig, installOpencodeDeps } from './opencode'
5
5
 
6
6
  export interface AllAgentsOptions {
7
- /** When true, also include Gemini CLI in the combined setup. */
7
+ /** When true, also include OpenCode and Gemini CLI in the combined setup. */
8
8
  full?: boolean
9
9
  }
10
10
 
11
11
  export interface AllAgentsResult {
12
12
  claude: { settingsPath: string; vscodeSettingsPath: string }
13
13
  codex: { configPath: string; authPath: string; catalogPath: string }
14
- opencode: { configPath: string }
14
+ opencode?: { configPath: string }
15
15
  gemini?: { envPath: string; settingsPath: string }
16
16
  }
17
17
 
18
- /** Write configuration for the combined setup (Claude Code + Codex + OpenCode, optional Gemini CLI). */
18
+ /** Write configuration for the combined setup (Claude Code + Codex; optional OpenCode + Gemini CLI with --full). */
19
19
  export async function writeAllAgentsConfig(
20
20
  apiKey: string,
21
21
  options: AllAgentsOptions = {}
22
22
  ): Promise<AllAgentsResult> {
23
23
  const claudeResult = writeClaudeConfig(apiKey)
24
24
  const codexResult = await writeCodexConfig(apiKey)
25
- const opencodeResult = writeOpencodeConfig(apiKey)
26
25
 
27
26
  const result: AllAgentsResult = {
28
27
  claude: claudeResult,
29
28
  codex: codexResult,
30
- opencode: opencodeResult,
31
29
  }
32
30
 
33
31
  if (options.full) {
32
+ result.opencode = writeOpencodeConfig(apiKey)
34
33
  result.gemini = writeGeminiConfig(apiKey)
35
34
  }
36
35
 
37
36
  return result
38
37
  }
39
38
 
40
- /** Install dependencies for the combined setup (Claude Code + Codex + OpenCode, optional Gemini CLI). */
39
+ /** Install dependencies for the combined setup (Claude Code + Codex; optional OpenCode + Gemini CLI with --full). */
41
40
  export async function installAllAgentsDeps(
42
41
  options: AllAgentsOptions = {}
43
42
  ): Promise<void> {
44
- const installers = [installDeps(), installCodexDeps(), installOpencodeDeps()]
45
- if (options.full) installers.push(installGeminiDeps())
43
+ const installers = [installDeps(), installCodexDeps()]
44
+ if (options.full) {
45
+ installers.push(installOpencodeDeps(), installGeminiDeps())
46
+ }
46
47
  await Promise.all(installers)
47
48
  }
@@ -74,6 +74,10 @@ describe('writeClaudeConfig', () => {
74
74
  expect(claudeSettings).toContain(
75
75
  '"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"'
76
76
  )
77
+ expect(claudeSettings).toContain(
78
+ '"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "128000"'
79
+ )
80
+ expect(claudeSettings).toContain('"CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"')
77
81
 
78
82
  const vscodeSettings = fs.readFileSync(result.vscodeSettingsPath, 'utf8')
79
83
  expect(vscodeSettings).toContain('"editor.fontSize": 14')
@@ -83,6 +87,9 @@ describe('writeClaudeConfig', () => {
83
87
  expect(vscodeSettings).toContain(
84
88
  '"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"'
85
89
  )
90
+ expect(vscodeSettings).toContain('"CLAUDE_CODE_AUTO_COMPACT_WINDOW"')
91
+ expect(vscodeSettings).toContain('"128000"')
92
+ expect(vscodeSettings).toContain('"CLAUDE_CODE_DISABLE_1M_CONTEXT"')
86
93
  expect(vscodeSettings).toContain('"1"')
87
94
  expect(vscodeSettings).toContain('"test-api-key"')
88
95
  })
@@ -6,6 +6,8 @@ import { ParseError, applyEdits, modify, parse } from 'jsonc-parser'
6
6
  import { ensureDir, commandExists, PNPM_INSTALL_ENV } from './utils'
7
7
 
8
8
  const CLAUDE_BASE_URL = 'https://ai.gengjiawen.com/api/claude/'
9
+ const CLAUDE_AUTO_COMPACT_WINDOW = '128000'
10
+ const CLAUDE_DISABLE_1M_CONTEXT = '1'
9
11
 
10
12
  /** Return Claude settings directory path */
11
13
  function getClaudeSettingsDir(): string {
@@ -43,7 +45,9 @@ const CLAUDE_SETTINGS_TEMPLATE = `{
43
45
  "OTEL_METRICS_EXPORTER": "otlp",
44
46
  "ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
45
47
  "ANTHROPIC_BASE_URL": "${CLAUDE_BASE_URL}",
46
- "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
48
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
49
+ "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "${CLAUDE_AUTO_COMPACT_WINDOW}",
50
+ "CLAUDE_CODE_DISABLE_1M_CONTEXT": "${CLAUDE_DISABLE_1M_CONTEXT}"
47
51
  },
48
52
  "includeCoAuthoredBy": false,
49
53
  "apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
@@ -95,6 +99,14 @@ function writeVSCodeClaudePluginConfig(apiKey: string): {
95
99
  { name: 'ANTHROPIC_BASE_URL', value: CLAUDE_BASE_URL },
96
100
  { name: 'ANTHROPIC_AUTH_TOKEN', value: apiKey },
97
101
  { name: 'CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC', value: '1' },
102
+ {
103
+ name: 'CLAUDE_CODE_AUTO_COMPACT_WINDOW',
104
+ value: CLAUDE_AUTO_COMPACT_WINDOW,
105
+ },
106
+ {
107
+ name: 'CLAUDE_CODE_DISABLE_1M_CONTEXT',
108
+ value: CLAUDE_DISABLE_1M_CONTEXT,
109
+ },
98
110
  ],
99
111
  {
100
112
  formattingOptions: {
@@ -80,7 +80,6 @@ custom_model = "keep-me"
80
80
 
81
81
  await writeCodexConfig('test-api-key')
82
82
  const config = TOML.parse(fs.readFileSync(configPath, 'utf8')) as {
83
- service_tier: string
84
83
  custom_flag: boolean
85
84
  model: string
86
85
  model_catalog_json: string
@@ -94,7 +93,7 @@ custom_model = "keep-me"
94
93
  }
95
94
  }
96
95
 
97
- expect(config.service_tier).toBe('fast')
96
+ expect(config).not.toHaveProperty('service_tier')
98
97
  expect(config.custom_flag).toBe(true)
99
98
  expect(config.model).toBe('gpt-5.4')
100
99
  expect(config.model_catalog_json).toBe(getExpectedModelCatalogConfigPath())
@@ -125,7 +124,6 @@ base_url = "https://example.com"
125
124
  model: string
126
125
  model_catalog_json: string
127
126
  preferred_auth_method: string
128
- service_tier: string
129
127
  model_providers: {
130
128
  jw: {
131
129
  name: string
@@ -138,7 +136,7 @@ base_url = "https://example.com"
138
136
  expect(config.model_catalog_json).toBe(getExpectedModelCatalogConfigPath())
139
137
  expect(config.preferred_auth_method).toBe('apikey')
140
138
  expect(config.model_providers.jw.name).toBe('jw')
141
- expect(config.service_tier).toBe('fast')
139
+ expect(config).not.toHaveProperty('service_tier')
142
140
  })
143
141
 
144
142
  test('refreshes remote model catalog after writing config', async () => {
package/libs/codex.ts CHANGED
@@ -30,12 +30,11 @@ function getCodexModelCatalogConfigPath(): string {
30
30
  function getCodexConfigTomlTemplate(): string {
31
31
  return `model_provider = "jw"
32
32
  model = "gpt-5.4"
33
- model_reasoning_effort = "high"
33
+ model_reasoning_effort = "xhigh"
34
34
  plan_mode_reasoning_effort = "xhigh"
35
35
  model_auto_compact_token_limit = 131072
36
36
  disable_response_storage = true
37
37
  preferred_auth_method = "apikey"
38
- service_tier = "fast"
39
38
  model_catalog_json = ${JSON.stringify(getCodexModelCatalogConfigPath())}
40
39
 
41
40
  [model_providers.jw]
@@ -75,6 +74,7 @@ function mergeTomlTables(
75
74
  function getMergedCodexConfig(existingContent: string): string {
76
75
  const existingConfig = TOML.parse(existingContent) as TomlTable
77
76
  const templateConfig = TOML.parse(getCodexConfigTomlTemplate()) as TomlTable
77
+ delete existingConfig.service_tier
78
78
 
79
79
  return TOML.stringify(mergeTomlTables(existingConfig, templateConfig))
80
80
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gengjiawen/os-init",
3
3
  "private": false,
4
- "version": "1.20.0",
4
+ "version": "1.22.0",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "bin": {
@@ -42,15 +42,21 @@
42
42
  "@types/node": "24.1.0",
43
43
  "cpy-cli": "^6.0.0",
44
44
  "husky": "9.1.6",
45
- "jest": "30.2.0",
45
+ "jest": "30.3.0",
46
46
  "lint-staged": "^15.2.2",
47
47
  "nodemon": "3.1.4",
48
48
  "prettier": "3.5.3",
49
49
  "rimraf": "6.1.2",
50
- "ts-jest": "29.4.6",
50
+ "ts-jest": "29.4.9",
51
51
  "ts-node": "^10.9.1",
52
52
  "typescript": "5.6.3"
53
53
  },
54
+ "pnpm": {
55
+ "overrides": {
56
+ "minimatch@3.1.2": "3.1.3",
57
+ "minimatch@9.0.5": "9.0.9"
58
+ }
59
+ },
54
60
  "husky": {
55
61
  "hooks": {
56
62
  "pre-commit": "lint-staged"