Skip to content
Cap-goPublic

About

Forgr: build your own personal Tools by chatting. Capacitor + Capgo, ChatGPT sign-in.

Topics

Resources

Code of conduct

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

Forgr

Personal app builder for iOS and Android (Capacitor 8 + Capgo). Sign in with ChatGPT, describe an app, and the AI builds it on your phone. Each user owns their apps locally.

  • Sign in with ChatGPT (OAuth 2 + PKCE, plan usage scopes), same flow as Capgo Browser. Tokens in Keychain/Keystore.
  • Builder agent on the OpenAI Responses API with the user's plan token. Tools in the mapp namespace: list/read/create/write/edit apps, open app, read runtime logs, and bundled Capgo skills (src/skills/*.md).
  • Mini apps are single-file HTML documents stored with @capacitor/filesystem, run in a sandboxed iframe with window.mapp (storage, haptics, camera, location, notifications, share, clipboard, native HTTP, ai.chat). Every change is versioned, Undo restores the previous one.
  • Three-finger pinch inside any app opens the switcher: Home, Edit (floating chat), or another app. Spread to go back.
  • Home Screen widget (@capgo/capacitor-widget-kit): Settings → Quick Launch pins tools as buttons. The widget needs iOS 17 or later and is available on Android. Layouts are Open (one tap opens Forgr), Tiny, Regular and Big, on a small, medium or large widget.
  • Capgo live updates (@capgo/capacitor-updater, app app.capgo.mapp, channel production) ship shell updates OTA.

Develop

bun install
bun run dev        # web shell on Vite
bun test
bun run build && bunx cap sync

Ship

# OTA (JS/CSS only): shipped by the Capgo Release workflow (see Capgo CI below), never by hand.

# Native (TestFlight)
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
xcodebuild -project ios/App/App.xcodeproj -scheme App -configuration Release \
  -destination 'generic/platform=iOS' -archivePath /tmp/mapp.xcarchive archive -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath /tmp/mapp.xcarchive -exportOptionsPlist <upload plist> \
  -exportPath /tmp/mapp-export -allowProvisioningUpdates

Use the App Store Connect admin API key (-authenticationKey* flags) for cloud signing.

Manual uploads to the CI-managed channel (bundle upload to production from a laptop or any other script) are not supported: they bypass the workflow's release tag, live update floor, source-order and native metadata guards. To ship a live update outside the automatic trigger, run Capgo Release manually (workflow_dispatch) with release_target=auto, which keeps the native-change detection; force release_target=ota only after checking that nothing native changed since the release tag (native paths and the Capacitor runtime resolved in bun.lock), because a forced target skips that detection. Set allow_rollback=true only after checking that the run's commit should replace the channel's current web content (an intentional rollback).

Capgo CI

The Capgo Release workflow (.github/workflows/capgo.yml) runs typecheck, test and build on every pull request. On each push to main that matches its path filters (anything outside website/, store/, cloud/, renovate.json and Markdown files, except src/**/*.md) it decides between a Capgo live update and a native release: a manual release_target wins, then any native change since the release tag (ios/ including ForgrWidget, android/, capacitor.config.*, the native parts of plugins/*, any Package.swift or *.podspec, or a new @capacitor/core|ios|android version in bun.lock) means native, otherwise bundle releaseType decides. Live updates are delta bundles <version>+build.<run>.<attempt>.<sha7>; a native release builds iOS (app + widget) and Android on Capgo Build, then uploads the same web build as the native baseline <version>+native.<run>.<attempt>.<sha7> and moves the release tag. Every build request passes --output-upload --output-retention 7d, so each build can be downloaded or installed in the Capgo cloud simulator for 7 days.

Secrets and credentials. The only GitHub secret is the CAPGO_TOKEN org secret (it needs app admin rights on app.capgo.mapp). Signing and store credentials are stored on Capgo for app.capgo.mapp (bunx @capgo/cli@latest build credentials push app.capgo.mapp; check with bunx @capgo/cli@latest build credentials remote-status app.capgo.mapp):

  • iOS: BUILD_CERTIFICATE_BASE64, P12_PASSWORD, APP_STORE_CONNECT_TEAM_ID, CAPGO_IOS_PROVISIONING_MAP (App Store profiles for both app.capgo.mapp and app.capgo.mapp.widget), and the App Store Connect API key APPLE_KEY_ID, APPLE_ISSUER_ID, APPLE_KEY_CONTENT.
  • Android: ANDROID_KEYSTORE_FILE, KEYSTORE_KEY_ALIAS, KEYSTORE_KEY_PASSWORD, KEYSTORE_STORE_PASSWORD, and the Play service account PLAY_CONFIG_JSON.

build request uses them automatically because the workflow passes no signing credential. Do not add --use-stored-credentials, and do not put any signing secret in the build env: one such value makes the CLI ignore all stored credentials.

Release vs debug. A release native build (the default build_mode=release) always builds both platforms and is followed by the native baseline, which raises the live update floor and moves the release tag, so it must reach both stores. The native baseline is uploaded and linked to the channel first, carrying the new version as its own min_update_version; the release tag moves after it. Live updates take their floor from the release tag's native version, so the live update floor advances only when the tag move succeeds; store submission alone moves neither. The workflow does not wait for App Store approval, so once the release finishes older iOS binaries get no new live updates until users install the approved version (a gap accepted for the review window). If both stores accepted the binaries but upload-native-baseline failed: when it failed before the baseline was linked, the channel keeps its previous bundle and floor, and later live updates use the old floor (subject to the usual checks, such as native package metadata on that bundle); when the baseline was linked but the tag move failed, the channel already holds the new baseline (with its new min_update_version) while the release tag, and so the live update floor, still records the old release, and live updates are refused ("a native release did not finish moving the tag") until the two agree. To recover, re-run the failed upload-native-baseline job only if the failure was transient, no newer run has published to the channel since, and the release commit is still on the default branch (the job re-runs every release guard and stops if one no longer passes). Otherwise a re-run cannot finish that release: if a newer run published to the channel, release in a new native run from a commit that contains that bundle's source; if the release commit is no longer on the default branch (it was rewritten), release in a new native run from the current default branch. That run still has to descend from the release tag (capgo-native-<channel>): if the rewrite removed only the failed release commit, the tag's commit is still on the default branch and the new run works. If the rewrite also removed the tag's commit, correct the tag first, by hand, while no release run is running or queued (check the Actions tab), so no run reads or moves it at the same time: pick a commit of the rewritten default branch whose native sources and resolved Capacitor runtime (the @capacitor/core, @capacitor/ios and @capacitor/android versions in bun.lock) both match the binaries in the stores; read the current tag object with git ls-remote origin refs/tags/capgo-native-<channel> (call it <old>); create the annotated tag with git tag -f -a capgo-native-<channel> -m 'native-version=<version in the stores>' <commit>; and push it with an explicit lease, git push --force-with-lease=refs/tags/capgo-native-<channel>:<old> origin refs/tags/capgo-native-<channel> (a bare --force-with-lease is rejected for tags, which have no remote-tracking ref). If no commit on the rewritten branch matches both, delete the tag the same way (git push --force-with-lease=refs/tags/capgo-native-<channel>:<old> origin :refs/tags/capgo-native-<channel>) and run the bootstrap native release from the default branch instead (release_target=native, build_mode=release, native_platform=both) with a package.json version above the one in the stores. Once the tag is corrected, start the new native run. In both cases use a package.json version above the one that reached the stores, and dispatch with allow_rollback=true only after checking, when the commit of the channel's linked baseline is not an ancestor of the new release commit. Android goes to the Play production track as completed; iOS is submitted to App Store review and released automatically after approval. A release-mode run with native_platform=android or ios fails at detection, and release builds fail before either platform starts if the stored PLAY_CONFIG_JSON or App Store Connect API key is missing (checked with build credentials remote-status). Release builds must use a commit already on main. build_mode=debug (manual dispatch) is a test build: it may build one platform, is never submitted for review, never publishes a baseline or moves the release tag, and is available as a Capgo download (kept 7 days). Android debug builds use --no-playstore-upload; iOS debug builds get no App Store Connect key from the workflow (their build number is still bumped, from the key stored on Capgo, so it never repeats an uploaded one), but the key stored on Capgo cannot be excluded for one build, so Capgo may still upload an iOS debug build to App Store Connect/TestFlight (never submitted or released). Debug test builds also work before the release tag exists.

Native version reservation. Before either platform of a release build starts, the reserve-native-version job pushes the tag capgo-native-version-<version> (for example capgo-native-version-1.3.7) onto the release commit. The workflow never moves or deletes it, so it survives a release that fails after one store already accepted its binary. A retry or a new run from the same commit reuses it; a run from any other commit with that package.json version fails before building and asks for a version bump. Delete a reservation tag by hand (git push origin :refs/tags/capgo-native-version-<version>) only if you are sure no store received that version and no run for it is queued or running.

Bootstrap (once, before the first release). Every release run (a push to main that matches the path filters, or a manual run) starts by reading the release marker tag capgo-native-production (capgo-native-<channel> for other channels). Until it exists, every automatic run fails, so no live update can reach the installed binaries before a native baseline is recorded (a manual debug test build still works). There are two ways to create it:

(a) You know the exact commit the store binaries were built from. Tag that commit with their native version, then re-run the workflow:

git tag -a capgo-native-production -m 'native-version=<version of the shipped binaries>' <sha-of-that-exact-commit>
git push origin refs/tags/capgo-native-production

The next native release then needs a package.json version above that native version.

(b) The shipped commit is not known exactly. Do not guess: native changes made before the tag would go undetected, and a later web bundle could reach binaries whose native code does not match it. Instead, set version in package.json above the version in both stores and merge that commit into main (its push fails at detection, which is expected), then run Capgo Release manually from main with release_target=native, build_mode=release and native_platform=both. That run builds and submits both platforms, uploads the native baseline, and creates the tag on its own commit with native-version=<package.json version>. A bootstrap dispatched from any other ref is refused, and if the tag appears while the run is in progress, it stops instead of overwriting it.

Channel prerequisite. The production channel must exist: every publishing job reads its current bundle and fails if it cannot (bunx @capgo/cli@latest channel currentBundle production app.capgo.mapp). A channel with no bundle linked yet can only be seeded by a native release; a live update refuses to publish to it.

Native package metadata. A live update is only published when the channel's linked bundle records its native packages (read from the Capgo API before the upload). A legacy bundle uploaded without that metadata would make --fail-on-incompatible skip its comparison, so the live update is refused until a native release (release_target=native, build_mode=release, native_platform=both) links a baseline that records them.

Source order and debug runs. Live update bundles are named <version>+build.<run>.<attempt>.<sha7> and native baselines <version>+native.<run>.<attempt>.<sha7>. Before any upload or store build, the workflow requires the commit recorded in the channel's current bundle name to be contained in the run's commit, so an older ref can never replace newer web content. A manual dispatch with allow_rollback=true skips only that check, for an intentional rollback. A live update refuses a channel bundle whose name records no commit (older +build.N.A / -build.N names, bundles uploaded by hand, or anything else unparseable): run a native release first (its baseline records its commit), or verify that the run's commit contains the channel's web content and dispatch with allow_rollback=true. A native release (including the bootstrap) still proceeds over such a bundle with a warning, since it is gated by the native version and the release tag's ancestry and its baseline replaces the bundle with one that records a commit. After that first native release the channel always holds a +native.*.<sha7> or +build.*.<sha7> bundle. An empty channel is handled separately (only a native release can seed it). build_mode=debug never publishes a live update: with release_target=auto it runs a native test build, and release_target=ota is refused. Each release-mode build job also re-checks that the capgo-native-version-<version> reservation still points at the run's commit before it requests a store build. Release-mode build jobs, the baseline job and the tag move also re-check that the run's commit is still on the live default branch, and a release-mode native build must be above every capgo-native-version-* reservation that belongs to another commit (a higher version may already be in a store), checked at detection and again before each build. Right before each live update or baseline upload, the job re-reads the channel's current bundle and stops if it changed since its source-order and metadata checks. Debug native builds do not need to descend from the release tag, so they can be built from other branches, but when the channel has a release tag their package.json version must be at least the tag's native version (equal is allowed for a debug build; a release build needs a higher one). Release runs of every channel share one queue (capgo-release), so a lower native version on one channel can never be submitted while a higher one reserved on another channel is in flight. Each guard reads the current default branch from origin (git ls-remote --symref origin HEAD) rather than from the triggering event, and fails closed if it cannot.

Layout

src/auth/*     Sign in with ChatGPT (from Capgo Browser)
src/ai/*       Responses API client, agent loop, tools, instructions
src/apps/*     Mini app store, iframe runtime + native bridge, starter apps
src/ui/*       Shell: home, stage, switcher, floating chat, onboarding
src/skills/*   Capgo skills bundled for the model
store/icon     1024 icon

Store assets

store/screenshots/{6.9,6.5} (framed) and store/video/mapp-app-preview.mp4 (886x1920, 30 fps) are uploaded to the 1.0 version in App Store Connect. Regenerate with the dev server on port 5181:

cd store/tools
bun shoot-store.mjs      # raw 1320x2868 screens (store demo mode)
bun frame-store.mjs      # framed 6.9" and 6.5" screenshots
bun record-preview.mjs   # preview footage, then encode with ffmpeg (see git log)

iPhone Duo

@capgo/capacitor-native-navigation provides the real UIKit tool navigation. The native sidebar is enabled only in expanded layouts, with both viewport dimensions at least 600 points. Regular iPhones and the folded Duo keep the original bar-free interface, including in phone landscape. Selecting a tool preserves its own conversation. Web sheets and onboarding temporarily hide the native chrome. Plugin insets are applied to both the shell and running mini apps.

The shell supports portrait and landscape, with an adaptive tool grid and side-by-side onboarding. Folding resets the floating chat button into the current screen's safe area. WebKit layout checks can be run with the dev server on port 5181 using cd store/tools && bun check-iphone-duo.mjs.

store/screenshots/iphone-duo contains unframed captures from the installed native app on the iOS 27.1 simulator, with no store-demo mode. Cover captures are 1398×2034 and unfolded captures are 2853×2007. See store/iphone-duo.md and store/iphone-duo-upload.json for provenance and App Store Connect status.

Upload through the App Store Connect CLI using the existing authenticated Keychain profile:

asc screenshots validate --path store/screenshots/iphone-duo --device-type IPHONE_DUO
asc screenshots upload --app 6821593688 --version 1.0 --locale en-US \
  --path store/screenshots/iphone-duo --device-type IPHONE_DUO --skip-existing

This uploads screenshots to the draft listing without submitting it for review. The existing 6.5-inch and 6.9-inch screenshot sets are not replaced.

About

Forgr: build your own personal Tools by chatting. Capacitor + Capgo, ChatGPT sign-in.

Topics

Resources

Code of conduct

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages