aa3cccead5
Implements Phase 1 of v0.1 Foundation:
- go.mod with Go 1.25
- cmd/orca/main.go entry point
- internal/cli/root.go with global --json flag
- internal/cli/version.go (orca version)
- internal/cli/init.go (orca init - creates ~/.orca/)
- internal/cli/status.go (orca status - shows daemon info)
- internal/cli/node.go (orca node {join,leave,list} - stubs)
- internal/cli/job.go (orca job {run,list,stop,logs} - stubs)
- Makefile (build, test, lint, fmt, release)
- LICENSE (MIT)
- README.md with quickstart
- .gitignore
- .githooks/pre-push + scripts/trigger_coreci.sh (CoreCI trigger)
- Smoke tests in internal/cli/root_test.go
Verified: go build, go test, go vet, gofmt all pass.
---ci---
project: orca
phase: 1
milestone: v0.1
status: execute
req_covered:
- REQ-001
- REQ-002
- REQ-013
- REQ-015
- REQ-016
- REQ-019
- REQ-024
---/ci---
53 lines
1019 B
Go
53 lines
1019 B
Go
package cli
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
version = "0.1.0-dev"
|
|
gitCommit = "unknown"
|
|
buildTime = "unknown"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "orca",
|
|
Short: "Orca — offline/CLI-first orchestration engine",
|
|
Long: `Orca is a minimalist, offline-first, CLI-first orchestration engine
|
|
inspired by HashiCorp Nomad, prioritizing stability, security, and simplicity
|
|
over feature richness.`,
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
}
|
|
|
|
var jsonOutput bool
|
|
|
|
func init() {
|
|
rootCmd.PersistentFlags().BoolVar(&jsonOutput, "json", false, "output in JSON format")
|
|
}
|
|
|
|
func Execute() error {
|
|
return rootCmd.Execute()
|
|
}
|
|
|
|
func printJSON(v any) error {
|
|
enc := json.NewEncoder(rootCmd.OutOrStdout())
|
|
enc.SetIndent("", " ")
|
|
return enc.Encode(v)
|
|
}
|
|
|
|
func printText(format string, args ...any) {
|
|
fmt.Fprintf(rootCmd.OutOrStdout(), format, args...)
|
|
}
|
|
|
|
func printResult(text string, jsonObj any) {
|
|
if jsonOutput {
|
|
_ = printJSON(jsonObj)
|
|
return
|
|
}
|
|
printText("%s\n", text)
|
|
}
|