stackdoctor-cli 1.0.1__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.
- stackdoctor_cli-1.0.1/LICENSE +201 -0
- stackdoctor_cli-1.0.1/PKG-INFO +177 -0
- stackdoctor_cli-1.0.1/README.md +144 -0
- stackdoctor_cli-1.0.1/pyproject.toml +129 -0
- stackdoctor_cli-1.0.1/pyproject.toml.orig +136 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/__init__.py +15 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/__main__.py +6 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/__init__.py +5 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/compaction.py +66 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/diagnosis.py +398 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/loop.py +801 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/prompts.py +85 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/__init__.py +295 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/base.py +210 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/claude.py +285 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/gemini.py +312 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/openai_compat.py +537 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/agent/providers/prices.py +90 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/__init__.py +11 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/__main__.py +198 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/holmes.py +386 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/report.py +362 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/runner.py +710 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/scenarios.py +153 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/benchmark/scoring.py +184 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/cli.py +882 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/dependencies.py +221 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/discovery.py +361 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/evidence.py +134 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/github.py +168 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/live.py +808 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/mcp_server.py +233 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/models.py +275 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/pglog.py +55 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/postgres.py +294 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/probes.py +172 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/py.typed +0 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/redaction.py +215 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/rules.py +303 -0
- stackdoctor_cli-1.0.1/src/stackdoctor/validation.py +61 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stackdoctor-cli
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: AI-powered integration validation and root cause analysis for containerized applications.
|
|
5
|
+
Author: Hussein Haidar Ahmad
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Topic :: System :: Monitoring
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: mcp>=2.3.0
|
|
19
|
+
Requires-Dist: pydantic>=2.14.4
|
|
20
|
+
Requires-Dist: typer>=0.29.3
|
|
21
|
+
Requires-Dist: anthropic>=2.14.0 ; extra == 'anthropic'
|
|
22
|
+
Requires-Dist: google-genai>=3.6.1 ; extra == 'gemini'
|
|
23
|
+
Requires-Dist: openai>=3.60.0 ; extra == 'openai'
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Project-URL: Homepage, https://github.com/13husseinH/stackdoctor
|
|
26
|
+
Project-URL: Repository, https://github.com/13husseinH/stackdoctor
|
|
27
|
+
Project-URL: Issues, https://github.com/13husseinH/stackdoctor/issues
|
|
28
|
+
Project-URL: Changelog, https://github.com/13husseinH/stackdoctor/blob/main/CHANGELOG.md
|
|
29
|
+
Provides-Extra: anthropic
|
|
30
|
+
Provides-Extra: gemini
|
|
31
|
+
Provides-Extra: openai
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<picture>
|
|
36
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/stackdoctor-logo-dark.svg">
|
|
37
|
+
<img alt="StackDoctor logo: stacked containers with a heartbeat line" src="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/stackdoctor-logo-light.svg" width="160">
|
|
38
|
+
</picture>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<h1 align="center">StackDoctor</h1>
|
|
42
|
+
|
|
43
|
+
<p align="center"><strong>Finds the broken connections between the services of a Docker Compose stack.</strong></p>
|
|
44
|
+
|
|
45
|
+
## Why StackDoctor
|
|
46
|
+
|
|
47
|
+
Every container in your stack reports **healthy**, yet the API can't reach
|
|
48
|
+
PostgreSQL: its connection string points at `localhost` instead of the `db`
|
|
49
|
+
service. Health checks look at one service at a time. The failures that hurt
|
|
50
|
+
most live *between* services: wrong hostnames, services on different
|
|
51
|
+
networks, host ports used inside the network, mismatched database
|
|
52
|
+
credentials.
|
|
53
|
+
|
|
54
|
+
StackDoctor checks those connections:
|
|
55
|
+
|
|
56
|
+
- **Deterministic.** `scan` and `validate` use plain rules, not AI, and need
|
|
57
|
+
no API key. They check the Compose configuration, and with `--live` the
|
|
58
|
+
running containers too.
|
|
59
|
+
- **Read-only.** It never starts, stops or changes your project.
|
|
60
|
+
- **Secrets stay secret.** Passwords, tokens and keys are redacted before
|
|
61
|
+
anything is printed, saved or sent to an AI provider.
|
|
62
|
+
- **Evidence for every finding.** Each finding points at the exact value it
|
|
63
|
+
is based on.
|
|
64
|
+
|
|
65
|
+
<p align="center">
|
|
66
|
+
<img src="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/demo-validate.svg" alt="Terminal output of stackdoctor validate on a project whose DATABASE_URL names the host postgress: error SD101, unknown host, with the hint Did you mean postgres? and the redacted URL as evidence" width="820">
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
StackDoctor needs Python 3.12 or later and the Docker CLI with the Compose
|
|
72
|
+
plugin. With [uv](https://docs.astral.sh/uv/), which also installs Python if
|
|
73
|
+
needed:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv tool install stackdoctor-cli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or from GitHub: `uv tool install "stackdoctor-cli @ git+https://github.com/13husseinH/stackdoctor@v1.0.1"`.
|
|
80
|
+
|
|
81
|
+
## Quickstart
|
|
82
|
+
|
|
83
|
+
Run it in a directory with a `compose.yaml`, or pass the directory:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
stackdoctor scan path/to/project # services, networks and dependencies
|
|
87
|
+
stackdoctor validate path/to/project # integration problems
|
|
88
|
+
stackdoctor validate --live # also check the running containers
|
|
89
|
+
stackdoctor validate --json # the report as JSON
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`validate` exits with code 1 when it finds an error (`--fail-on warning` to
|
|
93
|
+
fail on warnings too), so it fits in CI.
|
|
94
|
+
|
|
95
|
+
## GitHub Action
|
|
96
|
+
|
|
97
|
+
The action runs `validate` in a workflow: findings become annotations on the
|
|
98
|
+
Compose file, a findings table goes to the job summary, and the step fails on
|
|
99
|
+
findings. No AI and no API key.
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
103
|
+
with:
|
|
104
|
+
persist-credentials: false
|
|
105
|
+
- uses: 13husseinH/stackdoctor@v1.0.1 # or a full commit SHA
|
|
106
|
+
with:
|
|
107
|
+
path: deploy # the directory with compose.yaml
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Inputs, outputs and live checks are in the
|
|
111
|
+
[action's documentation](https://github.com/13husseinH/stackdoctor/blob/main/docs/github-action.md).
|
|
112
|
+
|
|
113
|
+
## AI diagnosis (optional)
|
|
114
|
+
|
|
115
|
+
`stackdoctor diagnose` lets an AI agent investigate with the same read-only
|
|
116
|
+
tools and explain the root cause. Every claim must cite evidence StackDoctor
|
|
117
|
+
collected, and the citations are checked in code. Install the extra for your
|
|
118
|
+
provider and set its key:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv tool install "stackdoctor-cli[gemini]"
|
|
122
|
+
export STACKDOCTOR_GEMINI_API_KEY=...
|
|
123
|
+
stackdoctor diagnose path/to/project
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| `--provider` | Extra | API key |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| `gemini` (default) | `gemini` | `STACKDOCTOR_GEMINI_API_KEY` |
|
|
129
|
+
| `groq` | `openai` | `STACKDOCTOR_GROQ_API_KEY` |
|
|
130
|
+
| `anthropic` | `anthropic` | `ANTHROPIC_API_KEY` |
|
|
131
|
+
| `ollama` | `openai` | none: a local server |
|
|
132
|
+
| `openai-compatible` | `openai` | the variable named with `--api-key-env` |
|
|
133
|
+
|
|
134
|
+
StackDoctor reads Gemini and Groq keys only from the `STACKDOCTOR_*`
|
|
135
|
+
variables, never from `GEMINI_API_KEY` or `GROQ_API_KEY`. Several extras
|
|
136
|
+
install together, as in `"stackdoctor-cli[gemini,openai]"`.
|
|
137
|
+
|
|
138
|
+
To keep keys in a `.env` file, let uv load it (StackDoctor never reads one
|
|
139
|
+
itself). A variable already set in your shell wins over the file:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
uvx --env-file .env --from "stackdoctor-cli[gemini]" stackdoctor diagnose path/to/project
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Keep that file outside your Compose project's directory, where Compose would
|
|
146
|
+
read it too.
|
|
147
|
+
|
|
148
|
+
Data is redacted before it is sent, but it is sent to the provider you choose;
|
|
149
|
+
with Ollama it stays on your machine. On the Gemini API free tier, Google may
|
|
150
|
+
use what it receives to improve its products. Each run is bounded by tool
|
|
151
|
+
calls, time, tokens and an estimated cost (default $0.10).
|
|
152
|
+
|
|
153
|
+
## Documentation
|
|
154
|
+
|
|
155
|
+
- [Usage](https://github.com/13husseinH/stackdoctor/blob/main/docs/usage.md):
|
|
156
|
+
every command, the rules, the AI diagnosis, the MCP server for Claude,
|
|
157
|
+
HolmesGPT and other clients, and exit codes
|
|
158
|
+
- [Live checks](https://github.com/13husseinH/stackdoctor/blob/main/docs/live-checks.md)
|
|
159
|
+
and [fault scenarios](https://github.com/13husseinH/stackdoctor/blob/main/docs/fault-scenarios.md)
|
|
160
|
+
- [LLM providers](https://github.com/13husseinH/stackdoctor/blob/main/docs/providers.md)
|
|
161
|
+
and [known issues](https://github.com/13husseinH/stackdoctor/blob/main/docs/known-issues.md)
|
|
162
|
+
- [Benchmark results and HolmesGPT comparison](https://github.com/13husseinH/stackdoctor/blob/main/docs/comparison/m6-results.md)
|
|
163
|
+
- [Architecture](https://github.com/13husseinH/stackdoctor/blob/main/docs/architecture.md)
|
|
164
|
+
- [Changelog](https://github.com/13husseinH/stackdoctor/blob/main/CHANGELOG.md),
|
|
165
|
+
[contributing](https://github.com/13husseinH/stackdoctor/blob/main/CONTRIBUTING.md)
|
|
166
|
+
and [security policy](https://github.com/13husseinH/stackdoctor/blob/main/SECURITY.md)
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
[Apache License 2.0](https://github.com/13husseinH/stackdoctor/blob/main/LICENSE).
|
|
171
|
+
StackDoctor contains no third-party source code; its dependencies are
|
|
172
|
+
installed separately under their own licenses (MIT or Apache-2.0). The test
|
|
173
|
+
corpus derived from [docker/awesome-compose](https://github.com/docker/awesome-compose)
|
|
174
|
+
is CC0-1.0 (see [its README](https://github.com/13husseinH/stackdoctor/blob/main/tests/corpus/README.md)).
|
|
175
|
+
StackDoctor is an independent project; it uses
|
|
176
|
+
[HolmesGPT](https://github.com/HolmesGPT/holmesgpt) as an architectural
|
|
177
|
+
reference but contains none of its code.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/stackdoctor-logo-dark.svg">
|
|
4
|
+
<img alt="StackDoctor logo: stacked containers with a heartbeat line" src="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/stackdoctor-logo-light.svg" width="160">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">StackDoctor</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center"><strong>Finds the broken connections between the services of a Docker Compose stack.</strong></p>
|
|
11
|
+
|
|
12
|
+
## Why StackDoctor
|
|
13
|
+
|
|
14
|
+
Every container in your stack reports **healthy**, yet the API can't reach
|
|
15
|
+
PostgreSQL: its connection string points at `localhost` instead of the `db`
|
|
16
|
+
service. Health checks look at one service at a time. The failures that hurt
|
|
17
|
+
most live *between* services: wrong hostnames, services on different
|
|
18
|
+
networks, host ports used inside the network, mismatched database
|
|
19
|
+
credentials.
|
|
20
|
+
|
|
21
|
+
StackDoctor checks those connections:
|
|
22
|
+
|
|
23
|
+
- **Deterministic.** `scan` and `validate` use plain rules, not AI, and need
|
|
24
|
+
no API key. They check the Compose configuration, and with `--live` the
|
|
25
|
+
running containers too.
|
|
26
|
+
- **Read-only.** It never starts, stops or changes your project.
|
|
27
|
+
- **Secrets stay secret.** Passwords, tokens and keys are redacted before
|
|
28
|
+
anything is printed, saved or sent to an AI provider.
|
|
29
|
+
- **Evidence for every finding.** Each finding points at the exact value it
|
|
30
|
+
is based on.
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/13husseinH/stackdoctor/main/docs/assets/demo-validate.svg" alt="Terminal output of stackdoctor validate on a project whose DATABASE_URL names the host postgress: error SD101, unknown host, with the hint Did you mean postgres? and the redacted URL as evidence" width="820">
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
StackDoctor needs Python 3.12 or later and the Docker CLI with the Compose
|
|
39
|
+
plugin. With [uv](https://docs.astral.sh/uv/), which also installs Python if
|
|
40
|
+
needed:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv tool install stackdoctor-cli
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or from GitHub: `uv tool install "stackdoctor-cli @ git+https://github.com/13husseinH/stackdoctor@v1.0.1"`.
|
|
47
|
+
|
|
48
|
+
## Quickstart
|
|
49
|
+
|
|
50
|
+
Run it in a directory with a `compose.yaml`, or pass the directory:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
stackdoctor scan path/to/project # services, networks and dependencies
|
|
54
|
+
stackdoctor validate path/to/project # integration problems
|
|
55
|
+
stackdoctor validate --live # also check the running containers
|
|
56
|
+
stackdoctor validate --json # the report as JSON
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`validate` exits with code 1 when it finds an error (`--fail-on warning` to
|
|
60
|
+
fail on warnings too), so it fits in CI.
|
|
61
|
+
|
|
62
|
+
## GitHub Action
|
|
63
|
+
|
|
64
|
+
The action runs `validate` in a workflow: findings become annotations on the
|
|
65
|
+
Compose file, a findings table goes to the job summary, and the step fails on
|
|
66
|
+
findings. No AI and no API key.
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
70
|
+
with:
|
|
71
|
+
persist-credentials: false
|
|
72
|
+
- uses: 13husseinH/stackdoctor@v1.0.1 # or a full commit SHA
|
|
73
|
+
with:
|
|
74
|
+
path: deploy # the directory with compose.yaml
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Inputs, outputs and live checks are in the
|
|
78
|
+
[action's documentation](https://github.com/13husseinH/stackdoctor/blob/main/docs/github-action.md).
|
|
79
|
+
|
|
80
|
+
## AI diagnosis (optional)
|
|
81
|
+
|
|
82
|
+
`stackdoctor diagnose` lets an AI agent investigate with the same read-only
|
|
83
|
+
tools and explain the root cause. Every claim must cite evidence StackDoctor
|
|
84
|
+
collected, and the citations are checked in code. Install the extra for your
|
|
85
|
+
provider and set its key:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uv tool install "stackdoctor-cli[gemini]"
|
|
89
|
+
export STACKDOCTOR_GEMINI_API_KEY=...
|
|
90
|
+
stackdoctor diagnose path/to/project
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
| `--provider` | Extra | API key |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| `gemini` (default) | `gemini` | `STACKDOCTOR_GEMINI_API_KEY` |
|
|
96
|
+
| `groq` | `openai` | `STACKDOCTOR_GROQ_API_KEY` |
|
|
97
|
+
| `anthropic` | `anthropic` | `ANTHROPIC_API_KEY` |
|
|
98
|
+
| `ollama` | `openai` | none: a local server |
|
|
99
|
+
| `openai-compatible` | `openai` | the variable named with `--api-key-env` |
|
|
100
|
+
|
|
101
|
+
StackDoctor reads Gemini and Groq keys only from the `STACKDOCTOR_*`
|
|
102
|
+
variables, never from `GEMINI_API_KEY` or `GROQ_API_KEY`. Several extras
|
|
103
|
+
install together, as in `"stackdoctor-cli[gemini,openai]"`.
|
|
104
|
+
|
|
105
|
+
To keep keys in a `.env` file, let uv load it (StackDoctor never reads one
|
|
106
|
+
itself). A variable already set in your shell wins over the file:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
uvx --env-file .env --from "stackdoctor-cli[gemini]" stackdoctor diagnose path/to/project
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Keep that file outside your Compose project's directory, where Compose would
|
|
113
|
+
read it too.
|
|
114
|
+
|
|
115
|
+
Data is redacted before it is sent, but it is sent to the provider you choose;
|
|
116
|
+
with Ollama it stays on your machine. On the Gemini API free tier, Google may
|
|
117
|
+
use what it receives to improve its products. Each run is bounded by tool
|
|
118
|
+
calls, time, tokens and an estimated cost (default $0.10).
|
|
119
|
+
|
|
120
|
+
## Documentation
|
|
121
|
+
|
|
122
|
+
- [Usage](https://github.com/13husseinH/stackdoctor/blob/main/docs/usage.md):
|
|
123
|
+
every command, the rules, the AI diagnosis, the MCP server for Claude,
|
|
124
|
+
HolmesGPT and other clients, and exit codes
|
|
125
|
+
- [Live checks](https://github.com/13husseinH/stackdoctor/blob/main/docs/live-checks.md)
|
|
126
|
+
and [fault scenarios](https://github.com/13husseinH/stackdoctor/blob/main/docs/fault-scenarios.md)
|
|
127
|
+
- [LLM providers](https://github.com/13husseinH/stackdoctor/blob/main/docs/providers.md)
|
|
128
|
+
and [known issues](https://github.com/13husseinH/stackdoctor/blob/main/docs/known-issues.md)
|
|
129
|
+
- [Benchmark results and HolmesGPT comparison](https://github.com/13husseinH/stackdoctor/blob/main/docs/comparison/m6-results.md)
|
|
130
|
+
- [Architecture](https://github.com/13husseinH/stackdoctor/blob/main/docs/architecture.md)
|
|
131
|
+
- [Changelog](https://github.com/13husseinH/stackdoctor/blob/main/CHANGELOG.md),
|
|
132
|
+
[contributing](https://github.com/13husseinH/stackdoctor/blob/main/CONTRIBUTING.md)
|
|
133
|
+
and [security policy](https://github.com/13husseinH/stackdoctor/blob/main/SECURITY.md)
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
[Apache License 2.0](https://github.com/13husseinH/stackdoctor/blob/main/LICENSE).
|
|
138
|
+
StackDoctor contains no third-party source code; its dependencies are
|
|
139
|
+
installed separately under their own licenses (MIT or Apache-2.0). The test
|
|
140
|
+
corpus derived from [docker/awesome-compose](https://github.com/docker/awesome-compose)
|
|
141
|
+
is CC0-1.0 (see [its README](https://github.com/13husseinH/stackdoctor/blob/main/tests/corpus/README.md)).
|
|
142
|
+
StackDoctor is an independent project; it uses
|
|
143
|
+
[HolmesGPT](https://github.com/HolmesGPT/holmesgpt) as an architectural
|
|
144
|
+
reference but contains none of its code.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "stackdoctor-cli"
|
|
3
|
+
version = "1.0.1"
|
|
4
|
+
description = "AI-powered integration validation and root cause analysis for containerized applications."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 5 - Production/Stable",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development :: Testing",
|
|
18
|
+
"Topic :: System :: Monitoring",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"mcp>=2.3.0",
|
|
23
|
+
"pydantic>=2.14.4",
|
|
24
|
+
"typer>=0.29.3",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[[project.authors]]
|
|
28
|
+
name = "Hussein Haidar Ahmad"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/13husseinH/stackdoctor"
|
|
32
|
+
Repository = "https://github.com/13husseinH/stackdoctor"
|
|
33
|
+
Issues = "https://github.com/13husseinH/stackdoctor/issues"
|
|
34
|
+
Changelog = "https://github.com/13husseinH/stackdoctor/blob/main/CHANGELOG.md"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
stackdoctor = "stackdoctor.cli:app"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
gemini = ["google-genai>=3.6.1"]
|
|
41
|
+
openai = ["openai>=3.60.0"]
|
|
42
|
+
anthropic = ["anthropic>=2.14.0"]
|
|
43
|
+
|
|
44
|
+
[build-system]
|
|
45
|
+
requires = ["uv_build>=0.13.10,<0.14.0"]
|
|
46
|
+
build-backend = "uv_build"
|
|
47
|
+
|
|
48
|
+
[tool.uv.build-backend]
|
|
49
|
+
module-name = "stackdoctor"
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 100
|
|
53
|
+
target-version = "py312"
|
|
54
|
+
src = [
|
|
55
|
+
"src",
|
|
56
|
+
"tests",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = [
|
|
61
|
+
"E",
|
|
62
|
+
"W",
|
|
63
|
+
"F",
|
|
64
|
+
"I",
|
|
65
|
+
"B",
|
|
66
|
+
"UP",
|
|
67
|
+
"SIM",
|
|
68
|
+
"RUF",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint.flake8-bugbear]
|
|
72
|
+
extend-immutable-calls = [
|
|
73
|
+
"typer.Option",
|
|
74
|
+
"typer.Argument",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[tool.mypy]
|
|
78
|
+
strict = true
|
|
79
|
+
files = [
|
|
80
|
+
"src",
|
|
81
|
+
"tests",
|
|
82
|
+
"scripts",
|
|
83
|
+
]
|
|
84
|
+
python_version = "3.12"
|
|
85
|
+
warn_unreachable = true
|
|
86
|
+
plugins = ["pydantic.mypy"]
|
|
87
|
+
|
|
88
|
+
[tool.pydantic-mypy]
|
|
89
|
+
init_forbid_extra = true
|
|
90
|
+
init_typed = true
|
|
91
|
+
warn_required_dynamic_aliases = true
|
|
92
|
+
|
|
93
|
+
[tool.pytest.ini_options]
|
|
94
|
+
testpaths = ["tests"]
|
|
95
|
+
addopts = [
|
|
96
|
+
"-ra",
|
|
97
|
+
"--strict-markers",
|
|
98
|
+
"--strict-config",
|
|
99
|
+
]
|
|
100
|
+
markers = [
|
|
101
|
+
"docker: needs the Docker CLI with Compose v2; opt in with --run-docker",
|
|
102
|
+
"runtime: starts containers from broken fixtures in isolation; opt in with --run-runtime",
|
|
103
|
+
"gemini: calls the real Gemini API; opt in with --run-gemini and STACKDOCTOR_GEMINI_API_KEY",
|
|
104
|
+
"groq: calls the real Groq API; opt in with --run-groq and STACKDOCTOR_GROQ_API_KEY",
|
|
105
|
+
"anthropic: calls the real Anthropic API; opt in with --run-anthropic and ANTHROPIC_API_KEY",
|
|
106
|
+
"ollama: calls a local Ollama server; opt in with --run-ollama",
|
|
107
|
+
"openai_compatible: calls STACKDOCTOR_LIVE_BASE_URL; opt in with --run-openai-compatible",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[tool.coverage.run]
|
|
111
|
+
source = ["stackdoctor"]
|
|
112
|
+
branch = true
|
|
113
|
+
patch = ["subprocess"]
|
|
114
|
+
|
|
115
|
+
[tool.coverage.report]
|
|
116
|
+
show_missing = true
|
|
117
|
+
skip_covered = false
|
|
118
|
+
|
|
119
|
+
[dependency-groups]
|
|
120
|
+
dev = [
|
|
121
|
+
"anthropic>=2.14.0",
|
|
122
|
+
"google-genai>=3.6.1",
|
|
123
|
+
"mypy>=2.4.1",
|
|
124
|
+
"openai>=3.60.0",
|
|
125
|
+
"pre-commit>=4.7.0",
|
|
126
|
+
"pytest>=9.2.0",
|
|
127
|
+
"pytest-cov>=7.1.0",
|
|
128
|
+
"ruff>=0.17.6",
|
|
129
|
+
]
|