Feature 57 (config and provisioning): release the catalogue, the reviewed release branch merged with main, on top of main
This commit is contained in:
@@ -19,11 +19,12 @@ const agentAccountFile = "/etc/claude-code/agent-account"
|
||||
|
||||
type manifestShell struct {
|
||||
Resources []map[string]any `json:"resources"`
|
||||
Shell []struct {
|
||||
For string `json:"for"`
|
||||
Slot string `json:"slot"`
|
||||
Code string `json:"code"`
|
||||
} `json:"shell"`
|
||||
// The zsh code is an item of the collection shell:zsh:<slot> (novox/hq ADR 0349 clause 13), its text the
|
||||
// template file beside the manifest.
|
||||
Items []struct {
|
||||
Collection string `json:"collection"`
|
||||
Template string `json:"template"`
|
||||
} `json:"items"`
|
||||
}
|
||||
|
||||
func readManifestShell(t *testing.T) manifestShell {
|
||||
@@ -54,9 +55,13 @@ func resourceByID(t *testing.T, m manifestShell, id string) map[string]any {
|
||||
func zshCode(t *testing.T, m manifestShell) string {
|
||||
t.Helper()
|
||||
var code []string
|
||||
for _, s := range m.Shell {
|
||||
if s.For == "zsh" {
|
||||
code = append(code, s.Code)
|
||||
for _, it := range m.Items {
|
||||
if strings.HasPrefix(it.Collection, "shell:zsh:") {
|
||||
text, err := os.ReadFile(filepath.Join("..", "..", it.Template))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
code = append(code, string(text))
|
||||
}
|
||||
}
|
||||
if len(code) != 1 {
|
||||
@@ -71,8 +76,8 @@ func TestTheAccountAgentsRunAsIsWrittenForTheShell(t *testing.T) {
|
||||
if r["type"] != "file" || r["path"] != agentAccountFile || r["mode"] != "0644" {
|
||||
t.Fatalf("the account's file is %v", r)
|
||||
}
|
||||
if r["content"] != "${machine:agent-account}\n" {
|
||||
t.Fatalf("the account's file holds %q", r["content"])
|
||||
if text := templateText(t, r); text != "${machine:agent-account}\n" {
|
||||
t.Fatalf("the account's file holds %q", text)
|
||||
}
|
||||
if _, has := r["owner"]; has {
|
||||
t.Fatal("the account's file must be root's, as claude-agent is")
|
||||
@@ -163,7 +168,7 @@ func TestClaudeAgentRunsTheRealClaudeUnderTheAlias(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
start, _ := resourceByID(t, readManifestShell(t), "start")["content"].(string)
|
||||
start := templateText(t, resourceByID(t, readManifestShell(t), "start"))
|
||||
if !strings.Contains(start, "exec claude \"$@\"") {
|
||||
t.Fatalf("claude-agent no longer runs claude itself:\n%s", start)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user