Skip to content

The terminal moves into core/, shared with Prism (#15) - #18

Closed
Maxaubert wants to merge 8 commits into
fix/16-drop-types-pathfrom
feat/15-core
Closed

Maxaubert wants to merge 8 commits into
fix/16-drop-types-pathfrom
feat/15-core

Conversation

@Maxaubert

@Maxaubert Maxaubert commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Part of #15. Stacked on #17 (the drop fix): this PR's base is that branch, and GitHub retargets it to main when #17 merges.

What this is

The owner's decision (2026-09-19): Prism's terminal and Prism Terminal must stay in sync, and this repo is the core ("why can't this repo be the core?"). Everything that IS the terminal moves into core/, which Prism consumes. The first commits change no behaviour; the later ones apply the owner's decisions (below).

What moved into core/

  • main: terminal, shells, termPrompt, agentDetect, agentPoll, agentResume (the generic half: claudeSessions, validResume; this app's planRestore stays in src/).
  • renderer: TerminalPanel, TermFind, useAgentIndicator, agentTitle, agentClock, termActivity, termAnsi, termBus, termPaste, termPrefs, termLinks, termLinkPaint, termTheme, termLook, recentRoots.
  • shared: termCwd, the terminal's types, and a single table of IPC channel names.
  • The bridge to main, written once for both hosts: core/preload/api.ts (createTermApi) and core/main/ipc.ts (registerTermIpc). This app's preload and main now call them instead of carrying their own copies.

The host seam (core/renderer/host.ts)

Where the two apps legitimately differ, the core asks its host instead of forking: the default each untouched setting reads as, whether there is a host style to follow, who paints the ground, and which chords the app owns. Defaults are per host on purpose, so adopting the core never silently changes what an existing Prism user sees. This app's answers are in src/renderer/src/termHost.ts.

The core carries the superset

This app had DELETED capabilities only Prism uses (cdTerm, decideFollow, cdCommand, following the host's style). As the core, deleting them here would take them from Prism, so Prism's fuller versions are back, unused by this app. It also takes Prism's newer termPaste (a copied image FILE pastes as its path), which this app never got: exactly the drift this ends.

Guard rails

  • Lint wall on core/, proven to bite: no path aliases (a consumer resolves @shared against ITS OWN tree; measured, silently, no error), no window.prism (use termApi()), no host src/, no electron, no chromeTheme (inside Prism it would overwrite the app's styles).
  • Seam tests model both hosts and prove an untouched setting reads as its own host says.
  • core/README.md is the contract; CLAUDE.md's "copied, port by hand" paragraph, which the owner reversed, is replaced by it.

How Prism consumes it

core/ is published on its own as the core-dist branch (git subtree split --prefix=core), so the package is small, scriptless and carries no app files. Tagged core-v0.1.0-rc.1. Checked: npm fetches 29 files, 164 KB, tests excluded. Prism's first adoption step is Maxaubert/Prism (see the linked PR), where the full e2e passes on it.

The owner's decisions, applied here (2026-09-19)

  • The terminal's SETTINGS are the core's too (core/renderer/settings): same names, types and behaviour in both apps, values per app. settings/options.ts lists every option; a unit test ties the list to the sections, and each app's e2e (options here, termOptions in Prism) asserts its page shows that list.
  • The close question is one smart rule, not a setting (agentClose): a plain shell closes unasked, a tab hosting an agent asks, the window is held only while one is mid-answer. The on/off switch is gone.
  • Ctrl+W closes a tab (Ctrl+Shift+W still works), in both apps.
  • Host seam grew two declared fields: what an unpicked indicator colour resolves to, and what "acrylic" means as a terminal setting (Prism: the style owns the glass, no opacity slider).

How far Prism is

Three stacked drafts: Maxaubert/Prism#155 (identical files), #156 (panel, look stores, bridge), #157 (settings, indicator rules, close question, and the npm run e2e:terminal gate the owner asked for). Prism pins core-v0.1.0-rc.5; after this merges a real core-v0.1.0 is cut from main and Prism is repointed.

Verification

  • npm run typecheck: clean. npm run lint: 0 errors.
  • npm test: 369 pass.
  • npm run e2e: all 14 scenarios pass with the app running on the core.
  • Packaged and installed on this machine (exe timestamp polled until it moved), 2026-09-19 14:14.
  • Prism on this core: typecheck, lint, 1474 unit tests, its terminal gate and its full e2e all pass (see Sort terminal themes: neutrals black to white, then coloured themes #157).

🤖 Generated with Claude Code

Maxaubert and others added 2 commits September 19, 2026 10:10
… seam (#15)

Everything that IS the terminal now lives in core/ and is what Prism will
consume: pty, shells, prompt bootstrap, agent detection, poll and resume, the
panel, find, links, the indicator rules, the theme and look stores. The bridge
to main is written once for both hosts (core/preload/api, core/main/ipc, one
channel table). Where the two apps legitimately differ, the core asks its host
(core/renderer/host): per-host defaults, whether there is a host style to
follow, who paints the ground, which chords the app owns.

The core carries Prism's fuller versions where this app had deleted a
capability (cdTerm, decideFollow, cdCommand, follow-the-host-style) and Prism's
newer termPaste, so Prism loses nothing by adopting it. Relative imports only
inside core/, and it never reads window.prism.

No behaviour change here: 360 unit tests and all 13 e2e scenarios pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…act (#15)

core/ may not use a path alias, import a host's src/, import electron, read
window.prism or pull in the window chrome; the rule is proven to bite. The seam
tests model both hosts and prove an untouched setting reads as ITS host says, so
adopting the core changes nothing a Prism user sees. core/README.md is the
contract, and CLAUDE.md's "copied, port by hand" paragraph, which the owner has
reversed, is replaced with it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Imports are evaluated in order and before main.tsx's own body, so anything in
App's module graph that reads a terminal setting at import time has to find a
host already configured. Found while wiring Prism, whose theme.ts paints at
import time; the same shape here keeps the two hosts alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Maxaubert and others added 5 commits September 19, 2026 13:39
…tion move into the core (#15)

Owner, 2026-09-19: the two apps' terminal settings are the same settings ("the
setting names, types, how they function"), only the personal values differ. So
the settings UI is shared code now: core/renderer/settings holds the field
primitives, the appearance section and the shell and indicator rows, and this
app's Settings is just its page plus its own rows (1107 lines to about 220). A
list of every option by id is held to the sections by a unit test and to the
running app by the e2e.

Two new declared host differences: what an unpicked indicator colour resolves
to, and what "acrylic" means as a terminal setting (the window's own material
here; in Prism the style owns it, so no opacity slider there).

Also by owner decision, for both apps: the close question is one rule and no
longer a setting (a plain shell closes unasked, a tab hosting an agent asks),
and Ctrl+W closes a tab.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…to exit once (#15)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…its own (#15)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Maxaubert
Maxaubert deleted the branch fix/16-drop-types-path September 19, 2026 14:12
@Maxaubert Maxaubert closed this Sep 19, 2026
Maxaubert added a commit that referenced this pull request Sep 25, 2026
…ns, what is on disk (#67) (#68)

- Paste is sanitised: no ESC or control can end the bracketed paste (#1).
- Windows tools are started by full path; main leaves its launch folder (#3).
- Paths are quoted for the shell they go to; cd quoting is complete (#5, #7).
- The updater installs main's own offer only, pre-answers the close at the
  quit, hears a failed handoff and removes its temp folder (#14, #15, #19).
- tabs.json and window.json are written atomically (#18).
- Command-line paths resolve against the typing folder; a drive root works
  (#16, #17). The DWM helper's stdin errors are heard (#13).
- The review and the three-PR plan are in docs/.


Claude-Session: https://claude.ai/code/session_01LJbePcRzre7AusNzPNS2Bk

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Sep 25, 2026
…ns, what is on disk (#67) (#68)

- Paste is sanitised: no ESC or control can end the bracketed paste (#1).
- Windows tools are started by full path; main leaves its launch folder (#3).
- Paths are quoted for the shell they go to; cd quoting is complete (#5, #7).
- The updater installs main's own offer only, pre-answers the close at the
  quit, hears a failed handoff and removes its temp folder (#14, #15, #19).
- tabs.json and window.json are written atomically (#18).
- Command-line paths resolve against the typing folder; a drive root works
  (#16, #17). The DWM helper's stdin errors are heard (#13).
- The review and the three-PR plan are in docs/.


Claude-Session: https://claude.ai/code/session_01LJbePcRzre7AusNzPNS2Bk

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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