forkfeed-mcp 1.3.2 → 1.3.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 +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,13 +63,14 @@ const manifestSchema = z.object({
|
|
|
63
63
|
feeds: z.array(feedSchema).min(1, 'Manifest must have at least one feed'),
|
|
64
64
|
cards: z.array(cardSchema).min(1, 'Manifest must have at least one card'),
|
|
65
65
|
});
|
|
66
|
-
/** Cross-reference checks that Zod can't express. Returns error string or null.
|
|
67
|
-
|
|
66
|
+
/** Cross-reference checks that Zod can't express. Returns error string or null.
|
|
67
|
+
* knownFeedIds: feed IDs that exist server-side but aren't in this manifest (skip fork ref check for these). */
|
|
68
|
+
function crossValidate(manifest, knownFeedIds) {
|
|
68
69
|
const feedIds = new Set(manifest.feeds.map((f) => f._id));
|
|
69
70
|
const errors = [];
|
|
70
71
|
for (const fork of manifest.forks) {
|
|
71
72
|
for (const fid of fork.feedIds) {
|
|
72
|
-
if (!feedIds.has(fid))
|
|
73
|
+
if (!feedIds.has(fid) && !knownFeedIds?.has(fid))
|
|
73
74
|
errors.push(`Fork "${fork._id}" references feed "${fid}" which is not in feeds array`);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -437,7 +438,7 @@ async function buildManifest(input) {
|
|
|
437
438
|
variants: [coverVariant, ...detailVariants],
|
|
438
439
|
};
|
|
439
440
|
});
|
|
440
|
-
return { forks: [fork], feeds: [feed], cards };
|
|
441
|
+
return { manifest: { forks: [fork], feeds: [feed], cards }, existingFeedIds };
|
|
441
442
|
}
|
|
442
443
|
async function pushManifestToServer(manifest) {
|
|
443
444
|
if (!TOKEN) {
|
|
@@ -652,8 +653,9 @@ server.tool('forkfeed_build', 'Build a forkfeed manifest from simplified content
|
|
|
652
653
|
const shouldPush = push !== false;
|
|
653
654
|
// Build the full manifest from simplified input
|
|
654
655
|
let manifest;
|
|
656
|
+
let existingFeedIds;
|
|
655
657
|
try {
|
|
656
|
-
manifest = await buildManifest(content);
|
|
658
|
+
({ manifest, existingFeedIds } = await buildManifest(content));
|
|
657
659
|
}
|
|
658
660
|
catch (err) {
|
|
659
661
|
return {
|
|
@@ -672,7 +674,7 @@ server.tool('forkfeed_build', 'Build a forkfeed manifest from simplified content
|
|
|
672
674
|
isError: true,
|
|
673
675
|
};
|
|
674
676
|
}
|
|
675
|
-
const crossErr = crossValidate(parsed.data);
|
|
677
|
+
const crossErr = crossValidate(parsed.data, new Set(existingFeedIds));
|
|
676
678
|
if (crossErr) {
|
|
677
679
|
return {
|
|
678
680
|
content: [{ type: 'text', text: `Built manifest cross-reference errors:\n${crossErr}` }],
|