2026-03-29 21:27:32 +00:00
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
|
|
|
|
|
package runner
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
core "dappco.re/go/core"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func ExampleCoreRoot() {
|
|
|
|
|
root := CoreRoot()
|
|
|
|
|
core.Println(core.HasSuffix(root, ".core"))
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleWorkspaceRoot() {
|
|
|
|
|
root := WorkspaceRoot()
|
|
|
|
|
core.Println(core.HasSuffix(root, "workspace"))
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 16:24:06 +00:00
|
|
|
func ExampleReadStatusResult() {
|
|
|
|
|
fsys := (&core.Fs{}).NewUnrestricted()
|
|
|
|
|
dir := fsys.TempDir("runner-paths-result")
|
|
|
|
|
defer fsys.DeleteAll(dir)
|
|
|
|
|
|
|
|
|
|
WriteStatus(dir, &WorkspaceStatus{
|
|
|
|
|
Status: "completed",
|
|
|
|
|
Agent: "codex",
|
|
|
|
|
Repo: "go-io",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
result := ReadStatusResult(dir)
|
|
|
|
|
core.Println(result.OK)
|
|
|
|
|
core.Println(result.Value.(*WorkspaceStatus).Repo)
|
|
|
|
|
// Output:
|
|
|
|
|
// true
|
|
|
|
|
// go-io
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:27:32 +00:00
|
|
|
func ExampleWriteStatus() {
|
|
|
|
|
fsys := (&core.Fs{}).NewUnrestricted()
|
|
|
|
|
dir := fsys.TempDir("runner-paths")
|
|
|
|
|
defer fsys.DeleteAll(dir)
|
|
|
|
|
|
2026-03-30 16:33:14 +00:00
|
|
|
result := WriteStatus(dir, &WorkspaceStatus{
|
2026-03-29 21:27:32 +00:00
|
|
|
Status: "running",
|
|
|
|
|
Agent: "codex",
|
|
|
|
|
Repo: "go-io",
|
|
|
|
|
})
|
2026-03-30 16:33:14 +00:00
|
|
|
core.Println(result.OK)
|
2026-03-29 21:27:32 +00:00
|
|
|
|
2026-03-30 20:20:50 +00:00
|
|
|
statusResult := ReadStatusResult(dir)
|
|
|
|
|
core.Println(statusResult.OK)
|
|
|
|
|
core.Println(statusResult.Value.(*WorkspaceStatus).Status)
|
2026-03-29 21:27:32 +00:00
|
|
|
// Output:
|
|
|
|
|
// true
|
2026-03-30 16:33:14 +00:00
|
|
|
// true
|
2026-03-29 21:27:32 +00:00
|
|
|
// running
|
|
|
|
|
}
|