@matelink/cli 2026.4.15 → 2026.4.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/bin/matecli.mjs +97 -1
- package/package.json +1 -1
package/bin/matecli.mjs
CHANGED
|
@@ -663,11 +663,104 @@ function listWorkspaceFiles(workspaceRoot) {
|
|
|
663
663
|
return files;
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
+
const FIXED_MEMORY_FILES = new Set([
|
|
667
|
+
"AGENTS.md",
|
|
668
|
+
"HEARTBEAT.md",
|
|
669
|
+
"IDENTITY.md",
|
|
670
|
+
"MEMORY.md",
|
|
671
|
+
"SOUL.md",
|
|
672
|
+
"TOOLS.md",
|
|
673
|
+
"USER.md",
|
|
674
|
+
]);
|
|
675
|
+
|
|
676
|
+
function normalizeFixedMemoryFileName(rawName) {
|
|
677
|
+
const normalized = String(rawName ?? "").trim().toUpperCase();
|
|
678
|
+
for (const fileName of FIXED_MEMORY_FILES) {
|
|
679
|
+
if (fileName.toUpperCase() === normalized) {
|
|
680
|
+
return fileName;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
throw new Error(`unsupported memory file: ${String(rawName ?? "").trim()}`);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function listFixedMemoryFiles(workspaceRoot) {
|
|
687
|
+
return Array.from(FIXED_MEMORY_FILES)
|
|
688
|
+
.sort((a, b) => a.localeCompare(b))
|
|
689
|
+
.map((name) => {
|
|
690
|
+
const { relativePath, absolutePath } = resolveWorkspaceFilePath(workspaceRoot, name);
|
|
691
|
+
if (!fs.existsSync(absolutePath)) {
|
|
692
|
+
return buildWorkspaceFileMeta({
|
|
693
|
+
workspaceRoot,
|
|
694
|
+
relativePath,
|
|
695
|
+
absolutePath,
|
|
696
|
+
missing: true,
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
return buildWorkspaceFileMeta({
|
|
700
|
+
workspaceRoot,
|
|
701
|
+
relativePath,
|
|
702
|
+
absolutePath,
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
|
|
666
707
|
async function callWorkspaceRpcLocal({
|
|
667
708
|
method,
|
|
668
709
|
params,
|
|
669
710
|
}) {
|
|
670
711
|
const workspaceRoot = resolveConfiguredWorkspaceRoot();
|
|
712
|
+
if (method === "memory.files.list") {
|
|
713
|
+
return {
|
|
714
|
+
ok: true,
|
|
715
|
+
workspace: workspaceRoot,
|
|
716
|
+
files: listFixedMemoryFiles(workspaceRoot),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (method === "memory.files.get") {
|
|
721
|
+
const fixedName = normalizeFixedMemoryFileName(params?.name);
|
|
722
|
+
const { relativePath, absolutePath } = resolveWorkspaceFilePath(workspaceRoot, fixedName);
|
|
723
|
+
if (!fs.existsSync(absolutePath)) {
|
|
724
|
+
return {
|
|
725
|
+
ok: true,
|
|
726
|
+
workspace: workspaceRoot,
|
|
727
|
+
file: buildWorkspaceFileMeta({
|
|
728
|
+
workspaceRoot,
|
|
729
|
+
relativePath,
|
|
730
|
+
absolutePath,
|
|
731
|
+
missing: true,
|
|
732
|
+
}),
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
return {
|
|
736
|
+
ok: true,
|
|
737
|
+
workspace: workspaceRoot,
|
|
738
|
+
file: buildWorkspaceFileMeta({
|
|
739
|
+
workspaceRoot,
|
|
740
|
+
relativePath,
|
|
741
|
+
absolutePath,
|
|
742
|
+
includeContent: true,
|
|
743
|
+
}),
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
if (method === "memory.files.set") {
|
|
748
|
+
const fixedName = normalizeFixedMemoryFileName(params?.name);
|
|
749
|
+
const { relativePath, absolutePath } = resolveWorkspaceFilePath(workspaceRoot, fixedName);
|
|
750
|
+
fs.mkdirSync(path.dirname(absolutePath), { recursive: true });
|
|
751
|
+
fs.writeFileSync(absolutePath, String(params?.content ?? ""), "utf8");
|
|
752
|
+
return {
|
|
753
|
+
ok: true,
|
|
754
|
+
workspace: workspaceRoot,
|
|
755
|
+
file: buildWorkspaceFileMeta({
|
|
756
|
+
workspaceRoot,
|
|
757
|
+
relativePath,
|
|
758
|
+
absolutePath,
|
|
759
|
+
includeContent: true,
|
|
760
|
+
}),
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
|
|
671
764
|
if (method === "agents.files.list") {
|
|
672
765
|
return {
|
|
673
766
|
ok: true,
|
|
@@ -2944,13 +3037,16 @@ async function callGatewayRpcLocal({
|
|
|
2944
3037
|
return {
|
|
2945
3038
|
ok: true,
|
|
2946
3039
|
methods: ["sessions.list", "sessions.abort", "sessions.delete", "sessions.usage", "sessions.patch",
|
|
2947
|
-
"usage.cost", "agents.files.list", "agents.files.get", "agents.files.set",
|
|
3040
|
+
"usage.cost", "memory.files.list", "memory.files.get", "memory.files.set", "agents.files.list", "agents.files.get", "agents.files.set",
|
|
2948
3041
|
"skills.status", "models.list", "chat.history", "chat.abort",
|
|
2949
3042
|
"config.get", "config.patch"],
|
|
2950
3043
|
};
|
|
2951
3044
|
}
|
|
2952
3045
|
|
|
2953
3046
|
if (
|
|
3047
|
+
method === "memory.files.list" ||
|
|
3048
|
+
method === "memory.files.get" ||
|
|
3049
|
+
method === "memory.files.set" ||
|
|
2954
3050
|
method === "agents.files.list" ||
|
|
2955
3051
|
method === "agents.files.get" ||
|
|
2956
3052
|
method === "agents.files.set"
|