@anvpx/motion-cli 0.1.50 → 0.1.52
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/dist/commands.js +4 -0
- package/dist/desktop/command.d.ts +21 -0
- package/dist/desktop/command.js +120 -0
- package/dist/main.js +0 -0
- package/dist/mcp/server.d.ts +82 -0
- package/dist/mcp/server.js +457 -0
- package/dist/plugin/install.d.ts +3 -3
- package/dist/plugin/install.js +2 -2
- package/dist/version/command.d.ts +5 -0
- package/dist/version/command.js +52 -0
- package/package.json +9 -8
package/dist/commands.js
CHANGED
|
@@ -5,6 +5,7 @@ import { captionsCommand } from "./captions/command.js";
|
|
|
5
5
|
import { catalogCommand } from "./catalog/command.js";
|
|
6
6
|
import { compareCommand } from "./compare/command.js";
|
|
7
7
|
import { contactCommand } from "./contact/command.js";
|
|
8
|
+
import { desktopCommand } from "./desktop/command.js";
|
|
8
9
|
import { doctorCommand } from "./doctor/command.js";
|
|
9
10
|
import { fitCommand } from "./fit/command.js";
|
|
10
11
|
import { generate3dCommand } from "./generate3d/command.js";
|
|
@@ -20,6 +21,7 @@ import { stateCommand } from "./state/command.js";
|
|
|
20
21
|
import { templateCommand } from "./template/command.js";
|
|
21
22
|
import { newCommand } from "./template/new.js";
|
|
22
23
|
import { verifyCommand } from "./verify/command.js";
|
|
24
|
+
import { versionCommand } from "./version/command.js";
|
|
23
25
|
import { voiceCommand } from "./voice/command.js";
|
|
24
26
|
import { buildCommand } from "./workflow/build.js";
|
|
25
27
|
import { draftCommand } from "./workflow/draft.js";
|
|
@@ -53,7 +55,9 @@ export const COMMANDS = [
|
|
|
53
55
|
iconCommand,
|
|
54
56
|
assetsCommand,
|
|
55
57
|
pluginCommand,
|
|
58
|
+
desktopCommand,
|
|
56
59
|
voiceCommand,
|
|
57
60
|
optimizeModelCommand,
|
|
58
61
|
generate3dCommand,
|
|
62
|
+
versionCommand,
|
|
59
63
|
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Command } from "../types.ts";
|
|
2
|
+
/** Resolves a package id (e.g. `@anvpx/motion/package.json`) to a file path. */
|
|
3
|
+
export type CoreResolver = (id: string) => string;
|
|
4
|
+
/** Path existence probe; injectable so tests can model an install layout. */
|
|
5
|
+
export type PathExists = (path: string) => boolean;
|
|
6
|
+
/** `<repo>/packages/core/mcpb`, where the release build stages the bundle. */
|
|
7
|
+
export declare const repoBundleDir: () => string;
|
|
8
|
+
/**
|
|
9
|
+
* The bundle directory, in order: (a) `mcpb/` inside the installed
|
|
10
|
+
* `@anvpx/motion` package, (b) `<repo>/packages/core/mcpb` for development.
|
|
11
|
+
* Never returns a path that does not exist.
|
|
12
|
+
*/
|
|
13
|
+
export declare const resolveBundleDir: (resolveCorePkg?: CoreResolver, exists?: PathExists) => string;
|
|
14
|
+
export interface DesktopEnv {
|
|
15
|
+
sourceDir: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const defaultDesktopEnv: () => DesktopEnv;
|
|
18
|
+
/** Exactly one bundle this build produced, or the reason there is not. */
|
|
19
|
+
export declare const pickBundle: (entries: readonly string[], dir: string) => string;
|
|
20
|
+
export declare const makeDesktopCommand: (env?: () => DesktopEnv) => Command;
|
|
21
|
+
export declare const desktopCommand: Command;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { parseFlags, textFlag, usageError } from "../args.js";
|
|
6
|
+
import { EXIT } from "../exit-codes.js";
|
|
7
|
+
/**
|
|
8
|
+
* `mk desktop`: hand the user the one-click Claude Desktop extension.
|
|
9
|
+
*
|
|
10
|
+
* The bundle itself is built and validated once, by `scripts/build-mcpb.mjs`
|
|
11
|
+
* (`@anthropic-ai/mcpb validate` + `pack`), and shipped inside the npm package at
|
|
12
|
+
* `mcpb/motion-kit-<version>.mcpb`. This command copies that file out; it never
|
|
13
|
+
* re-zips, so there is only one place the bundle's contents are decided.
|
|
14
|
+
*/
|
|
15
|
+
const USAGE = `mk desktop [<dir>] [--out <dir>]
|
|
16
|
+
|
|
17
|
+
Copy the Claude Desktop extension (motion-kit-<version>.mcpb) into <dir> (default .).
|
|
18
|
+
Open the written file to install it; it carries no engine — every tool call runs the
|
|
19
|
+
latest @anvpx/motion in the folder the call names.
|
|
20
|
+
--out <dir> where to write the .mcpb (created when missing)
|
|
21
|
+
Exit 0; 1 the bundle is missing or ambiguous; 2 usage.
|
|
22
|
+
`;
|
|
23
|
+
const FLAGS = { out: { type: "string" } };
|
|
24
|
+
/** Only an archive this build produces; a foreign `.mcpb` in the folder is not ours to hand out. */
|
|
25
|
+
const BUNDLE_NAME = /^motion-kit-\d+\.\d+\.\d+\.mcpb$/;
|
|
26
|
+
const defaultResolve = (id) => createRequire(import.meta.url).resolve(id);
|
|
27
|
+
/** `<repo>/packages/core/mcpb`, where the release build stages the bundle. */
|
|
28
|
+
export const repoBundleDir = () => fileURLToPath(new URL("../../../../packages/core/mcpb", import.meta.url));
|
|
29
|
+
const MISSING = "cannot find the packaged Desktop bundle; install @anvpx/motion (it ships mcpb/) or run `node scripts/build-mcpb.mjs`";
|
|
30
|
+
/**
|
|
31
|
+
* The bundle directory, in order: (a) `mcpb/` inside the installed
|
|
32
|
+
* `@anvpx/motion` package, (b) `<repo>/packages/core/mcpb` for development.
|
|
33
|
+
* Never returns a path that does not exist.
|
|
34
|
+
*/
|
|
35
|
+
export const resolveBundleDir = (resolveCorePkg = defaultResolve, exists = existsSync) => {
|
|
36
|
+
const searched = [];
|
|
37
|
+
try {
|
|
38
|
+
const installed = join(dirname(resolveCorePkg("@anvpx/motion/package.json")), "mcpb");
|
|
39
|
+
searched.push(installed);
|
|
40
|
+
if (exists(installed))
|
|
41
|
+
return installed;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Not installed, or an exports map hides ./package.json.
|
|
45
|
+
}
|
|
46
|
+
const repo = repoBundleDir();
|
|
47
|
+
searched.push(repo);
|
|
48
|
+
if (exists(repo))
|
|
49
|
+
return repo;
|
|
50
|
+
throw new Error(`${MISSING}; searched: ${searched.join(", ")}`);
|
|
51
|
+
};
|
|
52
|
+
export const defaultDesktopEnv = () => ({ sourceDir: resolveBundleDir() });
|
|
53
|
+
function parseDesktop(args, io) {
|
|
54
|
+
const parsed = parseFlags("desktop", USAGE, args, FLAGS, io);
|
|
55
|
+
if (parsed.kind === "exit")
|
|
56
|
+
return parsed.code;
|
|
57
|
+
const [positional, ...extra] = parsed.positionals;
|
|
58
|
+
if (extra.length > 0) {
|
|
59
|
+
return usageError("desktop", USAGE, `unexpected argument "${extra[0]}"`, io).code;
|
|
60
|
+
}
|
|
61
|
+
const flag = textFlag(parsed.flags, "out");
|
|
62
|
+
if (flag !== undefined && positional !== undefined) {
|
|
63
|
+
return usageError("desktop", USAGE, "use --out or <dir>, not both", io).code;
|
|
64
|
+
}
|
|
65
|
+
const out = flag ?? positional ?? ".";
|
|
66
|
+
if (out === "")
|
|
67
|
+
return usageError("desktop", USAGE, "--out needs a directory", io).code;
|
|
68
|
+
return { out };
|
|
69
|
+
}
|
|
70
|
+
/** Exactly one bundle this build produced, or the reason there is not. */
|
|
71
|
+
export const pickBundle = (entries, dir) => {
|
|
72
|
+
const bundles = entries.filter((entry) => BUNDLE_NAME.test(entry));
|
|
73
|
+
if (bundles.length === 1)
|
|
74
|
+
return bundles[0];
|
|
75
|
+
if (bundles.length === 0) {
|
|
76
|
+
throw new Error(`no motion-kit-<version>.mcpb in ${dir}; build it with \`node scripts/build-mcpb.mjs\``);
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`expected one motion-kit-<version>.mcpb in ${dir}, found ${bundles.length}: ${bundles.join(", ")}; clean the folder and rebuild`);
|
|
79
|
+
};
|
|
80
|
+
export const makeDesktopCommand = (env = defaultDesktopEnv) => ({
|
|
81
|
+
name: "desktop",
|
|
82
|
+
summary: "write the Claude Desktop extension (.mcpb)",
|
|
83
|
+
async run(args, io) {
|
|
84
|
+
const request = parseDesktop(args, io);
|
|
85
|
+
if (typeof request === "number")
|
|
86
|
+
return request;
|
|
87
|
+
let sourceDir;
|
|
88
|
+
try {
|
|
89
|
+
sourceDir = env().sourceDir;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
io.stderr(`mk desktop: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
93
|
+
return EXIT.ERROR;
|
|
94
|
+
}
|
|
95
|
+
let name;
|
|
96
|
+
try {
|
|
97
|
+
name = pickBundle(await io.host.listDir(sourceDir), sourceDir);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
io.stderr(`mk desktop: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
101
|
+
return EXIT.ERROR;
|
|
102
|
+
}
|
|
103
|
+
const from = join(sourceDir, name);
|
|
104
|
+
const to = join(resolve(request.out), name);
|
|
105
|
+
if (from !== to) {
|
|
106
|
+
try {
|
|
107
|
+
await io.host.copyFile(from, to);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
io.stderr(`mk desktop: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
111
|
+
return EXIT.ERROR;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
io.stdout(from === to
|
|
115
|
+
? `${to}\nalready there; open it to install the extension, then run mk_doctor\n`
|
|
116
|
+
: `${to}\nopen it to install the extension, then run mk_doctor\n`);
|
|
117
|
+
return EXIT.OK;
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
export const desktopCommand = makeDesktopCommand();
|
package/dist/main.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A dependency-free MCP (stdio) server for motion-kit, used by the Claude Desktop bundle.
|
|
3
|
+
*
|
|
4
|
+
* It owns no logic: every tool shells out to the same `mk` the CLI ships, so the extension can
|
|
5
|
+
* never drift from the engine. The bundle copies this file's compiled output, so it may import
|
|
6
|
+
* node builtins only — nothing from the workspace.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROTOCOL_VERSION = "2025-06-18";
|
|
9
|
+
export declare const DEFAULT_CLI = "@anvpx/motion@latest";
|
|
10
|
+
export interface RunRequest {
|
|
11
|
+
readonly command: string;
|
|
12
|
+
readonly args: readonly string[];
|
|
13
|
+
readonly cwd: string;
|
|
14
|
+
readonly timeoutMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface RunResult {
|
|
17
|
+
readonly code: number | null;
|
|
18
|
+
readonly stdout: string;
|
|
19
|
+
readonly stderr: string;
|
|
20
|
+
}
|
|
21
|
+
export type Runner = (request: RunRequest) => Promise<RunResult>;
|
|
22
|
+
export interface ServerOptions {
|
|
23
|
+
/** npm spec or an absolute path to an `mk` binary; default `@anvpx/motion@latest`. */
|
|
24
|
+
readonly cli?: string;
|
|
25
|
+
readonly version?: string;
|
|
26
|
+
/** Default working directory for tools that omit `cwd`. */
|
|
27
|
+
readonly cwd?: string;
|
|
28
|
+
/** Injected in tests; the default spawns a process. */
|
|
29
|
+
readonly run?: Runner;
|
|
30
|
+
}
|
|
31
|
+
interface ToolSpec {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly description: string;
|
|
34
|
+
readonly inputSchema: Record<string, unknown>;
|
|
35
|
+
readonly argv: (args: Record<string, unknown>) => string[];
|
|
36
|
+
readonly timeoutMs?: number;
|
|
37
|
+
/** Defaults to true; a tool that reads no film folder sets it false. */
|
|
38
|
+
readonly needsCwd?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const TOOLS: readonly ToolSpec[];
|
|
41
|
+
export declare const resolveCwd: (value: unknown, fallback: string | undefined) => string;
|
|
42
|
+
/** A fully resolved command line: no shell, so an argument can never become syntax. */
|
|
43
|
+
export interface Launch {
|
|
44
|
+
readonly command: string;
|
|
45
|
+
readonly args: readonly string[];
|
|
46
|
+
/** cmd.exe needs its own quoting, so Node must not quote the argument again. */
|
|
47
|
+
readonly windowsVerbatimArguments?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** The npm CLI's npx entry beside this Node, so the default engine needs no shell. */
|
|
50
|
+
export declare const npxCliPath: (execPath?: string, exists?: (path: string) => boolean) => string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* How to run the engine, with no shell unless a .cmd shim forces one.
|
|
53
|
+
*
|
|
54
|
+
* The npm-spec path runs Node on npm's own npx entry, so a template name, a
|
|
55
|
+
* storyboard path or a user's approval note can never be parsed as shell syntax.
|
|
56
|
+
*/
|
|
57
|
+
export declare const planLaunch: (cli: string, args: readonly string[], options?: {
|
|
58
|
+
readonly platform?: NodeJS.Platform;
|
|
59
|
+
readonly execPath?: string;
|
|
60
|
+
readonly exists?: (path: string) => boolean;
|
|
61
|
+
readonly comSpec?: string | undefined;
|
|
62
|
+
}) => Launch;
|
|
63
|
+
interface Request {
|
|
64
|
+
readonly jsonrpc?: string;
|
|
65
|
+
readonly id?: number | string | null;
|
|
66
|
+
readonly method?: string;
|
|
67
|
+
readonly params?: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
/** One JSON-RPC message in, one response out (undefined for notifications). */
|
|
70
|
+
export declare const handleMessage: (message: Request, options?: ServerOptions) => Promise<Record<string, unknown> | undefined>;
|
|
71
|
+
/** The bundle's own version, read from the manifest beside the server; "0.0.0" outside a bundle. */
|
|
72
|
+
export declare const bundleVersion: () => string;
|
|
73
|
+
/**
|
|
74
|
+
* An MCPB user_config value, or undefined when unset or left as its placeholder.
|
|
75
|
+
* The bundle loader substitutes only keys the user filled in; an empty optional
|
|
76
|
+
* setting can still arrive as the literal `${user_config.…}` text, which is
|
|
77
|
+
* truthy and would become a cwd that does not exist.
|
|
78
|
+
*/
|
|
79
|
+
export declare const envSetting: (name: string) => string | undefined;
|
|
80
|
+
/** Starts the stdio loop. Desktop runs this through the bundle's manifest. */
|
|
81
|
+
export declare const main: () => void;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
/**
|
|
7
|
+
* A dependency-free MCP (stdio) server for motion-kit, used by the Claude Desktop bundle.
|
|
8
|
+
*
|
|
9
|
+
* It owns no logic: every tool shells out to the same `mk` the CLI ships, so the extension can
|
|
10
|
+
* never drift from the engine. The bundle copies this file's compiled output, so it may import
|
|
11
|
+
* node builtins only — nothing from the workspace.
|
|
12
|
+
*/
|
|
13
|
+
export const PROTOCOL_VERSION = "2025-06-18";
|
|
14
|
+
export const DEFAULT_CLI = "@anvpx/motion@latest";
|
|
15
|
+
const RENDER_TIMEOUT_MS = 60 * 60 * 1000;
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = 20 * 60 * 1000;
|
|
17
|
+
const INSTRUCTIONS = [
|
|
18
|
+
"motion-kit turns a small storyboard JSON into an animated video, rendered locally.",
|
|
19
|
+
"Work inside the folder the user names. Write storyboard.json (and scenes/<name>/ for an",
|
|
20
|
+
"authored beat) yourself; then call mk_validate, mk_preview, show the contact sheet, and only",
|
|
21
|
+
"after an explicit yes call mk_approve and then mk_render with gated: true.",
|
|
22
|
+
"Never render without that yes. If a call returns an E /scenes/N line, fix the smallest thing",
|
|
23
|
+
"it names and validate again — do not rewrite the board from scratch.",
|
|
24
|
+
].join(" ");
|
|
25
|
+
const str = (args, key) => {
|
|
26
|
+
const value = args[key];
|
|
27
|
+
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
28
|
+
};
|
|
29
|
+
const flag = (args, key) => args[key] === true;
|
|
30
|
+
/** The optional audio/music flags shared by preview, approve and render. */
|
|
31
|
+
const audible = (args) => {
|
|
32
|
+
const audio = str(args, "audio");
|
|
33
|
+
const music = str(args, "music");
|
|
34
|
+
const volume = args.music_volume;
|
|
35
|
+
const license = str(args, "music_license");
|
|
36
|
+
return [
|
|
37
|
+
...(audio === undefined ? [] : ["--audio", audio]),
|
|
38
|
+
...(music === undefined ? [] : ["--music", music]),
|
|
39
|
+
...(typeof volume === "number" ? ["--music-volume", String(volume)] : []),
|
|
40
|
+
...(license === undefined ? [] : ["--music-license", license]),
|
|
41
|
+
];
|
|
42
|
+
};
|
|
43
|
+
const cwdSchema = {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Absolute path of the film folder the user names (the folder holding storyboard.json).",
|
|
46
|
+
};
|
|
47
|
+
const storyboardSchema = {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Path to storyboard.json, relative to cwd or absolute.",
|
|
50
|
+
};
|
|
51
|
+
const audioSchema = {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Voice manifest written by `mk voice`; omit for a silent film.",
|
|
54
|
+
};
|
|
55
|
+
const musicSchema = { type: "string", description: "CC0 music bed (.wav); requires audio." };
|
|
56
|
+
export const TOOLS = [
|
|
57
|
+
{
|
|
58
|
+
name: "mk_version",
|
|
59
|
+
description: "Report the engine version that would run, and this bundle's version. Ask this before blaming a bug on a stale extension.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: { cwd: cwdSchema },
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
},
|
|
65
|
+
argv: () => ["version", "--json"],
|
|
66
|
+
needsCwd: false,
|
|
67
|
+
timeoutMs: 60 * 1000,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "mk_doctor",
|
|
71
|
+
description: "Check the local engine: node, ffmpeg, renderer, browser, fonts, voice rows. Run this first.",
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: { cwd: cwdSchema },
|
|
75
|
+
additionalProperties: false,
|
|
76
|
+
},
|
|
77
|
+
argv: () => ["doctor", "--json"],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "mk_catalog",
|
|
81
|
+
description: "List the 29 scene types, or show one type's props. The catalog is the authority on props.",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
scene: { type: "string", description: 'Optional scene type, e.g. "compare".' },
|
|
86
|
+
},
|
|
87
|
+
additionalProperties: false,
|
|
88
|
+
},
|
|
89
|
+
argv: (args) => {
|
|
90
|
+
const scene = str(args, "scene");
|
|
91
|
+
return scene === undefined ? ["catalog"] : ["catalog", scene];
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "mk_new",
|
|
96
|
+
description: "Instantiate a template blueprint into a validated storyboard (writes themes/ too).",
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: "object",
|
|
99
|
+
properties: {
|
|
100
|
+
cwd: cwdSchema,
|
|
101
|
+
template: { type: "string", description: 'Template/blueprint, e.g. "explain/concept".' },
|
|
102
|
+
out: { type: "string", description: 'Output path, e.g. "storyboard.json".' },
|
|
103
|
+
demo: { type: "boolean", description: "Start from the blueprint's own example copy." },
|
|
104
|
+
},
|
|
105
|
+
required: ["cwd", "template", "out"],
|
|
106
|
+
additionalProperties: false,
|
|
107
|
+
},
|
|
108
|
+
argv: (args) => [
|
|
109
|
+
"new",
|
|
110
|
+
str(args, "template") ?? "",
|
|
111
|
+
...(flag(args, "demo") ? ["--demo"] : []),
|
|
112
|
+
"--out",
|
|
113
|
+
str(args, "out") ?? "storyboard.json",
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "mk_validate",
|
|
118
|
+
description: "Schema + lint check. Returns E /scenes/N lines (fix those) and W lines (read them).",
|
|
119
|
+
inputSchema: {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: { cwd: cwdSchema, storyboard: storyboardSchema },
|
|
122
|
+
required: ["cwd", "storyboard"],
|
|
123
|
+
additionalProperties: false,
|
|
124
|
+
},
|
|
125
|
+
argv: (args) => ["validate", str(args, "storyboard") ?? ""],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "mk_still",
|
|
129
|
+
description: 'Render stills at given seconds, e.g. at "1,5,9". Cheapest way to inspect a frame.',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
cwd: cwdSchema,
|
|
134
|
+
storyboard: storyboardSchema,
|
|
135
|
+
at: { type: "string", description: "Seconds, comma separated." },
|
|
136
|
+
},
|
|
137
|
+
required: ["cwd", "storyboard", "at"],
|
|
138
|
+
additionalProperties: false,
|
|
139
|
+
},
|
|
140
|
+
argv: (args) => ["still", str(args, "storyboard") ?? "", "--at", str(args, "at") ?? "1"],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "mk_preview",
|
|
144
|
+
description: "Build the review pack: contact.png, stills, clip.mp4, preview.json. Show it to the user.",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
cwd: cwdSchema,
|
|
149
|
+
storyboard: storyboardSchema,
|
|
150
|
+
full: { type: "boolean", description: "Render the complete board instead of a trailer." },
|
|
151
|
+
audio: audioSchema,
|
|
152
|
+
music: musicSchema,
|
|
153
|
+
music_volume: { type: "number", description: "Bed level in (0, 1], default 0.5." },
|
|
154
|
+
music_license: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Licence-evidence file hashed into the receipt.",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
required: ["cwd", "storyboard"],
|
|
160
|
+
additionalProperties: false,
|
|
161
|
+
},
|
|
162
|
+
argv: (args) => [
|
|
163
|
+
"preview",
|
|
164
|
+
str(args, "storyboard") ?? "",
|
|
165
|
+
...(flag(args, "full") ? ["--full"] : []),
|
|
166
|
+
...audible(args),
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "mk_approve",
|
|
171
|
+
description: "Record the user's explicit yes against the current inputs. Never call before they agree.",
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: "object",
|
|
174
|
+
properties: {
|
|
175
|
+
cwd: cwdSchema,
|
|
176
|
+
storyboard: storyboardSchema,
|
|
177
|
+
note: { type: "string", description: "The user's words, verbatim." },
|
|
178
|
+
audio: audioSchema,
|
|
179
|
+
music: musicSchema,
|
|
180
|
+
music_volume: { type: "number" },
|
|
181
|
+
music_license: { type: "string" },
|
|
182
|
+
},
|
|
183
|
+
required: ["cwd", "storyboard", "note"],
|
|
184
|
+
additionalProperties: false,
|
|
185
|
+
},
|
|
186
|
+
argv: (args) => [
|
|
187
|
+
"approve",
|
|
188
|
+
str(args, "storyboard") ?? "",
|
|
189
|
+
"--note",
|
|
190
|
+
str(args, "note") ?? "",
|
|
191
|
+
...audible(args),
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "mk_render",
|
|
196
|
+
description: "Render the delivery mp4. Exits 4 (AWAITING_APPROVAL) when it needs a fresh yes.",
|
|
197
|
+
inputSchema: {
|
|
198
|
+
type: "object",
|
|
199
|
+
properties: {
|
|
200
|
+
cwd: cwdSchema,
|
|
201
|
+
storyboard: storyboardSchema,
|
|
202
|
+
out: { type: "string", description: "Output directory, default out/final." },
|
|
203
|
+
verify: { type: "boolean", description: "Re-probe the mp4 after rendering (mp4 only)." },
|
|
204
|
+
audio: audioSchema,
|
|
205
|
+
music: musicSchema,
|
|
206
|
+
music_volume: { type: "number" },
|
|
207
|
+
music_license: { type: "string" },
|
|
208
|
+
},
|
|
209
|
+
required: ["cwd", "storyboard"],
|
|
210
|
+
additionalProperties: false,
|
|
211
|
+
},
|
|
212
|
+
timeoutMs: RENDER_TIMEOUT_MS,
|
|
213
|
+
argv: (args) => [
|
|
214
|
+
"render",
|
|
215
|
+
str(args, "storyboard") ?? "",
|
|
216
|
+
"--gated",
|
|
217
|
+
...(flag(args, "verify") ? ["--verify"] : []),
|
|
218
|
+
...(str(args, "out") === undefined ? [] : ["--out", str(args, "out") ?? ""]),
|
|
219
|
+
...audible(args),
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
];
|
|
223
|
+
export const resolveCwd = (value, fallback) => {
|
|
224
|
+
const raw = typeof value === "string" && value.trim() !== "" ? value : fallback;
|
|
225
|
+
if (raw === undefined)
|
|
226
|
+
throw new Error("cwd is required: the folder holding storyboard.json");
|
|
227
|
+
const abs = isAbsolute(raw) ? raw : resolve(process.cwd(), raw);
|
|
228
|
+
let stats;
|
|
229
|
+
try {
|
|
230
|
+
stats = statSync(abs);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
throw new Error(`cwd does not exist: ${abs}`);
|
|
234
|
+
}
|
|
235
|
+
if (!stats.isDirectory())
|
|
236
|
+
throw new Error(`cwd is not a folder: ${abs}`);
|
|
237
|
+
return abs;
|
|
238
|
+
};
|
|
239
|
+
/** The npm CLI's npx entry beside this Node, so the default engine needs no shell. */
|
|
240
|
+
export const npxCliPath = (execPath = process.execPath, exists = existsSync) => {
|
|
241
|
+
const dir = dirname(execPath);
|
|
242
|
+
const candidates = [
|
|
243
|
+
join(dir, "node_modules", "npm", "bin", "npx-cli.js"),
|
|
244
|
+
join(dir, "..", "lib", "node_modules", "npm", "bin", "npx-cli.js"),
|
|
245
|
+
];
|
|
246
|
+
return candidates.find((candidate) => exists(candidate));
|
|
247
|
+
};
|
|
248
|
+
/** A .cmd/.bat shim needs cmd.exe; refuse the characters that survive its quoting. */
|
|
249
|
+
const cmdArg = (value) => {
|
|
250
|
+
if (/["%\r\n]/.test(value)) {
|
|
251
|
+
throw new Error(`unsupported character in argument for a .cmd engine: ${value}`);
|
|
252
|
+
}
|
|
253
|
+
return /[\s&|<>^()]/.test(value) ? `"${value}"` : value;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* How to run the engine, with no shell unless a .cmd shim forces one.
|
|
257
|
+
*
|
|
258
|
+
* The npm-spec path runs Node on npm's own npx entry, so a template name, a
|
|
259
|
+
* storyboard path or a user's approval note can never be parsed as shell syntax.
|
|
260
|
+
*/
|
|
261
|
+
export const planLaunch = (cli, args, options = {}) => {
|
|
262
|
+
const platform = options.platform ?? process.platform;
|
|
263
|
+
const execPath = options.execPath ?? process.execPath;
|
|
264
|
+
const exists = options.exists ?? existsSync;
|
|
265
|
+
const cmd = options.comSpec ?? process.env.ComSpec ?? "cmd.exe";
|
|
266
|
+
if (isAbsolute(cli) && exists(cli)) {
|
|
267
|
+
if (platform === "win32" && /\.(cmd|bat)$/i.test(cli)) {
|
|
268
|
+
const exe = cmdArg(cli);
|
|
269
|
+
const rest = args.map(cmdArg).join(" ");
|
|
270
|
+
return {
|
|
271
|
+
command: cmd,
|
|
272
|
+
// cmd.exe strips the outer pair of quotes after /s, so the shim stays one quoted token.
|
|
273
|
+
args: ["/d", "/s", "/c", `""${exe}"${rest === "" ? "" : ` ${rest}`}"`],
|
|
274
|
+
windowsVerbatimArguments: true,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return { command: cli, args: [...args] };
|
|
278
|
+
}
|
|
279
|
+
const npxCli = npxCliPath(execPath, exists);
|
|
280
|
+
if (npxCli !== undefined)
|
|
281
|
+
return { command: execPath, args: [npxCli, "-y", cli, ...args] };
|
|
282
|
+
if (platform === "win32") {
|
|
283
|
+
return {
|
|
284
|
+
command: cmd,
|
|
285
|
+
args: ["/d", "/s", "/c", ["npx", "-y", cli, ...args].map(cmdArg).join(" ")],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
return { command: "npx", args: ["-y", cli, ...args] };
|
|
289
|
+
};
|
|
290
|
+
const defaultRunner = (cli) => (request) => new Promise((resolvePromise, reject) => {
|
|
291
|
+
let launch;
|
|
292
|
+
try {
|
|
293
|
+
launch = planLaunch(cli, request.args);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
reject(error);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const child = spawn(launch.command, [...launch.args], {
|
|
300
|
+
cwd: request.cwd,
|
|
301
|
+
windowsHide: true,
|
|
302
|
+
...(launch.windowsVerbatimArguments === true ? { windowsVerbatimArguments: true } : {}),
|
|
303
|
+
});
|
|
304
|
+
let stdout = "";
|
|
305
|
+
let stderr = "";
|
|
306
|
+
const timer = setTimeout(() => {
|
|
307
|
+
child.kill();
|
|
308
|
+
reject(new Error(`mk timed out after ${Math.round(request.timeoutMs / 1000)}s`));
|
|
309
|
+
}, request.timeoutMs);
|
|
310
|
+
child.stdout.on("data", (chunk) => {
|
|
311
|
+
stdout += chunk.toString();
|
|
312
|
+
});
|
|
313
|
+
child.stderr.on("data", (chunk) => {
|
|
314
|
+
stderr += chunk.toString();
|
|
315
|
+
});
|
|
316
|
+
child.on("error", (error) => {
|
|
317
|
+
clearTimeout(timer);
|
|
318
|
+
reject(error);
|
|
319
|
+
});
|
|
320
|
+
child.on("close", (code) => {
|
|
321
|
+
clearTimeout(timer);
|
|
322
|
+
resolvePromise({ code, stdout, stderr });
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
const text = (value) => ({
|
|
326
|
+
content: [{ type: "text", text: value }],
|
|
327
|
+
});
|
|
328
|
+
/** One JSON-RPC message in, one response out (undefined for notifications). */
|
|
329
|
+
export const handleMessage = async (message, options = {}) => {
|
|
330
|
+
const id = message.id ?? null;
|
|
331
|
+
const reply = (result) => ({ jsonrpc: "2.0", id, result });
|
|
332
|
+
const fail = (code, msg) => ({
|
|
333
|
+
jsonrpc: "2.0",
|
|
334
|
+
id,
|
|
335
|
+
error: { code, message: msg },
|
|
336
|
+
});
|
|
337
|
+
if (message.method === undefined)
|
|
338
|
+
return fail(-32600, "invalid request: no method");
|
|
339
|
+
if (message.method.startsWith("notifications/"))
|
|
340
|
+
return undefined;
|
|
341
|
+
if (message.method === "initialize") {
|
|
342
|
+
return reply({
|
|
343
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
344
|
+
capabilities: { tools: { listChanged: false } },
|
|
345
|
+
serverInfo: { name: "motion-kit", version: options.version ?? bundleVersion() },
|
|
346
|
+
instructions: INSTRUCTIONS,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
if (message.method === "ping")
|
|
350
|
+
return reply({});
|
|
351
|
+
if (message.method === "tools/list") {
|
|
352
|
+
return reply({
|
|
353
|
+
tools: TOOLS.map((tool) => ({
|
|
354
|
+
name: tool.name,
|
|
355
|
+
description: tool.description,
|
|
356
|
+
inputSchema: tool.inputSchema,
|
|
357
|
+
})),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (message.method !== "tools/call")
|
|
361
|
+
return fail(-32601, `unknown method: ${message.method}`);
|
|
362
|
+
const params = message.params ?? {};
|
|
363
|
+
const name = typeof params.name === "string" ? params.name : "";
|
|
364
|
+
const tool = TOOLS.find((candidate) => candidate.name === name);
|
|
365
|
+
if (tool === undefined)
|
|
366
|
+
return fail(-32602, `unknown tool: ${name}`);
|
|
367
|
+
const args = typeof params.arguments === "object" && params.arguments !== null
|
|
368
|
+
? params.arguments
|
|
369
|
+
: {};
|
|
370
|
+
const run = options.run ?? defaultRunner(options.cli ?? DEFAULT_CLI);
|
|
371
|
+
try {
|
|
372
|
+
// Informational tools run anywhere; a film tool must name a folder that exists.
|
|
373
|
+
const cwd = tool.needsCwd === false ? (options.cwd ?? process.cwd()) : resolveCwd(args.cwd, options.cwd);
|
|
374
|
+
const result = await run({
|
|
375
|
+
command: tool.name,
|
|
376
|
+
args: tool.argv(args),
|
|
377
|
+
cwd,
|
|
378
|
+
timeoutMs: tool.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
379
|
+
});
|
|
380
|
+
const tail = `\nexit ${result.code ?? "null"}`;
|
|
381
|
+
// The engine answers for itself; only the bundle's own version is the server's to add.
|
|
382
|
+
const bundle = tool.name === "mk_version" ? `\nbundle: ${options.version ?? bundleVersion()}` : "";
|
|
383
|
+
const body = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join("\n");
|
|
384
|
+
if (result.code === 0)
|
|
385
|
+
return reply(text(body + bundle + tail));
|
|
386
|
+
return reply({ ...text(body + bundle + tail), isError: true });
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
390
|
+
return reply({ ...text(`${tool.name} failed: ${detail}`), isError: true });
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
/** The bundle's own version, read from the manifest beside the server; "0.0.0" outside a bundle. */
|
|
394
|
+
export const bundleVersion = () => {
|
|
395
|
+
try {
|
|
396
|
+
const manifest = JSON.parse(readFileSync(new URL("../manifest.json", import.meta.url), "utf8"));
|
|
397
|
+
return typeof manifest.version === "string" ? manifest.version : "0.0.0";
|
|
398
|
+
}
|
|
399
|
+
catch {
|
|
400
|
+
return "0.0.0";
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* An MCPB user_config value, or undefined when unset or left as its placeholder.
|
|
405
|
+
* The bundle loader substitutes only keys the user filled in; an empty optional
|
|
406
|
+
* setting can still arrive as the literal `${user_config.…}` text, which is
|
|
407
|
+
* truthy and would become a cwd that does not exist.
|
|
408
|
+
*/
|
|
409
|
+
export const envSetting = (name) => {
|
|
410
|
+
const value = process.env[name]?.trim();
|
|
411
|
+
if (value === undefined || value === "")
|
|
412
|
+
return undefined;
|
|
413
|
+
// A placeholder anywhere means the loader did not substitute it: ${user_config.x}, ${HOME}, ...
|
|
414
|
+
if (/\$\{[^}]*\}/.test(value))
|
|
415
|
+
return undefined;
|
|
416
|
+
return value;
|
|
417
|
+
};
|
|
418
|
+
/** Starts the stdio loop. Desktop runs this through the bundle's manifest. */
|
|
419
|
+
export const main = () => {
|
|
420
|
+
const options = {
|
|
421
|
+
cli: envSetting("MOTION_KIT_CLI") ?? DEFAULT_CLI,
|
|
422
|
+
version: envSetting("MOTION_KIT_VERSION") ?? bundleVersion(),
|
|
423
|
+
cwd: envSetting("MOTION_KIT_CWD"),
|
|
424
|
+
};
|
|
425
|
+
const lines = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
426
|
+
const send = (payload) => {
|
|
427
|
+
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
428
|
+
};
|
|
429
|
+
lines.on("line", (line) => {
|
|
430
|
+
const trimmed = line.trim();
|
|
431
|
+
if (trimmed === "")
|
|
432
|
+
return;
|
|
433
|
+
let message;
|
|
434
|
+
try {
|
|
435
|
+
message = JSON.parse(trimmed);
|
|
436
|
+
}
|
|
437
|
+
catch {
|
|
438
|
+
send({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "parse error" } });
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
void handleMessage(message, options)
|
|
442
|
+
.then((response) => {
|
|
443
|
+
if (response !== undefined)
|
|
444
|
+
send(response);
|
|
445
|
+
})
|
|
446
|
+
.catch((error) => {
|
|
447
|
+
send({
|
|
448
|
+
jsonrpc: "2.0",
|
|
449
|
+
id: message.id ?? null,
|
|
450
|
+
error: { code: -32603, message: String(error) },
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
const entry = process.argv[1];
|
|
456
|
+
if (entry !== undefined && import.meta.url === pathToFileURL(entry).href)
|
|
457
|
+
main();
|
package/dist/plugin/install.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ import type { Command } from "../types.ts";
|
|
|
6
6
|
* version", which also pins `.claude-plugin/plugin.json`). `0.0.0` is the
|
|
7
7
|
* pre-publish placeholder: an isolated `npm install` of the packed tarball
|
|
8
8
|
* rewrites internal `workspace:*` to `0.0.0`, which is private/unpublished,
|
|
9
|
-
* so `npx -y @anvpx/motion@0.1.
|
|
9
|
+
* so `npx -y @anvpx/motion@0.1.52` 404s in isolation (qualify-pack exits 2
|
|
10
10
|
* BLOCKED with `unpublishedInternals`). Do NOT unpin or float the range to
|
|
11
11
|
* work around it. Publish path is choiceA (publish internal @anvpx/motion-*
|
|
12
12
|
* at real versions) or choiceB (bundle into one tarball); either lands with
|
|
13
13
|
* a version bump of core manifest + this pin + plugin.json together.
|
|
14
14
|
*/
|
|
15
|
-
export declare const PINNED_CORE_VERSION = "0.1.
|
|
16
|
-
export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.
|
|
15
|
+
export declare const PINNED_CORE_VERSION = "0.1.52";
|
|
16
|
+
export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.52";
|
|
17
17
|
/** Skill file whose sha256 must survive `plugin install` byte for byte. */
|
|
18
18
|
export declare const PLUGIN_SKILL: string;
|
|
19
19
|
export interface PluginEnv {
|
package/dist/plugin/install.js
CHANGED
|
@@ -11,13 +11,13 @@ import { EXIT } from "../exit-codes.js";
|
|
|
11
11
|
* version", which also pins `.claude-plugin/plugin.json`). `0.0.0` is the
|
|
12
12
|
* pre-publish placeholder: an isolated `npm install` of the packed tarball
|
|
13
13
|
* rewrites internal `workspace:*` to `0.0.0`, which is private/unpublished,
|
|
14
|
-
* so `npx -y @anvpx/motion@0.1.
|
|
14
|
+
* so `npx -y @anvpx/motion@0.1.52` 404s in isolation (qualify-pack exits 2
|
|
15
15
|
* BLOCKED with `unpublishedInternals`). Do NOT unpin or float the range to
|
|
16
16
|
* work around it. Publish path is choiceA (publish internal @anvpx/motion-*
|
|
17
17
|
* at real versions) or choiceB (bundle into one tarball); either lands with
|
|
18
18
|
* a version bump of core manifest + this pin + plugin.json together.
|
|
19
19
|
*/
|
|
20
|
-
export const PINNED_CORE_VERSION = "0.1.
|
|
20
|
+
export const PINNED_CORE_VERSION = "0.1.52";
|
|
21
21
|
export const PINNED_NPX = `npx -y @anvpx/motion@${PINNED_CORE_VERSION}`;
|
|
22
22
|
/** Skill file whose sha256 must survive `plugin install` byte for byte. */
|
|
23
23
|
export const PLUGIN_SKILL = join("skills", "motion-kit", "SKILL.md");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "../types.ts";
|
|
2
|
+
/** The package manifest beside `dist/version/command.js`, or undefined when it moved. */
|
|
3
|
+
export declare const readOwnVersion: () => string | undefined;
|
|
4
|
+
export declare const makeVersionCommand: (version?: () => string | undefined) => Command;
|
|
5
|
+
export declare const versionCommand: Command;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { parseFlags, usageError } from "../args.js";
|
|
4
|
+
import { EXIT } from "../exit-codes.js";
|
|
5
|
+
/**
|
|
6
|
+
* `mk version`: the release of the engine that is answering.
|
|
7
|
+
*
|
|
8
|
+
* The CLI package and `@anvpx/motion` are released in lockstep (guarded by
|
|
9
|
+
* `plugin/version-pin.test.ts`), so reading the CLI's own manifest is the same
|
|
10
|
+
* answer as reading the engine's, without a network call.
|
|
11
|
+
*/
|
|
12
|
+
const USAGE = `mk version [--json]
|
|
13
|
+
|
|
14
|
+
Print the engine version (the @anvpx/motion release serving this command).
|
|
15
|
+
--json {"version":"x.y.z"}
|
|
16
|
+
Exit 0; 1 when the manifest cannot be read.
|
|
17
|
+
`;
|
|
18
|
+
const FLAGS = { json: { type: "boolean" } };
|
|
19
|
+
/** The package manifest beside `dist/version/command.js`, or undefined when it moved. */
|
|
20
|
+
export const readOwnVersion = () => {
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL("../../package.json", import.meta.url);
|
|
23
|
+
const manifest = JSON.parse(readFileSync(fileURLToPath(url), "utf8"));
|
|
24
|
+
return typeof manifest.version === "string" ? manifest.version : undefined;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export const makeVersionCommand = (version = readOwnVersion) => ({
|
|
31
|
+
name: "version",
|
|
32
|
+
summary: "print the engine version",
|
|
33
|
+
run(args, io) {
|
|
34
|
+
const parsed = parseFlags("version", USAGE, args, FLAGS, io);
|
|
35
|
+
if (parsed.kind === "exit")
|
|
36
|
+
return Promise.resolve(parsed.code);
|
|
37
|
+
// `--json` is the one machine-readable line; a stray positional is a usage error.
|
|
38
|
+
if (parsed.positionals.length > 0) {
|
|
39
|
+
return Promise.resolve(usageError("version", USAGE, `unexpected argument "${parsed.positionals[0]}"`, io).code);
|
|
40
|
+
}
|
|
41
|
+
const found = version();
|
|
42
|
+
if (found === undefined) {
|
|
43
|
+
io.stderr("mk version: cannot read the package manifest beside the CLI\n");
|
|
44
|
+
return Promise.resolve(EXIT.ERROR);
|
|
45
|
+
}
|
|
46
|
+
io.stdout(parsed.flags.json === true
|
|
47
|
+
? `${JSON.stringify({ version: found })}\n`
|
|
48
|
+
: `motion-kit ${found}\n`);
|
|
49
|
+
return Promise.resolve(EXIT.OK);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export const versionCommand = makeVersionCommand();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvpx/motion-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "The mk CLI for @anvpx/motion: validate, preview, approve and render storyboards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "anvpx",
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"dist/**/*.js",
|
|
30
30
|
"dist/**/*.d.ts"
|
|
31
31
|
],
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@anvpx/motion-audio": "0.1.50",
|
|
34
|
-
"@anvpx/motion-build": "0.1.50",
|
|
35
|
-
"@anvpx/motion-schema": "0.1.50",
|
|
36
|
-
"@anvpx/motion-templates": "0.1.50"
|
|
37
|
-
},
|
|
38
32
|
"scripts": {
|
|
33
|
+
"prepack": "pnpm -w run build",
|
|
39
34
|
"test:integration": "vitest run --config vitest.integration.config.ts"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@anvpx/motion-audio": "workspace:*",
|
|
38
|
+
"@anvpx/motion-build": "workspace:*",
|
|
39
|
+
"@anvpx/motion-schema": "workspace:*",
|
|
40
|
+
"@anvpx/motion-templates": "workspace:*"
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
}
|