@captain_z/zsk 1.8.3 → 1.8.5
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/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -1
- package/dist/commands/add-flow.d.ts +3 -7
- package/dist/commands/add-flow.js +7 -59
- package/dist/commands/add-flow.js.map +1 -1
- package/dist/commands/add.js +25 -104
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/check.js +14 -575
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/demo.d.ts +5 -0
- package/dist/commands/demo.js +70 -297
- package/dist/commands/demo.js.map +1 -1
- package/dist/commands/doctor.js +9 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/gate.d.ts +1 -0
- package/dist/commands/gate.js +8 -2
- package/dist/commands/gate.js.map +1 -1
- package/dist/commands/prepare.js +7 -1
- package/dist/commands/prepare.js.map +1 -1
- package/dist/commands/project-init.js +30 -8
- package/dist/commands/project-init.js.map +1 -1
- package/dist/core/config.d.ts +68 -0
- package/dist/core/config.js +198 -15
- package/dist/core/config.js.map +1 -1
- package/dist/core/demo-auth.d.ts +30 -0
- package/dist/core/demo-auth.js +213 -0
- package/dist/core/demo-auth.js.map +1 -0
- package/dist/core/demo-scenarios.d.ts +62 -0
- package/dist/core/demo-scenarios.js +276 -0
- package/dist/core/demo-scenarios.js.map +1 -0
- package/dist/core/demo-sources.d.ts +37 -0
- package/dist/core/demo-sources.js +198 -0
- package/dist/core/demo-sources.js.map +1 -0
- package/dist/core/mcp-registry-discovery.d.ts +16 -0
- package/dist/core/mcp-registry-discovery.js +187 -0
- package/dist/core/mcp-registry-discovery.js.map +1 -0
- package/dist/core/origin-detection.js +1 -1
- package/dist/core/origin-detection.js.map +1 -1
- package/dist/core/prepare-artifacts.d.ts +16 -0
- package/dist/core/prepare-artifacts.js +25 -0
- package/dist/core/prepare-artifacts.js.map +1 -0
- package/dist/core/prepare-auth-helper.d.ts +8 -0
- package/dist/core/prepare-auth-helper.js +32 -0
- package/dist/core/prepare-auth-helper.js.map +1 -0
- package/dist/core/prepare-materialization.d.ts +8 -0
- package/dist/core/prepare-materialization.js +26 -0
- package/dist/core/prepare-materialization.js.map +1 -0
- package/dist/core/prepare-migration.d.ts +6 -0
- package/dist/core/prepare-migration.js +57 -0
- package/dist/core/prepare-migration.js.map +1 -0
- package/dist/core/prepare-reporting.d.ts +5 -0
- package/dist/core/prepare-reporting.js +106 -0
- package/dist/core/prepare-reporting.js.map +1 -0
- package/dist/core/prepare-routing.d.ts +12 -0
- package/dist/core/prepare-routing.js +182 -0
- package/dist/core/prepare-routing.js.map +1 -0
- package/dist/core/prepare-sync.d.ts +13 -53
- package/dist/core/prepare-sync.js +878 -359
- package/dist/core/prepare-sync.js.map +1 -1
- package/dist/core/prepare-utils.d.ts +6 -0
- package/dist/core/prepare-utils.js +35 -0
- package/dist/core/prepare-utils.js.map +1 -0
- package/dist/core/profile-bundle-installation.d.ts +55 -0
- package/dist/core/profile-bundle-installation.js +170 -0
- package/dist/core/profile-bundle-installation.js.map +1 -0
- package/dist/core/provider-policy.d.ts +26 -0
- package/dist/core/provider-policy.js +180 -0
- package/dist/core/provider-policy.js.map +1 -0
- package/dist/core/provider-readiness.d.ts +39 -0
- package/dist/core/provider-readiness.js +78 -0
- package/dist/core/provider-readiness.js.map +1 -0
- package/dist/core/source-adapter-normalization.d.ts +31 -0
- package/dist/core/source-adapter-normalization.js +235 -0
- package/dist/core/source-adapter-normalization.js.map +1 -0
- package/dist/core/source-snapshot-adapters.d.ts +59 -0
- package/dist/core/source-snapshot-adapters.js +60 -0
- package/dist/core/source-snapshot-adapters.js.map +1 -0
- package/dist/core/staffing-plan.d.ts +1 -0
- package/dist/core/staffing-plan.js +113 -21
- package/dist/core/staffing-plan.js.map +1 -1
- package/dist/core/stage-clarity-verification.d.ts +31 -0
- package/dist/core/stage-clarity-verification.js +316 -0
- package/dist/core/stage-clarity-verification.js.map +1 -0
- package/dist/core/stage-output-quality.d.ts +3 -0
- package/dist/core/stage-output-quality.js +122 -0
- package/dist/core/stage-output-quality.js.map +1 -0
- package/dist/core/stage-quality-artifacts.d.ts +15 -0
- package/dist/core/stage-quality-artifacts.js +421 -0
- package/dist/core/stage-quality-artifacts.js.map +1 -0
- package/dist/core/stage-quality-contracts.d.ts +105 -0
- package/dist/core/stage-quality-contracts.js +2 -0
- package/dist/core/stage-quality-contracts.js.map +1 -0
- package/dist/core/stage-quality-criteria.d.ts +9 -0
- package/dist/core/stage-quality-criteria.js +286 -0
- package/dist/core/stage-quality-criteria.js.map +1 -0
- package/dist/core/stage-quality-rendering.d.ts +15 -0
- package/dist/core/stage-quality-rendering.js +240 -0
- package/dist/core/stage-quality-rendering.js.map +1 -0
- package/dist/core/stage-quality.d.ts +4 -59
- package/dist/core/stage-quality.js +54 -795
- package/dist/core/stage-quality.js.map +1 -1
- package/dist/core/template-registry.js +12 -15
- package/dist/core/template-registry.js.map +1 -1
- package/dist/core/workspace-conformance.d.ts +39 -0
- package/dist/core/workspace-conformance.js +603 -0
- package/dist/core/workspace-conformance.js.map +1 -0
- package/package.json +2 -2
- package/schemas/providers.schema.json +74 -0
- package/schemas/zsk-config.schema.json +417 -1
- package/templates/module/frontend-module/design.md +10 -0
- package/templates/module/frontend-module/proposal.md +8 -0
- package/templates/module/frontend-module/spec.md +7 -0
- package/templates/project-init/.zsk/README.md +48 -0
- package/templates/project-init/.zsk/config.yaml +37 -0
- package/templates/project-init/.zsk/docs/CONFIG-SCHEMA.md +127 -0
- package/templates/project-init/.zsk/docs/PROJECT-CONFIG.md +53 -5
- package/templates/project-init/.zsk/docs/README.md +10 -0
- package/templates/project-init/.zsk/docs/SECURITY.md +34 -0
- package/templates/project-init/.zsk/docs/SYSTEM-SPEC.md +39 -7
- package/templates/project-init/.zsk/evidence/README.md +15 -0
- package/templates/project-init/.zsk/issues/README.md +10 -0
- package/templates/project-init/.zsk/modules/README.md +19 -0
- package/templates/project-init/.zsk/modules/index.md +9 -5
- package/templates/project-init/.zsk/raws/README.md +34 -0
- package/templates/project-init/.zsk/roles.yaml +36 -105
- package/templates/project-init/.zsk/templates/config.examples.yaml +83 -0
- package/templates/project-init/.zsk/templates/issue-card.md +23 -0
- package/templates/project-init/.zsk/templates/module/README.md +13 -0
- package/templates/project-init/.zsk/templates/module/design.md +22 -0
- package/templates/project-init/.zsk/templates/module/module.yaml +15 -0
- package/templates/project-init/.zsk/templates/module/proposal.md +20 -0
- package/templates/project-init/.zsk/templates/module/spec.md +22 -0
- package/templates/project-init/.zsk/templates/module/tasks.md +16 -0
- package/templates/project-init/.zsk/raws/index.md +0 -18
- package/templates/project-init/.zsk/raws/manifest.json +0 -4
- package/templates/project-init/.zsk/raws/prepare/backend/index.md +0 -4
- package/templates/project-init/.zsk/raws/prepare/design/index.md +0 -3
- package/templates/project-init/.zsk/raws/prepare/index.md +0 -4
- package/templates/project-init/.zsk/raws/prepare/product/index.md +0 -4
- package/templates/project-init/.zsk/raws/prepare/qa/index.md +0 -4
- package/templates/project-init/.zsk/raws/prepare/ux/index.md +0 -3
package/dist/commands/config.js
CHANGED
|
@@ -106,7 +106,7 @@ export async function eject(part, opts = {}) {
|
|
|
106
106
|
for (const warning of result.warnings) {
|
|
107
107
|
console.warn(pc.yellow(`! ${warning.file}: ${warning.message}`));
|
|
108
108
|
}
|
|
109
|
-
const blockingIssues = result.issues.filter((issue) => !(parts.includes("roles") && issue.path === "/customize/roles"));
|
|
109
|
+
const blockingIssues = result.issues.filter((issue) => !(parts.includes("roles") && (issue.path === "/customize/roles" || issue.path === "/staffing/rolePool")));
|
|
110
110
|
if (blockingIssues.length > 0) {
|
|
111
111
|
console.error(pc.red("✗ zsk config eject stopped: config check failed"));
|
|
112
112
|
console.error(formatConfigIssues(blockingIssues));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],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AAC,CAAC;IAC7E,IAAI,UAAU,KAAK,OAAO,IAAI,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,WAAW,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAChH,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;AACxF,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAkD;IAC5E,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,aAAa,GAAG,MAAM,oBAAoB,EAAE,CAAC;QACnD,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IACrF,CAAC;IACD,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,mBAAmB,EAAE,CAAC;IACtD,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,oBAAoB,EAAE,CAAC;IACxD,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/commands/demo.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type McpConfigOptions = {
|
|
|
12
12
|
target?: string;
|
|
13
13
|
write?: boolean;
|
|
14
14
|
};
|
|
15
|
+
export type DemoAuthOptions = DemoOptions & {
|
|
16
|
+
url?: string;
|
|
17
|
+
out?: string;
|
|
18
|
+
};
|
|
15
19
|
export type DemoRunOptions = DemoOptions & {
|
|
16
20
|
optimized?: boolean;
|
|
17
21
|
playwright?: boolean;
|
|
@@ -30,3 +34,4 @@ export declare function scenarioRecord(opts?: DemoOptions): Promise<void>;
|
|
|
30
34
|
export declare function scenarioPromote(opts?: DemoOptions): Promise<void>;
|
|
31
35
|
export declare function scenarioGenerate(opts?: ScenarioGenerateOptions): Promise<void>;
|
|
32
36
|
export declare function mcpConfig(opts?: McpConfigOptions): Promise<void>;
|
|
37
|
+
export declare function auth(opts?: DemoAuthOptions): Promise<void>;
|
package/dist/commands/demo.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import pc from "picocolors";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
3
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
import { resolvePath } from "../core/targets.js";
|
|
6
6
|
import { checkProjectConfig, findModuleConfigFiles, readProjectConfig, } from "../core/config.js";
|
|
7
|
+
import { renderDemoLoginHelper, resolveDemoAuthConfig, validatePlaywrightAuthState, } from "../core/demo-auth.js";
|
|
8
|
+
import { collectDemoSourceBasis, summarizeText, testCasePathsFromModule, } from "../core/demo-sources.js";
|
|
9
|
+
import { escapeForDoubleQuotedString, inferScenarioName, parseRoleTargets, renderOptimizedSpec, slugify, synthesizeOptimizedDemoCases, synthesizePlaywrightSteps, } from "../core/demo-scenarios.js";
|
|
10
|
+
import { resolvePlaywrightAuthStatePath } from "../core/workspace-conformance.js";
|
|
7
11
|
import { getWorkspacePath, interpolateModulePath } from "../core/workspace-layout.js";
|
|
8
12
|
export async function start(opts = {}) {
|
|
9
13
|
const ctx = await prepare(opts);
|
|
@@ -85,7 +89,11 @@ export async function run(opts = {}) {
|
|
|
85
89
|
await persistSession(ctx, session);
|
|
86
90
|
console.log(pc.green(`✓ zsk demo run prepared (${mode})`));
|
|
87
91
|
if (mode === "optimized") {
|
|
88
|
-
console.log(pc.dim("optimized:
|
|
92
|
+
console.log(pc.dim("optimized: source-backed inputs -> test-plan.json -> Playwright spec; no MCP or bridge fallback."));
|
|
93
|
+
if (ctx.demoAuth.required && session.auth?.status === "missing") {
|
|
94
|
+
console.log(pc.yellow(`! demo auth state missing: ${session.auth.storageState}`));
|
|
95
|
+
console.log(pc.dim(` run once with ZSK_DEMO_LOGIN=1, or run zsk demo auth -m ${ctx.moduleId} and execute the generated helper; set automation.demo.auth.required=false only for public flows.`));
|
|
96
|
+
}
|
|
89
97
|
}
|
|
90
98
|
if (mode === "computer-use") {
|
|
91
99
|
console.log(pc.yellow("! Computer Use is the preferred visual/system observation lane when available; record fallback if the runtime does not provide it."));
|
|
@@ -228,6 +236,33 @@ export async function mcpConfig(opts = {}) {
|
|
|
228
236
|
}
|
|
229
237
|
console.log(content);
|
|
230
238
|
}
|
|
239
|
+
export async function auth(opts = {}) {
|
|
240
|
+
const ctx = await prepare(opts);
|
|
241
|
+
const moduleConfig = await readModuleConfig(ctx.target, ctx.moduleId);
|
|
242
|
+
let statePath;
|
|
243
|
+
try {
|
|
244
|
+
statePath = resolvePlaywrightAuthStatePath(ctx.target, ctx.config, opts.out ?? ctx.demoAuth.storageState);
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
console.error(pc.red("✗ zsk demo auth stopped: storageState must stay under module or shared Playwright .auth"));
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
const scriptPath = join(dirname(statePath), "login.mjs");
|
|
251
|
+
const loginUrl = opts.url ?? ctx.demoAuth.loginUrl ?? moduleConfig.runtime?.url ?? "";
|
|
252
|
+
const script = renderDemoLoginHelper({
|
|
253
|
+
loginUrl,
|
|
254
|
+
storageState: statePath,
|
|
255
|
+
envFiles: ctx.demoAuth.envFiles,
|
|
256
|
+
env: ctx.demoAuth.env,
|
|
257
|
+
selectors: ctx.demoAuth.selectors,
|
|
258
|
+
});
|
|
259
|
+
await mkdir(dirname(statePath), { recursive: true });
|
|
260
|
+
await writeFile(scriptPath, script, "utf8");
|
|
261
|
+
console.log(pc.green("✓ zsk demo auth helper written"));
|
|
262
|
+
console.log(pc.dim(`script: ${relative(ctx.target, scriptPath)}`));
|
|
263
|
+
console.log(pc.dim(`storageState: ${relative(ctx.target, statePath)}`));
|
|
264
|
+
console.log(pc.dim("Run the helper once after installing Playwright, then reuse the stored state in generated demo specs."));
|
|
265
|
+
}
|
|
231
266
|
async function updateExisting(opts, status, eventType, terminal = false) {
|
|
232
267
|
const ctx = await prepare(opts);
|
|
233
268
|
const session = await requireSession(ctx);
|
|
@@ -263,6 +298,7 @@ async function prepare(opts) {
|
|
|
263
298
|
const scenarioDir = interpolate(demoConfig?.scenarioDir ?? getWorkspacePath(config, "playwrightSpecs", { module: moduleId }), moduleId);
|
|
264
299
|
const bridgePlan = interpolate(demoConfig?.bridge?.planFile ?? getWorkspacePath(config, "bridgeOperationPlan", { module: moduleId }), moduleId);
|
|
265
300
|
const bridgeExecution = interpolate(demoConfig?.bridge?.executionFile ?? getWorkspacePath(config, "bridgeExecution", { module: moduleId }), moduleId);
|
|
301
|
+
const demoAuth = resolveDemoAuthConfig(config, moduleId);
|
|
266
302
|
const sessionRoot = resolve(target, getWorkspacePath(config, "playwrightExecution", { module: moduleId }));
|
|
267
303
|
await mkdir(sessionRoot, { recursive: true });
|
|
268
304
|
await mkdir(resolve(target, evidenceDir), { recursive: true });
|
|
@@ -277,7 +313,8 @@ async function prepare(opts) {
|
|
|
277
313
|
evidenceDirAbs: resolve(target, evidenceDir),
|
|
278
314
|
scenarioDir,
|
|
279
315
|
scenarioDirAbs: resolve(target, scenarioDir),
|
|
280
|
-
playwrightAuthState:
|
|
316
|
+
playwrightAuthState: demoAuth.storageState,
|
|
317
|
+
demoAuth,
|
|
281
318
|
defaultMode: normalizeMode(demoConfig?.defaultMode),
|
|
282
319
|
bridge: {
|
|
283
320
|
decisionTool: demoConfig?.bridge?.decisionTool ?? (demoConfig?.computerUse?.enabled ? "computer_use" : "playwright_mcp"),
|
|
@@ -364,13 +401,11 @@ async function ensureBridgeArtifacts(ctx, session) {
|
|
|
364
401
|
}
|
|
365
402
|
async function ensureOptimizedArtifacts(ctx, session) {
|
|
366
403
|
const moduleConfig = await readModuleConfig(ctx.target, ctx.moduleId);
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
console.error(pc.red("✗ optimized demo stopped: no raw testing inputs mapped"));
|
|
373
|
-
console.error(pc.dim("Add .zsk/raws/prepare/qa/testing cases to .zsk/modules/{module}/module.yaml tests.raw_cases or sources.testing."));
|
|
404
|
+
const sourceBasis = await collectDemoSourceBasis(ctx.target, ctx.config, ctx.moduleId, moduleConfig);
|
|
405
|
+
const rawInputs = testCasePathsFromModule(moduleConfig);
|
|
406
|
+
if (sourceBasis.length === 0) {
|
|
407
|
+
console.error(pc.red("✗ optimized demo stopped: no source-backed demo inputs mapped"));
|
|
408
|
+
console.error(pc.dim("Add module spec/design/tasks docs, .zsk/raws test cases, existing tests, or implementation paths to .zsk/modules/{module}/module.yaml."));
|
|
374
409
|
process.exit(1);
|
|
375
410
|
}
|
|
376
411
|
const testPlanRel = chooseTestPlanPath(moduleConfig, ctx.scenarioDir);
|
|
@@ -383,86 +418,12 @@ async function ensureOptimizedArtifacts(ctx, session) {
|
|
|
383
418
|
process.exit(1);
|
|
384
419
|
}
|
|
385
420
|
session.auth = authValidation;
|
|
386
|
-
const cases =
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
process.exit(1);
|
|
393
|
-
}
|
|
394
|
-
const title = inferScenarioName(content) ?? rawInput.split("/").pop()?.replace(/\.[^.]+$/, "") ?? "generated case";
|
|
395
|
-
const fillValue = inferFillValue(content);
|
|
396
|
-
const expectedText = inferExpectedText(content, fillValue);
|
|
397
|
-
const caseId = slugify(`${ctx.moduleId}-${title}`);
|
|
398
|
-
const steps = [
|
|
399
|
-
{
|
|
400
|
-
id: "step-1",
|
|
401
|
-
intent: "Open the demo entry page",
|
|
402
|
-
action: "goto",
|
|
403
|
-
target: "{{baseUrl}}",
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
id: "step-2",
|
|
407
|
-
intent: "Perform the primary user input from the raw test case",
|
|
408
|
-
action: "fill",
|
|
409
|
-
locator: {
|
|
410
|
-
strategy: "role",
|
|
411
|
-
role: "textbox",
|
|
412
|
-
},
|
|
413
|
-
value: fillValue,
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
id: "step-3",
|
|
417
|
-
intent: "Submit or advance the flow",
|
|
418
|
-
action: "click",
|
|
419
|
-
locator: {
|
|
420
|
-
strategy: "role",
|
|
421
|
-
role: "button",
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
id: "step-4",
|
|
426
|
-
intent: "Verify the expected visible result",
|
|
427
|
-
action: "assert",
|
|
428
|
-
locator: {
|
|
429
|
-
strategy: "text",
|
|
430
|
-
text: expectedText,
|
|
431
|
-
},
|
|
432
|
-
},
|
|
433
|
-
];
|
|
434
|
-
cases.push({
|
|
435
|
-
id: caseId,
|
|
436
|
-
title,
|
|
437
|
-
source: rawInput,
|
|
438
|
-
priority: "P0",
|
|
439
|
-
preconditions: [
|
|
440
|
-
"Raw test case is mapped in module.yaml.",
|
|
441
|
-
`If authentication is required, Playwright storageState is prepared under ${ctx.playwrightAuthState} and gitignored.`,
|
|
442
|
-
"Computer Use observation is preferred for visual/current-page refinement when available; otherwise use Playwright MCP/ARIA/CDP, manual evidence, or Browser Use only in runtimes that support it.",
|
|
443
|
-
],
|
|
444
|
-
uiObservationBoundary: {
|
|
445
|
-
role: "observation-only",
|
|
446
|
-
allowedOutput: "structured observation with URL, page title, visible targets, role/label hints, auth/session note, and privacy note",
|
|
447
|
-
prohibitedOutputs: ["test-plan.json", ".spec.ts"],
|
|
448
|
-
},
|
|
449
|
-
steps,
|
|
450
|
-
assertions: [
|
|
451
|
-
{
|
|
452
|
-
intent: "Expected result from raw test case is visible",
|
|
453
|
-
type: "visible",
|
|
454
|
-
locator: {
|
|
455
|
-
strategy: "text",
|
|
456
|
-
text: expectedText,
|
|
457
|
-
},
|
|
458
|
-
},
|
|
459
|
-
],
|
|
460
|
-
risks: [
|
|
461
|
-
"Generated locator names must be refined from Computer Use, Playwright MCP/ARIA/CDP, manual evidence, or supported Browser Use observation before promotion.",
|
|
462
|
-
"Do not fall back to Playwright MCP or the hybrid bridge in optimized mode.",
|
|
463
|
-
],
|
|
464
|
-
});
|
|
465
|
-
}
|
|
421
|
+
const cases = synthesizeOptimizedDemoCases({
|
|
422
|
+
moduleId: ctx.moduleId,
|
|
423
|
+
sourceBasis,
|
|
424
|
+
runtimeUrl: moduleConfig.runtime?.url,
|
|
425
|
+
playwrightAuthState: ctx.playwrightAuthState,
|
|
426
|
+
});
|
|
466
427
|
await writeJson(resolve(ctx.target, testPlanRel), {
|
|
467
428
|
version: 1,
|
|
468
429
|
mode: "optimized",
|
|
@@ -473,15 +434,31 @@ async function ensureOptimizedArtifacts(ctx, session) {
|
|
|
473
434
|
forbiddenSurfaces: ["playwright_mcp", "hybrid_bridge"],
|
|
474
435
|
sources: {
|
|
475
436
|
testing: rawInputs,
|
|
437
|
+
stageDocs: sourceBasis.filter((source) => source.kind === "stage-doc").map((source) => source.path),
|
|
438
|
+
raws: sourceBasis.filter((source) => source.kind === "raw").map((source) => source.path),
|
|
439
|
+
existingTests: sourceBasis.filter((source) => source.kind === "existing-test").map((source) => source.path),
|
|
440
|
+
implementation: sourceBasis.filter((source) => source.kind === "implementation").map((source) => source.path),
|
|
476
441
|
},
|
|
442
|
+
sourceBasis: sourceBasis.map((source) => ({
|
|
443
|
+
kind: source.kind,
|
|
444
|
+
path: source.path,
|
|
445
|
+
summary: summarizeText(source.content),
|
|
446
|
+
})),
|
|
477
447
|
auth: {
|
|
478
448
|
storageState: ctx.playwrightAuthState,
|
|
449
|
+
required: ctx.demoAuth.required,
|
|
450
|
+
loginUrl: ctx.demoAuth.loginUrl,
|
|
451
|
+
envFiles: ctx.demoAuth.envFiles,
|
|
452
|
+
envKeys: ctx.demoAuth.env,
|
|
453
|
+
selectors: ctx.demoAuth.selectors,
|
|
479
454
|
validation: authValidation,
|
|
480
455
|
gitignoreRequired: true,
|
|
481
456
|
runtimeEnv: "ZSK_PLAYWRIGHT_STORAGE_STATE",
|
|
482
457
|
note: authValidation.status === "valid"
|
|
483
458
|
? "Storage state was validated as a reusable Playwright login/session state. It may contain sensitive cookies/localStorage and must not be committed."
|
|
484
|
-
:
|
|
459
|
+
: ctx.demoAuth.required
|
|
460
|
+
? "No reusable storageState file was found. Generated specs fail fast by default; run once with ZSK_DEMO_LOGIN=1 or use zsk demo auth, and set automation.demo.auth.required=false only for public flows."
|
|
461
|
+
: "Auth is configured as not required; generated specs run without storageState unless ZSK_DEMO_AUTH overrides it.",
|
|
485
462
|
},
|
|
486
463
|
uiObservationHandoff: {
|
|
487
464
|
requiredBeforePromotion: true,
|
|
@@ -504,7 +481,7 @@ async function ensureOptimizedArtifacts(ctx, session) {
|
|
|
504
481
|
});
|
|
505
482
|
const specPath = resolve(ctx.target, specRel);
|
|
506
483
|
await mkdir(resolve(specPath, ".."), { recursive: true });
|
|
507
|
-
await writeFile(specPath, renderOptimizedSpec(ctx.moduleId, cases), "utf8");
|
|
484
|
+
await writeFile(specPath, renderOptimizedSpec(ctx.moduleId, ctx.demoAuth, cases), "utf8");
|
|
508
485
|
console.log(pc.dim(`test plan: ${testPlanRel}`));
|
|
509
486
|
console.log(pc.dim(`spec: ${specRel}`));
|
|
510
487
|
}
|
|
@@ -529,108 +506,6 @@ function chooseSpecPath(moduleConfig, scenarioDir, moduleId) {
|
|
|
529
506
|
return e2e;
|
|
530
507
|
return join(e2e ?? scenarioDir, `${moduleId}-generated.spec.ts`);
|
|
531
508
|
}
|
|
532
|
-
function renderOptimizedSpec(moduleId, cases) {
|
|
533
|
-
const lines = [
|
|
534
|
-
`import { test, expect } from "@playwright/test";`,
|
|
535
|
-
``,
|
|
536
|
-
`const storageState = process.env.ZSK_PLAYWRIGHT_STORAGE_STATE;`,
|
|
537
|
-
`if (storageState) test.use({ storageState });`,
|
|
538
|
-
``,
|
|
539
|
-
`test.describe("${escapeForDoubleQuotedString(moduleId)} optimized demo scenarios", () => {`,
|
|
540
|
-
];
|
|
541
|
-
for (const testCase of cases) {
|
|
542
|
-
const fill = testCase.steps.find((step) => step.action === "fill");
|
|
543
|
-
const click = testCase.steps.find((step) => step.action === "click");
|
|
544
|
-
const assertion = testCase.steps.find((step) => step.action === "assert");
|
|
545
|
-
lines.push(` test("${escapeForDoubleQuotedString(testCase.title)}", async ({ page }) => {`, ` const baseUrl = process.env.ZSK_DEMO_BASE_URL;`, ` if (!baseUrl) throw new Error("Set ZSK_DEMO_BASE_URL to run this scenario.");`, ` await page.goto(baseUrl);`, ``, ` // Source: ${escapeForLineComment(testCase.source)}`, ` // ZSK_GENERATED_REFINEMENT_REQUIRED: refine locator names from Computer Use, Playwright MCP/ARIA/CDP, manual evidence, or compatible Browser Use before promotion.`);
|
|
546
|
-
if (fill?.locator?.role && fill.value) {
|
|
547
|
-
lines.push(` await ${renderRoleLocator(fill.locator.role, fill.locator.name)}.fill(${quote(fill.value)});`);
|
|
548
|
-
}
|
|
549
|
-
if (click?.locator?.role) {
|
|
550
|
-
lines.push(` await ${renderRoleLocator(click.locator.role, click.locator.name)}.click();`);
|
|
551
|
-
}
|
|
552
|
-
if (assertion?.locator?.text) {
|
|
553
|
-
lines.push(` await expect(page.getByText(${quote(assertion.locator.text)})).toBeVisible();`);
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
lines.push(` await expect(page).toHaveURL(/.+/);`);
|
|
557
|
-
}
|
|
558
|
-
lines.push(` });`, ``);
|
|
559
|
-
}
|
|
560
|
-
lines.push(`});`, ``);
|
|
561
|
-
return lines.join("\n");
|
|
562
|
-
}
|
|
563
|
-
async function validatePlaywrightAuthState(target, storageState, validatedAt) {
|
|
564
|
-
const file = resolve(target, storageState);
|
|
565
|
-
let parsed;
|
|
566
|
-
try {
|
|
567
|
-
parsed = JSON.parse(await readFile(file, "utf8"));
|
|
568
|
-
}
|
|
569
|
-
catch (error) {
|
|
570
|
-
const code = typeof error === "object" && error !== null && "code" in error
|
|
571
|
-
? String(error.code)
|
|
572
|
-
: "";
|
|
573
|
-
if (code === "ENOENT") {
|
|
574
|
-
return {
|
|
575
|
-
storageState,
|
|
576
|
-
status: "missing",
|
|
577
|
-
validatedAt,
|
|
578
|
-
cookies: 0,
|
|
579
|
-
origins: 0,
|
|
580
|
-
message: "storageState file does not exist yet",
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
return {
|
|
584
|
-
storageState,
|
|
585
|
-
status: "invalid",
|
|
586
|
-
validatedAt,
|
|
587
|
-
cookies: 0,
|
|
588
|
-
origins: 0,
|
|
589
|
-
message: "storageState file is not valid JSON",
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
if (!isRecord(parsed)) {
|
|
593
|
-
return {
|
|
594
|
-
storageState,
|
|
595
|
-
status: "invalid",
|
|
596
|
-
validatedAt,
|
|
597
|
-
cookies: 0,
|
|
598
|
-
origins: 0,
|
|
599
|
-
message: "storageState JSON must be an object",
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
const cookies = Array.isArray(parsed.cookies) ? parsed.cookies.length : -1;
|
|
603
|
-
const origins = Array.isArray(parsed.origins) ? parsed.origins.length : -1;
|
|
604
|
-
if (cookies < 0 || origins < 0) {
|
|
605
|
-
return {
|
|
606
|
-
storageState,
|
|
607
|
-
status: "invalid",
|
|
608
|
-
validatedAt,
|
|
609
|
-
cookies: Math.max(cookies, 0),
|
|
610
|
-
origins: Math.max(origins, 0),
|
|
611
|
-
message: "storageState must include Playwright cookies and origins arrays",
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
if (cookies === 0 && origins === 0) {
|
|
615
|
-
return {
|
|
616
|
-
storageState,
|
|
617
|
-
status: "invalid",
|
|
618
|
-
validatedAt,
|
|
619
|
-
cookies,
|
|
620
|
-
origins,
|
|
621
|
-
message: "storageState contains no cookies or localStorage origins, so it cannot prove reusable login/session credentials",
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
return {
|
|
625
|
-
storageState,
|
|
626
|
-
status: "valid",
|
|
627
|
-
validatedAt,
|
|
628
|
-
cookies,
|
|
629
|
-
origins,
|
|
630
|
-
message: "storageState is parseable and contains reusable session material",
|
|
631
|
-
loginBypassEvidence: "Generated Playwright specs can reuse this state through ZSK_PLAYWRIGHT_STORAGE_STATE.",
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
509
|
async function updateWorkflowState(file, moduleId, session) {
|
|
635
510
|
let state = { version: 1, modules: {} };
|
|
636
511
|
try {
|
|
@@ -687,7 +562,7 @@ function mapWorkflowStatus(status) {
|
|
|
687
562
|
}
|
|
688
563
|
function automationNote(mode) {
|
|
689
564
|
if (mode === "optimized")
|
|
690
|
-
return "Generated test-plan.json and Playwright spec
|
|
565
|
+
return "Generated source-backed test-plan.json and Playwright spec with auth bootstrap.";
|
|
691
566
|
if (mode === "playwright")
|
|
692
567
|
return "Prepared Playwright demo run and scenario preservation paths.";
|
|
693
568
|
if (mode === "hybrid")
|
|
@@ -730,109 +605,7 @@ async function readOptional(file) {
|
|
|
730
605
|
return "";
|
|
731
606
|
}
|
|
732
607
|
}
|
|
733
|
-
function parseRoleTargets(snapshot) {
|
|
734
|
-
const targets = [];
|
|
735
|
-
const rolePattern = /(?:^|\n)\s*-\s*(button|link|textbox|checkbox|heading|combobox|radio|menuitem)\s+"([^"]+)"/gi;
|
|
736
|
-
for (const match of snapshot.matchAll(rolePattern)) {
|
|
737
|
-
const role = normalizeRole(match[1] ?? "");
|
|
738
|
-
const name = (match[2] ?? "").trim();
|
|
739
|
-
if (!role || !name)
|
|
740
|
-
continue;
|
|
741
|
-
targets.push({ role, name });
|
|
742
|
-
}
|
|
743
|
-
return targets;
|
|
744
|
-
}
|
|
745
|
-
function synthesizePlaywrightSteps(targets, testCase) {
|
|
746
|
-
const steps = [];
|
|
747
|
-
const textbox = targets.find((target) => target.role === "textbox");
|
|
748
|
-
const button = targets.find((target) => target.role === "button");
|
|
749
|
-
const link = targets.find((target) => target.role === "link");
|
|
750
|
-
const checkbox = targets.find((target) => target.role === "checkbox");
|
|
751
|
-
const heading = targets.find((target) => target.role === "heading");
|
|
752
|
-
const fillValue = inferFillValue(testCase);
|
|
753
|
-
steps.push(`// Generated from test case and structured aria/accessibility snapshot.`);
|
|
754
|
-
if (textbox) {
|
|
755
|
-
steps.push(`await page.getByRole("textbox", { name: ${quote(textbox.name)} }).fill(${quote(fillValue)});`);
|
|
756
|
-
}
|
|
757
|
-
if (checkbox && shouldCheck(testCase)) {
|
|
758
|
-
steps.push(`await page.getByRole("checkbox", { name: ${quote(checkbox.name)} }).check();`);
|
|
759
|
-
}
|
|
760
|
-
if (button) {
|
|
761
|
-
steps.push(`await page.getByRole("button", { name: ${quote(button.name)} }).click();`);
|
|
762
|
-
}
|
|
763
|
-
else if (link) {
|
|
764
|
-
steps.push(`await page.getByRole("link", { name: ${quote(link.name)} }).click();`);
|
|
765
|
-
}
|
|
766
|
-
if (heading) {
|
|
767
|
-
steps.push(`await expect(page.getByRole("heading", { name: ${quote(heading.name)} })).toBeVisible();`);
|
|
768
|
-
}
|
|
769
|
-
else if (textbox || button || link || checkbox) {
|
|
770
|
-
steps.push(`await expect(page).toHaveURL(/.+/);`);
|
|
771
|
-
}
|
|
772
|
-
else {
|
|
773
|
-
steps.push(`// Provide a Playwright accessibility snapshot to synthesize role-first locators.`);
|
|
774
|
-
steps.push(`await expect(page).toHaveURL(/.+/);`);
|
|
775
|
-
}
|
|
776
|
-
return steps;
|
|
777
|
-
}
|
|
778
|
-
function renderRoleLocator(role, name) {
|
|
779
|
-
if (name)
|
|
780
|
-
return `page.getByRole(${quote(role)}, { name: ${quote(name)} })`;
|
|
781
|
-
return `page.getByRole(${quote(role)}).first()`;
|
|
782
|
-
}
|
|
783
|
-
function normalizeRole(role) {
|
|
784
|
-
if (role === "textbox")
|
|
785
|
-
return "textbox";
|
|
786
|
-
return role.toLowerCase();
|
|
787
|
-
}
|
|
788
|
-
function inferFillValue(testCase) {
|
|
789
|
-
const quoted = testCase.match(/["“”']([^"“”']{2,80})["“”']/);
|
|
790
|
-
if (quoted?.[1])
|
|
791
|
-
return quoted[1];
|
|
792
|
-
const afterInput = testCase.match(/(?:输入|type|fill|enter)\s*[::]?\s*([^\n,,。]{2,80})/i);
|
|
793
|
-
if (afterInput?.[1])
|
|
794
|
-
return afterInput[1].trim();
|
|
795
|
-
return "demo value";
|
|
796
|
-
}
|
|
797
|
-
function shouldCheck(testCase) {
|
|
798
|
-
return /check|toggle|勾选|选中|切换/i.test(testCase);
|
|
799
|
-
}
|
|
800
|
-
function inferScenarioName(testCase) {
|
|
801
|
-
const heading = testCase.match(/^#\s+(.+)$/m);
|
|
802
|
-
if (heading?.[1])
|
|
803
|
-
return heading[1];
|
|
804
|
-
const title = testCase.match(/(?:title|标题|用例)[::]\s*(.+)/i);
|
|
805
|
-
if (title?.[1])
|
|
806
|
-
return title[1];
|
|
807
|
-
return null;
|
|
808
|
-
}
|
|
809
|
-
function slugify(value) {
|
|
810
|
-
const slug = value
|
|
811
|
-
.toLowerCase()
|
|
812
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
813
|
-
.replace(/^-+|-+$/g, "");
|
|
814
|
-
return slug || "generated-from-test-case";
|
|
815
|
-
}
|
|
816
|
-
function quote(value) {
|
|
817
|
-
return JSON.stringify(value);
|
|
818
|
-
}
|
|
819
|
-
function escapeForDoubleQuotedString(value) {
|
|
820
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
821
|
-
}
|
|
822
|
-
function escapeForLineComment(value) {
|
|
823
|
-
return value.replace(/\*\//g, "* /").replace(/\n/g, " ");
|
|
824
|
-
}
|
|
825
|
-
function inferExpectedText(testCase, fallback) {
|
|
826
|
-
const expected = testCase.match(/(?:expect|should see|visible|断言|期望|显示|可见)\s*[::]?\s*["“”']?([^"“”'\n。]{2,80})/i);
|
|
827
|
-
if (expected?.[1])
|
|
828
|
-
return expected[1].trim();
|
|
829
|
-
const quoted = [...testCase.matchAll(/["“”']([^"“”']{2,80})["“”']/g)].map((match) => match[1]).filter(Boolean);
|
|
830
|
-
return quoted.at(-1) ?? fallback;
|
|
831
|
-
}
|
|
832
608
|
function isModuleConfig(value) {
|
|
833
609
|
return typeof value === "object" && value !== null;
|
|
834
610
|
}
|
|
835
|
-
function isRecord(value) {
|
|
836
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
837
|
-
}
|
|
838
611
|
//# sourceMappingURL=demo.js.map
|