{"_id":"@azanir/lexb","name":"@azanir/lexb","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@azanir/lexb","version":"0.1.0","description":"Explore an authenticated page (or a scenario) into verified Playwright locators + a test-case draft.","type":"module","bin":{"lexb":"dist/cli.js"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","dev":"tsc -w -p tsconfig.json","prepare":"npm run build","lexb":"node dist/cli.js"},"peerDependencies":{"@playwright/test":">=1.49.0"},"devDependencies":{"typescript":"^5.6.0","@types/node":"^22.0.0"},"engines":{"node":">=18"},"keywords":["playwright","testing","e2e","test-generation","locators","explorer","ai"],"repository":{"type":"git","url":"git+https://github.com/AZANIR/lexb.git"},"homepage":"https://github.com/AZANIR/lexb#readme","bugs":{"url":"https://github.com/AZANIR/lexb/issues"},"license":"MIT","_id":"@azanir/lexb@0.1.0","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-9Mra6p9rwlx/o1QsF3RMPB9iQqOeN97Zfg8k1uHdPjSYKuTJ4eXmXO/xh22cpDu8Xh1vefM8yBWzcgGm1G9ICQ==","shasum":"836911d66eb9d79683a0a41946ba4bbd0bb26221","tarball":"https://registry.npmjs.org/@azanir/lexb/-/lexb-0.1.0.tgz","fileCount":31,"unpackedSize":56293,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEKaa4NBHREHrf3AO4S1AHpmPJfkGqHtLnsUvgRSrT+vAiEA5uY9HKHLUoxQf4/APbwBDhob8br/FTobahaSpQvDdos="}]},"_npmUser":{"name":"azanir","email":"eleoneks@gmail.com"},"directories":{},"maintainers":[{"name":"azanir","email":"eleoneks@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lexb_0.1.0_1780955095518_0.38767842735124214"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-08T21:44:55.357Z","0.1.0":"2026-06-08T21:44:55.649Z","modified":"2026-06-08T21:44:55.872Z"},"maintainers":[{"name":"azanir","email":"eleoneks@gmail.com"}],"description":"Explore an authenticated page (or a scenario) into verified Playwright locators + a test-case draft.","homepage":"https://github.com/AZANIR/lexb#readme","keywords":["playwright","testing","e2e","test-generation","locators","explorer","ai"],"repository":{"type":"git","url":"git+https://github.com/AZANIR/lexb.git"},"bugs":{"url":"https://github.com/AZANIR/lexb/issues"},"license":"MIT","readme":"# lexb\n\nExplore an authenticated page — or a step-by-step scenario — into **verified** Playwright locators and a\ntest-case draft. Uses the Playwright library directly (no `agent-browser` / `playwright-cli` / `jq` / `curl`).\n\nThe cheap LLM only ever sees locators that were proven to resolve to exactly one element (`count()===1`),\nso it can't hallucinate selectors.\n\n## Install\n\nIn a Playwright + TypeScript repo (peer: `@playwright/test` >= 1.49):\n```bash\nnpm i -D @azanir/lexb              # from npm  (CLI command stays `lexb`)\n# or git dependency:  npm i -D github:AZANIR/lexb\nnpm i -D @playwright/test          # peer (every PW+TS repo already has it)\n```\n\n## Commands\n\n```bash\nlexb <codename> <url>          # explore -> verified locators + test-case (+ --emit-spec)\nlexb scenario --file s.md      # guided test from a human step list\nlexb auth <loginUrl>           # capture storageState (+ session tokens)\n```\n\n### explore\n```bash\nlexb dashboard https://app/dashboard --state .auth/auth-state.json --emit-spec\n```\n→ `documents/reports/spike-dashboard/`: `screenshot.png`, `aria.snapshot.txt`, `console.json`,\n`errors.json`, `locators.md` (verified `getByRole`, count===1), `test-case.md` (LLM draft),\n`dashboard.spec.ts` (skeleton, with `--emit-spec`), `lexb.json`.\n\n### scenario\nWrite a step list (from a screenshot); lexb maps each step to a verified locator + action:\n```markdown\n# Scenario: Upload a CV enables conversion\nurl: https://app/dashboard\n## Steps\n1. Upload \"fixtures/cv.md\" into the \"File upload area\"\n2. Observe the \"Convert to PDF\" button\n## Expected\n- \"Convert to PDF\" becomes enabled\n```\n```bash\nlexb scenario --file scenario.md --name dashboard-upload --emit-spec\n```\nA step whose target isn't in the verified set becomes a `// TODO`, never an invented locator.\nStarter: [`templates/scenario.example.md`](templates/scenario.example.md).\n\n### auth (cookies + localStorage + session tokens)\n- `--state` — storageState (cookies + localStorage).\n- `--tokens` — optional `{ entries, savedAt }` injected into **sessionStorage**\n  (`--tokens-target localStorage` to switch) via `addInitScript`, before navigation. For apps whose\n  session tokens live in sessionStorage (which `storageState` doesn't capture).\n```bash\nlexb auth https://app/login --state .auth/auth-state.json --tokens .auth/auth-tokens.json\n```\n\n## Options / env\n\n| Flag | Env | Default |\n|---|---|---|\n| `--state` | `LEXB_STATE` | `.auth/auth-state.json` |\n| `--tokens` | `LEXB_TOKENS` | `.auth/auth-tokens.json` if present |\n| `--tokens-target` | `LEXB_TOKENS_TARGET` | `sessionStorage` |\n| `--model` | `LEXB_MODEL` | `openai/gpt-4o-mini` |\n| `--key` | `LEXB_KEY` | `.auth/openrouter.key` (OpenRouter key file) |\n| `--out` | `LEXB_OUT` | `documents/reports` |\n| `--emit-spec`, `--headed`, `--url`, `--name` | — | — |\n\nThe LLM \"brain\" uses OpenRouter — put your key in `.auth/openrouter.key` (gitignored).\n\n## Programmatic\n\n```ts\nimport { explore, generateTestCase } from '@azanir/lexb';\n\nconst r = await explore({ url, state: '.auth/auth-state.json' });\n// r.verified -> [{ role, name, count }]  (count===1 = good)\n```\n\n## Local dev\n\n```bash\nnpm install\nnpm run build      # -> dist/\nnode dist/cli.js --help\n```\n\n## License\nMIT\n","readmeFilename":"README.md","_rev":"1-b06b0221856b0d9a55f4f69c6b111d08"}