From ce252dc0615f192ed3870f69b19acf7bd2cf7ea1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 18 Oct 2026 08:18:41 +0700 Subject: [PATCH] feat(tools): add projects support to gitea helper CLI --- tools/gitea.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/gitea.ts b/tools/gitea.ts index f97473e..e744894 100644 --- a/tools/gitea.ts +++ b/tools/gitea.ts @@ -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 [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]');