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>
68 lines
3.9 KiB
Markdown
68 lines
3.9 KiB
Markdown
# Slack Preparation Analysis
|
|
|
|
To successfully build a Slack-like distributed system using the `rdev` agentic workflow, we must bridge the gap between our current capabilities and the requirements of the `slackpath-*` cookbooks.
|
|
|
|
## 1. Success Enablers (What we have)
|
|
|
|
* **`pkg/api` Chassis**: A solid Go service foundation (`App` struct) that handles routing, logging (`slog`), middleware, and graceful shutdown. This allows us to spin up consistent APIs quickly.
|
|
* **`go-api` Template**: A standardized backend service template in `internal/adapter/templates/templates/go-api` that likely uses the chassis.
|
|
* **`skeleton` Template**: A monorepo base to hold multiple services.
|
|
* **Tree Runner**: A robust orchestration engine (`tree-runner.sh`) that can execute complex workflows, manage state, and verify deployments.
|
|
* **Infrastructure**: We seem to have K8s/Woodpecker integration via `deploy-k8s` skill.
|
|
|
|
## 2. Functionality Gaps (What is missing)
|
|
|
|
### Critical Infrastructure
|
|
* **Missing Component Types**: The cookbooks assume `type: worker`, `type: postgres`, and `type: redis`. Currently, `internal/adapter/templates/templates` only shows `go-api`, `astro-landing`, and `skeleton`.
|
|
* *Risk:* `add-db` and `add-worker` steps will fail in the runner.
|
|
* **Missing Shared Packages**:
|
|
* `pkg/auth`: No standard JWT verification middleware. Agent will have to write security code from scratch (high risk).
|
|
* `pkg/redis` or `pkg/queue`: No standard wrapper for Redis interactions or job queues.
|
|
* `pkg/websocket`: No standard WS upgrader/handler.
|
|
|
|
### SDLC Automation
|
|
* **Missing SDLC Commands**: The cookbooks rely on `/spec-feature`, `/design-feature`, and `/implement-feature`. These do **not** exist in `.claude/commands/`.
|
|
* **Missing API Logic**: The `rdev-api` endpoints for SDLC (`/sdlc/features`, `/builds`) need to be verified to ensure they support the "Prompt-to-Code" flow described in the cookbooks.
|
|
|
|
## 3. Required Claude Configuration
|
|
|
|
We need to create/update these to enable the agentic workflow:
|
|
|
|
* **`.claude/commands/implement-feature.md`**: Instructions for the agent on how to take a requirement and produce code.
|
|
* **`.claude/commands/spec-feature.md`**: Instructions for generating a technical spec artifact.
|
|
* **`.claude/commands/design-feature.md`**: Instructions for generating a DB schema/API design artifact.
|
|
* **`.claude/skills/distributed-systems.md`**: A skill that teaches the agent about our specific patterns for Worker/API communication (e.g., "Always use `pkg/queue` for async tasks").
|
|
|
|
## 4. Required SDLC Commands (in `rdev-api`)
|
|
|
|
The `rdev-api` needs to handle these operations (referenced in cookbooks):
|
|
|
|
* `POST /projects/{id}/sdlc/features`: Register a feature.
|
|
* `POST /projects/{id}/builds`: Trigger an autonomous build task (Prompt -> Code).
|
|
* `GET /projects/{id}/sdlc/next`: The "Classifier" logic to tell the runner what to do next.
|
|
|
|
## 5. Core Packages & Patterns to Implement
|
|
|
|
Before running `slackpath-1`:
|
|
|
|
1. **`pkg/auth`**:
|
|
* `GenerateToken(user User) (string, error)`
|
|
* `Middleware(secret string) func(http.Handler) http.Handler`
|
|
* `UserFromContext(ctx) User`
|
|
|
|
2. **`pkg/queue`** (for Path 2):
|
|
* `Producer` interface (`Enqueue(job)`)
|
|
* `Consumer` interface (`RegisterHandler(type, func)`)
|
|
* Redis implementation.
|
|
|
|
3. **`pkg/realtime`** (for Path 3):
|
|
* Websocket Hub implementation (register, unregister, broadcast).
|
|
* Redis Pub/Sub adapter for scaling across pods.
|
|
|
|
## Action Plan
|
|
|
|
1. **Scaffold Missing Templates**: Create `worker`, `redis` (helm chart wrapper), and `postgres` (helm chart wrapper) in `internal/adapter/templates/templates`.
|
|
2. **Build Shared Libs**: Implement `pkg/auth` and `pkg/queue` to standardize the "hard parts".
|
|
3. **Install SDLC Commands**: Create the missing markdown files in `.claude/commands`.
|
|
4. **Verify API**: Ensure `rdev-api` has the SDLC endpoints mounted.
|