Feature: Service Integration with dev-template configure (Phase B)
IMPLEMENTATION RULES: Before implementing this plan, read and follow:
- WORKFLOW.md - The implementation process
- PLANS.md - Plan structure and best practices
Status: ✅ Completed (2026-04-05, shipped in v1.7.16)
Goal: Add dev-template configure command that reads template-info.yaml, processes params, and calls UIS via uis-bridge to create databases, expose services, and wire connections into .env.
Last Updated: 2026-04-05
Investigation: helpers-no/dev-templates -> INVESTIGATE-unified-template-system.md (all three contributors confirmed)
Depends on:
- DCT Phase A completed (unified
dev-template, registry browsing,install_type) - UIS
uis configurecommand ready (at least PostgreSQL) - UIS
uis exposecommand ready
Overview
After Phase A, dev-template installs template files and tools. But templates with requires (e.g., Next.js + PostgreSQL) need a second step: dev-template configure.
Flow:
- User ran
dev-template(Phase A) -- files and tools installed - User edits
template-info.yamlparams (app_name, database_name, etc.) - User runs
dev-template configure - DCT reads
template-info.yaml, validates params - For each
requiresentry: callsuis-bridge configure <service> --json - UIS creates database/user, exposes port, returns connection JSON
- DCT writes
.envwith connection details - App is scaffolded and pre-wired to running infrastructure
Phase 1: Docker CLI install script — ✅ SUPERSEDED
Replaced by docker-outside-of-docker devcontainer feature (see
completed/INVESTIGATE-docker-socket-cross-platform.md). The feature
provides Docker CLI + socket on all platforms with zero configuration.
install-tool-docker-cli.sh was deleted.
Phase 2: uis-bridge library — ✅ DONE (code only, untested)
Tasks
- 2.1 Create
lib/uis-bridge.shin DCT manage directory:UIS_CONTAINER="uis-provision-host"(fixed name, Decision per 8UIS)uis_bridge_check()-- verify UIS container is running, clear error if notuis_bridge_run()--docker exec "$UIS_CONTAINER" uis "$@"uis_bridge_run_stdin()--docker exec -i "$UIS_CONTAINER" uis "$@"(for init files)uis_bridge_configure()-- callsuis configure, parses JSON response, handles errors- Error handling: parse
{"status": "error", "phase": "...", "detail": "..."}format
- 2.2 Check Docker CLI is available before any bridge call (clear error if not installed)
Validation
uis_bridge_run uis status --json returns data from UIS.
Phase 3: dev-template configure command — ✅ DONE (code only, untested)
Tasks
- 3.1 Add
dev-template configuresubcommand - 3.2 Substitute
{{ params.* }}inrequiresentries and init file contents - 3.3 For each
requiresentry: calluis_bridge_configure, handle stdin init files, collect connection details - 3.4 Write
.env/.env.clusterwith connection details - 3.5 Show completion summary (succeeded/failed/skipped)
Validation
dev-template configure creates database in UIS PostgreSQL, writes .env with DATABASE_URL.
Phase 4: Params -- three input paths — ✅ DONE
Tasks
- 4.1 Interactive path: developer edits
template-info.yamlparams section - 4.2 CLI path:
dev-template configure --param app_name=volunteer-app- CLI args override YAML values
- Write back to
template-info.yamlso future re-runs use the same values
- 4.3 Env var path (CI/CD):
TEMPLATE_PARAM_APP_NAME=volunteer-app dev-template configure
Validation
All three input paths work. Params persisted in template-info.yaml.
Phase 5: Idempotent re-runs — ✅ DONE (via UIS already_configured)
Tasks
- 5.1 Rely on UIS's
already_configuredresponse rather than local state tracking (simpler, no state sync issues). UIS rotates password onalready_configuredand returns fresh credentials — DCT writes updated.envautomatically. - 5.2 Handle failed retries: failed services fail with structured JSON error, summary shows succeeded/failed/skipped per service.
Validation
Verified in Round 2 integration testing (talk.md): dev-template configure run twice shows ⏭️ already configured on second run, .env password rotates on each re-run.
Phase 6: Testing — ✅ DONE
Integration tested against uis1 tester's live uis-provision-host container (see testing/uis1/talk/talk.md):
Round 1 — uis-bridge contract verification (7 tests, 5 PASS + 2 UIS contract gaps, fixed by UIS):
- 6.2
uis-bridgewith running UIS container - 6.3
uis-bridgewith UIS container not running (clear error) - 6.8 Init file error handling (bad SQL) — found+fixed UIS rollback bug
- 6.12
.envgeneration with correct connection details
Round 2 — full end-to-end flow (10 tests, all PASS after 3 DCT fixes in v1.7.15 + env_var in v1.7.16):
- 6.4
dev-template configurewith PostgreSQL requires - 6.6 Params via CLI args (with write-back to YAML)
- 6.7 Init file with param substitution
- 6.9 Idempotent re-run (
already_configuredwith password rotation) - 6.11 Partial failure (first succeeds, second fails) — structured errors surfaced
Skipped / not blocking ship:
- 6.1 Docker CLI install — superseded by
docker-outside-of-dockerfeature - 6.5 Params validation (missing required) — unit-level, covered by code path
- 6.10 Multiple requires (PostgreSQL + Authentik) — Authentik configure not yet in UIS, deferred
Validation
Full flow verified: dev-template python-basic-webserver-database → dev-template configure --param app_name=X --param database_name=Y → UIS creates DB → init file applied → .env written with DATABASE_URL → idempotent re-runs rotate passwords cleanly → structured errors for failures.
Acceptance Criteria
- Docker CLI installable — superseded:
docker-outside-of-dockerfeature provides CLI + socket -
uis-bridge.shabstracts all UIS communication (Decision per 3UIS) -
dev-template configurereadstemplate-info.yamland processesrequires - Params validated before any UIS calls
- Three input paths: YAML edit, CLI args (with write-back), env vars (3MSG)
-
{{ params.* }}substituted in requires and init files before UIS (11UIS) - Init file errors shown with context (15MSG)
- Partial failure handling: show summary, retry on re-run
-
.envgenerated with local and cluster connection details (env_varfield support) - Idempotent re-runs (UIS
already_configured+ password rotation) - Clear error when UIS container not running
- Clear error when Docker CLI not installed (via docker-outside-of-docker feature prereq)
Files to Create/Modify
New:
.devcontainer/additions/install-tool-docker-cli.sh-- Docker CLI install script.devcontainer/manage/lib/uis-bridge.sh-- UIS communication abstraction.devcontainer/manage/dev-template-configure.sh-- configure subcommand (or integrated into dev-template.sh)
Modify:
.devcontainer/manage/dev-template.sh-- addconfiguresubcommand routing