Plain Node .mjs scripts for the build, packaging and install-smoke steps. They run with node and do not import the TypeScript build output. smoke-install.mjs with --skip-build still packs the existing dist/ and asserts that its files are present. copy-renderer-assets.mjs gives the reason in a comment: it runs after tsc as part of npm run build. Release CI and the ci mise chain call these scripts through package.json scripts.
copy-renderer-assets.mjs: takes no arguments. Copiessrc/renderer/ghosttyWeb/assetstodist/renderer/ghosttyWeb/assets. Caller: the package.jsonbuildscript, aftertsc -p tsconfig.build.json. [copy-renderer-assets.mjs:main]pack-release.mjs: flags--build,--pack-destination <dir>(default: the project root) and--metadata-file <path>. Runsnpm pack, writes a.sha256file next to the tarball, and prints package metadata JSON to stdout. Callers: the package.jsonpack:releasescript,.github/workflows/release.ymlanddocs/RELEASE-PROCESS.md. [pack-release.mjs:parseCliArgs] [pack-release.mjs:main]packRelease(options): the exported function behindpack-release.mjs. Returns{ packageName, packageVersion, tarballFilename, tarballPath, tarballSizeBytes, checksumFilename, checksumPath, checksumSha256, npmShasum, packedPaths }.smoke-install.mjsimports it. [pack-release.mjs:packRelease]smoke-install.mjs: flags--skip-buildand--exercise-git-install. Packs the tarball, installs it into a temp prefix, and runs the installed CLI. With--exercise-git-installit also installs from a temporary git copy of the repo. Callers: the package.jsonsmoke:installscript and the mise taskinstall-smoke(npm run smoke:install -- --skip-build), which.github/workflows/ci.ymlruns. [smoke-install.mjs:supportedArgs] [smoke-install.mjs:verifyInstalledCli]seed-canonical-manifest.mjs:node ./scripts/seed-canonical-manifest.mjs <bundle-dir> < list.txt, where each stdin line is<relative-path>\t<description>. Prints{ artifacts: [{ path, description, sha256, bytes }] }for a canonicalmanifest.json. Its header calls it a one-time helper. No package.json script, mise task or workflow calls it. [seed-canonical-manifest.mjs:main]
copy-renderer-assets.mjsthrows when the source or the destination is not a directory, and setsprocess.exitCode = 1. [copy-renderer-assets.mjs:main]parseCliArgsthrows on unknown arguments and on a value flag without a value. [pack-release.mjs:parseCliArgs]packReleaseasserts thatnpm pack --jsonreturns exactly one entry whose name and version matchpackage.json, and that the tarball is a non-empty regular file. The checksum file holds<sha256> <tarball filename>. [pack-release.mjs:packRelease]sanitizeInheritedPathremovesnode_modules/.binandnode-gyp-binentries fromPATHand asserts that one entry remains. [pack-release.mjs:sanitizeInheritedPath]smoke-install.mjsasserts on unsupported arguments. The pack and the install must containdist/cli/main.js,dist/index.js,dist/index.d.ts,skills/agent-tty/SKILL.mdand every renderer asset underdist/renderer/ghosttyWeb/assets/. [smoke-install.mjs:supportedArgs] [smoke-install.mjs:getRequiredPackPaths]verifyInstalledCliasserts thatversion --jsonreports thepackage.jsonversion and that--home <tmp> doctor --jsonreturnsok: true. [smoke-install.mjs:verifyInstalledCli]- A failed git install passes only when the output matches a known node-pty caveat (
TAR_ENTRY_ERROR,spawn sh ENOENT,uv_cwdand similar). Any other failure throws. [smoke-install.mjs:isKnownGitInstallCaveat] seed-canonical-manifest.mjsexits 1 when<bundle-dir>is missing or a listed path is not a regular file. It skips blank lines,#lines and lines without a tab. [seed-canonical-manifest.mjs:main]
copy-renderer-assets.mjswrites intodist/withfs/promisesmkdirand recursivecp. [copy-renderer-assets.mjs:main]pack-release.mjsspawnsnpmwithspawnSync(npm run buildwith--build, thennpm pack --json --ignore-scripts). It creates the pack destination and the metadata file's directory withmkdir. It writes the.sha256file and the optional metadata file withfs/promises.writeFile. It readsPATH,HOME,npm_config_cache,npm_execpathandMISE_TRUSTED_CONFIG_PATHS. For the child it replacesPATHwith the sanitized value, adds the npm cache, the project root and the OS temp folder toMISE_TRUSTED_CONFIG_PATHS, and sets the npm audit, fund and update-notifier settings tofalse. [pack-release.mjs:runNpm] [pack-release.mjs:getDefaultEnv] [pack-release.mjs:getTrustedConfigPaths] [pack-release.mjs:packRelease]smoke-install.mjswithout--skip-buildcallspackReleasewithbuild: true, which runsnpm run buildin the repo and rewritesdist/. [smoke-install.mjs] [pack-release.mjs:packRelease]smoke-install.mjscreates$TMPDIR/agent-tty-install-smoke-*withmkdtempand removes it in afinallyblock. It runsnpm install -g --prefix <tmp>and the installedagent-ttybinary with an isolated--home. With--exercise-git-installit copies the repo and runsgit init,git addandgit commitin the copy. [smoke-install.mjs:verifyInstalledCli] [smoke-install.mjs:createGitInstallSource]seed-canonical-manifest.mjsreads stdin, hashes each file withcreateReadStream, writes JSON to stdout, and callsprocess.exit(1)for usage errors and non-regular files. Other errors, such as a missing listed path or a hash failure, reject the top-levelawait main()withoutprocess.exit. [seed-canonical-manifest.mjs:hashFile] [seed-canonical-manifest.mjs:main]
- No automated test covers this directory directly.
- Run:
npm run build(runscopy-renderer-assets.mjs) - Run:
npm run smoke:install(runssmoke-install.mjs, which callspackReleaseand rebuildsdist/)