@goliapkg/sentori-cli 0.5.1 → 0.5.3

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 ADDED
@@ -0,0 +1,56 @@
1
+ # @goliapkg/sentori-cli
2
+
3
+ Thin npm wrapper around the [Sentori](https://sentori.golia.jp) Rust CLI. The package downloads the prebuilt binary for your platform on `npm install` (postinstall hook) so `npx @goliapkg/sentori-cli` works the moment you have it in `package.json`.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install -D @goliapkg/sentori-cli
9
+ # or pnpm / yarn
10
+
11
+ npx @goliapkg/sentori-cli upload sourcemap \
12
+ --release myapp@1.2.3+456 \
13
+ --token st_pk_... \
14
+ --ingest-url https://ingest.sentori.your-host.com \
15
+ dist/bundle.js.map
16
+ ```
17
+
18
+ ### Using bun
19
+
20
+ Bun blocks postinstall scripts by default. After `bun add`, run:
21
+
22
+ ```sh
23
+ bun pm trust @goliapkg/sentori-cli
24
+ ```
25
+
26
+ once to allow the binary download, or use `bun add --trust @goliapkg/sentori-cli` from the start.
27
+
28
+ Supported platforms:
29
+
30
+ | OS | Arch |
31
+ |----|------|
32
+ | Linux | x64, arm64 |
33
+ | macOS | x64 (Intel), arm64 (Apple Silicon) |
34
+
35
+ If your platform isn't covered, the postinstall hook will print a soft warning and you can fall back to:
36
+
37
+ ```sh
38
+ cargo install --git https://github.com/goliajp/sentori --bin sentori-cli
39
+ ```
40
+
41
+ ## Skipping postinstall
42
+
43
+ `SENTORI_SKIP_DOWNLOAD=1` skips the binary download — useful in monorepo bootstrap or sandbox CI environments where the binary will be vendored separately.
44
+
45
+ ## Verifying the binary
46
+
47
+ Each release artifact ships with a `.sha256` sidecar published next to the `.tar.gz` on the GitHub Release page; the postinstall script downloads only the tarball but you can manually verify:
48
+
49
+ ```sh
50
+ curl -L https://github.com/goliajp/sentori/releases/download/cli-v<VERSION>/sentori-cli-cli-v<VERSION>-darwin-arm64.tar.gz.sha256
51
+ ```
52
+
53
+ ## License
54
+
55
+ Dual-licensed under [Apache-2.0](../../LICENSE-APACHE) OR
56
+ [MIT](../../LICENSE-MIT).
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ // Phase 17 sub-B: Node entry point for `npx @goliapkg/sentori-cli ...`.
3
+ // Forwards argv + stdio to the prebuilt Rust binary that postinstall
4
+ // dropped at ../vendor/sentori-cli.
5
+
6
+ 'use strict'
7
+
8
+ const path = require('node:path')
9
+ const fs = require('node:fs')
10
+ const { spawn } = require('node:child_process')
11
+
12
+ const bin = path.join(__dirname, '..', 'vendor', 'sentori-cli')
13
+ if (!fs.existsSync(bin)) {
14
+ console.error(
15
+ 'sentori-cli binary missing — postinstall did not complete. ' +
16
+ 'Try: `npm rebuild @goliapkg/sentori-cli` or set SENTORI_SKIP_DOWNLOAD=0 then reinstall.'
17
+ )
18
+ process.exit(127)
19
+ }
20
+
21
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' })
22
+ child.on('exit', (code, signal) => {
23
+ if (signal) {
24
+ process.kill(process.pid, signal)
25
+ } else {
26
+ process.exit(code ?? 1)
27
+ }
28
+ })
29
+ child.on('error', (e) => {
30
+ console.error('failed to run sentori-cli:', e.message)
31
+ process.exit(1)
32
+ })
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@goliapkg/sentori-cli",
3
- "version": "0.5.1",
4
- "description": "Sentori CLI \u2014 upload source maps so dashboard stack traces resolve to your original source.",
3
+ "version": "0.5.3",
4
+ "description": "Sentori CLI upload source maps + other release artifacts to a Sentori server. Thin wrapper that downloads the matching prebuilt Rust binary at install time.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sentori.golia.jp",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/goliajp/sentori.git",
10
- "directory": "sdk/cli"
10
+ "directory": "cli/npm"
11
11
  },
12
12
  "bugs": {
13
13
  "url": "https://github.com/goliajp/sentori/issues"
@@ -15,34 +15,25 @@
15
15
  "keywords": [
16
16
  "sentori",
17
17
  "cli",
18
- "sourcemaps",
18
+ "sourcemap",
19
19
  "error-tracking"
20
20
  ],
21
- "type": "module",
22
21
  "bin": {
23
- "sentori-cli": "./lib/index.js"
22
+ "sentori-cli": "bin/sentori-cli.js"
23
+ },
24
+ "scripts": {
25
+ "postinstall": "node scripts/postinstall.js || echo 'sentori-cli postinstall failed — run `npx @goliapkg/sentori-cli` once you have network'"
24
26
  },
25
- "main": "./lib/index.js",
26
- "types": "./lib/index.d.ts",
27
27
  "files": [
28
- "lib/",
29
- "src/",
28
+ "bin/",
29
+ "scripts/",
30
30
  "README.md"
31
31
  ],
32
32
  "engines": {
33
33
  "node": ">=18"
34
34
  },
35
- "scripts": {
36
- "build": "tsc -p tsconfig.json",
37
- "typecheck": "tsc --noEmit",
38
- "test": "bun test",
39
- "prepack": "bun run build"
40
- },
41
- "devDependencies": {
42
- "@types/bun": "latest",
43
- "@types/node": "*",
44
- "typescript": "^6"
45
- },
35
+ "os": ["darwin", "linux"],
36
+ "cpu": ["x64", "arm64"],
46
37
  "publishConfig": {
47
38
  "access": "public"
48
39
  }
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ // Phase 17 sub-B: download the prebuilt sentori-cli binary that
3
+ // matches the current platform / arch and place it at ../vendor/.
4
+ //
5
+ // Skips if SENTORI_SKIP_DOWNLOAD=1 (CI, monorepo bootstrap, etc.).
6
+
7
+ 'use strict'
8
+
9
+ const fs = require('node:fs')
10
+ const https = require('node:https')
11
+ const path = require('node:path')
12
+ const { spawnSync } = require('node:child_process')
13
+
14
+ const pkg = require(path.join(__dirname, '..', 'package.json'))
15
+ const TAG = `cli-v${pkg.version}`
16
+
17
+ const SUPPORTED = {
18
+ 'linux-x64': 'linux-x64',
19
+ 'linux-arm64': 'linux-arm64',
20
+ 'darwin-x64': 'darwin-x64',
21
+ 'darwin-arm64': 'darwin-arm64',
22
+ }
23
+
24
+ function detect() {
25
+ return `${process.platform}-${process.arch}`
26
+ }
27
+
28
+ function fetch(url, destStream) {
29
+ return new Promise((resolve, reject) => {
30
+ const handle = (u) => {
31
+ https
32
+ .get(u, { headers: { 'user-agent': `sentori-cli-installer/${pkg.version}` } }, (res) => {
33
+ const code = res.statusCode || 0
34
+ if (code >= 300 && code < 400 && res.headers.location) {
35
+ return handle(res.headers.location)
36
+ }
37
+ if (code !== 200) {
38
+ return reject(new Error(`HTTP ${code} from ${u}`))
39
+ }
40
+ res.pipe(destStream)
41
+ destStream.on('finish', resolve)
42
+ destStream.on('error', reject)
43
+ })
44
+ .on('error', reject)
45
+ }
46
+ handle(url)
47
+ })
48
+ }
49
+
50
+ async function main() {
51
+ if (process.env.SENTORI_SKIP_DOWNLOAD === '1') {
52
+ console.log('SENTORI_SKIP_DOWNLOAD=1; skipping sentori-cli binary download')
53
+ return
54
+ }
55
+
56
+ const key = detect()
57
+ const slug = SUPPORTED[key]
58
+ if (!slug) {
59
+ console.error(
60
+ `sentori-cli has no prebuilt binary for ${key}. ` +
61
+ `Cargo install instead: cargo install --git https://github.com/goliajp/sentori --bin sentori-cli`
62
+ )
63
+ process.exit(0) // soft fail — user can still cargo install
64
+ }
65
+
66
+ const filename = `sentori-cli-${TAG}-${slug}.tar.gz`
67
+ const url = `https://github.com/goliajp/sentori/releases/download/${TAG}/${filename}`
68
+ const vendorDir = path.join(__dirname, '..', 'vendor')
69
+ fs.mkdirSync(vendorDir, { recursive: true })
70
+ const tarball = path.join(vendorDir, 'sentori-cli.tar.gz')
71
+
72
+ console.log(`sentori-cli ${pkg.version}: downloading ${slug} from GitHub Release`)
73
+ await fetch(url, fs.createWriteStream(tarball))
74
+
75
+ const tar = spawnSync('tar', ['-xzf', tarball, '-C', vendorDir], { stdio: 'inherit' })
76
+ if (tar.status !== 0) {
77
+ console.error('tar -xzf failed; is `tar` on PATH?')
78
+ process.exit(1)
79
+ }
80
+ fs.unlinkSync(tarball)
81
+
82
+ const bin = path.join(vendorDir, 'sentori-cli')
83
+ fs.chmodSync(bin, 0o755)
84
+ console.log(`✓ sentori-cli ${pkg.version} ready (${slug})`)
85
+ }
86
+
87
+ main().catch((e) => {
88
+ console.error('sentori-cli install failed:', e.message)
89
+ process.exit(1)
90
+ })
package/lib/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}