@plasmickit/cli 0.2.6 → 0.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmickit/cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Plasmic skill bootstrap and NAS workflow resource manager",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: plasmic
3
- description: Inspect self-hosted Plasmic pages and templates, create or revise editable prototypes, and implement native React code from Plasmic designs.
3
+ compatibility: Requires Node.js >=22.12, Python >=3.9 available as python3, and signed-in Plasmic Desktop MCP for design inspection or editing.
4
+ description: Inspect self-hosted Plasmic pages and templates, create or revise editable Plasmic prototypes, and implement native React code from Plasmic designs. Use for Plasmic Studio/Desktop MCP work such as 原型设计, 后台页面原型 (list/form/detail pages), 按需求或线框/设计稿生成页面, 解读模板或页面, and 根据 Plasmic 设计生成代码. Not for generic React pages without a Plasmic design, or for developing the Plasmic platform itself.
4
5
  ---
5
6
 
6
7
  # Plasmic
@@ -23,7 +24,7 @@ npx -y @plasmickit/cli@latest context resolve --mode codegen
23
24
 
24
25
  Read every returned `mustRead` file, starting with `referencePath`. Resolve linked documents from the returned `resourceRoot`; follow the workflow's scenario-specific reading and evidence requirements. Resource readiness does not mean the documents have been read. For a task spanning modes, resolve and read each workflow before its work begins.
25
26
 
26
- The published resolver checks the NAS release manifest and verifies resource hashes. Stop dependent work on failure; do not silently use stale references. If it requires a newer CLI before npm has that version, install its returned `cliUrl` and rerun. Relay meaningful preparation progress from stderr; stdout contains the result. Report local versus published resources accurately.
27
+ Both resolvers verify that Python 3.9+ is available as `python3` for reference readers and gates. The published resolver also checks the NAS release manifest and verifies resource hashes. Stop dependent work on failure; do not silently use stale references. If it requires a newer CLI before npm has that version, install its returned `cliUrl` and rerun. Relay meaningful preparation progress from stderr; stdout contains the result. Report local versus published resources accurately.
27
28
 
28
29
  ## Ensure Desktop MCP access
29
30
 
package/src/progress.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  const labels = {
2
+ runtime: ["运行环境", "正在检查运行环境", "运行环境检查通过"],
2
3
  manifest: ["版本检查", "正在检查版本", "版本检查完成"],
3
4
  download: ["资源下载", "正在下载资源", "下载完成"],
4
5
  verify: ["资源校验", "正在校验资源", "校验通过"],
@@ -10,6 +10,7 @@ import {
10
10
  import { homedir } from "node:os";
11
11
  import path from "node:path";
12
12
  import { withProgress } from "./progress.mjs";
13
+ import { verifyRuntime } from "./runtime.mjs";
13
14
  import {
14
15
  CLI_VERSION,
15
16
  MAX_BYTES,
@@ -341,6 +342,7 @@ export async function resolveContext(mode, options = {}) {
341
342
  if (!Object.hasOwn(MODE_REFERENCES, mode)) {
342
343
  throw new Error("--mode must be inspect, prototype or codegen");
343
344
  }
345
+ const runtime = await withProgress(options, "runtime", verifyRuntime);
344
346
  const { manifest, ...resources } = await updateReferences(options);
345
347
  return withProgress(options, "workflow", (progress) => {
346
348
  const references = [
@@ -353,6 +355,6 @@ export async function resolveContext(mode, options = {}) {
353
355
  path.join(resources.resourceRoot, reference),
354
356
  );
355
357
  progress({ mode, mustRead });
356
- return { ...resources, mode, mustRead };
358
+ return { ...resources, mode, mustRead, runtime };
357
359
  });
358
360
  }
@@ -0,0 +1,22 @@
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+
4
+ const execute = promisify(execFile);
5
+
6
+ /** The bundled reference readers and verification scripts require Python 3.9+. */
7
+ export async function verifyRuntime() {
8
+ let version;
9
+ try {
10
+ const { stdout } = await execute("python3", [
11
+ "-c", "import json,sys; print(json.dumps(list(sys.version_info[:3])))",
12
+ ], { timeout: 10000, maxBuffer: 4096 });
13
+ version = JSON.parse(stdout);
14
+ } catch (error) {
15
+ throw new Error("Plasmic workflows require Python 3.9+ available as python3. Install it or make it available on this client's PATH, then resolve context again.", { cause: error });
16
+ }
17
+ if (!Array.isArray(version) || version.length !== 3 || !version.every(Number.isInteger) ||
18
+ version[0] < 3 || (version[0] === 3 && version[1] < 9)) {
19
+ throw new Error("Plasmic workflows require Python 3.9+ available as python3; the detected version is unsupported. Update it, then resolve context again.");
20
+ }
21
+ return { node: process.versions.node, python: { command: "python3", version: version.join(".") } };
22
+ }