Commit Graph

2807 Commits

Author SHA1 Message Date
oyi77
2d601ea459 feat: CLI Integration Suite for issue #2016
- Add tool-detector.ts (6 CLI tools: claude, codex, opencode, cline, kilocode, continue)
- Add config-generator/ factory + 6 generators (JSON + YAML)
- Add doctor/checks.ts for CLI tool health checks
- Add log-streamer.ts for usage log streaming
- Add @omniroute/opencode-provider npm package
- Add 5 CLI commands: config, status, logs, update, provider
- Add 3 API routes: config, detect, apply
- Update bin/omniroute.mjs, bin/cli/index.mjs, package.json
- Update docs: SETUP_GUIDE.md, CLI-TOOLS.md
- All tests pass (4302/4326, 24 pre-existing failures unchanged)
2026-05-14 17:26:30 +07:00
diegosouzapw
bf83aa55de feat(antigravity): support custom Google Cloud project ID (#2227)
Co-authored-by: nickwizard <nickwizard@users.noreply.github.com>
2026-05-14 05:11:24 -03:00
diegosouzapw
22f2c033da test(modelSync,antigravity): align with post-merge route behavior
After merging PRs #2221 (ModelSync shared loopback readiness gate + IPv4 force)
and #2219 (Antigravity loadCodeAssist bootstrap + fetchAvailableModels fallback)
into release/v3.8.0, two test suites needed updates to match the new routing:

- tests/unit/model-sync-route.test.ts:
  * resetStorage() now calls __resetLoopbackReadinessForTests() so the
    module-level __loopbackReadyPromise cache does not leak between tests.
  * Every fetch mock now answers the /__readiness_probe__/ URL with 404 so
    the gate opens immediately (any HTTP response satisfies the probe).
  * Self-fetch target URL assertions updated from http://localhost/...
    to http://127.0.0.1:20128/... per PR #2221's IPv4-force.
- tests/unit/provider-models-route.test.ts:
  * The Antigravity discovery-retry test now treats loadCodeAssist calls as
    non-fatal failures so the discovery path is still exercised.
  * The expected discovery URL sequence is updated to the new
    fetchAvailableModels-first order introduced by PR #2219.
2026-05-14 00:40:18 -03:00
diegosouzapw
30130d6c2c fix(model): narrow ModelAliasValue with typed check before string ops
The local-aliases-precedence path used `typeof aliases[parsed.model] === "string"`
to guard string-only operations, but TypeScript does not narrow the variable
`directTarget` from that index-expression test — the variable retained the union
type ModelAliasValue (string | object), so `indexOf`/`slice` were typed as
property accesses on the object branch and the strict-core typecheck failed.

Refactors to capture `directTarget` first and run `typeof directTarget === "string"`
on the variable, which TS does narrow. No runtime semantics change — local-aliases
tests still pass.
2026-05-14 00:24:08 -03:00
Anton
44a04df4f6 fix(rateLimit): never .stop() during runtime reset, evict cache instead (#2218)
Integrated into release/v3.8.0
2026-05-14 00:21:16 -03:00
Anton
253f5e5904 fix(ModelSync): shared loopback readiness gate + IPv4 force (#2221)
Integrated into release/v3.8.0
2026-05-14 00:16:22 -03:00
Anton
e2b4c2b06e fix(antigravity): strip generationConfig.thinkingConfig for Claude models (#2217)
Integrated into release/v3.8.0
2026-05-14 00:15:40 -03:00
Anton
9ae31e7f05 fix(model): local aliases override cross-proxy provider inference (#2223)
Integrated into release/v3.8.0
2026-05-14 00:10:05 -03:00
Anton
bbdcb97a06 fix(antigravity): bootstrap project via loadCodeAssist + fetchAvailableModels fallback (#2219)
Integrated into release/v3.8.0
2026-05-14 00:09:26 -03:00
Anton
29b9f27919 fix(proxyFetch): retry once on undici dispatcher failure before native fallback (#2222)
Integrated into release/v3.8.0
2026-05-14 00:08:35 -03:00
Anton
46df8470a9 fix(requestLogger): exempt tools field from array truncation for full debug visibility (#2234)
Integrated into release/v3.8.0
2026-05-14 00:07:47 -03:00
diegosouzapw
8c4d726c7b Merge upstream/registry-per-model-specs-refresh: registry per-model specs refresh (gpt-5.5 cap, kimi-coding context)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	open-sse/config/providerRegistry.ts
#	src/shared/constants/modelSpecs.ts
2026-05-13 22:27:20 -03:00
diegosouzapw
81928cccc5 Merge upstream/cliproxyapi-anthropic-shape-fixes: Anthropic shape + Capy strip + mcp rewrite
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	open-sse/executors/cliproxyapi.ts
#	tests/unit/cliproxyapi-executor.test.ts
2026-05-13 22:19:02 -03:00
diegosouzapw
14884568a9 Merge upstream/responses-background-degrade: responses background → synchronous degrade
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 22:15:57 -03:00
diegosouzapw
788f8e1794 Merge upstream/executors-sanitize-reasoning-effort: sanitize reasoning_effort for non-supporting providers
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	tests/unit/base-executor-sanitize-effort.test.ts
2026-05-13 22:15:19 -03:00
diegosouzapw
6a0b19c535 Merge upstream/translator-claude-thinking-placeholder: thinking placeholder for Claude-shape upstreams
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	open-sse/translator/helpers/claudeHelper.ts
#	tests/unit/translator-claude-helper-thinking.test.ts
2026-05-13 22:13:13 -03:00
diegosouzapw
2eb4b1ac3b Merge follow-up-2100-useUpstream429BreakerHints: resilience 429 hints toggle
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	open-sse/services/accountFallback.ts
#	src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx
#	src/lib/resilience/settings.ts
#	src/shared/utils/classify429.ts
#	src/shared/utils/providerHints.ts
#	src/sse/handlers/chat.ts
#	src/sse/handlers/chatHelpers.ts
#	tests/unit/provider-hints.test.ts
#	tests/unit/resilience-settings-upstream429-breaker.test.ts
2026-05-13 22:06:57 -03:00
diegosouzapw
8b93dd5583 Merge feature/ollama-search-provider: Ollama Search web provider
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 21:52:58 -03:00
diegosouzapw
a249724777 Merge feat/devin-cli-windsurf-provider: Devin CLI + Windsurf provider + OAuth
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	src/shared/services/cliRuntime.ts
2026-05-13 21:52:20 -03:00
diegosouzapw
078f687592 Merge feat/combo-model-metadata-catalog: aggregate combo model metadata in catalog
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	CHANGELOG.md
#	scripts/scratch/check_usage.js
2026-05-13 21:50:42 -03:00
diegosouzapw
6f93d81e58 Merge prclean/resilience-model-cooldown: expose model cooldown list with manual re-enable
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	src/app/(dashboard)/dashboard/settings/components/ResilienceTab.tsx
2026-05-13 21:46:39 -03:00
diegosouzapw
e584fe9e33 Merge fix/combo-context-length-auto-calc: CustomModelEntry refactor
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	.issues/feat-batch-delete-provider-accounts.md
2026-05-13 21:44:46 -03:00
diegosouzapw
7d0e51a7a7 Merge fix/searxng-test-connection: allow optional-key providers to pass connection test
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

# Conflicts:
#	src/shared/constants/providers.ts
#	tests/unit/proxy-connection-test.test.ts
2026-05-13 21:43:52 -03:00
diegosouzapw
799959432b Merge bugfix/preserve-reasoning-content-tool-calls: preserve reasoning_content in tool_calls
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 21:41:58 -03:00
diegosouzapw
9fcc8648e9 Merge platform overhaul finalize (FASES 5-9)
Builds on the FASE 1-4 merges already on release/v3.8.0.

### FASE 5 — i18n docs pipeline (hash-based incremental)
- config/i18n.json canonical locale list (41 locales) + JSON schema
- scripts/i18n/run-translation.mjs (cx/gpt-5.4-mini via OMNIROUTE_TRANSLATION_*)
- scripts/i18n/check-translation-drift.mjs
- .i18n-state.json tracks SHA-256 source/target hashes
- Legacy scripts (i18n_autotranslate.py, generate-multilang.mjs) deprecated with banners
- Built-in .env auto-loader so npm scripts work standalone

### FASE 6 — i18n UI pipeline
- scripts/i18n/sync-ui-keys.mjs replicates en.json keys to 40 locales
- scripts/i18n/check-ui-keys-coverage.mjs (gate 80%)
- DocsI18n.tsx (cosmetic) removed — locale unified via next-intl
- [slug]/page.tsx serves locale-translated docs with English fallback

### FASE 7 — /src/app/docs sync
- Drift fixes: 179->177 providers, 13->14 strategies, 36->37 MCP tools
- YAML frontmatter on all 44 docs (title/version/lastUpdated)
- ApiExplorer consumes docs/reference/openapi.yaml (19 endpoints, dynamic)
- content.ts updated: 37 MCP tool groups, 7 deployment guides with internal hrefs

### FASE 8 — CI gates & hooks
- scripts/check/check-doc-links.mjs validates internal markdown refs
- Husky pre-commit extended (env-doc-sync strict, i18n advisories)
- ci.yml: 2 new jobs (docs-sync-strict, i18n-ui-coverage)

### FASE 9 — Sign-off
- 270 broken doc links rewritten (post-restructure relativization fix)
- .i18n-state.json drift in ARCHITECTURE.md re-translated
- CHANGELOG.md and RELEASE_CHECKLIST.md updated

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 21:21:43 -03:00
diegosouzapw
91b457a802 docs(release): add i18n / doc-links / env-doc checks to RELEASE_CHECKLIST
Wires the new platform-overhaul gates into the Detailed Checklist used by
the release-cut workflow:

  Documentation block:
    npm run check:docs-all   (umbrella over sync, counts, env-doc, deprecated, doc-links)
    npm run check:env-doc-sync   (code ↔ .env.example ↔ ENVIRONMENT.md parity)
    npm run check:doc-links   (no broken internal markdown refs)

  i18n block (replaces stale `scripts/i18n-check.mjs` mention):
    npm run i18n:check   (drift between source docs and .i18n-state.json)
    npm run i18n:check-ui-coverage   (every locale ≥ 80% UI key coverage)
    npm run i18n:sync-ui:dry   (0 missing keys across 40 locales)
    Note about running npm run i18n:run when source English docs change.

These are the same checks newly enforced by the docs-sync-strict and
i18n-ui-coverage CI jobs added in commit acf6b93d.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 20:00:22 -03:00
diegosouzapw
e022335b60 docs(release): update CHANGELOG with platform overhaul summary (FASES 1-9)
Adds an Unreleased entry summarizing the nine-phase platform overhaul that
ships in v3.8.x: scripts cleanup, .env audit, /docs subfolder restructure,
diagrams folder, hash-based docs translation pipeline, UI key sync,
/src/app/docs drift fixes + frontmatter + openapi feed, and the new CI
gates (env-doc-sync strict, doc-links, docs-sync-strict workflow,
i18n-ui-coverage workflow). Also records the Fixed entry for the 270
broken-link sweep.

No version bump — that is intentionally left for the release-cut workflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:59:35 -03:00
diegosouzapw
b23127e53c fix(i18n): refresh translation state hash for architecture/ARCHITECTURE.md
The FASE 7 frontmatter sync touched docs/architecture/ARCHITECTURE.md but
.i18n-state.json was not refreshed, so npm run i18n:check reported
source-changed drift on every subsequent run.

Resolution: re-ran the hash-based translator end-to-end (npm run i18n:run
-- --locale=pt-BR --files=docs/architecture/ARCHITECTURE.md) which:

  - retranslated the source through the production backend (14 chunks,
    75 KB pt-BR output);
  - persisted the new source/target SHA-256 pair in .i18n-state.json
    (target_hash now matches the regenerated translation);
  - left every other source/locale pair untouched.

After the run:
  npm run i18n:check → PASS - all sources and targets match recorded hashes.

The pre-commit i18n drift advisory will no longer warn for this file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:58:52 -03:00
diegosouzapw
52f29f2347 fix(docs): rewrite 270 broken internal markdown links after subfolder restructure
The FASE 3 /docs restructure moved files into 8 subfolders (architecture,
guides, reference, frameworks, routing, security, compression, ops) but left
several link categories with stale relative paths. The new check:doc-links
gate (FASE 8) surfaced these and produced this exhaustive fix sweep.

Categories repaired (counts before → after, total broken: 270 → 0):

  i18n-relative (241 → 0): docs in subfolders now reference translations
    under docs/i18n/<locale>/docs/<subfolder>/<FILE>.md (one extra "../"
    plus the docs/<subfolder>/ segment). Affects ARCHITECTURE, FEATURES,
    USER_GUIDE, TROUBLESHOOTING, UNINSTALL, VM_DEPLOYMENT_GUIDE,
    API_REFERENCE, and the I18N.md self-reference table.

  parent-relative (14 → 0): refs like ../CLAUDE.md, ../CONTRIBUTING.md,
    ../AGENTS.md, ../Tuto_Qdrant.md, ../open-sse/..., ../electron/...,
    ../src/... promoted from one to two parent hops (../ → ../../) to
    reach repo root from docs/<subfolder>/.

  screenshots (9 → 0): FEATURES.md PNG refs rewritten to ../screenshots/
    (assets live at docs/screenshots/ unchanged).

  missing-rfc (2 → 0): RFC-AUTO-ASSESSMENT.md was deleted earlier in the
    overhaul; replaced refs in EVALS.md with pointers to the live
    AUTO-COMBO.md scoring doc plus an in-prose mention of
    src/domain/assessment/.

  other (4 → 0): ENVIRONMENT.md → ../../.env.example,
    SETUP_GUIDE.md → ../../{open-sse/mcp-server,src/lib/a2a}/README.md,
    PROVIDER_REFERENCE.md → ../../src/shared/... and ../../open-sse/...,
    VM_DEPLOYMENT_GUIDE.md omnirouteCloud reference replaced with a
    pointer to in-repo TUNNELS_GUIDE.md (omnirouteCloud lives in a
    separate companion repo).

Validation:
  npm run check:doc-links → PASS (501 internal links, 0 broken)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:52:04 -03:00
diegosouzapw
acf6b93df2 ci: add docs-sync-strict + i18n-ui-coverage jobs to ci.yml
Adds two strict drift gates that mirror (and harden) the new pre-commit
advisories from FASE 8:

  - docs-sync-strict: runs `npm run check:docs-all` (docs version sync,
    counts, env-doc contract, deprecated versions, and the new internal
    doc-links checker) plus the i18n translation-drift check in strict
    mode.
  - i18n-ui-coverage: enforces ≥80% UI message coverage across every
    configured locale.

Both jobs slot in immediately after `lint`, reusing the existing
setup-node@v6 + cache pattern. They are also wired into ci-summary
(`needs` + dashboard table) so the dashboard surfaces their status.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:25:50 -03:00
diegosouzapw
3796fc0925 chore(husky): wire env-doc-sync + i18n drift advisories in pre-commit
Pre-commit now runs three additional drift checks beyond the existing
docs-sync + any-budget gates:

  1. check-env-doc-sync (strict) — blocks commits that drift the env
     contract across code, .env.example, and ENVIRONMENT.md.
  2. check-translation-drift --warn — advisory only; prints a hint when
     docs/i18n mirrors are stale so devs can run `npm run i18n:run`
     before pushing. CI enforces strict mode in the new gate.
  3. check-ui-keys-coverage --threshold=80 — pre-commit prints a hint
     when any locale dips below 80%, but does not block. CI enforces
     strict mode.

End-to-end pre-commit duration: ~28s on a clean tree (40 locales).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:22:17 -03:00
diegosouzapw
8aa2c9461a chore(scripts): encadear check:doc-links em check:docs-all
Expose `npm run check:doc-links` and add it to the end of `check:docs-all`
so the new internal-link gate runs alongside the other documentation
sync checks. Pre-existing broken links (272) will be tracked and fixed
under FASE 9; the CI strict gate added in this phase makes the debt
visible without blocking pre-commit (which still runs only check:docs-sync).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:19:46 -03:00
diegosouzapw
0ccc1f0d60 feat(check): add doc-links checker for internal markdown references
Adds scripts/check/check-doc-links.mjs that scans every docs/**/*.md
(excluding i18n mirrors, screenshots, exported diagrams, and superpowers
plans) and verifies that every internal markdown/HTML link resolves to a
file on disk. External URLs (http/https/mailto/tel), anchor-only links,
and fenced code blocks are ignored.

Supports --report (informational, exit 0), --json (machine-readable),
and --help. Default mode exits 1 when any broken link is found, so this
can be wired as a CI gate. Initial baseline reveals ~270 pre-existing
broken links carried over from prior reorgs (i18n relative paths,
removed RFC drafts, stale screenshot refs) that FASE 9 will clean up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:19:28 -03:00
diegosouzapw
9668b5fd34 refactor(docs-ui): update content.ts to reflect v3.8.0 (37 MCP tools, 7 deploy guides)
content.ts changes:
- DOCS_MCP_TOOL_GROUPS: 29 → 37 tools (added Compression group with 5 tools and
  1Proxy/Tunnels group with 3 tools); now matches docs/frameworks/MCP-SERVER.md
  totals (Routing 9 + Operations 11 + Cache 2 + Compression 5 + 1Proxy 3 +
  Memory 3 + Skills 4 = 37).
- DOCS_DEPLOYMENT_GUIDES: 1 (hardcoded GitHub URL to TERMUX_GUIDE) → 7 entries
  with internal /docs/<slug> hrefs (setup, electron, docker, vm, fly, pwa, termux).

i18n labels:
- Added 16 new keys to src/i18n/messages/en.json:
  - deploy{Setup,Electron,Docker,Vm,Fly,Pwa}Title + Text (12)
  - mcpTools{Compression,OneProxy}Title + Desc (4)
- Propagated to 40 locales via npm run i18n:sync-ui (+640 entries with
  __MISSING__: markers).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 19:13:46 -03:00
diegosouzapw
9638a88145 feat(docs-ui): generate openapi module from yaml + ApiExplorer consumes it
- scripts/docs/gen-openapi-module.mjs (new): build helper that loads
  docs/reference/openapi.yaml via js-yaml, flattens paths × methods, and
  emits src/app/docs/lib/openapi.generated.ts with strongly-typed
  OPENAPI_ENDPOINTS, OPENAPI_TAGS, OPENAPI_VERSION, OPENAPI_TITLE plus
  the OpenApiEndpoint interface (no `any`, deterministic ordering).
  By default it skips internal management paths (anything under /api/
  that isn't /api/v1/*) so the Api Explorer focuses on the OpenAI-
  compatible public surface — 19 endpoints for v3.8.0 (Chat, Messages,
  Responses, Embeddings, Images, Audio, Moderations, Rerank, Models,
  System). Add --include-management to emit all 121 paths if needed.
- src/app/docs/components/ApiExplorerClient.tsx: drop the 13-entry
  hardcoded API_ENDPOINTS array; the component now imports from
  @/app/docs/lib/openapi.generated. Tags come from the spec; the
  "Try It" form picks an example body keyed by full path (8 well-known
  bodies pre-seeded, everything else starts empty). The header pill
  now shows endpoint count + OpenAPI version, and an "auth" pill is
  rendered next to operations whose spec declares non-empty security.
- package.json: prebuild:docs now chains gen-openapi-module after the
  docs index generator so `next build` always sees a fresh module.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:57:12 -03:00
diegosouzapw
caa262a4c5 feat(docs): add YAML frontmatter to all docs (title/version/lastUpdated)
Every .md under docs/{architecture,guides,reference,frameworks,routing,
security,compression,ops,diagrams} plus docs/README.md now opens with:

  ---
  title: "<inferred from first H1>"
  version: 3.8.0
  lastUpdated: 2026-05-13
  ---

46 files updated (no docs were skipped — none had pre-existing
frontmatter). [slug]/page.tsx already reads frontmatter.version and
frontmatter.lastUpdated via gray-matter and renders a "v3.8.0" pill
plus a "Last updated" caption, so the UI picks these up automatically.

Helper: scripts/docs/add-frontmatter.mjs — idempotent (skips files that
already start with `---`), falls back to a humanized basename when no
leading H1 exists. Excludes docs/i18n/, docs/screenshots/,
docs/superpowers/, docs/diagrams/exported/. Re-runnable safely.

Also regenerated src/app/docs/lib/docs-auto-generated.ts: 44 docs across
8 sections (Architecture / Guides / Reference / Frameworks / Routing /
Security / Compression / Ops), which now includes the 14 docs that were
missing from the v3.7 sidebar (Cloud Agents, Guardrails, Memory, Skills,
Webhooks, Evals, Authz, Agent Protocols, Repository Map, Provider
Reference, Reasoning Replay, Stealth Guide, Tunnels Guide, Electron
Guide).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:46:05 -03:00
diegosouzapw
8a26128e93 fix(docs): correct provider/strategy/MCP-tools drift (179→177, 13→14)
- ARCHITECTURE.md and CODEBASE_DOCUMENTATION.md: 179 → 177 registered
  providers (canonical from src/shared/constants/providers.ts).
- FEATURES.md and en.json wizard step: 13 → 14 routing strategies; lists
  all 14 explicitly including reset-aware (the missing one).
- llm.txt root: combo strategy count corrected in 3 places (UI tree,
  dashboard summary, fallback semantics).
- MCP-SERVER.md: 37 tool count was already correct; added a "Related
  Frameworks (v3.8.0)" section pointing to Cloud Agents
  (docs/frameworks/CLOUD_AGENT.md) and Guardrails
  (docs/security/GUARDRAILS.md), both sibling frameworks intentionally
  outside the MCP tool catalog.
- scripts/i18n/sync-llm-mirrors.mjs (new): idempotent helper to push
  root llm.txt body into the 40 docs/i18n/<locale>/llm.txt mirrors
  while preserving each locale's heading + language bar prefix; ran
  it to refresh all 40 mirrors so `check:docs-sync` is green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:43:48 -03:00
diegosouzapw
5592b25243 feat(docs-ui): [slug]/page.tsx serves locale-translated docs with English fallback
Reads the current request locale via `getLocale()` from next-intl and
prefers a translated markdown copy under
`docs/i18n/<locale>/docs/<fileName>` when one exists. Falls back to
the English source otherwise, so locales with partial coverage stay
readable instead of 404ing.

Path resolution is hardened: every read is resolved against an
absolute docs root and verified to live inside it, so a stray
filename in the docs index cannot escape the directory.

This is the runtime counterpart to the DocsI18n removal: the locale
preference set by the shared LanguageSelector in the docs layout now
materially affects what content the page renders.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:02:16 -03:00
diegosouzapw
7b97b01fe6 refactor(docs-ui): drop DocsI18n.tsx, unify locale handling via next-intl
The cosmetic DocsI18n.tsx shim duplicated the locale catalog that
already lives in config/i18n.json and consumed it through a separate
client hook (useDocsLocale + a 10-entry hard-coded SECTION_LABELS
map). It only ever translated sidebar section titles — the docs
content itself was always English.

Now the /docs page uses the same `LanguageSelector` component as the
rest of the dashboard, backed by next-intl + config/i18n.json. The
locale cookie set there is consumed by the [slug] page server
component (next commit) to actually serve translated markdown.

Removed:
- src/app/docs/components/DocsI18n.tsx (203 lines)

Updated:
- src/app/docs/layout.tsx — swaps DocsLocaleSwitcher for the shared
  LanguageSelector
- tests/unit/docs-site-overhaul.test.ts — replaces the DocsI18n
  importability assertions with checks that (a) the shared next-intl
  config covers the same locales, (b) the global LanguageSelector
  is the new docs switcher, and (c) the DocsI18n module is gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:01:53 -03:00
diegosouzapw
fd65db99c8 chore(i18n-ui): backfill ~700 missing keys per locale with __MISSING__ markers
Ran `npm run i18n:sync-ui` against every non-English locale to
replicate the full key tree from `src/i18n/messages/en.json`. Missing
strings now show up as `__MISSING__:<english_value>` placeholders,
which:
- keep the catalogs the same shape as the source-of-truth, so a
  runtime `useTranslations('feature.x')` call no longer falls back
  to the English bundle for every drifted key;
- are visible to reviewers (and to the optional `--translate-markers`
  pass in sync-ui-keys.mjs) so the drift can be paid down
  incrementally.

Volume summary (40 locales):
- 25,234 placeholders inserted in total
- zh-CN closest to parity (+105)
- most European/Asian locales (+710)
- pt-BR slightly ahead (+589)
- bn/fa/gu/in/mr/sw/ta/te/ur (+445)

No existing translated strings were touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:53:48 -03:00
diegosouzapw
352b87bd30 feat(i18n-ui): add check-ui-keys-coverage.mjs (advisory gate)
New script `scripts/i18n/check-ui-keys-coverage.mjs` compares every
`src/i18n/messages/<locale>.json` against `en.json` and reports
per-locale coverage: missing keys, __MISSING__ placeholder counts,
and real translated coverage percentage.

Modes:
- default: fail with exit 1 if any locale falls below `--threshold`
  (default 80%)
- `--report`: print the same table but always exit 0 (informational)
- `--json`: machine-readable output for CI dashboards

Wired into `i18n:check-ui-coverage` npm script (added in the previous
commit). FASE 8 will decide whether to make this a pre-push gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:52:33 -03:00
diegosouzapw
31b1985c64 feat(i18n-ui): add sync-ui-keys.mjs for missing-key replication
New script `scripts/i18n/sync-ui-keys.mjs` replicates keys present in
`src/i18n/messages/en.json` into every other locale catalog, marking
missing strings with a `__MISSING__:<english_value>` sentinel so the
drift is auditable and recoverable.

The script also accepts `--translate-markers` to call the OmniRoute
translation backend (same env vars as run-translation.mjs) and replace
those placeholders with real translations. Bounded concurrency, fail-
fast on missing env vars, and a `--dry-run` mode mirror the existing
docs translation pipeline.

Adds the matching `i18n:sync-ui` / `i18n:sync-ui:dry` npm scripts and
`i18n:check-ui-coverage` (next commit) wiring placeholder so the JSON
files can be backfilled with `npm run i18n:sync-ui`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:52:12 -03:00
diegosouzapw
fb963154ea fix(i18n): auto-load .env in run-translation.mjs so npm scripts work standalone
Adds a tiny built-in dotenv loader at the top of run-translation.mjs that
parses the repo-root .env file into process.env (without pulling dotenv
as a dependency). Existing process.env values still take precedence, so
shell/CI overrides keep working.

Before: `npm run i18n:run` failed with "Missing required env var:
OMNIROUTE_TRANSLATION_API_URL" unless the operator exported the vars in
the current shell.

After: the npm scripts (i18n:run, i18n:run:dry) pick up .env automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:41:57 -03:00
diegosouzapw
55111efcb5 chore(docs): regenerate auto-generated docs navigation index
Refresh the generated docs metadata file to match the current docs
structure and serialization format after the recent documentation
reorganization.
2026-05-13 17:28:02 -03:00
diegosouzapw
399b9f8d9d docs(env): document docs translation pipeline env vars
Adds OMNIROUTE_TRANSLATION_API_URL, OMNIROUTE_TRANSLATION_API_KEY,
OMNIROUTE_TRANSLATION_MODEL, OMNIROUTE_TRANSLATION_TIMEOUT_MS, and
OMNIROUTE_TRANSLATION_CONCURRENCY to both .env.example (commented placeholders)
and docs/reference/ENVIRONMENT.md (new 'Docs translation pipeline' subsection).
Restores the env-doc-sync contract reported by the strict checker added in
FASE 2 — these vars are now referenced by scripts/i18n/run-translation.mjs
introduced in this branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:20:57 -03:00
diegosouzapw
ae3d73a2e7 docs(i18n): demonstrate translator with pt-BR backfill of CLAUDE.md + architecture/ARCHITECTURE.md
Updates docs/guides/I18N.md with a 'Translation pipeline (recommended)' section
documenting the npm run i18n:run / :check / :run:dry flow, required env vars,
state file semantics, and the legacy-script deprecation notice. The legacy
Quick-Reference row for the Python translator is replaced with the new npm
script entry.

Re-translates two sources end-to-end through the new pipeline:
  - CLAUDE.md (1 chunk, 23k chars)
  - docs/architecture/ARCHITECTURE.md (14 chunks, 74k chars, one timeout retry)

Both translations now have a fresh language bar regenerated from
config/i18n.json (41 locales), an H1 heading with the native language tag,
and prose translated into Brazilian Portuguese while preserving markdown
syntax, code blocks, command names, env var identifiers, and version
numbers verbatim.

.i18n-state.json records the SHA-256 hash for each source and target. A
second invocation with no source changes correctly reports
'work units: 0 (skipped up-to-date: 2 of 2)' and `npm run i18n:check`
exits 0 — confirming the hash-based incremental + drift detection paths
both work as designed.

  - Elapsed: ~10 min total at concurrency=4
  - Cost: ~75k chars output through the configured backend

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:17:27 -03:00
diegosouzapw
dfe9a3e288 chore(i18n): point src/i18n/config.ts to config/i18n.json and deprecate legacy scripts
src/i18n/config.ts is now a thin adapter that reads config/i18n.json
(canonical locale list) and exports the same shape — LOCALES, LANGUAGES,
RTL_LOCALES, DEFAULT_LOCALE, Locale type, LOCALE_COOKIE — that
LanguageSelector, layout.tsx, request.ts, and the rest of the codebase
already consume. No call-site changes were required. Adds
DOCS_TARGET_LOCALES and getLanguage() helpers for new code.

The legacy scripts now print a deprecation warning on stderr at startup:
  - scripts/i18n/i18n_autotranslate.py    (banner + module-level warn)
  - scripts/i18n/generate-multilang.mjs   (banner + console.warn)

They keep working for messages and readme modes (UI strings / root README
variants), which are still outside the new pipeline's scope. Both will be
removed in v3.10.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:57:35 -03:00
diegosouzapw
58b70de654 feat(i18n): add translation drift checker and npm scripts
Adds scripts/i18n/check-translation-drift.mjs — a deterministic CI gate that
verifies every source recorded in .i18n-state.json still hashes to the same
SHA-256 on disk and every produced translation target exists with its
recorded hash. No API calls.

Modes: --strict (default, exit 1 on any drift), --warn (exit 0 with report),
--json (machine-readable report).

Also adds three npm scripts:
- i18n:run         run the translator (incremental, hash-based)
- i18n:run:dry     preview what would happen (no API calls, no writes)
- i18n:check       drift checker (used in CI / pre-merge)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:55:27 -03:00
diegosouzapw
afeee02e4a feat(i18n): add hash-based incremental docs translator
Adds scripts/i18n/run-translation.mjs — the new docs translation pipeline.

Reads sources from CLAUDE.md, GEMINI.md, AGENTS.md, CONTRIBUTING.md, SECURITY.md,
CODE_OF_CONDUCT.md, README.md at the repo root, plus all .md files under
docs/<subfolder>/ (recursing one level). Writes targets to
docs/i18n/<locale>/<source-path>.

Behavior:
- SHA-256 hash per source + per target stored in .i18n-state.json
- Re-runs only retranslate sources whose hash changed (or whose target file
  is missing)
- Excludes docs/i18n/, docs/screenshots/, docs/superpowers/, docs/diagrams/,
  docs/reports/ subtrees + I18N.md and README.md filenames
- Backend reads OMNIROUTE_TRANSLATION_* env vars (URL, API key, model,
  timeout, concurrency); never logs the API key
- Chunks markdown on top-level ## headings before sending to the LLM
- Pre-formats translator output with Prettier so lint-staged commit hooks
  cannot mutate file content out from under the hash registry

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:54:19 -03:00
diegosouzapw
c86f60b1d3 feat(i18n): add config/i18n.json as canonical locale list
Adds config/i18n.json (41 locales) + JSON-Schema as the single source of
truth for the locale list, RTL set, and docs-translation policy. This file
is consumed by:

- The runtime UI config in src/i18n/config.ts (next commit).
- The docs translation pipeline (scripts/i18n/run-translation.mjs, added in
  a later commit).
- The drift checker (scripts/i18n/check-translation-drift.mjs).

Fields:
- default: source locale (en)
- rtl: locale codes rendered right-to-left
- uiOnly: locales shipped in UI but not target of docs translation
- docsExcluded: locales NOT receiving docs translations (source language)
- locales[]: code, label, name, native, english, flag

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:51:41 -03:00