Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8847239637 | |||
| 3cece0a975 | |||
| 15e849f4c5 | |||
| 332195e774 | |||
| 43ac2918dd |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mokoconsulting/mcp-mokogitea-api",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "MCP server for Gitea REST API v1 operations",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
+49
-5
@@ -897,22 +897,57 @@ server.tool(
|
||||
|
||||
server.tool(
|
||||
'gitea_bulk_file_push',
|
||||
'Push the same file content to multiple repos (uses Contents API)',
|
||||
'Push the same file content to multiple repos (uses Contents API). Provide repos list OR platform to auto-discover repos by metadata platform.',
|
||||
{
|
||||
owner: z.string().describe('Organization name'),
|
||||
repos: z.array(z.string()).describe('List of repository names'),
|
||||
repos: z.array(z.string()).optional().describe('List of repository names (omit to use platform filter)'),
|
||||
platform: z.string().optional().describe('Auto-discover repos by metadata platform (e.g. joomla, go, mcp). Ignored if repos is provided.'),
|
||||
path: z.string().describe('File path in each repo (e.g. .mokogitea/workflows/pre-release.yml)'),
|
||||
content_base64: z.string().describe('Base64-encoded file content'),
|
||||
message: z.string().describe('Commit message'),
|
||||
branch: z.string().optional().describe('Target branch (default: main)'),
|
||||
...ConnectionParam,
|
||||
},
|
||||
async ({ owner, repos, path, content_base64, message, branch, connection }) => {
|
||||
async ({ owner, repos, platform, path, content_base64, message, branch, connection }) => {
|
||||
const client = clientFor(connection);
|
||||
const targetBranch = branch ?? 'main';
|
||||
const results: Array<{ repo: string; status: string }> = [];
|
||||
|
||||
for (const repo of repos) {
|
||||
// Resolve repo list: explicit repos or auto-discover by platform
|
||||
let targetRepos: string[];
|
||||
if (repos && repos.length > 0) {
|
||||
targetRepos = repos;
|
||||
} else if (platform) {
|
||||
// List all org repos, then filter by metadata platform
|
||||
const allRepos: string[] = [];
|
||||
let page = 1;
|
||||
while (true) {
|
||||
const res = await client.get(`/orgs/${owner}/repos`, { page: String(page), limit: '50' });
|
||||
const data = res.data as Array<{ name: string }>;
|
||||
if (!data || data.length === 0) break;
|
||||
allRepos.push(...data.map(r => r.name));
|
||||
if (data.length < 50) break;
|
||||
page++;
|
||||
}
|
||||
// Check metadata for each repo
|
||||
const matched: string[] = [];
|
||||
for (const repo of allRepos) {
|
||||
try {
|
||||
const meta = await client.get(`/repos/${owner}/${repo}/metadata`);
|
||||
const p = (meta.data as { platform?: string })?.platform;
|
||||
if (p === platform) matched.push(repo);
|
||||
} catch { /* skip repos without metadata */ }
|
||||
}
|
||||
targetRepos = matched;
|
||||
if (targetRepos.length === 0) {
|
||||
return { content: [{ type: 'text' as const, text: `No repos found with platform "${platform}" in ${owner}` }] };
|
||||
}
|
||||
results.push({ repo: '(discovery)', status: `found ${targetRepos.length} repos: ${targetRepos.join(', ')}` });
|
||||
} else {
|
||||
return { content: [{ type: 'text' as const, text: 'Error: provide either repos list or platform filter' }] };
|
||||
}
|
||||
|
||||
for (const repo of targetRepos) {
|
||||
try {
|
||||
// Get current file SHA
|
||||
const existing = await client.get(`/repos/${owner}/${repo}/contents/${path}?ref=${targetBranch}`);
|
||||
@@ -1720,13 +1755,22 @@ server.tool(
|
||||
repo: z.string().describe('Repository name'),
|
||||
name: z.string().optional().describe('Project name'),
|
||||
org: z.string().optional().describe('Organization'),
|
||||
description: z.string().optional().describe('Project description'),
|
||||
version: z.string().optional().describe('Version string (e.g. 06.00.00)'),
|
||||
version_prefix: z.string().optional().describe('Tag prefix for version display (e.g. v1.26.1-moko.)'),
|
||||
license_spdx: z.string().optional().describe('SPDX license identifier'),
|
||||
license_name: z.string().optional().describe('Human-readable license name (e.g. GNU General Public License v3)'),
|
||||
element_name: z.string().optional().describe('Extension element name (e.g. pkg_mokosuitecrm, mod_mokojoomhero)'),
|
||||
platform: z.string().optional().describe('Platform (joomla, wordpress, dolibarr, go, mcp, platform, generic)'),
|
||||
standards_version: z.string().optional().describe('mokoplatform standards version (e.g. 05.01.00)'),
|
||||
standards_source: z.string().optional().describe('URL to standards repo'),
|
||||
display_name: z.string().optional().describe('Human-readable display name (e.g. Package - MokoSuite CRM)'),
|
||||
maintainer: z.string().optional().describe('Maintainer name (e.g. Moko Consulting)'),
|
||||
maintainer_url: z.string().optional().describe('Maintainer website URL'),
|
||||
info_url: z.string().optional().describe('Extension info/product page URL'),
|
||||
target_version: z.string().optional().describe('Target platform version regex (e.g. (5|6)\\.*)'),
|
||||
target_version: z.string().optional().describe('Target platform version regex (e.g. 6..*)'),
|
||||
php_minimum: z.string().optional().describe('Minimum PHP version (e.g. 8.1)'),
|
||||
language: z.string().optional().describe('Primary language (e.g. PHP, Go, TypeScript)'),
|
||||
package_type: z.string().optional().describe('Extension type (component, module, plugin, package, template, library, file)'),
|
||||
entry_point: z.string().optional().describe('Build entry point path'),
|
||||
...ConnectionParam,
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"exclude": ["node_modules", "dist", "src/server.ts", "src/sse.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user