ai-helper-agent 1.12.1 → 1.12.2
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/package.json +1 -1
- package/src/search.js +2 -2
package/package.json
CHANGED
package/src/search.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
3
|
import { readdir, stat, readFile } from 'fs/promises';
|
|
4
4
|
import { statSync } from 'fs';
|
|
5
|
-
import { join, basename, extname, resolve } from 'path';
|
|
5
|
+
import { join, basename, extname, resolve, isAbsolute } from 'path';
|
|
6
6
|
import { checkPath } from './security.js';
|
|
7
7
|
|
|
8
8
|
// 缓存检测结果,避免每次启动重复检测
|
|
@@ -112,7 +112,7 @@ function searchWithFd(rootPath, filePattern, recursive, maxResults) {
|
|
|
112
112
|
const output = Buffer.concat(stdout).toString('utf-8').trim();
|
|
113
113
|
const lines = output ? output.split('\n').filter(Boolean) : [];
|
|
114
114
|
const results = lines.map(p => {
|
|
115
|
-
const absPath = join(rootPath, p);
|
|
115
|
+
const absPath = isAbsolute(p) ? p : join(rootPath, p);
|
|
116
116
|
try {
|
|
117
117
|
const s = statSync(absPath);
|
|
118
118
|
return { path: absPath, name: basename(p), type: s.isDirectory() ? 'directory' : 'file', size: s.size, mtime: s.mtimeMs };
|