stackai-cli 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackai_cli-0.2.0/PKG-INFO +119 -0
- stackai_cli-0.2.0/README.md +99 -0
- stackai_cli-0.2.0/devai/__init__.py +1 -0
- stackai_cli-0.2.0/devai/cli.py +58 -0
- stackai_cli-0.2.0/devai/detector.py +524 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/devai/generator.py +135 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/pyproject.toml +1 -1
- stackai_cli-0.2.0/stackai_cli.egg-info/PKG-INFO +119 -0
- stackai_cli-0.1.0/PKG-INFO +0 -111
- stackai_cli-0.1.0/README.md +0 -91
- stackai_cli-0.1.0/devai/__init__.py +0 -1
- stackai_cli-0.1.0/devai/cli.py +0 -56
- stackai_cli-0.1.0/devai/detector.py +0 -151
- stackai_cli-0.1.0/stackai_cli.egg-info/PKG-INFO +0 -111
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/devai/ai.py +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/devai/debugger.py +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/setup.cfg +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/stackai_cli.egg-info/SOURCES.txt +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/stackai_cli.egg-info/dependency_links.txt +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/stackai_cli.egg-info/entry_points.txt +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/stackai_cli.egg-info/requires.txt +0 -0
- {stackai_cli-0.1.0 → stackai_cli-0.2.0}/stackai_cli.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stackai-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: AI-powered Docker assistant — detects your stack, generates Dockerfile & compose, debugs containers.
|
|
5
|
+
Author-email: El Mehdi Boutahar <boutahar.elmehdi@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MehdiB7/devai
|
|
8
|
+
Project-URL: Repository, https://github.com/MehdiB7/devai
|
|
9
|
+
Project-URL: Bug-Tracker, https://github.com/MehdiB7/devai/issues
|
|
10
|
+
Keywords: docker,ai,devops,cli,ollama,automation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: click>=8.1
|
|
20
|
+
|
|
21
|
+
# stackai-cli
|
|
22
|
+
|
|
23
|
+
> AI-powered Docker assistant. No configuration needed.
|
|
24
|
+
|
|
25
|
+
`stackai` analyzes your project, generates an optimized Dockerfile and docker-compose, and debugs your containers using a local AI model — all in a single command.
|
|
26
|
+
|
|
27
|
+
[](https://pypi.org/project/stackai-cli/)
|
|
28
|
+
[](https://pypi.org/project/stackai-cli/)
|
|
29
|
+
[](https://opensource.org/licenses/MIT)
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install stackai-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> `stackai debug` requires [Ollama](https://ollama.com) running locally with `ollama pull llama3`.
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
### `stackai init` — Generate Docker files from your project
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cd my-project
|
|
45
|
+
stackai init
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
🔍 Analyzing project...
|
|
50
|
+
✅ Stack detected: python / fastapi + postgres + redis
|
|
51
|
+
⚙️ Generating Docker files...
|
|
52
|
+
✅ Dockerfile created
|
|
53
|
+
✅ .dockerignore created
|
|
54
|
+
✅ docker-compose.yaml created
|
|
55
|
+
|
|
56
|
+
🚀 Ready! Run: docker compose up -d
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `stackai scan` — Inspect detected stack without generating files
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
stackai scan
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
📦 Stack detected:
|
|
67
|
+
Language : python
|
|
68
|
+
Framework : fastapi
|
|
69
|
+
Port : 8000
|
|
70
|
+
Services : postgres, redis
|
|
71
|
+
Python ver. : 3.11
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `stackai debug` — Analyze a failing container with AI
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
stackai debug my-container
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
📋 Latest logs:
|
|
82
|
+
─────────────────────────────────────────
|
|
83
|
+
Error: could not connect to postgres...
|
|
84
|
+
─────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
🤖 Running AI analysis...
|
|
87
|
+
|
|
88
|
+
💡 Analysis:
|
|
89
|
+
1. PROBLEM : The app cannot connect to PostgreSQL
|
|
90
|
+
2. CAUSE : The postgres container is not ready when the app starts
|
|
91
|
+
3. FIX : Add `depends_on: [postgres]` in your docker-compose.yaml
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Supported Stacks
|
|
95
|
+
|
|
96
|
+
| Language | Detected Frameworks |
|
|
97
|
+
|----------|-------------------|
|
|
98
|
+
| Python | FastAPI, Flask, Django, generic |
|
|
99
|
+
| Node.js | Express, Next.js, Nuxt.js, React |
|
|
100
|
+
| Java | Spring Boot (Maven / Gradle) |
|
|
101
|
+
| Go | generic |
|
|
102
|
+
|
|
103
|
+
## Auto-detected Services
|
|
104
|
+
|
|
105
|
+
`postgres` · `redis` · `mongodb` · `mysql` · `elasticsearch`
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
|
|
109
|
+
- Python 3.10+
|
|
110
|
+
- Docker installed and running
|
|
111
|
+
- [Ollama](https://ollama.com) + `ollama pull llama3` (only for `stackai debug`)
|
|
112
|
+
|
|
113
|
+
## Contributing
|
|
114
|
+
|
|
115
|
+
Pull requests are welcome. For major changes, please open an issue first.
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT © [El Mehdi Boutahar](https://github.com/MehdiB7)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# stackai-cli
|
|
2
|
+
|
|
3
|
+
> AI-powered Docker assistant. No configuration needed.
|
|
4
|
+
|
|
5
|
+
`stackai` analyzes your project, generates an optimized Dockerfile and docker-compose, and debugs your containers using a local AI model — all in a single command.
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/stackai-cli/)
|
|
8
|
+
[](https://pypi.org/project/stackai-cli/)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install stackai-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> `stackai debug` requires [Ollama](https://ollama.com) running locally with `ollama pull llama3`.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### `stackai init` — Generate Docker files from your project
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd my-project
|
|
25
|
+
stackai init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
🔍 Analyzing project...
|
|
30
|
+
✅ Stack detected: python / fastapi + postgres + redis
|
|
31
|
+
⚙️ Generating Docker files...
|
|
32
|
+
✅ Dockerfile created
|
|
33
|
+
✅ .dockerignore created
|
|
34
|
+
✅ docker-compose.yaml created
|
|
35
|
+
|
|
36
|
+
🚀 Ready! Run: docker compose up -d
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `stackai scan` — Inspect detected stack without generating files
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
stackai scan
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
📦 Stack detected:
|
|
47
|
+
Language : python
|
|
48
|
+
Framework : fastapi
|
|
49
|
+
Port : 8000
|
|
50
|
+
Services : postgres, redis
|
|
51
|
+
Python ver. : 3.11
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `stackai debug` — Analyze a failing container with AI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
stackai debug my-container
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
📋 Latest logs:
|
|
62
|
+
─────────────────────────────────────────
|
|
63
|
+
Error: could not connect to postgres...
|
|
64
|
+
─────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
🤖 Running AI analysis...
|
|
67
|
+
|
|
68
|
+
💡 Analysis:
|
|
69
|
+
1. PROBLEM : The app cannot connect to PostgreSQL
|
|
70
|
+
2. CAUSE : The postgres container is not ready when the app starts
|
|
71
|
+
3. FIX : Add `depends_on: [postgres]` in your docker-compose.yaml
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Supported Stacks
|
|
75
|
+
|
|
76
|
+
| Language | Detected Frameworks |
|
|
77
|
+
|----------|-------------------|
|
|
78
|
+
| Python | FastAPI, Flask, Django, generic |
|
|
79
|
+
| Node.js | Express, Next.js, Nuxt.js, React |
|
|
80
|
+
| Java | Spring Boot (Maven / Gradle) |
|
|
81
|
+
| Go | generic |
|
|
82
|
+
|
|
83
|
+
## Auto-detected Services
|
|
84
|
+
|
|
85
|
+
`postgres` · `redis` · `mongodb` · `mysql` · `elasticsearch`
|
|
86
|
+
|
|
87
|
+
## Requirements
|
|
88
|
+
|
|
89
|
+
- Python 3.10+
|
|
90
|
+
- Docker installed and running
|
|
91
|
+
- [Ollama](https://ollama.com) + `ollama pull llama3` (only for `stackai debug`)
|
|
92
|
+
|
|
93
|
+
## Contributing
|
|
94
|
+
|
|
95
|
+
Pull requests are welcome. For major changes, please open an issue first.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT © [El Mehdi Boutahar](https://github.com/MehdiB7)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from devai.detector import detect_stack
|
|
3
|
+
from devai.generator import generate_files
|
|
4
|
+
from devai.debugger import debug_container
|
|
5
|
+
from devai import __version__
|
|
6
|
+
|
|
7
|
+
@click.group()
|
|
8
|
+
@click.version_option(version=__version__, prog_name="stackai")
|
|
9
|
+
def main():
|
|
10
|
+
"""stackai — AI-powered Docker assistant. No configuration needed."""
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@main.command()
|
|
15
|
+
@click.argument("path", default=".", type=click.Path(exists=True))
|
|
16
|
+
def init(path):
|
|
17
|
+
"""Analyse ton projet et génère Dockerfile + docker-compose."""
|
|
18
|
+
click.echo(click.style("🔍 Analyzing project...", fg="cyan"))
|
|
19
|
+
|
|
20
|
+
stack = detect_stack(path)
|
|
21
|
+
if not stack:
|
|
22
|
+
click.echo(click.style("❌ Could not detect stack. Make sure you are in a project directory.", fg="red"))
|
|
23
|
+
raise SystemExit(1)
|
|
24
|
+
|
|
25
|
+
services = ', '.join(stack['services']) if stack['services'] else 'none'
|
|
26
|
+
click.echo(click.style(f"✅ Stack detected: {stack['language']} / {stack.get('framework','generic')} + {services}", fg="green"))
|
|
27
|
+
click.echo(click.style("⚙️ Generating Docker files...", fg="cyan"))
|
|
28
|
+
|
|
29
|
+
generated = generate_files(path, stack)
|
|
30
|
+
for f in generated:
|
|
31
|
+
click.echo(click.style(f" ✅ {f} created", fg="green"))
|
|
32
|
+
|
|
33
|
+
click.echo(click.style("\n🚀 Ready! Run: docker compose up -d", fg="bright_green", bold=True))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@main.command()
|
|
37
|
+
@click.argument("container_name")
|
|
38
|
+
def debug(container_name):
|
|
39
|
+
"""Analyse les logs d'un container et explique l'erreur."""
|
|
40
|
+
click.echo(click.style(f"🔍 Reading logs from '{container_name}'...", fg="cyan"))
|
|
41
|
+
debug_container(container_name)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@main.command()
|
|
45
|
+
@click.argument("path", default=".", type=click.Path(exists=True))
|
|
46
|
+
def scan(path):
|
|
47
|
+
"""Affiche un résumé de la stack détectée sans rien générer."""
|
|
48
|
+
stack = detect_stack(path)
|
|
49
|
+
if not stack:
|
|
50
|
+
click.echo(click.style("❌ Aucune stack détectée.", fg="red"))
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
click.echo(click.style("📦 Stack detected:", fg="cyan", bold=True))
|
|
54
|
+
click.echo(f" Language : {stack['language']}")
|
|
55
|
+
click.echo(f" Framework : {stack.get('framework', 'unknown')}")
|
|
56
|
+
click.echo(f" Port : {stack.get('port', 'unknown')}")
|
|
57
|
+
click.echo(f" Services : {', '.join(stack['services']) if stack['services'] else 'none'}")
|
|
58
|
+
click.echo(f" Python ver. : {stack.get('python_version', 'N/A')}")
|