@promptster/cli 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/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @promptster/cli
2
+
3
+ The official Promptster CLI. Capture and submit AI-native developer assessments.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @promptster/cli
9
+ # or
10
+ pnpm add -g @promptster/cli
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # Validate your candidate key and accept terms
17
+ promptster redeem PST-XXXX-XXXX
18
+
19
+ # Configure hooks/MCP and begin your assessment
20
+ promptster start
21
+
22
+ # Submit when you're done
23
+ promptster done
24
+
25
+ # Check current session info
26
+ promptster status
27
+
28
+ # Diagnose your setup
29
+ promptster doctor
30
+ ```
31
+
32
+ ## Supported Platforms
33
+
34
+ - macOS (Intel + Apple Silicon)
35
+ - Linux (x64 + arm64)
36
+ - Windows (x64)
37
+
38
+ ## License
39
+
40
+ MIT
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+ const os = require("os");
8
+
9
+ function getBinaryName() {
10
+ const platform = os.platform(); // 'linux', 'darwin', 'win32'
11
+ const arch = os.arch(); // 'x64', 'arm64', 'ia32', etc.
12
+
13
+ const archMap = {
14
+ x64: "x64",
15
+ arm64: "arm64",
16
+ };
17
+
18
+ const mappedArch = archMap[arch];
19
+ if (!mappedArch) {
20
+ console.error(`promptster: unsupported architecture: ${arch}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ if (platform === "win32") {
25
+ return `promptster-win32-x64.exe`;
26
+ }
27
+
28
+ if (platform === "linux" || platform === "darwin") {
29
+ return `promptster-${platform}-${mappedArch}`;
30
+ }
31
+
32
+ console.error(`promptster: unsupported platform: ${platform}`);
33
+ process.exit(1);
34
+ }
35
+
36
+ const binaryName = getBinaryName();
37
+ const binaryPath = path.join(__dirname, "..", "binaries", binaryName);
38
+
39
+ if (!fs.existsSync(binaryPath)) {
40
+ console.error(`promptster: binary not found at ${binaryPath}`);
41
+ console.error(`Platform: ${os.platform()}, Arch: ${os.arch()}`);
42
+ console.error("Please re-install: npm install -g @promptster/cli");
43
+ process.exit(1);
44
+ }
45
+
46
+ try {
47
+ execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
48
+ } catch (err) {
49
+ if (err.status != null) {
50
+ process.exit(err.status);
51
+ }
52
+ throw err;
53
+ }
@@ -0,0 +1 @@
1
+ # placeholder
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@promptster/cli",
3
+ "version": "0.1.1",
4
+ "description": "Promptster CLI — capture and submit developer assessments",
5
+ "keywords": [
6
+ "promptster",
7
+ "cli",
8
+ "assessment",
9
+ "developer",
10
+ "ai"
11
+ ],
12
+ "homepage": "https://promptster.dev",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/promptster/promptster-backend"
16
+ },
17
+ "license": "MIT",
18
+ "bin": {
19
+ "promptster": "./bin/promptster.js"
20
+ },
21
+ "scripts": {
22
+ "build": "node scripts/build.js",
23
+ "prepublishOnly": "node scripts/check-binaries.js"
24
+ },
25
+ "files": [
26
+ "bin/",
27
+ "binaries/",
28
+ "scripts/",
29
+ "README.md"
30
+ ],
31
+ "engines": {
32
+ "node": ">=16"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ }
37
+ }
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ /**
5
+ * Cross-compiles the Go CLI binary for all target platforms.
6
+ * Run from the monorepo root or from this directory.
7
+ *
8
+ * Usage:
9
+ * node scripts/build.js [version]
10
+ *
11
+ * Example:
12
+ * node scripts/build.js 0.1.0
13
+ */
14
+
15
+ const { execSync } = require("child_process");
16
+ const path = require("path");
17
+ const fs = require("fs");
18
+
19
+ const version = process.argv[2] || "dev";
20
+
21
+ const TARGETS = [
22
+ { goos: "linux", goarch: "amd64", out: "promptster-linux-x64" },
23
+ { goos: "linux", goarch: "arm64", out: "promptster-linux-arm64" },
24
+ { goos: "darwin", goarch: "amd64", out: "promptster-darwin-x64" },
25
+ { goos: "darwin", goarch: "arm64", out: "promptster-darwin-arm64" },
26
+ { goos: "windows", goarch: "amd64", out: "promptster-win32-x64.exe" },
27
+ ];
28
+
29
+ // Path to the Go source (relative to this script's parent)
30
+ const goSrcDir = path.resolve(__dirname, "../../promptster-cli");
31
+ const binariesDir = path.resolve(__dirname, "../binaries");
32
+
33
+ if (!fs.existsSync(binariesDir)) {
34
+ fs.mkdirSync(binariesDir, { recursive: true });
35
+ }
36
+
37
+ if (!fs.existsSync(goSrcDir)) {
38
+ console.error(`Go source not found at: ${goSrcDir}`);
39
+ console.error("Expected: apps/promptster-cli/");
40
+ process.exit(1);
41
+ }
42
+
43
+ console.log(`Building promptster v${version} for all platforms...\n`);
44
+
45
+ for (const { goos, goarch, out } of TARGETS) {
46
+ const outPath = path.join(binariesDir, out);
47
+ const cmd = `go build -ldflags "-X main.version=${version}" -o ${outPath} .`;
48
+ console.log(` ${goos}/${goarch} → binaries/${out}`);
49
+ try {
50
+ execSync(cmd, {
51
+ cwd: goSrcDir,
52
+ env: { ...process.env, GOOS: goos, GOARCH: goarch, CGO_ENABLED: "0" },
53
+ stdio: "inherit",
54
+ });
55
+ } catch (err) {
56
+ console.error(`\nFailed to build ${goos}/${goarch}`);
57
+ process.exit(1);
58
+ }
59
+ }
60
+
61
+ console.log("\n✓ All binaries built successfully");
62
+ console.log(` Output: ${binariesDir}`);
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+
7
+ const EXPECTED = [
8
+ "promptster-linux-x64",
9
+ "promptster-linux-arm64",
10
+ "promptster-darwin-x64",
11
+ "promptster-darwin-arm64",
12
+ "promptster-win32-x64.exe",
13
+ ];
14
+
15
+ const binDir = path.join(__dirname, "..", "binaries");
16
+ let missing = [];
17
+
18
+ for (const name of EXPECTED) {
19
+ const p = path.join(binDir, name);
20
+ if (!fs.existsSync(p)) {
21
+ missing.push(name);
22
+ }
23
+ }
24
+
25
+ if (missing.length > 0) {
26
+ console.error("ERROR: Missing binaries before publish:");
27
+ for (const m of missing) console.error(" - " + m);
28
+ console.error("\nRun: node scripts/build.js");
29
+ process.exit(1);
30
+ }
31
+
32
+ console.log("✓ All binaries present");