flowchart LR
cli[cli.ts] --> parser[commands/parser.ts]
parser --> executor[commands/executor.ts]
executor --> sdk[sdk/management.ts]
executor --> lib[lib/hash.ts / lib/sign.ts]
sdk --> api[Source Push REST API]
| File | Role |
|---|---|
src/cli.ts |
Parses argv via yargs, calls execute() |
src/index.ts |
Re-exports AccountManager for programmatic use |
dist/cli.js |
Published npm bin (srcpush) |
dist/index.js |
Published SDK entry |
- Parser (
commands/parser.ts) — yargs definitions map argv →ICommandobjects (types/cli.ts). - Executor (
commands/executor.ts) — dispatches byCommandType, formats output, handles confirmations. - Management SDK (
sdk/management.ts) — HTTP via superagent to the Source Push API. - Acquisition SDK (
sdk/acquisition.ts) — client-side update check protocol (used by RN plugin, also exported).
commands/executor.ts exports a runtime object (sdk, log, spawn, confirm, createEmptyTempReleaseFolder, release) so tests can stub dependencies without fighting ESM live bindings.
Vite compiles TypeScript to CommonJS with preserveModules: true into dist/. The shebang in cli.ts is preserved in dist/cli.js.
Package hashing in src/lib/hash.ts is duplicated in the API service for server-side validation. Keep both implementations aligned.