- Add LICENSE-MIT and LICENSE-APACHE for dual MIT / Apache-2.0 distribution - Update root LICENSE pointer, README.md, Deno workspace manifests, and Cargo.toml - Add deno.lock dependency lockfile - Format AGENTS.md system guidelines - Import task lifecycle scaffolding and historical story specifications (extract-auth-yes, setup-ts architecture, modular workspace)
4.3 KiB
4.3 KiB
TASK METADATA
- Target Files:
infra/setup.ts,auth-yes/infra/setup.ts - Core Objective: Design a standardized 4-Layer CLI architecture to split
the monolithic
setup.tsinto discrete, context-specific scripts fored-droidandauth-yeswhile ensuring identical dual-mode ergonomics and adopting the conciseinfra/directory standard. - Dependencies: None.
- Additional Important Notes:
- Standardize directory name to
infra/(replacinginfra/). - Podman compose commands must explicitly specify
--project-name(e.g.,--project-name auth-yes,--project-name ed-droid). - Recommend a template approach over a shared library initially to avoid external bootstrap dependencies during local dev.
- Maintain existing UX conventions via
@cliffyand@std/fmt/colors.
- Standardize directory name to
Architectural Considerations & Risks
- Risks:
- Divergence: Splitting into two scripts introduces the risk of the architectures drifting apart over time if the 4-layer template is not strictly adhered to.
- Duplication: While mitigating external dependencies, the template approach inherently requires code duplication of standard patterns (e.g., config loading, command trees, TUI loops).
- Bootstrap Failure: If an external library (e.g., from JSR) is used immediately, offline environments or initial setups might fail to run the script.
- Alternatives:
- Shared Micro-Library: Extracting the common CLI framework into a
standalone package like
@atyg/setup-clion JSR. This provides maximum DRYness but introduces external dependency risks during local bootstrapping. Recommended as a future phase once more standalone services exist. - Unified Monolith (Current State): Keep the unified
infra/setup.ts. While simple for a single repo, it violates separation of concerns sinceauth-yesis treated as a standalone workspace/repository.
- Shared Micro-Library: Extracting the common CLI framework into a
standalone package like
Proposed Implementation
1. Define the 4-Layer Architectural Template
Both the ed-droid and auth-yes CLI scripts (infra/setup.ts) must strictly
implement this pattern:
- Config/Dotenv Layer: Functions handling purely I/O reads/writes (e.g.,
readEnv(),generateEnv()). - Cliffy Command Tree (Headless/Scriptable): Definition of the CLI
structure with standard subcommand verbs:
config: Generates/reviews.envand compose files non-interactively.build: Executespodman buildand pushes to registry.test: Verifies health checks and service connectivity.deploy: Runspodman-compose --project-name <name> --env-file <env> -f <compose> up -d.- Context-specific subcommands (
spire,compile_protoforauth-yes;modules,handshakefored-droid).
- Interactive TUI Loop: The fallback wizard for human operators, using
@cliffy/promptto guide users if no subcommands/flags are passed. - Execution Engine: The core logic driving side effects like generating
files, running container commands with explicit
--project-name, or network requests.
2. Standardize on infra/ Directory & Split setup.ts
- Directory Naming: Adopt the concise
infra/convention across all repositories (e.g.,infra/setup.ts,infra/compose.yml,infra/.env.example). auth-yes/infra/setup.ts:- Exclusively manages Auth-Yes, Spire/SPIFFE mTLS, Valkey/Postgres stack, and protobuf compilation.
- Uses
--project-name auth-yesfor all compose lifecycle commands.
ed-droid/infra/setup.ts:- Exclusively manages the Central Hub, UI modules, edge client handshake, and hub images.
- Uses
--project-name ed-droidfor all compose lifecycle commands.
3. Standardize Ergonomics, UX & Deno Tasks
Ensure both target files share identical ergonomics:
- Utilize
@std/fmt/colorsconsistently for logging and prompts. - Maintain dual-mode behavior: Fail fast with clear errors in non-interactive environments unless explicit subcommands are passed.
- Add standard Deno task in both
deno.jsonfiles:"tasks": { "setup": "deno run -A infra/setup.ts" }
4. Future Phase Consideration
Document within the repository the migration path to an @atyg/setup-cli JSR
package once the ecosystem scales to additional standalone repositories.