rdev/slack-preparation-thoughts-2.md
jordan d69da6d627 feat: add structured logging infrastructure and SDLC extensions
Major changes:
- Add internal/logging package with field constants, context propagation,
  sensitive data auto-redaction, and per-component log levels
- Add worker timeout constants (TimeoutQuickOp, TimeoutHealthCheck, etc.)
- Extend SDLC with callback handlers, generate endpoints, and executor
- Add new cookbook trees for aeries and slackpath progression
- Add skeleton templates for queue, realtime, and microservices
- Add worker component template with async job processing
- Refactor services and handlers to use new logging infrastructure
- Split component.go into component_infra.go and component_listing.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:56:04 -07:00

76 lines
3.3 KiB
Markdown

# Slack Preparation Phase 2 (Execution Plan)
> Based on `slack-preparation-thoughts.md`, this plan details the specific files and commands needed to enable `slackpath-1` (Identity) and `slackpath-2` (Async Workers).
## 1. Missing Templates (Priority: High)
We must implement these templates in `internal/adapter/templates/templates/` so the Tree Runner can execute `add-worker`, `add-db`, and `add-redis`.
### `worker` Template
* **Location:** `internal/adapter/templates/templates/worker`
* **Structure:** Go service similar to `go-api` but optimized for long-running tasks.
* **Key File:** `cmd/worker/main.go` (starts a queue consumer instead of an HTTP server).
* **Dockerfile:** Standard Go build.
* **Helm Chart:** Deployment (not Service/Ingress).
### `postgres` Template
* **Location:** `internal/adapter/templates/templates/postgres`
* **Nature:** Infrastructure Wrapper.
* **Helm Chart:** Dependencies on `bitnami/postgresql` or a custom StatefulSet.
* **Outputs:** Connection string secret.
### `redis` Template
* **Location:** `internal/adapter/templates/templates/redis`
* **Nature:** Infrastructure Wrapper.
* **Helm Chart:** Dependencies on `bitnami/redis`.
* **Outputs:** Host/Port secrets.
## 2. Missing Shared Packages (Priority: Critical)
The agent needs standard libraries to avoid writing insecure auth or buggy queues from scratch. These go in `pkg/` at the root of the project templates (or the `skeleton`).
### `pkg/auth` (for Path 1)
* **JWT Handling:** `Sign(claims) string`, `Parse(token) (*Claims, error)`.
* **Middleware:** `func RequireAuth(next http.Handler) http.Handler`.
* **Context:** `func GetUser(ctx) User`.
### `pkg/queue` (for Path 2)
* **Interface:**
```go
type JobQueue interface {
Enqueue(ctx context.Context, topic string, payload any) error
Process(ctx context.Context, topic string, handler func(payload []byte) error)
}
```
* **Implementation:** Redis-based (using `go-redis/v9`).
## 3. SDLC Commands (Priority: Critical)
The cookbooks use commands that don't exist. We must create the prompt definitions.
### `.claude/commands/spec-feature.md`
* **Goal:** Generate `spec.md`.
* **Instructions:** "You are a Technical PM. Analyze the feature slug. Write a requirements doc."
### `.claude/commands/design-feature.md`
* **Goal:** Generate `design.md`.
* **Instructions:** "You are a System Architect. Analyze `spec.md`. Define DB Schema, API Contracts, and Package structure."
### `.claude/commands/implement-feature.md`
* **Goal:** Write Code.
* **Instructions:** "You are a Senior Go Developer. Read `design.md`. Implement the changes. Run tests."
## 4. API Verification (Priority: Medium)
We need to ensure `rdev-api` actually handles the `POST /projects/{id}/builds` endpoint with the `prompt` payload correctly (routing it to the Claude Code agent).
* **Check:** `cmd/rdev-api/internal/service/build_service.go` (or similar).
* **Verify:** Does it invoke the `claude` CLI inside the project pod?
## Execution Order
1. **Templates:** Create `worker`, `postgres`, `redis` folders.
2. **Packages:** Write `pkg/auth` and `pkg/queue` code to be included in the `skeleton` template.
3. **Commands:** Create the 3 markdown files in `.claude/commands/`.
4. **Test:** Run `slackpath-1`.