@plasmickit/cli 0.0.57 → 0.0.59

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.0.57",
3
+ "version": "0.0.59",
4
4
  "description": "Plasmic skill bootstrap and NAS workflow resource manager",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,23 +1,24 @@
1
1
  ---
2
2
  name: plasmic
3
- description: Design, revise, and verify editable product prototypes in self-hosted Plasmic, or read Plasmic pages and generate native React project code under maintained engineering standards. Use for Plasmic product prototyping and design-to-code development.
3
+ description: Explain or review self-hosted Plasmic pages, components and templates; create or revise editable prototypes; implement or update native React project code from Plasmic designs. Use for Plasmic model/template inspection, prototype design and design-to-code work.
4
4
  ---
5
5
 
6
6
  # Plasmic
7
7
 
8
8
  This is a bootstrap skill. Workflows, component guidance and verification scripts live in a versioned resource bundle on the NAS, outside this installed skill.
9
9
 
10
- At the start of each task, choose `prototype` for product design or `codegen` for code generation and integration. Run:
10
+ Choose the task mode before work: `inspect` for read-only page/template explanation or design review, `prototype` for design edits, or `codegen` for native React implementation and updates. Run the matching command:
11
11
 
12
12
  ```sh
13
+ npx -y @plasmickit/cli@latest context resolve --mode inspect
13
14
  npx -y @plasmickit/cli@latest context resolve --mode prototype
14
- # Or: npx -y @plasmickit/cli@latest context resolve --mode codegen
15
+ npx -y @plasmickit/cli@latest context resolve --mode codegen
15
16
  ```
16
17
 
17
- In `codegen` mode, read page models, component contracts and interactions through Desktop MCP, then implement code in the target project's architecture. Generation follows the returned standards; it does not use `export_code` or the official Plasmic CLI.
18
+ Inspect uses accessible Desktop MCP reads and does not require edit permission or save/change designs. Prototype mutations require edit permission. Codegen reads models/contracts through MCP and writes code in the target architecture; it does not use `export_code` or official Plasmic sync. For explicitly requested official `@plasmicapp/cli` integration, resolve inspect and follow the guide's official-CLI reference instead of replacing that request with native coding.
18
19
 
19
- The command checks the NAS release manifest every time, downloads changed resources and verifies their hashes before returning absolute paths. Read all returned `mustRead` files, starting with `referencePath`; resolve subsequent links relative to the reference file. Use the returned `resourceRoot` for verification scripts. For a task spanning both modes, resolve and read each mode before its work begins.
20
+ The command checks the NAS release manifest every time, downloads changed resources and verifies their hashes before returning absolute paths. Read all returned `mustRead` files, starting with `referencePath`; resolve subsequent links relative to the reference file. Use the returned `resourceRoot` for verification scripts. For a task spanning multiple modes, resolve and read each mode before its work begins.
20
21
 
21
- The runner uses the latest published Plasmic CLI. Later commands can use `npx -y @plasmickit/cli@<cliVersion>` from the result to keep the task on that CLI version, or the global `plasmickit` after checking `plasmickit version check`.
22
+ The runner uses the latest published `@plasmickit/cli`, distinct from official `@plasmicapp/cli`. Later commands can use `npx -y @plasmickit/cli@<cliVersion>` from the result to keep the task on that CLI version, or the global `plasmickit` after checking `plasmickit version check`.
22
23
 
23
24
  If the command fails, stop dependent work and report the error. Do not silently use cached references. If it requires a newer CLI before npm has that version, install the returned `cliUrl` with `npm install -g <cliUrl>` and rerun. Do not copy the resource bundle into this skill or treat an old transcript as the current component contract.
package/src/index.mjs CHANGED
@@ -11,7 +11,7 @@ const usage = `plasmickit commands:
11
11
  skill install [--dry-run]
12
12
  version check [--feed HTTPS_URL]
13
13
  references check|update|path [--feed HTTPS_URL] [--home CACHE_ROOT]
14
- context resolve --mode prototype|codegen [--feed HTTPS_URL] [--home CACHE_ROOT]
14
+ context resolve --mode inspect|prototype|codegen [--feed HTTPS_URL] [--home CACHE_ROOT]
15
15
  --version
16
16
  `;
17
17
  export async function main(argv) {
package/src/protocol.mjs CHANGED
@@ -4,13 +4,12 @@ import { createRequire } from "node:module";
4
4
 
5
5
  export const DEFAULT_FEED = "https://studio.plasmic.shiguanglab.com/desktop-updates/plasmic";
6
6
  export const CLI_VERSION = createRequire(import.meta.url)("../package.json").version;
7
- export const MIN_CLI_VERSION = "0.0.34";
8
- export const CODEGEN_REFERENCES = [
9
- "references/codegen/page-reading.md",
10
- "references/codegen/project-code.md",
11
- "references/codegen/interactions.md",
12
- "references/codegen/acceptance.md",
13
- ];
7
+ export const MIN_CLI_VERSION = "0.0.59";
8
+ export const MODE_REFERENCES = {
9
+ inspect: ["references/model-reading.md"],
10
+ prototype: [],
11
+ codegen: ["references/model-reading.md", "references/codegen/project-code.md", "references/codegen/acceptance.md"],
12
+ };
14
13
  export function compareVersions(a, b) {
15
14
  const parse = (version) => {
16
15
  if (typeof version !== "string" || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(version)) throw new Error(`Invalid stable version: ${version}`);
@@ -53,13 +52,13 @@ export function validateManifest(manifest) {
53
52
  }
54
53
  files.set(file.path, file);
55
54
  }
56
- for (const mode of ["guide", "prototype", "codegen"]) {
55
+ for (const mode of ["guide", ...Object.keys(MODE_REFERENCES)]) {
57
56
  const entry = manifest.entrypoints?.[mode];
58
57
  if (!files.has(entry) || !entry.startsWith("references/") || !entry.endsWith(".md")) throw new Error(`Missing ${mode} entrypoint`);
59
58
  }
60
59
  if (!files.has("references/desktop-mcp.md")) throw new Error("Missing Desktop MCP reference");
61
- for (const reference of CODEGEN_REFERENCES) {
62
- if (!files.has(reference)) throw new Error(`Missing code-generation standard: ${reference}`);
60
+ for (const reference of new Set(Object.values(MODE_REFERENCES).flat())) {
61
+ if (!files.has(reference)) throw new Error(`Missing task reference: ${reference}`);
63
62
  }
64
63
  for (const [kind, name] of [["resources", "resources.json.gz"], ["cli", "plasmic-cli.tgz"]]) {
65
64
  const artifact = manifest.artifacts?.[kind];
@@ -1,7 +1,7 @@
1
1
  import { lstat, mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import path from "node:path";
4
- import { artifactUrl, CLI_VERSION, CODEGEN_REFERENCES, feedUrl, MAX_BYTES, requiresNewCli, sha256, unpackResources, validateManifest } from "./protocol.mjs";
4
+ import { artifactUrl, CLI_VERSION, MODE_REFERENCES, feedUrl, MAX_BYTES, requiresNewCli, sha256, unpackResources, validateManifest } from "./protocol.mjs";
5
5
 
6
6
  const cacheRoot = (options) => path.resolve(options.home || process.env.PLASMIC_RESOURCE_HOME || path.join(homedir(), ".cache", "plasmic"));
7
7
  async function download(url) {
@@ -139,8 +139,8 @@ export async function referencePath(options = {}) {
139
139
  return result(root, { manifest, cliUrl: artifactUrl(feedUrl(state.feed), manifest, "cli") }, { freshness: "unchecked" });
140
140
  }
141
141
  export async function resolveContext(mode, options = {}) {
142
- if (!["prototype", "codegen"].includes(mode)) throw new Error("--mode must be prototype or codegen");
142
+ if (!Object.hasOwn(MODE_REFERENCES, mode)) throw new Error("--mode must be inspect, prototype or codegen");
143
143
  const { manifest, ...resources } = await updateReferences(options);
144
- const references = [manifest.entrypoints.guide, "references/desktop-mcp.md", manifest.entrypoints[mode], ...(mode === "codegen" ? CODEGEN_REFERENCES : [])];
144
+ const references = [manifest.entrypoints.guide, "references/desktop-mcp.md", manifest.entrypoints[mode], ...MODE_REFERENCES[mode]];
145
145
  return { ...resources, mode, mustRead: references.map((reference) => path.join(resources.resourceRoot, reference)) };
146
146
  }