@command-center/command-center 0.2.3 → 0.3.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Command Center CLI
2
2
 
3
- Binary distribution of UpToSpeed Command Center, a desktop-friendly interface for reviewing repositories and generating walkthroughs. This package installs a thin Node.js wrapper that launches the precompiled Command Center binary for your platform.
3
+ Binary distribution of UpToSpeed Command Center, a desktop-friendly interface for reviewing repositories and generating walkthroughs. This package installs a thin Node.js wrapper that launches the precompiled Command Center binary for your platform via platform-specific optional dependencies.
4
4
 
5
5
  ## Supported Platforms
6
6
 
@@ -18,7 +18,15 @@ If your platform is missing, please open an issue so we can add another target.
18
18
  npm install -g @command-center/command-center
19
19
  ```
20
20
 
21
- This command places a `command-center` executable on your `$PATH`. The wrapper selects the appropriate binary from the package’s `dist/` directory and forwards all CLI arguments to it.
21
+ This command places a `command-center` executable on your `$PATH`. During installation npm/yarn/pnpm automatically adds the matching optional dependency:
22
+
23
+ - `@command-center/command-center-macos-arm64`
24
+ - `@command-center/command-center-macos-x64`
25
+ - `@command-center/command-center-linux-arm64`
26
+ - `@command-center/command-center-linux-x64`
27
+ - `@command-center/command-center-win-x64`
28
+
29
+ Each optional package ships exactly one prebuilt binary. The wrapper resolves the right package at runtime and forwards all CLI arguments to its binary.
22
30
 
23
31
  ## Usage
24
32
 
@@ -41,8 +49,23 @@ npm update -g @command-center/command-center
41
49
 
42
50
  After updating, run `command-center --version` to verify the new binary.
43
51
 
52
+ ## Maintainer Utilities
53
+
54
+ If you are working from the repository and want to validate the packaged
55
+ artifacts before publishing, run:
56
+
57
+ ```bash
58
+ npm run build-and-install
59
+ ```
60
+
61
+ This command rebuilds the binaries, generates platform-specific packages under
62
+ `artifacts/platform-packages/`, and installs both the matching platform binary
63
+ package and the CLI in a temporary directory. Finish by running
64
+ `command-center --version` (the script does this for you) or launching the app
65
+ directly from the printed path.
66
+
44
67
  ## Troubleshooting
45
68
 
46
69
  - **“Unsupported platform”** – The wrapper could not map your `process.platform`/`process.arch` combination. Please file an issue with your OS and architecture.
47
- - **“Expected binary … was not found”** – Reinstall the package. If you are working from a git checkout, run `bun run build:binary` before linking with `npm link`.
48
- - **Permission errors** – On POSIX systems, ensure the binaries in `dist/` remain executable (`chmod +x dist/command-center-*`).
70
+ - **“Expected binary … was not found”** – Reinstall the package. If you are developing locally, run `npm run prepare:dist` from the repository root to refresh the optional binary packages.
71
+ - **Permission errors** – On POSIX systems, ensure the binaries remain executable (`chmod +x node_modules/@command-center/command-center-*/dist/command-center-*`).
@@ -4,35 +4,60 @@ import { spawn } from "node:child_process";
4
4
  import { existsSync } from "node:fs";
5
5
  import { createRequire } from "node:module";
6
6
  import path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
7
 
9
8
  const require = createRequire(import.meta.url);
10
9
  const packageMetadata = require("../package.json");
11
10
 
12
11
  const PACKAGE_VERSION = packageMetadata.version ?? "0.0.0";
13
-
14
12
  const PLATFORM_KEY = `${process.platform}:${process.arch}`;
15
13
 
16
- // TAG_PLATFORM_MATRIX 2025.10.02: Keep binary names in sync with scripts/build-all.ts outputs.
17
- const PLATFORM_BINARIES = new Map([
18
- ["darwin:arm64", "command-center-macos-arm64"],
19
- ["darwin:x64", "command-center-macos-x64"],
20
- ["linux:arm64", "command-center-linux-arm64"],
21
- ["linux:x64", "command-center-linux-x64"],
22
- // ["win32:x64", "command-center-win-x64.exe"],
14
+ // TAG_PLATFORM_MATRIX 2025.10.14: Keep entries in sync with scripts/build-all.ts outputs.
15
+ const PLATFORM_PACKAGES = new Map([
16
+ [
17
+ "darwin:arm64",
18
+ {
19
+ packageName: "@command-center/command-center-macos-arm64",
20
+ binaryName: "command-center-macos-arm64",
21
+ },
22
+ ],
23
+ [
24
+ "darwin:x64",
25
+ {
26
+ packageName: "@command-center/command-center-macos-x64",
27
+ binaryName: "command-center-macos-x64",
28
+ },
29
+ ],
30
+ [
31
+ "linux:arm64",
32
+ {
33
+ packageName: "@command-center/command-center-linux-arm64",
34
+ binaryName: "command-center-linux-arm64",
35
+ },
36
+ ],
37
+ [
38
+ "linux:x64",
39
+ {
40
+ packageName: "@command-center/command-center-linux-x64",
41
+ binaryName: "command-center-linux-x64",
42
+ },
43
+ ],
44
+ [
45
+ "win32:x64",
46
+ {
47
+ packageName: "@command-center/command-center-win-x64",
48
+ binaryName: "command-center-win-x64.exe",
49
+ },
50
+ ],
23
51
  ]);
24
52
 
25
- const __filename = fileURLToPath(import.meta.url);
26
- const __dirname = path.dirname(__filename);
27
-
28
53
  function fail(message) {
29
54
  console.error(`command-center (wrapper): ${message}`);
30
55
  process.exit(1);
31
56
  }
32
57
 
33
58
  function resolveBinary() {
34
- const binaryName = PLATFORM_BINARIES.get(PLATFORM_KEY);
35
- if (!binaryName) {
59
+ const entry = PLATFORM_PACKAGES.get(PLATFORM_KEY);
60
+ if (!entry) {
36
61
  fail(
37
62
  `unsupported platform '${process.platform}' with architecture '${process.arch}'.` +
38
63
  "\n • Please open an issue so we can add build support." +
@@ -40,12 +65,27 @@ function resolveBinary() {
40
65
  );
41
66
  }
42
67
 
43
- const binaryPath = path.join(__dirname, "..", "dist", binaryName);
68
+ let packageRoot = "";
69
+ try {
70
+ const packageJsonPath = require.resolve(
71
+ `${entry.packageName}/package.json`,
72
+ );
73
+ packageRoot = path.dirname(packageJsonPath);
74
+ } catch (error) {
75
+ fail(
76
+ `missing optional dependency '${entry.packageName}'.` +
77
+ "\n • npm should install it automatically on supported platforms." +
78
+ "\n • Try reinstalling the CLI or running 'npm install @command-center/command-center' again." +
79
+ `\n • Underlying error: ${error instanceof Error ? error.message : String(error)}`,
80
+ );
81
+ }
82
+
83
+ const binaryPath = path.join(packageRoot, "dist", entry.binaryName);
44
84
  if (!existsSync(binaryPath)) {
45
85
  fail(
46
- `expected binary '${binaryName}' was not found at ${binaryPath}.` +
47
- "\n • Ensure the package was published with binaries (run 'bun run build:binary' before publishing)." +
48
- "\n • If you are developing locally, rebuild the binaries and try again.",
86
+ `expected binary '${entry.binaryName}' was not found in ${entry.packageName}.` +
87
+ "\n • Ensure the optional dependency was published with binaries (run 'bun run build:binary' before publishing)." +
88
+ "\n • If you are developing locally, run 'npm run prepare:dist' to refresh optional packages.",
49
89
  );
50
90
  }
51
91
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@command-center/command-center",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Binary distribution of UpToSpeed Command Center",
6
6
  "bin": {
@@ -8,17 +8,8 @@
8
8
  },
9
9
  "files": [
10
10
  "bin/",
11
- "dist/",
12
11
  "README.md"
13
12
  ],
14
- "scripts": {
15
- "prepare:dist": "node ./scripts/prepare-dist.cjs",
16
- "check:dist": "node ./scripts/assert-dist-binaries.cjs",
17
- "prepublishOnly": "npm run prepare:dist && npm run check:dist",
18
- "bump:minor": "npm version minor",
19
- "bump:patch": "npm version patch",
20
- "release": "npm publish"
21
- },
22
13
  "engines": {
23
14
  "node": ">=18.0.0"
24
15
  },
@@ -30,5 +21,13 @@
30
21
  "license": "MIT",
31
22
  "publishConfig": {
32
23
  "access": "public"
33
- }
24
+ },
25
+ "optionalDependencies": {
26
+ "@command-center/command-center-linux-arm64": "0.3.0",
27
+ "@command-center/command-center-linux-x64": "0.3.0",
28
+ "@command-center/command-center-macos-arm64": "0.3.0",
29
+ "@command-center/command-center-macos-x64": "0.3.0",
30
+ "@command-center/command-center-win-x64": "0.3.0"
31
+ },
32
+ "scripts": {}
34
33
  }
Binary file
Binary file
Binary file
Binary file