You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add CONTRIBUTING.md and update project documentation
- Introduced a new CONTRIBUTING.md file to guide contributors on local development, project layout, and release processes.
- Updated README to reference the new CONTRIBUTING.md for development setup and project structure.
- Modified package.json to include the repository URL and adjusted publish configuration for npm.
- Enhanced release workflow to support trusted publishing with OIDC for npm.
├── core/ # Core unit tests (appCollector, bundleDiff, buildDocuments)
42
+
└── lib/ # Utility tests (spinner)
43
+
```
44
+
45
+
## Advanced: Firebase and backend configuration
46
+
47
+
Normal installs use Ensemble’s cloud endpoints and a Firebase API key that is **injected at build time** (`npm run build` reads `ENSEMBLE_FIREBASE_API_KEY` via `scripts/inject-env.mjs`). You typically set that only when building or testing the CLI from source.
48
+
49
+
You can override the defaults at **runtime** (forks, custom backends, local integration tests):
|`ENSEMBLE_FIREBASE_PROJECT`|`ensemble-web-studio`| Firestore / Firebase project ID |
54
+
|`ENSEMBLE_AUTH_BASE_URL`|`https://studio.ensembleui.com/sign-in`| Browser sign-in page used by `ensemble login`|
55
+
|`ENSEMBLE_FIREBASE_API_KEY`| Injected placeholder in `dist/`| Firebase Web API key (token refresh, etc.) |
56
+
57
+
If the built-in key is missing or wrong, token refresh may fail with a message to set `ENSEMBLE_FIREBASE_API_KEY`.
58
+
59
+
## Releases
60
+
61
+
GitHub Actions bumps the version, tags, creates a GitHub Release, and publishes `@ensembleui/cli` to **GitHub Packages** and \*\*npm`.
62
+
63
+
**npm: trusted publishing (OIDC)** — Pushes to [registry.npmjs.org](https://www.npmjs.com/) use [trusted publishing](https://docs.npmjs.com/trusted-publishers): short-lived tokens via GitHub OIDC, no `NPM_TOKEN` secret. On npm → **Package** → **Settings** → **Trusted publishing**, add **GitHub Actions** with repository `EnsembleUI/ensemble-cli` and workflow filename **`release.yml`** (must match exactly, including `.yml`). `package.json` must keep a correct [`repository`](https://docs.npmjs.com/trusted-publishers) URL for this repo.
|`GH_PACKAGES_TOKEN`| Publish to GitHub Packages |
70
+
|`ENSEMBLE_FIREBASE_API_KEY`| Used at build time when compiling the CLI |
71
+
72
+
To cut a release: GitHub → **Actions** → **Release (bump version, tag, publish)** → choose `patch`, `minor`, or `major`.
73
+
74
+
## Security notes (maintainers)
75
+
76
+
- GitHub tokens used in `.npmrc` for GitHub Packages must not be committed; use least-privilege scopes (`read:packages` for consumers) and rotate if exposed.
77
+
- Shell and subprocess usage in the CLI (`npm view`, `npm install -g`, `open`/`start`/`xdg-open`) should stay **static string literals** so user input cannot be injected into shells.
Your GitHub token must have at least the `read:packages` scope. Treat this token as a **secret**:
29
-
- Do not commit `.npmrc` to source control.
30
-
- Prefer the minimum required scopes (typically `read:packages`).
31
-
- Rotate the token promptly if you suspect it has been exposed.
32
-
33
-
2.**Install the CLI globally:**
34
-
35
-
```bash
36
-
npm install -g @ensembleui/cli
37
-
```
38
-
39
-
3.**Use the CLI:**
11
+
### Use the CLI
40
12
41
13
```bash
42
14
ensemble login
@@ -50,25 +22,6 @@ ensemble add
50
22
ensemble update
51
23
```
52
24
53
-
### Development setup
54
-
55
-
```bash
56
-
npm install
57
-
npm run build
58
-
npm link # link globally for local development
59
-
```
60
-
61
-
## Releasing (GitHub Packages)
62
-
63
-
This repo uses GitHub Actions to:
64
-
65
-
- bump the version in `package.json`
66
-
- create a git tag (e.g. `v0.1.0`)
67
-
- create a GitHub Release
68
-
- publish `@ensembleui/cli` to GitHub Packages
69
-
70
-
To release a new version, go to GitHub → Actions → run the workflow **Release (bump version, tag, publish)** and choose `patch`, `minor`, or `major`.
71
-
72
25
## Commands
73
26
74
27
| Command | Description |
@@ -201,25 +154,26 @@ Without `-y`, both commands refuse to run when not attached to a TTY and exit wi
201
154
202
155
>**Tip:** In CI, prefer `ensemble push --dry-run` / `ensemble pull --dry-run`in a validation job, and use `-y` only when you are ready to apply changes.
203
156
204
-
## Environment Variables
157
+
## Environment variables
158
+
159
+
For everyday use you do not need to set anything beyond what is described in [CI/CD](#cicd) (`ENSEMBLE_TOKEN` in automation).
|`DEBUG`| Same idea as global `--debug` (truthy values as above). |
167
+
|`CI` / `ENSEMBLE_NO_UPDATE_CHECK`| Truthy values disable the startup “new version available” check (useful in CI or when you want a quiet run). |
168
+
169
+
Firebase project, auth URL, and API key are fixed for the published CLI (the API key is injected when the package is built). You only need to think about those when [developing the CLI](CONTRIBUTING.md#advanced-firebase-and-backend-configuration).
215
170
216
171
## Security considerations
217
172
218
173
- **Secrets and tokens**
219
174
- `ENSEMBLE_TOKEN` (CI token) is a long-lived Firebase refresh token. Store it only in CI secret stores (e.g. GitHub Actions secrets), never insource control or logs.
220
175
- The local auth file at `~/.ensemble/cli-config.json` contains ID tokens and refresh tokens foryour user account. Anyone who can read this file can act as youin the CLI.
221
176
- The CLI now writes `~/.ensemble/cli-config.json` with user-only permissions on POSIX systems (`0700` directory, `0600` file), but you should still treat it as sensitive.
222
-
- GitHub tokens used in`.npmrc` (for GitHub Packages) must not be committed or shared; use least-privilege scopes (`read:packages`) and rotate if exposed.
223
177
- **Auth and authorization model**
224
178
- Authentication is handled via browser sign-in to Ensemble (backed by Firebase). The CLI stores tokens locally and refreshes them via Firebase’s secure token API.
225
179
- Authorization is enforced server-side using Firestore security rules and app-level roles (`write`/`owner`). The CLI passes your Firebase ID token as a Bearer token and does not make its own trust decisions beyond handling HTTP responses.
@@ -230,34 +184,9 @@ Without `-y`, both commands refuse to run when not attached to a TTY and exit wi
230
184
- All shell commands used by the CLI (`npm view`, `npm install -g`, `open`/`start`/`xdg-open`) are static string literals and must remain so to avoid shell injection.
231
185
- Firestore/network debug hooks intentionally avoid logging Authorization headers or raw tokens; custom debug handlers must preserve this invariant.
0 commit comments