@oneteam-app/apps-cli 0.1.0-alpha.5 → 0.1.0-alpha.7
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.
- package/CHANGELOG.md +23 -0
- package/README.md +46 -2
- package/dist/index.js +1943 -54
- package/package.json +8 -6
- package/templates/hosted/.dev.vars.example +11 -0
- package/templates/hosted/README.md +119 -0
- package/templates/hosted/_gitignore +11 -0
- package/templates/hosted/index.html +16 -0
- package/templates/hosted/migrations/0001_init.sql +16 -0
- package/templates/hosted/oneteam.app.json +17 -0
- package/templates/hosted/package.json +34 -0
- package/templates/hosted/src/client/App.tsx +276 -0
- package/templates/hosted/src/client/main.tsx +10 -0
- package/templates/hosted/src/client/styles.css +6 -0
- package/templates/hosted/src/shared.ts +22 -0
- package/templates/hosted/src/worker/dev.ts +15 -0
- package/templates/hosted/src/worker/env.d.ts +10 -0
- package/templates/hosted/src/worker/index.test.ts +113 -0
- package/templates/hosted/src/worker/index.ts +121 -0
- package/templates/hosted/src/worker/items.ts +85 -0
- package/templates/hosted/src/worker/jobs.ts +22 -0
- package/templates/hosted/tsconfig.json +16 -0
- package/templates/hosted/tsconfig.worker.json +16 -0
- package/templates/hosted/vite.config.ts +15 -0
- package/templates/hosted/vitest.config.ts +16 -0
- package/templates/hosted/wrangler.jsonc +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @oneteam-app/apps-cli
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.7
|
|
4
|
+
|
|
5
|
+
- **`init --hosted`** starts a hosted app from a template: a Hono Worker with a D1 database and a
|
|
6
|
+
React front end built on `@oneteam-app/ui`.
|
|
7
|
+
- **`login`, `deploy`, `status` and `logs`** for hosted apps. `deploy` builds, checks and uploads
|
|
8
|
+
a version; it goes live once an organisation admin approves it.
|
|
9
|
+
- **`secret list`, `secret set` and `secret remove`.** `secret set NAME --env live|preview` asks
|
|
10
|
+
for the value at a hidden prompt; it is never an argument, never printed and never written to
|
|
11
|
+
disk.
|
|
12
|
+
- **`job list` and `job run`** for scheduled jobs. `status` shows the schedules, and `deploy`
|
|
13
|
+
says what an admin has to approve.
|
|
14
|
+
- `deploy` and `doctor` refuse env files that are not git-ignored, credentials written into the
|
|
15
|
+
code, a schedule without a handler, and sending something the manifest does not list. `doctor`
|
|
16
|
+
also warns about hard-coded colours and raw `<button>` / `<input>` in a hosted app's front end.
|
|
17
|
+
- Depends on `@oneteam-app/apps@0.1.0-alpha.7`.
|
|
18
|
+
|
|
19
|
+
Oneteam's hosting is not open yet: until it is, `deploy` and the commands after it only work
|
|
20
|
+
against the local stand-in.
|
|
21
|
+
|
|
22
|
+
## 0.1.0-alpha.6
|
|
23
|
+
|
|
24
|
+
- Depends on `@oneteam-app/apps@0.1.0-alpha.6`.
|
|
25
|
+
|
|
3
26
|
## 0.1.0-alpha.5
|
|
4
27
|
|
|
5
28
|
- Depends on `@oneteam-app/apps@0.1.0-alpha.5`.
|
package/README.md
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
# @oneteam-app/apps-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Starts, checks and deploys apps for Oneteam.
|
|
4
4
|
|
|
5
5
|
> **Alpha.** Expect changes before 1.0.
|
|
6
6
|
|
|
7
|
+
## Hosted apps (the platform runs the app and signs people in)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @oneteam-app/apps-cli init --hosted "Lost and found"
|
|
11
|
+
cd lost-and-found && npm install && npm run dev
|
|
12
|
+
npx oneteam-apps login # or set ONETEAM_TOKEN
|
|
13
|
+
npx oneteam-apps deploy --organisation <id>
|
|
14
|
+
npx oneteam-apps status
|
|
15
|
+
npx oneteam-apps logs --env preview --hours 2
|
|
16
|
+
npx oneteam-apps secret set SUPABASE_SERVICE_KEY --env preview # asks at a hidden prompt
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Command | Does |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `init --hosted <name>` | Copies the template (Vite + React, a Hono API, D1, permission tests) into a new folder, writes `oneteam.app.json` and the rules coding agents read (`AGENTS.md`, a Cursor rule) |
|
|
22
|
+
| `login` | Signs in through your browser (OAuth with PKCE, as a client it registers itself; the code comes back to `127.0.0.1`). Credentials go to `~/.config/oneteam-apps/credentials.json` (mode 600). `--organisation <id>` remembers the organisation. Not needed with `ONETEAM_TOKEN` (a personal access token) |
|
|
23
|
+
| `deploy` | Runs the project's `build` script, bundles `src/worker/index.ts` into one ES module, packs `worker.js`, `assets/`, `migrations/` and `source/` (what `.gitignore` allows; never `node_modules`, env files or tests), registers the app on the first run and uploads the version. Prints the review: checks, each finding as `SEVERITY file:line` with what is wrong and how to fix it, then "Deploy stopped" (exit code 1) or the preview address and whether it waits for approval (exit code 0). `--json`, `--summary`, `--skip-build`, `--worker`, `--assets` |
|
|
24
|
+
| `status` | Status, addresses, live and preview version, and which secrets still need a value. `--json` |
|
|
25
|
+
| `logs` | Recent errors (with message and stack) and requests. `--env live\|preview`, `--hours`, `--json` |
|
|
26
|
+
| `job list` | The scheduled jobs per environment: what runs when (times in the platform's zone), the next run, how the last one went. `--env`, `--json` |
|
|
27
|
+
| `job run <NAME> --env live\|preview` | Asks for one run now; it starts within a minute. A job run by hand does what it does on its schedule, sending included |
|
|
28
|
+
| `secret list` | Every secret the app declares, per environment: `saved`, `missing` or `unused`, who entered it and when. Never a value. `--env`, `--json` |
|
|
29
|
+
| `secret set <NAME> --env live\|preview` | Asks for the value at a hidden prompt (nothing is echoed), or reads stdin when piped (`op read … \| oneteam-apps secret set NAME --env live`), and saves it for that one environment. There is no `--value` flag and a value given as an argument is refused: it would end up in shell history. The value is not written to disk or printed, and cannot be read back. The name must be listed under `secrets` in `oneteam.app.json` |
|
|
30
|
+
| `secret remove <NAME> --env live\|preview` | Removes the value for that environment |
|
|
31
|
+
| `doctor` | For a hosted app: the Worker uses the hosted adapter, `.gitignore` covers `.dev.vars`, no env file would be committed, no key is written into the code, no secret has a `VITE_` name |
|
|
32
|
+
|
|
33
|
+
`deploy` stops before uploading ("Not uploaded: the app would carry secrets
|
|
34
|
+
with it") when an env file (`.env*`, `.dev.vars*`) is not git-ignored or sits
|
|
35
|
+
in the built front end, when a value from a local env file turns up in the
|
|
36
|
+
Worker, the front end or the source, or when the code contains something
|
|
37
|
+
shaped like a credential. It names the file and line, never the value.
|
|
38
|
+
|
|
39
|
+
`deploy` and `doctor` also hold the Worker against the manifest: a job under
|
|
40
|
+
`schedules` without a handler in `defineJobs()`, a handler without a schedule,
|
|
41
|
+
jobs that nothing puts in front of the Worker (`withJobs`), and `notify()` or
|
|
42
|
+
`sendChatMessage()` without the matching entry under `sends` stop the deploy.
|
|
43
|
+
After a deploy the output lists what an admin has to approve again: a new job,
|
|
44
|
+
one that runs more often or on more days, something new under `sends`.
|
|
45
|
+
|
|
46
|
+
Environment: `ONETEAM_TOKEN`, `ONETEAM_ORGANISATION_ID`, `ONETEAM_API_URL`
|
|
47
|
+
(default `https://api.oneteam.io`; only https, or http on localhost).
|
|
48
|
+
|
|
49
|
+
## Apps you host yourself
|
|
50
|
+
|
|
7
51
|
```bash
|
|
8
52
|
npx @oneteam-app/apps-cli init --url https://your-app.example.com
|
|
9
53
|
npx @oneteam-app/apps-cli validate
|
|
@@ -13,7 +57,7 @@ npx @oneteam-app/apps-cli doctor
|
|
|
13
57
|
| Command | Does |
|
|
14
58
|
|---|---|
|
|
15
59
|
| `init` | Writes `lib/oneteam.ts`, the auth route handler, a deny-by-default `proxy.ts`, `oneteam.app.json`, `.env.example` entries, and the rules coding agents read (`AGENTS.md`, a Cursor rule). Never overwrites existing files without `--force`, and never replaces an existing middleware |
|
|
16
|
-
| `validate` | Checks `oneteam.app.json` against the manifest schema |
|
|
60
|
+
| `validate` | Checks `oneteam.app.json` against the manifest schema (both kinds) |
|
|
17
61
|
| `doctor` | Checks the manifest, environment variables, route protection and that the Oneteam issuer is reachable. Use `--offline` to skip the network check |
|
|
18
62
|
|
|
19
63
|
Non-interactive by design, so AI coding tools can run it.
|