@mizchi/vlmkit-generate 0.9.0 → 0.11.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.
- package/README.md +1 -1
- package/dist/cli.mjs +12 -0
- package/dist/generate.mjs +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ The optional second argument to `buildPlaywrightRuntimeGate` repeats the runtime
|
|
|
81
81
|
gate, which is useful for routing, filters, hydration, and other timing-sensitive
|
|
82
82
|
UI where a single run can miss a race.
|
|
83
83
|
|
|
84
|
-
When `provider` is omitted, vlmkit-generate uses `
|
|
84
|
+
When `provider` is omitted, vlmkit-generate uses `VLMKIT_LLM_PROVIDER` first, then
|
|
85
85
|
available API keys in this order: Anthropic, OpenRouter, Gemini. With no key
|
|
86
86
|
signals it falls back to OpenRouter.
|
|
87
87
|
|
package/dist/cli.mjs
CHANGED
|
@@ -169,6 +169,18 @@ if (isDirectRun()) runGenerateCli(process.argv.slice(2)).then((code) => {
|
|
|
169
169
|
console.error(error instanceof Error ? error.stack : error);
|
|
170
170
|
process.exitCode = 1;
|
|
171
171
|
});
|
|
172
|
+
/**
|
|
173
|
+
* Deliberately not `isCliEntry` from `@mizchi/vlmkit-core/plugin/cli-entry.ts`: this
|
|
174
|
+
* package does not depend on core, and a ten-line guard is not worth adding one to a
|
|
175
|
+
* published dependency graph. The semantics match — core's version realpaths both sides
|
|
176
|
+
* too, a change this spelling is what prompted — so the two cannot disagree about which
|
|
177
|
+
* module is the entry.
|
|
178
|
+
*
|
|
179
|
+
* The `realpathSync` is load-bearing, not defensive. npm installs this package's `bin`
|
|
180
|
+
* as a symlink, so `argv[1]` is `node_modules/.bin/vlmkit-generate` while `import.meta.url` is the
|
|
181
|
+
* real `dist/cli.mjs`; comparing resolved-but-not-realpathed paths returns false and the
|
|
182
|
+
* CLI silently does nothing.
|
|
183
|
+
*/
|
|
172
184
|
function isDirectRun() {
|
|
173
185
|
if (!process.argv[1]) return false;
|
|
174
186
|
try {
|
package/dist/generate.mjs
CHANGED
|
@@ -19,7 +19,7 @@ function buildGeneratePrompt(input) {
|
|
|
19
19
|
"- For live-region roles such as `status`, `alert`, and `log`, use `getByRole(\"status\")` and assert text separately; do not pass a `name` filter.",
|
|
20
20
|
"- Keep comments sparse. Do not narrate obvious Playwright actions; comment only non-obvious locator or determinism constraints.",
|
|
21
21
|
"- Every visual assertion must also have semantic assertions.",
|
|
22
|
-
requireScreenshots ? "- Include deterministic `toHaveScreenshot()` checks for the
|
|
22
|
+
requireScreenshots ? "- Include deterministic `toHaveScreenshot()` checks only for VRT states required by the plan and additional generation rules. Do not invent extra snapshots." : void 0,
|
|
23
23
|
input.locatorInventory ? formatLocatorInventory(input.locatorInventory) : void 0,
|
|
24
24
|
"",
|
|
25
25
|
input.rulesMarkdown?.trim() ? `Additional generation rules:\n${input.rulesMarkdown.trim()}` : void 0,
|
|
@@ -321,10 +321,10 @@ function normalizeMaxAttempts(value) {
|
|
|
321
321
|
return Math.max(1, Math.floor(value));
|
|
322
322
|
}
|
|
323
323
|
function resolveDefaultProvider(env) {
|
|
324
|
-
const fromEnv = env.
|
|
324
|
+
const fromEnv = env.VLMKIT_LLM_PROVIDER;
|
|
325
325
|
if (fromEnv) {
|
|
326
326
|
if (fromEnv === "anthropic" || fromEnv === "gemini" || fromEnv === "openrouter") return fromEnv;
|
|
327
|
-
throw new Error(`Invalid
|
|
327
|
+
throw new Error(`Invalid VLMKIT_LLM_PROVIDER: ${fromEnv}`);
|
|
328
328
|
}
|
|
329
329
|
if (env.ANTHROPIC_API_KEY) return "anthropic";
|
|
330
330
|
if (env.OPENROUTER_API_KEY) return "openrouter";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mizchi/vlmkit-generate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Generator contract for Playwright tests: turns a Markdown plan and generation rules into a Playwright spec source file.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "mizchi",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"typescript": "^6.0.2",
|
|
47
|
-
"@mizchi/vlmkit-ai": "0.
|
|
47
|
+
"@mizchi/vlmkit-ai": "0.11.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "pnpm --dir ../.. exec tsdown --config tsdown.packages.config.ts --filter @mizchi/vlmkit-generate",
|
|
51
|
-
"test": "
|
|
51
|
+
"test": "pnpm --dir ../.. exec vitest run packages/vlmkit-generate/src"
|
|
52
52
|
}
|
|
53
53
|
}
|