@plasmickit/cli 0.0.58 → 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 +1 -1
- package/skill/plasmic/SKILL.md +7 -6
- package/src/index.mjs +1 -1
- package/src/protocol.mjs +9 -10
- package/src/references.mjs +3 -3
package/package.json
CHANGED
package/skill/plasmic/SKILL.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plasmic
|
|
3
|
-
description:
|
|
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
|
-
|
|
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
|
-
|
|
15
|
+
npx -y @plasmickit/cli@latest context resolve --mode codegen
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
|
|
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
|
|
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
|
|
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.
|
|
8
|
-
export const
|
|
9
|
-
"references/
|
|
10
|
-
|
|
11
|
-
"references/codegen/
|
|
12
|
-
|
|
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",
|
|
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
|
|
62
|
-
if (!files.has(reference)) throw new Error(`Missing
|
|
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];
|
package/src/references.mjs
CHANGED
|
@@ -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,
|
|
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 (!
|
|
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], ...
|
|
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
|
}
|