@azx-pbc/helix-cli 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +87 -12
  2. package/dist/helix.js +918 -182
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -66,19 +66,78 @@ helix deploy [--dir <dir>] [--bundle <zip>] [--promote] # upload a version
66
66
  helix versions # list versions
67
67
  helix promote <number> # make a version live
68
68
  helix rollback [number] # revert the live pointer
69
+ helix capabilities [--json] # what this deployment offers
69
70
  helix skill [--path <file>] # write this deployment's agent skill to disk
71
+ helix ci init [--repo <owner/name>] [--branch <b>] [--reusable] [--force] # deploy from GitHub Actions
72
+ helix ci show | helix ci remove # the app's repo binding
70
73
  ```
71
74
 
72
75
  `deploy` uploads the bundle as a **preview**; `--promote` flips it live in the
73
76
  same step (architecture §5.1). `visibility` is `internal | group:<id>[,<id>…] | password
74
77
  | public`.
75
78
 
76
- `helix skill` fetches this deployment's rendered agent skill (`GET /api/v1/skill`,
77
- ADR-0036) — the same document the portal's **How to develop** modal hands out, with
78
- this deployment's hosts, servable models, and approval baselines already substituted
79
- in. It needs no app slug or `helix.json`, only a portal URL and a token. Defaults to
80
- `./SKILL.md`; `--path .claude/skills/helix/SKILL.md` drops it where a Claude Code
81
- agent reads it off disk.
79
+ `helix capabilities` prints the deployment capability catalogue
80
+ (`GET /api/v1/capabilities`, ADR-0036) in readable form:
81
+
82
+ - servable models;
83
+ - approval baselines;
84
+ - named connections and OAuth providers;
85
+ - visibility modes;
86
+ - deploy caps;
87
+ - the dev gateway;
88
+ - which requests queue for an admin.
89
+
90
+ `--json` prints the raw catalogue. If the portal sends a shape this CLI can't
91
+ format, it prints the JSON instead of failing.
92
+
93
+ `helix skill` fetches this deployment's rendered agent skill (`GET /api/v1/skill`).
94
+ It is the same document the portal's **How to develop** modal hands out: this
95
+ deployment's hosts, plus pointers to `helix capabilities` and the public docs.
96
+
97
+ Neither command needs an app slug or `helix.json`, only a portal URL and a token.
98
+ `helix skill` writes `./SKILL.md` by default; `--path .claude/skills/helix/SKILL.md`
99
+ puts it where a Claude Code agent reads it from disk.
100
+
101
+ ### Compatibility with the portal
102
+
103
+ Every command except `logout` first reads the public `GET /api/v1/config`. If
104
+ the portal states a `cli.minVersion` newer than this CLI, the CLI prints a
105
+ warning to stderr suggesting `@latest`. The warning never fails the command.
106
+
107
+ A 404 from a missing _route_ (the portal's not-found handler, as opposed to "app
108
+ not found") means the portal is older than the CLI, and the error says so. The
109
+ floor is `MIN_CLI_VERSION` in `@azx-pbc/shared`. Bump it by hand when the portal
110
+ removes or changes something an older CLI relies on (ADR-0052).
111
+
112
+ ### Deploying from GitHub Actions
113
+
114
+ `helix ci init`, run signed in from the app's directory in its repo checkout,
115
+ connects the app to the repo and branch. The repo comes from `origin`; the
116
+ branch is the remote's default branch. `--repo` and `--branch` override either.
117
+ It then writes `.github/workflows/helix-deploy.yml` and merges `slug`,
118
+ `portalUrl` and `dir` into `helix.json`, or into a legacy `azx.json` if that's
119
+ the file in use. Commit both. Each push to the branch then lands a preview
120
+ (ADR-0051). Re-running it keeps any environment or workflow limit set on the
121
+ Repository tab, and refuses to replace a workflow pin unless you pass `--force`.
122
+
123
+ The generated workflow has two jobs. `build` installs and builds with no
124
+ `id-token` permission. `deploy` downloads the output and runs only the pinned
125
+ CLI. Code from the repo or its dependencies never runs where it could mint a
126
+ deploy token.
127
+
128
+ The workflow needs no secret. Inside GitHub Actions, when `HELIX_TOKEN` is not
129
+ set and the job has `permissions: id-token: write`, `helix deploy` asks GitHub
130
+ for an OIDC token whose audience is the portal (read from `GET /api/v1/config`)
131
+ and uploads to `POST /api/v1/apps/:slug/ci/versions`. CI deploys always land as
132
+ a preview, so `--promote` is refused there. It refuses to send the token to a
133
+ plain-`http` portal other than one on `localhost`.
134
+
135
+ `--reusable` writes a caller of the public reusable workflow
136
+ (`AZX-PBC-OSS/helix-actions`, source in `integrations/helix-actions/`) instead
137
+ of a self-contained one. It also pins the binding to that workflow, so no other
138
+ workflow on the branch can deploy. `helix ci show` prints the binding,
139
+ including the repo ids pinned by the first deploy. `helix ci remove` disconnects
140
+ the app.
82
141
 
83
142
  > **Breaking in 0.2.0:** the `private` visibility mode was renamed to `internal`.
84
143
  > It never checked _which_ user signed in, only that someone had. Passing the old
@@ -91,9 +150,11 @@ agent reads it off disk.
91
150
  Two paths, in precedence order:
92
151
 
93
152
  1. **Static token** — `HELIX_TOKEN` / `--token`. Sends the value as a bearer
94
- token verbatim. This is the CI/scripts path, and also how the portal's
95
- dev-token stub keeps working (`HELIX_TOKEN=$PORTAL_DEV_TOKEN`). It is never
96
- accepted by a production portal.
153
+ token verbatim. This is the local scripts path, and also how the portal's
154
+ dev-token stub keeps working (`HELIX_TOKEN=$PORTAL_DEV_TOKEN`). The dev token
155
+ is never accepted by a production portal. A stored token is not a supported
156
+ way to deploy from CI; repo-backed deploys use the workflow's GitHub Actions
157
+ OIDC token instead (ADR-0051).
97
158
  2. **`helix login`** — the OIDC device flow. The CLI asks the portal
98
159
  (`GET /api/v1/auth/config`) which issuer to use (the local dev IdP on
99
160
  `:3002` in dev; Entra later), prints a verification URL + code, and polls
@@ -104,15 +165,29 @@ Two paths, in precedence order:
104
165
 
105
166
  ## Running it
106
167
 
107
- ### Installed from npm
168
+ ### From npm
169
+
170
+ App authors and agents run it with `npx`, so it is always the current release
171
+ and there is nothing to keep updated (ADR-0052):
108
172
 
109
173
  ```bash
110
- npm i -g @azx-pbc/helix-cli
111
174
  cd my-app
112
- export HELIX_TOKEN="…"
175
+ npx -y @azx-pbc/helix-cli@latest deploy --promote
176
+ ```
177
+
178
+ Write `@latest` explicitly, because a bare package name lets `npx` reuse a copy
179
+ it cached earlier. `-y` skips the install prompt.
180
+
181
+ To install it once instead:
182
+
183
+ ```bash
184
+ npm i -g @azx-pbc/helix-cli # update with: npm i -g @azx-pbc/helix-cli@latest
113
185
  helix deploy --promote
114
186
  ```
115
187
 
188
+ CI workflows pin an exact version; `helix ci init` writes the one it was run
189
+ with.
190
+
116
191
  Needs **Node 22.12+** (or 24+). The engines range and the bundle's esbuild
117
192
  target move together (see `scripts/build.mjs`), so the declared floor is real:
118
193
  older runtimes may not merely warn, they may fail to parse it.