@usecontextlayer/ctxs 0.2.9

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 (2) hide show
  1. package/launcher/ctxs.cjs +40 -0
  2. package/package.json +29 -0
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ // Platform launcher for @usecontextlayer/ctxs. Mirror of the ctxb launcher in
3
+ // packages/base-cli/launcher/ctxb.cjs — see that file for the rationale on
4
+ // .cjs, CommonJS, and the require-based resolution pattern.
5
+
6
+ const { spawnSync } = require("node:child_process")
7
+
8
+ const PLATFORMS = {
9
+ "darwin-arm64": "@usecontextlayer/ctxs-darwin-arm64",
10
+ "linux-arm64": "@usecontextlayer/ctxs-linux-arm64",
11
+ "linux-x64": "@usecontextlayer/ctxs-linux-x64",
12
+ }
13
+
14
+ const key = `${process.platform}-${process.arch}`
15
+ const binaryFromEnv = process.env.CTXS_BINARY
16
+ const pkg = PLATFORMS[key]
17
+
18
+ if (!binaryFromEnv && !pkg) {
19
+ console.error(
20
+ `@usecontextlayer/ctxs: unsupported platform ${key}. ` +
21
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}. ` +
22
+ `Set CTXS_BINARY to override.`,
23
+ )
24
+ process.exit(1)
25
+ }
26
+
27
+ let binary
28
+ try {
29
+ binary = binaryFromEnv ?? require.resolve(`${pkg}/bin/ctxs`)
30
+ } catch {
31
+ console.error(
32
+ `@usecontextlayer/ctxs: platform package ${pkg} is not installed. ` +
33
+ `If you used --omit=optional, re-run npm install with --include=optional.`,
34
+ )
35
+ process.exit(1)
36
+ }
37
+
38
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" })
39
+ if (result.signal) process.kill(process.pid, result.signal)
40
+ else process.exit(result.status ?? 1)
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "bin": {
3
+ "ctxs": "./launcher/ctxs.cjs"
4
+ },
5
+ "devDependencies": {
6
+ "@usecontextlayer/shared": "*",
7
+ "@usecontextlayer/slate-bridge": "*",
8
+ "commander": "^14.0.3",
9
+ "consola": "^3.4.2"
10
+ },
11
+ "files": [
12
+ "launcher/ctxs.cjs"
13
+ ],
14
+ "name": "@usecontextlayer/ctxs",
15
+ "optionalDependencies": {
16
+ "@usecontextlayer/ctxs-darwin-arm64": "0.2.9",
17
+ "@usecontextlayer/ctxs-linux-arm64": "0.2.9",
18
+ "@usecontextlayer/ctxs-linux-x64": "0.2.9"
19
+ },
20
+ "scripts": {
21
+ "build": "bun build ./cli.ts --compile --outfile ./bin/ctxs",
22
+ "clean": "rm -rf bin *.tsbuildinfo .*.bun-build",
23
+ "postbuild": "rm -f .*.bun-build",
24
+ "prebuild": "rm -rf bin",
25
+ "tsc": "npx tsc -b tsconfig.json"
26
+ },
27
+ "type": "module",
28
+ "version": "0.2.9"
29
+ }