agent-xplat 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.
- agent_xplat-1.0.1/LICENSE +21 -0
- agent_xplat-1.0.1/PKG-INFO +292 -0
- agent_xplat-1.0.1/README.md +264 -0
- agent_xplat-1.0.1/pyproject.toml +51 -0
- agent_xplat-1.0.1/setup.cfg +4 -0
- agent_xplat-1.0.1/src/agent_xplat/__init__.py +3 -0
- agent_xplat-1.0.1/src/agent_xplat/__main__.py +5 -0
- agent_xplat-1.0.1/src/agent_xplat/baseline.py +66 -0
- agent_xplat-1.0.1/src/agent_xplat/cli.py +211 -0
- agent_xplat-1.0.1/src/agent_xplat/config.py +295 -0
- agent_xplat-1.0.1/src/agent_xplat/contracts.py +41 -0
- agent_xplat-1.0.1/src/agent_xplat/diff.py +72 -0
- agent_xplat-1.0.1/src/agent_xplat/discovery.py +113 -0
- agent_xplat-1.0.1/src/agent_xplat/doctor.py +41 -0
- agent_xplat-1.0.1/src/agent_xplat/engine.py +149 -0
- agent_xplat-1.0.1/src/agent_xplat/env.py +24 -0
- agent_xplat-1.0.1/src/agent_xplat/environments.py +47 -0
- agent_xplat-1.0.1/src/agent_xplat/executables.py +16 -0
- agent_xplat-1.0.1/src/agent_xplat/explain.py +39 -0
- agent_xplat-1.0.1/src/agent_xplat/fixing.py +78 -0
- agent_xplat-1.0.1/src/agent_xplat/init.py +125 -0
- agent_xplat-1.0.1/src/agent_xplat/line_endings.py +19 -0
- agent_xplat-1.0.1/src/agent_xplat/models.py +199 -0
- agent_xplat-1.0.1/src/agent_xplat/parsers.py +347 -0
- agent_xplat-1.0.1/src/agent_xplat/reporting.py +238 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/__init__.py +5 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/agent_config.py +33 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/common.py +96 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/external_tools.py +42 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/filesystem.py +47 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/node.py +105 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/node_ast.py +499 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/package_managers.py +29 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/paths.py +288 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/python.py +172 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/quoting.py +119 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/registry.py +115 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/runtimes.py +28 -0
- agent_xplat-1.0.1/src/agent_xplat/rules/shell.py +180 -0
- agent_xplat-1.0.1/src/agent_xplat/schemas.py +210 -0
- agent_xplat-1.0.1/src/agent_xplat/scoring.py +42 -0
- agent_xplat-1.0.1/src/agent_xplat/suppression.py +68 -0
- agent_xplat-1.0.1/src/agent_xplat/terminal.py +13 -0
- agent_xplat-1.0.1/src/agent_xplat/verification.py +116 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/PKG-INFO +292 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/SOURCES.txt +70 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/dependency_links.txt +1 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/entry_points.txt +2 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/requires.txt +6 -0
- agent_xplat-1.0.1/src/agent_xplat.egg-info/top_level.txt +1 -0
- agent_xplat-1.0.1/tests/test_baseline_diff.py +29 -0
- agent_xplat-1.0.1/tests/test_cli.py +34 -0
- agent_xplat-1.0.1/tests/test_cli_extra.py +43 -0
- agent_xplat-1.0.1/tests/test_cli_smoke.py +11 -0
- agent_xplat-1.0.1/tests/test_documentation_contract.py +23 -0
- agent_xplat-1.0.1/tests/test_engine_scoring.py +25 -0
- agent_xplat-1.0.1/tests/test_false_positive_controls.py +94 -0
- agent_xplat-1.0.1/tests/test_fixing.py +29 -0
- agent_xplat-1.0.1/tests/test_fixtures.py +30 -0
- agent_xplat-1.0.1/tests/test_init_commands.py +29 -0
- agent_xplat-1.0.1/tests/test_models_config_discovery.py +99 -0
- agent_xplat-1.0.1/tests/test_parsers.py +91 -0
- agent_xplat-1.0.1/tests/test_regression.py +22 -0
- agent_xplat-1.0.1/tests/test_reports.py +59 -0
- agent_xplat-1.0.1/tests/test_rules_additional.py +67 -0
- agent_xplat-1.0.1/tests/test_rules_languages.py +276 -0
- agent_xplat-1.0.1/tests/test_rules_paths_shell.py +57 -0
- agent_xplat-1.0.1/tests/test_schema_sarif.py +97 -0
- agent_xplat-1.0.1/tests/test_snapshots.py +16 -0
- agent_xplat-1.0.1/tests/test_support_modules.py +14 -0
- agent_xplat-1.0.1/tests/test_suppression_contract.py +40 -0
- agent_xplat-1.0.1/tests/test_verification.py +27 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agent-xplat 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,292 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-xplat
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Detect cross-OS portability issues in AI agent workflows, skills, configs, and scripts.
|
|
5
|
+
Author: agent-xplat contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kwhi6693-web/agent-xplat
|
|
8
|
+
Project-URL: Repository, https://github.com/kwhi6693-web/agent-xplat
|
|
9
|
+
Project-URL: Documentation, https://github.com/kwhi6693-web/agent-xplat#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/kwhi6693-web/agent-xplat/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/kwhi6693-web/agent-xplat/blob/master/CHANGELOG.md
|
|
12
|
+
Keywords: ai-agent,agent-skills,cross-platform,portability,static-analysis,sarif
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: tree-sitter<0.27,>=0.26
|
|
23
|
+
Requires-Dist: tree-sitter-javascript<0.26,>=0.25
|
|
24
|
+
Requires-Dist: tree-sitter-typescript<0.24,>=0.23
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# agent-xplat
|
|
30
|
+
|
|
31
|
+
[](https://github.com/kwhi6693-web/agent-xplat/actions/workflows/agent-xplat.yml)
|
|
32
|
+
|
|
33
|
+
Find the OS assumptions that break AI-agent workflows.
|
|
34
|
+
|
|
35
|
+
Windows ✓<br>
|
|
36
|
+
macOS ✓<br>
|
|
37
|
+
Linux ✓
|
|
38
|
+
|
|
39
|
+
Verified on real GitHub-hosted runners. The hosted jobs exercise Windows PowerShell, macOS zsh, and Linux bash; the static scan covers the full eight-target OS × Shell × Runtime matrix.
|
|
40
|
+
|
|
41
|
+
`agent-xplat` is a deterministic cross-OS portability checker for AI agent workflows, Agent Skills, agent configuration, and related scripts. It reports where a workflow can fail across **Windows, macOS, and Linux**, including the shell and runtime context—not just the operating system.
|
|
42
|
+
|
|
43
|
+
Skill validators check structure and linters check style; agent-xplat checks the OS × Shell × Runtime assumptions that make an otherwise valid workflow fail on another platform.
|
|
44
|
+
|
|
45
|
+
Fastest install from the published v1.0.1 release:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python -m pip install https://github.com/kwhi6693-web/agent-xplat/releases/download/v1.0.1/agent_xplat-1.0.1-py3-none-any.whl
|
|
49
|
+
agent-xplat scan .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After a formal release has been published to PyPI through Trusted Publishing,
|
|
53
|
+
the standard install is:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python -m pip install agent-xplat
|
|
57
|
+
agent-xplat scan .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
agent-xplat scan .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Example from the included mixed-platform fixture:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
Agent Workflow Portability
|
|
68
|
+
===========================
|
|
69
|
+
|
|
70
|
+
Compatibility Matrix
|
|
71
|
+
---------------------
|
|
72
|
+
Environment Score Status Findings
|
|
73
|
+
Windows / PowerShell 41/100 BLOCKED 4
|
|
74
|
+
Windows / CMD 1/100 BLOCKED 6
|
|
75
|
+
Windows / Git Bash 76/100 PARTIAL 3
|
|
76
|
+
Windows / WSL 76/100 PARTIAL 3
|
|
77
|
+
macOS / zsh 56/100 PARTIAL 4
|
|
78
|
+
macOS / bash 56/100 PARTIAL 4
|
|
79
|
+
Linux / bash 56/100 PARTIAL 4
|
|
80
|
+
Linux / zsh 56/100 PARTIAL 4
|
|
81
|
+
|
|
82
|
+
7 portability issues found (0 ignored)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The scores are deterministic and explainable. Static findings are marked as inferred; only a real runner or local runtime check can produce verified evidence.
|
|
86
|
+
|
|
87
|
+
## Why it exists
|
|
88
|
+
|
|
89
|
+
Agent workflows often mix Markdown instructions, shell snippets, Python, Node scripts, package managers, and external tools. A workflow can be valid on Linux Bash and still fail in Windows PowerShell, Windows CMD, Git Bash, WSL, or macOS zsh. General linters and security scanners are not designed to answer that portability question.
|
|
90
|
+
|
|
91
|
+
The boundary is deliberate: agent-xplat is not a security scanner, Agent Skill schema validator, benchmark, general linter, or repository health tool. It focuses on **Cross-OS Runtime Portability for AI Agent Workflows**.
|
|
92
|
+
|
|
93
|
+
## Quick start
|
|
94
|
+
|
|
95
|
+
Install from a checkout:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python -m pip install .
|
|
99
|
+
agent-xplat scan .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For development:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python -m pip install -e ".[dev]"
|
|
106
|
+
python -m pytest -q
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The module invocation is always available as a fallback:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
python -m agent_xplat scan . --format json
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Installation
|
|
116
|
+
|
|
117
|
+
Python 3.10 or newer is required. The v1.0.1 GitHub Release publishes a wheel and source distribution; the direct wheel URL is shown above. The runtime package includes the small Tree-sitter parser bindings needed for JavaScript/JSX/TypeScript/TSX AST analysis; `pytest` is only a development extra. `pipx install .` is a convenient isolated CLI installation when working from a release checkout.
|
|
118
|
+
|
|
119
|
+
## Supported environments
|
|
120
|
+
|
|
121
|
+
The internal model is OS × Shell × Runtime:
|
|
122
|
+
|
|
123
|
+
| Target | OS | Shell | Runtime context |
|
|
124
|
+
|---|---|---|---|
|
|
125
|
+
| `windows-powershell` | Windows | PowerShell | native |
|
|
126
|
+
| `windows-cmd` | Windows | CMD | native |
|
|
127
|
+
| `windows-git-bash` | Windows | Bash | Git Bash |
|
|
128
|
+
| `windows-wsl` | Windows | Bash | WSL |
|
|
129
|
+
| `macos-zsh` | macOS | zsh | native |
|
|
130
|
+
| `macos-bash` | macOS | Bash | native |
|
|
131
|
+
| `linux-bash` | Linux | Bash | native |
|
|
132
|
+
| `linux-zsh` | Linux | zsh | native |
|
|
133
|
+
|
|
134
|
+
## What is scanned
|
|
135
|
+
|
|
136
|
+
The default bounded discovery includes `SKILL.md`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `README.md`, `.github/**`, `.cursor/**`, `.claude/**`, `.codex/**`, `scripts/**`, package manifests/lockfiles, Python metadata, Docker/Make files, and common shell, Python, JavaScript, JSX, TypeScript, TSX, and batch extensions (`.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`). `.git`, `node_modules`, `vendor`, `dist`, `build`, caches, binary files, and oversized files are excluded.
|
|
137
|
+
|
|
138
|
+
## Examples
|
|
139
|
+
|
|
140
|
+
Included fixtures exercise portable, OS-specific, shell-specific, Python, Node, mixed, and agent-instruction workflows:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
agent-xplat scan tests/fixtures/mixed
|
|
144
|
+
agent-xplat scan tests/fixtures/python --format json
|
|
145
|
+
agent-xplat scan tests/fixtures/node --format sarif --output agent-xplat.sarif
|
|
146
|
+
agent-xplat scan tests/fixtures/node-ast --format json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The fixture metadata in `tests/fixtures/*/expected.json` records expected rules, affected targets, severity, and confidence. It is test data, not a claim about a third-party tool's standard.
|
|
150
|
+
|
|
151
|
+
## Rules, severity, and confidence
|
|
152
|
+
|
|
153
|
+
Rules are modular and use stable `AX-*` identifiers. They cover paths, shell commands and environment syntax, quoting, Python, Node package scripts and Node/JS/TS AST facts, filesystems, package managers, external tools, runtime assumptions, and agent configuration. JavaScript-family source is parsed structurally with Tree-sitter; dynamic strings and behavior still remain static inferences. See [docs/RULES.md](docs/RULES.md).
|
|
154
|
+
|
|
155
|
+
Severity is one of `BLOCKER`, `ERROR`, `WARNING`, or `INFO`. Confidence is one of `HIGH`, `MEDIUM`, or `LOW`. A low-confidence assumption is reported as such and does not become a blocker merely because it is inconvenient.
|
|
156
|
+
|
|
157
|
+
## Scan and reports
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
agent-xplat scan .
|
|
161
|
+
agent-xplat scan . --format json --output agent-xplat.json
|
|
162
|
+
agent-xplat scan . --format sarif --output agent-xplat.sarif
|
|
163
|
+
agent-xplat report .
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
JSON is versioned (`schema_version: 1.0`) for agent and CI consumption and contains `targets`, `scores`, `findings`, `baseline`, `contract`, `verification`, and `summary`. SARIF output is version 2.1.0 and includes file, line, column, rule, level, message, and help. The Markdown report contains the executive summary, matrix, blocking issues, warnings, assumptions, contract violations, affected files, suggested fixes, evidence, ignored findings, and baseline status.
|
|
167
|
+
|
|
168
|
+
## Safe fixes
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
agent-xplat fix . --dry-run
|
|
172
|
+
agent-xplat fix .
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Only deterministic, high-confidence, behavior-preserving fixes are eligible. v1.0 automatically normalizes CRLF shebang files to LF. Shell rewrites, path rewrites, environment syntax conversions, and dependency migrations remain suggestions because their equivalence cannot be proven from static text alone. Dry-run prints a unified patch and does not modify files.
|
|
176
|
+
|
|
177
|
+
## Runtime verification
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
agent-xplat test .
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`scan` performs no target-code execution. `test` is explicit and bounded: it may run an allowlisted project test command with a timeout and records the actual host target, command, exit code, and output tail. A missing command is `INFERRED`, not `VERIFIED`. Runtime evidence from one host does not prove all matrix rows.
|
|
184
|
+
|
|
185
|
+
## GitHub Actions and SARIF
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
agent-xplat init-ci
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The generated workflow runs on `windows-latest`, `macos-latest`, and `ubuntu-latest`, installs the project, runs tests, performs a static scan, invokes controlled runtime verification, creates JSON/SARIF/Markdown artifacts, and uploads SARIF to Code Scanning. A workflow file existing locally is not evidence that the hosted jobs passed; the repository must run those jobs before claiming cross-OS verification.
|
|
192
|
+
|
|
193
|
+
## Baseline and diff mode
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
agent-xplat baseline
|
|
197
|
+
agent-xplat scan . --baseline-only
|
|
198
|
+
agent-xplat scan . --diff main
|
|
199
|
+
agent-xplat scan . --diff HEAD~1 --format markdown
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Baselines distinguish existing, new, and resolved fingerprints. `--baseline-only` gates on new findings. Diff mode compares before/after scores and issue fingerprints from a Git reference without executing the reference tree.
|
|
203
|
+
|
|
204
|
+
## Compatibility Contract
|
|
205
|
+
|
|
206
|
+
`.agent-xplat.yml` accepts declared support and requirements:
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
supported:
|
|
210
|
+
- windows-powershell
|
|
211
|
+
- windows-git-bash
|
|
212
|
+
- windows-wsl
|
|
213
|
+
- macos-zsh
|
|
214
|
+
- linux-bash
|
|
215
|
+
unsupported:
|
|
216
|
+
- windows-cmd
|
|
217
|
+
requirements:
|
|
218
|
+
python: ">=3.11"
|
|
219
|
+
node: ">=22"
|
|
220
|
+
minimum_score: 85
|
|
221
|
+
fail_on:
|
|
222
|
+
- BLOCKER
|
|
223
|
+
- ERROR
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The optional `agent-xplat:` wrapper is also accepted. Declared support is compared to detected assumptions and reported as `VIOLATION`; unsupported targets are not treated as contract failures.
|
|
227
|
+
|
|
228
|
+
## Configuration and ignoring rules
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
agent-xplat init
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The schema supports `targets`, `exclude`, `ignore`, `minimum_score`, `fail_on`, `supported`, `unsupported`, `requirements`, `max_file_size`, and `verification`. Global suppression uses `ignore`. A line-level marker is explicit and auditable:
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
# agent-xplat-ignore AX-SHELL-001
|
|
238
|
+
chmod +x scripts/render.sh
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Ignored findings remain in machine-readable output with `ignored: true`, and the summary reports their count. Unknown keys, targets, severities, rule IDs, and invalid values fail with exit code 2.
|
|
242
|
+
Unused line-level suppression markers are reported as suppression diagnostics instead of being silently accepted.
|
|
243
|
+
|
|
244
|
+
## Agent-native usage and exit codes
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
agent-xplat scan . --format json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
| Code | Meaning |
|
|
251
|
+
|---:|---|
|
|
252
|
+
| 0 | No configured portability gate failure |
|
|
253
|
+
| 1 | Portability violation, contract violation, or new diff regression |
|
|
254
|
+
| 2 | Invalid configuration, input, Git reference, or command arguments |
|
|
255
|
+
| 3 | Unexpected internal tool error |
|
|
256
|
+
|
|
257
|
+
Agents should consume `summary`, per-target `scores`, `findings`, and `contract.violations` rather than parsing terminal decoration.
|
|
258
|
+
|
|
259
|
+
## Badge and doctor
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
agent-xplat badge
|
|
263
|
+
agent-xplat doctor
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
The default badge says `Static Checked` and `Inference only`. A `Cross-OS Verified` badge must be backed by a verification artifact that records verified Windows, macOS, and Linux evidence; the badge label is never implied by a static scan. `doctor` only reports local availability of Git, Node, Python, Docker, PowerShell, Git Bash, WSL, Bash, and zsh. It does not inspect repository health.
|
|
267
|
+
|
|
268
|
+
## Security model
|
|
269
|
+
|
|
270
|
+
Default commands are offline, read-only with respect to the target source, non-executing, non-telemetric, and do not upload data. `test` is the only command that may execute a selected allowlisted project test command, and it has no shell operators, a bounded timeout, and a clear runtime evidence record. There is no AI API, SaaS backend, credential upload, or hidden network path.
|
|
271
|
+
|
|
272
|
+
## Architecture
|
|
273
|
+
|
|
274
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). The core flow is:
|
|
275
|
+
|
|
276
|
+
```text
|
|
277
|
+
Config -> bounded discovery -> structured/text parsers -> rule registry
|
|
278
|
+
-> target-specific findings -> suppression -> score/contract
|
|
279
|
+
-> terminal / JSON / SARIF / Markdown / baseline / diff
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Limitations and roadmap
|
|
283
|
+
|
|
284
|
+
Static analysis cannot prove every shell version, installed tool, filesystem policy, native binary, dynamic command string, or runtime behavior. JavaScript-family source now has structured AST coverage for the supported suffixes, but dynamic evaluation, generated code, unsupported syntax recovery, and actual subprocess behavior remain runtime concerns. The release workflow is generated and documented, but hosted runner evidence must come from the user's GitHub repository. Future work may add more runtime adapters and independently reviewed rules without changing the public finding contract.
|
|
285
|
+
|
|
286
|
+
## Contributing
|
|
287
|
+
|
|
288
|
+
Read [CONTRIBUTING.md](CONTRIBUTING.md), add a positive and negative fixture for every rule change, run `python -m pytest -q`, and preserve deterministic output. Do not add telemetry, network calls, secrets, or machine-specific paths.
|
|
289
|
+
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# agent-xplat
|
|
2
|
+
|
|
3
|
+
[](https://github.com/kwhi6693-web/agent-xplat/actions/workflows/agent-xplat.yml)
|
|
4
|
+
|
|
5
|
+
Find the OS assumptions that break AI-agent workflows.
|
|
6
|
+
|
|
7
|
+
Windows ✓<br>
|
|
8
|
+
macOS ✓<br>
|
|
9
|
+
Linux ✓
|
|
10
|
+
|
|
11
|
+
Verified on real GitHub-hosted runners. The hosted jobs exercise Windows PowerShell, macOS zsh, and Linux bash; the static scan covers the full eight-target OS × Shell × Runtime matrix.
|
|
12
|
+
|
|
13
|
+
`agent-xplat` is a deterministic cross-OS portability checker for AI agent workflows, Agent Skills, agent configuration, and related scripts. It reports where a workflow can fail across **Windows, macOS, and Linux**, including the shell and runtime context—not just the operating system.
|
|
14
|
+
|
|
15
|
+
Skill validators check structure and linters check style; agent-xplat checks the OS × Shell × Runtime assumptions that make an otherwise valid workflow fail on another platform.
|
|
16
|
+
|
|
17
|
+
Fastest install from the published v1.0.1 release:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install https://github.com/kwhi6693-web/agent-xplat/releases/download/v1.0.1/agent_xplat-1.0.1-py3-none-any.whl
|
|
21
|
+
agent-xplat scan .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After a formal release has been published to PyPI through Trusted Publishing,
|
|
25
|
+
the standard install is:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m pip install agent-xplat
|
|
29
|
+
agent-xplat scan .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
agent-xplat scan .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Example from the included mixed-platform fixture:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Agent Workflow Portability
|
|
40
|
+
===========================
|
|
41
|
+
|
|
42
|
+
Compatibility Matrix
|
|
43
|
+
---------------------
|
|
44
|
+
Environment Score Status Findings
|
|
45
|
+
Windows / PowerShell 41/100 BLOCKED 4
|
|
46
|
+
Windows / CMD 1/100 BLOCKED 6
|
|
47
|
+
Windows / Git Bash 76/100 PARTIAL 3
|
|
48
|
+
Windows / WSL 76/100 PARTIAL 3
|
|
49
|
+
macOS / zsh 56/100 PARTIAL 4
|
|
50
|
+
macOS / bash 56/100 PARTIAL 4
|
|
51
|
+
Linux / bash 56/100 PARTIAL 4
|
|
52
|
+
Linux / zsh 56/100 PARTIAL 4
|
|
53
|
+
|
|
54
|
+
7 portability issues found (0 ignored)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The scores are deterministic and explainable. Static findings are marked as inferred; only a real runner or local runtime check can produce verified evidence.
|
|
58
|
+
|
|
59
|
+
## Why it exists
|
|
60
|
+
|
|
61
|
+
Agent workflows often mix Markdown instructions, shell snippets, Python, Node scripts, package managers, and external tools. A workflow can be valid on Linux Bash and still fail in Windows PowerShell, Windows CMD, Git Bash, WSL, or macOS zsh. General linters and security scanners are not designed to answer that portability question.
|
|
62
|
+
|
|
63
|
+
The boundary is deliberate: agent-xplat is not a security scanner, Agent Skill schema validator, benchmark, general linter, or repository health tool. It focuses on **Cross-OS Runtime Portability for AI Agent Workflows**.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
Install from a checkout:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
python -m pip install .
|
|
71
|
+
agent-xplat scan .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For development:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python -m pip install -e ".[dev]"
|
|
78
|
+
python -m pytest -q
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The module invocation is always available as a fallback:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m agent_xplat scan . --format json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Installation
|
|
88
|
+
|
|
89
|
+
Python 3.10 or newer is required. The v1.0.1 GitHub Release publishes a wheel and source distribution; the direct wheel URL is shown above. The runtime package includes the small Tree-sitter parser bindings needed for JavaScript/JSX/TypeScript/TSX AST analysis; `pytest` is only a development extra. `pipx install .` is a convenient isolated CLI installation when working from a release checkout.
|
|
90
|
+
|
|
91
|
+
## Supported environments
|
|
92
|
+
|
|
93
|
+
The internal model is OS × Shell × Runtime:
|
|
94
|
+
|
|
95
|
+
| Target | OS | Shell | Runtime context |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| `windows-powershell` | Windows | PowerShell | native |
|
|
98
|
+
| `windows-cmd` | Windows | CMD | native |
|
|
99
|
+
| `windows-git-bash` | Windows | Bash | Git Bash |
|
|
100
|
+
| `windows-wsl` | Windows | Bash | WSL |
|
|
101
|
+
| `macos-zsh` | macOS | zsh | native |
|
|
102
|
+
| `macos-bash` | macOS | Bash | native |
|
|
103
|
+
| `linux-bash` | Linux | Bash | native |
|
|
104
|
+
| `linux-zsh` | Linux | zsh | native |
|
|
105
|
+
|
|
106
|
+
## What is scanned
|
|
107
|
+
|
|
108
|
+
The default bounded discovery includes `SKILL.md`, `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `README.md`, `.github/**`, `.cursor/**`, `.claude/**`, `.codex/**`, `scripts/**`, package manifests/lockfiles, Python metadata, Docker/Make files, and common shell, Python, JavaScript, JSX, TypeScript, TSX, and batch extensions (`.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`). `.git`, `node_modules`, `vendor`, `dist`, `build`, caches, binary files, and oversized files are excluded.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
Included fixtures exercise portable, OS-specific, shell-specific, Python, Node, mixed, and agent-instruction workflows:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
agent-xplat scan tests/fixtures/mixed
|
|
116
|
+
agent-xplat scan tests/fixtures/python --format json
|
|
117
|
+
agent-xplat scan tests/fixtures/node --format sarif --output agent-xplat.sarif
|
|
118
|
+
agent-xplat scan tests/fixtures/node-ast --format json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The fixture metadata in `tests/fixtures/*/expected.json` records expected rules, affected targets, severity, and confidence. It is test data, not a claim about a third-party tool's standard.
|
|
122
|
+
|
|
123
|
+
## Rules, severity, and confidence
|
|
124
|
+
|
|
125
|
+
Rules are modular and use stable `AX-*` identifiers. They cover paths, shell commands and environment syntax, quoting, Python, Node package scripts and Node/JS/TS AST facts, filesystems, package managers, external tools, runtime assumptions, and agent configuration. JavaScript-family source is parsed structurally with Tree-sitter; dynamic strings and behavior still remain static inferences. See [docs/RULES.md](docs/RULES.md).
|
|
126
|
+
|
|
127
|
+
Severity is one of `BLOCKER`, `ERROR`, `WARNING`, or `INFO`. Confidence is one of `HIGH`, `MEDIUM`, or `LOW`. A low-confidence assumption is reported as such and does not become a blocker merely because it is inconvenient.
|
|
128
|
+
|
|
129
|
+
## Scan and reports
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
agent-xplat scan .
|
|
133
|
+
agent-xplat scan . --format json --output agent-xplat.json
|
|
134
|
+
agent-xplat scan . --format sarif --output agent-xplat.sarif
|
|
135
|
+
agent-xplat report .
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
JSON is versioned (`schema_version: 1.0`) for agent and CI consumption and contains `targets`, `scores`, `findings`, `baseline`, `contract`, `verification`, and `summary`. SARIF output is version 2.1.0 and includes file, line, column, rule, level, message, and help. The Markdown report contains the executive summary, matrix, blocking issues, warnings, assumptions, contract violations, affected files, suggested fixes, evidence, ignored findings, and baseline status.
|
|
139
|
+
|
|
140
|
+
## Safe fixes
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
agent-xplat fix . --dry-run
|
|
144
|
+
agent-xplat fix .
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Only deterministic, high-confidence, behavior-preserving fixes are eligible. v1.0 automatically normalizes CRLF shebang files to LF. Shell rewrites, path rewrites, environment syntax conversions, and dependency migrations remain suggestions because their equivalence cannot be proven from static text alone. Dry-run prints a unified patch and does not modify files.
|
|
148
|
+
|
|
149
|
+
## Runtime verification
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
agent-xplat test .
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`scan` performs no target-code execution. `test` is explicit and bounded: it may run an allowlisted project test command with a timeout and records the actual host target, command, exit code, and output tail. A missing command is `INFERRED`, not `VERIFIED`. Runtime evidence from one host does not prove all matrix rows.
|
|
156
|
+
|
|
157
|
+
## GitHub Actions and SARIF
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
agent-xplat init-ci
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The generated workflow runs on `windows-latest`, `macos-latest`, and `ubuntu-latest`, installs the project, runs tests, performs a static scan, invokes controlled runtime verification, creates JSON/SARIF/Markdown artifacts, and uploads SARIF to Code Scanning. A workflow file existing locally is not evidence that the hosted jobs passed; the repository must run those jobs before claiming cross-OS verification.
|
|
164
|
+
|
|
165
|
+
## Baseline and diff mode
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
agent-xplat baseline
|
|
169
|
+
agent-xplat scan . --baseline-only
|
|
170
|
+
agent-xplat scan . --diff main
|
|
171
|
+
agent-xplat scan . --diff HEAD~1 --format markdown
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Baselines distinguish existing, new, and resolved fingerprints. `--baseline-only` gates on new findings. Diff mode compares before/after scores and issue fingerprints from a Git reference without executing the reference tree.
|
|
175
|
+
|
|
176
|
+
## Compatibility Contract
|
|
177
|
+
|
|
178
|
+
`.agent-xplat.yml` accepts declared support and requirements:
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
supported:
|
|
182
|
+
- windows-powershell
|
|
183
|
+
- windows-git-bash
|
|
184
|
+
- windows-wsl
|
|
185
|
+
- macos-zsh
|
|
186
|
+
- linux-bash
|
|
187
|
+
unsupported:
|
|
188
|
+
- windows-cmd
|
|
189
|
+
requirements:
|
|
190
|
+
python: ">=3.11"
|
|
191
|
+
node: ">=22"
|
|
192
|
+
minimum_score: 85
|
|
193
|
+
fail_on:
|
|
194
|
+
- BLOCKER
|
|
195
|
+
- ERROR
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The optional `agent-xplat:` wrapper is also accepted. Declared support is compared to detected assumptions and reported as `VIOLATION`; unsupported targets are not treated as contract failures.
|
|
199
|
+
|
|
200
|
+
## Configuration and ignoring rules
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
agent-xplat init
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The schema supports `targets`, `exclude`, `ignore`, `minimum_score`, `fail_on`, `supported`, `unsupported`, `requirements`, `max_file_size`, and `verification`. Global suppression uses `ignore`. A line-level marker is explicit and auditable:
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
# agent-xplat-ignore AX-SHELL-001
|
|
210
|
+
chmod +x scripts/render.sh
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Ignored findings remain in machine-readable output with `ignored: true`, and the summary reports their count. Unknown keys, targets, severities, rule IDs, and invalid values fail with exit code 2.
|
|
214
|
+
Unused line-level suppression markers are reported as suppression diagnostics instead of being silently accepted.
|
|
215
|
+
|
|
216
|
+
## Agent-native usage and exit codes
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
agent-xplat scan . --format json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
| Code | Meaning |
|
|
223
|
+
|---:|---|
|
|
224
|
+
| 0 | No configured portability gate failure |
|
|
225
|
+
| 1 | Portability violation, contract violation, or new diff regression |
|
|
226
|
+
| 2 | Invalid configuration, input, Git reference, or command arguments |
|
|
227
|
+
| 3 | Unexpected internal tool error |
|
|
228
|
+
|
|
229
|
+
Agents should consume `summary`, per-target `scores`, `findings`, and `contract.violations` rather than parsing terminal decoration.
|
|
230
|
+
|
|
231
|
+
## Badge and doctor
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
agent-xplat badge
|
|
235
|
+
agent-xplat doctor
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The default badge says `Static Checked` and `Inference only`. A `Cross-OS Verified` badge must be backed by a verification artifact that records verified Windows, macOS, and Linux evidence; the badge label is never implied by a static scan. `doctor` only reports local availability of Git, Node, Python, Docker, PowerShell, Git Bash, WSL, Bash, and zsh. It does not inspect repository health.
|
|
239
|
+
|
|
240
|
+
## Security model
|
|
241
|
+
|
|
242
|
+
Default commands are offline, read-only with respect to the target source, non-executing, non-telemetric, and do not upload data. `test` is the only command that may execute a selected allowlisted project test command, and it has no shell operators, a bounded timeout, and a clear runtime evidence record. There is no AI API, SaaS backend, credential upload, or hidden network path.
|
|
243
|
+
|
|
244
|
+
## Architecture
|
|
245
|
+
|
|
246
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). The core flow is:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
Config -> bounded discovery -> structured/text parsers -> rule registry
|
|
250
|
+
-> target-specific findings -> suppression -> score/contract
|
|
251
|
+
-> terminal / JSON / SARIF / Markdown / baseline / diff
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Limitations and roadmap
|
|
255
|
+
|
|
256
|
+
Static analysis cannot prove every shell version, installed tool, filesystem policy, native binary, dynamic command string, or runtime behavior. JavaScript-family source now has structured AST coverage for the supported suffixes, but dynamic evaluation, generated code, unsupported syntax recovery, and actual subprocess behavior remain runtime concerns. The release workflow is generated and documented, but hosted runner evidence must come from the user's GitHub repository. Future work may add more runtime adapters and independently reviewed rules without changing the public finding contract.
|
|
257
|
+
|
|
258
|
+
## Contributing
|
|
259
|
+
|
|
260
|
+
Read [CONTRIBUTING.md](CONTRIBUTING.md), add a positive and negative fixture for every rule change, run `python -m pytest -q`, and preserve deterministic output. Do not add telemetry, network calls, secrets, or machine-specific paths.
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agent-xplat"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
description = "Detect cross-OS portability issues in AI agent workflows, skills, configs, and scripts."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "agent-xplat contributors" }]
|
|
14
|
+
keywords = ["ai-agent", "agent-skills", "cross-platform", "portability", "static-analysis", "sarif"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"tree-sitter>=0.26,<0.27",
|
|
25
|
+
"tree-sitter-javascript>=0.25,<0.26",
|
|
26
|
+
"tree-sitter-typescript>=0.23,<0.24",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/kwhi6693-web/agent-xplat"
|
|
31
|
+
Repository = "https://github.com/kwhi6693-web/agent-xplat"
|
|
32
|
+
Documentation = "https://github.com/kwhi6693-web/agent-xplat#readme"
|
|
33
|
+
Issues = "https://github.com/kwhi6693-web/agent-xplat/issues"
|
|
34
|
+
Changelog = "https://github.com/kwhi6693-web/agent-xplat/blob/master/CHANGELOG.md"
|
|
35
|
+
|
|
36
|
+
[project.optional-dependencies]
|
|
37
|
+
dev = ["pytest>=8.0"]
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
agent-xplat = "agent_xplat.cli:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools]
|
|
43
|
+
package-dir = {"" = "src"}
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["src"]
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
pythonpath = ["src"]
|
|
51
|
+
addopts = "-ra"
|