How martinffx/atelier works
1. What this repo is
Atelier is a TypeScript/Bun CLI that installs and maintains AI-agent workspace scaffolding in a target project. It is not an application server; its main job is to generate files, wire them into a harness, and optionally install bundled skills.
2. Primary runtime boundary
The executable entrypoint lives in src/atelier.ts, with the public surface split into three user-facing commands: init, update, and remove. Those commands operate on the current project directory, not on Atelier’s own repo, so the architectural boundary is “tooling repository” vs “destination project.”
3. Command orchestration layer
src/commands/ is the control plane. init performs first-time setup and can be interactive or non-interactive; update refreshes generated harness assets; remove cleans up generated files without uninstalling skills. This layer is where idempotency and destructive/non-destructive behavior are enforced.
4. Harness detection and branching
src/utils/detect.ts is the branching point that determines whether the target project is using Claude Code or OpenCode, unless the user forces a choice. That decision shapes every downstream output: agent file locations, plugin/hook format, and model identifiers.
5. Configuration as the source of truth
The repo centers on a project-local config file under .atelier/config.json, represented by src/models.ts and src/types.ts and managed through src/utils/config.ts. This config captures harness choice, selected skills source, and agent definitions, and it lets later runs regenerate the same project state predictably.
6. Template/rendering subsystem
src/utils/templates.ts provides the template content and file-shaping logic used by generators. The important architectural point is that generated artifacts are not hand-authored ad hoc; they are derived from templates so init and update can reproduce consistent output.
7. Harness-specific generators
src/generators/claude.ts and src/generators/opencode.ts are the two concrete emitters. They translate the shared config/model layer into harness-specific outputs: Claude-focused agent directories and session hooks, or OpenCode plugins and agent definitions. The paired tests in src/generators/*.test.ts suggest this is a key compatibility boundary.
8. Generated artifacts and project integration
The CLI writes into the destination repo’s tool-specific directories, such as .claude/agents/, .opencode/agents/, .opencode/plugins/atelier.js, and .atelier/config.json. For Claude Code, the hook boundary is session-start context injection; for OpenCode, it is plugin/config transformation. These outputs are the runtime integration points with the external harness.
9. External dependency on the skills ecosystem
Atelier can optionally invoke the external skills CLI (npx skills add martinffx/atelier) to install the repo’s packaged skills into the project. That means skills are intentionally separated from the generator pipeline: the CLI can manage harness scaffolding without owning the skills distribution mechanism.
10. Skills content as packaged knowledge
The skills/ tree is a large content subsystem, not executable app logic. It contains workflow skills, oracle/thinking skills, and technology/domain skills that are meant to be auto-invoked by the harness. In architecture terms, these are deployable knowledge artifacts that complement the generated agents and hooks.
11. Agent/persona definitions
The agents/ directory and the README’s Scout/Oracle/Architect concept indicate a small persona layer with distinct responsibilities: reconnaissance, strategic analysis, and architecture. These are generated into harness-specific locations and configured with different model selections depending on Claude vs OpenCode.
12. Error handling and validation
src/utils/errors.ts exists as a dedicated utility boundary for predictable failures. Combined with src/utils/config.ts and the command tests, this suggests the CLI is designed to fail cleanly when project state, harness detection, or generation inputs are invalid.
13. Repo-level delivery and maintenance
GitHub Actions in .github/workflows/ci.yml and release-please.yml, plus commitlint.config.js, show a conventional release pipeline around a packaged CLI. The repository is designed to ship versioned tooling, with changelog/release automation rather than runtime deployment infrastructure.
14. Docs/specs as design history
docs/specs/ contains dated design and plan artifacts, which implies the repo uses spec-driven development for evolving features such as CLI behavior and provider selection. Those docs are not runtime dependencies, but they are important for understanding why the code is organized around generated artifacts, harness abstractions, and idempotent operations.
Main entry points: init.ts Init · update.ts Update · atelier.ts Atelier CLI · claude.ts Claude Gen
Components 19
CLI Runtime
Entry commands and project-facing control flow
- Atelier CLI · Bun/TypeScript executable surface
src/atelier.ts - Init · First-time setup and wiring
src/commands/init.ts - Update · Refresh generated harness assets
src/commands/update.ts - Remove · Clean generated files
src/commands/remove.ts
Core Services
Shared state, detection, templates, and error handling
- Detect Harness · Selects Claude Code or OpenCode
src/utils/detect.ts - Project Config · Source of truth in .atelier/config.json
src/utils/config.ts - Models · Shared config and domain shapes
src/models.ts - Types · Shared TypeScript contracts
src/types.ts - Templates · Generates file content and layout
src/utils/templates.ts - Errors · Predictable CLI failure handling
src/utils/errors.ts
Harness Backends
Harness-specific generators and emitted artifacts
- Claude Gen · Emits Claude-specific harness files
src/generators/claude.ts - OpenCode Gen · Emits OpenCode-specific harness files
src/generators/opencode.ts - Claude Assets · Agent dirs and session hooks under .claude
src/generators/claude.ts - OpenCode Assets · Agents and plugin under .opencode
src/generators/opencode.ts
Packaged Content
Agents and skills shipped with the repo
- Skills Pack · Packaged knowledge artifacts for auto-invocation
skills/code-review/SKILL.md - Agent Personas · Scout, Oracle, Architect definitions
agents/architect.md - Skills CLI · Optional npx skills add installation path
Delivery
Release automation and design history
- Release CI · CI and release-please publishing flow
.github/workflows/ci.yml - Specs · Design and plan artifacts for evolution
docs/specs/2025-05-07-atelier-cli/design.md
Connections 30
- Atelier CLI → Init: dispatch · Routes the init command
- Atelier CLI → Update: dispatch · Routes the update command
- Atelier CLI → Remove: dispatch · Routes the remove command
- Init → Detect Harness: choose harness · Determines Claude Code vs OpenCode
- Init → Project Config: persist · Writes project-local configuration
- Update → Project Config: read · Loads existing project state
- Remove → Project Config: read · Uses config to know what to clean
- Project Config → Models: shape · Backed by shared config model
- Models → Types: define · Shared domain contracts support the model layer
- Init → Templates: render · Builds generated files from templates
- Update → Templates: render · Re-renders consistent output
- Init → Claude Gen: branch · Uses Claude backend when selected
- Init → OpenCode Gen: branch · Uses OpenCode backend when selected
- Update → Claude Gen: refresh · Updates Claude-managed files
- Update → OpenCode Gen: refresh · Updates OpenCode-managed files
- Claude Gen → Claude Assets: emit · Writes Claude-specific project artifacts
- OpenCode Gen → OpenCode Assets: emit · Writes OpenCode-specific project artifacts
- Claude Gen → Agent Personas: persona input · Uses agent definitions for Claude output
- OpenCode Gen → Agent Personas: persona input · Uses agent definitions for OpenCode output
- Claude Gen → Skills Pack: bundle · References packaged skills content
- OpenCode Gen → Skills Pack: bundle · References packaged skills content
- Init → Skills CLI: optional install · Can delegate skills installation externally
- Skills CLI → Skills Pack: install · Installs the packaged skills set
- Atelier CLI → Errors: fail fast · Shared predictable error handling
- Init → Errors: validate · Checks invalid project or inputs
- Update → Errors: validate · Rejects unsupported or inconsistent state
- Remove → Errors: validate · Protects destructive cleanup paths
- Release CI → Atelier CLI: ship · Build and release the CLI package
- Specs → Init: inform · Documents evolving command behavior
- Specs → Detect Harness: inform · Tracks provider and harness selection decisions