{"_id":"@caoergou/xp-scenario-tools","name":"@caoergou/xp-scenario-tools","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@caoergou/xp-scenario-tools","version":"0.1.0","description":"Authoring CLI and programmable validation for @caoergou/windows-xp scenarios and content packs","type":"module","bin":{"xp-scenario":"dist/cli.js"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./serve":{"types":"./dist/serve.d.ts","import":"./dist/serve.js"},"./package.json":"./package.json"},"scripts":{"build":"vite build --config vite.config.ts","dev":"jiti src/cli.ts","typecheck":"tsc --noEmit -p tsconfig.json"},"dependencies":{"ajv":"^8.20.0","esbuild":"^0.28.1","jiti":"^2.6.1","vite":"^8.1.5","ws":"^8.21.1"},"devDependencies":{"@types/ws":"^8.18.1","typescript":"^5.9.3","vite-plugin-dts":"^4.5.3"},"peerDependencies":{"@caoergou/windows-xp":"^0.4.0"},"peerDependenciesMeta":{"@caoergou/windows-xp":{"optional":true}},"engines":{"node":">=22.12.0"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/caoergou/windows-xp.git","directory":"tools/scenario-tools"},"homepage":"https://github.com/caoergou/windows-xp/tree/main/tools/scenario-tools","bugs":{"url":"https://github.com/caoergou/windows-xp/issues"},"keywords":["windows-xp","scenario","content-pack","authoring","validation","cli"],"_id":"@caoergou/xp-scenario-tools@0.1.0","_integrity":"sha512-Qf/x0eigq7QSulqhM/CjZSnzFLXa4zN0KQhtIqicknYwpjZli2TlceTYgcWiOhkv9tVtIrFODnDp1YxfUIhSxA==","_resolved":"/home/runner/work/windows-xp/windows-xp/release-artifacts/caoergou-xp-scenario-tools-0.1.0.tgz","_from":"file:release-artifacts/caoergou-xp-scenario-tools-0.1.0.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-Qf/x0eigq7QSulqhM/CjZSnzFLXa4zN0KQhtIqicknYwpjZli2TlceTYgcWiOhkv9tVtIrFODnDp1YxfUIhSxA==","shasum":"ed0042e28dedc2be17aee4be3fb414a977996bf2","tarball":"https://registry.npmjs.org/@caoergou/xp-scenario-tools/-/xp-scenario-tools-0.1.0.tgz","fileCount":11,"unpackedSize":420119,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAzuyukCqTrCpjcxiIhke+zC5TrsHexzIC1CFMgWOP5FAiBrcKLmHzidc71ZcYeM3F0hnWo4yVKoiistV7F1Lw3m4g=="}]},"_npmUser":{"name":"caoergou","email":"itsericsmail@gmail.com"},"directories":{},"maintainers":[{"name":"caoergou","email":"itsericsmail@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/xp-scenario-tools_0.1.0_1785303056033_0.04182913525427101"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-29T05:30:55.669Z","0.1.0":"2026-07-29T05:30:56.199Z","modified":"2026-07-29T05:30:56.503Z"},"maintainers":[{"name":"caoergou","email":"itsericsmail@gmail.com"}],"description":"Authoring CLI and programmable validation for @caoergou/windows-xp scenarios and content packs","homepage":"https://github.com/caoergou/windows-xp/tree/main/tools/scenario-tools","keywords":["windows-xp","scenario","content-pack","authoring","validation","cli"],"repository":{"type":"git","url":"git+https://github.com/caoergou/windows-xp.git","directory":"tools/scenario-tools"},"bugs":{"url":"https://github.com/caoergou/windows-xp/issues"},"license":"MIT","readme":"# @caoergou/xp-scenario-tools\n\nNode-only authoring tools for `@caoergou/windows-xp` scenarios and content packs. The package is deliberately separate from the browser engine.\n\nRequires Node.js 22.12 or newer.\n\n```bash\nnpx xp-scenario lint ./scenario.ts\nnpx xp-scenario solve ./scenario.ts\nnpx xp-scenario graph ./scenario.ts --format mermaid\nnpx xp-scenario pack ./content-pack --check\nnpx xp-scenario pack ./content-pack --format xpspack --compress brotli --out dist/story.xpspack\nnpx xp-scenario pack ./content-pack --format xpspack --compress brotli \\\n  --sign-key-env XP_SCENARIO_SIGNING_KEY --sign-key-id publisher-2026 \\\n  --out dist/story-signed.xpspack\nnpx xp-scenario migrate ./scenario.ts ./save.json --map-flag old=new --write\nnpx xp-scenario serve ./scenario.ts\n```\n\n`lint` and `pack` return a non-zero exit code for errors. Warnings remain visible but do not fail CI. `migrate` is diagnostic by default; it writes only when `--write` is explicit, and never guesses a rename. Use `--map-flag old=new` or `--map-trigger old=new` to describe intentional renames.\n\nThe versioned `.xpspack` distribution contract is specified in\n[`docs/XPSPACK-FORMAT.md`](../../docs/XPSPACK-FORMAT.md). `pack` keeps JSON as\nits default and can also emit deterministic ZIP-compatible archives with\n`--format xpspack` and `--compress none|gzip|brotli`. `--check` validates and\nmeasures either format without writing. The programmatic `readXpspack()` loader\nverifies the restricted ZIP profile, CRCs, manifest invariants, chunk and asset\nhashes, size limits, decompression, and the reconstructed ContentPack before\nreturning it. Local files declared in `ContentPack.assets` are stored as separate\nbinary-safe entries and restored as media-typed `data:` URLs. Ed25519 signing\nreads a PEM private key only from the named environment\nvariable; the key is never added to the manifest or result. `readXpspack()`\naccepts host-controlled `trustedSigningKeys` by key ID and can enforce\n`requireSignature`. Signature failures throw `XpspackError` with stable codes\nfor localization. The programmatic builder accepts additional chunk definitions;\nAES-256-GCM chunks always receive fresh random nonces and `readXpspack()` asks\nthe host-owned asynchronous `keyProvider` only when `loadChunk(id)` is called.\nRaw chapter keys are never returned or serialized. CLI-authored chunk boundaries\nand hosted per-file fetching remain follow-up work.\n\n`serve` starts the browser-based **Scenario Studio** plus a token-protected, loopback-only\nWebSocket control channel and preserves the interactive REPL for terminal-first\nauthors. Scenario Studio shows independent lint/solve/pack gates, the existing\ndependency graph, rehearsal controls, runtime state, typed event injection,\npersona modes, and shipping sizes around the live desktop preview. It supports\ndeterministic seek/step, event injection, flag/trigger inspection, file hot reload,\nand provider persona rehearsal. A failed reload leaves the last valid desktop\nusable and marks the preview stale. `chat --offline <buddy>` requires an authored fallback or\nscript; use `--provider-url <url>` to POST live chat requests to an author-owned\nendpoint. Use `--no-ui` for the legacy desktop-only browser surface, or `--no-open`\nto prevent browser launch in headless environments. The default is `--ui`.\nThe live desktop defaults to the `zh` culture required by QQ; pass\n`--language en` (or another registered culture id) when authoring another skin.\n\n## Writer loop: `midsummer-pack`\n\n1. Run `xp-scenario serve examples/midsummer-pack` and keep the source directory\n   open in your editor.\n2. Use **Problems** to keep lint, solve, and pack gates independently green.\n3. Select a node in **Map**, inspect its dependencies, and use **Seek here** when\n   the node maps to a named rehearsal beat.\n4. Step through **Timeline**, inject a schema-listed event in **Events**, and\n   inspect exact trigger conditions and recent events in **Inspector**.\n5. Open **Personas**, choose `xiaoyu`, and run **Offline** to verify the authored\n   fallback without sending provider credentials to the browser.\n6. Edit and save the pack. A valid draft reloads automatically; an invalid draft\n   appears in **Problems** while the preview remains on the visibly stale last\n   valid version.\n7. Check declared assets and byte budgets in **Shipping** before running\n   `npm run scenario:ci`.\n\nThe main package exports the pure command implementations and protocol parser.\nImport `startScenarioServer()` from `@caoergou/xp-scenario-tools/serve` only when\nembedding the Vite/WebSocket authoring server.\n","readmeFilename":"README.md","_rev":"1-859ff1dadbc4dfd1bd65eb8106b1ded4"}