yuanflow-cli 0.1.2 → 0.1.3

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.
@@ -90,27 +90,20 @@ function resolveRepositoryRoot(extractDir) {
90
90
  }
91
91
 
92
92
  function resolveLocalSkillRoot(packageRoot) {
93
+ const localRoot = path.resolve(packageRoot, '..', 'YuanFlow-skill');
94
+ if (fs.existsSync(path.join(localRoot, 'SKILL.md'))) {
95
+ return localRoot;
96
+ }
97
+
93
98
  const packagedRoot = path.resolve(packageRoot, 'skills', 'yuanflow-skill');
94
99
  if (fs.existsSync(path.join(packagedRoot, 'SKILL.md'))) {
95
100
  return packagedRoot;
96
101
  }
97
102
 
98
- const localRoot = path.resolve(packageRoot, '..', 'YuanFlow-skill');
99
- if (fs.existsSync(path.join(localRoot, 'SKILL.md'))) {
100
- return localRoot;
101
- }
102
103
  return '';
103
104
  }
104
105
 
105
106
  async function prepareSkillSource({ packageRoot }) {
106
- const localRoot = resolveLocalSkillRoot(packageRoot);
107
- if (localRoot) {
108
- return {
109
- sourceRoot: localRoot,
110
- cleanup() {},
111
- };
112
- }
113
-
114
107
  const repoConfig = readRepositoryConfig(packageRoot);
115
108
  const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'yuanflow-skill-'));
116
109
  const archiveFile = path.join(tempRoot, `${repoConfig.repo}-${repoConfig.ref}.tar.gz`);
@@ -138,6 +131,15 @@ async function prepareSkillSource({ packageRoot }) {
138
131
  cloneRepository({ repoConfig, targetDir: cloneDir });
139
132
  sourceRoot = resolveRepositoryRoot(cloneDir);
140
133
  } catch (gitError) {
134
+ const localRoot = resolveLocalSkillRoot(packageRoot);
135
+ if (localRoot) {
136
+ fs.rmSync(tempRoot, { recursive: true, force: true });
137
+ return {
138
+ sourceRoot: localRoot,
139
+ cleanup() {},
140
+ };
141
+ }
142
+
141
143
  const archiveMessage = archiveError instanceof Error ? archiveError.message : String(archiveError);
142
144
  const gitMessage = gitError instanceof Error ? gitError.message : String(gitError);
143
145
  throw new Error(`下载 skill 仓库失败。archive: ${archiveMessage}; git: ${gitMessage}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuanflow-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "YuanFlow API CLI and skill installer for supported AI coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",