@gengjiawen/os-init 1.2.1 → 1.4.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/.github/workflows/nodejs.yml +14 -6
- package/.github/workflows/release-please.yml +50 -0
- package/CHANGELOG.md +50 -0
- package/README.md +12 -6
- package/bin/bin.js +33 -4
- package/build/index.d.ts +7 -1
- package/build/index.js +73 -11
- package/libs/index.ts +100 -13
- package/macOS-init.md +3 -0
- package/package.json +5 -2
- package/packages/win/LICENSE +0 -21
- package/packages/win/README.md +0 -8
- package/packages/win/__tests__/index.test.ts +0 -5
- package/packages/win/bin/init.js +0 -21
- package/packages/win/libs/index.ts +0 -15
- package/packages/win/libs/packages.ts +0 -8
- package/packages/win/package.json +0 -33
- package/packages/win/tsconfig.json +0 -11
- package/pnpm-lock.yaml +0 -3786
|
@@ -10,14 +10,22 @@ jobs:
|
|
|
10
10
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
|
11
11
|
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Setup Node.js (LTS)
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 'lts/*'
|
|
18
|
+
- name: Setup pnpm
|
|
19
|
+
uses: pnpm/action-setup@v4
|
|
20
|
+
with:
|
|
21
|
+
version: 9
|
|
14
22
|
- name: Envinfo
|
|
15
23
|
run: npx envinfo
|
|
16
|
-
- name:
|
|
24
|
+
- name: Install, build, and test (pnpm)
|
|
17
25
|
run: |
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
pnpm install --frozen-lockfile=false
|
|
27
|
+
pnpm build
|
|
28
|
+
pnpm format:check
|
|
29
|
+
pnpm test
|
|
22
30
|
env:
|
|
23
31
|
CI: true
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
issues: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release-please:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- id: release
|
|
18
|
+
uses: googleapis/release-please-action@v4
|
|
19
|
+
with:
|
|
20
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
21
|
+
release-type: node
|
|
22
|
+
|
|
23
|
+
- name: Checkout
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '24.x'
|
|
30
|
+
registry-url: 'https://registry.npmjs.org'
|
|
31
|
+
|
|
32
|
+
- name: Setup pnpm
|
|
33
|
+
uses: pnpm/action-setup@v4
|
|
34
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
35
|
+
with:
|
|
36
|
+
version: 9
|
|
37
|
+
|
|
38
|
+
- name: Install dependencies
|
|
39
|
+
run: pnpm install --frozen-lockfile=false
|
|
40
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
41
|
+
|
|
42
|
+
- name: Build
|
|
43
|
+
run: pnpm run build
|
|
44
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
45
|
+
|
|
46
|
+
- name: Publish
|
|
47
|
+
env:
|
|
48
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
49
|
+
run: npm publish
|
|
50
|
+
if: ${{ steps.release.outputs.release_created }}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.4.0](https://github.com/gengjiawen/os-init/compare/v1.3.2...v1.4.0) (2025-10-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add Raycast AI configuration setup and command ([b5d64d4](https://github.com/gengjiawen/os-init/commit/b5d64d4fa65dddf739b7b3b6e50ce3f94346538a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* format ([ad7cc79](https://github.com/gengjiawen/os-init/commit/ad7cc791efb1437c2eaae916fe3ba43bc545b355))
|
|
14
|
+
|
|
15
|
+
## [1.3.2](https://github.com/gengjiawen/os-init/compare/v1.3.1...v1.3.2) (2025-10-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* release process again ([d436b08](https://github.com/gengjiawen/os-init/commit/d436b0891c4ce2262339b2b36107a5c65abdbf83))
|
|
21
|
+
|
|
22
|
+
## [1.3.1](https://github.com/gengjiawen/os-init/compare/v1.3.0...v1.3.1) (2025-10-19)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* release process ([a833c10](https://github.com/gengjiawen/os-init/commit/a833c1046247bb033a286d6173f493c1984f1150))
|
|
28
|
+
|
|
29
|
+
## 1.3.0 (2025-10-19)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add cc support ([6bf77d8](https://github.com/gengjiawen/os-init/commit/6bf77d8d01b24babfa8c61e14cb1600b5efea309))
|
|
35
|
+
* bump deps and updatete cchoco scritp ([f47c982](https://github.com/gengjiawen/os-init/commit/f47c982e163c8396ef579becd869ae0ae0124c2c))
|
|
36
|
+
* support codex ([1b95737](https://github.com/gengjiawen/os-init/commit/1b957378dbfce4945aea74f3d84326dc5e657cc6))
|
|
37
|
+
* update configuration handling for Claude integration and enhance .gitignore ([5c59ed8](https://github.com/gengjiawen/os-init/commit/5c59ed85125e3247c97dd6d339584fe6d9aa63a2))
|
|
38
|
+
* update macOS commands ([b1d80cf](https://github.com/gengjiawen/os-init/commit/b1d80cf8fa06360fff2be1e188b7d09cfb2d8479))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* choco install ([9af90d2](https://github.com/gengjiawen/os-init/commit/9af90d299b5865d54b7b3eff467f086dacdd175d))
|
|
44
|
+
* correct format-check command to format:check in CI workflow ([3befc98](https://github.com/gengjiawen/os-init/commit/3befc989086cc04da5306b42159bcd2b751451b6))
|
|
45
|
+
* publish ([3ea009e](https://github.com/gengjiawen/os-init/commit/3ea009e1634e94e7b8c1801ff6754cb7a5012ccf))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Miscellaneous Chores
|
|
49
|
+
|
|
50
|
+
* release 1.3.0 ([588992a](https://github.com/gengjiawen/os-init/commit/588992ab4565e792900e1efa50ebdedca9fca91d))
|
package/README.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
##
|
|
1
|
+
## os-init CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
What it does
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
- Configure Claude Code Router with your API key (writes `~/.claude-code-router/config.json`).
|
|
6
|
+
- Configure Codex CLI with your API key (writes `~/.codex/config.toml` and `~/.codex/auth.json`).
|
|
7
|
+
- Configure Raycast AI with your API key (writes `~/.config/raycast/ai/providers.yaml`).
|
|
8
|
+
- Install global tools: `@anthropic-ai/claude-code`, `@musistudio/claude-code-router`, `@openai/codex`.
|
|
9
|
+
|
|
10
|
+
Usage
|
|
11
|
+
|
|
12
|
+
- `pnpx @gengjiawen/os-init set-cc <API_KEY>`
|
|
13
|
+
- `pnpx @gengjiawen/os-init set-codex <API_KEY>`
|
|
14
|
+
- `pnpx @gengjiawen/os-init set-raycast-ai <API_KEY>`
|
|
9
15
|
|
|
10
16
|
Project generated by [gengjiawen/ts-scaffold](https://github.com/gengjiawen/ts-scaffold)
|
package/bin/bin.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander')
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
writeClaudeConfig,
|
|
6
|
+
installDeps,
|
|
7
|
+
writeCodexConfig,
|
|
8
|
+
installCodexDeps,
|
|
9
|
+
writeRaycastConfig,
|
|
10
|
+
} = require('../build')
|
|
5
11
|
|
|
6
12
|
const program = new Command()
|
|
7
13
|
|
|
@@ -17,14 +23,17 @@ program
|
|
|
17
23
|
return
|
|
18
24
|
}
|
|
19
25
|
try {
|
|
20
|
-
const
|
|
21
|
-
console.log(`
|
|
26
|
+
const { routerConfigPath, settingsPath } = writeClaudeConfig(apiKey)
|
|
27
|
+
console.log(`Claude router config written to: ${routerConfigPath}`)
|
|
28
|
+
console.log(`Claude settings written to: ${settingsPath}`)
|
|
22
29
|
await installDeps()
|
|
23
30
|
} catch (err) {
|
|
24
31
|
console.error('Failed to complete setup:', err.message)
|
|
25
32
|
process.exit(1)
|
|
26
33
|
}
|
|
27
|
-
console.log(
|
|
34
|
+
console.log(
|
|
35
|
+
'Claude code is ready, use `claude` in terminal to start building'
|
|
36
|
+
)
|
|
28
37
|
})
|
|
29
38
|
|
|
30
39
|
program
|
|
@@ -49,4 +58,24 @@ program
|
|
|
49
58
|
console.log('Codex is ready. use `codex` in terminal to start building')
|
|
50
59
|
})
|
|
51
60
|
|
|
61
|
+
program
|
|
62
|
+
.command('set-raycast-ai')
|
|
63
|
+
.description('setup Raycast AI providers config')
|
|
64
|
+
.argument('<apiKey>', 'API key to set for Raycast AI')
|
|
65
|
+
.action(async (apiKey) => {
|
|
66
|
+
if (!apiKey || String(apiKey).trim().length === 0) {
|
|
67
|
+
console.error('Missing required argument: <apiKey>')
|
|
68
|
+
program.help({ error: true })
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
const { configPath } = writeRaycastConfig(apiKey)
|
|
73
|
+
console.log(`Raycast AI config written to: ${configPath}`)
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error('Failed to setup Raycast AI:', err.message)
|
|
76
|
+
process.exit(1)
|
|
77
|
+
}
|
|
78
|
+
console.log('Raycast AI is ready to use')
|
|
79
|
+
})
|
|
80
|
+
|
|
52
81
|
program.parse(process.argv)
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function writeClaudeConfig(apiKey: string): {
|
|
2
|
+
routerConfigPath: string;
|
|
3
|
+
settingsPath: string;
|
|
4
|
+
};
|
|
2
5
|
export declare function installDeps(): Promise<void>;
|
|
3
6
|
export declare function writeCodexConfig(apiKey: string): {
|
|
4
7
|
configPath: string;
|
|
5
8
|
authPath: string;
|
|
6
9
|
};
|
|
7
10
|
export declare function installCodexDeps(): Promise<void>;
|
|
11
|
+
export declare function writeRaycastConfig(apiKey: string): {
|
|
12
|
+
configPath: string;
|
|
13
|
+
};
|
package/build/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.writeClaudeConfig = writeClaudeConfig;
|
|
4
4
|
exports.installDeps = installDeps;
|
|
5
5
|
exports.writeCodexConfig = writeCodexConfig;
|
|
6
6
|
exports.installCodexDeps = installCodexDeps;
|
|
7
|
+
exports.writeRaycastConfig = writeRaycastConfig;
|
|
7
8
|
const fs = require("fs");
|
|
8
9
|
const path = require("path");
|
|
9
10
|
const os = require("os");
|
|
@@ -20,7 +21,7 @@ const DEFAULT_TEMPLATE = `{
|
|
|
20
21
|
"name": "jw",
|
|
21
22
|
"api_base_url": "https://ai.gengjiawen.com/api/openai/v1/chat/completions",
|
|
22
23
|
"api_key": "API_KEY_PLACEHOLDER",
|
|
23
|
-
"models": ["code", "free"
|
|
24
|
+
"models": ["code", "free"],
|
|
24
25
|
"transformer": {
|
|
25
26
|
"use": ["openrouter"]
|
|
26
27
|
}
|
|
@@ -33,17 +34,43 @@ const DEFAULT_TEMPLATE = `{
|
|
|
33
34
|
"longContext": "jw,code"
|
|
34
35
|
}
|
|
35
36
|
}`;
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
function getClaudeSettingsDir() {
|
|
38
|
+
return path.join(os.homedir(), '.claude');
|
|
39
|
+
}
|
|
40
|
+
const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
41
|
+
"env": {
|
|
42
|
+
"DISABLE_TELEMETRY": "1",
|
|
43
|
+
"OTEL_METRICS_EXPORTER": "otlp",
|
|
44
|
+
"ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
|
|
45
|
+
"ANTHROPIC_BASE_URL": "https://ai.gengjiawen.com/api/claude/",
|
|
46
|
+
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
47
|
+
},
|
|
48
|
+
"includeCoAuthoredBy": false,
|
|
49
|
+
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
50
|
+
"permissions": {
|
|
51
|
+
"allow": [],
|
|
52
|
+
"deny": []
|
|
53
|
+
}
|
|
54
|
+
}`;
|
|
55
|
+
function writeClaudeConfig(apiKey) {
|
|
56
|
+
const routerConfigDir = getDefaultConfigDir();
|
|
57
|
+
const routerConfigPath = path.join(routerConfigDir, 'config.json');
|
|
58
|
+
ensureDir(routerConfigDir);
|
|
59
|
+
const routerContent = DEFAULT_TEMPLATE.replace('API_KEY_PLACEHOLDER', apiKey);
|
|
60
|
+
fs.writeFileSync(routerConfigPath, routerContent);
|
|
61
|
+
const settingsDir = getClaudeSettingsDir();
|
|
62
|
+
const settingsPath = path.join(settingsDir, 'settings.json');
|
|
63
|
+
ensureDir(settingsDir);
|
|
64
|
+
const settingsContent = CLAUDE_SETTINGS_TEMPLATE.replace(/API_KEY_PLACEHOLDER/g, apiKey);
|
|
65
|
+
fs.writeFileSync(settingsPath, settingsContent);
|
|
66
|
+
return { routerConfigPath, settingsPath };
|
|
43
67
|
}
|
|
44
68
|
async function commandExists(command) {
|
|
45
69
|
try {
|
|
46
|
-
const { failed } = await (0, execa_1.execa)(command, ['--version'], {
|
|
70
|
+
const { failed } = await (0, execa_1.execa)(command, ['--version'], {
|
|
71
|
+
stdio: 'ignore',
|
|
72
|
+
reject: false,
|
|
73
|
+
});
|
|
47
74
|
return !failed;
|
|
48
75
|
}
|
|
49
76
|
catch (error) {
|
|
@@ -51,7 +78,10 @@ async function commandExists(command) {
|
|
|
51
78
|
}
|
|
52
79
|
}
|
|
53
80
|
async function installDeps() {
|
|
54
|
-
const packages = [
|
|
81
|
+
const packages = [
|
|
82
|
+
'@anthropic-ai/claude-code',
|
|
83
|
+
'@musistudio/claude-code-router',
|
|
84
|
+
];
|
|
55
85
|
const usePnpm = await commandExists('pnpm');
|
|
56
86
|
if (usePnpm) {
|
|
57
87
|
console.log('pnpm detected. Installing dependencies with pnpm...');
|
|
@@ -100,3 +130,35 @@ async function installCodexDeps() {
|
|
|
100
130
|
}
|
|
101
131
|
console.log('Codex dependency installed successfully.');
|
|
102
132
|
}
|
|
133
|
+
function getRaycastAIConfigDir() {
|
|
134
|
+
return path.join(os.homedir(), '.config', 'raycast', 'ai');
|
|
135
|
+
}
|
|
136
|
+
const RAYCAST_PROVIDERS_YAML_TEMPLATE = `providers:
|
|
137
|
+
- id: my_provider
|
|
138
|
+
name: gengjiawen AI
|
|
139
|
+
base_url: https://ai.gengjiawen.com/api/openai/v1/
|
|
140
|
+
api_keys:
|
|
141
|
+
openai: API_KEY_PLACEHOLDER
|
|
142
|
+
models:
|
|
143
|
+
- id: sota
|
|
144
|
+
name: "sota"
|
|
145
|
+
context: 200000
|
|
146
|
+
provider: openai
|
|
147
|
+
abilities:
|
|
148
|
+
temperature:
|
|
149
|
+
supported: true
|
|
150
|
+
vision:
|
|
151
|
+
supported: true
|
|
152
|
+
system_message:
|
|
153
|
+
supported: true
|
|
154
|
+
tools:
|
|
155
|
+
supported: true
|
|
156
|
+
`;
|
|
157
|
+
function writeRaycastConfig(apiKey) {
|
|
158
|
+
const configDir = getRaycastAIConfigDir();
|
|
159
|
+
ensureDir(configDir);
|
|
160
|
+
const configPath = path.join(configDir, 'providers.yaml');
|
|
161
|
+
const content = RAYCAST_PROVIDERS_YAML_TEMPLATE.replace('API_KEY_PLACEHOLDER', apiKey);
|
|
162
|
+
fs.writeFileSync(configPath, content);
|
|
163
|
+
return { configPath };
|
|
164
|
+
}
|
package/libs/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ const DEFAULT_TEMPLATE = `{
|
|
|
20
20
|
"name": "jw",
|
|
21
21
|
"api_base_url": "https://ai.gengjiawen.com/api/openai/v1/chat/completions",
|
|
22
22
|
"api_key": "API_KEY_PLACEHOLDER",
|
|
23
|
-
"models": ["code", "free"
|
|
23
|
+
"models": ["code", "free"],
|
|
24
24
|
"transformer": {
|
|
25
25
|
"use": ["openrouter"]
|
|
26
26
|
}
|
|
@@ -34,21 +34,61 @@ const DEFAULT_TEMPLATE = `{
|
|
|
34
34
|
}
|
|
35
35
|
}`
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
/** Return Claude settings directory path */
|
|
38
|
+
function getClaudeSettingsDir(): string {
|
|
39
|
+
return path.join(os.homedir(), '.claude')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Template for Claude settings.json */
|
|
43
|
+
const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
44
|
+
"env": {
|
|
45
|
+
"DISABLE_TELEMETRY": "1",
|
|
46
|
+
"OTEL_METRICS_EXPORTER": "otlp",
|
|
47
|
+
"ANTHROPIC_API_KEY": "API_KEY_PLACEHOLDER",
|
|
48
|
+
"ANTHROPIC_BASE_URL": "https://ai.gengjiawen.com/api/claude/",
|
|
49
|
+
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
50
|
+
},
|
|
51
|
+
"includeCoAuthoredBy": false,
|
|
52
|
+
"apiKeyHelper": "echo 'API_KEY_PLACEHOLDER'",
|
|
53
|
+
"permissions": {
|
|
54
|
+
"allow": [],
|
|
55
|
+
"deny": []
|
|
56
|
+
}
|
|
57
|
+
}`
|
|
58
|
+
|
|
59
|
+
/** Write Claude config files (both router config and settings) */
|
|
60
|
+
export function writeClaudeConfig(apiKey: string): {
|
|
61
|
+
routerConfigPath: string
|
|
62
|
+
settingsPath: string
|
|
63
|
+
} {
|
|
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
|
+
// Write Claude settings
|
|
72
|
+
const settingsDir = getClaudeSettingsDir()
|
|
73
|
+
const settingsPath = path.join(settingsDir, 'settings.json')
|
|
74
|
+
ensureDir(settingsDir)
|
|
75
|
+
const settingsContent = CLAUDE_SETTINGS_TEMPLATE.replace(
|
|
76
|
+
/API_KEY_PLACEHOLDER/g,
|
|
77
|
+
apiKey
|
|
78
|
+
)
|
|
79
|
+
fs.writeFileSync(settingsPath, settingsContent)
|
|
80
|
+
|
|
81
|
+
return { routerConfigPath, settingsPath }
|
|
45
82
|
}
|
|
46
83
|
|
|
47
84
|
/** Check if a command exists */
|
|
48
85
|
async function commandExists(command: string): Promise<boolean> {
|
|
49
86
|
try {
|
|
50
87
|
// execa with reject: false will not throw on non-zero exit codes.
|
|
51
|
-
const { failed } = await execa(command, ['--version'], {
|
|
88
|
+
const { failed } = await execa(command, ['--version'], {
|
|
89
|
+
stdio: 'ignore',
|
|
90
|
+
reject: false,
|
|
91
|
+
})
|
|
52
92
|
return !failed
|
|
53
93
|
} catch (error) {
|
|
54
94
|
// Catch errors for commands that don't support --version or other issues
|
|
@@ -58,7 +98,10 @@ async function commandExists(command: string): Promise<boolean> {
|
|
|
58
98
|
|
|
59
99
|
/** Install global dependencies */
|
|
60
100
|
export async function installDeps(): Promise<void> {
|
|
61
|
-
const packages = [
|
|
101
|
+
const packages = [
|
|
102
|
+
'@anthropic-ai/claude-code',
|
|
103
|
+
'@musistudio/claude-code-router',
|
|
104
|
+
]
|
|
62
105
|
const usePnpm = await commandExists('pnpm')
|
|
63
106
|
|
|
64
107
|
if (usePnpm) {
|
|
@@ -71,7 +114,6 @@ export async function installDeps(): Promise<void> {
|
|
|
71
114
|
console.log('Dependencies installed successfully.')
|
|
72
115
|
}
|
|
73
116
|
|
|
74
|
-
|
|
75
117
|
/** Return Codex configuration directory path */
|
|
76
118
|
function getCodexConfigDir(): string {
|
|
77
119
|
return path.join(os.homedir(), '.codex')
|
|
@@ -91,7 +133,10 @@ wire_api = "responses"
|
|
|
91
133
|
`
|
|
92
134
|
|
|
93
135
|
/** Write Codex config.toml and auth.json */
|
|
94
|
-
export function writeCodexConfig(apiKey: string): {
|
|
136
|
+
export function writeCodexConfig(apiKey: string): {
|
|
137
|
+
configPath: string
|
|
138
|
+
authPath: string
|
|
139
|
+
} {
|
|
95
140
|
const configDir = getCodexConfigDir()
|
|
96
141
|
ensureDir(configDir)
|
|
97
142
|
|
|
@@ -120,3 +165,45 @@ export async function installCodexDeps(): Promise<void> {
|
|
|
120
165
|
console.log('Codex dependency installed successfully.')
|
|
121
166
|
}
|
|
122
167
|
|
|
168
|
+
/** Return Raycast AI configuration directory path */
|
|
169
|
+
function getRaycastAIConfigDir(): string {
|
|
170
|
+
return path.join(os.homedir(), '.config', 'raycast', 'ai')
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Template for Raycast AI providers.yaml */
|
|
174
|
+
const RAYCAST_PROVIDERS_YAML_TEMPLATE = `providers:
|
|
175
|
+
- id: my_provider
|
|
176
|
+
name: gengjiawen AI
|
|
177
|
+
base_url: https://ai.gengjiawen.com/api/openai/v1/
|
|
178
|
+
api_keys:
|
|
179
|
+
openai: API_KEY_PLACEHOLDER
|
|
180
|
+
models:
|
|
181
|
+
- id: sota
|
|
182
|
+
name: "sota"
|
|
183
|
+
context: 200000
|
|
184
|
+
provider: openai
|
|
185
|
+
abilities:
|
|
186
|
+
temperature:
|
|
187
|
+
supported: true
|
|
188
|
+
vision:
|
|
189
|
+
supported: true
|
|
190
|
+
system_message:
|
|
191
|
+
supported: true
|
|
192
|
+
tools:
|
|
193
|
+
supported: true
|
|
194
|
+
`
|
|
195
|
+
|
|
196
|
+
/** Write Raycast AI providers.yaml */
|
|
197
|
+
export function writeRaycastConfig(apiKey: string): { configPath: string } {
|
|
198
|
+
const configDir = getRaycastAIConfigDir()
|
|
199
|
+
ensureDir(configDir)
|
|
200
|
+
|
|
201
|
+
const configPath = path.join(configDir, 'providers.yaml')
|
|
202
|
+
const content = RAYCAST_PROVIDERS_YAML_TEMPLATE.replace(
|
|
203
|
+
'API_KEY_PLACEHOLDER',
|
|
204
|
+
apiKey
|
|
205
|
+
)
|
|
206
|
+
fs.writeFileSync(configPath, content)
|
|
207
|
+
|
|
208
|
+
return { configPath }
|
|
209
|
+
}
|
package/macOS-init.md
CHANGED
|
@@ -23,6 +23,9 @@ brew install omnidisksweeper
|
|
|
23
23
|
brew install git-lfs
|
|
24
24
|
brew install jordanbaird-ice
|
|
25
25
|
sudo git lfs install --system
|
|
26
|
+
npm i -g pnpm yarn && pnpm setup
|
|
27
|
+
pnpm i -g vite 7zip-bin-full
|
|
28
|
+
sudo ln -s "$(NODE_PATH="$(pnpm root -g)" node -p "require('7zip-bin-full').path7za")" /usr/local/bin/7z
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gengjiawen/os-init",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"os-init": "bin/bin.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
11
|
+
"dev": "tsc -w",
|
|
12
12
|
"server": "nodemon --exec ts-node libs/index.ts",
|
|
13
13
|
"prepare": "husky install",
|
|
14
14
|
"clean": "rimraf build",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">22.12.0"
|
|
30
|
+
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@types/jest": "29.5.12",
|
|
30
33
|
"@types/node": "24.1.0",
|
package/packages/win/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) gengjiawen <technicalcute@gmail.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
package/packages/win/README.md
DELETED
package/packages/win/bin/init.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const program = require('commander')
|
|
4
|
-
|
|
5
|
-
const { init, list } = require('../build')
|
|
6
|
-
|
|
7
|
-
program
|
|
8
|
-
.version(require('../package.json').version)
|
|
9
|
-
.command('init')
|
|
10
|
-
.action(() => {
|
|
11
|
-
init()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
program
|
|
15
|
-
.version(require('../package.json').version)
|
|
16
|
-
.command('list')
|
|
17
|
-
.action(() => {
|
|
18
|
-
list()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
program.parse(process.argv)
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { packages } from './packages'
|
|
2
|
-
import * as execa from 'execa'
|
|
3
|
-
|
|
4
|
-
export const psPolicy = `Set-ExecutionPolicy -ExecutionPolicy ByPass`
|
|
5
|
-
|
|
6
|
-
export async function init() {
|
|
7
|
-
const cmd = `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))`
|
|
8
|
-
console.log(`need to ${psPolicy} if you are not`)
|
|
9
|
-
console.log(cmd)
|
|
10
|
-
await execa.command(cmd, { shell: 'powershell', stdio: 'inherit' })
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function list() {
|
|
14
|
-
console.log(packages.join('\n'))
|
|
15
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gengjiawen/win",
|
|
3
|
-
"version": "0.0.4",
|
|
4
|
-
"description": "my groovy project",
|
|
5
|
-
"author": "gengjiawen <technicalcute@gmail.com>",
|
|
6
|
-
"bin": {
|
|
7
|
-
"init": "bin/init.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"start": "tsc -w",
|
|
11
|
-
"clean": "rimraf build",
|
|
12
|
-
"test": "jest",
|
|
13
|
-
"build": "npm run clean && tsc -p ./tsconfig.json"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"commander": "^8.2.0",
|
|
17
|
-
"execa": "^5.1.1"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/jest": "27.0.2",
|
|
21
|
-
"jest": "27.3.0",
|
|
22
|
-
"ts-jest": "27.0.7"
|
|
23
|
-
},
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public"
|
|
26
|
-
},
|
|
27
|
-
"jest": {
|
|
28
|
-
"testEnvironment": "node",
|
|
29
|
-
"transform": {
|
|
30
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|