← 一覧
@lapius/sca-clisca
GitHubnpm
<div align="center"> <p align="center"><b>English</b> | <a href="README.ja.md">日本語</a></p> <h1 align="center">SCA CLI</h1> <h3 align="center">Chat from the terminal, without opening a browser.</h3> <p align="center">A CLI for the chat at <code>https://chatapp.lapius7.com/</code>. Create and list rooms, join them, and see who is online, all with the <code>sca</code> command.</p> <p align="center"> <a href="https://github.com/Lapius7/sca-cli/releases"><img alt="Release" src="https://img.shields.io/github/v/release/Lapius7/sca-cli?label=release&style=flat-square&color=e8833a&logo=github"></a> <a href="https://www.npmjs.com/package/@lapius/sca-cli"><img alt="npm" src="https://img.shields.io/npm/v/@lapius/sca-cli?style=flat-square&color=cb3837&logo=npm"></a> <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/github/license/Lapius7/sca-cli?style=flat-square&color=97ca00"></a> <a href="https://go.dev"><img alt="Go" src="https://img.shields.io/badge/language-Go-00add8?style=flat-square&logo=go&logoColor=white"></a> <a href="https://github.com/Lapius7/sca-cli/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/Lapius7/sca-cli?style=flat-square&color=e3b341&logo=github"></a> <a href="https://github.com/Lapius7/sca-cli/commits/main"><img alt="Last commit" src="https://img.shields.io/github/last-commit/Lapius7/sca-cli?style=flat-square&color=3b82f6"></a> </p> <p align="center"> <a href="#quick-start">Quick start</a> · <a href="#commands">Commands</a> · <a href="#design-notes">Design notes</a> · <a href="#known-limitations">Known limitations</a> </p> </div>

Features

Structure

You use only the sca binary from cli/. The Python side runs behind the scenes for sca room who and sca room join.

Quick start

1. Install

With pnpm (recommended):

pnpm add -g @lapius/sca-cli

This installs a prebuilt binary for Linux, macOS (x64, arm64), or Windows (x64). It needs no Go, only Node.js 18 or later. Run the same command to update.

[!IMPORTANT] This package assumes pnpm. Installing with both npm and pnpm makes the same command appear twice, so use only pnpm add -g.

Only sca room who and sca room join (the Realtime features) use Python 3. The Python environment is prepared automatically on first run.

With the installer script (builds from source with Go):

curl -fsSL https://raw.githubusercontent.com/Lapius7/sca-cli/main/install.sh | bash

This needs Go. It checks for Go, builds, explains the install location and PATH, and prepares the Python environment for Realtime. Running go install directly is not supported.

2. Log in

sca login         # sign in to account.lapius7.com (Lapount) in the browser; the session is obtained automatically

That is all you need. You do not write a config file. The installer script prepares the Python environment for the Realtime features, and if you run sca room who or sca room join before that, it is set up on the spot.

Commands

sca whoami                                          # show the logged-in user
sca room list                                       # rooms you created (IDs are shown)
sca room create "chat"                              # create a room (you enter it right after)
sca room rename 5f2e...-uuid "chat2"                # rename (only rooms you created)
sca room delete 5f2e...-uuid                        # delete (only rooms you created, asks first)
sca room who 5f2e...-uuid                           # show who is in the room now
sca room join 5f2e...-uuid                          # join and start interactive chat
sca logout                                          # log out
sca version                                         # show the version

A room is specified by ID only, not by name. chat_rooms is readable by every authenticated user under RLS, so allowing name lookup would let anyone check whether a room exists, find its ID, and enter it just by typing a guessed name. For that reason sca room list shows only the rooms you created, and other people's rooms can be joined only with an ID that the creator passes you with /invite.

During sca room join:

Configuration

Normally you need no configuration. To point the CLI directly at another Supabase instance, write SUPABASE_URL and ANON_KEY in ~/.config/sca/config.env, or set environment variables with the same names. This skips the proxy, so you must give the ANON_KEY of your own instance.

Safety

[!NOTE] The CLI does not talk to supabase.lapius7.com directly. It goes through the reverse proxy https://chatapp.lapius7.com/api/ (implemented in web/chatapp.lapius7.com/proxy/main.go, relaying REST, Auth, and the Realtime WebSocket). Only this proxy adds the ANON_KEY, so neither the Go side nor the Python side of the CLI holds the ANON_KEY. The ANON_KEY is a non-secret value that relies on RLS (it is in the web version's JS bundle as is), so embedding it would be acceptable in a strict sense, but keeping it out of the CLI source removes even that "just in case" risk.

<details> <summary>How <code>sca login</code> works</summary>

sca login starts a temporary local HTTP server on a random port chosen by the OS. It first calls the oauth-connect-token function (action=mint; through sca-proxy, so no ANON_KEY is needed) to issue a one-time token for the redirect target (http://127.0.0.1:<port>/callback). It then prints https://account.lapius7.com/oauth/v2/authorize?token=<token> in the terminal with its expiry. The browser is not opened automatically; you click or copy the link. After you log in through the account.lapius7.com SSO handoff, the token returns to the local server automatically (the same method as CLIs such as gh and aws). The oauth-connect-token call and the /oauth/v2/authorize access go directly to account.lapius7.com and supabase.lapius7.com, not through sca-proxy. The old path /oauth/authorize is redirected with a 302 by account.lapius7.com and still works, but new links are issued with /oauth/v2/authorize. /oauth/v2/authorize is a dedicated path that looks like a common OAuth authorization endpoint; existing services such as chatapp.lapius7.com, post.lapius7.com, and md.lapius7.com share the same entry point and the same token mechanism. The real redirect URL does not appear in the URL; it sits behind a one-time token that expires in 5 minutes.

The port is not fixed (the old implementation used a fixed 8765). With a fixed port, a third party could in theory take that port beforehand, make you open a phishing link that shows only the login confirmation screen, and steal the session (this CLI is open source and its port number is public). account.lapius7.com allows a handoff only to an arbitrary port on 127.0.0.1 as a special case (oauth-connect-token function, sso-handoff function, ssoRedirect.ts) and loosens nothing for other domains.

</details>

Design notes

<details> <summary>Design notes (server side and internals)</summary> </details>

Known limitations

[!NOTE] This README was rewritten from the previous text, and the commands were checked against cli/cmd/sca/main.go. The CLI, the proxy, and the Supabase functions were not run for this rewrite. The proxy and the Supabase functions are outside this repository, so the server-side notes are carried over from the previous README without checking.

Development

Pushing a v* tag runs .github/workflows/release.yml. It publishes to npm and attaches binaries to the GitHub Release, with npm Trusted Publisher authentication (no token). npm/build.mjs builds the npm package.

License

MIT