@inplaysoft/cli-staging 0.0.0-stage → 0.0.0-staging.0.g12f761067754

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.
Files changed (3) hide show
  1. package/README.md +62 -2
  2. package/inplay.js +76 -0
  3. package/package.json +29 -4
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
- # Temporary Holding Version
1
+ > **staging channel.** This is `@inplaysoft/cli-staging`, the staging build of the Inplaysoft CLI. Install it with
2
+ > `npm install -g @inplaysoft/cli-staging` and run it as `inplay-staging` (not `inplay`). The text below describes the
3
+ > prod package: read `@inplaysoft/cli-staging` for `@inplaysoft/cli` in every install line and `inplay-staging` for `inplay` in every command.
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ # @inplaysoft/cli
6
+
7
+ `inplay` — Inplaysoft Platform command-line interface.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g @inplaysoft/cli
13
+ ```
14
+
15
+ The install pulls one matching native binary for your OS + arch via npm's
16
+ `optionalDependencies` mechanism. Supported targets:
17
+
18
+ | OS | Architectures |
19
+ | ------- | --------------- |
20
+ | Linux | x64, arm64 |
21
+ | macOS | x64, arm64 |
22
+ | Windows | x64, arm64 |
23
+
24
+ ## Quick start
25
+
26
+ ```bash
27
+ inplay login # opens your browser to /cli/authorize
28
+ inplay whoami # confirm the session
29
+ inplay devices list # list your CLI devices
30
+ inplay api GET /api/v1/... # raw passthrough with your token
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ | Flag / env | Default | Purpose |
36
+ | ---------------------- | -------------------------------------- | ------------------------------------------ |
37
+ | `--gateway` | (baked-in at build time) | Override the gateway URL |
38
+ | `INPLAY_GATEWAY` | (baked-in at build time) | Same, via env |
39
+ | `--insecure-storage` | (off) | Store creds in a 0600 file instead of OS keychain |
40
+
41
+ Releases on npm currently point at the **staging** gateway
42
+ (`https://gateway.staging.inplaysoft.com`). When the production gateway
43
+ ships, prod binaries publish under a separate dist-tag.
44
+
45
+ ## Known caveats
46
+
47
+ - **Device revocation lag**: the gateway caches token validity for ~5
48
+ minutes. Revoking a device in the admin UI takes up to that long to be
49
+ honored by an actively-used CLI session.
50
+ - **Alpine / musl**: the `linux-x64` / `linux-arm64` packages have no
51
+ npm-level Alpine constraint and the binaries are built with
52
+ `CGO_ENABLED=0` (statically linked Go), so the binary itself runs on
53
+ Alpine. **But** the default OS-keychain credential store relies on
54
+ the Secret Service API over D-Bus, which Alpine doesn't ship by
55
+ default — pass `--insecure-storage` to `inplay login` to fall back to
56
+ a 0600 file in `~/.config/inplay/`.
57
+ - **`--omit=optional`**: `npm install -g @inplaysoft/cli --omit=optional`
58
+ installs the main package but skips every platform binary. The CLI
59
+ will then fail with a clear error on first invocation.
60
+
61
+ ## License
62
+
63
+ UNLICENSED — distributed only for use by Inplaysoft Platform admins.
package/inplay.js ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ // Thin Node wrapper that locates the matching native <wrapper>-<os>-<arch>
3
+ // package and execs its binary. The release workflow ships one binary per
4
+ // optional-platform package and npm only installs the one that matches the
5
+ // host's process.platform + process.arch — same pattern as esbuild, swc,
6
+ // biome, tailwindcss-oxide.
7
+ //
8
+ // One wrapper serves every release channel (#27756): the platform-package
9
+ // prefix is this package's OWN name, read from the package.json npm ships
10
+ // beside it — `@inplaysoft/cli` (prod) resolves `@inplaysoft/cli-linux-x64`,
11
+ // `@inplaysoft/cli-staging` resolves `@inplaysoft/cli-staging-linux-x64`.
12
+ // There is deliberately NO fallback to the prod prefix: a channel wrapper that
13
+ // cannot name itself must fail, never silently run another channel's binary.
14
+
15
+ const { spawnSync } = require('node:child_process');
16
+
17
+ const SUPPORTED = ['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', 'win32-arm64', 'win32-x64'];
18
+
19
+ let wrapper;
20
+ try {
21
+ wrapper = require('./package.json').name;
22
+ } catch (err) {
23
+ console.error(
24
+ `inplay: cannot read the wrapper's own package.json (${err.message}).\n` +
25
+ ` Reinstall the inplay CLI package you installed (e.g. npm install -g @inplaysoft/cli).`,
26
+ );
27
+ process.exit(1);
28
+ }
29
+ if (typeof wrapper !== 'string' || !/^@inplaysoft\/cli(-[a-z]+)?$/.test(wrapper)) {
30
+ console.error(`inplay: the wrapper's package.json names '${wrapper}', not an @inplaysoft/cli package. Reinstall it.`);
31
+ process.exit(1);
32
+ }
33
+
34
+ const key = `${process.platform}-${process.arch}`;
35
+
36
+ if (!SUPPORTED.includes(key)) {
37
+ console.error(`${wrapper}: unsupported platform ${key}. Supported: ${SUPPORTED.join(', ')}.`);
38
+ process.exit(1);
39
+ }
40
+
41
+ const pkg = `${wrapper}-${key}`;
42
+ const binName = process.platform === 'win32' ? 'inplay.exe' : 'inplay';
43
+
44
+ let binaryPath;
45
+ try {
46
+ binaryPath = require.resolve(`${pkg}/bin/${binName}`);
47
+ } catch (err) {
48
+ // The matching optional-platform package isn't installed. This usually
49
+ // means npm skipped it because the host advertised a different
50
+ // platform/arch than the one running the wrapper (e.g. installing in CI
51
+ // with --omit=optional, or using a tool that filters optional deps).
52
+ console.error(
53
+ `${wrapper}: native binary for ${key} is not installed.\n` +
54
+ ` Try: npm install ${pkg}\n` +
55
+ ` Or: reinstall ${wrapper} without --omit=optional.`,
56
+ );
57
+ process.exit(1);
58
+ }
59
+
60
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
61
+ stdio: 'inherit',
62
+ windowsHide: true,
63
+ });
64
+
65
+ if (result.error) {
66
+ console.error(`${wrapper}: failed to spawn ${binaryPath}: ${result.error.message}`);
67
+ process.exit(1);
68
+ }
69
+
70
+ // Preserve signal-termination fidelity for scripted callers: if the child
71
+ // was killed by a signal (Ctrl-C, etc.), re-raise it on ourselves rather
72
+ // than exiting 0 — status is null when signal is set.
73
+ if (result.signal) {
74
+ process.kill(process.pid, result.signal);
75
+ }
76
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "@inplaysoft/cli-staging",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.0-staging.0.g12f761067754",
4
+ "description": "Inplaysoft Platform command-line interface (inplay-staging).",
5
+ "bin": {
6
+ "inplay-staging": "./inplay.js"
7
+ },
8
+ "engines": {
9
+ "node": ">=18"
10
+ },
11
+ "files": [
12
+ "inplay.js",
13
+ "README.md"
14
+ ],
15
+ "optionalDependencies": {
16
+ "@inplaysoft/cli-staging-darwin-arm64": "0.0.0-staging.0.g12f761067754",
17
+ "@inplaysoft/cli-staging-darwin-x64": "0.0.0-staging.0.g12f761067754",
18
+ "@inplaysoft/cli-staging-linux-arm64": "0.0.0-staging.0.g12f761067754",
19
+ "@inplaysoft/cli-staging-linux-x64": "0.0.0-staging.0.g12f761067754",
20
+ "@inplaysoft/cli-staging-win32-arm64": "0.0.0-staging.0.g12f761067754",
21
+ "@inplaysoft/cli-staging-win32-x64": "0.0.0-staging.0.g12f761067754"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "license": "UNLICENSED",
27
+ "keywords": [
28
+ "inplaysoft",
29
+ "cli"
30
+ ]
31
+ }