jaypost 0.6.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # jaypost
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 333dedb: One-line install for the standalone binary: `curl -fsSL https://unpkg.com/jaypost/install.sh | sh` picks the binary for your OS and CPU, checks it against `SHA256SUMS`, puts it in `~/.local/bin` and runs `jaypost init`. The website serves the same script at `https://bithyte.github.io/jaypost/install.sh`.
8
+
9
+ ### Patch Changes
10
+
11
+ - b299efa: Fixed the standalone binary failing every Telegram call, so `jaypost init` rejected any bot token. Also silenced the `url.parse()` deprecation warning (DEP0169) it printed on the first Telegram request.
12
+
3
13
  ## 0.6.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -429,7 +429,7 @@ Attachments need a service at least as new as this release; an older one ignores
429
429
 
430
430
  ### OpenAPI spec
431
431
 
432
- The API is described in OpenAPI 3.1: [`docs/openapi.yaml`](docs/openapi.yaml) (port 8787, Telegram's text limit), `GET /openapi.yaml` on a running service, or `jaypost openapi [FILE]`. The last two use the install's port and its provider's text limit. Regenerate the docs copy with `npm run openapi`.
432
+ The API is described in OpenAPI 3.1: [`docs/openapi.yaml`](docs/openapi.yaml) (port 8787, Telegram's text limit), `GET /openapi.yaml` on a running service, or `jaypost openapi [FILE]`. The last two use the install's port and its provider's text limit. Regenerate the docs copy with `vp run openapi`.
433
433
 
434
434
  ## Install options
435
435
 
@@ -446,21 +446,29 @@ Node 24+ is needed for `npx` and the systemd and launchd targets unless you use
446
446
 
447
447
  ### Standalone binary
448
448
 
449
- Each GitHub Release has a single-file binary for Linux and macOS, so you can skip Node:
449
+ Each GitHub Release has a single-file binary for Linux and macOS (x64 and arm64), so you can skip Node:
450
450
 
451
451
  ```
452
- curl -L https://github.com/bithyte/jaypost/releases/latest/download/jaypost-linux-x64.gz | gunzip > jaypost && chmod +x jaypost && ./jaypost init systemd
452
+ curl -fsSL https://unpkg.com/jaypost/install.sh | sh
453
453
  ```
454
454
 
455
- On macOS (Apple silicon):
455
+ The same script is on the website too:
456
456
 
457
457
  ```
458
- curl -L https://github.com/bithyte/jaypost/releases/latest/download/jaypost-darwin-arm64.gz | gunzip > jaypost && chmod +x jaypost && ./jaypost init launchd
458
+ curl -fsSL https://bithyte.github.io/jaypost/install.sh | sh
459
+ ```
460
+
461
+ It picks the binary for your OS and CPU, checks it against the release's `SHA256SUMS`, puts it in `~/.local/bin/jaypost` and runs `jaypost init`. Right after a release the binaries can take a few minutes to upload; the script says so if it gets there first.
462
+
463
+ To do it by hand, download `jaypost-<linux|darwin>-<x64|arm64>.gz` from the [latest release](https://github.com/bithyte/jaypost/releases/latest), then:
464
+
465
+ ```
466
+ gunzip jaypost-linux-x64.gz && mv jaypost-linux-x64 jaypost && chmod +x jaypost && ./jaypost init
459
467
  ```
460
468
 
461
469
  If you downloaded the binary with a browser instead of curl, macOS may block it; run `xattr -d com.apple.quarantine jaypost` first.
462
470
 
463
- `init` copies the binary to `~/.local/bin/jaypost` and runs the service from there. `SHA256SUMS` on the release lists the checksums.
471
+ `init` copies the binary to `~/.local/bin/jaypost` and runs the service from there.
464
472
 
465
473
  The API token file `~/.config/jaypost/token` is written for every target; the service's own copy goes in the target's `.env` or in `config.json` as listed below. All targets keep their files under `~/.config/jaypost/` (or `$XDG_CONFIG_HOME/jaypost/`). `install.json` there records which target is installed, its port and version. It's what `status`, `reset-owner` and `uninstall` read.
466
474
 
@@ -677,10 +685,10 @@ The [question log](#question-log) keeps question text and answers on disk (mode
677
685
 
678
686
  ## Releasing
679
687
 
680
- When a change matters to users, run `npm run changeset` on its branch, pick patch, minor or major, write a line or two for the changelog, and commit the generated `.changeset/*.md` file with the change. Internal changes (refactors, tests, docs) don't need one.
688
+ When a change matters to users, run `vp run changeset` on its branch, pick patch, minor or major, write a line or two for the changelog, and commit the generated `.changeset/*.md` file with the change. Internal changes (refactors, tests, docs) don't need one.
681
689
 
682
690
  After a PR with a changeset is merged into `main`, the `publish` workflow opens or updates a `chore: release` PR that bumps the version, writes `CHANGELOG.md` and regenerates `docs/openapi.yaml`. Merging that PR is the release: the workflow runs the checks and tests, publishes to npm, pushes the `vX.Y.Z` tag and creates the GitHub Release. Nothing needs to be run locally.
683
691
 
684
692
  The same workflow builds the standalone binaries: Linux on Ubuntu, macOS on a macOS runner (ad-hoc codesigned). One last job gzips them and attaches the four `.gz` files and a `SHA256SUMS` to the GitHub Release.
685
693
 
686
- The website in `site/` deploys to `https://bithyte.github.io/jaypost/` after each release, as the last job of `publish`. To deploy by hand (the first time, or for a site-only fix), run the `site` workflow from the Actions tab; it builds whichever ref you pick. For local work, run `npm --prefix site ci` once, then `npm run web:dev`. One-time setup: Settings, Pages, Source: GitHub Actions. To run it from a release tag, add a `v*` tag rule to the `github-pages` environment, which only allows `main` by default.
694
+ The website in `site/` deploys to `https://bithyte.github.io/jaypost/` after each release, as the last job of `publish`. To deploy by hand (the first time, or for a site-only fix), run the `site` workflow from the Actions tab; it builds whichever ref you pick. For local work, `vp install` at the root installs the site too, then run `vp run web:dev`. One-time setup: Settings, Pages, Source: GitHub Actions. To run it from a release tag, add a `v*` tag rule to the `github-pages` environment, which only allows `main` by default.
package/dist/cli.js CHANGED
@@ -209,7 +209,7 @@ function toEntry(asked, settled, now) {
209
209
  //#endregion
210
210
  //#region src/config/constants.ts
211
211
  /** Package version, read from package.json when the module loads. */
212
- const VERSION = "0.6.0";
212
+ const VERSION = "0.7.0";
213
213
  /** Port used when neither the env nor the config file sets one. */
214
214
  const DEFAULT_PORT = 8787;
215
215
  /** Appended to config errors so the user knows how to fix them. */
package/install.sh ADDED
@@ -0,0 +1,69 @@
1
+ #!/bin/sh
2
+ # Installs the jaypost standalone binary to ~/.local/bin, then runs `jaypost init`.
3
+ # Usage: curl -fsSL https://unpkg.com/jaypost/install.sh | sh
4
+ # JAYPOST_RELEASE_URL overrides where the binaries come from (tests use it).
5
+ set -eu
6
+
7
+ release_url="${JAYPOST_RELEASE_URL:-https://github.com/bithyte/jaypost/releases/latest/download}"
8
+ bin_dir="$HOME/.local/bin"
9
+
10
+ fail() {
11
+ echo "jaypost install: $1" >&2
12
+ exit 1
13
+ }
14
+
15
+ case "$(uname -s)" in
16
+ Linux) os=linux ;;
17
+ Darwin) os=darwin ;;
18
+ *) fail "no binary for $(uname -s); use npx jaypost init instead (needs Node 24+)" ;;
19
+ esac
20
+
21
+ case "$(uname -m)" in
22
+ x86_64 | amd64) arch=x64 ;;
23
+ aarch64 | arm64) arch=arm64 ;;
24
+ *) fail "no binary for $(uname -m); use npx jaypost init instead (needs Node 24+)" ;;
25
+ esac
26
+
27
+ # A shell running under Rosetta reports x86_64 on Apple silicon; the native binary is better
28
+ if [ "$os" = darwin ] && [ "$arch" = x64 ] && [ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = 1 ]; then
29
+ arch=arm64
30
+ fi
31
+
32
+ if command -v sha256sum >/dev/null 2>&1; then
33
+ hash_file() { sha256sum "$1" | cut -d' ' -f1; }
34
+ elif command -v shasum >/dev/null 2>&1; then
35
+ hash_file() { shasum -a 256 "$1" | cut -d' ' -f1; }
36
+ else
37
+ fail "needs sha256sum or shasum to check the download"
38
+ fi
39
+
40
+ asset="jaypost-$os-$arch.gz"
41
+ temp_dir=$(mktemp -d)
42
+ trap 'rm -rf "$temp_dir" "$bin_dir/jaypost.$$.tmp"' EXIT
43
+
44
+ echo "Downloading $asset"
45
+ for file in "$asset" SHA256SUMS; do
46
+ if ! curl -fsSL -o "$temp_dir/$file" "$release_url/$file"; then
47
+ fail "couldn't download $release_url/$file; if a release just came out, its binaries may still be uploading, so try again in a few minutes"
48
+ fi
49
+ done
50
+
51
+ expected=$(awk -v name="$asset" '$2 == name { print $1 }' "$temp_dir/SHA256SUMS")
52
+ actual=$(hash_file "$temp_dir/$asset")
53
+ if [ -z "$expected" ] || [ "$expected" != "$actual" ]; then
54
+ fail "checksum of $asset doesn't match SHA256SUMS"
55
+ fi
56
+
57
+ # Unpack next to the target and rename, so a running copy is never half-written
58
+ mkdir -p "$bin_dir"
59
+ gunzip -c "$temp_dir/$asset" >"$bin_dir/jaypost.$$.tmp"
60
+ chmod +x "$bin_dir/jaypost.$$.tmp"
61
+ mv -f "$bin_dir/jaypost.$$.tmp" "$bin_dir/jaypost"
62
+ echo "Installed $bin_dir/jaypost"
63
+
64
+ # stdin is this script when piped from curl, so init's prompts need the terminal
65
+ if ! (: </dev/tty) 2>/dev/null; then
66
+ echo "No terminal to set it up from; run $bin_dir/jaypost init"
67
+ exit 0
68
+ fi
69
+ "$bin_dir/jaypost" init </dev/tty
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaypost",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Local HTTP API that asks you a question on Telegram or Discord with buttons and returns your answer",
5
5
  "keywords": [
6
6
  "approval",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "CHANGELOG.md"
23
+ "CHANGELOG.md",
24
+ "install.sh"
24
25
  ],
25
26
  "type": "module",
26
27
  "exports": {
@@ -36,21 +37,6 @@
36
37
  },
37
38
  "./package.json": "./package.json"
38
39
  },
39
- "scripts": {
40
- "start": "node src/cli.ts start",
41
- "cli": "node src/cli.ts",
42
- "test": "vp test",
43
- "check": "vp check",
44
- "build": "tsc -p tsconfig.build.json && vp pack",
45
- "build:exe": "node scripts/build-exe.ts",
46
- "openapi": "node scripts/openapi.ts",
47
- "changeset": "changeset",
48
- "version-packages": "changeset version && npm install --package-lock-only && npm run openapi",
49
- "prepack": "npm run build",
50
- "web:dev": "npm --prefix site run dev",
51
- "web:build": "npm --prefix site run build",
52
- "web:preview": "npm --prefix site run preview"
53
- },
54
40
  "dependencies": {
55
41
  "@clack/prompts": "^1.8.1",
56
42
  "@discordjs/core": "^2.6.0",
@@ -72,5 +58,19 @@
72
58
  },
73
59
  "engines": {
74
60
  "node": ">=24.2"
61
+ },
62
+ "scripts": {
63
+ "start": "node src/cli.ts start",
64
+ "cli": "node src/cli.ts",
65
+ "test": "vp test",
66
+ "check": "vp check",
67
+ "build": "tsc -p tsconfig.build.json && vp pack",
68
+ "build:exe": "node scripts/build-exe.ts",
69
+ "openapi": "node scripts/openapi.ts",
70
+ "changeset": "changeset",
71
+ "version-packages": "changeset version && vp install --lockfile-only && vp run openapi",
72
+ "web:dev": "vp run --filter jaypost-site dev",
73
+ "web:build": "vp run --filter jaypost-site build",
74
+ "web:preview": "vp run --filter jaypost-site preview"
75
75
  }
76
- }
76
+ }