feat: add ax serve command with JSON API backed by NodeService

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 13:04:29 +02:00
parent 9e5194893e
commit 3dfc46c3ff
5 changed files with 256 additions and 2 deletions

View File

@@ -11,8 +11,9 @@ import (
type fileConfig struct {
path string
User string `json:"user"`
UserAliases []*Alias `json:"aliases"`
User string `json:"user"`
UserAliases []*Alias `json:"aliases"`
Serve ServerConfig `json:"serve"`
}
var defaultAliases = []*Alias{
@@ -140,6 +141,18 @@ func (c *fileConfig) ListAliases() ([]*Alias, error) {
return result, nil
}
func (c *fileConfig) GetServerConfig() ServerConfig {
host := c.Serve.Host
if host == "" {
host = "localhost"
}
port := c.Serve.Port
if port == 0 {
port = 7000
}
return ServerConfig{Host: host, Port: port}
}
func (c *fileConfig) Save() error {
if err := os.MkdirAll(filepath.Dir(c.path), 0755); err != nil {
return err