@kevlns/v-cli 0.7.3 → 0.7.5
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 +148 -38
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.mjs +25 -19
- package/package.json +6 -6
- package/skills/v-cli/SKILL.md +1 -1
- package/skills/v-cli/references/project.md +8 -8
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.5";
|
|
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 };
|
|
@@ -8557,6 +8563,97 @@ var plugin = {
|
|
|
8557
8563
|
}
|
|
8558
8564
|
};
|
|
8559
8565
|
|
|
8566
|
+
// src/core/managed-skills.ts
|
|
8567
|
+
import fs15 from "fs";
|
|
8568
|
+
import path16 from "path";
|
|
8569
|
+
import os3 from "os";
|
|
8570
|
+
import { createHash as createHash6, randomUUID as randomUUID2 } from "crypto";
|
|
8571
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8572
|
+
var digest = (data) => createHash6("sha256").update(JSON.stringify(data)).digest("hex");
|
|
8573
|
+
function owned(home, relative) {
|
|
8574
|
+
let current = home;
|
|
8575
|
+
for (const part of relative.split("/")) {
|
|
8576
|
+
current = path16.join(current, part);
|
|
8577
|
+
if (fs15.lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
8578
|
+
throw new Error("\u53D7\u7BA1\u6280\u80FD\u8DEF\u5F84\u5305\u542B\u94FE\u63A5\uFF1A" + current);
|
|
8579
|
+
}
|
|
8580
|
+
return current;
|
|
8581
|
+
}
|
|
8582
|
+
async function projectTool(home, skills, dryRun) {
|
|
8583
|
+
const first = skills[0];
|
|
8584
|
+
const files = skills.flatMap((skill) => skillFileHashes(path16.dirname(skill.path)).map((file2) => [skill.id + "/" + file2.path, file2.hash]));
|
|
8585
|
+
files.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
8586
|
+
const hash = digest(files);
|
|
8587
|
+
const relative = "managed/" + first.tool + "/" + hash;
|
|
8588
|
+
const target = owned(home, "skills/" + relative);
|
|
8589
|
+
function verify(directory) {
|
|
8590
|
+
if (digest(skillFileHashes(directory).map((file2) => [file2.path, file2.hash])) !== hash)
|
|
8591
|
+
throw new Error("\u53D7\u7BA1\u6280\u80FD\u5185\u5BB9\u6821\u9A8C\u5931\u8D25\uFF1A" + directory);
|
|
8592
|
+
}
|
|
8593
|
+
if (fs15.existsSync(target)) verify(target);
|
|
8594
|
+
else if (!dryRun) {
|
|
8595
|
+
fs15.mkdirSync(path16.dirname(target), { recursive: true });
|
|
8596
|
+
const staging = fs15.mkdtempSync(path16.join(path16.dirname(target), ".stage-"));
|
|
8597
|
+
try {
|
|
8598
|
+
for (const skill of skills) fs15.cpSync(path16.dirname(skill.path), path16.join(staging, skill.id), {
|
|
8599
|
+
recursive: true,
|
|
8600
|
+
filter: (source) => path16.basename(source) !== "__pycache__" && !source.endsWith(".pyc")
|
|
8601
|
+
});
|
|
8602
|
+
verify(staging);
|
|
8603
|
+
try {
|
|
8604
|
+
await retryFile(() => fs15.renameSync(staging, target));
|
|
8605
|
+
} catch (error) {
|
|
8606
|
+
if (!fs15.existsSync(target)) throw error;
|
|
8607
|
+
verify(target);
|
|
8608
|
+
}
|
|
8609
|
+
} finally {
|
|
8610
|
+
fs15.rmSync(staging, { recursive: true, force: true });
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8613
|
+
return {
|
|
8614
|
+
id: first.tool,
|
|
8615
|
+
package: first.package,
|
|
8616
|
+
version: first.version,
|
|
8617
|
+
contentHash: hash,
|
|
8618
|
+
path: relative,
|
|
8619
|
+
skills: skills.map(({ id }) => ({ id, path: id + "/SKILL.md" }))
|
|
8620
|
+
};
|
|
8621
|
+
}
|
|
8622
|
+
async function syncManagedSkills({
|
|
8623
|
+
dryRun = false,
|
|
8624
|
+
home = process.env.VANT_HOME || path16.join(os3.homedir(), ".vant"),
|
|
8625
|
+
resolvePackage
|
|
8626
|
+
} = {}) {
|
|
8627
|
+
const installed = path16.dirname(fileURLToPath2(import.meta.url));
|
|
8628
|
+
const { skills } = discoverToolSkills({ resolvePackage: resolvePackage ?? ((pkg) => defaultResolvePackage(pkg, {
|
|
8629
|
+
cwd: installed,
|
|
8630
|
+
resolveFrom: process.env.V_CLI_PLUGIN_RESOLVE_FROM && path16.resolve(process.env.V_CLI_PLUGIN_RESOLVE_FROM)
|
|
8631
|
+
})) });
|
|
8632
|
+
const groups = /* @__PURE__ */ new Map();
|
|
8633
|
+
for (const skill of skills) {
|
|
8634
|
+
const group = groups.get(skill.tool) ?? [];
|
|
8635
|
+
group.push(skill);
|
|
8636
|
+
groups.set(skill.tool, group);
|
|
8637
|
+
}
|
|
8638
|
+
const file2 = owned(home, "state/tool-skills/index.json");
|
|
8639
|
+
const tools = [];
|
|
8640
|
+
for (const group of groups.values()) tools.push(await projectTool(home, group, dryRun));
|
|
8641
|
+
const previous = fs15.existsSync(file2) ? JSON.parse(fs15.readFileSync(file2, "utf8")) : { schemaVersion: 1, tools: [] };
|
|
8642
|
+
if (previous.schemaVersion !== 1 || !Array.isArray(previous.tools)) throw new Error("\u53D7\u7BA1\u6280\u80FD\u7D22\u5F15\u65E0\u6548\u3002");
|
|
8643
|
+
const next = { schemaVersion: 1, tools: [...tools, ...previous.tools.filter((tool) => !groups.has(tool.id))] };
|
|
8644
|
+
if (!dryRun && JSON.stringify(previous) !== JSON.stringify(next)) {
|
|
8645
|
+
fs15.mkdirSync(path16.dirname(file2), { recursive: true });
|
|
8646
|
+
const temporary = file2 + "." + randomUUID2();
|
|
8647
|
+
try {
|
|
8648
|
+
fs15.writeFileSync(temporary, JSON.stringify(next, null, 2) + "\n", { flag: "wx" });
|
|
8649
|
+
await retryFile(() => fs15.renameSync(temporary, file2));
|
|
8650
|
+
} finally {
|
|
8651
|
+
fs15.rmSync(temporary, { force: true });
|
|
8652
|
+
}
|
|
8653
|
+
}
|
|
8654
|
+
return { dryRun, names: skills.map((skill) => skill.id) };
|
|
8655
|
+
}
|
|
8656
|
+
|
|
8560
8657
|
// src/commands/project.ts
|
|
8561
8658
|
var PROJECT_HELP_TEXT = [
|
|
8562
8659
|
"project\uFF1A\u5DE5\u7A0B\u6839\u7ED1\u5B9A\u4E0E\u53EA\u8BFB\u68C0\u67E5\u3002",
|
|
@@ -8660,7 +8757,7 @@ var project = {
|
|
|
8660
8757
|
"\u8986\u76D6\u67D0 Provider \u7684\u7ED1\u5B9A\u6BB5\uFF08\u53EF\u91CD\u590D\uFF1BJSON \u5BF9\u8C61\u5B8C\u6574\u66FF\u6362\u9ED8\u8BA4\u6BB5\uFF09",
|
|
8661
8758
|
(value, previous = []) => [...previous, value],
|
|
8662
8759
|
[]
|
|
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) => {
|
|
8760
|
+
).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
8761
|
const json = ctx.json || opts.json;
|
|
8665
8762
|
const registry = createDefaultRegistry();
|
|
8666
8763
|
try {
|
|
@@ -8670,8 +8767,20 @@ var project = {
|
|
|
8670
8767
|
reset: opts.reset,
|
|
8671
8768
|
dryRun: opts.dryRun
|
|
8672
8769
|
});
|
|
8770
|
+
let skills;
|
|
8771
|
+
if (result4.ok) {
|
|
8772
|
+
try {
|
|
8773
|
+
skills = await syncManagedSkills({ dryRun: opts.dryRun });
|
|
8774
|
+
} catch (error) {
|
|
8775
|
+
const reason = "\u53D7\u7BA1\u6280\u80FD\u540C\u6B65\u5931\u8D25\uFF1A" + formatError(error);
|
|
8776
|
+
if (json) ctx.log.result({ ok: false, projectConfig: result4, skills: { ok: false, reason } });
|
|
8777
|
+
ctx.log.error(reason + "\u3002\u4FEE\u6B63\u540E\u53EF\u91CD\u65B0\u8FD0\u884C project init\u3002");
|
|
8778
|
+
process.exitCode = 1;
|
|
8779
|
+
return;
|
|
8780
|
+
}
|
|
8781
|
+
}
|
|
8673
8782
|
if (json) {
|
|
8674
|
-
ctx.log.result(result4);
|
|
8783
|
+
ctx.log.result(skills ? { ...result4, skills } : result4);
|
|
8675
8784
|
if (!result4.ok) {
|
|
8676
8785
|
ctx.log.error(result4.reason);
|
|
8677
8786
|
process.exitCode = 1;
|
|
@@ -8696,6 +8805,7 @@ var project = {
|
|
|
8696
8805
|
...Object.entries(result4.bindings).map(([id, section]) => `\u7ED1\u5B9A ${id}: ${JSON.stringify(section)}`),
|
|
8697
8806
|
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
8807
|
];
|
|
8808
|
+
if (skills) lines.push(`\u53D7\u7BA1\u6280\u80FD: ${skills.names.join("\u3001")}\uFF08${skills.dryRun ? "\u9884\u89C8" : "\u5DF2\u5C31\u7EEA"}\uFF09`);
|
|
8699
8809
|
for (const warning of result4.warnings) lines.push(`\u8B66\u544A: ${warning}`);
|
|
8700
8810
|
ctx.log.result(lines.join("\n"));
|
|
8701
8811
|
} catch (err) {
|
|
@@ -8820,12 +8930,12 @@ async function loadBuiltinCommands() {
|
|
|
8820
8930
|
return builtinCommands.map((command) => ({ command, source: "builtin" }));
|
|
8821
8931
|
}
|
|
8822
8932
|
async function loadLocalPlugins(ctx) {
|
|
8823
|
-
const dir =
|
|
8933
|
+
const dir = path17.join(ctx.homeDir, "commands");
|
|
8824
8934
|
const loaded = [];
|
|
8825
|
-
if (!
|
|
8826
|
-
const files =
|
|
8935
|
+
if (!fs16.existsSync(dir)) return loaded;
|
|
8936
|
+
const files = fs16.readdirSync(dir).filter((f) => f.endsWith(".mjs")).sort();
|
|
8827
8937
|
for (const file2 of files) {
|
|
8828
|
-
const abs =
|
|
8938
|
+
const abs = path17.join(dir, file2);
|
|
8829
8939
|
try {
|
|
8830
8940
|
const mod = await import(
|
|
8831
8941
|
/* @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.5";
|
|
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));
|
|
@@ -7590,11 +7592,12 @@ function discoverToolSkills(options = {}) {
|
|
|
7590
7592
|
}
|
|
7591
7593
|
function readRuntimeSkill(command, options = {}) {
|
|
7592
7594
|
const tool = command ?? "v-cli";
|
|
7593
|
-
const result4 = discoverToolSkills(options)
|
|
7595
|
+
const result4 = discoverToolSkills(options);
|
|
7596
|
+
const skill = result4.skills.find((s) => s.id === tool) ?? result4.skills.find((s) => s.tool === tool);
|
|
7594
7597
|
if (!skill) throw new Error("\u5DE5\u5177\u672A\u58F0\u660E\u8FD0\u884C\u6280\u80FD\uFF1A" + tool);
|
|
7595
7598
|
return { ...skill, file: skill.path, content: fs11.readFileSync(skill.path, "utf8"), sha256: createHash5("sha256").update(fs11.readFileSync(skill.path)).digest("hex") };
|
|
7596
7599
|
}
|
|
7597
|
-
function
|
|
7600
|
+
function skillFileHashes(root2) {
|
|
7598
7601
|
const files = [];
|
|
7599
7602
|
const walk = (directory, prefix = "") => {
|
|
7600
7603
|
for (const entry of fs11.readdirSync(directory, { withFileTypes: true })) {
|
|
@@ -7607,7 +7610,10 @@ function skillBundleHash(root2) {
|
|
|
7607
7610
|
};
|
|
7608
7611
|
walk(root2);
|
|
7609
7612
|
files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
7610
|
-
return
|
|
7613
|
+
return files;
|
|
7614
|
+
}
|
|
7615
|
+
function skillBundleHash(root2) {
|
|
7616
|
+
return createHash5("sha256").update(JSON.stringify(skillFileHashes(root2))).digest("hex");
|
|
7611
7617
|
}
|
|
7612
7618
|
function exportToolSkill(command, options) {
|
|
7613
7619
|
if (!["codex", "claude"].includes(options.host) || !options.directory)
|
|
@@ -7641,7 +7647,7 @@ function exportToolSkill(command, options) {
|
|
|
7641
7647
|
};
|
|
7642
7648
|
walk(path11.dirname(skill.path), target);
|
|
7643
7649
|
const adapter = path11.join(root2, "adapters", options.host);
|
|
7644
|
-
if (fs11.existsSync(adapter)) walk(adapter, target);
|
|
7650
|
+
if (fs11.existsSync(adapter) && readRuntimeSkill(skill.tool, options).id === skill.id) walk(adapter, target);
|
|
7645
7651
|
if (!options.dryRun) for (const file2 of planned) {
|
|
7646
7652
|
fs11.mkdirSync(path11.dirname(file2.path), { recursive: true });
|
|
7647
7653
|
fs11.writeFileSync(file2.path, file2.bytes);
|
|
@@ -7650,7 +7656,7 @@ function exportToolSkill(command, options) {
|
|
|
7650
7656
|
}
|
|
7651
7657
|
|
|
7652
7658
|
// src/version.ts
|
|
7653
|
-
var VERSION = "0.7.
|
|
7659
|
+
var VERSION = "0.7.5";
|
|
7654
7660
|
|
|
7655
7661
|
// src/capability-coverage.ts
|
|
7656
7662
|
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.5",
|
|
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.
|
|
62
|
-
"@kevlns/figma-to-uprefab": "0.1.
|
|
63
|
-
"@kevlns/ship-cli": "0.1.
|
|
64
|
-
"@kevlns/u-cli-mod": "0.3.
|
|
65
|
-
"@kevlns/xlmerge": "2.0.
|
|
61
|
+
"@kevlns/art-workshop": "0.6.4",
|
|
62
|
+
"@kevlns/figma-to-uprefab": "0.1.5",
|
|
63
|
+
"@kevlns/ship-cli": "0.1.3",
|
|
64
|
+
"@kevlns/u-cli-mod": "0.3.2",
|
|
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.5
|
|
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,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
### @kevlns/art-workshop — 命令 `v-cli art …`
|
|
47
47
|
|
|
48
|
-
**版本**:0.6.
|
|
48
|
+
**版本**:0.6.4
|
|
49
49
|
**描述**:管理图片与视频两个独立制作通道;图片旧命令兼容,视频复用项目状态、CAS及原执行身份。
|
|
50
50
|
**平台**:win32, linux, darwin
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
### @kevlns/figma-to-uprefab — 命令 `v-cli figma …`
|
|
58
58
|
|
|
59
|
-
**版本**:0.1.
|
|
59
|
+
**版本**:0.1.5
|
|
60
60
|
**描述**:将 Figma 标记画板导出为源数据和图片,通过 Unity 转换器生成 UGUI 预制体。
|
|
61
61
|
**平台**:win32(仅 Windows 主机可用;非 Windows 上 v-cli 会拒绝路由)
|
|
62
62
|
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
### @kevlns/ship-cli — 命令 `v-cli ship …`
|
|
69
69
|
|
|
70
|
-
**版本**:0.1.
|
|
70
|
+
**版本**:0.1.3
|
|
71
71
|
**描述**:校验已构建的游戏产物,执行 Steam 上传、微信小游戏预览和开发版上传。
|
|
72
72
|
**平台**:win32, linux, darwin
|
|
73
73
|
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
### @kevlns/u-cli-mod — 命令 `v-cli unity …`
|
|
80
80
|
|
|
81
|
-
**版本**:0.3.
|
|
81
|
+
**版本**:0.3.2
|
|
82
82
|
**描述**:按 Unity Editor 精确版本定位工具链,校验和安装 com.unity.pipeline,并执行工程命令。
|
|
83
83
|
**平台**:win32(仅 Windows 主机可用;非 Windows 上 v-cli 会拒绝路由)
|
|
84
84
|
|
|
@@ -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`
|