Skip to content

Commit c914295

Browse files
committed
Add non-interactive installer docs
1 parent df95bef commit c914295

4 files changed

Lines changed: 70 additions & 17 deletions

File tree

NPM_README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ npm install -g @halilertekin/claude-code-router-config
1212
ccr-setup
1313
```
1414

15+
### Non-interactive install (CI)
16+
17+
If you run in CI or without a TTY, the installer skips existing config files by default.
18+
19+
```bash
20+
# Skip prompts (CI-friendly)
21+
CCR_CONFIG_NO_PROMPT=1 ccr-setup
22+
23+
# Force overwrite existing config files
24+
CCR_CONFIG_OVERWRITE=1 ccr-setup
25+
# or
26+
ccr-setup --overwrite
27+
```
28+
1529
### One-shot GLM setup (Claude login + GLM API)
1630

1731
```bash

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Claude Code Router Config - Advanced Multi-Provider Setup
22

3-
🚀 **v1.3.7** - Now with z.ai (GLM 4.7) support, advanced CLI tools, analytics, smart routing, and configuration templates!
3+
🚀 **v1.3.9** - Now with z.ai (GLM 4.7) support, advanced CLI tools, analytics, smart routing, and configuration templates!
44

55
Use Claude Code as a single interface to access multiple AI providers with intelligent routing for optimal performance, cost, and quality.
66

7-
## ✨ New in v1.3.7
7+
## ✨ New in v1.3.9
88
- **z.ai Support**: Native integration for GLM-4.7 via z.ai (PPInfra).
99
- **Lightweight Mode**: New `ccc` function for zero-dependency routing.
1010
- **Direct GLM Alias**: Type `glm` to launch Claude Code with GLM-4.7 immediately.
11+
- **Non-interactive install**: CI-friendly installer flags and env controls.
1112

1213
## 🚀 Setup on Another Machine (Fastest Way)
1314

@@ -76,6 +77,21 @@ pnpm add -g @halilertekin/claude-code-router-config
7677
# System is ready! Run: ccr --help
7778
```
7879

80+
Then run the installer to copy config files:
81+
82+
```bash
83+
ccr-setup
84+
```
85+
86+
Non-interactive usage (CI):
87+
88+
```bash
89+
CCR_CONFIG_NO_PROMPT=1 ccr-setup
90+
CCR_CONFIG_OVERWRITE=1 ccr-setup
91+
# or
92+
ccr-setup --overwrite
93+
```
94+
7995
### Option 2: Manual Setup
8096

8197
#### 1. Install Dependencies
@@ -179,4 +195,4 @@ MIT © [Halil Ertekin](https://github.com/halilertekin)
179195

180196
## 🌟 Show Your Support
181197

182-
If you find this useful, please give it a ⭐ on [GitHub](https://github.com/halilertekin/CC-RouterMultiProvider)!
198+
If you find this useful, please give it a ⭐ on [GitHub](https://github.com/halilertekin/CC-RouterMultiProvider)!

install.js

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ const { execSync } = require('child_process');
1717

1818
const configDir = path.join(process.env.HOME || process.env.USERPROFILE, '.claude-code-router');
1919
const packageDir = __dirname;
20+
const argv = new Set(process.argv.slice(2));
21+
const envIsTrue = (value) => /^(1|true|yes|y)$/i.test(value || '');
22+
const forceOverwrite =
23+
argv.has('--overwrite') ||
24+
argv.has('--force') ||
25+
envIsTrue(process.env.CCR_CONFIG_OVERWRITE);
26+
const nonInteractive =
27+
argv.has('--no-prompt') ||
28+
argv.has('--non-interactive') ||
29+
envIsTrue(process.env.CCR_CONFIG_NO_PROMPT) ||
30+
envIsTrue(process.env.CI);
31+
const canPrompt = Boolean(process.stdin.isTTY) && !nonInteractive;
2032

2133
async function checkRequirements() {
2234
console.log(chalk.blue('📋 Checking requirements...'));
@@ -76,18 +88,29 @@ async function setupConfig() {
7688
const dest = path.join(configDir, file);
7789

7890
if (await fs.pathExists(dest)) {
79-
const { overwrite } = await inquirer.prompt([
80-
{
81-
type: 'confirm',
82-
name: 'overwrite',
83-
message: `File ${file} exists. Overwrite?`,
84-
default: false
85-
}
86-
]);
87-
88-
if (!overwrite) {
89-
console.log(chalk.yellow(`⚠️ Skipping ${file}`));
91+
if (forceOverwrite) {
92+
console.log(chalk.yellow(`⚠️ Overwriting ${file} (forced)`));
93+
} else if (!canPrompt) {
94+
console.log(
95+
chalk.yellow(
96+
`⚠️ Skipping ${file} (non-interactive). Set CCR_CONFIG_OVERWRITE=1 to overwrite.`
97+
)
98+
);
9099
continue;
100+
} else {
101+
const { overwrite } = await inquirer.prompt([
102+
{
103+
type: 'confirm',
104+
name: 'overwrite',
105+
message: `File ${file} exists. Overwrite?`,
106+
default: false
107+
}
108+
]);
109+
110+
if (!overwrite) {
111+
console.log(chalk.yellow(`⚠️ Skipping ${file}`));
112+
continue;
113+
}
91114
}
92115
}
93116

@@ -157,4 +180,4 @@ if (require.main === module) {
157180
main().catch(console.error);
158181
}
159182

160-
module.exports = { checkRequirements, installRouter, setupConfig };
183+
module.exports = { checkRequirements, installRouter, setupConfig };

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@halilertekin/claude-code-router-config",
3-
"version": "1.3.8",
3+
"version": "1.3.9",
44
"description": "Multi-provider configuration for Claude Code Router with intent-based routing, advanced CLI tools, analytics, and smart routing. Setup OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, and GitHub Copilot with intelligent routing.",
55
"main": "install.js",
66
"bin": {
@@ -74,7 +74,7 @@
7474
"license": "MIT",
7575
"repository": {
7676
"type": "git",
77-
"url": "https://github.com/halilertekin/CC-RouterMultiProvider.git"
77+
"url": "git+https://github.com/halilertekin/CC-RouterMultiProvider.git"
7878
},
7979
"bugs": {
8080
"url": "https://github.com/halilertekin/CC-RouterMultiProvider/issues"

0 commit comments

Comments
 (0)