Skip to content

Commit 5d67878

Browse files
docs - inbuilt documentation or help
1 parent 3e05601 commit 5d67878

16 files changed

Lines changed: 562 additions & 6 deletions

File tree

app/commands/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .shell import shell
88
from .down import down
99
from .status import status
10+
from .docs.docs import docs
1011

1112
__all__ = [
1213
"init",
@@ -17,5 +18,6 @@
1718
"logs",
1819
"shell",
1920
"down",
20-
"status"
21+
"status",
22+
"docs"
2123
]

app/commands/docs/content/clone.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# mate clone
2+
3+
The `clone` command allows you to download a Git repository to your local machine. DevMate handles destination path logic automatically if you don't specify one, following standard naming conventions.
4+
5+
## Detailed Description
6+
`mate clone` uses Git to download the specified repository. If no directory is provided, it extracts the repository name from the URL and creates a folder with that name in the current directory. It is the fundamental first step before running `mate up` or other management commands.
7+
8+
## Usage
9+
`mate clone <URL> [OPTIONS]`
10+
11+
## Arguments & Options
12+
| Flag | Description |
13+
|------|-------------|
14+
| `URL` | The Git URL of the repository (required). |
15+
| `-d`, `--dir` | Custom directory path where the repo will be cloned. |
16+
17+
## Examples
18+
19+
### 1. Default Logic (Automatic Naming)
20+
Clones the repository and names the folder after the repo name (e.g., `my-app`).
21+
```bash
22+
mate clone https://github.com/user/my-app.git
23+
```
24+
25+
### 2. Specific Directory
26+
Clones the repository into a predetermined folder structure.
27+
```bash
28+
mate clone https://github.com/user/my-app.git --dir ./projects/client-a
29+
```
30+
31+
### 3. SSH Support
32+
Works with SSH URLs if your system is configured with Git keys.
33+
```bash
34+
mate clone git@github.com:user/my-app.git
35+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# mate deploy
2+
3+
The `deploy` command is the fastest way to get a project running. it combines `clone` and `up` into a single atomic operation, including automatic environment detection and health checks.
4+
5+
## Detailed Description
6+
When you run `deploy`, DevMate:
7+
1. Clones the repository to your local machine.
8+
2. Enters the project directory (or a specified sub-location).
9+
3. Detects if the project uses Docker Compose or a standalone Dockerfile.
10+
4. Spins up the services.
11+
5. Performs immediate health checks to ensure the application is ready.
12+
13+
## Usage
14+
`mate deploy <REPO_URL> [OPTIONS]`
15+
16+
## Arguments & Options
17+
| Flag | Description |
18+
|------|-------------|
19+
| `REPO_URL` | The Git URL to clone (required). |
20+
| `-n`, `--name` | Custom name for the cloned folder. |
21+
| `-b`, `--branch` | Specific branch to clone (e.g., `main`, `staging`). |
22+
| `-p`, `--port` | Port mappings for Dockerfile projects (`HOST:CONTAINER`). |
23+
| `-l`, `--location` | Subdirectory inside the repo where config files are found (default `.`). |
24+
| `-f`, `--force` | Force rebuild of images and restart. |
25+
26+
## Examples
27+
28+
### 1. Docker Compose Scenario (Default)
29+
Deploys a multi-container stack from a standard repository.
30+
```bash
31+
mate deploy https://github.com/example/api-stack.git
32+
```
33+
34+
### 2. Dockerfile Scenario (with Port Mapping)
35+
Deploys a single service and maps it to a specific local port.
36+
```bash
37+
mate deploy https://github.com/example/web-app.git --port 8080:80
38+
```
39+
40+
### 3. Custom Branch and Sub-location
41+
Deploys the `dev` branch and looks for configuration in the `./backend` folder.
42+
```bash
43+
mate deploy https://github.com/example/monorepo.git --branch dev --location ./backend
44+
```

app/commands/docs/content/down.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# mate down
2+
3+
The `down` command stops and cleans up your development environment. It is designed to safely terminate processes and optionally remove transient assets like volumes and images.
4+
5+
## Detailed Description
6+
`mate down` automatically detects your environment type. For Compose projects, it stops and removes containers and networks. For standalone containers, it terminates the specific process. Use this when you want to free up system resources or reset your environment.
7+
8+
## Usage
9+
`mate down [OPTIONS]`
10+
11+
## Options
12+
| Flag | Description |
13+
|------|-------------|
14+
| `-p`, `--project-path` | Path to the project. DevMate detects the config here. |
15+
| `-c`, `--container-name` | Explicitly stop a container by name, ignoring project logic. |
16+
| `-v`, `--remove-volumes` | Remove named and anonymous volumes (use with caution). |
17+
| `-i`, `--remove-images` | Remove images used by the services. |
18+
| `-o`, `--remove-orphans` | Clean up containers not defined in the current compose file. |
19+
20+
## Examples
21+
22+
### 1. Docker Compose Cleanup
23+
Stops all services defined in the current directory's Compose file.
24+
```bash
25+
mate down
26+
```
27+
28+
### 2. Dockerfile Cleanup (Full Reset)
29+
Stops the container and removes its images and volumes.
30+
```bash
31+
mate down -v -i
32+
```
33+
34+
### 3. Direct Container Stop
35+
Stops a specific container named "legacy-db" without needing a manifest file.
36+
```bash
37+
mate down --container-name legacy-db
38+
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# mate health
2+
3+
The `health` command verifies that your application is not just running, but actually responding to requests.
4+
5+
## Detailed Description
6+
`mate health` performs active polling against your application's endpoints. It supports both HTTP (for web apps) and TCP (for databases/internal services). It includes built-in retry logic and progress tracking to handle applications with slow startup times.
7+
8+
## Usage
9+
`mate health [OPTIONS]`
10+
11+
## Options
12+
| Flag | Description |
13+
|------|-------------|
14+
| `-u`, `--url` | Base URL (e.g., `http://localhost`). |
15+
| `-p`, `--path` | Endpoint path (default: `/`). |
16+
| `-P`, `--port` | Port to check. |
17+
| `-r`, `--max-retries` | How many times to try before giving up (default: 3). |
18+
| `-t`, `--timeout` | Seconds to wait for each request. |
19+
20+
## Examples
21+
22+
### 1. Web Service Check
23+
Checks if your frontend is serving traffic on the root path.
24+
```bash
25+
mate health --port 3000
26+
```
27+
28+
### 2. API Health Endpoint
29+
Verifies a specific internal status endpoint with multiple retries.
30+
```bash
31+
mate health -P 8080 -p /api/v1/health --max-retries 10
32+
```
33+
34+
### 3. Remote Service Audit
35+
Checks the health of an external or staging URL.
36+
```bash
37+
mate health --url http://staging.myapp.com --timeout 10
38+
```

app/commands/docs/content/init.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# mate init
2+
3+
The `init` command ensures your local machine is ready for development using DevMate. It acts as a "Doctor" check for your dev environment.
4+
5+
## Detailed Description
6+
`mate init` audits your system for three critical dependencies:
7+
- **Git**: Required for `clone` and `deploy`.
8+
- **Docker**: Required for all container management.
9+
- **Python**: Required for internal CLI logic.
10+
11+
If any tool is missing, DevMate doesn't just error out—it provides official download links and installation guidance tailored to your needs.
12+
13+
## Usage
14+
`mate init [OPTIONS]`
15+
16+
## Options
17+
| Flag | Description |
18+
|------|-------------|
19+
| `-v`, `--verbose` | Show detailed paths and versions of detected tools. |
20+
21+
## Examples
22+
23+
### 1. Standard Environment Check
24+
The first command any new DevMate user should run.
25+
```bash
26+
mate init
27+
```
28+
29+
### 2. Verbose Audit
30+
Useful if you have multiple versions of tools and need to know which one `mate` found.
31+
```bash
32+
mate init --verbose
33+
```
34+
35+
### 3. Alias Support
36+
You can also run this using the `doctor` alias for a friendlier feel.
37+
```bash
38+
mate doctor
39+
```

app/commands/docs/content/logs.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# mate logs
2+
3+
The `logs` command streams the output of your application to your terminal, making it easy to monitor activity and catch errors as they happen.
4+
5+
## Detailed Description
6+
DevMate `logs` integrates with both Docker Compose and standalone containers. It supports "follow" mode for real-time monitoring and allows you to limit the output history using the "tail" option to avoid terminal clutter.
7+
8+
## Usage
9+
`mate logs [OPTIONS]`
10+
11+
## Options
12+
| Flag | Description |
13+
|------|-------------|
14+
| `-f`, `--follow` | Stream logs in real-time until interrupted (Ctrl+C). |
15+
| `-t`, `--tail` | Number of recent lines to display (default: 100). |
16+
| `-c`, `--container` | Explicitly fetch logs for a specific container name. |
17+
| `-p`, `--path` | Project path for fetching Compose-wide logs. |
18+
19+
## Examples
20+
21+
### 1. Project Monitoring (Compose)
22+
Follows logs from ALL services in your current stack simultaneously.
23+
```bash
24+
mate logs -f
25+
```
26+
27+
### 2. Debugging a Specific Service
28+
Shows the last 500 lines for a specific container.
29+
```bash
30+
mate logs --container web-api --tail 500
31+
```
32+
33+
### 3. Quick Inspection
34+
Checks the recent history of the current folder's project without streaming.
35+
```bash
36+
mate logs
37+
```

app/commands/docs/content/main.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# DevMate (`mate`) — The Developer's Companion
2+
3+
Welcome to the official documentation for **DevMate**.
4+
5+
DevMate is a high-performance, developer-centric orchestration tool designed to bridge the gap between your local source code and a fully functional containerized environment.
6+
7+
---
8+
9+
## 🛠️ Commands & Examples
10+
11+
Use `mate docs <command>` for even more specialized guides.
12+
13+
### 1. `init` (System Audit)
14+
Ensure your environment is ready.
15+
- **Example**: `mate init`
16+
- **Verbose**: `mate init --verbose`
17+
- **Alias**: `mate doctor`
18+
19+
### 2. `clone` (Smart Fetch)
20+
Download repositories with automatic naming.
21+
- **Default**: `mate clone https://github.com/user/my-app.git`
22+
- **Custom Dir**: `mate clone <URL> --dir ./src`
23+
- **SSH**: `mate clone git@github.com:user/repo.git`
24+
25+
### 3. `up` (Orchestrate)
26+
Build and start your services.
27+
- **Compose**: `mate up` (auto-detects `compose.yaml`)
28+
- **Dockerfile**: `mate up --port 8080:80` (auto-maps local port)
29+
- **Force**: `mate up --force --pull always` (fresh build)
30+
31+
### 4. `deploy` (One-Touch)
32+
Clone and start in one command.
33+
- **Compose Stack**: `mate deploy https://github.com/user/api-stack.git`
34+
- **Single Service**: `mate deploy <URL> --port 3000:3000`
35+
- **Branch/Sub-location**: `mate deploy <URL> --branch dev --location ./app`
36+
37+
### 5. `status` (Monitor)
38+
Real-time dashboard of your containers.
39+
- **Standard**: `mate status`
40+
- **Inspection**: `mate status --volume --health`
41+
- **Filtered**: `mate status --stopped --all`
42+
43+
### 6. `shell` (Interact)
44+
Instant terminal access into containers.
45+
- **Interactive**: `mate shell` (picks best container)
46+
- **Direct**: `mate shell --name redis-service`
47+
- **Custom Shell**: `mate shell --sh /bin/bash`
48+
49+
### 7. `logs` (Stream)
50+
Monitor application output.
51+
- **Follow All**: `mate logs -f`
52+
- **Service Specific**: `mate logs --container api-gw --tail 200`
53+
- **Quick Check**: `mate logs`
54+
55+
### 8. `health` (Audit)
56+
Validate endpoint responsiveness.
57+
- **Local HTTP**: `mate health --port 8080`
58+
- **Internal API**: `mate health -P 5000 -p /health --max-retries 5`
59+
- **TCP Check**: `mate health --url tcp://localhost:5432`
60+
61+
### 9. `down` (Cleanup)
62+
Safe environment shutdown.
63+
- **Compose Reset**: `mate down`
64+
- **Full Removal**: `mate down -v -i` (deletes volumes/images)
65+
- **Specific Container**: `mate down --container-name test-db`
66+
67+
---
68+
69+
## Quick Start - The most common workflow
70+
```bash
71+
mate init # 1. Check system
72+
mate deploy https://github.com/user/project # 2. Get it running
73+
mate status # 3. Verify services
74+
```
75+
for more workflows run `mate docs workflow`
76+
*DevMate — Build faster, debug less.*

app/commands/docs/content/shell.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# mate shell
2+
3+
The `shell` command provides instant access into any running container, allowing you to run management commands, inspect logs, or debug the environment directly.
4+
5+
## Detailed Description
6+
`mate shell` is your primary tool for "Inside-the-box" debugging. It automatically detects the most relevant container in your current project directory. If your project has multiple containers (Compose), it provides an interactive selection menu.
7+
8+
## Usage
9+
`mate shell [OPTIONS]`
10+
11+
## Options
12+
| Flag | Description |
13+
|------|-------------|
14+
| `-n`, `--name` | Name of the container or Compose service to connect to. |
15+
| `-s`, `--sh` | Shell executable to use (default: `/bin/sh`). |
16+
| `-p`, `--path` | Project directory for auto-detection logic. |
17+
18+
## Examples
19+
20+
### 1. Interactive Selection (Compose)
21+
If you have multiple services, DevMate will let you pick the one you want.
22+
```bash
23+
mate shell
24+
```
25+
26+
### 2. Direct Container Access
27+
Quickly jump into a known container to check a specific file or process.
28+
```bash
29+
mate shell --name my-redis-cache
30+
```
31+
32+
### 3. Custom Shell (Bash)
33+
Use this if the container has `bash` installed for a more feature-rich experience.
34+
```bash
35+
mate shell --sh /bin/bash
36+
```

0 commit comments

Comments
 (0)