refactor: Update project structure to place tools and frontends under components/
This commit is contained in:
@@ -132,7 +132,7 @@ Creates a shim so the tool is available system-wide after
|
||||
|
||||
```yaml
|
||||
tool:
|
||||
source: my-tool/ # Source directory
|
||||
source: components/my-tool/ # Source directory
|
||||
version: "1.0.0"
|
||||
system_dependencies: [pandoc, poppler-utils]
|
||||
```
|
||||
@@ -209,7 +209,7 @@ A component can have multiple roles. For example, `protonmail` is both a
|
||||
# Service — scaffolds project, assigns port, registers in castle.yaml
|
||||
castle create my-service --type service --description "Does something"
|
||||
|
||||
# Tool — scaffolds at repo root
|
||||
# Tool — scaffolds under components/
|
||||
castle create my-tool --type tool --description "Does something"
|
||||
```
|
||||
|
||||
@@ -222,7 +222,7 @@ components:
|
||||
my-tool:
|
||||
description: Does something useful
|
||||
tool:
|
||||
source: my-tool/
|
||||
source: components/my-tool/
|
||||
install:
|
||||
path:
|
||||
alias: my-tool
|
||||
@@ -234,7 +234,7 @@ components:
|
||||
|
||||
```bash
|
||||
castle create my-service --type service # 1. Scaffold + register
|
||||
cd my-service && uv sync # 2. Install deps
|
||||
cd components/my-service && uv sync # 2. Install deps
|
||||
# ... implement ...
|
||||
castle test my-service # 3. Run tests
|
||||
castle service enable my-service # 4. Generate systemd unit, start
|
||||
@@ -254,10 +254,10 @@ castle service disable my-service # Stop and remove systemd unit
|
||||
|
||||
```bash
|
||||
castle create my-tool --type tool # 1. Scaffold + register
|
||||
cd my-tool && uv sync # 2. Install deps
|
||||
cd components/my-tool && uv sync # 2. Install deps
|
||||
# ... implement ...
|
||||
castle test my-tool # 3. Run tests
|
||||
uv tool install --editable my-tool/ # 4. Install to PATH
|
||||
uv tool install --editable components/my-tool/ # 4. Install to PATH
|
||||
```
|
||||
|
||||
### Job lifecycle
|
||||
@@ -295,7 +295,7 @@ and a `.timer` file.
|
||||
|
||||
## Manifest models
|
||||
|
||||
The Pydantic models live in `cli/src/castle_cli/manifest.py`. Key classes:
|
||||
The Pydantic models live in `core/src/castle_core/manifest.py`. Key classes:
|
||||
|
||||
- `ComponentManifest` — top-level model, has `roles` computed property
|
||||
- `RunSpec` — discriminated union (RunPythonUvTool, RunCommand, etc.)
|
||||
@@ -303,5 +303,8 @@ The Pydantic models live in `cli/src/castle_cli/manifest.py`. Key classes:
|
||||
- `ExposeSpec`, `ProxySpec`, `ManageSpec`, `InstallSpec`, `ToolSpec`, `BuildSpec`
|
||||
- `CaddySpec`, `SystemdSpec`, `HttpExposeSpec`, `HttpInternal`
|
||||
|
||||
Config loading: `cli/src/castle_cli/config.py` — `load_config()` parses
|
||||
Config loading: `core/src/castle_core/config.py` — `load_config()` parses
|
||||
castle.yaml into `CastleConfig` with typed `components` dict.
|
||||
|
||||
Infrastructure generators: `core/src/castle_core/generators/` — systemd unit/timer
|
||||
generation (`systemd.py`) and Caddyfile generation (`caddyfile.py`).
|
||||
|
||||
@@ -24,10 +24,10 @@ How to build CLI tools following Unix philosophy.
|
||||
|
||||
## Project layout
|
||||
|
||||
Each tool is an independent project at the repo root with its own `pyproject.toml`:
|
||||
Each tool is an independent project under `components/` with its own `pyproject.toml`:
|
||||
|
||||
```
|
||||
my-tool/
|
||||
components/my-tool/
|
||||
├── src/my_tool/
|
||||
│ ├── __init__.py
|
||||
│ └── main.py # Entry point
|
||||
@@ -37,13 +37,13 @@ my-tool/
|
||||
└── CLAUDE.md
|
||||
```
|
||||
|
||||
Examples: `pdf2md/`, `gpt/`, `protonmail/`
|
||||
Examples: `components/pdf2md/`, `components/gpt/`, `components/protonmail/`
|
||||
|
||||
## Creating a new tool
|
||||
|
||||
```bash
|
||||
castle create my-tool --type tool --description "Does something"
|
||||
cd my-tool && uv sync
|
||||
cd components/my-tool && uv sync
|
||||
```
|
||||
|
||||
This scaffolds the project and registers it in `castle.yaml`.
|
||||
@@ -318,7 +318,7 @@ components:
|
||||
my-tool:
|
||||
description: Does something useful
|
||||
tool:
|
||||
source: my-tool/
|
||||
source: components/my-tool/
|
||||
install:
|
||||
path:
|
||||
alias: my-tool
|
||||
@@ -331,7 +331,7 @@ components:
|
||||
pdf2md:
|
||||
description: Convert PDF files to Markdown
|
||||
tool:
|
||||
source: pdf2md/
|
||||
source: components/pdf2md/
|
||||
system_dependencies: [pandoc, poppler-utils]
|
||||
install:
|
||||
path:
|
||||
|
||||
@@ -20,7 +20,7 @@ How to build, serve, and manage web frontends as castle components.
|
||||
|
||||
```bash
|
||||
# Create the project
|
||||
mkdir my-frontend && cd my-frontend
|
||||
mkdir components/my-frontend && cd components/my-frontend
|
||||
pnpm create vite . --template react-ts
|
||||
|
||||
# Core dependencies
|
||||
|
||||
Reference in New Issue
Block a user