agent/pkg/agentic/commands_core_test.go
Snider 820d33ebec feat(agent/agentic): scaffold core pipeline command tree per RFC-AGENT-PIPELINE.md
Codex preflight found docs/RFC-AGENT-PIPELINE.md (not the speculative
RFC.pipeline.md the ticket title referenced). Implementation matches
the actual RFC tree:

- core (top-level)
- core pipeline (router)
- core pipeline epic / fix / budget / training (grouped routers)
- All RFC leaf commands under each grouped router

Routers print scoped help. Each leaf currently returns "not yet
implemented" with a concrete next doc/flow reference (e.g. docs/flow/
RFC.flow-audit-issues.md). Future tickets wire the leaves to real
handlers.

Tests cover registration, descriptions, --help routing through
core pipeline audit.

Note: docs/RFC.pipeline.md alias still missing — TODO note in
commands_core.go for that follow-up.

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=228
2026-04-25 20:24:21 +01:00

70 lines
1.8 KiB
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic
import (
"testing"
core "dappco.re/go/core"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCommandsCore_RegisterCoreCommands_Good(t *testing.T) {
s, c := testPrepWithCore(t, nil)
s.registerCoreCommands()
for _, spec := range coreCommandSpecs {
assert.Contains(t, c.Commands(), spec.Path)
result := c.Command(spec.Path)
require.True(t, result.OK, spec.Path)
command, ok := result.Value.(*core.Command)
require.True(t, ok, spec.Path)
assert.Equal(t, spec.Description, command.Description)
assert.NotEmpty(t, command.Description)
}
}
func TestCommandsCore_CliHelp_Good_ListsAllSubcommands(t *testing.T) {
s, c := testPrepWithCore(t, nil)
s.registerCoreCommands()
var result core.Result
output := captureStdout(t, func() {
result = c.Cli().Run("core", "--help")
})
require.True(t, result.OK)
assert.Contains(t, output, "usage: core [pipeline] [--help]")
for _, spec := range coreCommandSpecs {
if spec.Path == "core" {
continue
}
assert.Contains(t, output, spec.Usage)
}
}
func TestCommandsCore_CliRoute_Bad_AuditPlaceholder(t *testing.T) {
s, c := testPrepWithCore(t, nil)
s.registerCoreCommands()
var result core.Result
output := captureStdout(t, func() {
result = c.Cli().Run("core", "pipeline", "audit", "go-io")
})
assert.False(t, result.OK)
err, ok := result.Value.(error)
require.True(t, ok)
assert.Contains(t, err.Error(), "core pipeline audit is not yet implemented")
assert.Contains(t, output, "usage: core pipeline audit <repo> [--help]")
assert.Contains(t, output, "about: Stage 1: audit issues into implementation work")
assert.Contains(t, output, "status: not yet implemented")
assert.Contains(t, output, "docs/flow/RFC.flow-audit-issues.md")
}