siteward 0.1.0 → 0.1.2
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/README.md +58 -11
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,72 @@
|
|
|
1
1
|
# siteward
|
|
2
2
|
|
|
3
|
-
Add, list and remove Siteward monitors from the terminal. How many monitors you can have follows your plan.
|
|
3
|
+
Add, list and remove [Siteward](https://github.com/sholajegede/siteward) monitors from the terminal. How many monitors you can have follows your plan.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
npm install -g siteward
|
|
7
|
-
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
You need Node.js 20 or later. To run it once without installing, use `npx siteward`.
|
|
12
|
+
|
|
13
|
+
## Start
|
|
14
|
+
|
|
15
|
+
This tool talks to a Siteward server. You deploy that server yourself, from the [repository](https://github.com/sholajegede/siteward), or use the address of one that you have an account on.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
siteward login --url https://<your-siteward-server>
|
|
8
19
|
siteward add https://example.com "Example"
|
|
9
20
|
siteward list
|
|
10
21
|
```
|
|
11
22
|
|
|
12
|
-
`login` opens your browser and signs you in through Kinde. The tool
|
|
23
|
+
`login` opens your browser and signs you in through Kinde. The tool never sees your password.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
13
26
|
|
|
14
27
|
| Command | What it does |
|
|
15
28
|
| --- | --- |
|
|
16
|
-
| `siteward login [org_code] --url <address>` | Sign in through the browser |
|
|
17
|
-
| `siteward logout` | Delete the stored token |
|
|
18
|
-
| `siteward whoami` | Show the organization and when the sign-in ends |
|
|
19
|
-
| `siteward list` | Show monitors, their state and your plan limit |
|
|
20
|
-
| `siteward add <url> [name]` | Add a monitor. A plan at its limit answers with an error |
|
|
21
|
-
| `siteward remove <id>` | Remove a monitor |
|
|
29
|
+
| `siteward login [org_code] --url <address>` | Sign in through the browser. Pass an organization code to choose one. |
|
|
30
|
+
| `siteward logout` | Delete the stored token. |
|
|
31
|
+
| `siteward whoami` | Show the organization, the server and when the sign-in ends. |
|
|
32
|
+
| `siteward list` | Show monitors, their state and your plan limit. |
|
|
33
|
+
| `siteward add <url> [name]` | Add a monitor. A plan at its limit answers with an error. |
|
|
34
|
+
| `siteward remove <id>` | Remove a monitor. |
|
|
35
|
+
|
|
36
|
+
The address of the server is saved after `login`, so later commands need no `--url`.
|
|
37
|
+
|
|
38
|
+
## Monitor states
|
|
39
|
+
|
|
40
|
+
| State | Meaning |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `active` | The monitor runs. |
|
|
43
|
+
| `paused_plan` | Your plan allows fewer monitors than you have. The newest monitors pause first, and they resume when the limit rises. |
|
|
44
|
+
| `paused_user` | You paused it. A plan change does not resume it. |
|
|
45
|
+
|
|
46
|
+
## Sign-in and storage
|
|
47
|
+
|
|
48
|
+
- The tool signs in with OAuth 2.0 and PKCE. It listens on `http://localhost:8976/callback` for the answer, so that address must be an allowed callback URL in your Kinde application.
|
|
49
|
+
- The access token is saved in `~/.config/siteward/credentials.json` (or under `$XDG_CONFIG_HOME`), readable only by you.
|
|
50
|
+
- A token lasts 24 hours. After that, run `siteward login` again. `siteward logout` deletes the file at once.
|
|
51
|
+
|
|
52
|
+
## Use it in scripts
|
|
53
|
+
|
|
54
|
+
Set two variables and skip `login`:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
export SITEWARD_URL=https://<your-siteward-server>
|
|
58
|
+
export SITEWARD_TOKEN=<Kinde access token>
|
|
59
|
+
siteward list
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Errors
|
|
63
|
+
|
|
64
|
+
| Message | What to do |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `Your plan allows N monitors.` | Remove a monitor or upgrade the plan. |
|
|
67
|
+
| `Sign in again.` | The token expired. Run `siteward login`. |
|
|
68
|
+
| `Pass the address of your Siteward` | Add `--url https://<your-siteward-server>` to `login`. |
|
|
22
69
|
|
|
23
|
-
|
|
70
|
+
## License
|
|
24
71
|
|
|
25
|
-
MIT
|
|
72
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -125,7 +125,7 @@ try {
|
|
|
125
125
|
}
|
|
126
126
|
else if (command === "list") {
|
|
127
127
|
const { limits, monitors } = await call("GET", "/api/monitors");
|
|
128
|
-
console.log(`${monitors.length} of ${limits
|
|
128
|
+
console.log(`${monitors.length} of ${limits ? limits.monitors ?? "unlimited" : "an unknown number of"} monitors`);
|
|
129
129
|
for (const m of monitors)
|
|
130
130
|
console.log(`${m.status.padEnd(12)} ${m.name.padEnd(24)} ${m.url} ${m.id}`);
|
|
131
131
|
}
|