feat(tools): add projects support to gitea helper CLI

This commit is contained in:
Your Name committed 2026-10-18 08:18:41 +07:00
1 parent 8a8438096c
commit ce252dc061
1 file changed
+29
+29
View File
@@ -149,11 +149,40 @@ async function main() {
break;
}
case 'projects': {
const sub = args[0] || 'list';
if (sub === 'list') {
const projects = await api(`/repos/${OWNER}/${REPO}/projects`);
if (projects.length === 0) {
console.log('No projects found.');
} else {
console.log(`Found ${projects.length} projects:`);
for (const p of projects) {
console.log(` #${p.id} ${p.title}`);
}
}
} else if (sub === 'create') {
const title = args[1];
const description = args.slice(2).join(' ') || '';
if (!title) {
console.error('Usage: bun tools/gitea.ts projects create <title> [description]');
process.exit(1);
}
const project = await api(`/repos/${OWNER}/${REPO}/projects`, {
method: 'POST',
body: JSON.stringify({ title, description }),
});
console.log(`Created Project #${project.id}: ${project.title}`);
}
break;
}
default: {
console.log(`Gitea Helper CLI for ${OWNER}/${REPO}`);
console.log('Available commands:');
console.log(' bun tools/gitea.ts whoami');
console.log(' bun tools/gitea.ts repo');
console.log(' bun tools/gitea.ts projects [list|create]');
console.log(' bun tools/gitea.ts issues [list|create]');
console.log(' bun tools/gitea.ts prs [list|create]');
console.log(' bun tools/gitea.ts releases [list|create]');