glm-switch 2.0.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.
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.applyProfile = applyProfile;
7
+ exports.enableGLM = enableGLM;
8
+ exports.disableGLM = disableGLM;
9
+ exports.showStatus = showStatus;
10
+ exports.initProfile = initProfile;
11
+ exports.setProfileValue = setProfileValue;
12
+ exports.setAllProfilesValue = setAllProfilesValue;
13
+ exports.listAllProfiles = listAllProfiles;
14
+ exports.deleteProfile = deleteProfile;
15
+ const chalk_1 = __importDefault(require("chalk"));
16
+ const config_1 = require("./config");
17
+ const settings_1 = require("./settings");
18
+ const profiles_1 = require("./profiles");
19
+ /**
20
+ * Apply a profile by ID (or default profile if no ID provided)
21
+ */
22
+ function applyProfile(profileId) {
23
+ const settingsPath = (0, config_1.getSettingsPath)();
24
+ try {
25
+ // Determine which profile to use
26
+ let targetId;
27
+ if (profileId) {
28
+ targetId = profileId;
29
+ }
30
+ else {
31
+ const defaultId = (0, profiles_1.getDefaultProfile)();
32
+ targetId = defaultId || '0';
33
+ }
34
+ // Check if profile exists
35
+ if (!(0, profiles_1.profileExists)(targetId)) {
36
+ console.error(chalk_1.default.red(`✗ Profile ${targetId} does not exist`));
37
+ console.log(chalk_1.default.gray(` Run "glm-switch init ${targetId}" to create it first`));
38
+ process.exit(1);
39
+ }
40
+ const profile = (0, profiles_1.getProfile)(targetId);
41
+ const settings = (0, settings_1.readSettings)(settingsPath);
42
+ // Check if token is empty
43
+ if (!profile.config.ANTHROPIC_AUTH_TOKEN) {
44
+ console.log(chalk_1.default.yellow(`⚠ Warning: Profile ${targetId} has no auth token`));
45
+ console.log(chalk_1.default.gray(` Run "glm-switch set ${targetId} token <your-token>" to set it`));
46
+ }
47
+ // Apply profile config to settings
48
+ const newSettings = { ...settings };
49
+ if (!newSettings.env) {
50
+ newSettings.env = {};
51
+ }
52
+ newSettings.env = {
53
+ ...newSettings.env,
54
+ ...profile.config,
55
+ };
56
+ (0, settings_1.writeSettings)(settingsPath, newSettings);
57
+ (0, profiles_1.setActiveProfile)(targetId);
58
+ console.log(chalk_1.default.green(`✓ Profile ${targetId} applied`));
59
+ console.log(chalk_1.default.gray(' Please restart VS Code for changes to take effect'));
60
+ }
61
+ catch (error) {
62
+ console.error(chalk_1.default.red('✗ Failed to apply profile'));
63
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
64
+ process.exit(1);
65
+ }
66
+ }
67
+ /**
68
+ * Legacy function - applies profile 0 by default
69
+ * @deprecated Use applyProfile() instead
70
+ */
71
+ function enableGLM() {
72
+ applyProfile();
73
+ }
74
+ /**
75
+ * Disable GLM mode (remove all GLM config from settings)
76
+ */
77
+ function disableGLM() {
78
+ const settingsPath = (0, config_1.getSettingsPath)();
79
+ try {
80
+ const settings = (0, settings_1.readSettings)(settingsPath);
81
+ if (!(0, settings_1.hasGLMConfig)(settings, config_1.GLM_KEYS)) {
82
+ console.log(chalk_1.default.yellow('⚠ GLM mode is already disabled'));
83
+ return;
84
+ }
85
+ const newSettings = (0, settings_1.removeGLMConfig)(settings, config_1.GLM_KEYS);
86
+ (0, settings_1.writeSettings)(settingsPath, newSettings);
87
+ console.log(chalk_1.default.green('✓ Claude API mode restored'));
88
+ console.log(chalk_1.default.gray(' Please restart VS Code for changes to take effect'));
89
+ }
90
+ catch (error) {
91
+ console.error(chalk_1.default.red('✗ Failed to disable GLM mode'));
92
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
93
+ process.exit(1);
94
+ }
95
+ }
96
+ /**
97
+ * Show current status
98
+ */
99
+ function showStatus() {
100
+ const settingsPath = (0, config_1.getSettingsPath)();
101
+ try {
102
+ const settings = (0, settings_1.readSettings)(settingsPath);
103
+ const isGLMEnabled = (0, settings_1.hasGLMConfig)(settings, config_1.GLM_KEYS);
104
+ const activeProfileId = (0, profiles_1.getActiveProfile)();
105
+ if (isGLMEnabled) {
106
+ console.log(chalk_1.default.green('Current mode: GLM'));
107
+ if (activeProfileId) {
108
+ console.log(chalk_1.default.gray(`Active Profile: ${activeProfileId}`));
109
+ }
110
+ console.log(chalk_1.default.gray(`API Endpoint: ${settings.env?.ANTHROPIC_BASE_URL || 'N/A'}`));
111
+ console.log(chalk_1.default.gray(`Sonnet Model: ${settings.env?.ANTHROPIC_DEFAULT_SONNET_MODEL || 'N/A'}`));
112
+ console.log(chalk_1.default.gray(`Opus Model: ${settings.env?.ANTHROPIC_DEFAULT_OPUS_MODEL || 'N/A'}`));
113
+ console.log(chalk_1.default.gray(`Haiku Model: ${settings.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL || 'N/A'}`));
114
+ const token = settings.env?.ANTHROPIC_AUTH_TOKEN;
115
+ if (token) {
116
+ const maskedToken = token.length > 10
117
+ ? `${token.substring(0, 10)}...`
118
+ : token;
119
+ console.log(chalk_1.default.gray(`Auth Token: ${maskedToken}`));
120
+ }
121
+ else {
122
+ console.log(chalk_1.default.yellow('Auth Token: Not set'));
123
+ }
124
+ }
125
+ else {
126
+ console.log(chalk_1.default.blue('Current mode: Claude API'));
127
+ }
128
+ console.log(chalk_1.default.gray(`\nSettings file: ${settingsPath}`));
129
+ }
130
+ catch (error) {
131
+ console.error(chalk_1.default.red('✗ Failed to read settings'));
132
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
133
+ process.exit(1);
134
+ }
135
+ }
136
+ /**
137
+ * Initialize a new profile
138
+ */
139
+ function initProfile(id) {
140
+ try {
141
+ if (!/^\d+$/.test(id)) {
142
+ console.error(chalk_1.default.red('✗ Profile ID must be numeric'));
143
+ console.log(chalk_1.default.gray(' Example: glm-switch init 0'));
144
+ process.exit(1);
145
+ }
146
+ const profile = (0, profiles_1.createProfile)(id);
147
+ console.log(chalk_1.default.green(`✓ Profile ${id} created`));
148
+ console.log(chalk_1.default.gray(` Config: ${JSON.stringify(profile.config, null, 2)}`));
149
+ console.log(chalk_1.default.yellow(` Don't forget to set your auth token:`));
150
+ console.log(chalk_1.default.gray(` glm-switch set ${id} token <your-token>`));
151
+ }
152
+ catch (error) {
153
+ console.error(chalk_1.default.red('✗ Failed to create profile'));
154
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
155
+ process.exit(1);
156
+ }
157
+ }
158
+ /**
159
+ * Set a value for a specific profile
160
+ */
161
+ function setProfileValue(id, key, value) {
162
+ try {
163
+ if (!(0, profiles_1.profileExists)(id)) {
164
+ console.error(chalk_1.default.red(`✗ Profile ${id} does not exist`));
165
+ console.log(chalk_1.default.gray(` Run "glm-switch init ${id}" to create it first`));
166
+ process.exit(1);
167
+ }
168
+ const validKeys = (0, profiles_1.getValidConfigKeys)();
169
+ if (!validKeys.includes(key)) {
170
+ console.error(chalk_1.default.red(`✗ Invalid config key: ${key}`));
171
+ console.log(chalk_1.default.gray(` Valid keys: ${validKeys.join(', ')}`));
172
+ process.exit(1);
173
+ }
174
+ const profile = (0, profiles_1.updateProfile)(id, key, value);
175
+ console.log(chalk_1.default.green(`✓ Updated profile ${id}`));
176
+ console.log(chalk_1.default.gray(` ${key}: ${value}`));
177
+ // Check if this is the active profile
178
+ const activeProfileId = (0, profiles_1.getActiveProfile)();
179
+ if (activeProfileId === id) {
180
+ console.log(chalk_1.default.yellow(` ⚠ This profile is currently active`));
181
+ console.log(chalk_1.default.gray(` Run "glm-switch on ${id}" to apply the changes`));
182
+ }
183
+ }
184
+ catch (error) {
185
+ console.error(chalk_1.default.red('✗ Failed to update profile'));
186
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
187
+ process.exit(1);
188
+ }
189
+ }
190
+ /**
191
+ * Set a value for all profiles
192
+ */
193
+ function setAllProfilesValue(key, value) {
194
+ try {
195
+ const validKeys = (0, profiles_1.getValidConfigKeys)();
196
+ if (!validKeys.includes(key)) {
197
+ console.error(chalk_1.default.red(`✗ Invalid config key: ${key}`));
198
+ console.log(chalk_1.default.gray(` Valid keys: ${validKeys.join(', ')}`));
199
+ process.exit(1);
200
+ }
201
+ (0, profiles_1.updateAllProfiles)(key, value);
202
+ const profiles = (0, profiles_1.listProfiles)();
203
+ console.log(chalk_1.default.green(`✓ Updated ${profiles.length} profile(s)`));
204
+ console.log(chalk_1.default.gray(` ${key}: ${value}`));
205
+ }
206
+ catch (error) {
207
+ console.error(chalk_1.default.red('✗ Failed to update profiles'));
208
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
209
+ process.exit(1);
210
+ }
211
+ }
212
+ /**
213
+ * List all profiles
214
+ */
215
+ function listAllProfiles() {
216
+ try {
217
+ const profiles = (0, profiles_1.listProfiles)();
218
+ const activeProfileId = (0, profiles_1.getActiveProfile)();
219
+ const defaultProfileId = (0, profiles_1.getDefaultProfile)();
220
+ if (profiles.length === 0) {
221
+ console.log(chalk_1.default.yellow('No profiles found'));
222
+ console.log(chalk_1.default.gray(' Run "glm-switch init 0" to create your first profile'));
223
+ return;
224
+ }
225
+ console.log(chalk_1.default.bold('Profiles:'));
226
+ console.log('');
227
+ profiles.forEach((profile) => {
228
+ const isActive = profile.id === activeProfileId;
229
+ const isDefault = profile.id === defaultProfileId;
230
+ let status = '';
231
+ if (isActive)
232
+ status += chalk_1.default.green('[active] ');
233
+ if (isDefault)
234
+ status += chalk_1.default.blue('[default] ');
235
+ console.log(`${status}chalk.bold(${profile.id})`);
236
+ const token = profile.config.ANTHROPIC_AUTH_TOKEN;
237
+ const maskedToken = token
238
+ ? (token.length > 10 ? `${token.substring(0, 10)}...` : token)
239
+ : chalk_1.default.yellow('(not set)');
240
+ console.log(` Base URL: ${profile.config.ANTHROPIC_BASE_URL}`);
241
+ console.log(` Token: ${maskedToken}`);
242
+ console.log(` Haiku: ${profile.config.ANTHROPIC_DEFAULT_HAIKU_MODEL}`);
243
+ console.log(` Sonnet: ${profile.config.ANTHROPIC_DEFAULT_SONNET_MODEL}`);
244
+ console.log(` Opus: ${profile.config.ANTHROPIC_DEFAULT_OPUS_MODEL}`);
245
+ console.log('');
246
+ });
247
+ }
248
+ catch (error) {
249
+ console.error(chalk_1.default.red('✗ Failed to list profiles'));
250
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
251
+ process.exit(1);
252
+ }
253
+ }
254
+ /**
255
+ * Delete a profile
256
+ */
257
+ function deleteProfile(id) {
258
+ try {
259
+ if (!(0, profiles_1.profileExists)(id)) {
260
+ console.error(chalk_1.default.red(`✗ Profile ${id} does not exist`));
261
+ process.exit(1);
262
+ }
263
+ (0, profiles_1.deleteProfile)(id);
264
+ console.log(chalk_1.default.green(`✓ Profile ${id} deleted`));
265
+ }
266
+ catch (error) {
267
+ console.error(chalk_1.default.red('✗ Failed to delete profile'));
268
+ console.error(chalk_1.default.gray(` ${error instanceof Error ? error.message : String(error)}`));
269
+ process.exit(1);
270
+ }
271
+ }
272
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;;;;AA2BA,oCAmDC;AAMD,8BAEC;AAKD,gCAqBC;AAKD,gCAoCC;AAKD,kCAmBC;AAKD,0CA+BC;AAKD,kDAmBC;AAKD,0CA0CC;AAKD,sCAeC;AAhTD,kDAA0B;AAE1B,qCAAqD;AACrD,yCAKoB;AACpB,yCAaoB;AAEpB;;GAEG;AACH,SAAgB,YAAY,CAAC,SAAkB;IAC7C,MAAM,YAAY,GAAG,IAAA,wBAAe,GAAE,CAAC;IAEvC,IAAI,CAAC;QACH,iCAAiC;QACjC,IAAI,QAAgB,CAAC;QAErB,IAAI,SAAS,EAAE,CAAC;YACd,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,SAAS,GAAG,IAAA,4BAAi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,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,EAAU;IACtC,IAAI,CAAC;QACH,IAAI,CAAC,IAAA,wBAAa,EAAC,EAAE,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAA,wBAAiB,EAAC,EAAE,CAAC,CAAC;QAEtB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface SettingsPath {
2
+ path: string;
3
+ exists: boolean;
4
+ }
5
+ /**
6
+ * Get the Claude Code settings.json file path for the current platform
7
+ */
8
+ export declare function getSettingsPath(): string;
9
+ /**
10
+ * Default GLM API configuration template
11
+ * This is used as a fallback and for backwards compatibility
12
+ */
13
+ export declare const GLM_CONFIG_TEMPLATE: {
14
+ ANTHROPIC_BASE_URL: string;
15
+ ANTHROPIC_AUTH_TOKEN: string;
16
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: string;
17
+ ANTHROPIC_DEFAULT_SONNET_MODEL: string;
18
+ ANTHROPIC_DEFAULT_OPUS_MODEL: string;
19
+ };
20
+ /**
21
+ * Legacy GLM configuration (for backwards compatibility)
22
+ * @deprecated Use profile-based configuration instead
23
+ */
24
+ export declare const GLM_CONFIG: {
25
+ ANTHROPIC_BASE_URL: string;
26
+ ANTHROPIC_AUTH_TOKEN: string;
27
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: string;
28
+ ANTHROPIC_DEFAULT_SONNET_MODEL: string;
29
+ ANTHROPIC_DEFAULT_OPUS_MODEL: string;
30
+ };
31
+ /**
32
+ * Keys to check for GLM mode detection
33
+ */
34
+ export declare const GLM_KEYS: string[];
35
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAiBxC;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAM/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;CAAsB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,QAAQ,UAAmC,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.GLM_KEYS = exports.GLM_CONFIG = exports.GLM_CONFIG_TEMPLATE = void 0;
37
+ exports.getSettingsPath = getSettingsPath;
38
+ const path = __importStar(require("path"));
39
+ const os = __importStar(require("os"));
40
+ /**
41
+ * Get the Claude Code settings.json file path for the current platform
42
+ */
43
+ function getSettingsPath() {
44
+ const platform = os.platform();
45
+ if (platform === 'win32') {
46
+ // Windows: C:\Users\{username}\.claude\settings.json
47
+ const userProfile = process.env.USERPROFILE || process.env.HOME;
48
+ if (!userProfile) {
49
+ throw new Error('USERPROFILE environment variable not found');
50
+ }
51
+ return path.join(userProfile, '.claude', 'settings.json');
52
+ }
53
+ else if (platform === 'darwin') {
54
+ // macOS: ~/.claude/settings.json
55
+ const home = os.homedir();
56
+ return path.join(home, '.claude', 'settings.json');
57
+ }
58
+ else {
59
+ throw new Error(`Unsupported platform: ${platform}. Only Windows and macOS are supported.`);
60
+ }
61
+ }
62
+ /**
63
+ * Default GLM API configuration template
64
+ * This is used as a fallback and for backwards compatibility
65
+ */
66
+ exports.GLM_CONFIG_TEMPLATE = {
67
+ ANTHROPIC_BASE_URL: 'https://api.z.ai/api/anthropic',
68
+ ANTHROPIC_AUTH_TOKEN: 'b8eb5131e993419fa5f39181c7c6a1db.emTv6QgzVxbSo3a7',
69
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: 'glm-4.5-air',
70
+ ANTHROPIC_DEFAULT_SONNET_MODEL: 'glm-4.7',
71
+ ANTHROPIC_DEFAULT_OPUS_MODEL: 'glm-4.7',
72
+ };
73
+ /**
74
+ * Legacy GLM configuration (for backwards compatibility)
75
+ * @deprecated Use profile-based configuration instead
76
+ */
77
+ exports.GLM_CONFIG = exports.GLM_CONFIG_TEMPLATE;
78
+ /**
79
+ * Keys to check for GLM mode detection
80
+ */
81
+ exports.GLM_KEYS = Object.keys(exports.GLM_CONFIG_TEMPLATE);
82
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,0CAiBC;AA5BD,2CAA6B;AAC7B,uCAAyB;AAOzB;;GAEG;AACH,SAAgB,eAAe;IAC7B,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,qDAAqD;QACrD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAChE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC;SAAM,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,iCAAiC;QACjC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,yCAAyC,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AAED;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IACjC,kBAAkB,EAAE,gCAAgC;IACpD,oBAAoB,EAAE,mDAAmD;IACzE,6BAA6B,EAAE,aAAa;IAC5C,8BAA8B,EAAE,SAAS;IACzC,4BAA4B,EAAE,SAAS;CACxC,CAAC;AAEF;;;GAGG;AACU,QAAA,UAAU,GAAG,2BAAmB,CAAC;AAE9C;;GAEG;AACU,QAAA,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,2BAAmB,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { getSettingsPath, GLM_CONFIG, GLM_CONFIG_TEMPLATE, GLM_KEYS } from './config';
2
+ export { readSettings, writeSettings, hasGLMConfig, addGLMConfig, removeGLMConfig, type Settings, } from './settings';
3
+ export { enableGLM, disableGLM, showStatus, applyProfile, initProfile, setProfileValue, setAllProfilesValue, listAllProfiles, deleteProfile, } from './commands';
4
+ export { getProfilesDir, getProfilePath, getActiveProfilePath, getDefaultProfilePath, initializeProfilesDir, profileExists, createProfile, getProfile, updateProfile, updateAllProfiles, deleteProfile as deleteProfileFile, listProfiles, getActiveProfile, setActiveProfile, getDefaultProfile, setDefaultProfile, getValidConfigKeys, DEFAULT_PROFILE_CONFIG, type ProfileConfig, type Profile, } from './profiles';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGtF,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,KAAK,QAAQ,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,IAAI,iBAAiB,EAClC,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,aAAa,EAClB,KAAK,OAAO,GACb,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_PROFILE_CONFIG = exports.getValidConfigKeys = exports.setDefaultProfile = exports.getDefaultProfile = exports.setActiveProfile = exports.getActiveProfile = exports.listProfiles = exports.deleteProfileFile = exports.updateAllProfiles = exports.updateProfile = exports.getProfile = exports.createProfile = exports.profileExists = exports.initializeProfilesDir = exports.getDefaultProfilePath = exports.getActiveProfilePath = exports.getProfilePath = exports.getProfilesDir = exports.deleteProfile = exports.listAllProfiles = exports.setAllProfilesValue = exports.setProfileValue = exports.initProfile = exports.applyProfile = exports.showStatus = exports.disableGLM = exports.enableGLM = exports.removeGLMConfig = exports.addGLMConfig = exports.hasGLMConfig = exports.writeSettings = exports.readSettings = exports.GLM_KEYS = exports.GLM_CONFIG_TEMPLATE = exports.GLM_CONFIG = exports.getSettingsPath = void 0;
4
+ // Config exports
5
+ var config_1 = require("./config");
6
+ Object.defineProperty(exports, "getSettingsPath", { enumerable: true, get: function () { return config_1.getSettingsPath; } });
7
+ Object.defineProperty(exports, "GLM_CONFIG", { enumerable: true, get: function () { return config_1.GLM_CONFIG; } });
8
+ Object.defineProperty(exports, "GLM_CONFIG_TEMPLATE", { enumerable: true, get: function () { return config_1.GLM_CONFIG_TEMPLATE; } });
9
+ Object.defineProperty(exports, "GLM_KEYS", { enumerable: true, get: function () { return config_1.GLM_KEYS; } });
10
+ // Settings exports
11
+ var settings_1 = require("./settings");
12
+ Object.defineProperty(exports, "readSettings", { enumerable: true, get: function () { return settings_1.readSettings; } });
13
+ Object.defineProperty(exports, "writeSettings", { enumerable: true, get: function () { return settings_1.writeSettings; } });
14
+ Object.defineProperty(exports, "hasGLMConfig", { enumerable: true, get: function () { return settings_1.hasGLMConfig; } });
15
+ Object.defineProperty(exports, "addGLMConfig", { enumerable: true, get: function () { return settings_1.addGLMConfig; } });
16
+ Object.defineProperty(exports, "removeGLMConfig", { enumerable: true, get: function () { return settings_1.removeGLMConfig; } });
17
+ // Commands exports
18
+ var commands_1 = require("./commands");
19
+ Object.defineProperty(exports, "enableGLM", { enumerable: true, get: function () { return commands_1.enableGLM; } });
20
+ Object.defineProperty(exports, "disableGLM", { enumerable: true, get: function () { return commands_1.disableGLM; } });
21
+ Object.defineProperty(exports, "showStatus", { enumerable: true, get: function () { return commands_1.showStatus; } });
22
+ Object.defineProperty(exports, "applyProfile", { enumerable: true, get: function () { return commands_1.applyProfile; } });
23
+ Object.defineProperty(exports, "initProfile", { enumerable: true, get: function () { return commands_1.initProfile; } });
24
+ Object.defineProperty(exports, "setProfileValue", { enumerable: true, get: function () { return commands_1.setProfileValue; } });
25
+ Object.defineProperty(exports, "setAllProfilesValue", { enumerable: true, get: function () { return commands_1.setAllProfilesValue; } });
26
+ Object.defineProperty(exports, "listAllProfiles", { enumerable: true, get: function () { return commands_1.listAllProfiles; } });
27
+ Object.defineProperty(exports, "deleteProfile", { enumerable: true, get: function () { return commands_1.deleteProfile; } });
28
+ // Profiles exports
29
+ var profiles_1 = require("./profiles");
30
+ Object.defineProperty(exports, "getProfilesDir", { enumerable: true, get: function () { return profiles_1.getProfilesDir; } });
31
+ Object.defineProperty(exports, "getProfilePath", { enumerable: true, get: function () { return profiles_1.getProfilePath; } });
32
+ Object.defineProperty(exports, "getActiveProfilePath", { enumerable: true, get: function () { return profiles_1.getActiveProfilePath; } });
33
+ Object.defineProperty(exports, "getDefaultProfilePath", { enumerable: true, get: function () { return profiles_1.getDefaultProfilePath; } });
34
+ Object.defineProperty(exports, "initializeProfilesDir", { enumerable: true, get: function () { return profiles_1.initializeProfilesDir; } });
35
+ Object.defineProperty(exports, "profileExists", { enumerable: true, get: function () { return profiles_1.profileExists; } });
36
+ Object.defineProperty(exports, "createProfile", { enumerable: true, get: function () { return profiles_1.createProfile; } });
37
+ Object.defineProperty(exports, "getProfile", { enumerable: true, get: function () { return profiles_1.getProfile; } });
38
+ Object.defineProperty(exports, "updateProfile", { enumerable: true, get: function () { return profiles_1.updateProfile; } });
39
+ Object.defineProperty(exports, "updateAllProfiles", { enumerable: true, get: function () { return profiles_1.updateAllProfiles; } });
40
+ Object.defineProperty(exports, "deleteProfileFile", { enumerable: true, get: function () { return profiles_1.deleteProfile; } });
41
+ Object.defineProperty(exports, "listProfiles", { enumerable: true, get: function () { return profiles_1.listProfiles; } });
42
+ Object.defineProperty(exports, "getActiveProfile", { enumerable: true, get: function () { return profiles_1.getActiveProfile; } });
43
+ Object.defineProperty(exports, "setActiveProfile", { enumerable: true, get: function () { return profiles_1.setActiveProfile; } });
44
+ Object.defineProperty(exports, "getDefaultProfile", { enumerable: true, get: function () { return profiles_1.getDefaultProfile; } });
45
+ Object.defineProperty(exports, "setDefaultProfile", { enumerable: true, get: function () { return profiles_1.setDefaultProfile; } });
46
+ Object.defineProperty(exports, "getValidConfigKeys", { enumerable: true, get: function () { return profiles_1.getValidConfigKeys; } });
47
+ Object.defineProperty(exports, "DEFAULT_PROFILE_CONFIG", { enumerable: true, get: function () { return profiles_1.DEFAULT_PROFILE_CONFIG; } });
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,mCAAsF;AAA7E,yGAAA,eAAe,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAEnE,mBAAmB;AACnB,uCAOoB;AANlB,wGAAA,YAAY,OAAA;AACZ,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AAIjB,mBAAmB;AACnB,uCAUoB;AATlB,qGAAA,SAAS,OAAA;AACT,sGAAA,UAAU,OAAA;AACV,sGAAA,UAAU,OAAA;AACV,wGAAA,YAAY,OAAA;AACZ,uGAAA,WAAW,OAAA;AACX,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AACnB,2GAAA,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AAGf,mBAAmB;AACnB,uCAqBoB;AApBlB,0GAAA,cAAc,OAAA;AACd,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AACrB,iHAAA,qBAAqB,OAAA;AACrB,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,sGAAA,UAAU,OAAA;AACV,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,6GAAA,aAAa,OAAqB;AAClC,wGAAA,YAAY,OAAA;AACZ,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,6GAAA,iBAAiB,OAAA;AACjB,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAClB,kHAAA,sBAAsB,OAAA"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Profile configuration interface
3
+ */
4
+ export interface ProfileConfig {
5
+ ANTHROPIC_BASE_URL: string;
6
+ ANTHROPIC_AUTH_TOKEN: string;
7
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: string;
8
+ ANTHROPIC_DEFAULT_SONNET_MODEL: string;
9
+ ANTHROPIC_DEFAULT_OPUS_MODEL: string;
10
+ }
11
+ /**
12
+ * Profile interface
13
+ */
14
+ export interface Profile {
15
+ id: string;
16
+ config: ProfileConfig;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ }
20
+ /**
21
+ * Default profile configuration template
22
+ */
23
+ export declare const DEFAULT_PROFILE_CONFIG: ProfileConfig;
24
+ /**
25
+ * Get the profiles directory path
26
+ */
27
+ export declare function getProfilesDir(): string;
28
+ /**
29
+ * Get profile file path for a given ID
30
+ */
31
+ export declare function getProfilePath(id: string): string;
32
+ /**
33
+ * Get active profile file path
34
+ */
35
+ export declare function getActiveProfilePath(): string;
36
+ /**
37
+ * Get default profile file path
38
+ */
39
+ export declare function getDefaultProfilePath(): string;
40
+ /**
41
+ * Initialize profiles directory
42
+ */
43
+ export declare function initializeProfilesDir(): void;
44
+ /**
45
+ * Check if a profile exists
46
+ */
47
+ export declare function profileExists(id: string): boolean;
48
+ /**
49
+ * Create a new profile
50
+ */
51
+ export declare function createProfile(id: string): Profile;
52
+ /**
53
+ * Get a profile by ID
54
+ */
55
+ export declare function getProfile(id: string): Profile;
56
+ /**
57
+ * Update a specific key in a profile
58
+ */
59
+ export declare function updateProfile(id: string, key: string, value: string): Profile;
60
+ /**
61
+ * Update a specific key in all profiles
62
+ */
63
+ export declare function updateAllProfiles(key: string, value: string): void;
64
+ /**
65
+ * Delete a profile
66
+ */
67
+ export declare function deleteProfile(id: string): void;
68
+ /**
69
+ * List all profiles
70
+ */
71
+ export declare function listProfiles(): Profile[];
72
+ /**
73
+ * Get the active profile ID
74
+ */
75
+ export declare function getActiveProfile(): string | null;
76
+ /**
77
+ * Set the active profile
78
+ */
79
+ export declare function setActiveProfile(id: string): void;
80
+ /**
81
+ * Get the default profile ID
82
+ */
83
+ export declare function getDefaultProfile(): string | null;
84
+ /**
85
+ * Set the default profile ID
86
+ */
87
+ export declare function setDefaultProfile(id: string): void;
88
+ /**
89
+ * Get valid config keys
90
+ */
91
+ export declare function getValidConfigKeys(): string[];
92
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,6BAA6B,EAAE,MAAM,CAAC;IACtC,8BAA8B,EAAE,MAAM,CAAC;IACvC,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAMpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAevC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAK5C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CA4BjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAO9C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE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