@phren/cli 0.0.14 → 0.0.16
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/mcp/dist/capabilities/cli.js +1 -1
- package/mcp/dist/capabilities/mcp.js +1 -1
- package/mcp/dist/capabilities/vscode.js +1 -1
- package/mcp/dist/capabilities/web-ui.js +1 -1
- package/mcp/dist/cli-graph.js +4 -1
- package/mcp/dist/cli-hooks-context.js +1 -1
- package/mcp/dist/cli-namespaces.js +17 -7
- package/mcp/dist/hooks.js +126 -26
- package/mcp/dist/mcp-data.js +38 -39
- package/mcp/dist/mcp-graph.js +2 -2
- package/mcp/dist/mcp-hooks.js +5 -64
- package/mcp/dist/mcp-skills.js +13 -5
- package/mcp/dist/memory-ui-assets.js +3 -2
- package/mcp/dist/memory-ui-data.js +24 -2
- package/mcp/dist/memory-ui-graph.js +78 -38
- package/mcp/dist/memory-ui-page.js +2 -2
- package/mcp/dist/memory-ui-scripts.js +39 -19
- package/mcp/dist/memory-ui-server.js +117 -5
- package/mcp/dist/phren-paths.js +17 -0
- package/mcp/dist/shared.js +1 -1
- package/mcp/dist/skill-registry.js +25 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import * as path from "path";
|
|
|
3
3
|
import { getProjectDirs } from "./shared.js";
|
|
4
4
|
import { parseSkillFrontmatter } from "./link-skills.js";
|
|
5
5
|
import { isSkillEnabled } from "./skill-state.js";
|
|
6
|
+
import { safeProjectPath } from "./utils.js";
|
|
6
7
|
function normalizeCommand(raw, fallbackName) {
|
|
7
8
|
const value = typeof raw === "string" && raw.trim() ? raw.trim() : `/${fallbackName}`;
|
|
8
9
|
return value.startsWith("/") ? value : `/${value}`;
|
|
@@ -28,13 +29,35 @@ function collectSkills(phrenPath, root, sourceLabel, scopeType, sourceKind, seen
|
|
|
28
29
|
if (!fs.existsSync(root))
|
|
29
30
|
return [];
|
|
30
31
|
const results = [];
|
|
32
|
+
const realRoot = (() => {
|
|
33
|
+
try {
|
|
34
|
+
return fs.realpathSync(root);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return path.resolve(root);
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
31
40
|
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
32
41
|
const isFolder = entry.isDirectory();
|
|
33
|
-
const
|
|
42
|
+
const candidatePath = isFolder
|
|
34
43
|
? path.join(root, entry.name, "SKILL.md")
|
|
35
44
|
: entry.name.endsWith(".md") ? path.join(root, entry.name) : null;
|
|
36
|
-
if (!
|
|
45
|
+
if (!candidatePath)
|
|
46
|
+
continue;
|
|
47
|
+
const safeCandidate = safeProjectPath(root, path.relative(root, candidatePath));
|
|
48
|
+
if (!safeCandidate || seen.has(safeCandidate) || !fs.existsSync(safeCandidate))
|
|
37
49
|
continue;
|
|
50
|
+
try {
|
|
51
|
+
if (fs.lstatSync(safeCandidate).isSymbolicLink())
|
|
52
|
+
continue;
|
|
53
|
+
const realCandidate = fs.realpathSync(safeCandidate);
|
|
54
|
+
if (realCandidate !== realRoot && !realCandidate.startsWith(realRoot + path.sep))
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const filePath = safeCandidate;
|
|
38
61
|
seen.add(filePath);
|
|
39
62
|
const name = isFolder ? entry.name : entry.name.replace(/\.md$/, "");
|
|
40
63
|
const { frontmatter } = parseSkillFrontmatter(fs.readFileSync(filePath, "utf8"));
|