pstdio 0.1.0 → 0.1.1

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/bin/pstdio.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("node:child_process");
4
+ const { resolvePackageName } = require("./resolve-package.cjs");
5
+
6
+ const pkg = resolvePackageName(process.platform, process.arch);
7
+
8
+ if (!pkg) {
9
+ process.stderr.write(
10
+ `pstdio: unsupported platform ${process.platform}-${process.arch}.\n` +
11
+ `Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, win-x64, win-arm64\n`,
12
+ );
13
+ process.exit(1);
14
+ }
15
+
16
+ const binPath = require(pkg);
17
+ const result = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
18
+ process.exit(result.status ?? 1);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ function detectLinuxLibc() {
4
+ if (process.platform !== "linux") return null;
5
+ if (!process.report || typeof process.report.getReport !== "function") return "glibc";
6
+ const report = process.report.getReport();
7
+ return report.header?.glibcVersionRuntime ? "glibc" : "musl";
8
+ }
9
+
10
+ function resolvePackageName(platform, arch, libc = platform === "linux" ? detectLinuxLibc() : null) {
11
+ if (platform === "darwin" && arch === "arm64") return "@pstdio/cli-darwin-arm64";
12
+ if (platform === "darwin" && arch === "x64") return "@pstdio/cli-darwin-x64";
13
+ if (platform === "linux" && arch === "x64")
14
+ return libc === "musl" ? "@pstdio/cli-linux-x64-musl" : "@pstdio/cli-linux-x64";
15
+ if (platform === "linux" && arch === "arm64")
16
+ return libc === "musl" ? "@pstdio/cli-linux-arm64-musl" : "@pstdio/cli-linux-arm64";
17
+ if (platform === "win32" && arch === "x64") return "@pstdio/cli-win-x64";
18
+ if (platform === "win32" && arch === "arm64") return "@pstdio/cli-win-arm64";
19
+ return null;
20
+ }
21
+
22
+ module.exports = { detectLinuxLibc, resolvePackageName };
@@ -0,0 +1,48 @@
1
+ import { describe, expect, test } from "bun:test";
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
4
+ const { resolvePackageName } = require("./resolve-package.cjs") as {
5
+ resolvePackageName: (platform: string, arch: string, libc?: "glibc" | "musl" | null) => string | null;
6
+ };
7
+
8
+ describe("resolvePackageName", () => {
9
+ test("darwin arm64", () => {
10
+ expect(resolvePackageName("darwin", "arm64")).toBe("@pstdio/cli-darwin-arm64");
11
+ });
12
+
13
+ test("darwin x64", () => {
14
+ expect(resolvePackageName("darwin", "x64")).toBe("@pstdio/cli-darwin-x64");
15
+ });
16
+
17
+ test("linux x64", () => {
18
+ expect(resolvePackageName("linux", "x64", "glibc")).toBe("@pstdio/cli-linux-x64");
19
+ });
20
+
21
+ test("linux arm64", () => {
22
+ expect(resolvePackageName("linux", "arm64", "glibc")).toBe("@pstdio/cli-linux-arm64");
23
+ });
24
+
25
+ test("linux x64 musl", () => {
26
+ expect(resolvePackageName("linux", "x64", "musl")).toBe("@pstdio/cli-linux-x64-musl");
27
+ });
28
+
29
+ test("linux arm64 musl", () => {
30
+ expect(resolvePackageName("linux", "arm64", "musl")).toBe("@pstdio/cli-linux-arm64-musl");
31
+ });
32
+
33
+ test("win32 x64", () => {
34
+ expect(resolvePackageName("win32", "x64")).toBe("@pstdio/cli-win-x64");
35
+ });
36
+
37
+ test("win32 arm64", () => {
38
+ expect(resolvePackageName("win32", "arm64")).toBe("@pstdio/cli-win-arm64");
39
+ });
40
+
41
+ test("returns null for unsupported platform", () => {
42
+ expect(resolvePackageName("freebsd", "x64")).toBeNull();
43
+ });
44
+
45
+ test("returns null for unsupported arch", () => {
46
+ expect(resolvePackageName("darwin", "ppc64")).toBeNull();
47
+ });
48
+ });
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "pstdio",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pstdio": "./bin/pstdio.js"
7
7
  },
8
8
  "files": [
9
- "bin",
10
- "dist"
9
+ "bin"
11
10
  ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/pufflyai/prompt-studio"
14
+ },
12
15
  "scripts": {
13
16
  "pstdio": "bun ./src/index.ts",
14
- "dev": "bun --watch ./src/index.ts -- serve & VITE_API_BASE_URL= bun run --cwd ../pstdio-dashboard dev & wait",
15
- "build": "bun build ./src/index.ts --outfile dist/index.js --target node --banner \"#!/usr/bin/env node\" --external react",
16
- "analyze-bundle": "bun build ./src/index.ts --outfile dist/index.js --target node --banner \"#!/usr/bin/env node\" --external react --metafile=./dist/bundle-meta.json --metafile-md=./dist/bundle-meta.md",
17
- "build:bundle": "bun run build && mkdir -p dist/api && cp -r ../pstdio-dashboard/dist ./dist/dashboard && cp ../pstdio-api/dist/index.js ./dist/api/server.js",
18
- "build:compile": "bun run ../../scripts/build-compile.ts",
17
+ "dev": "PSTDIO_DISABLE_EMBED_MANIFEST=1 bun --watch ./src/index.ts -- serve & VITE_API_BASE_URL= bun run --cwd ../pstdio-dashboard dev & wait",
18
+ "build": "bun run ../../scripts/build-compile.ts",
19
19
  "typecheck": "tsc --noEmit",
20
20
  "lint": "bun run typecheck && bunx @biomejs/biome lint .",
21
21
  "format": "bunx @biomejs/biome format --write .",
@@ -29,14 +29,14 @@
29
29
  "yargs": "^18.0.0"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@pstdio/cli-darwin-arm64": "0.0.1",
33
- "@pstdio/cli-darwin-x64": "0.0.1",
34
- "@pstdio/cli-linux-x64": "0.0.1",
35
- "@pstdio/cli-linux-arm64": "0.0.1",
36
- "@pstdio/cli-linux-x64-musl": "0.0.1",
37
- "@pstdio/cli-linux-arm64-musl": "0.0.1",
38
- "@pstdio/cli-win-x64": "0.0.1",
39
- "@pstdio/cli-win-arm64": "0.0.1"
32
+ "@pstdio/cli-darwin-arm64": "0.1.0",
33
+ "@pstdio/cli-darwin-x64": "0.1.0",
34
+ "@pstdio/cli-linux-x64": "0.1.0",
35
+ "@pstdio/cli-linux-arm64": "0.1.0",
36
+ "@pstdio/cli-linux-x64-musl": "0.1.0",
37
+ "@pstdio/cli-linux-arm64-musl": "0.1.0",
38
+ "@pstdio/cli-win-x64": "0.1.0",
39
+ "@pstdio/cli-win-arm64": "0.1.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/bun": "latest",
@@ -46,6 +46,7 @@
46
46
  "@types/yargs": "^17.0.35",
47
47
  "pstdio-agents": "workspace:*",
48
48
  "pstdio-api": "workspace:*",
49
+ "pstdio-dashboard": "workspace:*",
49
50
  "pstdio-db": "workspace:*",
50
51
  "pstdio-wt": "workspace:*",
51
52
  "typescript": "~5.9.3"