import { MCPResource } from './index.js';
import { ChangerawrClient } from '../client/changerawr-client.js';
export const changelogResource: MCPResource = {
uri: 'changerawr://projects/{projectId}/changelog',
name: 'Project Changelog',
description: 'Changelog entries for a specific project',
mimeType: 'application/json',
async read(uri: string, client: ChangerawrClient) {
// Extract projectId from URI
const match = uri.match(/changerawr:\/\/projects\/([^\/]+)\/changelog/);
if (!match || !match[1]) {
throw new Error('Invalid changelog resource URI');
}
const projectId = match[1]!;
const result = await client.listChangelogEntries(projectId);
return {
projectId,
entries: result.entries,
count: result.entries.length,
nextCursor: result.nextCursor,
timestamp: new Date().toISOString(),
};
},
};