Skip to content

Rebrand to TerKix + PWA, Gemini API improvements, UI & storage refactor#8

Open
Huynhthuongg wants to merge 5 commits into
mainfrom
codex/review-and-update-project-setup-bwuljk
Open

Rebrand to TerKix + PWA, Gemini API improvements, UI & storage refactor#8
Huynhthuongg wants to merge 5 commits into
mainfrom
codex/review-and-update-project-setup-bwuljk

Conversation

@Huynhthuongg

@Huynhthuongg Huynhthuongg commented Jun 7, 2026

Copy link
Copy Markdown
Member

Motivation

  • Rebrand the app from RKix to TerKix and provide a production-ready developer PWA shell with offline caching and a polished brand asset set.
  • Harden server-side AI integration by making Gemini model selectable, adding input validation, and sanitizing/parsing AI JSON outputs.
  • Improve frontend UX for terminal-first workflows with persisted preferences, command history, PWA install flow, and safer localStorage helpers.

Description

  • Branding & PWA: rename product strings to TerKix, add public/terkix-logo.svg, manifest.webmanifest, sw.js service worker, register service worker in src/main.tsx, and update index.html/README.md/metadata.json and .env.example to include GEMINI_MODEL and PORT notes.
  • Server & Gemini: refactor server.ts to load env via dotenv, expose /api/health, add GEMINI_MODEL override, validate/normalize request payloads, un-fence and parse JSON outputs from Gemini, and use the configured model when calling @google/genai.
  • Frontend UX & persistence: major src/App.tsx enhancements including PWA install prompt handling, command history with up/down recall, thinking-mode trace, UI preference types and persistence, offline/online state handling, export snapshot feature, many UI copy/branding updates, and service worker registration.
  • Utilities & build: add src/utils/storage.ts helpers for robust read/write/legacy-key migration, update package.json/package-lock.json metadata and dev deps ordering, and wire Vite config/tailwind/react plugin entries.

Testing

  • Ran TypeScript validation with npm run typecheck to ensure typings and new storage utilities integrate properly (no type errors reported).
  • Executed a production build with npm run build to verify client bundling and server bundling succeed (build completed).
  • Performed a quick local smoke health check by requesting /api/health and verifying a JSON response that includes the configured geminiModel (responded as expected).

Codex Task


Summary by cubic

Rebranded the app to TerKix and shipped an installable PWA with offline shell caching. Hardened the Gemini command API, added persisted preferences/history, and delivered a compact mobile cockpit UI.

  • New Features

    • PWA shell: added public/manifest.webmanifest, public/sw.js, updated index.html meta/theme/Apple tags and icons, and registered the service worker only outside Vite dev; offline shell + install prompts.
    • Server-side Gemini: .env loading via dotenv, GEMINI_MODEL override (default gemini-2.5-flash), PORT support, /api/health, stricter request schema validation, and safer un-fencing/JSON parsing with @google/genai.
    • Terminal UX + storage: persisted UI preferences, command history with up/down recall, thinking-mode trace, online/offline state, workspace snapshot export, compact mobile cockpit/dashboard; new src/utils/storage.ts for robust read/write and legacy-key migration.
    • Rebrand & build: new public/terkix-logo.svg, copy/CSS refresh, updated README.md and metadata.json (adds microphone permission), package renamed to terkix-terminal-os (v1.0.5), and scripts updated (preview; lint runs typecheck).
  • Migration

    • Set env vars: GEMINI_API_KEY (required), optional GEMINI_MODEL and PORT.
    • After deploy, hard-reload or clear old service worker/cache to load the new PWA shell.
    • Commands: npm run build then npm start; dev via npm run dev; preview with npm run preview.

Written for commit 4771564. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
terkix Error Error Jun 8, 2026 2:21pm

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Bản cập nhật toàn diện để đổi tên thương hiệu từ RKix sang TerKix, bổ sung khả năng PWA với Service Worker, triển khai lớp lưu trữ được gõ kiểu, hỗ trợ cài đặt PWA và UI preferences, cải tiến điều hướng lịch sử lệnh, và tối ưu hóa tích hợp Gemini API.

Changes

TerKix Terminal OS — Cập nhật toàn diện với PWA, persistence, và tích hợp API

Layer / File(s) Tóm tắt
Siêu dữ liệu dự án và cấu hình môi trường
.env.example, package.json, metadata.json, index.html, README.md, vite.config.ts
Cập nhật danh tính dự án sang TerKix phiên bản 1.0.5, thêm biến GEMINI_MODELPORT, mở rộng requestFramePermissions với "microphone", cập nhật tiêu đề HTML, và cung cấp tài liệu hướng dẫn đầy đủ.
Cơ sở hạ tầng PWA: Manifest, Service Worker, và đăng ký
public/manifest.webmanifest, public/sw.js, src/main.tsx
Thêm Web App Manifest với metadata PWA và 2 shortcuts, triển khai Service Worker với chiến lược network-first và stale-while-revalidate, và có điều kiện đăng ký service worker để tránh xung đột dev server.
Tiện ích localStorage được gõ kiểu để lưu trữ
src/utils/storage.ts
Module mới cung cấp helper đọc/ghi được gõ kiểu với kiểm tra lỗi JSON, hỗ trợ di chuyển khóa cũ, và fallback an toàn khi trình duyệt không hỗ trợ.
Khởi tạo trạng thái App và lớp lưu trữ
src/App.tsx (lines 49–184, 532–586)
Chuyển đổi App.tsx sang dùng typed storage helpers cho projects, terminal lines, command history, và UI preferences; khởi tạo TerKixUiPreferences với kiểm tra loại và đồng bộ hóa trạng thái vào localStorage.
Xử lý PWA install prompt và quản lý UI preferences
src/App.tsx (lines 307–357, 2819–2824)
Thêm event listener cho beforeinstallpromptappinstalled, cung cấp handleInstallApp, tải và đồng bộ UI preferences (kích thước font, theme, bộ lọc CRT, sidebar), và theo dõi trạng thái online/offline.
Điều hướng lịch sử lệnh bằng phím bàn phím
src/App.tsx (lines 642–662, 712–715, 746–747, 3117–3137)
Triển khai recallCommandHistory để điều hướng với ArrowUp/ArrowDown, duy trì historyCursor, cập nhật input lệnh khi điều hướng, giới hạn 30 mục với loại trùng khi submit.
Thiết kế lại terminal command deck và điều khiển UI
src/App.tsx (lines 2838–2955)
Vẽ lại command deck với branding TerKix, thêm nút cài PWA, export snapshot, reset UI, hiển thị trạng thái online/offline, stats telemetry, info agent, và command history chips.
Tiện ích export snapshot workspace và reset UI
src/App.tsx (lines 1461–1513)
Thêm exportWorkspaceSnapshot để tạo JSON export của project hiện tại, command history, và UI preferences; thêm resetUiPreferences để khôi phục cấu hình UI mặc định.
Cập nhật branding và dữ liệu trong App component
src/App.tsx (lines 372–410, 804–876, 1276–1404, 1534–2592, 2997)
Cập nhật email liên hệ, phản hồi plugin, author commit, HTML simulator, prompt prefix, menu overlay, sidebar ID, footer label, status bar logo, và help command text từ RKix sang TerKix.
Tích hợp Gemini API máy chủ với xử lý file bình thường hóa
server.ts
Tải cấu hình môi trường sớm, thêm phân tích PORT và GEMINI_MODEL, triển khai normalizeFilesparseGeminiJson, refactor endpoint /api/gemini/command, mở rộng schema response yêu cầu trường language trong filesToCreate và trường log trong agentWorkflow, thêm tuyến SPA fallback, và bao gồm GEMINI_MODEL trong response health và startup log.
Cập nhật branding trong text component và dữ liệu
src/components/ContactsManager.tsx, src/components/DashboardOverview.tsx, src/components/PluginManager.tsx, src/components/TelemetryD3Chart.tsx, src/data/presets.ts
Cập nhật email domain (rkix.dev→terkix.dev), banner OS styling, description agent presets, kernel simulation text, command samples, comment reference, author preset names, compiled output text, và timeline labels.
Hiệu ứng CSS mới cho nhận dạng TerKix
src/index.css
Thêm 3 class CSS mới: .terkix-grid-bg với background grid gradient và mask fade, .terkix-command-deck với positioning và glow overlay, và .terkix-terminal-glass với glass morphism gradient layers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 In TerKix we now dwell, with PWA shell so grand,
Storage keepers keep our state across the digital land,
Service Workers guard offline, while Gemini speaks the command,
Branding fresh and bright—a terminal born anew, handcrafted and planned.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Tiêu đề rõ ràng tóm tắt ba thay đổi chính: rebrand sang TerKix, thêm PWA, và cải thiện Gemini API, phù hợp với nội dung của PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed Mô tả PR liên quan chặt chẽ đến các thay đổi trong pull request, chi tiết hóa động lực (rebrand sang TerKix, PWA, Gemini improvements), mô tả các phần thay đổi cụ thể (branding, server, frontend, utilities), và bao gồm kết quả kiểm thử.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/review-and-update-project-setup-bwuljk
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/review-and-update-project-setup-bwuljk
  • 🛠️ Aethon

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped Aethon/backend-api.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot

kilo-code-bot Bot commented Jun 7, 2026

Copy link
Copy Markdown

Kilo Code Review could not run — your account is out of credits.

Add credits or switch to a free model to enable reviews on this change.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f722412bb6

ℹ️ 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".

Comment thread package.json
Comment thread public/sw.js
Comment thread public/manifest.webmanifest
Comment thread public/manifest.webmanifest

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 20 files

You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread public/sw.js
Comment thread server.ts Outdated
Comment thread src/utils/storage.ts
Comment thread src/utils/storage.ts
Comment thread index.html

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@index.html`:
- Line 11: The apple-touch-icon link currently points to an SVG
(href="/terkix-logo.svg"), which may not work on older iOS versions; add a PNG
fallback by including a second link rel="apple-touch-icon" that points to a
180x180 PNG (e.g., "/terkix-logo-180.png") alongside or before the SVG link, and
keep the existing SVG reference for modern browsers so older iOS devices get the
PNG while newer ones can use the SVG.

In `@public/manifest.webmanifest`:
- Line 8: The manifest currently hard-locks orientation via the "orientation":
"portrait-primary" setting in public/manifest.webmanifest; remove or relax this
constraint by either deleting the "orientation" entry or replacing
"portrait-primary" with a more permissive value (e.g., "any" or allowing both
portrait/landscape) so tablets can use landscape modes when needed; update the
manifest key "orientation" accordingly and verify the change works on target
devices.
- Around line 20-35: The manifest defines shortcuts with ?section=terminal and
?section=files but the app doesn't read the query string; in src/App.tsx add a
useEffect on mount that reads window.location.search (or URLSearchParams) to
extract the "section" param, map "terminal"->"terminal" and "files"->"files"
(fallback to "terminal" for invalid/missing values) and call
setCurrentSection(mappedSection); ensure this logic runs once on mount and does
not override user navigation/state thereafter.

In `@public/sw.js`:
- Line 1: The CACHE_NAME constant is set to "terkix-shell-v2" which is confusing
for a first PWA release; change the value of CACHE_NAME in public/sw.js from
"terkix-shell-v2" to "terkix-shell-v1" (or another v1 identifier you choose) and
update any references that use CACHE_NAME (e.g., cache open/activate/cleanup
logic) so the service worker consistently uses the new version string; if you
intentionally had a prior v1 in testing, leave v2 and add a comment explaining
that decision.
- Around line 29-42: The staleWhileRevalidate function can resolve to undefined
when both the cache miss (cached is undefined) and the network fetch fails;
update staleWhileRevalidate to return a valid Response in that edge case by
falling back to a pre-cached SPA asset (e.g., index.html) or a known fallback
Response. Specifically, after computing cached and network (the promise chain
that uses .catch(() => cached)), ensure the function awaits the network promise
and if the result is still falsy, read the fallback Response from
caches.open(CACHE_NAME).then(c => c.match('/index.html')) (or your chosen
fallback key) and return that instead so staleWhileRevalidate never returns
undefined.
- Line 2: SHELL_ASSETS currently lists only a few static entries and won't
precache build-generated JS/CSS/font bundles; update the service worker
bootstrap (the file containing SHELL_ASSETS) to stop manually extending that
array and instead inject the real build assets at build time — use Workbox
injectManifest or read the asset-manifest produced by your bundler to generate
the precache list (include hashed JS/CSS bundles and any external fonts/CSS
referenced by index.html) and replace SHELL_ASSETS with that generated list so
cold-start offline works reliably.

In `@README.md`:
- Around line 17-18: Add an "engines" field to package.json to match the README
requirement (e.g., set "node": ">=22" and "npm": ">=10") so npm will warn on
incompatible runtimes; update or validate any existing package.json-related
metadata (scripts or CI checks) that may rely on Node version and ensure the
README and package.json remain consistent by reflecting the same minimum
versions.

In `@server.ts`:
- Around line 249-253: The catch block handling Gemini Command processing
currently returns error.message to the client; change it to return a generic
client-safe error payload (e.g. error: "An error occurred while processing your
command.", code: "GEMINI_PROCESSING_ERROR") while keeping the detailed
console.error("Gemini Command processing failed:", error) for server logs;
update the res.status(500).json call in the catch block (the error handling in
server.ts) to the generic message and code and remove direct exposure of
error.message from the response.

In `@src/App.tsx`:
- Around line 328-346: The handleInstallApp function lacks error handling around
the async PWA install calls: wrap the installPromptEvent.prompt() and awaiting
installPromptEvent.userChoice in a try-catch, handle rejected promises and user
cancellation by updating setPwaInstallState (e.g., "failed" or keep "ready"),
call setInstallPromptEvent(null) on finalization, and push a descriptive system
line to setTerminalLines with the error or cancellation outcome; use the
existing symbols installPromptEvent, setPwaInstallState, setInstallPromptEvent,
and setTerminalLines when implementing this change.
- Around line 152-157: The current validator passed to readJsonStorage for the
projects state only checks id and files and can allow corrupt/incomplete Project
objects; create a full type guard (e.g., isProject and isProjectArray) that
validates all required Project fields (id, name, description, createdAt, status,
activeBranch, branches as array, commitHistory as array, deployments as array,
files as array, etc. matching the Project type from types.ts) and use that guard
as the predicate argument to readJsonStorage when initializing projects; ensure
the guard is exported/located near types.ts so it can be reused and that the
initializer falls back to PRESET_PROJECTS when validation fails.

In `@src/main.tsx`:
- Around line 13-17: Thêm bắt lỗi khi đăng ký service worker: trong khối where
you call navigator.serviceWorker.register('/sw.js') (inside the
window.addEventListener('load', ...) and guarded by 'serviceWorker' in navigator
&& !isViteDevServer) xử lý promise trả về bằng then/catch hoặc async/await và
log lỗi rõ ràng (ví dụ console.error hoặc logger) bao gồm thông điệp ngữ cảnh
"Failed to register service worker" kèm chi tiết lỗi, để dễ debug khi đăng ký
navigator.serviceWorker.register thất bại.
- Line 12: Replace the manual cast of import.meta by adding Vite types and
handle SW registration errors: add a vite-env.d.ts or include "types":
["vite/client"] in tsconfig so import.meta.hot is recognized and remove the cast
around isViteDevServer (symbol: isViteDevServer / import.meta.hot), and update
the service worker registration call (symbol:
navigator.serviceWorker.register('/sw.js')) to attach a .catch that logs the
error (use existing logger or console.error) so registration failures are
surfaced.

In `@src/utils/storage.ts`:
- Around line 14-19: When migrating a value inside the legacyKeys loop in
src/utils/storage.ts, remove the old entry to avoid duplicate data: after
retrieving legacyValue and writing it to the new key with
window.localStorage.setItem(key, legacyValue), call
window.localStorage.removeItem(legacyKey) before returning legacyValue; this
change touches the legacyKeys iteration and uses legacyKey, key,
getItem/setItem/removeItem to locate and remove the migrated item.
- Around line 41-47: The code unsafely casts `parsed` (unknown) to `T` when
`validator` is undefined (see `validator`, `parsed`, and the `return parsed as
T` line); either make the validator required for non-primitive types or add
runtime safeguards/overloads: (1) require a `validator` parameter (or
throw/return `fallback`) whenever `T` could be complex, or (2) provide two
overloads—one without a validator limited to primitive types and one that
requires a runtime type guard—plus update JSDoc to state the caller
responsibility; implement one of these options and remove the unconditional
`return parsed as T` cast so parsed is only returned after validation or
explicit primitive-safe path.
- Around line 68-72: The function readNumberStorage currently uses
Number.parseInt so it drops fractional parts; replace the integer parse with a
floating-point parse (e.g., use Number.parseFloat(rawValue) or
parseFloat(rawValue)) and keep the Number.isFinite(parsed) check so non-numeric
values fall back to the provided fallback; update the implementation in
readNumberStorage (which calls readStringStorage) accordingly or alternatively
rename the function to readIntStorage if you intend to keep integer-only
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 29ef7e29-eab9-4cf8-9ab4-00bb11c4e42a

📥 Commits

Reviewing files that changed from the base of the PR and between e678bdf and f722412.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • public/terkix-logo.svg is excluded by !**/*.svg
📒 Files selected for processing (18)
  • .env.example
  • README.md
  • index.html
  • metadata.json
  • package.json
  • public/manifest.webmanifest
  • public/sw.js
  • server.ts
  • src/App.tsx
  • src/components/ContactsManager.tsx
  • src/components/DashboardOverview.tsx
  • src/components/PluginManager.tsx
  • src/components/TelemetryD3Chart.tsx
  • src/data/presets.ts
  • src/index.css
  • src/main.tsx
  • src/utils/storage.ts
  • vite.config.ts

Comment thread index.html
Comment thread public/manifest.webmanifest
Comment thread public/manifest.webmanifest
Comment thread public/sw.js
Comment thread public/sw.js
Comment thread src/main.tsx
Comment thread src/main.tsx
Comment thread src/utils/storage.ts
Comment thread src/utils/storage.ts
Comment thread src/utils/storage.ts
Huynhthuongg and others added 2 commits June 7, 2026 21:14
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Signed-off-by: Huỳnh Thương <252359928+Huynhthuongg@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5298720d17

ℹ️ 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".

Comment thread src/utils/storage.ts
@alwaysmeticulous

alwaysmeticulous Bot commented Jun 12, 2026

Copy link
Copy Markdown

Meticulous was unable to execute a test run for this PR because the most recent commit is associated with multiple PRs. To execute a test run, please try pushing up a new commit that is only associated with this PR.

Last updated for commit 4771564. This comment will update as new commits are pushed.

vercel Bot and others added 2 commits June 12, 2026 21:09
Generated by v0

[v0 Session](https://v0.app/chat/xVL4WU8pTgL)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Initialize the repository with a base project structure and
configuration to enable local development and deployment. Adds standard
configs and scripts so the project builds and runs out of the box.

<sup>Written for commit 9357c26.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/Huynhthuongg/Terkix/pull/19?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant