@autotest/agent 0.0.6 → 0.0.8
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 +7 -0
- package/dist/.buildstamp +1 -0
- package/dist/api/agent_api.d.ts +2 -2
- package/dist/autotest-cli.js +1 -397
- package/dist/common/config/config.yaml +4 -0
- package/dist/common/config/manager.d.ts +4 -4
- package/dist/common/config/types.d.ts +5 -0
- package/dist/common/dfx/index.d.ts +1 -1
- package/dist/core/agent/single_agent/agent.d.ts +1 -0
- package/dist/core/device/device_protocol.d.ts +1 -1
- package/dist/core/device/hdc/device.d.ts +5 -2
- package/dist/core/knowledge/knowledge_manager.d.ts +3 -3
- package/dist/core/knowledge/vectordb.d.ts +5 -5
- package/dist/core/mcp/harmony_hdc_adapter.d.ts +2 -0
- package/dist/core/mcp/mcp_tools.d.ts +1 -0
- package/dist/core/mcp/verify_tool.d.ts +12 -0
- package/dist/core/prompt/templates/single/single_v2.0.md +15 -0
- package/dist/data_types/device.d.ts +1 -1
- package/dist/data_types/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -163
- package/dist/tools/batch_runner.js +1 -745
- package/dist/tools/case_runner/runner.js +1 -410
- package/dist/tools/config/config_tool.js +1 -339
- package/dist/tools/prompt_compare/compare_runner.js +1 -360
- package/package.json +2 -2
- package/dist/api/agent_api.js +0 -550
- package/dist/api/autotest_agent.js +0 -205
- package/dist/api/types.js +0 -11
- package/dist/common/case_manager.js +0 -91
- package/dist/common/collect_case.js +0 -128
- package/dist/common/common_errors.js +0 -66
- package/dist/common/config/config_validator.js +0 -28
- package/dist/common/config/manager.js +0 -257
- package/dist/common/config/output.js +0 -59
- package/dist/common/config/types.js +0 -185
- package/dist/common/dfx/client_factory.js +0 -62
- package/dist/common/dfx/context.js +0 -23
- package/dist/common/dfx/index.js +0 -15
- package/dist/common/dfx/recorder.js +0 -191
- package/dist/common/dfx/recording_fetch.js +0 -228
- package/dist/common/dfx/source.js +0 -13
- package/dist/common/image_cacher.js +0 -36
- package/dist/common/image_helper.js +0 -128
- package/dist/common/image_similarity.js +0 -171
- package/dist/common/llm_cache/cache_transport.js +0 -102
- package/dist/common/llm_cache/prompt_cache.js +0 -113
- package/dist/common/logger.js +0 -158
- package/dist/common/model/custom_model.js +0 -487
- package/dist/common/model/index.js +0 -5
- package/dist/common/path_utils.js +0 -88
- package/dist/common/result_parser.js +0 -49
- package/dist/common/usage/token_usage.js +0 -117
- package/dist/common/utils.js +0 -125
- package/dist/core/agent/layered_agent/ability_helper.js +0 -125
- package/dist/core/agent/layered_agent/agent.js +0 -37
- package/dist/core/agent/layered_agent/agent_registry.js +0 -82
- package/dist/core/agent/layered_agent/decision.js +0 -518
- package/dist/core/agent/layered_agent/execute_agent/action_handler.js +0 -155
- package/dist/core/agent/layered_agent/execute_agent/agent_factory.js +0 -41
- package/dist/core/agent/layered_agent/execute_agent/base_agent.js +0 -112
- package/dist/core/agent/layered_agent/execute_agent/general_agent.js +0 -207
- package/dist/core/agent/layered_agent/execute_agent/glm_agent.js +0 -241
- package/dist/core/agent/layered_agent/execute_agent/i18n.js +0 -34
- package/dist/core/agent/layered_agent/execute_agent/index.js +0 -67
- package/dist/core/agent/layered_agent/execute_agent/mai_ui_agent.js +0 -316
- package/dist/core/agent/layered_agent/execute_agent/mcp_prompts.js +0 -154
- package/dist/core/agent/layered_agent/execute_agent/parser/general_parser.js +0 -243
- package/dist/core/agent/layered_agent/execute_agent/parser/glm_parser.js +0 -139
- package/dist/core/agent/layered_agent/execute_agent/parser/index.js +0 -9
- package/dist/core/agent/layered_agent/execute_agent/parser/mai_ui_parser.js +0 -94
- package/dist/core/agent/layered_agent/execute_agent/prompts.js +0 -109
- package/dist/core/agent/layered_agent/execute_agent/simple_reporter.js +0 -33
- package/dist/core/agent/layered_agent/execute_agent/utils.js +0 -52
- package/dist/core/agent/report_analyzer_agent/agent.js +0 -565
- package/dist/core/agent/report_analyzer_agent/config.js +0 -22
- package/dist/core/agent/report_analyzer_agent/data_loader.js +0 -255
- package/dist/core/agent/report_analyzer_agent/guardrails.js +0 -99
- package/dist/core/agent/report_analyzer_agent/hooks.js +0 -31
- package/dist/core/agent/report_analyzer_agent/index.js +0 -52
- package/dist/core/agent/report_analyzer_agent/key_steps_builder.js +0 -42
- package/dist/core/agent/report_analyzer_agent/mapping.js +0 -133
- package/dist/core/agent/report_analyzer_agent/parse.js +0 -375
- package/dist/core/agent/report_analyzer_agent/prompt.js +0 -300
- package/dist/core/agent/report_analyzer_agent/report_writer.js +0 -558
- package/dist/core/agent/report_analyzer_agent/tools.js +0 -150
- package/dist/core/agent/report_analyzer_agent/types.js +0 -274
- package/dist/core/agent/rewrite_agent/agent.js +0 -209
- package/dist/core/agent/rewrite_agent/guardrails.js +0 -95
- package/dist/core/agent/rewrite_agent/mapping.js +0 -56
- package/dist/core/agent/rewrite_agent/parse.js +0 -121
- package/dist/core/agent/rewrite_agent/types.js +0 -37
- package/dist/core/agent/single_agent/agent.js +0 -801
- package/dist/core/agent/single_agent/hook_manager.js +0 -59
- package/dist/core/agent/single_agent/hooks.js +0 -288
- package/dist/core/agent/single_agent/image_utils.js +0 -158
- package/dist/core/agent/single_agent/scroll_search_agent.js +0 -405
- package/dist/core/agent/single_agent/subagent_manager.js +0 -72
- package/dist/core/agent/single_agent/tool_recorder_hook.js +0 -42
- package/dist/core/agent/types.js +0 -2
- package/dist/core/agent/utils/message_builder.js +0 -138
- package/dist/core/device/device_protocol.js +0 -2
- package/dist/core/device/hdc/apps.js +0 -437
- package/dist/core/device/hdc/device.js +0 -219
- package/dist/core/device/hdc/index.js +0 -31
- package/dist/core/device/hdc/input.js +0 -74
- package/dist/core/device/hdc/screenshot.js +0 -171
- package/dist/core/device/index.js +0 -70
- package/dist/core/device/types.js +0 -2
- package/dist/core/knowledge/knowledge_manager.js +0 -70
- package/dist/core/knowledge/vectordb.js +0 -283
- package/dist/core/mcp/adapter_factory.js +0 -99
- package/dist/core/mcp/android_adapter.js +0 -286
- package/dist/core/mcp/base_adapter.js +0 -86
- package/dist/core/mcp/harmony_hdc_adapter.js +0 -798
- package/dist/core/mcp/ios_adapter.js +0 -286
- package/dist/core/mcp/local_tools.js +0 -41
- package/dist/core/mcp/mcp_tools.js +0 -473
- package/dist/core/mcp/types.js +0 -6
- package/dist/core/memory/_utils.js +0 -140
- package/dist/core/memory/compressed_session.js +0 -182
- package/dist/core/memory/context_compressor.js +0 -176
- package/dist/core/memory/index.js +0 -22
- package/dist/core/memory/memory_manager.js +0 -28
- package/dist/core/memory/reflector.js +0 -95
- package/dist/core/memory/replan_manager.js +0 -12
- package/dist/core/memory/session_factory.js +0 -29
- package/dist/core/memory/tool_player.js +0 -225
- package/dist/core/memory/tool_player_popup.js +0 -276
- package/dist/core/memory/tool_player_replan.js +0 -226
- package/dist/core/memory/tool_player_xpath.js +0 -139
- package/dist/core/memory/tool_recorder.js +0 -126
- package/dist/core/preprocessor/task_splitter.js +0 -112
- package/dist/core/prompt/prompt_loader.js +0 -315
- package/dist/core/skill/skill_manager.js +0 -302
- package/dist/data_types/action.js +0 -2
- package/dist/data_types/agent.js +0 -2
- package/dist/data_types/case.js +0 -57
- package/dist/data_types/device.js +0 -2
- package/dist/data_types/index.js +0 -11
- package/dist/data_types/report.js +0 -6
- package/dist/data_types/screen.js +0 -23
- package/dist/data_types/task.js +0 -2
- package/dist/loop/cli.js +0 -127
- package/dist/loop/orchestrator.js +0 -314
- package/dist/loop/result_writer.js +0 -260
- package/dist/loop/types.js +0 -82
- package/dist/mcp-server/server.js +0 -341
- package/dist/mcp-server/types.js +0 -224
- package/dist/reporter/batch_summary.js +0 -197
- package/dist/reporter/generator.js +0 -286
- package/dist/reporter/html_template/index.js +0 -529
- package/dist/reporter/json_report.js +0 -6
- package/dist/reporter/types.js +0 -45
- package/dist/tools/case_runner/report.js +0 -264
|
@@ -1,339 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Config management tool: init/init-app-config/get/set/list operations on config.yaml.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Commands:
|
|
8
|
-
* init - Create a default config.yaml template at the specified path.
|
|
9
|
-
* init-app-config - Create an example app_config.json for MCP bundle name mapping.
|
|
10
|
-
* get - Read a config value by dot-notation key.
|
|
11
|
-
* set - Write a config value by dot-notation key.
|
|
12
|
-
* list - List all config key-value pairs.
|
|
13
|
-
*/
|
|
14
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
-
}
|
|
20
|
-
Object.defineProperty(o, k2, desc);
|
|
21
|
-
}) : (function(o, m, k, k2) {
|
|
22
|
-
if (k2 === undefined) k2 = k;
|
|
23
|
-
o[k2] = m[k];
|
|
24
|
-
}));
|
|
25
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
-
}) : function(o, v) {
|
|
28
|
-
o["default"] = v;
|
|
29
|
-
});
|
|
30
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
-
var ownKeys = function(o) {
|
|
32
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
-
var ar = [];
|
|
34
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
|
-
return ownKeys(o);
|
|
38
|
-
};
|
|
39
|
-
return function (mod) {
|
|
40
|
-
if (mod && mod.__esModule) return mod;
|
|
41
|
-
var result = {};
|
|
42
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
-
__setModuleDefault(result, mod);
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
})();
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.main = main;
|
|
49
|
-
const fs = __importStar(require("fs"));
|
|
50
|
-
const path = __importStar(require("path"));
|
|
51
|
-
const yaml = __importStar(require("js-yaml"));
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
// Default config template source
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
function getDefaultConfigPath() {
|
|
56
|
-
return path.join(__dirname, '..', '..', 'common', 'config', 'config.yaml');
|
|
57
|
-
}
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
// YAML helpers
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
function loadYaml(filePath) {
|
|
62
|
-
if (!fs.existsSync(filePath)) {
|
|
63
|
-
console.error(`Error: config file not found: ${filePath}`);
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
const data = yaml.load(fs.readFileSync(filePath, 'utf-8'));
|
|
67
|
-
return (data && typeof data === 'object') ? data : {};
|
|
68
|
-
}
|
|
69
|
-
function saveYaml(filePath, data) {
|
|
70
|
-
const content = yaml.dump(data, { lineWidth: -1, noRefs: true });
|
|
71
|
-
fs.writeFileSync(filePath, content, 'utf-8');
|
|
72
|
-
}
|
|
73
|
-
function resolveKey(data, key) {
|
|
74
|
-
const parts = key.split('.');
|
|
75
|
-
let current = data;
|
|
76
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
77
|
-
if (typeof current !== 'object' || current === null || !(parts[i] in current)) {
|
|
78
|
-
return { parent: null, leaf: '' };
|
|
79
|
-
}
|
|
80
|
-
current = current[parts[i]];
|
|
81
|
-
}
|
|
82
|
-
if (typeof current !== 'object' || current === null) {
|
|
83
|
-
return { parent: null, leaf: '' };
|
|
84
|
-
}
|
|
85
|
-
return { parent: current, leaf: parts[parts.length - 1] };
|
|
86
|
-
}
|
|
87
|
-
function getValue(data, key) {
|
|
88
|
-
const { parent, leaf } = resolveKey(data, key);
|
|
89
|
-
if (parent === null || !(leaf in parent)) {
|
|
90
|
-
return { found: false, value: null };
|
|
91
|
-
}
|
|
92
|
-
return { found: true, value: parent[leaf] };
|
|
93
|
-
}
|
|
94
|
-
function setValue(data, key, value) {
|
|
95
|
-
const parts = key.split('.');
|
|
96
|
-
let current = data;
|
|
97
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
98
|
-
if (!(parts[i] in current) || typeof current[parts[i]] !== 'object' || current[parts[i]] === null) {
|
|
99
|
-
current[parts[i]] = {};
|
|
100
|
-
}
|
|
101
|
-
current = current[parts[i]];
|
|
102
|
-
}
|
|
103
|
-
current[parts[parts.length - 1]] = value;
|
|
104
|
-
}
|
|
105
|
-
function parseValue(raw) {
|
|
106
|
-
const lower = raw.toLowerCase();
|
|
107
|
-
if (lower === 'true' || lower === 'yes')
|
|
108
|
-
return true;
|
|
109
|
-
if (lower === 'false' || lower === 'no')
|
|
110
|
-
return false;
|
|
111
|
-
if (lower === 'null' || lower === 'none' || lower === '~')
|
|
112
|
-
return null;
|
|
113
|
-
if (/^-?\d+$/.test(raw))
|
|
114
|
-
return parseInt(raw, 10);
|
|
115
|
-
if (/^-?\d*\.\d+$/.test(raw))
|
|
116
|
-
return parseFloat(raw);
|
|
117
|
-
if (raw.startsWith('[') || raw.startsWith('{')) {
|
|
118
|
-
try {
|
|
119
|
-
return JSON.parse(raw);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// fall through
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return raw;
|
|
126
|
-
}
|
|
127
|
-
// ---------------------------------------------------------------------------
|
|
128
|
-
// Flatten for list command
|
|
129
|
-
// ---------------------------------------------------------------------------
|
|
130
|
-
function flatten(data, prefix = '') {
|
|
131
|
-
const result = [];
|
|
132
|
-
for (const [k, v] of Object.entries(data)) {
|
|
133
|
-
const fullKey = prefix ? `${prefix}.${k}` : k;
|
|
134
|
-
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
135
|
-
result.push(...flatten(v, fullKey));
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
result.push([fullKey, v]);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
// ---------------------------------------------------------------------------
|
|
144
|
-
// Commands
|
|
145
|
-
// ---------------------------------------------------------------------------
|
|
146
|
-
const APP_CONFIG_TEMPLATE = {
|
|
147
|
-
bundle_names: {
|
|
148
|
-
'设置': 'com.huawei.hmos.settings',
|
|
149
|
-
},
|
|
150
|
-
main_abilities: {
|
|
151
|
-
'com.huawei.hmos.settings': 'com.huawei.hmos.setting.MainAbility',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
function cmdInit(opts) {
|
|
155
|
-
const src = getDefaultConfigPath();
|
|
156
|
-
if (!fs.existsSync(src)) {
|
|
157
|
-
console.error(`Error: default config template not found at: ${src}`);
|
|
158
|
-
return 1;
|
|
159
|
-
}
|
|
160
|
-
if (fs.existsSync(opts.output) && !opts.force) {
|
|
161
|
-
console.error(`Error: file already exists: ${opts.output}`);
|
|
162
|
-
console.error('Use --force to overwrite.');
|
|
163
|
-
return 1;
|
|
164
|
-
}
|
|
165
|
-
const content = fs.readFileSync(src, 'utf-8');
|
|
166
|
-
const outputDir = path.dirname(path.resolve(opts.output));
|
|
167
|
-
if (outputDir)
|
|
168
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
169
|
-
fs.writeFileSync(opts.output, content, 'utf-8');
|
|
170
|
-
console.log(`\n${'='.repeat(60)}`);
|
|
171
|
-
console.log(` 配置文件已创建: ${path.resolve(opts.output)}`);
|
|
172
|
-
console.log(`${'='.repeat(60)}`);
|
|
173
|
-
console.log(`\n下一步:编辑该文件,填入你的 API Key 和模型配置:\n`);
|
|
174
|
-
console.log(` model.unified.api_key → 填入你的 DashScope API Key`);
|
|
175
|
-
console.log(` model.unified.name → 填入模型名(如 qwen3.7-plus)`);
|
|
176
|
-
console.log(` device.device_sn → 填入设备序列号(hdc list targets 查看)`);
|
|
177
|
-
console.log(`\n或用命令行修改:`);
|
|
178
|
-
console.log(` node dist/tools/config/config_tool.js set model.unified.api_key "sk-xxx"`);
|
|
179
|
-
console.log(` node dist/tools/config/config_tool.js set model.unified.name "qwen3.7-plus"`);
|
|
180
|
-
console.log(` node dist/tools/config/config_tool.js set device.device_sn "YOUR_DEVICE_SN"`);
|
|
181
|
-
console.log(`\n配置完成后即可运行测试:`);
|
|
182
|
-
console.log(` node dist/autotest-cli.js run --task "你的测试任务描述"`);
|
|
183
|
-
console.log(`\n${'='.repeat(60)}\n`);
|
|
184
|
-
return 0;
|
|
185
|
-
}
|
|
186
|
-
function cmdInitAppConfig(opts) {
|
|
187
|
-
if (fs.existsSync(opts.output) && !opts.force) {
|
|
188
|
-
console.error(`Error: file already exists: ${opts.output}`);
|
|
189
|
-
console.error('Use --force to overwrite.');
|
|
190
|
-
return 1;
|
|
191
|
-
}
|
|
192
|
-
const outputDir = path.dirname(path.resolve(opts.output));
|
|
193
|
-
if (outputDir)
|
|
194
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
195
|
-
fs.writeFileSync(opts.output, JSON.stringify(APP_CONFIG_TEMPLATE, null, 2) + '\n', 'utf-8');
|
|
196
|
-
console.log(`Created app_config template: ${path.resolve(opts.output)}`);
|
|
197
|
-
console.log(` bundle_names: ${Object.keys(APP_CONFIG_TEMPLATE.bundle_names).length} entries`);
|
|
198
|
-
console.log(` main_abilities: ${Object.keys(APP_CONFIG_TEMPLATE.main_abilities).length} entries`);
|
|
199
|
-
console.log(`\nEdit the file to add your app mappings, then use:`);
|
|
200
|
-
console.log(` autotest run --task "..." --app-config ${opts.output}`);
|
|
201
|
-
return 0;
|
|
202
|
-
}
|
|
203
|
-
function cmdGet(opts) {
|
|
204
|
-
const data = loadYaml(opts.config);
|
|
205
|
-
const { found, value } = getValue(data, opts.key);
|
|
206
|
-
if (!found) {
|
|
207
|
-
console.error(`Key not found: ${opts.key}`);
|
|
208
|
-
return 1;
|
|
209
|
-
}
|
|
210
|
-
if (value && typeof value === 'object') {
|
|
211
|
-
console.log(yaml.dump(value, { lineWidth: -1, noRefs: true }).trimEnd());
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
console.log(value === null ? 'null' : String(value));
|
|
215
|
-
}
|
|
216
|
-
return 0;
|
|
217
|
-
}
|
|
218
|
-
function cmdSet(opts) {
|
|
219
|
-
const data = loadYaml(opts.config);
|
|
220
|
-
const parsed = parseValue(opts.value);
|
|
221
|
-
setValue(data, opts.key, parsed);
|
|
222
|
-
saveYaml(opts.config, data);
|
|
223
|
-
console.log(`Set ${opts.key} = ${JSON.stringify(parsed)}`);
|
|
224
|
-
return 0;
|
|
225
|
-
}
|
|
226
|
-
function cmdList(opts) {
|
|
227
|
-
const data = loadYaml(opts.config);
|
|
228
|
-
const items = flatten(data);
|
|
229
|
-
if (items.length === 0) {
|
|
230
|
-
console.log('(empty config)');
|
|
231
|
-
return 0;
|
|
232
|
-
}
|
|
233
|
-
const maxKeyLen = Math.max(...items.map(([k]) => k.length));
|
|
234
|
-
const separator = '─'.repeat(maxKeyLen + 20);
|
|
235
|
-
let currentPrefix = null;
|
|
236
|
-
for (const [key, value] of items) {
|
|
237
|
-
const prefix = key.split('.')[0];
|
|
238
|
-
if (prefix !== currentPrefix) {
|
|
239
|
-
console.log(separator);
|
|
240
|
-
console.log(` [${prefix}]`);
|
|
241
|
-
console.log(separator);
|
|
242
|
-
currentPrefix = prefix;
|
|
243
|
-
}
|
|
244
|
-
const valStr = value === null ? 'null' : String(value);
|
|
245
|
-
console.log(` ${key.padEnd(maxKeyLen)} ${valStr}`);
|
|
246
|
-
}
|
|
247
|
-
console.log(`\n${separator}`);
|
|
248
|
-
console.log(`Total: ${items.length} keys`);
|
|
249
|
-
return 0;
|
|
250
|
-
}
|
|
251
|
-
function parseArgs(args) {
|
|
252
|
-
const result = {
|
|
253
|
-
command: '',
|
|
254
|
-
output: '',
|
|
255
|
-
force: false,
|
|
256
|
-
key: '',
|
|
257
|
-
value: '',
|
|
258
|
-
config: 'config.yaml',
|
|
259
|
-
};
|
|
260
|
-
if (args.length === 0)
|
|
261
|
-
return result;
|
|
262
|
-
result.command = args[0];
|
|
263
|
-
for (let i = 1; i < args.length; i++) {
|
|
264
|
-
switch (args[i]) {
|
|
265
|
-
case '-o':
|
|
266
|
-
case '--output':
|
|
267
|
-
result.output = args[++i] ?? '';
|
|
268
|
-
break;
|
|
269
|
-
case '--force':
|
|
270
|
-
result.force = true;
|
|
271
|
-
break;
|
|
272
|
-
case '--config':
|
|
273
|
-
case '-c':
|
|
274
|
-
result.config = args[++i] ?? 'config.yaml';
|
|
275
|
-
break;
|
|
276
|
-
default:
|
|
277
|
-
if (!result.key) {
|
|
278
|
-
result.key = args[i];
|
|
279
|
-
}
|
|
280
|
-
else if (!result.value) {
|
|
281
|
-
result.value = args[i];
|
|
282
|
-
}
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
function printUsage() {
|
|
289
|
-
console.log(`
|
|
290
|
-
Usage: autotest-config <command> [options]
|
|
291
|
-
|
|
292
|
-
Commands:
|
|
293
|
-
init Create a default config.yaml template
|
|
294
|
-
init-app-config Create an example app_config.json for MCP bundle name mapping
|
|
295
|
-
get Get a config value by dot-notation key
|
|
296
|
-
set Set a config value by dot-notation key
|
|
297
|
-
list List all config key-value pairs
|
|
298
|
-
|
|
299
|
-
Options:
|
|
300
|
-
-o, --output <path> Output file path (for init/init-app-config)
|
|
301
|
-
--force Overwrite existing file
|
|
302
|
-
-c, --config <path> Config file path (for get/set/list, default: config.yaml)
|
|
303
|
-
`);
|
|
304
|
-
}
|
|
305
|
-
function main() {
|
|
306
|
-
const args = process.argv.slice(2);
|
|
307
|
-
const parsed = parseArgs(args);
|
|
308
|
-
if (!parsed.command) {
|
|
309
|
-
printUsage();
|
|
310
|
-
return 1;
|
|
311
|
-
}
|
|
312
|
-
switch (parsed.command) {
|
|
313
|
-
case 'init':
|
|
314
|
-
return cmdInit({ output: parsed.output || 'config.yaml', force: parsed.force });
|
|
315
|
-
case 'init-app-config':
|
|
316
|
-
return cmdInitAppConfig({ output: parsed.output || 'app_config.json', force: parsed.force });
|
|
317
|
-
case 'get':
|
|
318
|
-
if (!parsed.key) {
|
|
319
|
-
console.error('Usage: autotest-config get <key>');
|
|
320
|
-
return 1;
|
|
321
|
-
}
|
|
322
|
-
return cmdGet({ config: parsed.config, key: parsed.key });
|
|
323
|
-
case 'set':
|
|
324
|
-
if (!parsed.key || !parsed.value) {
|
|
325
|
-
console.error('Usage: autotest-config set <key> <value>');
|
|
326
|
-
return 1;
|
|
327
|
-
}
|
|
328
|
-
return cmdSet({ config: parsed.config, key: parsed.key, value: parsed.value });
|
|
329
|
-
case 'list':
|
|
330
|
-
return cmdList({ config: parsed.config });
|
|
331
|
-
default:
|
|
332
|
-
console.error(`Unknown command: ${parsed.command}`);
|
|
333
|
-
printUsage();
|
|
334
|
-
return 1;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
if (require.main === module) {
|
|
338
|
-
process.exit(main());
|
|
339
|
-
}
|
|
1
|
+
'use strict';const _0x2842e1=_0x2cee;(function(_0x51017a,_0x4c3b68){const _0x3368a4=_0x2cee,_0x2c8329=_0x51017a();while(!![]){try{const _0x20f377=-parseInt(_0x3368a4(0x91))/0x1+parseInt(_0x3368a4(0x97))/0x2+parseInt(_0x3368a4(0x81))/0x3+parseInt(_0x3368a4(0x86))/0x4+parseInt(_0x3368a4(0xc5))/0x5+parseInt(_0x3368a4(0xcd))/0x6*(parseInt(_0x3368a4(0xb3))/0x7)+parseInt(_0x3368a4(0xda))/0x8*(-parseInt(_0x3368a4(0x90))/0x9);if(_0x20f377===_0x4c3b68)break;else _0x2c8329['push'](_0x2c8329['shift']());}catch(_0x445445){_0x2c8329['push'](_0x2c8329['shift']());}}}(_0x4b51,0x47f1a));var __createBinding=exports&&exports[_0x2842e1(0xc2)]||(Object['create']?function(_0x1720ea,_0x305d18,_0x33befc,_0x33b5ef){const _0x280396=_0x2842e1;if(_0x33b5ef===void 0x0)_0x33b5ef=_0x33befc;var _0x6e5870=Object[_0x280396(0x82)](_0x305d18,_0x33befc);(!_0x6e5870||(_0x280396(0xd9)in _0x6e5870?!_0x305d18[_0x280396(0xdb)]:_0x6e5870['writable']||_0x6e5870[_0x280396(0xd4)]))&&(_0x6e5870={'enumerable':!![],'get':function(){return _0x305d18[_0x33befc];}}),Object[_0x280396(0x9c)](_0x1720ea,_0x33b5ef,_0x6e5870);}:function(_0x68ddc4,_0x23ea45,_0x4fbed4,_0x36b2b4){if(_0x36b2b4===void 0x0)_0x36b2b4=_0x4fbed4;_0x68ddc4[_0x36b2b4]=_0x23ea45[_0x4fbed4];}),__setModuleDefault=exports&&exports['__setModuleDefault']||(Object[_0x2842e1(0x85)]?function(_0x1c02e5,_0x307a32){const _0x28eac8=_0x2842e1;Object[_0x28eac8(0x9c)](_0x1c02e5,_0x28eac8(0xde),{'enumerable':!![],'value':_0x307a32});}:function(_0x303b71,_0x2d17cf){const _0x52f691=_0x2842e1;_0x303b71[_0x52f691(0xde)]=_0x2d17cf;}),__importStar=exports&&exports[_0x2842e1(0xa6)]||(function(){var _0x28324c=function(_0x199903){const _0xfc427=_0x2cee;return _0x28324c=Object[_0xfc427(0xb6)]||function(_0x1e7c1a){const _0xe5236a=_0xfc427;var _0x495352=[];for(var _0x51cb43 in _0x1e7c1a)if(Object[_0xe5236a(0xcf)][_0xe5236a(0xac)][_0xe5236a(0x88)](_0x1e7c1a,_0x51cb43))_0x495352[_0x495352['length']]=_0x51cb43;return _0x495352;},_0x28324c(_0x199903);};return function(_0x824001){const _0x51f376=_0x2cee;if(_0x824001&&_0x824001[_0x51f376(0xdb)])return _0x824001;var _0x3e6e7a={};if(_0x824001!=null){for(var _0x4f06ca=_0x28324c(_0x824001),_0x371068=0x0;_0x371068<_0x4f06ca['length'];_0x371068++)if(_0x4f06ca[_0x371068]!==_0x51f376(0xde))__createBinding(_0x3e6e7a,_0x824001,_0x4f06ca[_0x371068]);}return __setModuleDefault(_0x3e6e7a,_0x824001),_0x3e6e7a;};}());Object[_0x2842e1(0x9c)](exports,_0x2842e1(0xdb),{'value':!![]}),exports[_0x2842e1(0x8e)]=main;var fs=__importStar(require('fs')),path=__importStar(require(_0x2842e1(0xad))),yaml=__importStar(require(_0x2842e1(0xd7)));function getDefaultConfigPath(){const _0x3ea7e3=_0x2842e1;return path['join'](__dirname,'..','..',_0x3ea7e3(0xd5),_0x3ea7e3(0xce),_0x3ea7e3(0x92));}function loadYaml(_0x319961){const _0x1ee0cf=_0x2842e1;!fs[_0x1ee0cf(0xe1)](_0x319961)&&(console[_0x1ee0cf(0xa0)](_0x1ee0cf(0xa2)+_0x319961),process['exit'](0x1));const _0x4554a0=yaml['load'](fs[_0x1ee0cf(0xc6)](_0x319961,_0x1ee0cf(0xb8)));return _0x4554a0&&typeof _0x4554a0===_0x1ee0cf(0xbb)?_0x4554a0:{};}function saveYaml(_0x5624c9,_0x707f09){const _0x1b5b51=_0x2842e1,_0x4ccdea=yaml[_0x1b5b51(0x96)](_0x707f09,{'lineWidth':-0x1,'noRefs':!![]});fs[_0x1b5b51(0xae)](_0x5624c9,_0x4ccdea,_0x1b5b51(0xb8));}function resolveKey(_0x344584,_0x152988){const _0x1b580b=_0x2842e1,_0x4ea571=_0x152988['split']('.');let _0x436eae=_0x344584;for(let _0x5266bb=0x0;_0x5266bb<_0x4ea571[_0x1b580b(0xcc)]-0x1;_0x5266bb++){if(typeof _0x436eae!==_0x1b580b(0xbb)||_0x436eae===null||!(_0x4ea571[_0x5266bb]in _0x436eae))return{'parent':null,'leaf':''};_0x436eae=_0x436eae[_0x4ea571[_0x5266bb]];}if(typeof _0x436eae!=='object'||_0x436eae===null)return{'parent':null,'leaf':''};return{'parent':_0x436eae,'leaf':_0x4ea571[_0x4ea571['length']-0x1]};}function _0x4b51(){const _0x16305a=['BwfPBG','ig1VzgvSlNvUAwzPzwqUyxbPx2TLEsdIHPiG5AgR5ywL5l2G55QeierHC2Hty29WzsbbueKGs2v5','ovvAteDztG','nti3mtiZqwzVCuTl','y29UzMLNlNLHBwW','igvUDhjPzxm','Aw5PDa','q3jLyxrLzcbHChbFy29UzMLNihrLBxbSyxrLoIa','zhvTCa','ndi5mJa0DeXkq1P2','AxnbCNjHEq','C3bSAxq','A2v5','u2v0ia','zgvMAw5LuhjVCgvYDhK','ioMfJEE9RUAwH+s7TUw3SUwiM+w7UJOG','rxjYB3i6igzPBguGywXYzwfKEsbLEgLZDhm6ia','CMvWzwf0','zxjYB3i','BgLZDa','rxjYB3i6ignVBMzPzYbMAwXLig5VDcbMB3vUzdOG','id0G','DgvZDa','y29TBwfUza','x19PBxbVCNrtDgfY','DMfSDwu','cUs4I+s4GoATPE+8MUE8LUI+KEIVPEAwH+s7TU+8JowHQ+wfPEs9OoEAHcbbueKGs2v5iowsJoAOOEwEI+MfJEE9RU+8MGO','zgLYBMfTzq','ig5VzguGzgLZDc90B29SCY9JB25MAwCVy29UzMLNx3rVB2WUANmGC2v0ig1VzgvSlNvUAwzPzwqUyxbPx2TLEsaIC2STEhH4iG','vxnHz2u6igf1Dg90zxn0lwnVBMzPzYbZzxqGpgTLEt4GphzHBhvLpG','AgfZt3DUuhjVCgvYDhK','Cgf0Aa','D3jPDgvgAwXLu3LUyW','y29TlMH1yxDLAs5OBw9ZlNnLDhrPBMCUtwfPBKfIAwXPDhK','igrLDMLJzs5KzxzPy2vFC24G4OAsiowHQ+wfPEIUVUwKH+w6J+wiL+wpT++8IgHKyYbSAxn0ihrHCMDLDhmG5P+L55Yl77Yj','C2XPy2u','BwfW','mtG5v2vcC3LW','ig5VzguGzgLZDc9HDxrVDgvZDc1JBgKUANmGCNvUic0TDgfZAYaI5l2G55Qe5Rwl6k+v5lU75yQH5O+p6l+WiG','yxbWx2nVBMzPzY5QC29U','z2v0t3DUuhjVCgvYDhLoyw1LCW','Dhj1zq','DxrMltG','ig5VzguGzgLZDc90B29SCY9JB25MAwCVy29UzMLNx3rVB2WUANmGC2v0ig1VzgvSlNvUAwzPzwqUBMfTzsaICxDLBJmUnY1WBhvZiG','BwTKAxjtEw5J','B2jQzwn0','C2v0','s2v5ig5VDcbMB3vUzdOG','kgvTChr5ignVBMzPzYK','C3rYAw5NAwz5','C3rHCNrZv2L0Aa','BwfPBL9HyMLSAxrPzxm','x19JCMvHDgvcAw5KAw5N','CgfKrw5K','BNvSBa','mtuWmdi2me1MreDgEq','CMvHzezPBgvtEw5J','DhjPBuvUza','BM9Uzq','vw5RBM93BIbJB21Tyw5KoIa','yxjNDG','ChvZAa','BgvUz3rO','mZyYndz2rKzmu08','y29UzMLN','ChjVDg90ExbL','EwvZ','igf1Dg90zxn0ihj1BIaTlxrHC2SGiI4UlIiGls1HChaTy29UzMLNia','y29TlMH1yxDLAs5OBw9ZlNnLDhrPBMDZ','zM9Yy2u','y29UzMLNDxjHyMXL','y29TBw9U','CgfYC2u','ANmTEwfTBa','cKvKAxqGDgHLigzPBguGDg8GywrKihLVDxiGyxbWig1HChbPBMDZlcb0AgvUihvZztO','z2v0','mZuZoda4oeLOq0fqsq','x19LC01VzhvSzq','Bg9N','vxnLic0TzM9Yy2uGDg8GB3zLCNDYAxrLlG','zgvMyxvSDa','A2v5CW','CMvZB2X2zq','zxHPC3rZu3LUyW','ndiWndi2B0HNrLrY','z2v0t3DUuhjVCgvYDhLezxnJCMLWDg9Y','B3v0Chv0','ls1VDxrWDxq','y3jLyxrL','mtC4ndy1mM5HuMfmDa','igTLExm','y2fSBa','vg90ywW6ia','zMfSC2u','Aw5PDc1HChaTy29UzMLN','zxHPDa','Bwf4'];_0x4b51=function(){return _0x16305a;};return _0x4b51();}function getValue(_0x3d0e68,_0x390415){const {parent:_0xff58e4,leaf:_0x19b20b}=resolveKey(_0x3d0e68,_0x390415);if(_0xff58e4===null||!(_0x19b20b in _0xff58e4))return{'found':![],'value':null};return{'found':!![],'value':_0xff58e4[_0x19b20b]};}function setValue(_0x494eed,_0x198af7,_0x570958){const _0x508c71=_0x2842e1,_0x580122=_0x198af7['split']('.');let _0x5ea605=_0x494eed;for(let _0x2427b7=0x0;_0x2427b7<_0x580122[_0x508c71(0xcc)]-0x1;_0x2427b7++){(!(_0x580122[_0x2427b7]in _0x5ea605)||typeof _0x5ea605[_0x580122[_0x2427b7]]!==_0x508c71(0xbb)||_0x5ea605[_0x580122[_0x2427b7]]===null)&&(_0x5ea605[_0x580122[_0x2427b7]]={}),_0x5ea605=_0x5ea605[_0x580122[_0x2427b7]];}_0x5ea605[_0x580122[_0x580122[_0x508c71(0xcc)]-0x1]]=_0x570958;}function _0x2cee(_0x54636c,_0x2d1803){_0x54636c=_0x54636c-0x81;const _0x4b51c0=_0x4b51();let _0x2cee2c=_0x4b51c0[_0x54636c];if(_0x2cee['zFJTnN']===undefined){var _0x171538=function(_0x1bcbf6){const _0x4fb531='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1720ea='',_0x305d18='';for(let _0x33befc=0x0,_0x33b5ef,_0x6e5870,_0x68ddc4=0x0;_0x6e5870=_0x1bcbf6['charAt'](_0x68ddc4++);~_0x6e5870&&(_0x33b5ef=_0x33befc%0x4?_0x33b5ef*0x40+_0x6e5870:_0x6e5870,_0x33befc++%0x4)?_0x1720ea+=String['fromCharCode'](0xff&_0x33b5ef>>(-0x2*_0x33befc&0x6)):0x0){_0x6e5870=_0x4fb531['indexOf'](_0x6e5870);}for(let _0x23ea45=0x0,_0x4fbed4=_0x1720ea['length'];_0x23ea45<_0x4fbed4;_0x23ea45++){_0x305d18+='%'+('00'+_0x1720ea['charCodeAt'](_0x23ea45)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x305d18);};_0x2cee['dMKuPs']=_0x171538,_0x2cee['hSeghG']={},_0x2cee['zFJTnN']=!![];}const _0x5363ff=_0x4b51c0[0x0],_0x19c7d5=_0x54636c+_0x5363ff,_0x2c49b3=_0x2cee['hSeghG'][_0x19c7d5];return!_0x2c49b3?(_0x2cee2c=_0x2cee['dMKuPs'](_0x2cee2c),_0x2cee['hSeghG'][_0x19c7d5]=_0x2cee2c):_0x2cee2c=_0x2c49b3,_0x2cee2c;}function parseValue(_0x80bb25){const _0x37dfde=_0x2842e1,_0x5898ee=_0x80bb25['toLowerCase']();if(_0x5898ee===_0x37dfde(0xb7)||_0x5898ee===_0x37dfde(0xd0))return!![];if(_0x5898ee===_0x37dfde(0x8a)||_0x5898ee==='no')return![];if(_0x5898ee===_0x37dfde(0xc4)||_0x5898ee===_0x37dfde(0xc8)||_0x5898ee==='~')return null;if(/^-?\d+$/[_0x37dfde(0xa4)](_0x80bb25))return parseInt(_0x80bb25,0xa);if(/^-?\d*\.\d+$/[_0x37dfde(0xa4)](_0x80bb25))return parseFloat(_0x80bb25);if(_0x80bb25[_0x37dfde(0xc0)]('[')||_0x80bb25['startsWith']('{'))try{return JSON[_0x37dfde(0xd6)](_0x80bb25);}catch{}return _0x80bb25;}function flatten(_0x30972f,_0x5392ee=''){const _0x4b024b=_0x2842e1,_0x411ece=[];for(const [_0x26d47f,_0x1ac2c0]of Object['entries'](_0x30972f)){const _0x406d43=_0x5392ee?_0x5392ee+'.'+_0x26d47f:_0x26d47f;_0x1ac2c0&&typeof _0x1ac2c0===_0x4b024b(0xbb)&&!Array[_0x4b024b(0x98)](_0x1ac2c0)?_0x411ece[_0x4b024b(0xcb)](...flatten(_0x1ac2c0,_0x406d43)):_0x411ece[_0x4b024b(0xcb)]([_0x406d43,_0x1ac2c0]);}return _0x411ece;}var APP_CONFIG_TEMPLATE={'bundle_names':{'设置':_0x2842e1(0xd2)},'main_abilities':{'com.huawei.hmos.settings':_0x2842e1(0xaf)}};function cmdInit(_0x55132d){const _0x14c9d=_0x2842e1,_0x32b2ad=getDefaultConfigPath();if(!fs['existsSync'](_0x32b2ad))return console[_0x14c9d(0xa0)]('Error:\x20default\x20config\x20template\x20not\x20found\x20at:\x20'+_0x32b2ad),0x1;if(fs[_0x14c9d(0xe1)](_0x55132d[_0x14c9d(0x83)])&&!_0x55132d[_0x14c9d(0xd3)])return console[_0x14c9d(0xa0)](_0x14c9d(0x9e)+_0x55132d[_0x14c9d(0x83)]),console[_0x14c9d(0xa0)]('Use\x20--force\x20to\x20overwrite.'),0x1;const _0x419fa8=fs[_0x14c9d(0xc6)](_0x32b2ad,_0x14c9d(0xb8)),_0x22a720=path[_0x14c9d(0xa9)](path[_0x14c9d(0xe0)](_0x55132d[_0x14c9d(0x83)]));if(_0x22a720)fs[_0x14c9d(0xba)](_0x22a720,{'recursive':!![]});return fs[_0x14c9d(0xae)](_0x55132d['output'],_0x419fa8,_0x14c9d(0xb8)),console['log']('\x0a'+'='[_0x14c9d(0x9f)](0x3c)),console[_0x14c9d(0xdc)](_0x14c9d(0x9d)+path[_0x14c9d(0xe0)](_0x55132d[_0x14c9d(0x83)])),console[_0x14c9d(0xdc)](''+'='[_0x14c9d(0x9f)](0x3c)),console['log'](_0x14c9d(0xa8)),console[_0x14c9d(0xdc)](_0x14c9d(0x8f)),console[_0x14c9d(0xdc)]('\x20model.unified.name\x20→\x20填入模型名(如\x20qwen3.7-plus)'),console['log'](_0x14c9d(0xb0)),console[_0x14c9d(0xdc)]('\x0a或用命令行修改:'),console[_0x14c9d(0xdc)](_0x14c9d(0xaa)),console[_0x14c9d(0xdc)](_0x14c9d(0xb9)),console[_0x14c9d(0xdc)]('\x20node\x20dist/tools/config/config_tool.js\x20set\x20device.device_sn\x20\x22YOUR_DEVICE_SN\x22'),console['log']('\x0a配置完成后即可运行测试:'),console[_0x14c9d(0xdc)](_0x14c9d(0xb4)),console['log']('\x0a'+'='[_0x14c9d(0x9f)](0x3c)+'\x0a'),0x0;}function cmdInitAppConfig(_0x2cd5b9){const _0x30f015=_0x2842e1;if(fs[_0x30f015(0xe1)](_0x2cd5b9[_0x30f015(0x83)])&&!_0x2cd5b9['force'])return console['error'](_0x30f015(0x9e)+_0x2cd5b9[_0x30f015(0x83)]),console[_0x30f015(0xa0)](_0x30f015(0xdd)),0x1;const _0x1bc884=path['dirname'](path['resolve'](_0x2cd5b9['output']));if(_0x1bc884)fs[_0x30f015(0xba)](_0x1bc884,{'recursive':!![]});return fs['writeFileSync'](_0x2cd5b9['output'],JSON[_0x30f015(0xbf)](APP_CONFIG_TEMPLATE,null,0x2)+'\x0a',_0x30f015(0xb8)),console[_0x30f015(0xdc)](_0x30f015(0x95)+path['resolve'](_0x2cd5b9[_0x30f015(0x83)])),console[_0x30f015(0xdc)]('\x20bundle_names:\x20'+Object[_0x30f015(0xdf)](APP_CONFIG_TEMPLATE['bundle_names'])[_0x30f015(0xcc)]+_0x30f015(0x93)),console['log']('\x20main_abilities:\x20'+Object[_0x30f015(0xdf)](APP_CONFIG_TEMPLATE[_0x30f015(0xc1)])['length']+'\x20entries'),console[_0x30f015(0xdc)](_0x30f015(0xd8)),console[_0x30f015(0xdc)](_0x30f015(0xd1)+_0x2cd5b9[_0x30f015(0x83)]),0x0;}function cmdGet(_0x283ed1){const _0x407af8=_0x2842e1,_0x21bfd9=loadYaml(_0x283ed1['config']),{found:_0x43e045,value:_0x31e45b}=getValue(_0x21bfd9,_0x283ed1['key']);if(!_0x43e045)return console['error'](_0x407af8(0xbd)+_0x283ed1[_0x407af8(0x9a)]),0x1;return _0x31e45b&&typeof _0x31e45b==='object'?console[_0x407af8(0xdc)](yaml[_0x407af8(0x96)](_0x31e45b,{'lineWidth':-0x1,'noRefs':!![]})[_0x407af8(0xc7)]()):console[_0x407af8(0xdc)](_0x31e45b===null?_0x407af8(0xc4):String(_0x31e45b)),0x0;}function cmdSet(_0x34fb39){const _0x2bfb17=_0x2842e1,_0x487391=loadYaml(_0x34fb39[_0x2bfb17(0xce)]),_0x5cc98f=parseValue(_0x34fb39[_0x2bfb17(0xa7)]);return setValue(_0x487391,_0x34fb39[_0x2bfb17(0x9a)],_0x5cc98f),saveYaml(_0x34fb39[_0x2bfb17(0xce)],_0x487391),console[_0x2bfb17(0xdc)](_0x2bfb17(0x9b)+_0x34fb39[_0x2bfb17(0x9a)]+_0x2bfb17(0xa3)+JSON['stringify'](_0x5cc98f)),0x0;}function cmdList(_0x3e5b83){const _0x13a7f8=_0x2842e1,_0x4297dc=loadYaml(_0x3e5b83['config']),_0x523c94=flatten(_0x4297dc);if(_0x523c94[_0x13a7f8(0xcc)]===0x0)return console[_0x13a7f8(0xdc)](_0x13a7f8(0xbe)),0x0;const _0x429ff9=Math[_0x13a7f8(0x8d)](..._0x523c94[_0x13a7f8(0xb2)](([_0x220479])=>_0x220479[_0x13a7f8(0xcc)])),_0x52be9b='\u2500'['repeat'](_0x429ff9+0x14);let _0x594db9=null;for(const [_0x2ce9f4,_0x269ca2]of _0x523c94){const _0x1fb88e=_0x2ce9f4[_0x13a7f8(0x99)]('.')[0x0];_0x1fb88e!==_0x594db9&&(console[_0x13a7f8(0xdc)](_0x52be9b),console['log']('\x20['+_0x1fb88e+']'),console[_0x13a7f8(0xdc)](_0x52be9b),_0x594db9=_0x1fb88e);const _0x31b7c7=_0x269ca2===null?_0x13a7f8(0xc4):String(_0x269ca2);console[_0x13a7f8(0xdc)]('\x20'+_0x2ce9f4[_0x13a7f8(0xc3)](_0x429ff9)+'\x20'+_0x31b7c7);}return console[_0x13a7f8(0xdc)]('\x0a'+_0x52be9b),console[_0x13a7f8(0xdc)](_0x13a7f8(0x89)+_0x523c94[_0x13a7f8(0xcc)]+_0x13a7f8(0x87)),0x0;}function parseArgs(_0x280e38){const _0x1fa251=_0x2842e1,_0x5b9e7d={'command':'','output':'','force':![],'key':'','value':'','config':'config.yaml'};if(_0x280e38[_0x1fa251(0xcc)]===0x0)return _0x5b9e7d;_0x5b9e7d[_0x1fa251(0xa5)]=_0x280e38[0x0];for(let _0x57086d=0x1;_0x57086d<_0x280e38[_0x1fa251(0xcc)];_0x57086d++){switch(_0x280e38[_0x57086d]){case'-o':case _0x1fa251(0x84):_0x5b9e7d[_0x1fa251(0x83)]=_0x280e38[++_0x57086d]??'';break;case'--force':_0x5b9e7d['force']=!![];break;case'--config':case'-c':_0x5b9e7d[_0x1fa251(0xce)]=_0x280e38[++_0x57086d]??_0x1fa251(0x92);break;default:if(!_0x5b9e7d[_0x1fa251(0x9a)])_0x5b9e7d[_0x1fa251(0x9a)]=_0x280e38[_0x57086d];else!_0x5b9e7d['value']&&(_0x5b9e7d[_0x1fa251(0xa7)]=_0x280e38[_0x57086d]);break;}}return _0x5b9e7d;}function printUsage(){const _0x5edd01=_0x2842e1;console[_0x5edd01(0xdc)]('\x0aUsage:\x20autotest-config\x20<command>\x20[options]\x0a\x0aCommands:\x0a\x20init\x20Create\x20a\x20default\x20config.yaml\x20template\x0a\x20init-app-config\x20Create\x20an\x20example\x20app_config.json\x20for\x20MCP\x20bundle\x20name\x20mapping\x0a\x20get\x20Get\x20a\x20config\x20value\x20by\x20dot-notation\x20key\x0a\x20set\x20Set\x20a\x20config\x20value\x20by\x20dot-notation\x20key\x0a\x20list\x20List\x20all\x20config\x20key-value\x20pairs\x0a\x0aOptions:\x0a\x20-o,\x20--output\x20<path>\x20Output\x20file\x20path\x20(for\x20init/init-app-config)\x0a\x20--force\x20Overwrite\x20existing\x20file\x0a\x20-c,\x20--config\x20<path>\x20Config\x20file\x20path\x20(for\x20get/set/list,\x20default:\x20config.yaml)\x0a');}function main(){const _0x5f10ee=_0x2842e1,_0x27fcd4=process[_0x5f10ee(0xca)][_0x5f10ee(0xb1)](0x2),_0xdec8af=parseArgs(_0x27fcd4);if(!_0xdec8af['command'])return printUsage(),0x1;switch(_0xdec8af[_0x5f10ee(0xa5)]){case _0x5f10ee(0x94):return cmdInit({'output':_0xdec8af[_0x5f10ee(0x83)]||_0x5f10ee(0x92),'force':_0xdec8af[_0x5f10ee(0xd3)]});case _0x5f10ee(0x8b):return cmdInitAppConfig({'output':_0xdec8af[_0x5f10ee(0x83)]||_0x5f10ee(0xb5),'force':_0xdec8af[_0x5f10ee(0xd3)]});case _0x5f10ee(0xd9):if(!_0xdec8af[_0x5f10ee(0x9a)])return console[_0x5f10ee(0xa0)]('Usage:\x20autotest-config\x20get\x20<key>'),0x1;return cmdGet({'config':_0xdec8af['config'],'key':_0xdec8af[_0x5f10ee(0x9a)]});case _0x5f10ee(0xbc):if(!_0xdec8af[_0x5f10ee(0x9a)]||!_0xdec8af[_0x5f10ee(0xa7)])return console[_0x5f10ee(0xa0)](_0x5f10ee(0xab)),0x1;return cmdSet({'config':_0xdec8af['config'],'key':_0xdec8af[_0x5f10ee(0x9a)],'value':_0xdec8af[_0x5f10ee(0xa7)]});case _0x5f10ee(0xa1):return cmdList({'config':_0xdec8af[_0x5f10ee(0xce)]});default:console['error'](_0x5f10ee(0xc9)+_0xdec8af[_0x5f10ee(0xa5)]),printUsage();return 0x1;}}require['main']===module&&process[_0x2842e1(0x8c)](main());
|