Skip to content

Architecture Overview

xtarterize is organized as a monorepo using Turborepo for task orchestration, pnpm for package management, and Vite Plus for build, test, and development workflows.

flowchart TD
    CLI["xtarterize<br/>apps/cli"] --> Core["@xtarterize/core"]
    CLI --> Tasks["@xtarterize/tasks"]
    Tasks --> Core
    Tasks --> Patchers["@xtarterize/patchers"]
    
    style CLI fill:#6366f1,color:#fff
    style Core fill:#22c55e,color:#fff
    style Tasks fill:#f59e0b,color:#fff
    style Patchers fill:#a855f7,color:#fff
sequenceDiagram
    participant User
    participant CLI as CLI (citty)
    participant Core as @xtarterize/core
    participant Tasks as @xtarterize/tasks
    participant Patchers as @xtarterize/patchers
    
    User->>CLI: xtarterize init
    CLI->>Core: runPreflight(cwd)
    Core-->>CLI: PreflightResult
    CLI->>Core: detectProject(cwd)
    Core-->>CLI: ProjectProfile
    CLI->>Tasks: getAllTasks()
    Tasks-->>CLI: Task[]
    CLI->>Core: resolveTasks(profile, tasks)
    Core-->>CLI: ApplicableTask[]
    CLI->>Core: resolveTaskStatuses(tasks, cwd, profile)
    Core-->>CLI: Map<taskId, TaskStatus>
    CLI->>User: Display plan
    User->>CLI: Confirm
    CLI->>Core: applyTasks(tasks, cwd, profile)
    Core->>Core: backupFile(cwd, filepath)
    Core->>Tasks: task.apply(cwd, profile)
    Tasks->>Patchers: mergeJson / mergeYaml / injectVitePlugin
    Patchers-->>Tasks: Modified content
    Tasks-->>Core: Applied
    Core-->>CLI: { applied, skipped, errors }
    CLI->>User: Summary
  • Detection lives in core — No CLI dependency, reusable by other consumers
  • Tasks are independent — Each task can run standalone via add <task-id>
  • Dry-run is exactdryRun() output is bit-for-bit identical to what apply() writes
  • Idempotency is non-negotiable — Running twice produces no changes on second run
  • Templates are parameterized — All templates receive ProjectProfile and adapt accordingly
  • Factory-based task creation — Most tasks use createSimpleFileTask, createJsonMergeTask, or createFileTask to eliminate boilerplate, with shared seams in factory-config.ts and factory-ops.ts
  • Shared command orchestrationinit and sync share a runCommand() helper in the CLI layer
flowchart TD
    Core["@xtarterize/core"] --> Detect["detect.ts + detect/*<br/>Project detection"]
    Core --> Resolve["resolve.ts<br/>Task resolution"]
    Core --> Apply["apply.ts<br/>Task application"]
    Core --> Backup["backup.ts<br/>File backup/restore"]
    Core --> Preflight["preflight.ts<br/>Pre-flight checks"]
    Core --> Diagnostics["diagnostics.ts<br/>Conflict detection"]
    Core --> Utils["utils/<br/>fs, diff, logger ([picocolors](https://github.com/alexeyraspopov/picocolors)), pkg ([pkg-types](https://github.com/unjs/pkg-types))"]
    
    style Core fill:#6366f1,color:#fff
flowchart LR
    Tasks["@xtarterize/tasks"] --> Lint["lint/<br/>biome"]
    Tasks --> TS["ts/<br/>incremental"]
    Tasks --> Gitignore["gitignore/<br/>tsbuildinfo"]
    Tasks --> Vite["vite/<br/>checker, visualizer"]
    Tasks --> CI["ci/<br/>release, auto-update, ci"]
    Tasks --> Deps["deps/<br/>renovate"]
    Tasks --> Release["release/<br/>commitlint, czg, cat-version"]
    Tasks --> Quality["quality/<br/>knip"]
    Tasks --> Codegen["codegen/<br/>plop"]
    Tasks --> Monorepo["monorepo/<br/>turbo"]
    Tasks --> Editor["editor/<br/>vscode (settings + extensions)"]
    Tasks --> Agent["agent/<br/>agents-md, skills, module"]
    Tasks --> Scripts["scripts/<br/>package-scripts"]
    Tasks --> Factory["factory.ts + factory-*<br/>task creation helpers"]
    
    style Tasks fill:#6366f1,color:#fff
Terminal window
# Install dependencies
vp install
ToolPurposeCommand
Vite PlusBuild, test, pack, dev servervp build, vp test, vp pack, vp dev
TurborepoMonorepo task orchestrationturbo run build, turbo run typecheck
BiomeLinting and formattingbiome lint ., biome check --write .
pnpmPackage management, workspacespnpm install, catalog: for shared deps
ChangesetsVersion management and publishingchangeset, changeset version
Explore project detection →