Repository navigation
Make the browser demo exercise the real app - #54
Conversation
The public demo needs to prove the actual product path rather than a browser-side rule table. This adds a local demo backend, a reusable web-demo translation service, browser calls to /api/translate, and a Docker Compose path with an Ollama sidecar for local-model testing. Constraint: Browser JavaScript must not receive provider keys or call paid/local model endpoints directly. Rejected: Keep a static substitution fallback | it hides provider failures and repeats the original launch-testing problem Rejected: Bake model weights into the app image | large, slow, and harder to update than a model sidecar plus persistent volume Confidence: high Scope-risk: moderate Directive: Do not reintroduce static translation fallback in docs/index.html; provider errors must stay visible. Tested: pnpm build; pnpm test; pnpm audit --audit-level low; node demo-server smoke for /api/status and /api/translate 503; docker compose --profile setup config; docker compose build demo; npm pack dry-run guard
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c7363c7ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const relative = pathname === "/" | ||
| ? "docs/index.html" | ||
| : pathname.replace(/^\/+/, ""); |
There was a problem hiding this comment.
Keep demo assets addressable when serving
/
Mapping / directly to docs/index.html makes the page load from the root directory, so its relative <script src="dialectos-engine.js"> resolves to /dialectos-engine.js and 404s (the file exists at /docs/dialectos-engine.js). In the current flow (http://127.0.0.1:8080 from the README), this leaves DIALECT_METADATA undefined and causes translation rendering to fail even when /api/translate succeeds.
Useful? React with 👍 / 👎.
| const absolute = path.resolve(rootDir, relative); | ||
| if (!absolute.startsWith(rootDir + path.sep) && absolute !== rootDir) { | ||
| return undefined; |
There was a problem hiding this comment.
Limit static file serving to intended demo files
The static resolver currently allows any path under the repository root, so requests like /package.json are served as-is (and any local dotfiles under the repo would be exposed too). Because this demo is documented for container/VPS use and can bind publicly, this creates an unintended data exposure surface; static serving should be restricted to the demo asset subtree (or an explicit allowlist).
Useful? React with 👍 / 👎.
Brings GitHub main level with Forgejo main (ef214e5), the canonical repo, so GitHub carries what v0.3.2 is cut from. - **Roast fixes:** dictionary accents and meaning-safe swaps (#50), accented words in the register, voseo, gender and grammar checks (#51), the file sandbox and patched dependencies (#52), honest claims and a pinned toolchain (#53), and adjective agreement, MCP vosotros parity, the real engine in the demo, and no more "first" claim (#55). - **Branding:** the Hermes plugin icon (#54). - **Release:** every version and install path moves to 0.3.2 (#56). - **Security:** the voseo quote regex CodeQL flagged on this PR now runs in linear time (#57). - **Pages:** `docs/CNAME` is removed. The site already serves from kyanitelabs.github.io/DialectOS/ without a redirect. After this merges, both mains have the same files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RXhEX6WJsRZUyGhsp5WgGe --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
/api/translateWhy
The landing page must be a real test surface. A static rule table cannot prove translation quality, provider behavior, or semantic dialect prompts. This makes the page exercise the full app path while keeping provider keys/server-side model endpoints out of browser JavaScript.
Verification
pnpm buildpnpm testpnpm audit --audit-level lowgit diff --checknode scripts/demo-server.mjssmoke:/api/statusreturns provider status and/api/translatereturns 503 when no provider is configureddocker compose --profile setup configdocker compose build demo