init: ops-assistant codebase

This commit is contained in:
OpenClaw Agent
2026-03-19 21:23:28 +08:00
commit 81deba4766
94 changed files with 10767 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package ops
import (
"path/filepath"
"ops-assistant/internal/core/runbook"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
// RunOnce executes a runbook directly without bot/channel.
func RunOnce(dbPath, baseDir, commandText, runbookName string, operator int64, inputs map[string]string) (uint, string, error) {
db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
if err != nil {
return 0, "", err
}
exec := runbook.NewExecutor(db, filepath.Join(baseDir, "runbooks"))
return exec.RunWithInputsAndMeta(commandText, runbookName, operator, inputs, runbook.NewMeta())
}