code-workflow-probe 0.1.4__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.
@@ -0,0 +1,32 @@
1
+ # Virtual environments
2
+ .venv/
3
+ venv/
4
+ env/
5
+
6
+ # Local environment files
7
+ .env*
8
+ !.env.example
9
+
10
+ # Python bytecode and caches
11
+ __pycache__/
12
+ *.pyc
13
+ *.pyo
14
+ *.pyd
15
+
16
+ # Test and tool caches
17
+ .pytest_cache/
18
+ .ruff_cache/
19
+ .mypy_cache/
20
+ .pyright/
21
+ .code-symbol-index/
22
+ .coverage
23
+ .coverage.*
24
+ htmlcov/
25
+
26
+ # Build outputs
27
+ build/
28
+ dist/
29
+ *.egg-info/
30
+
31
+ # Local probe cache
32
+ .code-workflow-probe.json
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## 0.1.4 - 2026-05-23
4
+
5
+ - Included adjacent lock/config evidence files next to discovered manifests even when those files are ignored by `.gitignore`.
6
+ - Fixed package manager detection for ignored lockfiles such as `uv.lock` and `package-lock.json`.
7
+
8
+ ## 0.1.3 - 2026-05-23
9
+
10
+ - Improved default text output readability with stable `summary`, `components`, and workflow sections.
11
+
12
+ ## 0.1.2 - 2026-05-23
13
+
14
+ - Added `status --detail compact|standard|full`, `--depth`, and `--limit` for bounded AI-focused status output with workflow command previews.
15
+ - Added deterministic detectors for Deno, Ruby/Bundler, PHP/Composer, .NET, and SwiftPM.
16
+
17
+ ## 0.1.1 - 2026-05-23
18
+
19
+ - Added `sync_async(...)` Python API for background-thread sync.
20
+ - Added path-only sync, incremental reuse for edit/affected flows, and compact progress output.
21
+ - Made default status output shorter for large repositories.
22
+ - Updated Codex skill guidance for incremental sync, path-only sync, full scans, and progress.
23
+ - Documented Python API signatures and examples in README.
24
+
25
+ ## 0.1.0 - 2026-05-23
26
+
27
+ - Initial release.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hit9
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,69 @@
1
+ UV ?= uv
2
+ MODULE := code_workflow_probe
3
+ CACHE ?= .code-workflow-probe.json
4
+ PUBLISH_ARGS ?=
5
+
6
+ .PHONY: help install sync test check smoke status build publish clean version
7
+
8
+ help:
9
+ @printf '%s\n' \
10
+ 'Targets:' \
11
+ ' make install Sync the uv environment' \
12
+ ' make sync Alias for install' \
13
+ ' make test Run pytest' \
14
+ ' make check Run syntax checks and tests' \
15
+ ' make smoke Run a small CLI/API smoke test' \
16
+ ' make status Show an AI-focused project workflow summary' \
17
+ ' make build Build package artifacts' \
18
+ ' make publish Check, build, and publish package artifacts with uv' \
19
+ ' make clean Remove local test/build/probe artifacts' \
20
+ ' make version Print package version'
21
+
22
+ install:
23
+ $(UV) sync
24
+
25
+ sync: install
26
+
27
+ test:
28
+ $(UV) run pytest
29
+
30
+ check:
31
+ $(UV) run python -m py_compile $(MODULE).py tests/test_code_workflow_probe.py
32
+ $(UV) run pytest
33
+
34
+ smoke:
35
+ @tmp=$$(mktemp -d); \
36
+ trap 'rm -rf "$$tmp"' EXIT; \
37
+ mkdir -p "$$tmp/tests"; \
38
+ printf '%s\n' \
39
+ '[project]' \
40
+ 'name = "sample"' \
41
+ 'version = "0.1.0"' \
42
+ 'dependencies = ["pytest", "ruff"]' \
43
+ '[tool.pytest.ini_options]' \
44
+ 'testpaths = ["tests"]' \
45
+ '[tool.ruff]' \
46
+ 'line-length = 100' > "$$tmp/pyproject.toml"; \
47
+ printf '%s\n' 'def test_ok():' ' assert True' > "$$tmp/tests/test_sample.py"; \
48
+ $(UV) run python $(MODULE).py sync --root "$$tmp" --format json --compact >/dev/null; \
49
+ $(UV) run python $(MODULE).py status --root "$$tmp" >/dev/null; \
50
+ $(UV) run python $(MODULE).py affected --root "$$tmp" --changed tests/test_sample.py >/dev/null
51
+
52
+ status:
53
+ $(UV) run python $(MODULE).py status --root . --detail standard --depth 2 --limit 20
54
+
55
+ build:
56
+ $(UV) build
57
+
58
+ publish: check
59
+ rm -rf dist
60
+ $(UV) build
61
+ $(UV) publish $(PUBLISH_ARGS)
62
+
63
+ clean:
64
+ rm -rf .pytest_cache __pycache__ tests/__pycache__
65
+ rm -rf build dist *.egg-info
66
+ rm -f $(CACHE)
67
+
68
+ version:
69
+ @$(UV) run python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])'
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-workflow-probe
3
+ Version: 0.1.4
4
+ Summary: Deterministic repo workflow profile syncer for AI coding tools.
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.11
@@ -0,0 +1,177 @@
1
+ # code-workflow-probe
2
+
3
+ Pure-Python repo workflow profile syncer for AI coding tools.
4
+
5
+ It deterministically reads repo files such as manifests, lockfiles, task runners, CI files, and tool config, then returns an aligned profile of components, package managers, workflows, evidence files, fingerprints, confidence, and execution safety.
6
+
7
+ It does not use an LLM and does not guess missing workflows.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ uv tool install code-workflow-probe
13
+ ```
14
+
15
+ ## Evidence Model
16
+
17
+ Detectors parse structured files such as `pyproject.toml`, `package.json`, lockfiles, task runners, and CI config. For example, Python pytest workflow detection treats `pytest.ini`, `setup.cfg` pytest sections, or `[tool.pytest...]` in `pyproject.toml` as high-confidence test config evidence.
18
+
19
+ Dependencies such as `pytest` or `ruff` can identify the tech stack, but they do not by themselves create a high-confidence workflow command. If only test files are found without pytest config, the pytest command is marked as a lower-confidence candidate.
20
+
21
+ Current deterministic detector families include JavaScript/TypeScript, Deno, Python, Go, Rust, Java/JVM, Ruby/Bundler, PHP/Composer, .NET, and SwiftPM.
22
+
23
+ ## Quick Use
24
+
25
+ ```bash
26
+ code-workflow-probe sync --root .
27
+ code-workflow-probe status --root .
28
+ code-workflow-probe edit --root . --changed path/to/file
29
+ code-workflow-probe affected --root . --changed path/to/file
30
+ ```
31
+
32
+ Default output is concise text for LLM context. Use JSON for structured consumers:
33
+
34
+ ```bash
35
+ code-workflow-probe sync --root . --format json
36
+ ```
37
+
38
+ ## Text Format
39
+
40
+ The default text format is optimized as bounded context for AI coding tools:
41
+
42
+ - It starts with alignment so stale profiles are not silently trusted.
43
+ - It uses stable sections such as `summary`, `components`, `workflows.safe_auto`, `workflows.needs_review`, and `evidence`.
44
+ - It names project type, tech stack, package manager, component path, and workflow `cwd`.
45
+ - It includes concrete local workflow commands for install, test, lint, format, build, and dev when evidence supports them.
46
+ - It marks non-obvious execution safety with `candidate`, `risk=...`, `conf=...`, and `ci-only` notes.
47
+ - It keeps evidence as a short file preview by default; use `--verbose` for fingerprints and full evidence.
48
+
49
+ Use `--verbose` when you need full evidence and fingerprints.
50
+
51
+ Use `sync --changed ...` for incremental cache reuse after known file edits:
52
+
53
+ ```bash
54
+ code-workflow-probe sync --root . --changed src/app.py
55
+ ```
56
+
57
+ Use `--paths-only` when you want sync to trust only the explicit changed paths plus the existing cache, without discovering the whole repo:
58
+
59
+ ```bash
60
+ code-workflow-probe sync --root . --changed pyproject.toml --paths-only
61
+ ```
62
+
63
+ Use `--progress` to print sync progress to stderr, and `--full` to force a full scan.
64
+
65
+ ## Status Output
66
+
67
+ `status` has three text detail levels:
68
+
69
+ ```bash
70
+ code-workflow-probe status --root . # compact: tech, package managers, workflow commands
71
+ code-workflow-probe status --root . --detail standard # component structure plus workflow commands
72
+ code-workflow-probe status --root . --detail full # full component/workflow/evidence listing
73
+ ```
74
+
75
+ Use `--depth N` and `--limit N` to control the structural preview in `standard`:
76
+
77
+ ```bash
78
+ code-workflow-probe status --root . --detail standard --depth 2 --limit 20
79
+ ```
80
+
81
+ The compact and standard text outputs are designed for AI coding context:
82
+
83
+ - They include the aligned state, project type, detected tech stack, package managers, and local workflow commands.
84
+ - Workflow preview order is `test`, `lint`, `format`, `build`, `install`, then `dev`.
85
+ - Workflow lines include `cwd` and `command`, plus candidate/risk/confidence notes when relevant.
86
+ - CI-only workflows are counted but not mixed into local command recommendations.
87
+
88
+ In `standard`, components are shown as a bounded repo structure preview:
89
+
90
+ - Components are sorted by path ascending.
91
+ - `depth` limits how deep component paths can be.
92
+ - `limit` caps displayed workflow, component, stale, and evidence previews.
93
+ - Hidden counts are reported separately.
94
+
95
+ `--verbose` is kept as an alias for full status text.
96
+
97
+ ## Python API
98
+
99
+ ```python
100
+ from code_workflow_probe import affected, edit, install_skill, status, sync, sync_async
101
+ ```
102
+
103
+ APIs return concise text by default. Pass `format="json"` to get dictionaries.
104
+
105
+ ```python
106
+ sync(root=".", cache_path=None, changed_files=None, write=True, format="text", verbose=False, incremental=True, paths_only=False, progress=None)
107
+ ```
108
+
109
+ Build an aligned profile and optionally write the cache. With `changed_files`, it can reuse an aligned cache when the changes do not affect profile evidence. With `paths_only=True`, it avoids whole-repo discovery and updates only from explicit changed paths plus the existing cache.
110
+
111
+ ```python
112
+ sync_async(root=".", cache_path=None, changed_files=None, write=True, format="text", verbose=False, incremental=True, paths_only=False, progress=None, executor=None)
113
+ ```
114
+
115
+ Run `sync` in a background thread and return a `concurrent.futures.Future`. If `executor` is omitted, a one-shot thread pool is created and shut down after completion.
116
+
117
+ ```python
118
+ status(root=".", cache_path=None, format="text", verbose=False, detail="compact", limit=8, depth=2)
119
+ ```
120
+
121
+ Check whether the cached profile still matches current evidence files. Text `detail` can be `compact`, `standard`, or `full`; JSON returns the structured data.
122
+
123
+ ```python
124
+ edit(root=".", changed_files=None, cache_path=None, format="text", verbose=False)
125
+ ```
126
+
127
+ Notify changed files; resync if the changes affect workflow evidence.
128
+
129
+ ```python
130
+ affected(root=".", changed_files=None, cache_path=None, format="text", verbose=False)
131
+ ```
132
+
133
+ Map changed files to affected components and suggested local workflows.
134
+
135
+ ```python
136
+ install_skill(tool="codex", skills_dir=None, dry_run=False, overwrite=True, format="text", verbose=False)
137
+ ```
138
+
139
+ Install the Codex skill.
140
+
141
+ ### API Examples
142
+
143
+ ```python
144
+ import code_workflow_probe as cwp
145
+
146
+ print(cwp.sync("."))
147
+
148
+ profile = cwp.sync(".", format="json")
149
+ if profile["alignment"]["aligned"]:
150
+ print(profile["project"]["components"])
151
+
152
+ result = cwp.affected(".", ["src/app.py"], format="json")
153
+ for workflow in result["suggested_workflows"]:
154
+ if workflow["safe_auto"]:
155
+ print(workflow["cwd"], workflow["command"])
156
+
157
+ future = cwp.sync_async(".", format="json")
158
+ profile = future.result(timeout=30)
159
+ ```
160
+
161
+ ## Codex Skill
162
+
163
+ ```bash
164
+ code-workflow-probe install-skill
165
+ ```
166
+
167
+ The installed skill tells Codex to call `sync` at task start, use `edit` / `affected` after file changes, and run `sync` again after editing project or workflow management files such as manifests, lockfiles, CI, task runner, test, lint, format, or build config.
168
+
169
+ ## Safety
170
+
171
+ Only auto-run workflows that are local, aligned, high confidence, low risk, and marked `safe_auto=true`.
172
+
173
+ Treat CI-only, candidate, stale, risky, or low-confidence workflows as requiring review.
174
+
175
+ ## License
176
+
177
+ MIT