Skip to content

feat: embed full rhwp-studio editor via Deno workspace - #9

Merged
amondnet merged 3 commits into
mainfrom
feat/embed-rhwp-studio
Jul 24, 2026
Merged

feat: embed full rhwp-studio editor via Deno workspace#9
amondnet merged 3 commits into
mainfrom
feat/embed-rhwp-studio

Conversation

@amondnet

@amondnet amondnet commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Restructures OpenHWP from a read-only SVG viewer into a thin native shell around the full upstream rhwp-studio editor (menus, toolbar, tables, formatting, undo, open/save) — the foundation for Phase 2 편집/저장 (edit/save). This mirrors golbin/hop's overlay approach, but targets deno desktop (CEF) instead of Tauri.

Key finding that makes this small: openhwp runs the studio in a normal http://127.0.0.1 CEF context, so it uses upstream's web WasmBridge + the File System Access API (showOpenFilePicker/showSaveFilePicker), which work in CEF as-is. So the unmodified upstream studio is already a working offline editor — zero source overrides needed in this phase.

What changed

  • Deno workspace — root deno.json with apps/desktop as the member.
  • apps/desktop — the deno-desktop shell: serves the built studio bundle over local HTTP, opens the window, installs a minimal native menu (Reload / DevTools). File/Edit stay with the studio — File System Access pickers need the transient user activation a native-menu → executeJs path can't carry.
  • apps/studio-host — builds the pristine upstream studio into dist/. vendor/rhwp-core is @rhwp/core@0.7.19 (the wasm-bindgen pkg/), supplied as the @wasm alias so the Rust/wasm-pack step is skipped (with PROVENANCE.json).
  • scripts/setup-rhwp.ts — materializes third_party/rhwp via a blob-filtered cone-sparse checkout (~80 MB, not the 1.1 GB monorepo), pinned in config/rhwp-studio-overrides.json.
  • scripts/build-studio.ts — supplies pkg/, disables the PWA service worker (guarded so a future upstream reformat fails loudly), drops sample docs, runs the upstream Vite build (--base=/), restores the tree.
  • run-openhwp driver + SKILL — rewritten to serve the studio bundle and gate on the editor booting (static shell + engine reaching ready, no page errors).

third_party/ and apps/studio-host/dist/ are gitignored; build them with deno task setup && deno task build:studio.

Verification

  • deno task check / deno lint / deno fmt --check — all pass.
  • run-openhwp driver — PASS: the embedded editor boots to ready in headless Chrome (#sb-message → `HWP 파일을 선택해주세요.`), full toolbar renders, no page errors.

Later phases (not this PR): native menu ↔ studio dispatcher overrides, branding, HWPX-save gating, deno desktop build installers + submodule-aware CI.

Related issue

N/A — Phase 1 of the edit/save restructure.

Checklist

  • PR title follows Conventional Commits
  • Tests added or updated, and the suite passes (deno test) — no deno test suite; the run-openhwp driver is the smoke test (verified: editor boots)
  • Lint/format pass (deno lint / deno fmt --check)
  • Documentation updated if behavior changed (SKILL.md, apps/studio-host/README.md)
  • No breaking change (pre-release app restructure; no published API)

Summary by cubic

Embeds the full upstream rhwp‑studio editor in a thin Deno desktop shell and adds tooling to build and run it offline. Also fixes CI and hardens the setup/build/driver so the editor reliably boots in both desktop and headless modes.

  • New Features

    • Embed unmodified rhwp-studio served by apps/desktop with a minimal native menu (Reload/DevTools); File/Edit remain in‑web for the File System Access API.
    • New workspace host: apps/desktop (shell) and apps/studio-host (builds studio dist/); vendored @rhwp/core@0.7.19 supplied as the @wasm alias to skip Rust.
    • Tooling: scripts/setup-rhwp.ts (sparse, pinned third_party/rhwp) and scripts/build-studio.ts (copies pkg/, disables PWA SW, runs Vite). Driver serves the studio bundle, waits for ready, and writes screenshots/studio.png.
  • Bug Fixes

    • CI runs deno task check and builds the studio (deno task setup && deno task build:studio) before the headless smoke test; adds Node for Vite.
    • Shell binds the UI server to 127.0.0.1 on an ephemeral port and preflights the studio bundle; fails fast with the build command if missing.
    • Driver binds to loopback, gates on the studio ready state and absence of page errors, and cleans up browser/server independently.
    • setup-rhwp.ts validates the manifest, fetches the pinned commit before re‑pinning, force‑checks out the pin, and reconciles sparse paths on every run. build-studio.ts runs npm install each build, narrows NotFound catches, and preserves the original build error on restore. Docs updated with Node/npm build requirement.

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

amondnet added 2 commits July 24, 2026 02:43
Restructure OpenHWP from a read-only SVG viewer into a thin native shell
around the full upstream rhwp-studio editor (menus, toolbar, tables,
formatting, undo, open/save), mirroring golbin/hop's overlay approach but
targeting deno-desktop (CEF) instead of Tauri.

- Deno workspace: root deno.json with apps/desktop as the member.
- apps/desktop: the deno-desktop shell — serves the built studio bundle
  over local HTTP, opens the window, installs a minimal native menu.
  File/Edit stay with the studio (File System Access needs the webview
  gesture a native menu can't carry).
- apps/studio-host: builds the pristine upstream studio into dist/.
  vendor/rhwp-core is @rhwp/core@0.7.19 (wasm-bindgen pkg/), supplied as
  the @wasm alias so the Rust/wasm-pack step is skipped.
- scripts/setup-rhwp.ts: materializes third_party/rhwp via a blob-filtered
  cone-sparse checkout (~80 MB, not the 1.1 GB monorepo), pinned in
  config/rhwp-studio-overrides.json.
- scripts/build-studio.ts: supplies pkg/, disables the PWA service worker,
  drops sample docs, runs the upstream Vite build (base=/), restores the
  tree.
- run-openhwp driver + SKILL rewritten to serve the studio bundle and gate
  on the editor booting (verified: boots to ready in headless Chrome).

third_party/ and apps/studio-host/dist/ are gitignored (built via
`deno task setup && deno task build:studio`). No source overrides yet — the
web File System Access bridge works in CEF as-is.
Iteration 1 of the review-fix loop on PR #9 surfaced a broken CI and
several robustness/correctness issues in the new tooling.

CI (was red on PR #9):
- ci.yml `check` ran `deno check main.ts` (root main.ts was deleted) →
  now `deno task check` (checks apps/desktop/main.ts via the workspace).
- ci.yml `smoke` ran the driver with no bundle (dist is gitignored) →
  now sets up Node, runs `deno task setup` + `deno task build:studio`
  first. Stale "serve src/ui" comment corrected.

Tooling robustness:
- setup-rhwp.ts: force-checkout the pin when re-pinning so a build-dirtied
  worktree can't block it, and reconcile sparse paths on every run; validate
  the manifest (non-empty repo/tag, 40-char commit SHA, non-empty
  sparsePaths) before feeding it to git.
- build-studio.ts: run `npm install` on every build (a re-pin no longer
  builds against stale node_modules); narrow the swallowed `Deno.remove`
  catches to NotFound; preserve the build error if config restore fails.
- setup-rhwp.ts / build-studio.ts: resolve ROOT via `import.meta.dirname`
  instead of `URL.pathname` (the latter percent-encodes spaces in the path).

Shell / driver:
- main.ts: bind the UI server to 127.0.0.1 on an ephemeral port
  (Deno.serve defaults to 0.0.0.0:8000) and preflight the studio bundle,
  failing with the build command instead of opening a blank window.
- driver.ts: bind to loopback; settle both cleanups independently so a
  browser.close() rejection can't mask a smoke failure or leak the port.

Docs: README.md / README.en.md / CONTRIBUTING.md described the removed
SVG-viewer layout ("no application code yet", `deno desktop main.ts`);
updated the status, build/run commands, and the Node prerequisite.

Verified: deno task check / lint / fmt --check pass; setup recovers a
dirty checkout; build:studio rebuilds a SW-free dist; the driver boots the
editor to ready in headless Chrome.
@amondnet
amondnet marked this pull request as ready for review July 24, 2026 01:41
@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown

Greptile Summary

Introduces a Deno workspace that embeds the upstream rhwp-studio editor.

  • Adds the desktop shell and local HTTP serving for the built studio bundle.
  • Adds pinned sparse-checkout setup and studio build tooling.
  • Updates CI, smoke testing, vendored WASM assets, and project documentation.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
scripts/setup-rhwp.ts Materializes and re-pins the sparse upstream checkout, including fetching the configured commit for existing clones.
scripts/build-studio.ts Prepares the upstream studio source, supplies the vendored WASM package, builds the bundle, and restores temporary mutations.
apps/desktop/main.ts Serves the generated studio bundle on loopback and hosts it in a minimally integrated desktop window.
.claude/skills/run-openhwp/driver.ts Replaces the viewer smoke test with a headless editor boot and readiness check.
.github/workflows/ci.yml Updates CI to check the workspace, build the studio, and execute the editor smoke test.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  M[upstream manifest] --> S[setup-rhwp sparse checkout]
  S --> B[build-studio]
  V[vendored rhwp core WASM] --> B
  B --> D[studio-host dist]
  D --> H[Deno desktop HTTP shell]
  H --> W[CEF editor window]
Loading

Reviews (2): Last reviewed commit: "fix(setup): fetch the pinned commit befo..." | Re-trigger Greptile

Comment thread scripts/setup-rhwp.ts
Greptile P1: the re-pin path force-checked-out the manifest commit without
fetching. The blob:none partial clone only holds history up to clone time, so
bumping the manifest to a newer upstream commit would fail ("commit not
available locally"). Fetch it (blobless) first; GitHub serves a tag-reachable
SHA directly, and an already-present commit fetches as a fast no-op.
@sonarqubecloud

Copy link
Copy Markdown

@amondnet
amondnet merged commit b73f1bd into main Jul 24, 2026
11 checks passed
@amondnet
amondnet deleted the feat/embed-rhwp-studio branch July 24, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant