fix: create_project_from_template hardcoded to template-go-web #24

Closed
opened 2026-05-15 15:25:52 +00:00 by mathias · 0 comments
Owner

Problem

create_project_from_template is hardcoded to use template-go-web as the template source in cmd/gitea-mcp/main.go:

tools.NewCreateProjectFromTemplate(giteaClient, ownerAllow, "mathias", "template-go-web")

The constructor already accepts tmplOwner and tmplName as parameters — good design — but the template choice is baked into the binary at startup. There is no way to create an agent project (template-go-agent) without modifying the code.

Required for

hyperguild new-project needs to select template at call time:

  • go-webtemplate-go-web
  • go-agenttemplate-go-agent
  • Future: go-ml, go-service, etc.

Fix

Add a template_name parameter to the tool's input schema:

// InputSchema addition
"template_name": {
    "type": "string",
    "enum": ["template-go-web", "template-go-agent"],
    "description": "Template repo name to generate from. Defaults to template-go-web.",
    "default": "template-go-web"
}

The tool resolves the template owner from config (stays mathias), but template name comes from the call argument. Default to template-go-web for backwards compatibility.

Alternatively: make template_owner and template_name both configurable via env vars (TEMPLATE_OWNER, TEMPLATE_NAME) with the current hardcoded values as defaults, and the tool input schema overrides at call time.

Recommended: input schema approach — more flexible, no restart needed to switch templates.

Acceptance criteria

  • create_project_from_template accepts optional template_name param
  • Defaults to template-go-web if not specified (backwards compatible)
  • template-go-agent works when specified (requires that repo to have content first — see local-dev #5)
  • main.go no longer hardcodes template name
  • Existing tests pass; new test covers template_name=template-go-agent
  • local-dev #5: add go-agent stack to new-project.sh (template-go-agent must be populated first)
  • hyperguild #10: project-webhook composite tool (calls this tool)
## Problem `create_project_from_template` is hardcoded to use `template-go-web` as the template source in `cmd/gitea-mcp/main.go`: ```go tools.NewCreateProjectFromTemplate(giteaClient, ownerAllow, "mathias", "template-go-web") ``` The constructor already accepts `tmplOwner` and `tmplName` as parameters — good design — but the template choice is baked into the binary at startup. There is no way to create an agent project (`template-go-agent`) without modifying the code. ## Required for `hyperguild new-project` needs to select template at call time: - `go-web` → `template-go-web` - `go-agent` → `template-go-agent` - Future: `go-ml`, `go-service`, etc. ## Fix Add a `template_name` parameter to the tool's input schema: ```go // InputSchema addition "template_name": { "type": "string", "enum": ["template-go-web", "template-go-agent"], "description": "Template repo name to generate from. Defaults to template-go-web.", "default": "template-go-web" } ``` The tool resolves the template owner from config (stays `mathias`), but template name comes from the call argument. Default to `template-go-web` for backwards compatibility. Alternatively: make `template_owner` and `template_name` both configurable via env vars (`TEMPLATE_OWNER`, `TEMPLATE_NAME`) with the current hardcoded values as defaults, and the tool input schema overrides at call time. **Recommended: input schema approach** — more flexible, no restart needed to switch templates. ## Acceptance criteria - [ ] `create_project_from_template` accepts optional `template_name` param - [ ] Defaults to `template-go-web` if not specified (backwards compatible) - [ ] `template-go-agent` works when specified (requires that repo to have content first — see local-dev #5) - [ ] `main.go` no longer hardcodes template name - [ ] Existing tests pass; new test covers `template_name=template-go-agent` ## Related - local-dev #5: add go-agent stack to new-project.sh (template-go-agent must be populated first) - hyperguild #10: project-webhook composite tool (calls this tool)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#24