@kevlns/v-cli 0.7.4 → 0.7.6
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/README.md +3 -1
- package/dist/cli.mjs +159 -40
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.mjs +36 -21
- package/package.json +3 -3
- package/skills/v-cli/SKILL.md +1 -1
- package/skills/v-cli/references/project.md +6 -6
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ v-cli capability run unity.test-start --project . --set mode=EditMode --json
|
|
|
49
49
|
|
|
50
50
|
project init 写入工程 `.vant/config/v-cli.json`,只保存 schemaVersion 和 provider bindings。已有配置只补缺失且有默认值的段,不覆盖已有值;显式 --binding 指向已有段时拒绝并提示 --reset。--reset 先备份再替换;--dry-run 不写配置或备份。art 图片通道需要显式 workspace/output/cache/projectId 绑定,不能猜当前图片工程 ID;视频通道以当前工程根目录保存独立配置与任务。
|
|
51
51
|
|
|
52
|
+
初始化也会按已安装工具的清单把完整技能(含 references、scripts)同步到 `$VANT_HOME/skills/managed`,默认位于 `~/.vant` 下。重复初始化复用内容一致的版本,`--dry-run` 只列出结果。用 `v-cli agent skills --json` 查看声明,用 `v-cli agent docs vant-spine-production` 读取美术工坊提供的 Spine 制作指南。
|
|
53
|
+
|
|
52
54
|
Vant 的角色、workflow 和项目组织属于 `.vant/config/project.json`,v-cli 不读取或写入。绑定路径限定工程内,拒绝穿越和链接越界;具体字段见 capability describe 的 provider.binding。
|
|
53
55
|
|
|
54
56
|
run 接受 --input JSON、--input-file FILE 和 --set k=v,按文件 → 内联 JSON → set 顺序合并,后者覆盖同名值。输入文件适合较大句柄或复杂结构,其路径以调用进程当前目录解析。目标由 --project 和绑定决定,不接受输入覆盖 projectPath。
|
|
@@ -102,7 +104,7 @@ v-cli capability describe art.run-resume --json
|
|
|
102
104
|
| unity | 精确 Editor 版本路由、CLI 校验、适配包安装和 Pipeline 调用;连接目标工程的运行中 Editor |
|
|
103
105
|
| figma | Figma 导出和 staging Prefab 工具;结构化 provider 仅离线 doctor/contract,不含联网导出或转换 |
|
|
104
106
|
| ship | 已构建游戏的 Steam/微信校验和开发渠道交付;不自动向玩家发布 |
|
|
105
|
-
| xlmerge | .xlsx/.xlsm Git
|
|
107
|
+
| xlmerge | .xlsx/.xlsm Git 冲突三方裁决与写回;Agent 可用 prepare/apply,人工审阅可用 launch |
|
|
106
108
|
|
|
107
109
|
每个插件首调先读 agent docs,再 describe。不要将插件执行成功当作引擎运行、平台发布或美术产物已完成。
|
|
108
110
|
|
package/dist/cli.mjs
CHANGED
|
@@ -75,8 +75,8 @@ function defaultHomeDir() {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// src/core/loader.ts
|
|
78
|
-
import
|
|
79
|
-
import
|
|
78
|
+
import fs16 from "fs";
|
|
79
|
+
import path17 from "path";
|
|
80
80
|
import { pathToFileURL } from "url";
|
|
81
81
|
|
|
82
82
|
// src/core/official.ts
|
|
@@ -701,11 +701,12 @@ function discoverToolSkills(options = {}) {
|
|
|
701
701
|
}
|
|
702
702
|
function readRuntimeSkill(command, options = {}) {
|
|
703
703
|
const tool = command ?? "v-cli";
|
|
704
|
-
const result4 = discoverToolSkills(options)
|
|
704
|
+
const result4 = discoverToolSkills(options);
|
|
705
|
+
const skill = result4.skills.find((s) => s.id === tool) ?? result4.skills.find((s) => s.tool === tool);
|
|
705
706
|
if (!skill) throw new Error("\u5DE5\u5177\u672A\u58F0\u660E\u8FD0\u884C\u6280\u80FD\uFF1A" + tool);
|
|
706
707
|
return { ...skill, file: skill.path, content: fs3.readFileSync(skill.path, "utf8"), sha256: createHash("sha256").update(fs3.readFileSync(skill.path)).digest("hex") };
|
|
707
708
|
}
|
|
708
|
-
function
|
|
709
|
+
function skillFileHashes(root2) {
|
|
709
710
|
const files = [];
|
|
710
711
|
const walk = (directory, prefix = "") => {
|
|
711
712
|
for (const entry of fs3.readdirSync(directory, { withFileTypes: true })) {
|
|
@@ -718,7 +719,10 @@ function skillBundleHash(root2) {
|
|
|
718
719
|
};
|
|
719
720
|
walk(root2);
|
|
720
721
|
files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
721
|
-
return
|
|
722
|
+
return files;
|
|
723
|
+
}
|
|
724
|
+
function skillBundleHash(root2) {
|
|
725
|
+
return createHash("sha256").update(JSON.stringify(skillFileHashes(root2))).digest("hex");
|
|
722
726
|
}
|
|
723
727
|
function exportToolSkill(command, options) {
|
|
724
728
|
if (!["codex", "claude"].includes(options.host) || !options.directory)
|
|
@@ -752,7 +756,7 @@ function exportToolSkill(command, options) {
|
|
|
752
756
|
};
|
|
753
757
|
walk(path4.dirname(skill.path), target);
|
|
754
758
|
const adapter = path4.join(root2, "adapters", options.host);
|
|
755
|
-
if (fs3.existsSync(adapter)) walk(adapter, target);
|
|
759
|
+
if (fs3.existsSync(adapter) && readRuntimeSkill(skill.tool, options).id === skill.id) walk(adapter, target);
|
|
756
760
|
if (!options.dryRun) for (const file2 of planned) {
|
|
757
761
|
fs3.mkdirSync(path4.dirname(file2.path), { recursive: true });
|
|
758
762
|
fs3.writeFileSync(file2.path, file2.bytes);
|
|
@@ -761,7 +765,7 @@ function exportToolSkill(command, options) {
|
|
|
761
765
|
}
|
|
762
766
|
|
|
763
767
|
// src/version.ts
|
|
764
|
-
var VERSION = "0.7.
|
|
768
|
+
var VERSION = "0.7.6";
|
|
765
769
|
|
|
766
770
|
// src/commands/agent.ts
|
|
767
771
|
function buildAgentIndex(builtin, local, official) {
|
|
@@ -874,7 +878,7 @@ var agent = {
|
|
|
874
878
|
path: ["docs"],
|
|
875
879
|
usage: "v-cli agent docs [command] [--json]",
|
|
876
880
|
description: "\u8BFB\u53D6\u5DE5\u5177\u58F0\u660E\u7684\u8FD0\u884C\u6280\u80FD\u5165\u53E3",
|
|
877
|
-
arguments: [{ name: "command", required: false, description: "\
|
|
881
|
+
arguments: [{ name: "command", required: false, description: "\u63D2\u4EF6\u547D\u4EE4\u540D\u6216\u6280\u80FD ID" }],
|
|
878
882
|
options: [{ flags: "--json", description: "\u8F93\u51FA { package, version, sha256, content }" }],
|
|
879
883
|
output: {
|
|
880
884
|
format: "stdout",
|
|
@@ -950,7 +954,7 @@ var agent = {
|
|
|
950
954
|
}
|
|
951
955
|
ctx.log.result(lines.join("\n"));
|
|
952
956
|
});
|
|
953
|
-
program.command("docs").description("\u8BFB\u53D6\u5DE5\u5177\u58F0\u660E\u7684\u8FD0\u884C\u6280\u80FD\u5165\u53E3").argument("[command]", "\
|
|
957
|
+
program.command("docs").description("\u8BFB\u53D6\u5DE5\u5177\u58F0\u660E\u7684\u8FD0\u884C\u6280\u80FD\u5165\u53E3").argument("[command]", "\u63D2\u4EF6\u547D\u4EE4\u540D\u6216\u6280\u80FD ID").option("--json", "\u8F93\u51FA\u673A\u5668\u53EF\u8BFB JSON\uFF08\u542B sha256/content\uFF09").addHelpText("after", DOCS_HELP_TEXT).action((command, opts) => {
|
|
954
958
|
const json = ctx.json || opts.json;
|
|
955
959
|
let docs;
|
|
956
960
|
let packageName = "@kevlns/v-cli";
|
|
@@ -983,7 +987,7 @@ var agent = {
|
|
|
983
987
|
process.stdout.write(docs.content);
|
|
984
988
|
});
|
|
985
989
|
program.command("skills").description("\u5217\u51FA\u53D7\u7BA1\u5DE5\u5177\u58F0\u660E\u7684\u6280\u80FD").option("--json", "JSON \u8F93\u51FA").action(() => ctx.log.result(discoverToolSkills()));
|
|
986
|
-
program.command("export").description("\u663E\u5F0F\u5BFC\u51FA\u5916\u90E8\u5BBF\u4E3B\u6280\u80FD").argument("[command]").requiredOption("--host <name>").requiredOption("--directory <path>").option("--dry-run").option("--json").action((command, opts) => ctx.log.result(exportToolSkill(command, opts)));
|
|
990
|
+
program.command("export").description("\u663E\u5F0F\u5BFC\u51FA\u5916\u90E8\u5BBF\u4E3B\u6280\u80FD").argument("[command]", "\u63D2\u4EF6\u547D\u4EE4\u540D\u6216\u6280\u80FD ID").requiredOption("--host <name>").requiredOption("--directory <path>").option("--dry-run").option("--json").action((command, opts) => ctx.log.result(exportToolSkill(command, opts)));
|
|
987
991
|
program.command("init").description("\u5DF2\u8FC1\u79FB\uFF1A\u4F7F\u7528 project init").argument("[directory]").option("--json").option("--dry-run").option("--force").action(() => {
|
|
988
992
|
throw new Error("agent init \u5DF2\u8FC1\u79FB\uFF1B\u9879\u76EE\u4F7F\u7528 v-cli project init\uFF0C\u5916\u90E8\u5BBF\u4E3B\u4F7F\u7528 agent export --host --directory\u3002");
|
|
989
993
|
});
|
|
@@ -1065,6 +1069,22 @@ function toStructuredError(err) {
|
|
|
1065
1069
|
// src/providers/ship/index.ts
|
|
1066
1070
|
import fs9 from "fs";
|
|
1067
1071
|
|
|
1072
|
+
// src/core/retry-file.ts
|
|
1073
|
+
async function retryFile(action) {
|
|
1074
|
+
const deadline = Date.now() + 3e3;
|
|
1075
|
+
for (; ; ) {
|
|
1076
|
+
try {
|
|
1077
|
+
return action();
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
if (!["EPERM", "EBUSY", "EACCES"].includes(
|
|
1080
|
+
error.code ?? ""
|
|
1081
|
+
) || Date.now() >= deadline)
|
|
1082
|
+
throw error;
|
|
1083
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1068
1088
|
// src/core/execution/resource-locks.ts
|
|
1069
1089
|
import fs5 from "fs";
|
|
1070
1090
|
import path6 from "path";
|
|
@@ -1153,8 +1173,8 @@ function resolveInsideProject(project2, relative, label) {
|
|
|
1153
1173
|
return { path: project2.root, realPath: project2.realRoot };
|
|
1154
1174
|
}
|
|
1155
1175
|
const segments = splitSafeRelative(relative, label);
|
|
1156
|
-
const
|
|
1157
|
-
const storage =
|
|
1176
|
+
const owned2 = segments.map((segment) => process.platform === "win32" ? segment.toLowerCase() : segment);
|
|
1177
|
+
const storage = owned2[0] === ".vant" && owned2[1] !== "rules" && !(owned2.length === 2 && owned2[1] === "rules.md");
|
|
1158
1178
|
const root2 = storage ? project2.storageRoot : project2.root;
|
|
1159
1179
|
const realRoot = storage ? project2.realStorageRoot : project2.realRoot;
|
|
1160
1180
|
const target = path5.join(root2, ...segments);
|
|
@@ -1216,20 +1236,6 @@ var conflicts = (a, b) => a.resources.some(
|
|
|
1216
1236
|
)
|
|
1217
1237
|
);
|
|
1218
1238
|
var pause = () => new Promise((resolve) => setTimeout(resolve, 10));
|
|
1219
|
-
async function retryFile(action) {
|
|
1220
|
-
const deadline = Date.now() + 3e3;
|
|
1221
|
-
for (; ; ) {
|
|
1222
|
-
try {
|
|
1223
|
-
return action();
|
|
1224
|
-
} catch (error) {
|
|
1225
|
-
if (!["EPERM", "EBUSY", "EACCES"].includes(
|
|
1226
|
-
error.code ?? ""
|
|
1227
|
-
) || Date.now() >= deadline)
|
|
1228
|
-
throw error;
|
|
1229
|
-
await pause();
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
1239
|
async function remove(file2) {
|
|
1234
1240
|
try {
|
|
1235
1241
|
await retryFile(() => fs5.unlinkSync(file2));
|
|
@@ -4758,9 +4764,9 @@ var FAIL_COUNT_PATHS = [
|
|
|
4758
4764
|
];
|
|
4759
4765
|
function extractFailCount(payload) {
|
|
4760
4766
|
if (!isPlainObject8(payload)) return { count: null, source: null };
|
|
4761
|
-
for (const
|
|
4767
|
+
for (const path18 of FAIL_COUNT_PATHS) {
|
|
4762
4768
|
let current = payload;
|
|
4763
|
-
for (const segment of
|
|
4769
|
+
for (const segment of path18) {
|
|
4764
4770
|
if (!isPlainObject8(current)) {
|
|
4765
4771
|
current = void 0;
|
|
4766
4772
|
break;
|
|
@@ -4768,16 +4774,16 @@ function extractFailCount(payload) {
|
|
|
4768
4774
|
current = current[segment];
|
|
4769
4775
|
}
|
|
4770
4776
|
if (typeof current === "number" && Number.isSafeInteger(current) && current >= 0) {
|
|
4771
|
-
return { count: current, source:
|
|
4777
|
+
return { count: current, source: path18.join(".") };
|
|
4772
4778
|
}
|
|
4773
4779
|
}
|
|
4774
4780
|
return { count: null, source: null };
|
|
4775
4781
|
}
|
|
4776
4782
|
function extractTotal(payload) {
|
|
4777
4783
|
if (!isPlainObject8(payload)) return { total: null, source: null };
|
|
4778
|
-
for (const
|
|
4784
|
+
for (const path18 of [["summary", "total"]]) {
|
|
4779
4785
|
let current = payload;
|
|
4780
|
-
for (const segment of
|
|
4786
|
+
for (const segment of path18) {
|
|
4781
4787
|
if (!isPlainObject8(current)) {
|
|
4782
4788
|
current = void 0;
|
|
4783
4789
|
break;
|
|
@@ -4785,7 +4791,7 @@ function extractTotal(payload) {
|
|
|
4785
4791
|
current = current[segment];
|
|
4786
4792
|
}
|
|
4787
4793
|
if (typeof current === "number" && Number.isSafeInteger(current) && current >= 0) {
|
|
4788
|
-
return { total: current, source:
|
|
4794
|
+
return { total: current, source: path18.join(".") };
|
|
4789
4795
|
}
|
|
4790
4796
|
}
|
|
4791
4797
|
return { total: null, source: null };
|
|
@@ -7097,6 +7103,15 @@ var videoActions = [
|
|
|
7097
7103
|
var videoReads = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "task.list", "task.read", "operation.validate", "script.read", "script.plan", "material.list", "image", "media.status", "execution.status"]);
|
|
7098
7104
|
var videoNoInput = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "runtime.start", "runtime.stop", "task.list", "material.list", "media.status"]);
|
|
7099
7105
|
var videoNetwork = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.save", "runtime.status", "runtime.start", "runtime.stop", "operation.create", "operation.update", "operation.derive", "operation.validate", "operation.run", "operation.resume", "operation.cancel", "script.plan", "script.apply", "film.refine"]);
|
|
7106
|
+
var spineDefinitions = ["describe", "parts", "build", "capture"].map((action) => ({
|
|
7107
|
+
id: "spine-" + action,
|
|
7108
|
+
command: ["spine", action],
|
|
7109
|
+
channel: "spine",
|
|
7110
|
+
fields: action === "describe" ? {} : { input: file },
|
|
7111
|
+
required: action === "describe" ? [] : ["input"],
|
|
7112
|
+
readonly: action === "describe",
|
|
7113
|
+
global: true
|
|
7114
|
+
}));
|
|
7100
7115
|
var videoDefinitions = videoActions.map((action) => ({
|
|
7101
7116
|
id: "video-" + action.replaceAll(".", "-"),
|
|
7102
7117
|
channel: "video",
|
|
@@ -7111,7 +7126,7 @@ function createArtProvider(deps) {
|
|
|
7111
7126
|
const discover = deps.discoverBackend ?? (() => discoverOfficialPlugin(
|
|
7112
7127
|
OFFICIAL_PLUGINS.find((s) => s.command === "art")
|
|
7113
7128
|
));
|
|
7114
|
-
const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions].map((d) => ({
|
|
7129
|
+
const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions, ...spineDefinitions].map((d) => ({
|
|
7115
7130
|
descriptor: {
|
|
7116
7131
|
id: "art." + (d.channel === "image" ? "image-" : "") + d.id,
|
|
7117
7132
|
commands: [d.command],
|
|
@@ -7203,7 +7218,7 @@ function createArtProvider(deps) {
|
|
|
7203
7218
|
const plan = JSON.parse(readFileSync(file2, "utf8"));
|
|
7204
7219
|
if (plan.project !== ctx.binding.projectId || plan.module !== businessCommand[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
|
|
7205
7220
|
}
|
|
7206
|
-
const argv = d.channel === "video" ? [
|
|
7221
|
+
const argv = d.channel === "spine" ? [...d.command, "--workspace", ctx.projectAnchor.root] : d.channel === "video" ? [
|
|
7207
7222
|
...d.command,
|
|
7208
7223
|
"--workspace",
|
|
7209
7224
|
ctx.projectAnchor.storageRoot,
|
|
@@ -8557,6 +8572,97 @@ var plugin = {
|
|
|
8557
8572
|
}
|
|
8558
8573
|
};
|
|
8559
8574
|
|
|
8575
|
+
// src/core/managed-skills.ts
|
|
8576
|
+
import fs15 from "fs";
|
|
8577
|
+
import path16 from "path";
|
|
8578
|
+
import os3 from "os";
|
|
8579
|
+
import { createHash as createHash6, randomUUID as randomUUID2 } from "crypto";
|
|
8580
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8581
|
+
var digest = (data) => createHash6("sha256").update(JSON.stringify(data)).digest("hex");
|
|
8582
|
+
function owned(home, relative) {
|
|
8583
|
+
let current = home;
|
|
8584
|
+
for (const part of relative.split("/")) {
|
|
8585
|
+
current = path16.join(current, part);
|
|
8586
|
+
if (fs15.lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
8587
|
+
throw new Error("\u53D7\u7BA1\u6280\u80FD\u8DEF\u5F84\u5305\u542B\u94FE\u63A5\uFF1A" + current);
|
|
8588
|
+
}
|
|
8589
|
+
return current;
|
|
8590
|
+
}
|
|
8591
|
+
async function projectTool(home, skills, dryRun) {
|
|
8592
|
+
const first = skills[0];
|
|
8593
|
+
const files = skills.flatMap((skill) => skillFileHashes(path16.dirname(skill.path)).map((file2) => [skill.id + "/" + file2.path, file2.hash]));
|
|
8594
|
+
files.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
8595
|
+
const hash = digest(files);
|
|
8596
|
+
const relative = "managed/" + first.tool + "/" + hash;
|
|
8597
|
+
const target = owned(home, "skills/" + relative);
|
|
8598
|
+
function verify(directory) {
|
|
8599
|
+
if (digest(skillFileHashes(directory).map((file2) => [file2.path, file2.hash])) !== hash)
|
|
8600
|
+
throw new Error("\u53D7\u7BA1\u6280\u80FD\u5185\u5BB9\u6821\u9A8C\u5931\u8D25\uFF1A" + directory);
|
|
8601
|
+
}
|
|
8602
|
+
if (fs15.existsSync(target)) verify(target);
|
|
8603
|
+
else if (!dryRun) {
|
|
8604
|
+
fs15.mkdirSync(path16.dirname(target), { recursive: true });
|
|
8605
|
+
const staging = fs15.mkdtempSync(path16.join(path16.dirname(target), ".stage-"));
|
|
8606
|
+
try {
|
|
8607
|
+
for (const skill of skills) fs15.cpSync(path16.dirname(skill.path), path16.join(staging, skill.id), {
|
|
8608
|
+
recursive: true,
|
|
8609
|
+
filter: (source) => path16.basename(source) !== "__pycache__" && !source.endsWith(".pyc")
|
|
8610
|
+
});
|
|
8611
|
+
verify(staging);
|
|
8612
|
+
try {
|
|
8613
|
+
await retryFile(() => fs15.renameSync(staging, target));
|
|
8614
|
+
} catch (error) {
|
|
8615
|
+
if (!fs15.existsSync(target)) throw error;
|
|
8616
|
+
verify(target);
|
|
8617
|
+
}
|
|
8618
|
+
} finally {
|
|
8619
|
+
fs15.rmSync(staging, { recursive: true, force: true });
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
return {
|
|
8623
|
+
id: first.tool,
|
|
8624
|
+
package: first.package,
|
|
8625
|
+
version: first.version,
|
|
8626
|
+
contentHash: hash,
|
|
8627
|
+
path: relative,
|
|
8628
|
+
skills: skills.map(({ id }) => ({ id, path: id + "/SKILL.md" }))
|
|
8629
|
+
};
|
|
8630
|
+
}
|
|
8631
|
+
async function syncManagedSkills({
|
|
8632
|
+
dryRun = false,
|
|
8633
|
+
home = process.env.VANT_HOME || path16.join(os3.homedir(), ".vant"),
|
|
8634
|
+
resolvePackage
|
|
8635
|
+
} = {}) {
|
|
8636
|
+
const installed = path16.dirname(fileURLToPath2(import.meta.url));
|
|
8637
|
+
const { skills } = discoverToolSkills({ resolvePackage: resolvePackage ?? ((pkg) => defaultResolvePackage(pkg, {
|
|
8638
|
+
cwd: installed,
|
|
8639
|
+
resolveFrom: process.env.V_CLI_PLUGIN_RESOLVE_FROM && path16.resolve(process.env.V_CLI_PLUGIN_RESOLVE_FROM)
|
|
8640
|
+
})) });
|
|
8641
|
+
const groups = /* @__PURE__ */ new Map();
|
|
8642
|
+
for (const skill of skills) {
|
|
8643
|
+
const group = groups.get(skill.tool) ?? [];
|
|
8644
|
+
group.push(skill);
|
|
8645
|
+
groups.set(skill.tool, group);
|
|
8646
|
+
}
|
|
8647
|
+
const file2 = owned(home, "state/tool-skills/index.json");
|
|
8648
|
+
const tools = [];
|
|
8649
|
+
for (const group of groups.values()) tools.push(await projectTool(home, group, dryRun));
|
|
8650
|
+
const previous = fs15.existsSync(file2) ? JSON.parse(fs15.readFileSync(file2, "utf8")) : { schemaVersion: 1, tools: [] };
|
|
8651
|
+
if (previous.schemaVersion !== 1 || !Array.isArray(previous.tools)) throw new Error("\u53D7\u7BA1\u6280\u80FD\u7D22\u5F15\u65E0\u6548\u3002");
|
|
8652
|
+
const next = { schemaVersion: 1, tools: [...tools, ...previous.tools.filter((tool) => !groups.has(tool.id))] };
|
|
8653
|
+
if (!dryRun && JSON.stringify(previous) !== JSON.stringify(next)) {
|
|
8654
|
+
fs15.mkdirSync(path16.dirname(file2), { recursive: true });
|
|
8655
|
+
const temporary = file2 + "." + randomUUID2();
|
|
8656
|
+
try {
|
|
8657
|
+
fs15.writeFileSync(temporary, JSON.stringify(next, null, 2) + "\n", { flag: "wx" });
|
|
8658
|
+
await retryFile(() => fs15.renameSync(temporary, file2));
|
|
8659
|
+
} finally {
|
|
8660
|
+
fs15.rmSync(temporary, { force: true });
|
|
8661
|
+
}
|
|
8662
|
+
}
|
|
8663
|
+
return { dryRun, names: skills.map((skill) => skill.id) };
|
|
8664
|
+
}
|
|
8665
|
+
|
|
8560
8666
|
// src/commands/project.ts
|
|
8561
8667
|
var PROJECT_HELP_TEXT = [
|
|
8562
8668
|
"project\uFF1A\u5DE5\u7A0B\u6839\u7ED1\u5B9A\u4E0E\u53EA\u8BFB\u68C0\u67E5\u3002",
|
|
@@ -8660,7 +8766,7 @@ var project = {
|
|
|
8660
8766
|
"\u8986\u76D6\u67D0 Provider \u7684\u7ED1\u5B9A\u6BB5\uFF08\u53EF\u91CD\u590D\uFF1BJSON \u5BF9\u8C61\u5B8C\u6574\u66FF\u6362\u9ED8\u8BA4\u6BB5\uFF09",
|
|
8661
8767
|
(value, previous = []) => [...previous, value],
|
|
8662
8768
|
[]
|
|
8663
|
-
).option("--reset", "\u663E\u5F0F\u91CD\u7F6E\uFF1A\u65E7\u914D\u7F6E\u5148\u5907\u4EFD\u5230 .vant/state/config-backups/\uFF0C\u518D\u6309\u9ED8\u8BA4\u6BB5\u539F\u5B50\u66FF\u6362").option("--dry-run", "\u53EA\u62A5\u544A\u5C06\u8981\u505A\u7684\u53D8\u66F4\uFF08action/added\uFF09\uFF0C\u4E0D\u5199\u4EFB\u4F55\u6587\u4EF6").option("--json", "\u8F93\u51FA\u673A\u5668\u53EF\u8BFB JSON").addHelpText("after", PROJECT_HELP_TEXT).action((opts) => {
|
|
8769
|
+
).option("--reset", "\u663E\u5F0F\u91CD\u7F6E\uFF1A\u65E7\u914D\u7F6E\u5148\u5907\u4EFD\u5230 .vant/state/config-backups/\uFF0C\u518D\u6309\u9ED8\u8BA4\u6BB5\u539F\u5B50\u66FF\u6362").option("--dry-run", "\u53EA\u62A5\u544A\u5C06\u8981\u505A\u7684\u53D8\u66F4\uFF08action/added\uFF09\uFF0C\u4E0D\u5199\u4EFB\u4F55\u6587\u4EF6").option("--json", "\u8F93\u51FA\u673A\u5668\u53EF\u8BFB JSON").addHelpText("after", PROJECT_HELP_TEXT).action(async (opts) => {
|
|
8664
8770
|
const json = ctx.json || opts.json;
|
|
8665
8771
|
const registry = createDefaultRegistry();
|
|
8666
8772
|
try {
|
|
@@ -8670,8 +8776,20 @@ var project = {
|
|
|
8670
8776
|
reset: opts.reset,
|
|
8671
8777
|
dryRun: opts.dryRun
|
|
8672
8778
|
});
|
|
8779
|
+
let skills;
|
|
8780
|
+
if (result4.ok) {
|
|
8781
|
+
try {
|
|
8782
|
+
skills = await syncManagedSkills({ dryRun: opts.dryRun });
|
|
8783
|
+
} catch (error) {
|
|
8784
|
+
const reason = "\u53D7\u7BA1\u6280\u80FD\u540C\u6B65\u5931\u8D25\uFF1A" + formatError(error);
|
|
8785
|
+
if (json) ctx.log.result({ ok: false, projectConfig: result4, skills: { ok: false, reason } });
|
|
8786
|
+
ctx.log.error(reason + "\u3002\u4FEE\u6B63\u540E\u53EF\u91CD\u65B0\u8FD0\u884C project init\u3002");
|
|
8787
|
+
process.exitCode = 1;
|
|
8788
|
+
return;
|
|
8789
|
+
}
|
|
8790
|
+
}
|
|
8673
8791
|
if (json) {
|
|
8674
|
-
ctx.log.result(result4);
|
|
8792
|
+
ctx.log.result(skills ? { ...result4, skills } : result4);
|
|
8675
8793
|
if (!result4.ok) {
|
|
8676
8794
|
ctx.log.error(result4.reason);
|
|
8677
8795
|
process.exitCode = 1;
|
|
@@ -8696,6 +8814,7 @@ var project = {
|
|
|
8696
8814
|
...Object.entries(result4.bindings).map(([id, section]) => `\u7ED1\u5B9A ${id}: ${JSON.stringify(section)}`),
|
|
8697
8815
|
result4.vantConfig.exists ? `\u68C0\u6D4B\u5230 Vant \u914D\u7F6E ${VANT_PROJECT_CONFIG_RELATIVE}\uFF08\u53EA\u8BFB\u63D0\u793A\uFF0Cv-cli \u672A\u505A\u4EFB\u4F55\u4FEE\u6539\uFF09` : "\u672A\u68C0\u6D4B\u5230 Vant \u914D\u7F6E\uFF08.vant/config/project.json\uFF09\uFF1B\u89D2\u8272/workflow \u5F52\u5C5E Vant\uFF0C\u4E0D\u5728\u672C\u6587\u4EF6"
|
|
8698
8816
|
];
|
|
8817
|
+
if (skills) lines.push(`\u53D7\u7BA1\u6280\u80FD: ${skills.names.join("\u3001")}\uFF08${skills.dryRun ? "\u9884\u89C8" : "\u5DF2\u5C31\u7EEA"}\uFF09`);
|
|
8699
8818
|
for (const warning of result4.warnings) lines.push(`\u8B66\u544A: ${warning}`);
|
|
8700
8819
|
ctx.log.result(lines.join("\n"));
|
|
8701
8820
|
} catch (err) {
|
|
@@ -8820,12 +8939,12 @@ async function loadBuiltinCommands() {
|
|
|
8820
8939
|
return builtinCommands.map((command) => ({ command, source: "builtin" }));
|
|
8821
8940
|
}
|
|
8822
8941
|
async function loadLocalPlugins(ctx) {
|
|
8823
|
-
const dir =
|
|
8942
|
+
const dir = path17.join(ctx.homeDir, "commands");
|
|
8824
8943
|
const loaded = [];
|
|
8825
|
-
if (!
|
|
8826
|
-
const files =
|
|
8944
|
+
if (!fs16.existsSync(dir)) return loaded;
|
|
8945
|
+
const files = fs16.readdirSync(dir).filter((f) => f.endsWith(".mjs")).sort();
|
|
8827
8946
|
for (const file2 of files) {
|
|
8828
|
-
const abs =
|
|
8947
|
+
const abs = path17.join(dir, file2);
|
|
8829
8948
|
try {
|
|
8830
8949
|
const mod = await import(
|
|
8831
8950
|
/* @vite-ignore */
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1207,7 +1207,7 @@ declare function redactArgv(argv: string[]): RedactionResult<string[]>;
|
|
|
1207
1207
|
declare const REDACTION_PLACEHOLDER = "***redacted***";
|
|
1208
1208
|
|
|
1209
1209
|
/** 版本常量:与 package.json 保持一致(有测试保证) */
|
|
1210
|
-
declare const VERSION = "0.7.
|
|
1210
|
+
declare const VERSION = "0.7.6";
|
|
1211
1211
|
|
|
1212
1212
|
/** 已发布命令清单与真实注册表逐项对照,不从命名猜测覆盖。 */
|
|
1213
1213
|
declare function capabilityCoverage(registry: CapabilityRegistry): {
|
package/dist/sdk.mjs
CHANGED
|
@@ -635,6 +635,22 @@ var CapabilityRegistry = class {
|
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
+
// src/core/retry-file.ts
|
|
639
|
+
async function retryFile(action) {
|
|
640
|
+
const deadline = Date.now() + 3e3;
|
|
641
|
+
for (; ; ) {
|
|
642
|
+
try {
|
|
643
|
+
return action();
|
|
644
|
+
} catch (error) {
|
|
645
|
+
if (!["EPERM", "EBUSY", "EACCES"].includes(
|
|
646
|
+
error.code ?? ""
|
|
647
|
+
) || Date.now() >= deadline)
|
|
648
|
+
throw error;
|
|
649
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
638
654
|
// src/core/execution/resource-locks.ts
|
|
639
655
|
import fs2 from "fs";
|
|
640
656
|
import path2 from "path";
|
|
@@ -787,20 +803,6 @@ var conflicts = (a, b) => a.resources.some(
|
|
|
787
803
|
)
|
|
788
804
|
);
|
|
789
805
|
var pause = () => new Promise((resolve) => setTimeout(resolve, 10));
|
|
790
|
-
async function retryFile(action) {
|
|
791
|
-
const deadline = Date.now() + 3e3;
|
|
792
|
-
for (; ; ) {
|
|
793
|
-
try {
|
|
794
|
-
return action();
|
|
795
|
-
} catch (error) {
|
|
796
|
-
if (!["EPERM", "EBUSY", "EACCES"].includes(
|
|
797
|
-
error.code ?? ""
|
|
798
|
-
) || Date.now() >= deadline)
|
|
799
|
-
throw error;
|
|
800
|
-
await pause();
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
806
|
async function remove(file2) {
|
|
805
807
|
try {
|
|
806
808
|
await retryFile(() => fs2.unlinkSync(file2));
|
|
@@ -6554,6 +6556,15 @@ var videoActions = [
|
|
|
6554
6556
|
var videoReads = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "task.list", "task.read", "operation.validate", "script.read", "script.plan", "material.list", "image", "media.status", "execution.status"]);
|
|
6555
6557
|
var videoNoInput = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.presets.h3", "runtime.status", "runtime.start", "runtime.stop", "task.list", "material.list", "media.status"]);
|
|
6556
6558
|
var videoNetwork = /* @__PURE__ */ new Set(["describe", "snapshot", "settings.get", "settings.save", "runtime.status", "runtime.start", "runtime.stop", "operation.create", "operation.update", "operation.derive", "operation.validate", "operation.run", "operation.resume", "operation.cancel", "script.plan", "script.apply", "film.refine"]);
|
|
6559
|
+
var spineDefinitions = ["describe", "parts", "build", "capture"].map((action) => ({
|
|
6560
|
+
id: "spine-" + action,
|
|
6561
|
+
command: ["spine", action],
|
|
6562
|
+
channel: "spine",
|
|
6563
|
+
fields: action === "describe" ? {} : { input: file },
|
|
6564
|
+
required: action === "describe" ? [] : ["input"],
|
|
6565
|
+
readonly: action === "describe",
|
|
6566
|
+
global: true
|
|
6567
|
+
}));
|
|
6557
6568
|
var videoDefinitions = videoActions.map((action) => ({
|
|
6558
6569
|
id: "video-" + action.replaceAll(".", "-"),
|
|
6559
6570
|
channel: "video",
|
|
@@ -6568,7 +6579,7 @@ function createArtProvider(deps) {
|
|
|
6568
6579
|
const discover = deps.discoverBackend ?? (() => discoverOfficialPlugin(
|
|
6569
6580
|
OFFICIAL_PLUGINS.find((s) => s.command === "art")
|
|
6570
6581
|
));
|
|
6571
|
-
const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions].map((d) => ({
|
|
6582
|
+
const registrations = [...definitions3, ...imageDefinitions, ...videoDefinitions, ...spineDefinitions].map((d) => ({
|
|
6572
6583
|
descriptor: {
|
|
6573
6584
|
id: "art." + (d.channel === "image" ? "image-" : "") + d.id,
|
|
6574
6585
|
commands: [d.command],
|
|
@@ -6660,7 +6671,7 @@ function createArtProvider(deps) {
|
|
|
6660
6671
|
const plan = JSON.parse(readFileSync(file2, "utf8"));
|
|
6661
6672
|
if (plan.project !== ctx.binding.projectId || plan.module !== businessCommand[0]) return fail("art-plan-scope-mismatch", "\u8BA1\u5212\u4E0D\u5C5E\u4E8E\u5F53\u524D art \u5DE5\u7A0B\u6216\u6267\u884C\u7C7B\u578B");
|
|
6662
6673
|
}
|
|
6663
|
-
const argv = d.channel === "video" ? [
|
|
6674
|
+
const argv = d.channel === "spine" ? [...d.command, "--workspace", ctx.projectAnchor.root] : d.channel === "video" ? [
|
|
6664
6675
|
...d.command,
|
|
6665
6676
|
"--workspace",
|
|
6666
6677
|
ctx.projectAnchor.storageRoot,
|
|
@@ -7590,11 +7601,12 @@ function discoverToolSkills(options = {}) {
|
|
|
7590
7601
|
}
|
|
7591
7602
|
function readRuntimeSkill(command, options = {}) {
|
|
7592
7603
|
const tool = command ?? "v-cli";
|
|
7593
|
-
const result4 = discoverToolSkills(options)
|
|
7604
|
+
const result4 = discoverToolSkills(options);
|
|
7605
|
+
const skill = result4.skills.find((s) => s.id === tool) ?? result4.skills.find((s) => s.tool === tool);
|
|
7594
7606
|
if (!skill) throw new Error("\u5DE5\u5177\u672A\u58F0\u660E\u8FD0\u884C\u6280\u80FD\uFF1A" + tool);
|
|
7595
7607
|
return { ...skill, file: skill.path, content: fs11.readFileSync(skill.path, "utf8"), sha256: createHash5("sha256").update(fs11.readFileSync(skill.path)).digest("hex") };
|
|
7596
7608
|
}
|
|
7597
|
-
function
|
|
7609
|
+
function skillFileHashes(root2) {
|
|
7598
7610
|
const files = [];
|
|
7599
7611
|
const walk = (directory, prefix = "") => {
|
|
7600
7612
|
for (const entry of fs11.readdirSync(directory, { withFileTypes: true })) {
|
|
@@ -7607,7 +7619,10 @@ function skillBundleHash(root2) {
|
|
|
7607
7619
|
};
|
|
7608
7620
|
walk(root2);
|
|
7609
7621
|
files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
7610
|
-
return
|
|
7622
|
+
return files;
|
|
7623
|
+
}
|
|
7624
|
+
function skillBundleHash(root2) {
|
|
7625
|
+
return createHash5("sha256").update(JSON.stringify(skillFileHashes(root2))).digest("hex");
|
|
7611
7626
|
}
|
|
7612
7627
|
function exportToolSkill(command, options) {
|
|
7613
7628
|
if (!["codex", "claude"].includes(options.host) || !options.directory)
|
|
@@ -7641,7 +7656,7 @@ function exportToolSkill(command, options) {
|
|
|
7641
7656
|
};
|
|
7642
7657
|
walk(path11.dirname(skill.path), target);
|
|
7643
7658
|
const adapter = path11.join(root2, "adapters", options.host);
|
|
7644
|
-
if (fs11.existsSync(adapter)) walk(adapter, target);
|
|
7659
|
+
if (fs11.existsSync(adapter) && readRuntimeSkill(skill.tool, options).id === skill.id) walk(adapter, target);
|
|
7645
7660
|
if (!options.dryRun) for (const file2 of planned) {
|
|
7646
7661
|
fs11.mkdirSync(path11.dirname(file2.path), { recursive: true });
|
|
7647
7662
|
fs11.writeFileSync(file2.path, file2.bytes);
|
|
@@ -7650,7 +7665,7 @@ function exportToolSkill(command, options) {
|
|
|
7650
7665
|
}
|
|
7651
7666
|
|
|
7652
7667
|
// src/version.ts
|
|
7653
|
-
var VERSION = "0.7.
|
|
7668
|
+
var VERSION = "0.7.6";
|
|
7654
7669
|
|
|
7655
7670
|
// src/capability-coverage.ts
|
|
7656
7671
|
function capabilityCoverage(registry) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevlns/v-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "提供工具发现、插件路由、工程绑定、结构化能力执行和操作证据管理。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"toolbox"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@kevlns/art-workshop": "0.6.
|
|
61
|
+
"@kevlns/art-workshop": "0.6.5",
|
|
62
62
|
"@kevlns/figma-to-uprefab": "0.1.5",
|
|
63
63
|
"@kevlns/ship-cli": "0.1.3",
|
|
64
64
|
"@kevlns/u-cli-mod": "0.3.2",
|
|
65
|
-
"@kevlns/xlmerge": "2.0.
|
|
65
|
+
"@kevlns/xlmerge": "2.0.7",
|
|
66
66
|
"commander": "^12.1.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
package/skills/v-cli/SKILL.md
CHANGED
|
@@ -7,4 +7,4 @@ description: 发现项目工具及技能,读取能力契约并执行结构化
|
|
|
7
7
|
|
|
8
8
|
先用 agent index、agent skills 和 capability describe 了解当前可用工具;操作约束按需读取 references/project.md 及目标工具的声明技能。命令参数以 describe 为准,不把仓库 AGENTS.md 当运行时规范。
|
|
9
9
|
|
|
10
|
-
项目初始化使用 project init
|
|
10
|
+
项目初始化使用 `project init`,它按各工具清单将技能、参考资料和脚本同步到 Vant 的全局受管目录。按技能 ID 用 `agent docs` 读取单份指南。默认安装不扫描或改写外部 Agent。失败保留明确状态,不循环重试;未知写入仅查询原执行身份,不能换 ID 重投。
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
### 核心约定(v-cli 本体)
|
|
20
20
|
|
|
21
|
-
- 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.7.
|
|
21
|
+
- 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.7.6
|
|
22
22
|
- 命令分三类:builtin(内置)、local(~/.vant/tools/v-cli/commands/ 下的本地插件)、official(官方插件白名单);
|
|
23
23
|
**命令集合以实际发现为准**:先运行 `v-cli agent index --json` 获取全部命令与 agent 元数据
|
|
24
24
|
- 单个命令的完整元数据用 `v-cli agent describe <命令名> --json` 查看
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
|
|
46
46
|
### @kevlns/art-workshop — 命令 `v-cli art …`
|
|
47
47
|
|
|
48
|
-
**版本**:0.6.
|
|
49
|
-
|
|
48
|
+
**版本**:0.6.5
|
|
49
|
+
**描述**:管理图片、视频与 Spine 骨骼动画制作。
|
|
50
50
|
**平台**:win32, linux, darwin
|
|
51
51
|
|
|
52
52
|
**何时使用**:读取对象和版本,保存规则即更新当前风格。按规则生成样张,在图片卡片上定版后自动加入风格运行时参考;原始分主题参考只用于分析。生成先编译预演,未知运行只恢复原身份。
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
|
|
90
90
|
### @kevlns/xlmerge — 命令 `v-cli xlmerge …`
|
|
91
91
|
|
|
92
|
-
**版本**:2.0.
|
|
93
|
-
|
|
92
|
+
**版本**:2.0.7
|
|
93
|
+
**描述**:处理 Git 中的 Excel 三方冲突,支持 Agent 根据项目规则裁决并写回,也支持浏览器逐项审阅。
|
|
94
94
|
**平台**:darwin, linux, win32
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
**何时使用**:在发生合并的工区 detect → prepare,读取 manifest 中 base/ours/theirs 的差异与稳定 ID,按项目约束及变更意图裁决。仅将无法判断的业务项交控制源。用 apply --no-commit 写回并验证 Git 索引,按原任务完成提交或交付。用户选择可视化审阅时使用 launch。
|
|
97
97
|
|
|
98
98
|
**首次调用前必读**:`v-cli agent docs xlmerge`(插件包内 清单声明的 SKILL.md)
|
|
99
99
|
**实时参数/命令**:`v-cli agent describe xlmerge --json`
|