chatium
v3.27.0
Published
Chatium Source Git developer CLI
Readme
chatium v3
Source Git CLI, replacing the earlier chatium npm implementation without backward compatibility.
Requires Node.js 22+ and Git on macOS, desktop Linux, or Windows, plus a browser and available system
secret storage. Version 3 completely replaces the previous package; old commands and settings are not migrated.
Install and start
After the public v3 release:
npm install -g chatium@latest
chatium --version
chatium clone your-account.example.comUse your account domain, HTTPS origin, or the exact repository URL from its Source Git page. Confirm chatium --version reports a 3.x version.
Browser login requires a real Auth2 user holding the account's code permission (system:code:commit: Owners and
Developers by default, or anyone given the Code committer / Code releaser role), with an active seat when the
account uses seats. Clone then generates tsconfig, installs Git hooks,
downloads IDE declarations and installs Chatium skills for Codex and Claude Code. You can open the resulting
folder in your editor and start working. The initial Chatium skill is a template; full guidance is still pending.
In an existing checkout, run chatium setup after installing v3. If setup fails, fix the reported cause and
rerun it in the preserved checkout. See the command and system requirements below.
Switch an existing repository to Chatium CLI
npm install -g chatium@latest
cd your-existing-repository
chatium setupSetup signs in with the chatium-cli OAuth client, configures the repository's account-scoped Git
credential helper, then generates tsconfig and installs hooks, typings and skills. Retry the original
Git command afterwards; you do not need to clone again. Global helpers and other accounts are preserved.
An existing CLI session issued to the old client requires one browser login. Cancellation or failure
preserves that session for another transition attempt; old refresh tokens are never reused under the new client.
Source Git rejects old-client tokens for reading and pushing. The old OAuth client can no longer authorize
or refresh, but logout can still revoke its saved session. The old OAuth shell installer has been removed.
Transition messages support Russian and English. CLI language comes from LANGUAGE, LC_ALL,
LC_MESSAGES, then LANG, with English fallback. HTTP messages use Accept-Language; browser pages
use the user's existing language settings. Existing unrelated CLI messages are unchanged.
Updates through npm
Automatic updates are enabled by default. After a successful login, clone, setup, get-typings,
get-skills, or merge/rebase setup, a detached worker checks public npm at most once an hour. The command
finishes without waiting. The worker installs only npm latest, provided it is a non-deprecated stable release
in the current major that supports the running Node version; it never downgrades or selects another version.
When latest moves to the next major, this major stops receiving automatic updates. Checkout, commit, credential helper, logout, offline commands,
help, failures and cancellation do not trigger updates. Nested CLI calls do not launch additional workers.
chatium update --check
chatium updateBoth commands perform a fresh check outside or inside a checkout. --check only reports the current and
available versions, Node, installation prefix, automatic-update setting and previous attempt. update
installs with visible progress. No available update is successful; an unsupported installation, failed check
or busy updater returns an error. Set CHATIUM_NO_AUTO_UPDATE=1 to disable automatic updates; manual commands
still work. Background results never appear during ordinary commands.
Only real global npm installations are updated, including custom prefixes and nvm. Source checkouts,
npm link, local dependencies and npx caches are excluded. The updater invokes npm through the running Node
and targets this installation's prefix, not npm's current default. It runs outside the checkout and preserves
absolute hook/helper paths. It does not ask for elevated privileges.
Active CLI commands, including nested Git helpers, defer installation. A deferred candidate can be installed
after the next eligible command, but metadata from a previous run is fetched again before installation,
even within the hourly interval. A registry failure prevents installation; fresh metadata from the current
run is reused without a second request. Coordination and diagnostic state
are stored per installation under $XDG_STATE_HOME/chatium/updates (otherwise Windows %LOCALAPPDATA%,
or ~/.local/state). Do not remove these files while commands or npm are active.
Recovery and major upgrades
npm replacement is not atomic. A new concurrent invocation can hit missing files during installation and
need a retry; external npm commands do not participate in CLI locking. Failed npm installation can leave
Chatium unusable, including chatium update --check. There is no automatic backup or rollback.
Reinstall directly with npm, using the same prefix:
npm install --global --prefix "/your/original/prefix" [email protected] --registry=https://registry.npmjs.orgReplace the example version with the version you want. To keep that version, set CHATIUM_NO_AUTO_UPDATE=1.
The updater also records a recovery command and its last error in state.json. To move to the next major,
run npm install -g chatium@latest, adding --prefix for your custom prefix.
Clone
chatium clone your-account.chatium.ru
chatium clone https://your-domain.example
chatium clone https://your-account.example.com/s/git/your-account.git
chatium clone https://your-account.example.com/s/git/your-account.git "my checkout"Clone starts browser login when needed or reuses the same session as login. Without a destination, the origin's hostname (without scheme or port) is used, including for full repository URLs.
For example, chatium clone your-domain.example creates your-domain.example, even if the account has another name. The new checkout's account-scoped credential helper and useHttpPath are
configured before its initial fetch; subsequent ordinary Git commands use the same session. Global
credential helpers remain unchanged.
The command reports success after cloning and running setup: local TypeScript configuration, managed hooks and declarations, then Chatium skills for Codex and Claude Code. The generated root tsconfig is overwritten even if tracked; other tracked files and legacy helper scripts are preserved. Project installation/lifecycle scripts are not run. The credential helper refers to this installed CLI and Node executable, so keep them available while using the checkout.
If preparation fails, the checkout is retained and the error names its location and recovery commands.
Run chatium setup inside it after fixing the cause. Git clone failures
retain Git's exit code and normal cleanup behavior; the CLI never removes an existing destination to retry.
Custom domains remain in the remote URL, OAuth and setup, with a separate session per origin. External proxies and path prefixes are unsupported.
Multiple account remotes
git remote add prod https://acme.chatium.ru/s/git/acme.git
git push prod main
chatium exec --remote prod 'return await someFunction()'Pushing main releases the code and needs the release permission (system:code:pushMain, part of the Developer
role by default); without it the push of main is rejected while other branches and tags push normally.
A checkout may have remotes for several accounts. Clone and setup configure the credential helper for HTTPS
Source Git URLs on the default port whose host has two to four labels, so a newly added account remote
authenticates on its first fetch or push, starting browser login when that account has no session. Checkouts
prepared by an earlier version receive this after one chatium setup (or the next merge hook), which also moves
their single-URL remotes from the pre-rename /s/source-git/ path to /s/git/. Other remotes
(loopback, custom ports, deeper hosts) need chatium setup --remote <name>. Requires Git 2.26 or later.
Commands that work with an account (login, logout, exec, setup, get-typings, generate-tsconfig,
typecheck and storage upload) use origin unless --remote <name> selects another remote. The choice is
not remembered: installed hooks and later commands use origin again, and they fail with a request for
--remote if origin is not a Source Git remote. setup --remote <name> signs in to that account and prepares
tsconfig and typings from it; other account remotes sign in on first use.
Login
chatium login https://your-account.example.com
chatium login your-account.example.com
chatium login
chatium login --remote prodInside a Source Git checkout, the URL defaults to the origin remote, including from subdirectories;
--remote <name> uses another remote instead of a URL.
Outside a checkout, supply an account URL. Authorization requires a real Auth2 user holding the account's code
permission (system:code:commit, see above) and grants repo:read repo:write code:execute. Login reuses a valid local session with all three scopes, refreshes an expired one, or starts browser login as needed.
Press Ctrl+C to cancel; unattended login times out after five minutes.
Login prints a code such as BCDF-GHJK and a link to the account's confirmation page.
Nothing opens by itself: in a terminal, press Enter to open the link in this machine's browser.
The page shows the same code: allow access only if it matches your terminal and you started the login yourself.
The CLI waits for the decision by polling the server, so the browser may run on any machine, for example when the CLI
runs over SSH. Deny on the page, or an expired code, ends the login with an error.
Account URLs require HTTPS. HTTP is accepted only for literal loopback hosts 127.0.0.1 and [::1],
for local development. Credentials embedded in URLs,
query strings, and fragments are rejected.
In Chatium Code, login checks the existing native session first. Otherwise it exchanges the injected
CHATIUM_TOKEN only when the target origin exactly matches https://${CHATIUM_ACCOUNT}, saves the ordinary
OAuth pair, and skips the browser. Invalid local values or server 401/403 fall back to browser login;
transport, server and malformed-response failures stop the command.
For scripts and agents, set CHATIUM_NONINTERACTIVE=1: when a command would start the browser login, it fails at
once with exit code 3 and does not poll the server. A saved session, its refresh and the Chatium Code token still work.
Git-started logins (credential helper) fail the same way, but Git reports its own exit code.
Logout
chatium logout your-account.example.com
chatium logout
chatium logout --remote prodA hostname without a scheme defaults to HTTPS and uses the same session as the full HTTPS origin.
Without an argument, logout uses the checkout's origin (or --remote <name>), including from subdirectories. It revokes the saved
refresh-token family on the server before deleting the local native entry. All local clones of that origin
share the session; other origins and other devices' token families are unaffected. No saved entry is a
successful no-op. Logout never opens the browser or clears the browser's Chatium session.
A network error or unconfirmed response retains the entry and exits unsuccessfully: retry logout when connected. If server revocation succeeds but native deletion fails, the error explicitly says so; unlock the native store and retry. Server revocation accepts consumed refresh tokens and repeated requests. The next Git credential request can start a new browser login. Logout is disabled while both managed Chatium Code variables are present.
Execute code
chatium exec 'return await someFunction()'
printf '%s\n' 'return { ok: true }' | chatium exec
chatium exec --remote prod 'return await someFunction()'
chatium exec --write 'return await someMutation()'Run chatium exec on a branch inside a Source Git checkout. It executes the snippet against the latest compatible
successful Source Build for that branch in the origin account, or in the account of --remote <name>, falling back
to main when the branch has none. Detached HEAD is rejected.
Local commits and staged, unstaged, untracked or dirty-submodule changes are unavailable; dirty checkouts warn and
continue. Ignored files do not trigger the warning, and the snippet is never added to Git.
Before sending, the CLI type-checks the snippet against the local checkout and its downloaded typings
(chatium get-typings); type errors in the snippet itself stop the run, errors elsewhere in the checkout do not, and a
crashed type check stops it too.
The snippet runs read-only: every database write (Heap, identities, account settings, billing, jobs, feeds) fails and
nothing changes, in the app functions it calls too. Pass --write to change
data; then there is no rollback, and a failed run may have applied some writes. While the DRY_RUN environment
variable is set (to any value) or CHATIUM_CODE_READONLY=1, --write is refused before anything is sent. Read-only does not cover
outbound HTTP requests, email, Redis, S3 and other side effects outside the databases: they still happen. Execution has no dedicated VM: it reuses the account VM when available. Only users holding the account's code permission (system:code:commit) can grant the separate code:execute
scope, and each use of it checks that permission again.
The result goes to stdout: strings are printed without JSON quotes, other JSON values are serialized. The executed
commit SHA, console.* output and errors go to stderr. Pass one snippet argument or pipe a snippet to stdin; put --
before a snippet argument that starts with -.
Prepare hooks and typings
chatium setup
chatium generate-tsconfig
chatium install-hooks
chatium get-typings
chatium get-skills
chatium typecheck [paths...]
chatium generate-typings
chatium format [--check] [paths...]Generated and migrated repositories provide npm run setup (chatium setup) for full repository preparation;
the old install-hooks npm script is removed. chatium install-hooks remains available separately.
The old command names typings, sync-typings and tsconfig are no longer accepted.
Run these in a Source Git checkout, its subdirectory or a Git worktree. setup authorizes and configures the account-scoped Git helper, then generates tsconfig,
installs hooks, downloads declarations, then installs the current Chatium skills. Both clone and setup print the checkout path and each preparation
step, then report success once. Failures show the cause; clone preserves the checkout and suggests retrying setup. generate-tsconfig works offline and derives aliases from local folders
and the account in origin; it overwrites even customized/tracked root configuration without staging.
install-hooks also works offline. Only downloading declarations needs the shared OAuth session.
typecheck regenerates tsconfig before running vue-tsgo (the @chatium/vue-ts-mapper-rs .vue mapper with tsrs, a Rust port of TypeScript 7; where tsrs has no build, such as Intel macOS, with @chatium/tsc-rs, and on Windows with TypeScript 7; VUE_TSGO_TSC=tsc-rs or VUE_TSGO_TSC=typescript picks those; VUE_TSGO_MAX_MEMORY=1G keeps tsrs near that much memory, the parsed program being the floor), all installed with the CLI as its dependencies; folders/files passed to typecheck (relative to the current directory) narrow the check to them and what they import, to use less memory; generate-typings replaces .typings using the public files in package.json with the native generator
(@chatium/typings-generator-rs, installed with the CLI). It reads the working copy and node_modules, so run
get-typings first for the builtin and dependency declarations; a failed run reports path:line:col: message and
leaves .typings untouched. Where the native generator has no build for the platform (a notice says so), or with
CHATIUM_TYPINGS_GENERATOR=js, it deletes .typings and runs the JS generator through npm, which follows its latest
release without a Chatium CLI update. Setup does not run them. get-typings leaves hooks unchanged and scans .ts, .tsx, .js, .jsx and
.vue files for scoped imports, excluding .git, .chatium, .skills, .typings and node_modules.
It downloads builtin declarations and the declarations of external accounts that are imported or host an app
installed in the account; it does not generate the project's public typings.
Installation uses Git's common hooks directory. Only recognized Chatium-managed hooks can be replaced; all hook destinations are checked before writing. The hook invokes this CLI through absolute Node/CLI paths; after moving the installation rerun
install-hooks. A foreign hook, symlink, or custom core.hooksPath (including an explicitly empty value) causes
an error during install-hooks/setup; get-typings does not inspect hooks or core.hooksPath.
The hook runs the installed CLI offline with Node and Git; no network access is needed during commit.
Directory metadata must be a regular index file. ID insertion rejects symlink paths and atomically replaces
the worktree file while preserving its permissions, formatting and partially staged edits.
Installed hooks run full setup after merge (including fast-forward pull), after rebase and on worktree creation,
so a new worktree gets declarations and skills too. After branch checkout/switch or detached HEAD checkout, only
tsconfig is regenerated, without network access. Checkout of individual files, amend, push and pull without changes do not trigger preparation.
Automatic setup downloads skills too and may start browser login. Failures print the cause and a manual retry command without
failing the completed Git operation; manual setup/generate-tsconfig still fail normally.
Existing checkouts receive these hooks after chatium setup or chatium install-hooks.
Typings output is restricted to declaration files inside this checkout's node_modules. The complete
response is checked before writing declarations: traversal, tracked files, symlinks, and conflicting paths
are refused. Once the response is valid, the checkout's whole node_modules is removed and written again, so
declarations of uninstalled apps disappear. This is the expected behavior, not a side effect: Chatium owns a Source
Git checkout's node_modules entirely, it holds only downloaded typings, and npm packages are not installed there.
Anything else placed there is lost on the next get-typings, setup or merge/rebase hook.
A failure midway can leave node_modules incomplete; rerun the command after fixing the cause.
The CLI adds /node_modules/ to Git's local info/exclude. Only tsconfig generation changes tracked
configuration in older checkouts; legacy helper files are preserved but their installation workflow is no longer supported.
The old /s/source-git/hooks/pre-commit endpoint has been removed. Run chatium setup in existing
checkouts to install the CLI hooks instead of running .chatium/install-hooks.mjs. The installed merge/rebase hooks also run preparation after successful Git operations.
Format code
chatium format
chatium format --check
chatium format src/page.vueFormatting uses bun fmt from Bun 1.4.4, installed with the CLI as a
dependency (about 90–115 MB per platform). npm must run Bun's postinstall script: an installation with
--ignore-scripts has no formatter, and formatting is then skipped with a warning. chatium format [args...]
runs bun fmt --no-script [args...] in the current directory and returns its exit code; other bun fmt
flags pass through unchanged.
The managed pre-commit hook runs bun fmt --staged once, after the directory metadata checks, in every
checkout with installed hooks, and re-stages what it formats. Bun alone chooses files (every language it
supports, including YAML and HTML), configuration and ignores: .prettierrc*, .oxfmtrc*, .editorconfig,
bunfig.toml, .gitignore, .prettierignore and .git/info/exclude. Without configuration Bun uses
Prettier's defaults (semicolons, double quotes, 80 columns, LF). Exclude files, or the whole project, with
.prettierignore.
Chatium changes this in two places only:
.vuefiles always keep semicolons. Without them a formatter joins the statements of an inline handler (@click="a = null; b = false") into one expression and the template stops compiling. When the repository root has a JSON.prettierrcor.prettierrc.json, the hook andchatium formatrun Bun with a temporary copy of it that adds{ "files": "*.vue", "options": { "semi": true } }as the last override, so<script>blocks of.vuefiles get semicolons too. Bun then reads no other configuration file, including a nested.prettierrcin a subfolder. Other configuration formats (YAML, JS,package.json,bunfig.toml) are not patched: add the override there yourself.chatium format --config=...or--no-configturns this off.- The hook does not format a commit that concludes a merge, a cherry-pick or a revert: such a commit carries files its author did not edit.
Formatting never blocks a commit. A file with a syntax error, a file with both staged and unstaged changes
(Bun skips it) or a missing Bun binary prints a warning, and the commit continues with the file as staged.
Invalid directory metadata still rejects the commit, before Bun runs. git commit --no-verify skips the
whole hook, including directory ID insertion.
Known Bun 1.4.4 limitations, left to Bun to fix:
git commit <path>commits the formatted file but leaves the old unformatted blob in the index (git statusshowsMM, oven-sh/bun#46839). Rungit add <path>before the next commit; otherwise that commit can restore the unformatted text, because Bun sees a partially staged file and skips it.- Formatting is not always idempotent: a few constructs, such as long Vue
{{ }}interpolations and some method chains, change again on a second run. Right afterchatium format,chatium format --checkcan still report such files, and a later commit of the file can carry an unrelated line-break change.
Existing projects are reformatted file by file as files are committed. To format everything at once, run
chatium format and commit the result separately.
Native storage and recovery
One native secret per account origin stores the access/refresh pair, expiry and scope.
Clones of one account share its session; different origins have independent entries.
Storage errors fail the command: unlock or repair the system store and retry. No plaintext fallback exists.
macOS uses Keychain and open; Windows uses Credential Manager and the default browser. Linux needs
xdg-open and a working desktop Secret Service for persistence across reboots; the native dependency's
kernel-keyring fallback may require a new login after reboot.
Login always prints the confirmation link and opens it only on Enter; a failed browser launcher is only a warning. On a remote or headless machine, or when Git starts the login, open the link in any browser.
A refresh-pending marker is saved in the same secret before the HTTP request. If the response is lost,
the process dies or saving the rotated pair fails, retrying performs a new browser login instead of
reusing the old refresh token. proper-lockfile coordinates processes per origin in the user's local
state directory, using a heartbeat and a 10-second stale threshold. Lock files contain no tokens.
Do not remove active locks. A killed process's lock may take about ten seconds to recover.
Coordination is local to a desktop, not shared across machines.
Git helper contract
chatium credential-helper [<account-origin>] get|store|erase uses Git's stdin/stdout protocol.
An explicit origin binds it to the account; unsupported hosts, protocols, usernames and repository
paths receive no tokens. Without an origin, the request host is the account: only HTTPS (or loopback HTTP)
Source Git repository paths are served, and each token goes only to the origin that issued it.
store cannot overwrite the OAuth pair. erase removes only a matching current access token; it does
not revoke server tokens.
Setup tooling must configure the helper locally for the exact account context and for the account remote
patterns https://*.*/s/git/ through https://*.*.*.*/s/git/ (and the same for the pre-rename /s/source-git/
prefix), reset inherited helpers
for those contexts and enable credential.useHttpPath there. Do not configure it as an unrestricted global
helper. Clone and setup configure this automatically.
Chatium skills
Run chatium get-skills [--remote <name>] (or npm run get-skills in newly generated/migrated projects) to
download the current default branch of https://github.com/chatium/chatium-agent-skills and the skills of the apps
installed in the account. Git, network access and Chatium login are required. The command works from
subdirectories and worktrees.
An app ships skills in its source as <app directory>/.skills/chatium-app-<app slug>-<skill>/SKILL.md with any files
beside it (no .dir.json); name in SKILL.md matches the folder. Other folder names are not delivered. Files arrive
byte for byte from the app's active build commit. Imports in .skills files are neither typechecked nor scanned by
get-typings. App skills disappear once the app is uninstalled or drops them.
Whole skill directories are copied independently into .agents/skills/ and .claude/skills/ for Codex
and Claude Code. Names starting with chatium are managed: local edits are replaced and retired skills
removed. Other skills and agent files remain yours. No agent configuration or lock file is generated.
The source currently contains a development template; substantive guidance will be maintained there.
The complete source and destination paths are validated before replacement. Download/validation failures,
a failed request for the apps' skills included, preserve installed skills. Fix the reported cause and rerun chatium get-skills; retry also repairs a
partial filesystem failure. Ctrl+C cancels download and removes temporary files.
Only /.agents/skills/chatium* and /.claude/skills/chatium* are excluded via local Git info/exclude.
New repository templates and migrated repositories include these rules in .gitignore, preserving
other rules. The command does not edit tracked .gitignore or stage/untrack files.
Upload local files
From the account's Source Git checkout (including subdirectories):
chatium storage upload ./photo.jpg ./document.pdf
chatium storage upload --protected ./private.pdf
chatium storage upload -- -filename.txt
chatium storage upload --remote prod ./photo.jpgThe account comes from the origin remote (or --remote <name>); the CLI reuses its OAuth session or starts login.
Files are public by default. Paths are relative to the current directory; directories are not uploaded.
Each successful upload prints a text block with file, file_hash, download_url, get_url, and
thumbnail_url (800px wide, when the format supports thumbnails). Protected URLs are unsigned;
use @app/storage helpers in your application to obtain authorized access URLs.
Files upload sequentially. File errors go to stderr and remaining files continue; any failure gives exit code 1. Authorization failure or cancellation stops the command. Successful uploads remain stored.
Manage secrets
chatium secrets list
chatium secrets create BANK_TOKEN
chatium secrets create client.key --value-file ./client.key --ref-only --host api.bank.example --allow-in tls
pass show bank/token | chatium secrets set BANK_TOKEN --value-file -
chatium secrets settings BANK_TOKEN --ref-only --host api.bank.example --allow-in header
chatium secrets log BANK_TOKEN
chatium secrets restore-previous BANK_TOKEN
chatium secrets delete BANK_TOKENThe commands do what the Secrets page of the account does. The account must grant you system:secrets:manage,
and, as for every CLI command, the right to commit code (system:code:commit). A value is never shown; open the
page to see a readable one.
The value is typed at a hidden prompt, or read from a file or from stdin with --value-file <path|->; a byte order
mark at the start (editors on Windows add one) and one final line break are dropped. It is never a command argument, so it stays out of the shell history. Without a terminal the
value must come from a file or stdin. The hidden prompt takes one line: pass a certificate or a key with
--value-file.
create makes a secret of the account's own code; an app creates its secrets from its code. The other commands
reach a secret of an app with --app <slug>. A new secret is readable by the code and managed by admins only;
--ref-only makes it usable only as a reference in requests to the --host hosts, in the --allow-in places
(url, header, body, tls), and --code-managed lets the code change and delete it. A reference-only secret
cannot be made readable again. settings --host replaces the whole list of hosts, --no-hosts empties it; hosts and
places are refused for a readable secret.
delete, restore-previous and settings --code-managed ask for confirmation. Without a terminal, or with
CHATIUM_NONINTERACTIVE=1, pass --yes; otherwise the command exits with code 3.
