Skip to content

Scripts ​

All under factory/scripts/, run from a clone of the repo. Each uses set -euo pipefail: an unlisted failure exits with the failing command's code.

check.sh ​

The fork's one check: the factory gate and the Check job of factory-ci.

Usagefactory/scripts/check.sh
Stepscheck-seams.sh; vp test run apps/server/src/factory; vp run --filter t3 typecheck; vp run --filter @t3tools/web typecheck
Printscheck: <command> before each step
0Every step passed.
otherThe first failing step's exit code.

check-seams.sh ​

Fails when a committed file differs from the upstream commit in factory/UPSTREAM and is neither factory-owned nor listed in factory/SEAMS.

Usagefactory/scripts/check-seams.sh
Factory-ownedapps/server/src/factory/, apps/web/src/factory/, factory/, .dw/, apps/web/src/routes/factory*, apps/web/src/routes/settings.factory*, .github/workflows/factory-*
Printscheck-seams: not a listed seam: <path> per offender
0No offender.
1At least one offender.

deploy.sh ​

build.sh, then install.sh on the archive.

Usagefactory/scripts/deploy.sh [--rebuild] [--build-only]
--rebuildBuild even when release/t3fac-<version>-darwin-arm64.tar.gz exists for this commit.
--build-onlyStop after the build.
0Installed, or built with --build-only.
1Uncommitted changes; or the build left no archive.
2Unknown argument.
otherbuild.sh or install.sh failed with that code.

build.sh ​

Builds the server archive and smoke-tests it.

Usagefactory/scripts/build.sh [--print-version]
Outputrelease/t3fac-<version>-darwin-arm64.tar.gz; its absolute path is the last line printed
Version<upstream nightly version>+fac.<short sha>; the apps/server/package.json version when factory/UPSTREAM names no nightly tag
EnvT3FAC_REPO_ROOT (default: git top level), T3FAC_SMOKE_TIMEOUT (default 60 seconds)
Needsvp, stable Rust (cargo)
0Built and smoke-tested, or --print-version.
1Dirty tree; unreadable SEA_NODE_VERSION; smoke test failed (smoke: FAILED: ...).

install.sh ​

Usagefactory/scripts/install.sh <t3fac-<version>-darwin-arm64.tar.gz>
DoesUnpacks to ~/.local/share/t3fac/versions/<version>, sets previous to the old current, points current at the new version, reloads io.github.rawphp.t3fac.logrotate, restarts io.github.rawphp.t3fac, waits for health.
HealthyPort accepts connections and the log gains factory started or no factory config after the restart.
EnvT3FAC_HEALTH_WAIT (default 90 seconds), T3FAC_UNLOAD_WAIT (default 10 seconds)
Printsinstalled <version>, current -> versions/<version>, job io.github.rawphp.t3fac restarted
0Installed and healthy.
1Missing or misnamed archive; no t3 in it; health check failed (then rolls back: install of <v> failed its health check; rolled back to <p>, or ...; rollback to <p> failed too, or ...; no earlier version to roll back to).

rollback.sh ​

Usagefactory/scripts/rollback.sh
DoesPoints current at previous, restarts both jobs, removes previous, runs the health check.
Printsrolled back to <version>
0Rolled back and healthy.
1no earlier version to roll back to; or rollback to <v> from <c> failed its health check.

stop-run.sh ​

Usagefactory/scripts/stop-run.sh <run id>
EnvT3FAC_DATA (default ~/.config/t3fac/factory)
DoesWrites <data dir>/stop-requests/<run id>. The next pass archives the session, removes the worktree and sets factory:stuck ("stopped by hand").
Printsstop requested: <id>; the issue goes to factory:stuck on the next pass
0Request written.
1Wrong argument count; no ledger; run finished; run not building (the message says what to do instead).

rotate-log.sh ​

Run every 10 minutes by io.github.rawphp.t3fac.logrotate; installed to ~/.local/share/t3fac/rotate-log.sh.

Usagerotate-log.sh <file> [max_mb] [keep], defaults 20 and 5
DoesWhen <file> is over max_mb, copies it to <file>.1, shifts older copies (.2.gz and up), keeps keep, truncates <file> in place.
Printsrotated <file> (<size> bytes)
0Rotated, or nothing to do.
1Bad arguments; copy failed (nothing changed).

regenerate-routes.sh ​

Rewrites apps/web/src/routeTree.gen.ts with the TanStack generator, for a sync conflict in that file. Needs vp i first.

Usagefactory/scripts/regenerate-routes.sh
Printsregenerated <path>
0Regenerated.
1apps/web/vite.config.ts calls tanstackRouter differently from the script.

sync.sh ​

Merges upstream's newest v*-nightly.* tag into main through a pull request. Run daily by .github/workflows/factory-sync.yml.

Usagefactory/scripts/sync.sh [prepare <dir> | publish <dir>]; no argument runs both
EnvSYNC_UPSTREAM (default https://github.com/pingdotgg/t3code)
prepareMerges the tag on sync/<tag>, runs vp i and check.sh, writes the outcome and a bundle to <dir>. No write token.
publishVerifies the bundle, then pushes, lands, or files an issue.
0Up to date; waiting on an open sync PR; merged into main; or prepare recorded an outcome.
1Anything that files an issue (conflicts, failing checks, cannot push, cannot land, route-tree review, stuck) or a bad tag or remote.
2Wrong arguments.