@done-coding/cli-cc-switch 0.2.0 → 0.2.1-alpha.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/types/index.d.ts CHANGED
@@ -15,16 +15,17 @@ export declare const buildChildEnv: (processEnv: NodeJS.ProcessEnv, profileEnv:
15
15
  * claude 透传参数);handler 内从 process.argv 在子命令名边界后取**原始切片**
16
16
  * 喂给 runRouter —— 不消费 yargs 解析产物,守 REQ-1 逐字保真语义
17
17
  * (独立入口 dc-cc-switch / cc-router 行为与未注册前完全一致)。
18
- * meta 自身命令面(REQ-1):--meta-profile=<name> / --meta-pick /
18
+ * meta 自身命令面(REQ-1):--meta-profile=<name> / --meta-pick / --meta-silent /
19
19
  * --meta-help / --meta-version 由 runRouter 消费,[MUST NOT] 透传给 claude。
20
20
  */
21
21
  export declare const createAsSubcommand: () => CommandModule;
22
22
 
23
23
  /**
24
- * REQ-3 内置 deepseek 模板。键集合与 requirements REQ-3 表逐键一致;
25
- * ANTHROPIC_AUTH_TOKEN 恒为空字符串(绝不含真实 token)。
24
+ * 纯新装 starter(settings.json 源形态,键集合与旧 DEEPSEEK_TEMPLATE 语义
25
+ * 对齐;apiKey 恒为空字符串——绝不含真实 token,待用户填入)。
26
+ * profile 名 = `${provider}-${id}`(deepseek-flash / deepseek-pro)。
26
27
  */
27
- export declare const DEEPSEEK_TEMPLATE: ProfileConfig;
28
+ export declare const DEEPSEEK_SETTINGS_TEMPLATE: Settings;
28
29
 
29
30
  /**
30
31
  * 找出值严格等于 `""` 的键(纯函数,可单测)。
@@ -48,22 +49,6 @@ export declare const maskValue: (v: string) => string;
48
49
  * addmodel=添加模型 / providerlist=列提供商 / modellist=列模型 / generate=重建配置 / help / version */
49
50
  export declare type MetaAction = "run" | "profile" | "pick" | "setkey" | "addmodel" | "providerlist" | "modellist" | "generate" | "help" | "version";
50
51
 
51
- /** model:模型层(绑 provider,id 为该 provider 下局部标识 → profile 名 = `${provider}-${id}`) */
52
- export declare interface Model {
53
- provider: string;
54
- id: string;
55
- /** 实际模型串(如 deepseek-v4-flash[1m]) */
56
- name: string;
57
- /** 附加 env 覆盖(如 pro 档 ANTHROPIC_DEFAULT_HAIKU_MODEL 用 flash) */
58
- envExtraParams?: Record<string, string>;
59
- }
60
-
61
- /** model 配置文件结构(~/.done-coding/cc-switch/model.json,defaultProfile 为生成后 profile 名) */
62
- export declare interface ModelConfig {
63
- defaultProfile: string;
64
- models: Model[];
65
- }
66
-
67
52
  /**
68
53
  * 解析 argv(纯函数,可单测)。
69
54
  * meta 自身命令面(REQ-1):--meta-profile=<name>(多个取最后一个生效)、
@@ -83,6 +68,8 @@ export declare interface ParsedArgv {
83
68
  modelName?: string;
84
69
  /** --meta-provider= 值(setkey/addmodel 的 provider 选择旁路,非独立动作) */
85
70
  providerId?: string;
71
+ /** --meta-silent:压制 output.* 输出(MCP/AI 调用避免污染上下文) */
72
+ silent: boolean;
86
73
  passthrough: string[];
87
74
  }
88
75
 
@@ -94,31 +81,28 @@ export declare interface Profile {
94
81
 
95
82
  /**
96
83
  * profile 配置文件唯一路径:~/.done-coding/cc-switch/profile.json
84
+ * (--meta-generate 编译快照,运行时单源读取)。
97
85
  * `~` 不写死具体用户,由 os.homedir() 解析当前用户 home。
98
86
  */
99
87
  export declare const PROFILE_PATH: string;
100
88
 
101
- /** profile 配置文件结构(~/.done-coding/cc-switch/profile.json) */
89
+ /**
90
+ * profile 配置文件结构(~/.done-coding/cc-switch/profile.json,--meta-generate
91
+ * 编译快照;运行时单源读取)。defaultProfile/disabledDefault/output 由
92
+ * settings.json 编译携带,均可选。
93
+ */
102
94
  export declare interface ProfileConfig {
103
- defaultProfile: string;
95
+ /** 可选:未配置 / 被 disabledDefault 禁用 → 交互 pick */
96
+ defaultProfile?: string;
97
+ /** 忽略已配默认,强制交互选择(缺省 false) */
98
+ disabledDefault?: boolean;
99
+ /** 输出行为控制(缺省 profileName=true) */
100
+ output?: {
101
+ profileName?: boolean;
102
+ };
104
103
  profiles: Record<string, Profile>;
105
104
  }
106
105
 
107
- /** provider:服务商层(url/apiKey 单点 + 可选附加 env,供 --meta-generate 消费) */
108
- export declare interface Provider {
109
- /** 展示名(服务商名) */
110
- name: string;
111
- url: string;
112
- apiKey: string;
113
- /** 附加 env(如 CLAUDE_CODE_EFFORT_LEVEL=max),合并序 model > provider > 通用 */
114
- envExtraParams?: Record<string, string>;
115
- }
116
-
117
- /** provider 配置文件结构(~/.done-coding/cc-switch/provider.json) */
118
- export declare interface ProviderConfig {
119
- providers: Record<string, Provider>;
120
- }
121
-
122
106
  /**
123
107
  * 选择 profile(纯函数,可单测)。
124
108
  * 有 profileName 用之,否则用 cfg.defaultProfile。
@@ -130,4 +114,46 @@ export declare const selectProfile: (cfg: ProfileConfig, profileName?: string) =
130
114
  profile: Profile;
131
115
  };
132
116
 
117
+ /**
118
+ * settings 配置文件结构(~/.done-coding/cc-switch/settings.json,唯一源,
119
+ * 含 apiKey → chmod 600)。注意与 env-guard 的 SETTINGS_PATH
120
+ * (~/.claude/settings.json,Claude Code 自身配置)同名不同物。
121
+ */
122
+ export declare interface Settings {
123
+ defaultProfile?: string;
124
+ disabledDefault?: boolean;
125
+ output?: {
126
+ profileName?: boolean;
127
+ };
128
+ providers: Record<string, SettingsProvider>;
129
+ }
130
+
131
+ /**
132
+ * settings 源文件唯一路径:~/.done-coding/cc-switch/settings.json
133
+ * (唯一源:providers 嵌套 models + defaultProfile/disabledDefault/output)。
134
+ * 注意:与 Claude Code 的 ~/.claude/settings.json(env-guard SETTINGS_PATH)
135
+ * 同名不同物,勿混淆。
136
+ */
137
+ export declare const SETTINGS_PATH: string;
138
+
139
+ /** settings 源:模型(绑 provider,id 为该 provider 下局部标识 → profile 名 = `${provider}-${id}`) */
140
+ export declare interface SettingsModel {
141
+ id: string;
142
+ /** 实际模型串(如 deepseek-v4-flash[1m]) */
143
+ name: string;
144
+ /** 附加 env 覆盖(如 pro 档 ANTHROPIC_DEFAULT_HAIKU_MODEL 用 flash) */
145
+ envExtraParams?: Record<string, string>;
146
+ }
147
+
148
+ /** settings 源:服务商(内嵌支持的模型;url/apiKey 单点) */
149
+ export declare interface SettingsProvider {
150
+ /** 展示名(服务商名) */
151
+ name: string;
152
+ url: string;
153
+ apiKey: string;
154
+ /** 附加 env(如 CLAUDE_CODE_EFFORT_LEVEL=max),合并序 model > provider > 通用 */
155
+ envExtraParams?: Record<string, string>;
156
+ models: SettingsModel[];
157
+ }
158
+
133
159
  export { }