@gengjiawen/os-init 1.7.1 → 1.8.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.0](https://github.com/gengjiawen/os-init/compare/v1.7.1...v1.8.0) (2025-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * bump andoid tool version ([e54ef83](https://github.com/gengjiawen/os-init/commit/e54ef835b9a4baa03f89cfca651b0d032364734b))
9
+ * refine default sdk home ([690d4ef](https://github.com/gengjiawen/os-init/commit/690d4efdeec1b96da2296e1275cfa2898382fea2))
10
+
3
11
  ## [1.7.1](https://github.com/gengjiawen/os-init/compare/v1.7.0...v1.7.1) (2025-11-09)
4
12
 
5
13
 
package/README.md CHANGED
@@ -2,41 +2,10 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40gengjiawen%2Fos-init)](https://www.npmjs.com/package/@gengjiawen/os-init)
4
4
 
5
- A CLI tool to quickly configure AI development tools and environments.
5
+ A CLI tool to quickly configure development tools and environments.
6
6
 
7
7
  ## Usage
8
8
 
9
- ### Configure Claude Code
10
-
11
- ```bash
12
- pnpx @gengjiawen/os-init set-cc <API_KEY>
13
- ```
14
-
15
- Configures Claude Code Router with your API key. This command will:
16
- - Write `~/.claude-code-router/config.json`
17
- - Write `~/.claude/settings.json`
18
- - Install global tools: `@anthropic-ai/claude-code`, `@musistudio/claude-code-router`
19
-
20
- ### Configure Codex CLI
21
-
22
- ```bash
23
- pnpx @gengjiawen/os-init set-codex <API_KEY>
24
- ```
25
-
26
- Configures Codex CLI with your API key. This command will:
27
- - Write `~/.codex/config.toml`
28
- - Write `~/.codex/auth.json`
29
- - Install global tool: `@openai/codex`
30
-
31
- ### Configure Raycast AI
32
-
33
- ```bash
34
- pnpx @gengjiawen/os-init set-raycast-ai <API_KEY>
35
- ```
36
-
37
- Configures Raycast AI providers with your API key. This command will:
38
- - Write `~/.config/raycast/ai/providers.yaml`
39
-
40
9
  ### Setup Dev Environment
41
10
 
42
11
  ```bash
@@ -44,12 +13,14 @@ pnpx @gengjiawen/os-init set-dev <SSH_PUBLIC_KEY>
44
13
  ```
45
14
 
46
15
  Sets up a Docker-based development environment with SSH access. This command will:
16
+
47
17
  - Copy `dev-setup` directory to your current directory (or specify with `-t, --target <dir>`)
48
18
  - Configure SSH public key in Dockerfile
49
19
  - Automatically run `docker-compose build && docker-compose up -d` (if docker-compose is available)
50
20
  - Display SSH connection command with your local IP address
51
21
 
52
22
  Example:
23
+
53
24
  ```bash
54
25
  pnpx @gengjiawen/os-init set-dev "ssh-rsa AAAAB3NzaC1yc2..."
55
26
  ```
@@ -61,6 +32,7 @@ pnpx @gengjiawen/os-init set-android
61
32
  ```
62
33
 
63
34
  Sets up a complete Android development environment on macOS and Linux. This command will:
35
+
64
36
  - Install Android SDK to `~/Android` (or custom path with `--android-home <path>`)
65
37
  - Download and install Android SDK Command-line Tools, Platform Tools, Build Tools, CMake, and NDK
66
38
  - Automatically accept Android SDK licenses
@@ -69,6 +41,7 @@ Sets up a complete Android development environment on macOS and Linux. This comm
69
41
  - No sudo access required
70
42
 
71
43
  Example:
44
+
72
45
  ```bash
73
46
  # Custom installation path
74
47
  pnpx @gengjiawen/os-init set-android --android-home ~/my-android-sdk
@@ -79,4 +52,38 @@ pnpx @gengjiawen/os-init set-android --skip-env-vars
79
52
 
80
53
  ---
81
54
 
55
+ ### Configure Claude Code
56
+
57
+ ```bash
58
+ pnpx @gengjiawen/os-init set-cc <API_KEY>
59
+ ```
60
+
61
+ Configures Claude Code Router with your API key. This command will:
62
+
63
+ - Write `~/.claude-code-router/config.json`
64
+ - Write `~/.claude/settings.json`
65
+ - Install global tools: `@anthropic-ai/claude-code`, `@musistudio/claude-code-router`
66
+
67
+ ### Configure Codex CLI
68
+
69
+ ```bash
70
+ pnpx @gengjiawen/os-init set-codex <API_KEY>
71
+ ```
72
+
73
+ Configures Codex CLI with your API key. This command will:
74
+
75
+ - Write `~/.codex/config.toml`
76
+ - Write `~/.codex/auth.json`
77
+ - Install global tool: `@openai/codex`
78
+
79
+ ### Configure Raycast AI
80
+
81
+ ```bash
82
+ pnpx @gengjiawen/os-init set-raycast-ai <API_KEY>
83
+ ```
84
+
85
+ Configures Raycast AI providers with your API key. This command will:
86
+
87
+ - Write `~/.config/raycast/ai/providers.yaml`
88
+
82
89
  Project generated by [gengjiawen/ts-scaffold](https://github.com/gengjiawen/ts-scaffold)
@@ -10,12 +10,29 @@ const fish_shell_utils_1 = require("./fish-shell-utils");
10
10
  const ANDROID_CONFIG = {
11
11
  sdkVersion: '11076708',
12
12
  platformVersion: 'android-36',
13
- buildToolsVersion: '36.0.0',
14
- cmakeVersion: '3.30.5',
13
+ buildToolsVersion: '36.1.0',
14
+ cmakeVersion: '4.1.2',
15
15
  ndkVersion: '29.0.14206865',
16
16
  };
17
17
  function getDefaultAndroidHome() {
18
- return path.join(os.homedir(), 'Android');
18
+ const { ANDROID_SDK_ROOT, ANDROID_HOME, LOCALAPPDATA } = process.env;
19
+ if (ANDROID_SDK_ROOT && ANDROID_SDK_ROOT.trim())
20
+ return ANDROID_SDK_ROOT;
21
+ if (ANDROID_HOME && ANDROID_HOME.trim())
22
+ return ANDROID_HOME;
23
+ const home = os.homedir();
24
+ switch (process.platform) {
25
+ case 'darwin':
26
+ return path.join(home, 'Library', 'Android', 'sdk');
27
+ case 'linux':
28
+ return path.join(home, 'Android', 'Sdk');
29
+ case 'win32':
30
+ return LOCALAPPDATA
31
+ ? path.join(LOCALAPPDATA, 'Android', 'Sdk')
32
+ : path.join(home, 'AppData', 'Local', 'Android', 'Sdk');
33
+ default:
34
+ return path.join(home, 'Android', 'Sdk');
35
+ }
19
36
  }
20
37
  function getSdkDownloadUrl(sdkVersion) {
21
38
  const platform = os.platform();
@@ -72,7 +89,7 @@ function appendEnvVarsToShellConfig(rcFile, envVars) {
72
89
  console.log(`Environment variables already exist in: ${bashrcFile}`);
73
90
  }
74
91
  if (shell.includes('fish')) {
75
- (0, fish_shell_utils_1.appendFishImportScript)(rcFile);
92
+ (0, fish_shell_utils_1.appendFishImportScript)();
76
93
  }
77
94
  }
78
95
  async function setupAndroidEnvironment(options) {
@@ -1,2 +1,2 @@
1
1
  export declare function getFishImportBashExports(): string;
2
- export declare function appendFishImportScript(fishConfigPath: string): void;
2
+ export declare function appendFishImportScript(): void;
@@ -4,6 +4,7 @@ exports.getFishImportBashExports = getFishImportBashExports;
4
4
  exports.appendFishImportScript = appendFishImportScript;
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
+ const os = require("os");
7
8
  function getFishImportBashExports() {
8
9
  return `
9
10
  # ===== Import environment variables from .bashrc - START (2025-11-09) =====
@@ -36,7 +37,13 @@ end
36
37
  # ===== Import environment variables from .bashrc - END =====
37
38
  `;
38
39
  }
39
- function appendFishImportScript(fishConfigPath) {
40
+ function appendFishImportScript() {
41
+ const homeDir = os.homedir();
42
+ const fishConfigPath = path.join(homeDir, '.config', 'fish', 'config.fish');
43
+ if (!fs.existsSync(fishConfigPath)) {
44
+ console.log('Fish shell config not found, skipping fish setup');
45
+ return;
46
+ }
40
47
  const configDir = path.dirname(fishConfigPath);
41
48
  if (!fs.existsSync(configDir)) {
42
49
  fs.mkdirSync(configDir, { recursive: true });
@@ -9,14 +9,32 @@ import { appendFishImportScript } from './fish-shell-utils'
9
9
  const ANDROID_CONFIG = {
10
10
  sdkVersion: '11076708',
11
11
  platformVersion: 'android-36',
12
- buildToolsVersion: '36.0.0',
13
- cmakeVersion: '3.30.5',
12
+ buildToolsVersion: '36.1.0',
13
+ cmakeVersion: '4.1.2',
14
14
  ndkVersion: '29.0.14206865',
15
15
  } as const
16
16
 
17
17
  /** Get default Android home directory */
18
18
  function getDefaultAndroidHome(): string {
19
- return path.join(os.homedir(), 'Android')
19
+ const { ANDROID_SDK_ROOT, ANDROID_HOME, LOCALAPPDATA } = process.env
20
+
21
+ if (ANDROID_SDK_ROOT && ANDROID_SDK_ROOT.trim()) return ANDROID_SDK_ROOT
22
+ if (ANDROID_HOME && ANDROID_HOME.trim()) return ANDROID_HOME
23
+
24
+ const home = os.homedir()
25
+ switch (process.platform) {
26
+ case 'darwin':
27
+ return path.join(home, 'Library', 'Android', 'sdk')
28
+ case 'linux':
29
+ return path.join(home, 'Android', 'Sdk')
30
+ case 'win32':
31
+ return LOCALAPPDATA
32
+ ? path.join(LOCALAPPDATA, 'Android', 'Sdk')
33
+ : path.join(home, 'AppData', 'Local', 'Android', 'Sdk')
34
+ default:
35
+ // Reasonable fallback for other POSIX-like environments
36
+ return path.join(home, 'Android', 'Sdk')
37
+ }
20
38
  }
21
39
 
22
40
  /** Get SDK download URL based on platform */
@@ -87,7 +105,7 @@ function appendEnvVarsToShellConfig(rcFile: string, envVars: string): void {
87
105
 
88
106
  // For fish shell, always write to bashrc first, then add import script to fish config
89
107
  if (shell.includes('fish')) {
90
- appendFishImportScript(rcFile)
108
+ appendFishImportScript()
91
109
  }
92
110
  }
93
111
 
@@ -1,5 +1,6 @@
1
1
  import * as fs from 'fs'
2
2
  import * as path from 'path'
3
+ import * as os from 'os'
3
4
 
4
5
  /** Get Fish shell script to import bash exports */
5
6
  export function getFishImportBashExports(): string {
@@ -39,8 +40,18 @@ end
39
40
  * Append bash import script to Fish shell config file
40
41
  * This function adds the import script to fish config.fish to automatically
41
42
  * source environment variables from .bashrc
43
+ * It detects fish shell by checking if ~/.config/fish/config.fish exists
42
44
  */
43
- export function appendFishImportScript(fishConfigPath: string): void {
45
+ export function appendFishImportScript(): void {
46
+ const homeDir = os.homedir()
47
+ const fishConfigPath = path.join(homeDir, '.config', 'fish', 'config.fish')
48
+
49
+ // Detect if fish shell exists by checking config file
50
+ if (!fs.existsSync(fishConfigPath)) {
51
+ console.log('Fish shell config not found, skipping fish setup')
52
+ return
53
+ }
54
+
44
55
  // Ensure fish config directory exists
45
56
  const configDir = path.dirname(fishConfigPath)
46
57
  if (!fs.existsSync(configDir)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gengjiawen/os-init",
3
3
  "private": false,
4
- "version": "1.7.1",
4
+ "version": "1.8.0",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "bin": {