@kevlns/v-cli 0.7.6 → 0.7.7

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/cli.mjs CHANGED
@@ -765,7 +765,7 @@ function exportToolSkill(command, options) {
765
765
  }
766
766
 
767
767
  // src/version.ts
768
- var VERSION = "0.7.6";
768
+ var VERSION = "0.7.7";
769
769
 
770
770
  // src/commands/agent.ts
771
771
  function buildAgentIndex(builtin, local, official) {
package/dist/sdk.d.ts CHANGED
@@ -1207,7 +1207,16 @@ 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.6";
1210
+ declare const VERSION = "0.7.7";
1211
+
1212
+ declare function syncManagedSkills({ dryRun, home, resolvePackage }?: {
1213
+ dryRun?: boolean;
1214
+ home?: string;
1215
+ resolvePackage?: (pkg: string) => string | undefined;
1216
+ }): Promise<{
1217
+ dryRun: boolean;
1218
+ names: string[];
1219
+ }>;
1211
1220
 
1212
1221
  /** 已发布命令清单与真实注册表逐项对照,不从命名猜测覆盖。 */
1213
1222
  declare function capabilityCoverage(registry: CapabilityRegistry): {
@@ -1226,4 +1235,4 @@ declare function capabilityCoverage(registry: CapabilityRegistry): {
1226
1235
  }[];
1227
1236
  };
1228
1237
 
1229
- export { type AcceptanceStatus, type ArtProviderDeps, type Artifact, type CapabilityDescriptor, CapabilityError, type CapabilityExecutionContext, type CapabilityImplementation, type CapabilityProvider, type CapabilityRegistration, CapabilityRegistrationError, CapabilityRegistry, type CapabilityRunRequest, type CapabilityRunResult, type CapabilityRuntimeDeps, type CapabilitySummary, type DefaultRegistryOptions, EXECUTION_HANDLE_VERSION, type ErrorCategory, type Evidence, type ExecutionHandle, type ExecutionHandleSeed, type ExecutionLifecycle, type ExecutionStatus, FIGMA_PROVIDER_ID, FIGMA_PROVIDER_VERSION, type FigmaBinding, type FigmaProviderDeps, type HandleVerification, type ImplementationOutcome, type InitProjectConfigResult, JSON_TYPES, type JsonSchema, type JsonSchemaArray, type JsonSchemaBoolean, type JsonSchemaNull, type JsonSchemaNumber, type JsonSchemaObject, type JsonSchemaString, type JsonSchemaType, type LoadProjectConfigResult, type LogRef, NodeProcessExecutor, OPERATIONS_RELATIVE, OperationExistsError, type OperationLogger, OperationStore, type OperationSummary, PROJECT_CLI_CONFIG_RELATIVE, PROJECT_STORAGE_ROOT_VERSION, PathSafetyError, type PreconditionChecker, type PreconditionDeclaration, type PreconditionOutcome, type ProcessExecutor, type ProcessInvocation, type ProcessOutcome, type ProjectBindingInfo, type ProjectCliConfig, type ProjectInspection, type ProjectRoot, type ProviderBindingContract, type ProviderBindingResolution, type ProviderBindingResolutionError, type ProviderBindingResolutionOk, type ProviderBindingResolveInput, type ProviderDefaultBinding, type ProviderInfo, type ProviderPathField, type ProviderSet, type ProviderState, type ProviderStatus, REDACTION_PLACEHOLDER, type ResolvedProviderBinding, type ResourceAuthorizationDecision, type ResourceAuthorizationRequest, type ResourceAuthorizer, type ResourceKind, type ResourceMode, type ResourceRequirement, type RetrySemantics, type SideEffectDeclaration, type SideEffectKind, type SideEffectRecord, type StructuredError, type ToolSkill, UNITY_PROVIDER_ID, UNITY_PROVIDER_VERSION, type UnityBinding, type UnityProviderDeps, type UnityTestMode, VANT_PROJECT_CONFIG_RELATIVE, VERSION, artBindingContract, buildDoctorArgv, buildExecArgv, buildExecutionHandle, canonicalize, capabilityCoverage, createArtProvider, createDefaultRegistry, createFigmaProvider, createUnityProvider, discoverToolSkills, executionFromProcess, exitCodeForResult, exportToolSkill, figmaBindingContract, formatResultJson, generateOperationId, initProjectConfig, inspectProject, loadProjectConfig, readRuntimeSkill, redactArgv, redactSecrets, renderProjectConfig, resolveBindings, resolveInsideProject, resolveProjectRoot, runCapability, splitSafeRelative, structuredError, toProviderSet, toStructuredError, unityBindingContract, validateCapability, validateOperationId, validateProjectCliConfig, validateProvider, validateSchemaDefinition, validateValue, verifyExecutionHandle };
1238
+ export { type AcceptanceStatus, type ArtProviderDeps, type Artifact, type CapabilityDescriptor, CapabilityError, type CapabilityExecutionContext, type CapabilityImplementation, type CapabilityProvider, type CapabilityRegistration, CapabilityRegistrationError, CapabilityRegistry, type CapabilityRunRequest, type CapabilityRunResult, type CapabilityRuntimeDeps, type CapabilitySummary, type DefaultRegistryOptions, EXECUTION_HANDLE_VERSION, type ErrorCategory, type Evidence, type ExecutionHandle, type ExecutionHandleSeed, type ExecutionLifecycle, type ExecutionStatus, FIGMA_PROVIDER_ID, FIGMA_PROVIDER_VERSION, type FigmaBinding, type FigmaProviderDeps, type HandleVerification, type ImplementationOutcome, type InitProjectConfigResult, JSON_TYPES, type JsonSchema, type JsonSchemaArray, type JsonSchemaBoolean, type JsonSchemaNull, type JsonSchemaNumber, type JsonSchemaObject, type JsonSchemaString, type JsonSchemaType, type LoadProjectConfigResult, type LogRef, NodeProcessExecutor, OPERATIONS_RELATIVE, OperationExistsError, type OperationLogger, OperationStore, type OperationSummary, PROJECT_CLI_CONFIG_RELATIVE, PROJECT_STORAGE_ROOT_VERSION, PathSafetyError, type PreconditionChecker, type PreconditionDeclaration, type PreconditionOutcome, type ProcessExecutor, type ProcessInvocation, type ProcessOutcome, type ProjectBindingInfo, type ProjectCliConfig, type ProjectInspection, type ProjectRoot, type ProviderBindingContract, type ProviderBindingResolution, type ProviderBindingResolutionError, type ProviderBindingResolutionOk, type ProviderBindingResolveInput, type ProviderDefaultBinding, type ProviderInfo, type ProviderPathField, type ProviderSet, type ProviderState, type ProviderStatus, REDACTION_PLACEHOLDER, type ResolvedProviderBinding, type ResourceAuthorizationDecision, type ResourceAuthorizationRequest, type ResourceAuthorizer, type ResourceKind, type ResourceMode, type ResourceRequirement, type RetrySemantics, type SideEffectDeclaration, type SideEffectKind, type SideEffectRecord, type StructuredError, type ToolSkill, UNITY_PROVIDER_ID, UNITY_PROVIDER_VERSION, type UnityBinding, type UnityProviderDeps, type UnityTestMode, VANT_PROJECT_CONFIG_RELATIVE, VERSION, artBindingContract, buildDoctorArgv, buildExecArgv, buildExecutionHandle, canonicalize, capabilityCoverage, createArtProvider, createDefaultRegistry, createFigmaProvider, createUnityProvider, discoverToolSkills, executionFromProcess, exitCodeForResult, exportToolSkill, figmaBindingContract, formatResultJson, generateOperationId, initProjectConfig, inspectProject, loadProjectConfig, readRuntimeSkill, redactArgv, redactSecrets, renderProjectConfig, resolveBindings, resolveInsideProject, resolveProjectRoot, runCapability, splitSafeRelative, structuredError, syncManagedSkills, toProviderSet, toStructuredError, unityBindingContract, validateCapability, validateOperationId, validateProjectCliConfig, validateProvider, validateSchemaDefinition, validateValue, verifyExecutionHandle };
package/dist/sdk.mjs CHANGED
@@ -740,8 +740,8 @@ function resolveInsideProject(project, relative, label) {
740
740
  return { path: project.root, realPath: project.realRoot };
741
741
  }
742
742
  const segments = splitSafeRelative(relative, label);
743
- const owned = segments.map((segment) => process.platform === "win32" ? segment.toLowerCase() : segment);
744
- const storage = owned[0] === ".vant" && owned[1] !== "rules" && !(owned.length === 2 && owned[1] === "rules.md");
743
+ const owned2 = segments.map((segment) => process.platform === "win32" ? segment.toLowerCase() : segment);
744
+ const storage = owned2[0] === ".vant" && owned2[1] !== "rules" && !(owned2.length === 2 && owned2[1] === "rules.md");
745
745
  const root2 = storage ? project.storageRoot : project.root;
746
746
  const realRoot = storage ? project.realStorageRoot : project.realRoot;
747
747
  const target = path.join(root2, ...segments);
@@ -4217,9 +4217,9 @@ var FAIL_COUNT_PATHS = [
4217
4217
  ];
4218
4218
  function extractFailCount(payload) {
4219
4219
  if (!isPlainObject7(payload)) return { count: null, source: null };
4220
- for (const path12 of FAIL_COUNT_PATHS) {
4220
+ for (const path13 of FAIL_COUNT_PATHS) {
4221
4221
  let current = payload;
4222
- for (const segment of path12) {
4222
+ for (const segment of path13) {
4223
4223
  if (!isPlainObject7(current)) {
4224
4224
  current = void 0;
4225
4225
  break;
@@ -4227,16 +4227,16 @@ function extractFailCount(payload) {
4227
4227
  current = current[segment];
4228
4228
  }
4229
4229
  if (typeof current === "number" && Number.isSafeInteger(current) && current >= 0) {
4230
- return { count: current, source: path12.join(".") };
4230
+ return { count: current, source: path13.join(".") };
4231
4231
  }
4232
4232
  }
4233
4233
  return { count: null, source: null };
4234
4234
  }
4235
4235
  function extractTotal(payload) {
4236
4236
  if (!isPlainObject7(payload)) return { total: null, source: null };
4237
- for (const path12 of [["summary", "total"]]) {
4237
+ for (const path13 of [["summary", "total"]]) {
4238
4238
  let current = payload;
4239
- for (const segment of path12) {
4239
+ for (const segment of path13) {
4240
4240
  if (!isPlainObject7(current)) {
4241
4241
  current = void 0;
4242
4242
  break;
@@ -4244,7 +4244,7 @@ function extractTotal(payload) {
4244
4244
  current = current[segment];
4245
4245
  }
4246
4246
  if (typeof current === "number" && Number.isSafeInteger(current) && current >= 0) {
4247
- return { total: current, source: path12.join(".") };
4247
+ return { total: current, source: path13.join(".") };
4248
4248
  }
4249
4249
  }
4250
4250
  return { total: null, source: null };
@@ -7665,7 +7665,98 @@ function exportToolSkill(command, options) {
7665
7665
  }
7666
7666
 
7667
7667
  // src/version.ts
7668
- var VERSION = "0.7.6";
7668
+ var VERSION = "0.7.7";
7669
+
7670
+ // src/core/managed-skills.ts
7671
+ import fs12 from "fs";
7672
+ import path12 from "path";
7673
+ import os2 from "os";
7674
+ import { createHash as createHash6, randomUUID as randomUUID2 } from "crypto";
7675
+ import { fileURLToPath as fileURLToPath2 } from "url";
7676
+ var digest = (data) => createHash6("sha256").update(JSON.stringify(data)).digest("hex");
7677
+ function owned(home, relative) {
7678
+ let current = home;
7679
+ for (const part of relative.split("/")) {
7680
+ current = path12.join(current, part);
7681
+ if (fs12.lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink())
7682
+ throw new Error("\u53D7\u7BA1\u6280\u80FD\u8DEF\u5F84\u5305\u542B\u94FE\u63A5\uFF1A" + current);
7683
+ }
7684
+ return current;
7685
+ }
7686
+ async function projectTool(home, skills, dryRun) {
7687
+ const first = skills[0];
7688
+ const files = skills.flatMap((skill) => skillFileHashes(path12.dirname(skill.path)).map((file2) => [skill.id + "/" + file2.path, file2.hash]));
7689
+ files.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
7690
+ const hash = digest(files);
7691
+ const relative = "managed/" + first.tool + "/" + hash;
7692
+ const target = owned(home, "skills/" + relative);
7693
+ function verify(directory) {
7694
+ if (digest(skillFileHashes(directory).map((file2) => [file2.path, file2.hash])) !== hash)
7695
+ throw new Error("\u53D7\u7BA1\u6280\u80FD\u5185\u5BB9\u6821\u9A8C\u5931\u8D25\uFF1A" + directory);
7696
+ }
7697
+ if (fs12.existsSync(target)) verify(target);
7698
+ else if (!dryRun) {
7699
+ fs12.mkdirSync(path12.dirname(target), { recursive: true });
7700
+ const staging = fs12.mkdtempSync(path12.join(path12.dirname(target), ".stage-"));
7701
+ try {
7702
+ for (const skill of skills) fs12.cpSync(path12.dirname(skill.path), path12.join(staging, skill.id), {
7703
+ recursive: true,
7704
+ filter: (source) => path12.basename(source) !== "__pycache__" && !source.endsWith(".pyc")
7705
+ });
7706
+ verify(staging);
7707
+ try {
7708
+ await retryFile(() => fs12.renameSync(staging, target));
7709
+ } catch (error) {
7710
+ if (!fs12.existsSync(target)) throw error;
7711
+ verify(target);
7712
+ }
7713
+ } finally {
7714
+ fs12.rmSync(staging, { recursive: true, force: true });
7715
+ }
7716
+ }
7717
+ return {
7718
+ id: first.tool,
7719
+ package: first.package,
7720
+ version: first.version,
7721
+ contentHash: hash,
7722
+ path: relative,
7723
+ skills: skills.map(({ id }) => ({ id, path: id + "/SKILL.md" }))
7724
+ };
7725
+ }
7726
+ async function syncManagedSkills({
7727
+ dryRun = false,
7728
+ home = process.env.VANT_HOME || path12.join(os2.homedir(), ".vant"),
7729
+ resolvePackage
7730
+ } = {}) {
7731
+ const installed = path12.dirname(fileURLToPath2(import.meta.url));
7732
+ const { skills } = discoverToolSkills({ resolvePackage: resolvePackage ?? ((pkg) => defaultResolvePackage(pkg, {
7733
+ cwd: installed,
7734
+ resolveFrom: process.env.V_CLI_PLUGIN_RESOLVE_FROM && path12.resolve(process.env.V_CLI_PLUGIN_RESOLVE_FROM)
7735
+ })) });
7736
+ const groups = /* @__PURE__ */ new Map();
7737
+ for (const skill of skills) {
7738
+ const group = groups.get(skill.tool) ?? [];
7739
+ group.push(skill);
7740
+ groups.set(skill.tool, group);
7741
+ }
7742
+ const file2 = owned(home, "state/tool-skills/index.json");
7743
+ const tools = [];
7744
+ for (const group of groups.values()) tools.push(await projectTool(home, group, dryRun));
7745
+ const previous = fs12.existsSync(file2) ? JSON.parse(fs12.readFileSync(file2, "utf8")) : { schemaVersion: 1, tools: [] };
7746
+ if (previous.schemaVersion !== 1 || !Array.isArray(previous.tools)) throw new Error("\u53D7\u7BA1\u6280\u80FD\u7D22\u5F15\u65E0\u6548\u3002");
7747
+ const next = { schemaVersion: 1, tools: [...tools, ...previous.tools.filter((tool) => !groups.has(tool.id))] };
7748
+ if (!dryRun && JSON.stringify(previous) !== JSON.stringify(next)) {
7749
+ fs12.mkdirSync(path12.dirname(file2), { recursive: true });
7750
+ const temporary = file2 + "." + randomUUID2();
7751
+ try {
7752
+ fs12.writeFileSync(temporary, JSON.stringify(next, null, 2) + "\n", { flag: "wx" });
7753
+ await retryFile(() => fs12.renameSync(temporary, file2));
7754
+ } finally {
7755
+ fs12.rmSync(temporary, { force: true });
7756
+ }
7757
+ }
7758
+ return { dryRun, names: skills.map((skill) => skill.id) };
7759
+ }
7669
7760
 
7670
7761
  // src/capability-coverage.ts
7671
7762
  function capabilityCoverage(registry) {
@@ -7748,6 +7839,7 @@ export {
7748
7839
  runCapability,
7749
7840
  splitSafeRelative,
7750
7841
  structuredError,
7842
+ syncManagedSkills,
7751
7843
  toProviderSet,
7752
7844
  toStructuredError,
7753
7845
  unityBindingContract,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevlns/v-cli",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "提供工具发现、插件路由、工程绑定、结构化能力执行和操作证据管理。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  "toolbox"
59
59
  ],
60
60
  "dependencies": {
61
- "@kevlns/art-workshop": "0.6.5",
61
+ "@kevlns/art-workshop": "0.6.6",
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",
@@ -8,3 +8,5 @@ description: 发现项目工具及技能,读取能力契约并执行结构化
8
8
  先用 agent index、agent skills 和 capability describe 了解当前可用工具;操作约束按需读取 references/project.md 及目标工具的声明技能。命令参数以 describe 为准,不把仓库 AGENTS.md 当运行时规范。
9
9
 
10
10
  项目初始化使用 `project init`,它按各工具清单将技能、参考资料和脚本同步到 Vant 的全局受管目录。按技能 ID 用 `agent docs` 读取单份指南。默认安装不扫描或改写外部 Agent。失败保留明确状态,不循环重试;未知写入仅查询原执行身份,不能换 ID 重投。
11
+
12
+ 美术制作通过 `art image`、`art video` 和 `art spine` 选择通道。`art spine describe` 提供拆件、骨架编译与取帧的输入示例;相同操作也可使用 `capability run art.spine-<操作>`。
@@ -18,7 +18,7 @@
18
18
 
19
19
  ### 核心约定(v-cli 本体)
20
20
 
21
- - 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.7.6
21
+ - 环境要求 Node.js >= 20;v-cli 版本 @kevlns/v-cli@0.7.7
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.5
48
+ **版本**:0.6.6
49
49
  **描述**:管理图片、视频与 Spine 骨骼动画制作。
50
50
  **平台**:win32, linux, darwin
51
51