go-devops/cmd/dev/service.go
Snider ecb50796b7 refactor: migrate core import to dappco.re/go/core
Replace forge.lthn.ai/core/go/pkg/core with dappco.re/go/core v0.4.7.
Adapt to new API: core.New() returns *Core directly, services registered
via c.Service(), Result replaces (any, bool, error) IPC pattern.
Simplify git/agentic integration by calling package-level functions
directly instead of routing through IPC service handlers.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 12:24:45 +00:00

42 lines
911 B
Go

package dev
import (
"context"
"os"
"os/exec"
"dappco.re/go/core"
agentic "forge.lthn.ai/core/agent/pkg/lifecycle"
)
// ServiceOptions for configuring the dev service.
type ServiceOptions struct {
RegistryPath string
}
// Service provides dev workflow orchestration as a Core service.
type Service struct {
*core.ServiceRuntime[ServiceOptions]
}
func (s *Service) handleTask(_ *core.Core, _ core.Task) core.Result {
return core.Result{}
}
// doCommit shells out to claude for AI-assisted commit.
func doCommit(ctx context.Context, repoPath string, allowEdit bool) error {
prompt := agentic.Prompt("commit")
tools := "Bash,Read,Glob,Grep"
if allowEdit {
tools = "Bash,Read,Write,Edit,Glob,Grep"
}
cmd := exec.CommandContext(ctx, "claude", "-p", prompt, "--allowedTools", tools)
cmd.Dir = repoPath
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
return cmd.Run()
}