flycode-mcp 1.14.3 → 1.14.4
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.js +20 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -112,7 +112,7 @@ var init_args = __esm({
|
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
// src/cli/env.ts
|
|
115
|
-
import { readFileSync } from "node:fs";
|
|
115
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
116
116
|
import { homedir } from "node:os";
|
|
117
117
|
import { dirname, join as join2, resolve } from "node:path";
|
|
118
118
|
import { fileURLToPath } from "node:url";
|
|
@@ -127,11 +127,16 @@ function resolveCliPaths(packageRoot) {
|
|
|
127
127
|
function defaultHome() {
|
|
128
128
|
return homedir();
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
function pickPackageRoot(here, hasPackageJson) {
|
|
131
|
+
const fromDist = resolve(here, "..");
|
|
132
|
+
if (hasPackageJson(fromDist)) {
|
|
133
|
+
return fromDist;
|
|
133
134
|
}
|
|
134
|
-
return resolve(
|
|
135
|
+
return resolve(here, "..", "..");
|
|
136
|
+
}
|
|
137
|
+
function defaultPackageRoot() {
|
|
138
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
139
|
+
return pickPackageRoot(here, (dir) => existsSync(join2(dir, "package.json")));
|
|
135
140
|
}
|
|
136
141
|
function readPackageVersion(packageRoot) {
|
|
137
142
|
const raw = JSON.parse(readFileSync(join2(packageRoot, "package.json"), "utf8"));
|
|
@@ -6145,7 +6150,7 @@ var init_trash = __esm({
|
|
|
6145
6150
|
// src/cli/skill.ts
|
|
6146
6151
|
import {
|
|
6147
6152
|
cpSync,
|
|
6148
|
-
existsSync,
|
|
6153
|
+
existsSync as existsSync2,
|
|
6149
6154
|
mkdirSync,
|
|
6150
6155
|
readFileSync as readFileSync2,
|
|
6151
6156
|
readdirSync,
|
|
@@ -6157,11 +6162,11 @@ import {
|
|
|
6157
6162
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
6158
6163
|
function inspectSkillDest(destDir, source) {
|
|
6159
6164
|
const mainPath = join3(destDir, MAIN_FILE);
|
|
6160
|
-
if (!
|
|
6165
|
+
if (!existsSync2(mainPath)) {
|
|
6161
6166
|
return { exists: false, hasMarker: false, markerVersion: null, contentMatchesSource: null };
|
|
6162
6167
|
}
|
|
6163
6168
|
const markerPath = join3(destDir, MARKER_FILE);
|
|
6164
|
-
const hasMarker =
|
|
6169
|
+
const hasMarker = existsSync2(markerPath);
|
|
6165
6170
|
let markerVersion = null;
|
|
6166
6171
|
if (hasMarker) {
|
|
6167
6172
|
try {
|
|
@@ -6172,7 +6177,7 @@ function inspectSkillDest(destDir, source) {
|
|
|
6172
6177
|
}
|
|
6173
6178
|
}
|
|
6174
6179
|
let contentMatchesSource = null;
|
|
6175
|
-
if (source !== void 0 &&
|
|
6180
|
+
if (source !== void 0 && existsSync2(join3(source.dir, MAIN_FILE))) {
|
|
6176
6181
|
contentMatchesSource = readFileSync2(mainPath, "utf8") === readFileSync2(join3(source.dir, MAIN_FILE), "utf8");
|
|
6177
6182
|
}
|
|
6178
6183
|
return { exists: true, hasMarker, markerVersion, contentMatchesSource };
|
|
@@ -6182,7 +6187,7 @@ function installSkill(options) {
|
|
|
6182
6187
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
6183
6188
|
const trashFn = options.trashFn ?? nativeTrashFn();
|
|
6184
6189
|
const sourceMain = join3(source.dir, MAIN_FILE);
|
|
6185
|
-
if (!
|
|
6190
|
+
if (!existsSync2(sourceMain) || !statSync(sourceMain).isFile()) {
|
|
6186
6191
|
return {
|
|
6187
6192
|
status: "failed",
|
|
6188
6193
|
reason: `skill \u6E90\u76EE\u5F55\u7F3A\u5C11 ${MAIN_FILE}\uFF1A${source.dir}`,
|
|
@@ -6191,7 +6196,7 @@ function installSkill(options) {
|
|
|
6191
6196
|
}
|
|
6192
6197
|
const parentDir = parentOf(destDir);
|
|
6193
6198
|
const destMain = join3(destDir, MAIN_FILE);
|
|
6194
|
-
const destExists =
|
|
6199
|
+
const destExists = existsSync2(destMain);
|
|
6195
6200
|
if (destExists) {
|
|
6196
6201
|
const destIsDir = (() => {
|
|
6197
6202
|
try {
|
|
@@ -6320,7 +6325,7 @@ function verifyInstalled(destDir, source) {
|
|
|
6320
6325
|
function sameFileSet(destDir, sourceDir) {
|
|
6321
6326
|
try {
|
|
6322
6327
|
const dest = listFiles(destDir).filter((name) => name !== MARKER_FILE);
|
|
6323
|
-
return dest.length === listFiles(sourceDir).length && dest.every((name) =>
|
|
6328
|
+
return dest.length === listFiles(sourceDir).length && dest.every((name) => existsSync2(join3(sourceDir, name)));
|
|
6324
6329
|
} catch {
|
|
6325
6330
|
return false;
|
|
6326
6331
|
}
|
|
@@ -6340,7 +6345,7 @@ function listFiles(root) {
|
|
|
6340
6345
|
return out.sort();
|
|
6341
6346
|
}
|
|
6342
6347
|
function cleanStaleStaging(parentDir) {
|
|
6343
|
-
if (!
|
|
6348
|
+
if (!existsSync2(parentDir)) return;
|
|
6344
6349
|
for (const entry of readdirSync(parentDir)) {
|
|
6345
6350
|
if (entry.startsWith(STAGING_PREFIX)) {
|
|
6346
6351
|
rmSync(join3(parentDir, entry), { recursive: true, force: true });
|
|
@@ -6641,7 +6646,7 @@ __export(update_exports, {
|
|
|
6641
6646
|
runUpdateCommand: () => runUpdateCommand
|
|
6642
6647
|
});
|
|
6643
6648
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
6644
|
-
import { existsSync as
|
|
6649
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, realpathSync } from "node:fs";
|
|
6645
6650
|
import { join as join4 } from "node:path";
|
|
6646
6651
|
function detectInstallation(packageRoot, platform = process.platform, spawnFn = defaultSpawn2) {
|
|
6647
6652
|
if (packageRoot.includes(join4(".bun", "install", "global", "node_modules"))) {
|
|
@@ -6745,7 +6750,7 @@ function installWithPackageManager(installation, target) {
|
|
|
6745
6750
|
}
|
|
6746
6751
|
function defaultVerifyInstalledVersion(installation) {
|
|
6747
6752
|
const pkgPath = join4(installation.packageRoot, "package.json");
|
|
6748
|
-
if (!
|
|
6753
|
+
if (!existsSync3(pkgPath)) return null;
|
|
6749
6754
|
try {
|
|
6750
6755
|
const parsed = JSON.parse(readFileSync3(pkgPath, "utf8"));
|
|
6751
6756
|
return typeof parsed.version === "string" ? parsed.version : null;
|