@szc-ft/mcp-szcd-client 0.13.2 → 0.14.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,48 @@
1
+ ---
2
+ description: 管理API工具(YApi+Swagger)的默认配置(baseUrl/account/password/cookies/swagUser/swagPass)
3
+ argument-hint: <get|set|clear> [--baseUrl=xxx] [--account=yyy] [--password=zzz] [--cookies=ccc] [--swgUser=admin] [--swgPass=xxx]
4
+ ---
5
+
6
+ 请帮我管理 szcd MCP 的 API 工具默认配置(同时支持 YApi 和 Swagger)。
7
+
8
+ **交互流程**:
9
+
10
+ 1. **向用户询问要执行的操作**,提供以下选项:
11
+ - "查看配置" -> 执行 get
12
+ - "设置配置" -> 执行 set(需进一步追问参数)
13
+ - "清除配置" -> 执行 clear
14
+
15
+ 2. **根据用户选择执行**:
16
+
17
+ - **查看配置**:直接执行 `npx szcd-mcp-api-config get`
18
+
19
+ - **设置配置**:逐项向用户询问以下参数,选项中提供当前值作为默认,用户也可自由输入新值:
20
+ - YAPI_BASE_URL - YApi 基础地址,如 `http://yapi.smartcitysz.work`
21
+ - YAPI_ACCOUNT - YApi 登录账号/邮箱
22
+ - YAPI_PASSWORD - YApi 密码
23
+ - YAPI_COOKIES - YApi Cookie 字符串(推荐,优先使用)
24
+ - SWAGGER_DEFAULT_USERNAME - Swagger 默认鉴权用户名
25
+ - SWAGGER_DEFAULT_PASSWORD - Swagger 默认鉴权密码(留空则跳过鉴权)
26
+ 收集完参数后执行:
27
+ ```bash
28
+ npx szcd-mcp-api-config set --baseUrl="<baseUrl>" --account="<account>" --password="<password>" --cookies="<cookies>" --swgUser="<swgUser>" --swgPass="<swgPass>"
29
+ ```
30
+
31
+ - **清除配置**:确认后执行 `npx szcd-mcp-api-config clear`
32
+
33
+ 3. **命令回退**:如果 npx 不可用,依次尝试:
34
+ - `node $(npm root -g)/@szc-ft/mcp-szcd-client/scripts/update-api-config.js <args>`
35
+ - `node /scity/zengzhijie/szcd/mcp/szcd-mcp-client/scripts/update-api-config.js <args>`
36
+
37
+ **配置字段说明**:
38
+ - `YAPI_BASE_URL` - YApi 基础地址
39
+ - `YAPI_ACCOUNT` - YApi 登录账号/邮箱
40
+ - `YAPI_PASSWORD` - YApi 密码(敏感)
41
+ - `YAPI_COOKIES` - YApi Cookie 字符串(敏感,推荐优先使用)
42
+ - `SWAGGER_DEFAULT_USERNAME` - Swagger 默认鉴权用户名(如 `admin`)
43
+ - `SWAGGER_DEFAULT_PASSWORD` - Swagger 默认鉴权密码(敏感,**留空则跳过鉴权**)
44
+
45
+ 配置保存在 `~/.szcd-mcp-config.json` 中,设置后 `api_tool` 的 fetch 操作可自动读取对应平台的认证信息。
46
+
47
+ 当前配置:
48
+ !`cat ~/.szcd-mcp-config.json 2>/dev/null | grep -E "YAPI|SWAGGER|MCP_SERVER" || echo "配置文件不存在或无 API 配置"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@szc-ft/mcp-szcd-client",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "MCP client for szcd component library - auto-configures AI coding tools with MCP server, skills, agents and commands",
5
5
  "keywords": [
6
6
  "mcp",
@@ -23,13 +23,15 @@
23
23
  "szcd-mcp-proxy": "mcp-proxy.js",
24
24
  "szcd-mcp-setup": "scripts/postinstall.js",
25
25
  "szcd-mcp-update-url": "scripts/update-mcp-url.js",
26
- "szcd-mcp-coding-config": "scripts/update-coding-config.js"
26
+ "szcd-mcp-coding-config": "scripts/update-coding-config.js",
27
+ "szcd-mcp-api-config": "scripts/update-api-config.js"
27
28
  },
28
29
  "files": [
29
30
  "mcp-proxy.js",
30
31
  "scripts/postinstall.js",
31
32
  "scripts/update-mcp-url.js",
32
33
  "scripts/update-coding-config.js",
34
+ "scripts/update-api-config.js",
33
35
  "scripts/lib/",
34
36
  "standard-skill/",
35
37
  "skill/",
@@ -0,0 +1,48 @@
1
+ ---
2
+ description: 管理API工具(YApi+Swagger)的默认配置(baseUrl/account/password/cookies/swagUser/swagPass)
3
+ argument-hint: <get|set|clear> [--baseUrl=xxx] [--account=yyy] [--password=zzz] [--cookies=ccc] [--swgUser=admin] [--swgPass=xxx]
4
+ ---
5
+
6
+ 请帮我管理 szcd MCP 的 API 工具默认配置(同时支持 YApi 和 Swagger)。
7
+
8
+ **交互流程**:
9
+
10
+ 1. **向用户询问要执行的操作**,提供以下选项:
11
+ - "查看配置" -> 执行 get
12
+ - "设置配置" -> 执行 set(需进一步追问参数)
13
+ - "清除配置" -> 执行 clear
14
+
15
+ 2. **根据用户选择执行**:
16
+
17
+ - **查看配置**:直接执行 `npx szcd-mcp-api-config get`
18
+
19
+ - **设置配置**:逐项向用户询问以下参数,选项中提供当前值作为默认,用户也可自由输入新值:
20
+ - YAPI_BASE_URL - YApi 基础地址,如 `http://yapi.smartcitysz.work`
21
+ - YAPI_ACCOUNT - YApi 登录账号/邮箱
22
+ - YAPI_PASSWORD - YApi 密码
23
+ - YAPI_COOKIES - YApi Cookie 字符串(推荐,优先使用)
24
+ - SWAGGER_DEFAULT_USERNAME - Swagger 默认鉴权用户名
25
+ - SWAGGER_DEFAULT_PASSWORD - Swagger 默认鉴权密码(留空则跳过鉴权)
26
+ 收集完参数后执行:
27
+ ```bash
28
+ npx szcd-mcp-api-config set --baseUrl="<baseUrl>" --account="<account>" --password="<password>" --cookies="<cookies>" --swgUser="<swgUser>" --swgPass="<swgPass>"
29
+ ```
30
+
31
+ - **清除配置**:确认后执行 `npx szcd-mcp-api-config clear`
32
+
33
+ 3. **命令回退**:如果 npx 不可用,依次尝试:
34
+ - `node $(npm root -g)/@szc-ft/mcp-szcd-client/scripts/update-api-config.js <args>`
35
+ - `node /scity/zengzhijie/szcd/mcp/szcd-mcp-client/scripts/update-api-config.js <args>`
36
+
37
+ **配置字段说明**:
38
+ - `YAPI_BASE_URL` - YApi 基础地址
39
+ - `YAPI_ACCOUNT` - YApi 登录账号/邮箱
40
+ - `YAPI_PASSWORD` - YApi 密码(敏感)
41
+ - `YAPI_COOKIES` - YApi Cookie 字符串(敏感,推荐优先使用)
42
+ - `SWAGGER_DEFAULT_USERNAME` - Swagger 默认鉴权用户名(如 `admin`)
43
+ - `SWAGGER_DEFAULT_PASSWORD` - Swagger 默认鉴权密码(敏感,**留空则跳过鉴权**)
44
+
45
+ 配置保存在 `~/.szcd-mcp-config.json` 中,设置后 `api_tool` 的 fetch 操作可自动读取对应平台的认证信息。
46
+
47
+ 当前配置:
48
+ !`cat ~/.szcd-mcp-config.json 2>/dev/null | grep -E "YAPI|SWAGGER|MCP_SERVER" || echo "配置文件不存在或无 API 配置"`
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "szcd-component-helper",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "szcd 组件库 MCP 助手 — 查询组件信息、匹配需求、生成代码",
5
5
  "mcpServers": {
6
6
  "szcd-component-helper": {
@@ -213,3 +213,47 @@ export function copyTraeIdeAgent(deps, isProjectLevel = false) {
213
213
  return copied > 0;
214
214
  }
215
215
 
216
+ // ==================== Slash Command 安装(Trae IDE) ====================
217
+
218
+ export function getTraeIdeCommandsDirectory() {
219
+ return path.join(getTraeUserDirectory(), "commands");
220
+ }
221
+
222
+ export function installTraeIdeSlashCommand(deps) {
223
+ const commandsSourceDir = path.join(deps.PACKAGE_ROOT, "commands");
224
+ if (!fs.existsSync(commandsSourceDir)) {
225
+ console.log("⚠️ Commands source directory not found, skipping Trae IDE");
226
+ return;
227
+ }
228
+
229
+ const commandFiles = fs.readdirSync(commandsSourceDir).filter(f => f.endsWith(".md"));
230
+ if (commandFiles.length === 0) {
231
+ console.log("⚠️ No command files found, skipping Trae IDE");
232
+ return;
233
+ }
234
+
235
+ const traeIdeCommandsDir = getTraeIdeCommandsDirectory();
236
+ try {
237
+ deps.ensureDirectory(traeIdeCommandsDir);
238
+ for (const file of commandFiles) {
239
+ const commandSource = path.join(commandsSourceDir, file);
240
+ const commandDest = path.join(traeIdeCommandsDir, file);
241
+
242
+ // 如果目标已存在且内容不同,跳过(用户可能已修改)
243
+ if (fs.existsSync(commandDest)) {
244
+ const existingContent = fs.readFileSync(commandDest, "utf8").trim();
245
+ const sourceContent = fs.readFileSync(commandSource, "utf8").trim();
246
+ if (existingContent !== sourceContent) {
247
+ console.log(`⏭️ Skipping Trae IDE command ${file}: already exists (user modified)`);
248
+ continue;
249
+ }
250
+ }
251
+
252
+ deps.copyFile(commandSource, commandDest);
253
+ console.log(`✓ Installed Trae IDE slash command: /${file.replace(".md", "")}`);
254
+ }
255
+ } catch (error) {
256
+ console.log(`⚠️ Failed to install Trae IDE slash commands: ${error.message}`);
257
+ }
258
+ }
259
+
@@ -4,7 +4,7 @@
4
4
  * 负责编排 Trae CLI 与 Trae IDE 的初始化流程。
5
5
  * 具体逻辑已按方向拆离到:
6
6
  * - trae-cli.js Trae CLI 专属逻辑(YAML、trae-cli 命令、.traecli/skills/agents/commands)
7
- * - trae-ide.js Trae IDE 专属逻辑(mcp.json、.trae-cn/skills、.trae-cn/agents)
7
+ * - trae-ide.js Trae IDE 专属逻辑(mcp.json、.trae-cn/skills、.trae-cn/agents、.trae-cn/commands
8
8
  *
9
9
  * 导出 setupTrae(deps) 供 postinstall.js 调用。
10
10
  * deps 需包含: { getMcpServerUrl, getMcpServerName, safeExecSync, isCommandAvailable, ensureDirectory, copyFile, writeFile, SKILL_SOURCE, PROJECT_ROOT, PACKAGE_ROOT }
@@ -23,6 +23,7 @@ import {
23
23
  copySkillToTrae,
24
24
  copyTraeIdeAgent,
25
25
  getTraeAgentsDirectory,
26
+ installTraeIdeSlashCommand,
26
27
  } from "./trae-ide.js";
27
28
 
28
29
  // ==================== 导出 ====================
@@ -31,6 +32,7 @@ export function setupTrae(deps) {
31
32
  // ---- Trae IDE ----
32
33
  createTraeIdeConfig(deps);
33
34
  copySkillToTrae(deps, false);
35
+ installTraeIdeSlashCommand(deps);
34
36
  // IDE 暂不支持 agent,跳过
35
37
  // copyTraeIdeAgent(deps, false);
36
38
 
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * szcd-mcp-api-config - 管理 API 工具(YApi + Swagger)的默认配置
5
+ *
6
+ * 用法:
7
+ * npx szcd-mcp-api-config get 查看当前 API 配置
8
+ * npx szcd-mcp-api-config set --baseUrl=xxx 设置 YApi 基础地址
9
+ * npx szcd-mcp-api-config set --account=xxx 设置 YApi 登录账号
10
+ * npx szcd-mcp-api-config set --password=xxx 设置 YApi 密码
11
+ * npx szcd-mcp-api-config set --cookies=xxx 设置 YApi Cookie
12
+ * npx szcd-mcp-api-config set --swgUser=xxx 设置 Swagger 默认用户名
13
+ * npx szcd-mcp-api-config set --swgPass=xxx 设置 Swagger 默认密码
14
+ * npx szcd-mcp-api-config set --baseUrl=xxx --account=yyy --password=zzz 批量设置
15
+ * npx szcd-mcp-api-config clear 清除所有 API 配置
16
+ *
17
+ * 配置保存在 ~/.szcd-mcp-config.json 中,字段名:
18
+ * YAPI_BASE_URL — YApi 基础地址(如 http://yapi.smartcitysz.work)
19
+ * YAPI_ACCOUNT — YApi 登录账号/邮箱
20
+ * YAPI_PASSWORD — YApi 密码(敏感)
21
+ * YAPI_COOKIES — YApi Cookie 字符串(敏感,优先使用)
22
+ * SWAGGER_DEFAULT_USERNAME — Swagger 默认鉴权用户名
23
+ * SWAGGER_DEFAULT_PASSWORD — Swagger 默认鉴权密码(敏感,留空则跳过鉴权)
24
+ */
25
+
26
+ import fs from "node:fs";
27
+ import path from "node:path";
28
+ import os from "node:os";
29
+
30
+ // ==================== 工具函数 ====================
31
+
32
+ function getHomeDir() {
33
+ if (os.platform() === "win32") {
34
+ return process.env.USERPROFILE || process.env.HOME || os.homedir();
35
+ }
36
+ return process.env.HOME || os.homedir();
37
+ }
38
+
39
+ function getConfigFilePath() {
40
+ return path.join(getHomeDir(), ".szcd-mcp-config.json");
41
+ }
42
+
43
+ function loadConfig() {
44
+ const configPath = getConfigFilePath();
45
+ try {
46
+ if (fs.existsSync(configPath)) {
47
+ return JSON.parse(fs.readFileSync(configPath, "utf8"));
48
+ }
49
+ } catch (error) {
50
+ console.error(`Failed to read config: ${error.message}`);
51
+ }
52
+ return {};
53
+ }
54
+
55
+ function saveConfig(config) {
56
+ const configPath = getConfigFilePath();
57
+ try {
58
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
59
+ return true;
60
+ } catch (error) {
61
+ console.error(`Failed to write config: ${error.message}`);
62
+ return false;
63
+ }
64
+ }
65
+
66
+ function maskValue(value) {
67
+ if (!value) return "(未设置)";
68
+ if (value.length <= 6) return "***";
69
+ return value.substring(0, 4) + "***";
70
+ }
71
+
72
+ function parseArgs(argv) {
73
+ const args = {
74
+ action: null,
75
+ baseUrl: null,
76
+ account: null,
77
+ password: null,
78
+ cookies: null,
79
+ swgUser: null,
80
+ swgPass: null,
81
+ };
82
+ const positional = [];
83
+
84
+ for (let i = 2; i < argv.length; i++) {
85
+ const arg = argv[i];
86
+ if (arg.startsWith("--")) {
87
+ const eqIdx = arg.indexOf("=");
88
+ if (eqIdx !== -1) {
89
+ const key = arg.slice(2, eqIdx);
90
+ const value = arg.slice(eqIdx + 1);
91
+ if (key === "baseUrl" || key === "base-url") args.baseUrl = value;
92
+ if (key === "account") args.account = value;
93
+ if (key === "password") args.password = value;
94
+ if (key === "cookies") args.cookies = value;
95
+ if (key === "swgUser" || key === "swg-user") args.swgUser = value;
96
+ if (key === "swgPass" || key === "swg-pass") args.swgPass = value;
97
+ }
98
+ } else {
99
+ positional.push(arg);
100
+ }
101
+ }
102
+
103
+ args.action = positional[0] || "get";
104
+ return args;
105
+ }
106
+
107
+ // ==================== 命令实现 ====================
108
+
109
+ function cmdGet() {
110
+ const config = loadConfig();
111
+
112
+ console.log(`\nAPI 工具配置 (${getConfigFilePath()})\n`);
113
+ console.log(` [YApi]`);
114
+ console.log(` YAPI_BASE_URL : ${config.YAPI_BASE_URL || "(未设置)"}`);
115
+ console.log(` YAPI_ACCOUNT : ${config.YAPI_ACCOUNT || "(未设置)"}`);
116
+ console.log(` YAPI_PASSWORD : ${maskValue(config.YAPI_PASSWORD)}`);
117
+ console.log(` YAPI_COOKIES : ${maskValue(config.YAPI_COOKIES)}`);
118
+ console.log(`\n [Swagger]`);
119
+ console.log(` SWAGGER_DEFAULT_USERNAME : ${config.SWAGGER_DEFAULT_USERNAME || "(未设置)"}`);
120
+ console.log(` SWAGGER_DEFAULT_PASSWORD : ${maskValue(config.SWAGGER_DEFAULT_PASSWORD)}`);
121
+ console.log(`\n配置后,api_tool fetch 操作可自动读取认证信息。`);
122
+ console.log(` 用法: npx szcd-mcp-api-config set --baseUrl=xxx --account=yyy --cookies=zzz --swgUser=admin --swgPass=xxx\n`);
123
+ }
124
+
125
+ function cmdSet(baseUrl, account, password, cookies, swgUser, swgPass) {
126
+ const config = loadConfig();
127
+ let changed = false;
128
+
129
+ if (baseUrl) {
130
+ const old = config.YAPI_BASE_URL || "(未设置)";
131
+ config.YAPI_BASE_URL = baseUrl;
132
+ console.log(` YAPI_BASE_URL : ${old} -> ${baseUrl}`);
133
+ changed = true;
134
+ }
135
+ if (account) {
136
+ const old = config.YAPI_ACCOUNT || "(未设置)";
137
+ config.YAPI_ACCOUNT = account;
138
+ console.log(` YAPI_ACCOUNT : ${old} -> ${account}`);
139
+ changed = true;
140
+ }
141
+ if (password) {
142
+ const old = maskValue(config.YAPI_PASSWORD);
143
+ config.YAPI_PASSWORD = password;
144
+ console.log(` YAPI_PASSWORD : ${old} -> ${maskValue(password)}`);
145
+ changed = true;
146
+ }
147
+ if (cookies) {
148
+ const old = maskValue(config.YAPI_COOKIES);
149
+ config.YAPI_COOKIES = cookies;
150
+ console.log(` YAPI_COOKIES : ${old} -> ${maskValue(cookies)}`);
151
+ changed = true;
152
+ }
153
+ if (swgUser) {
154
+ const old = config.SWAGGER_DEFAULT_USERNAME || "(未设置)";
155
+ config.SWAGGER_DEFAULT_USERNAME = swgUser;
156
+ console.log(` SWAGGER_DEFAULT_USERNAME : ${old} -> ${swgUser}`);
157
+ changed = true;
158
+ }
159
+ if (swgPass) {
160
+ const old = maskValue(config.SWAGGER_DEFAULT_PASSWORD);
161
+ config.SWAGGER_DEFAULT_PASSWORD = swgPass;
162
+ console.log(` SWAGGER_DEFAULT_PASSWORD : ${old} -> ${maskValue(swgPass)}`);
163
+ changed = true;
164
+ }
165
+
166
+ if (!changed) {
167
+ console.log("\n未提供任何要设置的参数。用法:");
168
+ console.log(" npx szcd-mcp-api-config set --baseUrl=xxx --account=yyy --password=zzz --cookies=ccc --swgUser=admin --swgPass=xxx\n");
169
+ return false;
170
+ }
171
+
172
+ if (saveConfig(config)) {
173
+ console.log(`\n配置已保存。`);
174
+ console.log(` YAPI_BASE_URL : ${config.YAPI_BASE_URL || "(未设置)"}`);
175
+ console.log(` YAPI_ACCOUNT : ${config.YAPI_ACCOUNT || "(未设置)"}`);
176
+ console.log(` YAPI_PASSWORD : ${maskValue(config.YAPI_PASSWORD)}`);
177
+ console.log(` YAPI_COOKIES : ${maskValue(config.YAPI_COOKIES)}`);
178
+ console.log(` SWAGGER_DEFAULT_USERNAME : ${config.SWAGGER_DEFAULT_USERNAME || "(未设置)"}`);
179
+ console.log(` SWAGGER_DEFAULT_PASSWORD : ${maskValue(config.SWAGGER_DEFAULT_PASSWORD)}\n`);
180
+ return true;
181
+ }
182
+ console.log("\n保存配置失败。\n");
183
+ return false;
184
+ }
185
+
186
+ function cmdClear() {
187
+ const config = loadConfig();
188
+ const hadBaseUrl = !!config.YAPI_BASE_URL;
189
+ const hadAccount = !!config.YAPI_ACCOUNT;
190
+ const hadPassword = !!config.YAPI_PASSWORD;
191
+ const hadCookies = !!config.YAPI_COOKIES;
192
+ const hadSwgUser = !!config.SWAGGER_DEFAULT_USERNAME;
193
+ const hadSwgPass = !!config.SWAGGER_DEFAULT_PASSWORD;
194
+
195
+ if (!hadBaseUrl && !hadAccount && !hadPassword && !hadCookies && !hadSwgUser && !hadSwgPass) {
196
+ console.log("\n没有 API 配置需要清除。\n");
197
+ return false;
198
+ }
199
+
200
+ delete config.YAPI_BASE_URL;
201
+ delete config.YAPI_ACCOUNT;
202
+ delete config.YAPI_PASSWORD;
203
+ delete config.YAPI_COOKIES;
204
+ delete config.SWAGGER_DEFAULT_USERNAME;
205
+ delete config.SWAGGER_DEFAULT_PASSWORD;
206
+
207
+ if (saveConfig(config)) {
208
+ console.log("\n已清除 API 配置。\n");
209
+ return true;
210
+ }
211
+ console.log("\n清除配置失败。\n");
212
+ return false;
213
+ }
214
+
215
+ // ==================== 帮助信息 ====================
216
+
217
+ function printHelp() {
218
+ console.log(`
219
+ Usage: npx szcd-mcp-api-config <command> [options]
220
+
221
+ Commands:
222
+ get 查看当前 API 工具配置
223
+ set [options] 设置 YApi / Swagger 配置项
224
+ clear 清除所有 API 配置
225
+
226
+ Options for 'set':
227
+ --baseUrl=<url> YApi 基础地址,如 http://yapi.smartcitysz.work
228
+ --account=<email> YApi 登录账号/邮箱
229
+ --password=<string> YApi 密码(敏感)
230
+ --cookies=<string> YApi Cookie 字符串(敏感,优先使用)
231
+ --swgUser=<string> Swagger 默认鉴权用户名
232
+ --swgPass=<string> Swagger 默认鉴权密码(敏感,留空则跳过鉴权)
233
+
234
+ Examples:
235
+ npx szcd-mcp-api-config get
236
+ npx szcd-mcp-api-config set --baseUrl=http://yapi.smartcitysz.work
237
+ npx szcd-mcp-api-config set --account=xxx@smartcitysz.work --password=xxx
238
+ npx szcd-mcp-api-config set --cookies="_yapi_token=xxx; _yapi_uid=xxx"
239
+ npx szcd-mcp-api-config set --swgUser=admin --swgPass=xxx
240
+ npx szcd-mcp-api-config set --baseUrl=xxx --account=yyy --swgUser=admin --swgPass=zzz
241
+ npx szcd-mcp-api-config clear
242
+
243
+ Config file: ~/.szcd-mcp-config.json
244
+ `);
245
+ }
246
+
247
+ // ==================== 主函数 ====================
248
+
249
+ function main() {
250
+ const args = parseArgs(process.argv);
251
+
252
+ if (args.action === "help" || args.action === "-h" || args.action === "--help") {
253
+ printHelp();
254
+ process.exit(0);
255
+ }
256
+
257
+ if (args.action === "get") {
258
+ cmdGet();
259
+ } else if (args.action === "set") {
260
+ const ok = cmdSet(args.baseUrl, args.account, args.password, args.cookies, args.swgUser, args.swgPass);
261
+ process.exit(ok ? 0 : 1);
262
+ } else if (args.action === "clear") {
263
+ const ok = cmdClear();
264
+ process.exit(ok ? 0 : 1);
265
+ } else {
266
+ console.error(`Unknown command: ${args.action}`);
267
+ printHelp();
268
+ process.exit(1);
269
+ }
270
+ }
271
+
272
+ main();