@palettelab/cli 0.3.4 → 0.3.5

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/lib/commands/dev.js +29 -12
  2. package/package.json +1 -1
@@ -28,17 +28,40 @@ function imageExistsLocally(image) {
28
28
  }
29
29
 
30
30
  function tryPullImage(image) {
31
- const res = spawnSync("docker", ["pull", image], { stdio: "inherit" })
32
- return res.status === 0
31
+ const res = spawnSync("docker", ["pull", image], { encoding: "utf8" })
32
+ if (res.stdout) process.stdout.write(res.stdout)
33
+ if (res.stderr) process.stderr.write(res.stderr)
34
+ return {
35
+ ok: res.status === 0,
36
+ output: `${res.stdout || ""}${res.stderr || ""}`,
37
+ }
33
38
  }
34
39
 
35
40
  function ensureImageAvailable(image) {
36
41
  // Accept a locally-built image (e.g. `platform-dev:test` from `docker build`)
37
42
  // without attempting a registry pull — local is authoritative if present.
38
- if (imageExistsLocally(image)) return true
43
+ if (imageExistsLocally(image)) return { ok: true, output: "" }
39
44
  return tryPullImage(image)
40
45
  }
41
46
 
47
+ function imagePullHelp(image, output) {
48
+ const arch = `${process.platform}/${process.arch}`
49
+ const archHint =
50
+ /no matching manifest|manifest.*unknown|not found/i.test(output || "")
51
+ ? ` • The image tag may not include your CPU architecture (${arch}).\n` +
52
+ " Platform maintainers: publish a multi-arch image for linux/amd64 and linux/arm64.\n"
53
+ : ""
54
+ return (
55
+ `\n[pltt] could not pull ${image}.\n` +
56
+ ` Most common causes:\n` +
57
+ archHint +
58
+ ` • The image hasn't been published to the registry yet.\n` +
59
+ ` Platform maintainers: run the platform-dev publish workflow and push the latest tag.\n` +
60
+ ` • You are not logged in: docker login ghcr.io -u <github-user> -p <pat>\n` +
61
+ ` • You are pointing at a different tag: set PALETTE_DEV_IMAGE=<your-image> to override.\n`
62
+ )
63
+ }
64
+
42
65
  async function run(args, { cwd }) {
43
66
  const { flags, rest } = parseFlags(args)
44
67
  const cloud = rest.includes("--cloud")
@@ -97,16 +120,10 @@ async function run(args, { cwd }) {
97
120
  // Pre-pull so we can give a useful error if the image isn't reachable
98
121
  // (common cause: maintainer hasn't pushed it yet, or `docker login ghcr.io`
99
122
  // missing). Without this, the `docker compose up` failure is cryptic.
100
- if (!ensureImageAvailable(DEFAULT_IMAGE)) {
123
+ const image = ensureImageAvailable(DEFAULT_IMAGE)
124
+ if (!image.ok) {
101
125
  if (frontendWatcher) await frontendWatcher.dispose()
102
- console.error(
103
- `\n[pltt] could not pull ${DEFAULT_IMAGE}.\n` +
104
- ` Most common causes:\n` +
105
- ` • The image hasn't been published to the registry yet.\n` +
106
- ` Platform maintainers: see docker/platform-dev/README.md for the build + push flow.\n` +
107
- ` • You are not logged in: docker login ghcr.io -u <github-user> -p <pat>\n` +
108
- ` • You are pointing at a different tag: set PALETTE_DEV_IMAGE=<your-image> to override.\n`,
109
- )
126
+ console.error(imagePullHelp(DEFAULT_IMAGE, image.output))
110
127
  process.exit(1)
111
128
  }
112
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palettelab/cli",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Developer CLI for building Palette platform plugins — no platform source access required.",
5
5
  "bin": {
6
6
  "pltt": "bin/pltt.js"