PathOS is a personal ChoiceScript library for the web and iOS.
  • JavaScript 87.4%
  • Swift 6.9%
  • CSS 3.9%
  • HTML 1%
  • Python 0.4%
  • Other 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Xuanli Lin 24f6beeb94
All checks were successful
Sync main to GitHub / sync (push) Successful in 6s
added var editing inside the play
2026-11-01 17:10:12 -07:00
.forgejo/workflows change runner name 2026-10-17 00:17:20 -07:00
.github/workflows automate the cf pages uploads (for real) 2026-10-27 11:36:13 -07:00
docs checked the engine against the reference implementation and fixed some discrepancies 2026-11-01 16:07:56 -07:00
ios-native code cleanup 2026-10-27 15:44:32 -07:00
public added var editing inside the play 2026-11-01 17:10:12 -07:00
scripts fixed pwa not working sometimes 2026-11-01 15:22:21 -07:00
src added var editing inside the play 2026-11-01 17:10:12 -07:00
tests added var editing inside the play 2026-11-01 17:10:12 -07:00
.gitignore added gh actions workflow 2026-10-16 17:00:01 -07:00
codemagic.yaml code cleanup 2026-10-27 15:44:32 -07:00
package-lock.json first version 2026-10-16 15:29:41 -07:00
package.json added buncha settings 2026-10-27 13:12:06 -07:00
pnpm-lock.yaml optimized mobile layout, fixed image loading issues, and trial screen 2026-10-21 00:56:09 -07:00
README.md added var editing inside the play 2026-11-01 17:10:12 -07:00

PathOS

PathOS is a personal ChoiceScript library for the web and iOS. Import an APK or ZIP that contains a complete ChoiceScript web game, play it in a sandboxed frame, view and edit your saves, and keep older versions of a game when it gets an update.

The website and the iOS app share the same JavaScript importer, player, save model, and interface. The iOS app is a Capacitor 8.5.3 shell that adds exporting through the native share sheet. This repository doesn't include any commercial games or APK assets.

Run the website

npm run build
python3 -m http.server 8000 --directory dist

Open http://localhost:8000. For production, deploy dist/ to a stable HTTPS address. Package inspection and gameplay happen entirely on the device, so there's no upload server to run. See web deployment.

Drag one APK or ZIP onto the library to import it. A drop target appears only during a file drag, then opens the same review as Import APK or ZIP. Text/link drags are ignored. Return to the library and close any open dialog before dropping another game.

On GitHub, run Actions → Build web app → Run workflow to download the built website or deploy it to Cloudflare Pages. See GitHub Actions setup. The Codemagic workflow is also available.

Build the iOS app

On a Mac with Node.js 22+ and Xcode 26+:

npm run build
cd ios-native
npm ci
npm run sync
npm run verify
npm run open

In Xcode, choose your signing team and run the App scheme. The project targets iOS and iPadOS 15+. See iOS build and verification. This repository contains the source and an Xcode project, not a signed IPA, and the app hasn't been tested on a real device yet.

To build in the cloud, use Actions → Build iOS app → Run workflow on GitHub and choose an unsigned IPA, simulator app, or signed IPA. See GitHub Actions setup. The root codemagic.yaml also includes simulator and signed IPA workflows; see Codemagic setup.

Automatic nightly releases

The Publish nightly workflow checks the default branch daily at 2:17 a.m. Phoenix time (09:17 UTC). When a new commit is available, it builds the unsigned iOS IPA and website, then updates the nightly GitHub prerelease with both downloads and their checksums. Push the workflow to your GitHub default branch to activate the schedule, or run Actions → Publish nightly → Run workflow to publish immediately. See nightly setup and downloads.

Game updates

Each save belongs to a game in your library and remembers the exact version that created it. Import a newer APK into the same game, and all of its saves stay together. If the update is compatible, PathOS resumes from a migrated copy of your save. If the chapter you were in has changed, you can keep playing on the original version, or replay that chapter from its start if a checkpoint is available. Your original save is never modified.

These are structural checks, so they can't catch every change an author makes to the story's logic. See save compatibility for the exact rules and what's supported.

Open a game's Versions tab and choose Remove to free an imported version's package files. While another version remains, all saves stay in your library. Compatible saves can resume on a remaining version; reimport an incompatible save's original version to use it again. Removing the active version selects a remaining one. Removing the last version asks you to confirm deleting the game and all its saves together.

Debug choices

While playing, turn on Debug choices in the reader toolbar to inspect choice conditions, their true/false results, and the current variables they check. Hidden and disabled options appear with their conditions, including conditional branches and reuse restrictions. Options without conditions say No checks. Selection effects shows variable changes, random ranges, and readable descriptions of jumps/calls. Small integer rolls also show dependent changes and branch probabilities. Larger or continuous rolls stay as ranges; dependent values are labeled as random results.

Effects look ahead through passage jumps, text-only Next pages, and bundled chapter transitions, including the shared continuation after your current fake choice. Future fake choices with only text or display commands also continue automatically; menus with conditions, reuse restrictions, or state-changing bodies remain decision boundaries. Later chapters are labeled, and their temporary variables start fresh. Inputs, calls, scripts, unknown destinations, and missing chapters stop the preview. Loop and work limits keep long paths bounded, with a notice when a preview is partial.

Expand Script and context on an option to see its original source, line numbers, surrounding lines, and enclosing choice/conditions. The selected option is highlighted. Parsed effects omit the original commands and line numbers.

Use Choose for an available option or Force-select to bypass a hidden or disabled option's checks. Forcing selects its body with your current stats. Previewing uses copies of the game variables and does not draw random numbers.

The toggle updates the current choice controls without replaying the page or creating a save. It starts off when PathOS opens and keeps your preference for the current app session. The bundled demo includes hidden and disabled examples. Standard ChoiceScript choice menus are supported; unfamiliar syntax is reported, and conditions that cannot be evaluated show “unknown.”

Choose Variables in the reader toolbar or Tools while playing to search and edit persistent stats and current-scene variables. Numbers, text, and booleans keep their original types; engine bookkeeping and complex values stay out of the editor. Apply changes updates the current playthrough and refreshes choices and debug predictions. Cancel leaves values unchanged; Reload values replaces unapplied edits with current values. Close an in-game stats screen before applying changes.

Live edits follow your autosave setting and are included in manual snapshots and backups. Resuming applies them after the saved page’s story commands, so those commands do not overwrite your edits or apply a change twice. Existing saves remain unchanged, and continuing the story carries the edited values into subsequent pages. Text already displayed updates as you continue.

Backups

On phones and smaller tablets, Menu contains game/save import, backup export and restore, device storage, and Help. Import save also stays visible in the selected game's Saves tab. While playing, open Tools for save status, Variables, Save snapshot, and Debug choices. Save-row actions use larger tap targets in a two-column layout.

Export a compressed ZIP backup of your library to move games and saves between a browser and the iOS app. Backups store game files as compressed binary data and share identical files across versions. Individual save exports are compressed ZIP files too. Saves keep progress, chapter checkpoints, in-game save slots, and preferences without repeating chapter source or regenerable engine caches; existing stored saves are compacted when the app opens. PathOS keeps the 20 most recent automatic saves for each installed version by default; change the limit in Settings. Manual and edited saves are kept separately. Editing a save always creates a copy. You can also import raw ChoiceScript saves and save bundles from the DinoKnights editor by choosing the installed version they came from. The browser and the iOS app have separate storage, and this release has no cloud sync.

Autosaves record choices, character input, and changes to game state or in-game save slots. Plain “Next” continuations that only move through text do not add snapshots. Opening an existing save, viewing stats, or repeated engine cache writes also do not add duplicates. New snapshots include a short story preview; save rows show the scene, line position, and timestamp to the second.

Choose Select saves to select individual snapshots or Select all saves, then Delete selected. The confirmation lists the chosen snapshots before deleting them together. Saves from other games and installed game versions stay intact.

Settings

Open Settings from the library menu or the reader's Tools. Choose a light or dark theme, or follow the device. Reader controls set the font, font size, line spacing, and reading width inside imported games; changes apply without restarting the game. Use the game's original appearance restores its own styling. A reduced-motion option applies throughout PathOS and the reader.

The autosave limit is per game version, from 0 to 100. 0 turns off new autosaves, including on exit or backgrounding, while preserving existing snapshots. Manual Save snapshot remains available. Lowering a positive limit immediately trims older automatic snapshots; named and edited saves are retained. Enable Also autosave text-only Next pages to save those continuations as well as choices and state changes.

Settings persist in the library's browser or native storage and are included in full backups. A restored backup supplies settings to a new library; existing local settings take precedence when merging into a library that already has preferences.

Development

npm ci
npm run check
npm test
npm run build

The web build has no install-time dependencies. The ZIP reader is vendored in src/vendor/ along with its license. Test dependencies are development-only, and native dependencies are pinned separately under ios-native/.

ChoiceScript regression tests run against the upstream engine pinned in tests/fixtures/choicescript/, including its license and source revision. These checks run offline without private game packages. The fixture files are excluded from the built application.

Path Contents
src/importer.js APK/ZIP validation, metadata, assets, and scene indexing
src/runtime.js Sandboxed player, local assets, and ChoiceScript state hooks
src/storage.js Shared storage rules, browser IndexedDB and backup import/export
src/native-storage.js Native transaction adapter and automatic library migration
src/compatibility.js Update checks, save migration, copies, and checkpoints
src/app.js Shared library and editor interface
dist/ Deployable static website
ios-native/ Capacitor configuration, pinned dependencies, and Xcode project
tests/ Importer, state, migration, backup, and runtime checks

To try the app without a game of your own, choose Explore with a demo for a short original story. Not every APK will work: the package must contain a complete ChoiceScript web game, and the player can't run Android bytecode or native plugins.

APKs that force Android-app mode use their bundled engine's browser/offline fallbacks in PathOS. PathOS answers purchase checks locally for content included in the APK, so its bundled chapters remain available without Android billing. When a product has a chapter list, every chapter in that list must be present. Paid chapters load from the archive rather than the engine's online purchase cache. This also applies to existing APK imports and resumed saves; ZIP web exports retain their original purchase behavior.

Bundled artwork is embedded for the isolated player, including images created by story commands and referenced by stylesheets. External images that are not included in the APK remain unavailable offline. Local APK content availability does not transfer Android purchase receipts or execute native Android modifications. Billing and downloads of missing chapters remain unavailable inside PathOS.