Implements deterministic feature lifecycle management for agent-driven
development. Agents use the CLI in pods; operators control via REST API.
Library (internal/sdlc/):
- Feature lifecycle with 10 phases (draft → released)
- Classifier engine with priority-ordered rules
- Artifact tracking with approval workflow
- Task management within features
- YAML-based state persistence
CLI (cmd/sdlc/):
- init, state, next, feature, artifact, task, query commands
- --json flag for machine-readable output
- Runs inside project pods
API (21 endpoints under /projects/{id}/sdlc/):
- State: GET /state, GET /next
- Features: CRUD + transition/block/unblock
- Artifacts: approve/reject per type
- Tasks: add/start/complete/block
- Queries: blocked/ready/needs-approval
Architecture:
- Port: SDLCExecutor interface (internal/port/)
- Adapter: kubectl exec into pods (internal/adapter/kubernetes/)
- Service: pod resolution + logging (internal/service/)
- Handlers: 5 files under 500-line limit (internal/handlers/)
Also includes template upgrades (chassis framework, UI components,
OpenAPI helpers, backend/frontend guides) and component improvements.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package sdlc
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// Init creates the .sdlc/ directory structure and default files.
|
|
func Init(root, projectName string) error {
|
|
sdlcRoot := SDLCRoot(root)
|
|
|
|
// Check if already initialized
|
|
if _, err := os.Stat(sdlcRoot); err == nil {
|
|
return fmt.Errorf("already initialized: %s exists", sdlcRoot)
|
|
}
|
|
|
|
// Create .sdlc/ and all subdirectories
|
|
for _, dir := range SubDirs() {
|
|
dirPath := filepath.Join(sdlcRoot, dir)
|
|
if err := os.MkdirAll(dirPath, 0o755); err != nil {
|
|
return fmt.Errorf("create directory %s: %w", dir, err)
|
|
}
|
|
}
|
|
|
|
// Write default state
|
|
state := DefaultState(projectName)
|
|
if err := state.Save(root); err != nil {
|
|
return fmt.Errorf("write default state: %w", err)
|
|
}
|
|
|
|
// Write default config
|
|
config := DefaultConfig(projectName)
|
|
if err := config.Save(root); err != nil {
|
|
return fmt.Errorf("write default config: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// IsInitialized returns true if the .sdlc/ directory exists.
|
|
func IsInitialized(root string) bool {
|
|
info, err := os.Stat(SDLCRoot(root))
|
|
return err == nil && info.IsDir()
|
|
}
|