@adithya-13/cc-switch 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -12,7 +12,7 @@ cc-switch use openrouter # → OpenRouter (320+ models)
12
12
  ## Install
13
13
 
14
14
  ```bash
15
- npm install -g cc-switch
15
+ npm install -g @adithya-13/cc-switch
16
16
  ```
17
17
 
18
18
  Or via curl:
package/bin/cc-switch.js CHANGED
@@ -8,7 +8,33 @@ import { addCommand } from "../src/commands/add.js";
8
8
  import { doctorCommand } from "../src/commands/doctor.js";
9
9
  import { readSettings, getCurrentProvider } from "../src/settings.js";
10
10
  import { PRESETS } from "../src/presets.js";
11
- import { loadProfiles } from "../src/profiles.js";
11
+ import { loadProfiles, isFirstRun } from "../src/profiles.js";
12
+
13
+ if (isFirstRun()) {
14
+ const settings = readSettings()
15
+ const current = getCurrentProvider(settings)
16
+ const preset = PRESETS[current] || loadProfiles()[current]
17
+ const name = preset?.name || current
18
+
19
+ console.log()
20
+ console.log(chalk.cyan(' ╔══════════════════════════════════════════════╗'))
21
+ console.log(chalk.cyan(' ║ Welcome to cc-switch! 🎉 ║'))
22
+ console.log(chalk.cyan(' ║ Switch Claude Code between providers ║'))
23
+ console.log(chalk.cyan(' ╚══════════════════════════════════════════════╝'))
24
+ console.log()
25
+ console.log(chalk.white(' Quick start:'))
26
+ console.log()
27
+ console.log(chalk.gray(' 1. See all providers: cc-switch list'))
28
+ console.log(chalk.gray(' 2. Switch provider: cc-switch use zai'))
29
+ console.log(chalk.gray(' 3. Add your API key: cc-switch use kimi (prompts for key)'))
30
+ console.log(chalk.gray(' 4. Save for next time: keys saved in ~/.cc-switch/keys.json'))
31
+ console.log()
32
+ console.log(chalk.gray(' Hit a rate limit? Use cclaude instead of claude —'))
33
+ console.log(chalk.gray(' it detects limits and shows fallback options.'))
34
+ console.log()
35
+ console.log(chalk.white(` Active: ${chalk.green.bold(name)}`))
36
+ console.log()
37
+ }
12
38
 
13
39
  const program = new Command();
14
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adithya-13/cc-switch",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Switch Claude Code between providers (Claude Pro, z.ai, Kimi, OpenRouter, DeepSeek, and more)",
5
5
  "keywords": [
6
6
  "claude",
@@ -2,6 +2,7 @@ import chalk from 'chalk'
2
2
  import { PRESETS } from '../presets.js'
3
3
  import { loadProfiles, loadKeys } from '../profiles.js'
4
4
  import { readSettings, getCurrentProvider } from '../settings.js'
5
+ import { maskKey } from '../utils.js'
5
6
 
6
7
  export function listCommand() {
7
8
  const settings = readSettings()
@@ -18,7 +19,7 @@ export function listCommand() {
18
19
  const label = isActive ? chalk.green.bold(preset.name) : chalk.white(preset.name)
19
20
  const keyStatus = preset.requiresKey === false
20
21
  ? chalk.gray('OAuth')
21
- : hasKey ? chalk.green('key ✓') : chalk.yellow('no key')
22
+ : hasKey ? chalk.green(`key ${maskKey(keys[name])}`) : chalk.yellow('no key')
22
23
 
23
24
  console.log(` ${marker} ${label.padEnd(isActive ? 33 : 25)} ${keyStatus}`)
24
25
  if (preset.description) {
package/src/profiles.js CHANGED
@@ -5,11 +5,21 @@ import { join } from 'path'
5
5
  const DIR = join(homedir(), '.cc-switch')
6
6
  const KEYS_PATH = join(DIR, 'keys.json')
7
7
  const PROFILES_PATH = join(DIR, 'profiles.json')
8
+ const INIT_FLAG = join(DIR, '.initialized')
8
9
 
9
10
  function ensureDir() {
10
11
  if (!existsSync(DIR)) mkdirSync(DIR, { recursive: true })
11
12
  }
12
13
 
14
+ export function isFirstRun() {
15
+ ensureDir()
16
+ if (!existsSync(INIT_FLAG)) {
17
+ writeFileSync(INIT_FLAG, '')
18
+ return true
19
+ }
20
+ return false
21
+ }
22
+
13
23
  export function loadKeys() {
14
24
  if (!existsSync(KEYS_PATH)) return {}
15
25
  return JSON.parse(readFileSync(KEYS_PATH, 'utf8'))