csspilot 0.3.0 → 0.3.2
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/LICENSE +21 -0
- package/dist/bin.js +9652 -9619
- package/dist/index.js +45 -13
- package/dist/skills/testpilot/workflows/run-case.md +1 -0
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -30183,7 +30183,17 @@ var configSchema = external_exports.strictObject({
|
|
|
30183
30183
|
cliPath: external_exports.string().min(1).optional()
|
|
30184
30184
|
}).optional()
|
|
30185
30185
|
});
|
|
30186
|
+
function interpolateEnvRefs(value) {
|
|
30187
|
+
return value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (match, name) => process.env[name] ?? match);
|
|
30188
|
+
}
|
|
30189
|
+
function loadProjectEnvFile(root = process.cwd()) {
|
|
30190
|
+
try {
|
|
30191
|
+
process.loadEnvFile(join3(root, ".env"));
|
|
30192
|
+
} catch {
|
|
30193
|
+
}
|
|
30194
|
+
}
|
|
30186
30195
|
async function loadTestpilotConfig(cwd = process.cwd()) {
|
|
30196
|
+
loadProjectEnvFile(cwd);
|
|
30187
30197
|
const file2 = join3(cwd, "testpilot.yaml");
|
|
30188
30198
|
let raw;
|
|
30189
30199
|
try {
|
|
@@ -30199,19 +30209,41 @@ async function loadTestpilotConfig(cwd = process.cwd()) {
|
|
|
30199
30209
|
const detail = result.error.issues.map((issue2) => `${issue2.path.map(String).join(".")}: ${issue2.message}`).join("; ");
|
|
30200
30210
|
throw new Error(`testpilot.yaml \u914D\u7F6E\u4E0D\u5408\u6CD5:${detail}`);
|
|
30201
30211
|
}
|
|
30212
|
+
const parsed = result.data;
|
|
30213
|
+
const environment = parsed.environment ? Object.fromEntries(
|
|
30214
|
+
Object.entries(parsed.environment).map(([name, entry]) => {
|
|
30215
|
+
if (name === "default" || typeof entry === "string") {
|
|
30216
|
+
return [name, entry];
|
|
30217
|
+
}
|
|
30218
|
+
if (entry === void 0) {
|
|
30219
|
+
return [name, void 0];
|
|
30220
|
+
}
|
|
30221
|
+
return [
|
|
30222
|
+
name,
|
|
30223
|
+
{ baseUrl: entry.baseUrl === void 0 ? void 0 : interpolateEnvRefs(entry.baseUrl) }
|
|
30224
|
+
];
|
|
30225
|
+
})
|
|
30226
|
+
) : void 0;
|
|
30202
30227
|
return {
|
|
30203
|
-
version:
|
|
30228
|
+
version: parsed.version,
|
|
30204
30229
|
// 用例目录:旧字段 casesDir 优先,其次 test.caseDirectory,最后默认值
|
|
30205
|
-
casesDir:
|
|
30206
|
-
testDirectory:
|
|
30207
|
-
projectName:
|
|
30208
|
-
environment
|
|
30209
|
-
adapters:
|
|
30210
|
-
workspace:
|
|
30211
|
-
server:
|
|
30212
|
-
|
|
30213
|
-
|
|
30214
|
-
|
|
30230
|
+
casesDir: parsed.casesDir ?? parsed.test?.caseDirectory ?? DEFAULT_CASES_DIR,
|
|
30231
|
+
testDirectory: parsed.test?.directory,
|
|
30232
|
+
projectName: parsed.project?.name,
|
|
30233
|
+
environment,
|
|
30234
|
+
adapters: parsed.adapters,
|
|
30235
|
+
workspace: parsed.workspace,
|
|
30236
|
+
server: parsed.server ? {
|
|
30237
|
+
baseUrl: parsed.server.baseUrl === void 0 ? void 0 : interpolateEnvRefs(parsed.server.baseUrl)
|
|
30238
|
+
} : void 0,
|
|
30239
|
+
web: parsed.web ? {
|
|
30240
|
+
baseUrl: parsed.web.baseUrl === void 0 ? void 0 : interpolateEnvRefs(parsed.web.baseUrl)
|
|
30241
|
+
} : void 0,
|
|
30242
|
+
api: parsed.api ? {
|
|
30243
|
+
baseUrl: parsed.api.baseUrl === void 0 ? void 0 : interpolateEnvRefs(parsed.api.baseUrl),
|
|
30244
|
+
timeoutMs: parsed.api.timeoutMs
|
|
30245
|
+
} : void 0,
|
|
30246
|
+
miniapp: parsed.miniapp
|
|
30215
30247
|
};
|
|
30216
30248
|
}
|
|
30217
30249
|
|
|
@@ -32484,7 +32516,7 @@ async function exists4(path) {
|
|
|
32484
32516
|
function resolveSkillSourceDir() {
|
|
32485
32517
|
const fromEnv = process.env.TESTPILOT_SKILL_DIR;
|
|
32486
32518
|
if (fromEnv) return fromEnv;
|
|
32487
|
-
const bundled = fileURLToPath(new URL("
|
|
32519
|
+
const bundled = fileURLToPath(new URL("./skills/testpilot", import.meta.url));
|
|
32488
32520
|
if (existsSync7(bundled)) return bundled;
|
|
32489
32521
|
const inRepo = fileURLToPath(new URL("../../../../../skills/testpilot", import.meta.url));
|
|
32490
32522
|
return existsSync7(inRepo) ? inRepo : void 0;
|
|
@@ -32902,7 +32934,7 @@ function makeValidateCommand() {
|
|
|
32902
32934
|
}
|
|
32903
32935
|
|
|
32904
32936
|
// src/cli.ts
|
|
32905
|
-
var CLI_VERSION = "0.3.
|
|
32937
|
+
var CLI_VERSION = "0.3.2";
|
|
32906
32938
|
async function createCli() {
|
|
32907
32939
|
const program2 = new Command();
|
|
32908
32940
|
program2.name("csspilot").description("TestPilot \u2014 AI Native \u8DE8\u7AEF\u4E1A\u52A1\u6D4B\u8BD5\u57FA\u7840\u8BBE\u65BD CLI").version(CLI_VERSION).addCommand(makeInitCommand()).addCommand(makeValidateCommand()).addCommand(makeListCommand()).addCommand(makeRunCommand()).addCommand(makeReportCommand()).addCommand(makeSyncMetadataCommand()).addCommand(makeDoctorCommand()).addCommand(makeCiCommand());
|
|
@@ -16,4 +16,5 @@ CLI → Case Loader → DSL Validator → Execution Engine → Adapter(Playwrigh
|
|
|
16
16
|
|
|
17
17
|
- 只通过 testpilot CLI 执行测试,不要直接调用 playwright 或 wechat-devtools。
|
|
18
18
|
- 被测服务需先就绪(如业务后端、本地页面服务),`navigate` 的相对 url 基于 testpilot.yaml 的 `web.baseUrl` 解析。
|
|
19
|
+
- 环境变量来源:shell / CI secrets,或项目根目录 `.env` 文件(CLI 自动加载,真实环境变量优先);`.env` 含敏感信息,确认已加入 .gitignore。
|
|
19
20
|
- 运行产物写入 `.testpilot/artifacts/runs/<run-id>/`(screenshots / traces / logs)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "csspilot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "TestPilot — AI Native 跨端业务测试基础设施 CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "node build.mjs",
|
|
22
|
-
"dev": "tsx src/bin.ts",
|
|
23
|
-
"start": "tsx src/bin.ts",
|
|
24
|
-
"typecheck": "tsc --noEmit"
|
|
25
|
-
},
|
|
26
20
|
"dependencies": {
|
|
27
21
|
"miniprogram-automator": "^0.12.0",
|
|
28
22
|
"playwright": "^1.53.0"
|
|
29
23
|
},
|
|
30
24
|
"devDependencies": {
|
|
31
|
-
"@testpilot/core": "workspace:^",
|
|
32
|
-
"@testpilot/sdk": "workspace:^",
|
|
33
25
|
"@types/node": "^22.0.0",
|
|
34
26
|
"commander": "^12.0.0",
|
|
35
27
|
"esbuild": "^0.25.0",
|
|
36
28
|
"tsx": "^4.19.0",
|
|
37
|
-
"typescript": "^5.5.0"
|
|
29
|
+
"typescript": "^5.5.0",
|
|
30
|
+
"@testpilot/core": "^0.1.0",
|
|
31
|
+
"@testpilot/sdk": "^0.1.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "node build.mjs",
|
|
35
|
+
"dev": "tsx src/bin.ts",
|
|
36
|
+
"start": "tsx src/bin.ts",
|
|
37
|
+
"typecheck": "tsc --noEmit"
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|