@liendev/lien 0.19.2 → 0.19.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.
- package/dist/index.js +24 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6480,7 +6480,7 @@ async function indexCommand(options) {
|
|
|
6480
6480
|
// src/cli/serve.ts
|
|
6481
6481
|
import chalk7 from "chalk";
|
|
6482
6482
|
import fs20 from "fs/promises";
|
|
6483
|
-
import
|
|
6483
|
+
import path22 from "path";
|
|
6484
6484
|
|
|
6485
6485
|
// src/mcp/server.ts
|
|
6486
6486
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -6793,8 +6793,8 @@ async function handleFindSimilar(args, ctx) {
|
|
|
6793
6793
|
}
|
|
6794
6794
|
|
|
6795
6795
|
// src/mcp/utils/path-matching.ts
|
|
6796
|
-
function normalizePath(
|
|
6797
|
-
let normalized =
|
|
6796
|
+
function normalizePath(path24, workspaceRoot) {
|
|
6797
|
+
let normalized = path24.replace(/['"]/g, "").trim().replace(/\\/g, "/");
|
|
6798
6798
|
normalized = normalized.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
6799
6799
|
if (normalized.startsWith(workspaceRoot + "/")) {
|
|
6800
6800
|
normalized = normalized.substring(workspaceRoot.length + 1);
|
|
@@ -6890,10 +6890,10 @@ async function handleGetFilesContext(args, ctx) {
|
|
|
6890
6890
|
log(`Scanned ${SCAN_LIMIT} chunks (limit reached). Test associations may be incomplete for large codebases.`, "warning");
|
|
6891
6891
|
}
|
|
6892
6892
|
const pathCache = /* @__PURE__ */ new Map();
|
|
6893
|
-
const normalizePathCached = (
|
|
6894
|
-
if (pathCache.has(
|
|
6895
|
-
const normalized = normalizePath(
|
|
6896
|
-
pathCache.set(
|
|
6893
|
+
const normalizePathCached = (path24) => {
|
|
6894
|
+
if (pathCache.has(path24)) return pathCache.get(path24);
|
|
6895
|
+
const normalized = normalizePath(path24, workspaceRoot);
|
|
6896
|
+
pathCache.set(path24, normalized);
|
|
6897
6897
|
return normalized;
|
|
6898
6898
|
};
|
|
6899
6899
|
const testAssociationsMap = filepaths.map((filepath) => {
|
|
@@ -7134,9 +7134,9 @@ async function handleGetDependents(args, ctx) {
|
|
|
7134
7134
|
log(`Scanning ${allChunks.length} chunks for imports...`);
|
|
7135
7135
|
const workspaceRoot = process.cwd().replace(/\\/g, "/");
|
|
7136
7136
|
const pathCache = /* @__PURE__ */ new Map();
|
|
7137
|
-
const normalizePathCached = (
|
|
7138
|
-
if (!pathCache.has(
|
|
7139
|
-
return pathCache.get(
|
|
7137
|
+
const normalizePathCached = (path24) => {
|
|
7138
|
+
if (!pathCache.has(path24)) pathCache.set(path24, normalizePath(path24, workspaceRoot));
|
|
7139
|
+
return pathCache.get(path24);
|
|
7140
7140
|
};
|
|
7141
7141
|
const importIndex = buildImportIndex(allChunks, normalizePathCached);
|
|
7142
7142
|
const normalizedTarget = normalizePathCached(validatedArgs.filepath);
|
|
@@ -7202,11 +7202,11 @@ var COMPLEXITY_THRESHOLDS2 = {
|
|
|
7202
7202
|
};
|
|
7203
7203
|
function createPathNormalizer(workspaceRoot) {
|
|
7204
7204
|
const cache = /* @__PURE__ */ new Map();
|
|
7205
|
-
return (
|
|
7206
|
-
const cached = cache.get(
|
|
7205
|
+
return (path24) => {
|
|
7206
|
+
const cached = cache.get(path24);
|
|
7207
7207
|
if (cached !== void 0) return cached;
|
|
7208
|
-
const normalized = normalizePath(
|
|
7209
|
-
cache.set(
|
|
7208
|
+
const normalized = normalizePath(path24, workspaceRoot);
|
|
7209
|
+
cache.set(path24, normalized);
|
|
7210
7210
|
return normalized;
|
|
7211
7211
|
};
|
|
7212
7212
|
}
|
|
@@ -7717,6 +7717,7 @@ init_utils();
|
|
|
7717
7717
|
// src/watcher/index.ts
|
|
7718
7718
|
init_schema();
|
|
7719
7719
|
import chokidar from "chokidar";
|
|
7720
|
+
import path21 from "path";
|
|
7720
7721
|
var FileWatcher = class {
|
|
7721
7722
|
watcher = null;
|
|
7722
7723
|
debounceTimers = /* @__PURE__ */ new Map();
|
|
@@ -7755,9 +7756,12 @@ var FileWatcher = class {
|
|
|
7755
7756
|
persistent: true,
|
|
7756
7757
|
ignoreInitial: true,
|
|
7757
7758
|
// Don't trigger for existing files
|
|
7759
|
+
// Handle atomic saves from modern editors (VS Code, Sublime, etc.)
|
|
7760
|
+
// Editors write to temp file then rename - without this, we get unlink+add instead of change
|
|
7761
|
+
atomic: true,
|
|
7758
7762
|
awaitWriteFinish: {
|
|
7759
|
-
stabilityThreshold:
|
|
7760
|
-
//
|
|
7763
|
+
stabilityThreshold: 300,
|
|
7764
|
+
// Reduced from 500ms for faster detection
|
|
7761
7765
|
pollInterval: 100
|
|
7762
7766
|
},
|
|
7763
7767
|
// Performance optimizations
|
|
@@ -7786,7 +7790,7 @@ var FileWatcher = class {
|
|
|
7786
7790
|
const timer = setTimeout(() => {
|
|
7787
7791
|
this.debounceTimers.delete(filepath);
|
|
7788
7792
|
if (this.onChangeHandler) {
|
|
7789
|
-
const absolutePath =
|
|
7793
|
+
const absolutePath = path21.isAbsolute(filepath) ? filepath : path21.join(this.rootDir, filepath);
|
|
7790
7794
|
try {
|
|
7791
7795
|
const result = this.onChangeHandler({
|
|
7792
7796
|
type,
|
|
@@ -8061,7 +8065,7 @@ async function startMCPServer(options) {
|
|
|
8061
8065
|
|
|
8062
8066
|
// src/cli/serve.ts
|
|
8063
8067
|
async function serveCommand(options) {
|
|
8064
|
-
const rootDir = options.root ?
|
|
8068
|
+
const rootDir = options.root ? path22.resolve(options.root) : process.cwd();
|
|
8065
8069
|
try {
|
|
8066
8070
|
if (options.root) {
|
|
8067
8071
|
try {
|
|
@@ -8109,7 +8113,7 @@ init_lancedb();
|
|
|
8109
8113
|
init_service();
|
|
8110
8114
|
import chalk9 from "chalk";
|
|
8111
8115
|
import fs21 from "fs";
|
|
8112
|
-
import
|
|
8116
|
+
import path23 from "path";
|
|
8113
8117
|
|
|
8114
8118
|
// src/insights/formatters/text.ts
|
|
8115
8119
|
import chalk8 from "chalk";
|
|
@@ -8384,7 +8388,7 @@ function validateFormat(format) {
|
|
|
8384
8388
|
function validateFilesExist(files, rootDir) {
|
|
8385
8389
|
if (!files || files.length === 0) return;
|
|
8386
8390
|
const missingFiles = files.filter((file) => {
|
|
8387
|
-
const fullPath =
|
|
8391
|
+
const fullPath = path23.isAbsolute(file) ? file : path23.join(rootDir, file);
|
|
8388
8392
|
return !fs21.existsSync(fullPath);
|
|
8389
8393
|
});
|
|
8390
8394
|
if (missingFiles.length > 0) {
|