winauto-cli 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wenqu
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,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: winauto-cli
3
+ Version: 0.1.0
4
+ Summary: A pragmatic Windows UI automation CLI built on top of pywinauto.
5
+ Author: wenqu
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/yourname/winauto-cli
8
+ Project-URL: Repository, https://github.com/yourname/winauto-cli
9
+ Project-URL: Issues, https://github.com/yourname/winauto-cli/issues
10
+ Keywords: windows,automation,uia,pywinauto,testing,cli
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Environment :: Console
18
+ Classifier: Topic :: Software Development :: Testing
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: pywinauto>=0.6.8
23
+ Dynamic: license-file
24
+
25
+ # winauto-cli
26
+
27
+ `winauto-cli` is a Python CLI wrapper around `pywinauto` for Windows desktop automation, with an Agent-oriented command surface for inspection, interaction, validation, and screenshot capture.
28
+
29
+ ## Install
30
+
31
+ ```powershell
32
+ pip install winauto-cli
33
+ ```
34
+
35
+ For local development:
36
+
37
+ ```powershell
38
+ pip install -e .
39
+ ```
40
+
41
+ ## Agent commands
42
+
43
+ These commands default to JSON output and are intended to be composed by an AI Agent.
44
+
45
+ ### `list-windows`
46
+
47
+ List top-level windows:
48
+
49
+ ```powershell
50
+ winauto-cli list-windows
51
+ ```
52
+
53
+ ### `find`
54
+
55
+ Return candidate matches instead of forcing a single element:
56
+
57
+ ```powershell
58
+ winauto-cli find --window-title "MyApp" --control-type Button --max-results 10
59
+ winauto-cli find --window-title "MyApp" --path "//Button[@name='Submit']"
60
+ winauto-cli find --window-title "MyApp" --path "Pane/Edit[0]"
61
+ ```
62
+
63
+ ### `inspect`
64
+
65
+ Inspect one resolved element and return its children, parent chain, supported patterns, recommended selectors, and recommended paths:
66
+
67
+ ```powershell
68
+ winauto-cli inspect --window-title "MyApp" --name "Submit"
69
+ winauto-cli inspect --window-title "MyApp" --path "//Button[@name='Submit']"
70
+ ```
71
+
72
+ `inspect` now returns path-oriented hints such as:
73
+
74
+ - `recommended_paths`
75
+ - `relative_path`
76
+
77
+ These are intended for Agent follow-up calls using `--path`.
78
+
79
+ ### `act`
80
+
81
+ Run a single action against a resolved element:
82
+
83
+ ```powershell
84
+ winauto-cli act --window-title "MyApp" --name "Submit" --action click
85
+ winauto-cli act --window-title "MyApp" --control-type Edit --action type --text "hello"
86
+ winauto-cli act --window-title "MyApp" --path "//Button[@name='Submit']" --action click
87
+ ```
88
+
89
+ ### `assert`
90
+
91
+ Validate existence, count, text, visibility, or enabled state:
92
+
93
+ ```powershell
94
+ winauto-cli assert --window-title "MyApp" --name "Submit" --assertion exists
95
+ winauto-cli assert --window-title "MyApp" --name "Submit" --assertion enabled --expected-bool true
96
+ winauto-cli assert --window-title "MyApp" --control-type Button --assertion count --expected 3
97
+ winauto-cli assert --window-title "MyApp" --path "//Button[@name='Submit']" --assertion exists
98
+ ```
99
+
100
+ ### `screenshot`
101
+
102
+ Capture a screenshot for a resolved window or element:
103
+
104
+ ```powershell
105
+ winauto-cli screenshot --window-title "MyApp" --out app-window.png
106
+ winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --out submit-button.png
107
+ winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --highlight --out submit-button-marked.png
108
+ ```
109
+
110
+ Useful highlight options:
111
+
112
+ - `--highlight`
113
+ - `--highlight-duration-ms 800`
114
+ - `--highlight-colour red`
115
+ - `--highlight-thickness 3`
116
+
117
+ ## Path DSL
118
+
119
+ The `--path` query is XPath-like, but intentionally smaller and desktop-focused.
120
+
121
+ Supported forms:
122
+
123
+ - `//Button`
124
+ - `//Button[@name='Submit']`
125
+ - `//Edit[@auto_id='txtUsername']`
126
+ - `Pane/Edit[0]`
127
+ - `//Pane[@class_name='Toolbar']/Button[1]`
128
+
129
+ Rules:
130
+
131
+ - `/` means direct child step.
132
+ - `//` means descendant step.
133
+ - `Type` matches `control_type`.
134
+ - `[@name='x']`, `[@auto_id='x']`, `[@class_name='x']`, `[@control_type='x']`, `[@window_text='x']` are supported.
135
+ - `[0]`, `[1]`, ... select by zero-based index after a step is filtered.
136
+
137
+ ## Compatibility commands
138
+
139
+ These are retained as convenience wrappers over the newer primitives.
140
+
141
+ - `dump`
142
+ - `click`
143
+ - `type`
144
+
145
+ Examples:
146
+
147
+ ```powershell
148
+ winauto-cli dump --window-title "MyApp"
149
+ winauto-cli click --window-title "MyApp" --name "Submit"
150
+ winauto-cli type --window-title "MyApp" --control-type Edit --text "hello from cli"
151
+ ```
152
+
153
+ ## Selector model
154
+
155
+ Parent window options:
156
+
157
+ - `--window-title`
158
+ - `--window-title-re`
159
+ - `--window-class-name`
160
+ - `--window-auto-id`
161
+
162
+ Target element options:
163
+
164
+ - `--name`
165
+ - `--auto-id`
166
+ - `--control-type`
167
+ - `--class-name`
168
+ - `--index`
169
+ - `--path`
170
+
171
+ Runtime options:
172
+
173
+ - `--backend {uia,win32}`
174
+ - `--timeout <seconds>`
175
+ - `--top-level-only`
176
+ - `--verbose`
177
+ - `--json`
178
+
179
+ ## Design intent
180
+
181
+ The project is optimized for AI-assisted test authoring and debugging:
182
+
183
+ - `find` returns candidate sets instead of hiding ambiguity.
184
+ - `inspect` exposes enough metadata to refine selectors.
185
+ - `act` separates action execution from selector debugging.
186
+ - `assert` closes the loop for script verification.
187
+ - `screenshot` provides visual verification and failure evidence.
188
+ - `--path` provides a bridge between raw tree exploration and stable scripted lookup.
189
+ - Compatibility commands remain available for quick manual use.
190
+
191
+ ## License
192
+
193
+ This project is licensed under the MIT License. See `LICENSE`.
194
+
195
+ Third-party dependencies keep their own licenses. See `THIRD_PARTY_NOTICES.md`.
196
+
197
+ ## Publishing
198
+
199
+ Build distributions:
200
+
201
+ ```powershell
202
+ python -m pip install build twine
203
+ python -m build
204
+ python -m twine check dist/*
205
+ ```
206
+
207
+ Test on TestPyPI first:
208
+
209
+ ```powershell
210
+ python -m twine upload --repository testpypi dist/*
211
+ ```
212
+
213
+ Then publish to PyPI:
214
+
215
+ ```powershell
216
+ python -m twine upload dist/*
217
+ ```
@@ -0,0 +1,193 @@
1
+ # winauto-cli
2
+
3
+ `winauto-cli` is a Python CLI wrapper around `pywinauto` for Windows desktop automation, with an Agent-oriented command surface for inspection, interaction, validation, and screenshot capture.
4
+
5
+ ## Install
6
+
7
+ ```powershell
8
+ pip install winauto-cli
9
+ ```
10
+
11
+ For local development:
12
+
13
+ ```powershell
14
+ pip install -e .
15
+ ```
16
+
17
+ ## Agent commands
18
+
19
+ These commands default to JSON output and are intended to be composed by an AI Agent.
20
+
21
+ ### `list-windows`
22
+
23
+ List top-level windows:
24
+
25
+ ```powershell
26
+ winauto-cli list-windows
27
+ ```
28
+
29
+ ### `find`
30
+
31
+ Return candidate matches instead of forcing a single element:
32
+
33
+ ```powershell
34
+ winauto-cli find --window-title "MyApp" --control-type Button --max-results 10
35
+ winauto-cli find --window-title "MyApp" --path "//Button[@name='Submit']"
36
+ winauto-cli find --window-title "MyApp" --path "Pane/Edit[0]"
37
+ ```
38
+
39
+ ### `inspect`
40
+
41
+ Inspect one resolved element and return its children, parent chain, supported patterns, recommended selectors, and recommended paths:
42
+
43
+ ```powershell
44
+ winauto-cli inspect --window-title "MyApp" --name "Submit"
45
+ winauto-cli inspect --window-title "MyApp" --path "//Button[@name='Submit']"
46
+ ```
47
+
48
+ `inspect` now returns path-oriented hints such as:
49
+
50
+ - `recommended_paths`
51
+ - `relative_path`
52
+
53
+ These are intended for Agent follow-up calls using `--path`.
54
+
55
+ ### `act`
56
+
57
+ Run a single action against a resolved element:
58
+
59
+ ```powershell
60
+ winauto-cli act --window-title "MyApp" --name "Submit" --action click
61
+ winauto-cli act --window-title "MyApp" --control-type Edit --action type --text "hello"
62
+ winauto-cli act --window-title "MyApp" --path "//Button[@name='Submit']" --action click
63
+ ```
64
+
65
+ ### `assert`
66
+
67
+ Validate existence, count, text, visibility, or enabled state:
68
+
69
+ ```powershell
70
+ winauto-cli assert --window-title "MyApp" --name "Submit" --assertion exists
71
+ winauto-cli assert --window-title "MyApp" --name "Submit" --assertion enabled --expected-bool true
72
+ winauto-cli assert --window-title "MyApp" --control-type Button --assertion count --expected 3
73
+ winauto-cli assert --window-title "MyApp" --path "//Button[@name='Submit']" --assertion exists
74
+ ```
75
+
76
+ ### `screenshot`
77
+
78
+ Capture a screenshot for a resolved window or element:
79
+
80
+ ```powershell
81
+ winauto-cli screenshot --window-title "MyApp" --out app-window.png
82
+ winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --out submit-button.png
83
+ winauto-cli screenshot --window-title "MyApp" --path "//Button[@name='Submit']" --highlight --out submit-button-marked.png
84
+ ```
85
+
86
+ Useful highlight options:
87
+
88
+ - `--highlight`
89
+ - `--highlight-duration-ms 800`
90
+ - `--highlight-colour red`
91
+ - `--highlight-thickness 3`
92
+
93
+ ## Path DSL
94
+
95
+ The `--path` query is XPath-like, but intentionally smaller and desktop-focused.
96
+
97
+ Supported forms:
98
+
99
+ - `//Button`
100
+ - `//Button[@name='Submit']`
101
+ - `//Edit[@auto_id='txtUsername']`
102
+ - `Pane/Edit[0]`
103
+ - `//Pane[@class_name='Toolbar']/Button[1]`
104
+
105
+ Rules:
106
+
107
+ - `/` means direct child step.
108
+ - `//` means descendant step.
109
+ - `Type` matches `control_type`.
110
+ - `[@name='x']`, `[@auto_id='x']`, `[@class_name='x']`, `[@control_type='x']`, `[@window_text='x']` are supported.
111
+ - `[0]`, `[1]`, ... select by zero-based index after a step is filtered.
112
+
113
+ ## Compatibility commands
114
+
115
+ These are retained as convenience wrappers over the newer primitives.
116
+
117
+ - `dump`
118
+ - `click`
119
+ - `type`
120
+
121
+ Examples:
122
+
123
+ ```powershell
124
+ winauto-cli dump --window-title "MyApp"
125
+ winauto-cli click --window-title "MyApp" --name "Submit"
126
+ winauto-cli type --window-title "MyApp" --control-type Edit --text "hello from cli"
127
+ ```
128
+
129
+ ## Selector model
130
+
131
+ Parent window options:
132
+
133
+ - `--window-title`
134
+ - `--window-title-re`
135
+ - `--window-class-name`
136
+ - `--window-auto-id`
137
+
138
+ Target element options:
139
+
140
+ - `--name`
141
+ - `--auto-id`
142
+ - `--control-type`
143
+ - `--class-name`
144
+ - `--index`
145
+ - `--path`
146
+
147
+ Runtime options:
148
+
149
+ - `--backend {uia,win32}`
150
+ - `--timeout <seconds>`
151
+ - `--top-level-only`
152
+ - `--verbose`
153
+ - `--json`
154
+
155
+ ## Design intent
156
+
157
+ The project is optimized for AI-assisted test authoring and debugging:
158
+
159
+ - `find` returns candidate sets instead of hiding ambiguity.
160
+ - `inspect` exposes enough metadata to refine selectors.
161
+ - `act` separates action execution from selector debugging.
162
+ - `assert` closes the loop for script verification.
163
+ - `screenshot` provides visual verification and failure evidence.
164
+ - `--path` provides a bridge between raw tree exploration and stable scripted lookup.
165
+ - Compatibility commands remain available for quick manual use.
166
+
167
+ ## License
168
+
169
+ This project is licensed under the MIT License. See `LICENSE`.
170
+
171
+ Third-party dependencies keep their own licenses. See `THIRD_PARTY_NOTICES.md`.
172
+
173
+ ## Publishing
174
+
175
+ Build distributions:
176
+
177
+ ```powershell
178
+ python -m pip install build twine
179
+ python -m build
180
+ python -m twine check dist/*
181
+ ```
182
+
183
+ Test on TestPyPI first:
184
+
185
+ ```powershell
186
+ python -m twine upload --repository testpypi dist/*
187
+ ```
188
+
189
+ Then publish to PyPI:
190
+
191
+ ```powershell
192
+ python -m twine upload dist/*
193
+ ```
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "winauto-cli"
7
+ version = "0.1.0"
8
+ description = "A pragmatic Windows UI automation CLI built on top of pywinauto."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "wenqu" },
14
+ ]
15
+ keywords = ["windows", "automation", "uia", "pywinauto", "testing", "cli"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Operating System :: Microsoft :: Windows",
23
+ "Environment :: Console",
24
+ "Topic :: Software Development :: Testing",
25
+ ]
26
+ dependencies = [
27
+ "pywinauto>=0.6.8",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/yourname/winauto-cli"
32
+ Repository = "https://github.com/yourname/winauto-cli"
33
+ Issues = "https://github.com/yourname/winauto-cli/issues"
34
+
35
+ [project.scripts]
36
+ winauto-cli = "winauto_cli.cli:main"
37
+
38
+ [tool.setuptools]
39
+ include-package-data = true
40
+
41
+ [tool.setuptools.packages.find]
42
+ include = ["winauto_cli*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ __all__ = ["__version__"]
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ from winauto_cli.cli import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ raise SystemExit(main())