horizech
v0.1.4
Published
The Horizech command line: sign in, and build, pack and publish Horizech Workspace components
Maintainers
Readme
horizech
The Horizech command line. One install and one sign-in for every Horizech product; today that means building and publishing Horizech Workspace components.
Documentation: cli.horizech.com
npm install -g horizech
horizech login # sign in with your Horizech Account (opens the browser)
hws pack # build Backend/ + Frontend/ into <CODE>_<version>.zip
hws publish --org acme # check, build, zip and upload to the dev channel
hws promote [email protected] --to stableThe package installs two commands:
horizechis the whole CLI: account commands at the top (horizech login), each product under its own name (horizech hws publish).hwsis a shortcut forhorizech hws, for the people who live in it:hws publishishorizech hws publish. It also answers the account commands, sohws loginworks too.
Without installing: npx horizech hws publish.
The design, its decisions and what is still open live in the Horizech monorepo:
docs/horizech-cli-plan.md.
Requirements
- Node.js 22 or later. On an older Node, the CLI stops with a message saying so.
- .NET SDK for components with a backend, and the frontend's own
npm installalready run (the CLI never installs packages for you).
Commands
Your Horizech Account
| Command | |
|---|---|
| horizech login [--no-browser] | Sign in. --no-browser only prints the link. |
| horizech logout | Sign out and revoke the session. |
| horizech whoami | Who is signed in, and where the session is stored. |
Horizech Workspace (hws … or horizech hws …)
| Command | |
|---|---|
| hws pack [dir] [--out <file>] [--no-build] | Build and zip. No sign-in, no network. |
| hws publish [dir] [--org <slug>] [--channel dev\|beta\|stable] [--notes <text>] [--create [--visibility private\|public]] [--dry-run] [--no-build] | Publish. The channel defaults to dev. |
| hws promote <CODE>@<version> --to beta\|stable [--from dev\|beta] [--org <slug>] | Move a version to a later channel. |
| hws package list [--search <text>] [--type <type>] [--mine] | Packages you can see. |
| hws package info <CODE> [--org <slug>] | One package. |
| hws package versions <CODE> [--org <slug>] [--channel <channel>] | Its versions. |
| hws download <CODE>[@<version>\|@latest] [--org <slug>] [--channel <channel>] [--out <file>] | Fetch a published zip, checked against the registry's SHA-256. |
--jsonon every command prints a machine-readable result on stdout; progress goes to stderr.--orgcan be left out when exactly one organization you can see has a package with that code.--no-buildzips outputs that already exist (Backend/bin/Release/<tfm>/publishandFrontend/dist), for CI where an earlier step built.--dry-rundoes everythingpublishdoes except create and upload, and lists the zip's contents.--createmakes the package if the organization does not have it yet. It is created private unless you pass--visibility public.
Publishing needs the OWNER or ADMIN role in the organization. publish
checks the organization, the package, your role and whether the version is
already in the channel before building, so a mistake costs a second, not
a build.
A Workspace component
my-component/
├── package.hws the manifest
├── Backend/ built with `dotnet publish -c Release`
└── Frontend/ only with a frontend; built with `npm run build:next`, output in Frontend/distA component has a frontend when package.hws names it with
Frontend.RemoteEntry (and Frontend.RemoteName). Most providers and many
plugins have none: their Frontend section is empty or holds only metadata
such as I18nBundles or Actions. Nothing is built for the frontend then,
and a Frontend/ folder, if there is one, is skipped with a note.
The zip holds bin/ (the backend's publish output), dist/ (the frontend
build, when there is one) and package.hws at its root, exactly as the
Workspace launcher and final-build.ps1 expect. The same zip installs by hand
and publishes.
package.hws is checked before anything is built: it must be strictly valid
JSON (no comments, no trailing commas, no duplicate keys, including keys that
differ only in case), with a semantic Version, an AssemblyName ending in
.dll, a MainFile, an Info.Type of Core, App, Plugin, Provider or Theme,
a Frontend.RemoteEntry wherever there is a Frontend.RemoteName, and no
Frontend.RemoteUrlOverride. Every problem is listed in one run.
Sign-in and where the session is kept
horizech login uses OAuth2 with PKCE: your browser signs in to your Horizech
Account and hands control back to the CLI on 127.0.0.1. The session is kept
in the macOS Keychain, Windows Credential Manager or the Linux secret service
(service name horizech). Where none is available it falls back to a file
readable only by you, and says so. Tokens refresh by themselves; the CLI never
prints them.
Environment
| Variable | |
|---|---|
| HORIZECH_API_URL | horizech-api (default https://api.horizech.com) |
| HORIZECH_AUTH_URL | identity provider (default https://horizech.com) |
| HORIZECH_CLIENT_ID | OAuth2 client id, for testing against another provider |
| HORIZECH_TOKEN_STORE=file | skip the keychain and use the file |
| HORIZECH_CONFIG_DIR | where that file lives (default ~/.config/horizech, %APPDATA%\horizech on Windows) |
Releasing
- Bump
versioninpackage.jsonand add the release toCHANGELOG.md. npm publish(the tests run first), then tag:git tag -a v<version> -m "horizech <version> (npm)".- Update the docs at cli.horizech.com: add the version to
VERSIONSandCHANGELOGinapps/cli/lib/docs/versions.tsin the Horizech monorepo, document any new command or option inlib/docs/commands.tswith asince, and redeploy that site.
Developing
nvm use # Node 22
npm install
npm test # builds, then runs unit tests and the end-to-end tests
node bin/horizech.js --help
node bin/hws.js --helpThe end-to-end tests (src/cli/cli.test.ts) run the real CLI against a local
stub of the identity provider and the registry. The stub enforces PKCE, the
redirect binding, rotating refresh tokens and organization roles, so a test
passes only when the CLI really does them.
src/core holds everything that does the work and never writes to the
terminal; src/cli parses arguments and prints. A CI script or an editor
extension can import src/core directly. A new product gets its own command
group in src/cli/main.ts beside HWS, and reuses the session as it is.
