polyglot-code-guard 0.1.0__tar.gz → 0.2.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.
Files changed (23) hide show
  1. polyglot_code_guard-0.2.0/PKG-INFO +155 -0
  2. polyglot_code_guard-0.2.0/README.md +132 -0
  3. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/pyproject.toml +2 -2
  4. polyglot_code_guard-0.2.0/src/polyglot_code_guard.egg-info/PKG-INFO +155 -0
  5. polyglot_code_guard-0.2.0/src/polyglot_code_guard.egg-info/requires.txt +6 -0
  6. polyglot_code_guard-0.2.0/src/polyguard/SKILL.md +34 -0
  7. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyguard/__init__.py +1 -1
  8. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyguard/cli.py +5 -4
  9. polyglot_code_guard-0.2.0/src/polyguard/runner.py +414 -0
  10. polyglot_code_guard-0.2.0/tests/test_runner.py +163 -0
  11. polyglot_code_guard-0.1.0/PKG-INFO +0 -105
  12. polyglot_code_guard-0.1.0/README.md +0 -83
  13. polyglot_code_guard-0.1.0/src/polyglot_code_guard.egg-info/PKG-INFO +0 -105
  14. polyglot_code_guard-0.1.0/src/polyglot_code_guard.egg-info/requires.txt +0 -3
  15. polyglot_code_guard-0.1.0/src/polyguard/SKILL.md +0 -35
  16. polyglot_code_guard-0.1.0/src/polyguard/runner.py +0 -271
  17. polyglot_code_guard-0.1.0/tests/test_runner.py +0 -74
  18. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/LICENSE +0 -0
  19. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/setup.cfg +0 -0
  20. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyglot_code_guard.egg-info/SOURCES.txt +0 -0
  21. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyglot_code_guard.egg-info/dependency_links.txt +0 -0
  22. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyglot_code_guard.egg-info/entry_points.txt +0 -0
  23. {polyglot_code_guard-0.1.0 → polyglot_code_guard-0.2.0}/src/polyglot_code_guard.egg-info/top_level.txt +0 -0
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: polyglot-code-guard
3
+ Version: 0.2.0
4
+ Summary: Fail-closed, multi-language test verification for AI-generated code.
5
+ Author: Furox-Art
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Furox-Art/polyglot-code-guard
8
+ Project-URL: Repository, https://github.com/Furox-Art/polyglot-code-guard
9
+ Project-URL: Issues, https://github.com/Furox-Art/polyglot-code-guard/issues
10
+ Keywords: testing,code-verification,polyglot,ai-generated-code,quality-gate
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Testing
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: tomli>=2; python_version < "3.11"
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest>=8.0; extra == "test"
22
+ Dynamic: license-file
23
+
24
+ # Polyguard
25
+
26
+ **A fail-closed verification gate for AI-generated code across multiple programming languages.**
27
+
28
+ Polyguard discovers supported project types, checks that a real test suite is present, executes the project's test/build commands, and reports a one-word verdict by default. It reports **PASS** only when every detected or explicitly required language has test evidence and every configured command exits successfully.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ python -m pip install --upgrade polyglot-code-guard
34
+ ```
35
+
36
+ ## Run
37
+
38
+ From the target repository:
39
+
40
+ ```bash
41
+ polyguard verify
42
+ ```
43
+
44
+ Normal output is exactly one verdict:
45
+
46
+ ```text
47
+ PASS
48
+ ```
49
+
50
+ or:
51
+
52
+ ```text
53
+ FAIL
54
+ ```
55
+
56
+ Useful diagnostic modes:
57
+
58
+ ```bash
59
+ polyguard verify --details
60
+ polyguard verify --json
61
+ polyguard verify --path ./my-project --timeout 180
62
+ polyguard verify --config ./ci/polyguard.toml
63
+ polyguard --version
64
+ ```
65
+
66
+ Exit code is **0** for PASS and **1** for FAIL. A missing project, malformed configuration, missing test suite, missing toolchain, command error, or timeout fails closed.
67
+
68
+ ## Configure project-specific test commands
69
+
70
+ Automatic detection is useful for conventional projects, but real repositories often use custom layouts and test runners. Put a `.polyguard.toml` file in the project root, or pass a file with `--config`.
71
+
72
+ Example:
73
+
74
+ ```toml
75
+ [project]
76
+ # Every listed language is required for an overall PASS.
77
+ languages = ["python", "rust"]
78
+
79
+ [checks.python]
80
+ commands = [
81
+ ["python3", "-m", "compileall", "-q", "src"],
82
+ ["python3", "-m", "pytest", "-q"],
83
+ ]
84
+ test_patterns = ["tests/test_*.py", "tests/**/*.py"]
85
+
86
+ [checks.rust]
87
+ commands = [["cargo", "test", "--all-targets"]]
88
+ test_patterns = ["tests/**/*.rs", "src/**/*.rs"]
89
+ ```
90
+
91
+ Rules:
92
+ - `commands` is a non-empty list of argument arrays. Commands are launched without a shell.
93
+ - `test_patterns` must match at least one file inside the project root.
94
+ - A language under `[project].languages` is mandatory even if automatic detection misses it.
95
+ - A custom check overrides the built-in commands and test-file heuristic for that language.
96
+ - Patterns containing parent-directory traversal (`..`) are rejected.
97
+ - Do not use a command that merely prints success; it must execute the actual test suite.
98
+
99
+ A starter file is available as `.polyguard.example.toml`.
100
+
101
+ ## Initial built-in language support
102
+
103
+ | Language | Default command |
104
+ | --- | --- |
105
+ | Python | `python -m compileall`, then `python -m pytest` |
106
+ | Rust | `cargo test --all-targets` |
107
+ | Go | `go test ./...` |
108
+ | JavaScript / TypeScript | `npm test`; TypeScript also runs `tsc --noEmit` when configured |
109
+ | Java | Maven `test` or Gradle `test` |
110
+ | C# | `dotnet test` |
111
+ | PHP | PHPUnit |
112
+ | Ruby | RSpec or Rake test |
113
+ | Swift | `swift test` |
114
+ | C / C++ | CMake build and CTest |
115
+
116
+ Automatic test evidence is detected using language-specific test names, declarations, or annotations. For unconventional frameworks, use `.polyguard.toml` to define the actual test commands and test file patterns.
117
+
118
+ ## AI coding-agent skill
119
+
120
+ The repository contains `SKILL.md`. Add it to the coding agent's instruction/skills directory and require the agent to run:
121
+
122
+ ```bash
123
+ polyguard verify --path . --details
124
+ ```
125
+
126
+ Agents must not claim successful verification unless the command exits 0 and returns PASS. If any language fails, the overall result is FAIL. Agents must not delete, skip, or weaken tests to obtain PASS.
127
+
128
+ ## Important limitations and security
129
+
130
+ Polyguard is a test execution gate, **not a formal proof of correctness**. PASS means the configured commands completed successfully; it does not guarantee comprehensive test coverage, correct requirements, or absence of defects. Tests can be weak or misleading. Test quality remains a separate responsibility.
131
+
132
+ The verifier executes project build scripts, package managers, and test commands. Treat repositories and dependencies as untrusted. Run them in a disposable container or VM without credentials, privileged access, or sensitive host mounts. Polyguard does not itself provide operating-system isolation.
133
+
134
+ Built-in language recognition is intentionally conservative. Use explicit configuration for monorepos, non-standard directory structures, custom test frameworks, or multiple packages in one repository.
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ python -m pip install -e ".[test]"
140
+ python -m pytest -q
141
+ python -m build
142
+ python -m twine check dist/*
143
+ ```
144
+
145
+ ## Publishing
146
+
147
+ The GitHub Actions workflow builds the distributions and publishes using PyPI Trusted Publishing. Configure the PyPI publisher for:
148
+ - Owner: `Furox-Art`
149
+ - Repository: `polyglot-code-guard`
150
+ - Workflow: `publish.yml`
151
+ - Environment: `pypi`
152
+
153
+ ## License
154
+
155
+ MIT
@@ -0,0 +1,132 @@
1
+ # Polyguard
2
+
3
+ **A fail-closed verification gate for AI-generated code across multiple programming languages.**
4
+
5
+ Polyguard discovers supported project types, checks that a real test suite is present, executes the project's test/build commands, and reports a one-word verdict by default. It reports **PASS** only when every detected or explicitly required language has test evidence and every configured command exits successfully.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ python -m pip install --upgrade polyglot-code-guard
11
+ ```
12
+
13
+ ## Run
14
+
15
+ From the target repository:
16
+
17
+ ```bash
18
+ polyguard verify
19
+ ```
20
+
21
+ Normal output is exactly one verdict:
22
+
23
+ ```text
24
+ PASS
25
+ ```
26
+
27
+ or:
28
+
29
+ ```text
30
+ FAIL
31
+ ```
32
+
33
+ Useful diagnostic modes:
34
+
35
+ ```bash
36
+ polyguard verify --details
37
+ polyguard verify --json
38
+ polyguard verify --path ./my-project --timeout 180
39
+ polyguard verify --config ./ci/polyguard.toml
40
+ polyguard --version
41
+ ```
42
+
43
+ Exit code is **0** for PASS and **1** for FAIL. A missing project, malformed configuration, missing test suite, missing toolchain, command error, or timeout fails closed.
44
+
45
+ ## Configure project-specific test commands
46
+
47
+ Automatic detection is useful for conventional projects, but real repositories often use custom layouts and test runners. Put a `.polyguard.toml` file in the project root, or pass a file with `--config`.
48
+
49
+ Example:
50
+
51
+ ```toml
52
+ [project]
53
+ # Every listed language is required for an overall PASS.
54
+ languages = ["python", "rust"]
55
+
56
+ [checks.python]
57
+ commands = [
58
+ ["python3", "-m", "compileall", "-q", "src"],
59
+ ["python3", "-m", "pytest", "-q"],
60
+ ]
61
+ test_patterns = ["tests/test_*.py", "tests/**/*.py"]
62
+
63
+ [checks.rust]
64
+ commands = [["cargo", "test", "--all-targets"]]
65
+ test_patterns = ["tests/**/*.rs", "src/**/*.rs"]
66
+ ```
67
+
68
+ Rules:
69
+ - `commands` is a non-empty list of argument arrays. Commands are launched without a shell.
70
+ - `test_patterns` must match at least one file inside the project root.
71
+ - A language under `[project].languages` is mandatory even if automatic detection misses it.
72
+ - A custom check overrides the built-in commands and test-file heuristic for that language.
73
+ - Patterns containing parent-directory traversal (`..`) are rejected.
74
+ - Do not use a command that merely prints success; it must execute the actual test suite.
75
+
76
+ A starter file is available as `.polyguard.example.toml`.
77
+
78
+ ## Initial built-in language support
79
+
80
+ | Language | Default command |
81
+ | --- | --- |
82
+ | Python | `python -m compileall`, then `python -m pytest` |
83
+ | Rust | `cargo test --all-targets` |
84
+ | Go | `go test ./...` |
85
+ | JavaScript / TypeScript | `npm test`; TypeScript also runs `tsc --noEmit` when configured |
86
+ | Java | Maven `test` or Gradle `test` |
87
+ | C# | `dotnet test` |
88
+ | PHP | PHPUnit |
89
+ | Ruby | RSpec or Rake test |
90
+ | Swift | `swift test` |
91
+ | C / C++ | CMake build and CTest |
92
+
93
+ Automatic test evidence is detected using language-specific test names, declarations, or annotations. For unconventional frameworks, use `.polyguard.toml` to define the actual test commands and test file patterns.
94
+
95
+ ## AI coding-agent skill
96
+
97
+ The repository contains `SKILL.md`. Add it to the coding agent's instruction/skills directory and require the agent to run:
98
+
99
+ ```bash
100
+ polyguard verify --path . --details
101
+ ```
102
+
103
+ Agents must not claim successful verification unless the command exits 0 and returns PASS. If any language fails, the overall result is FAIL. Agents must not delete, skip, or weaken tests to obtain PASS.
104
+
105
+ ## Important limitations and security
106
+
107
+ Polyguard is a test execution gate, **not a formal proof of correctness**. PASS means the configured commands completed successfully; it does not guarantee comprehensive test coverage, correct requirements, or absence of defects. Tests can be weak or misleading. Test quality remains a separate responsibility.
108
+
109
+ The verifier executes project build scripts, package managers, and test commands. Treat repositories and dependencies as untrusted. Run them in a disposable container or VM without credentials, privileged access, or sensitive host mounts. Polyguard does not itself provide operating-system isolation.
110
+
111
+ Built-in language recognition is intentionally conservative. Use explicit configuration for monorepos, non-standard directory structures, custom test frameworks, or multiple packages in one repository.
112
+
113
+ ## Development
114
+
115
+ ```bash
116
+ python -m pip install -e ".[test]"
117
+ python -m pytest -q
118
+ python -m build
119
+ python -m twine check dist/*
120
+ ```
121
+
122
+ ## Publishing
123
+
124
+ The GitHub Actions workflow builds the distributions and publishes using PyPI Trusted Publishing. Configure the PyPI publisher for:
125
+ - Owner: `Furox-Art`
126
+ - Repository: `polyglot-code-guard`
127
+ - Workflow: `publish.yml`
128
+ - Environment: `pypi`
129
+
130
+ ## License
131
+
132
+ MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "polyglot-code-guard"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Fail-closed, multi-language test verification for AI-generated code."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Programming Language :: Python :: 3",
19
19
  "Topic :: Software Development :: Testing",
20
20
  ]
21
- dependencies = []
21
+ dependencies = ["tomli>=2; python_version < '3.11'"]
22
22
 
23
23
  [project.optional-dependencies]
24
24
  test = ["pytest>=8.0"]
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: polyglot-code-guard
3
+ Version: 0.2.0
4
+ Summary: Fail-closed, multi-language test verification for AI-generated code.
5
+ Author: Furox-Art
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Furox-Art/polyglot-code-guard
8
+ Project-URL: Repository, https://github.com/Furox-Art/polyglot-code-guard
9
+ Project-URL: Issues, https://github.com/Furox-Art/polyglot-code-guard/issues
10
+ Keywords: testing,code-verification,polyglot,ai-generated-code,quality-gate
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Testing
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: tomli>=2; python_version < "3.11"
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest>=8.0; extra == "test"
22
+ Dynamic: license-file
23
+
24
+ # Polyguard
25
+
26
+ **A fail-closed verification gate for AI-generated code across multiple programming languages.**
27
+
28
+ Polyguard discovers supported project types, checks that a real test suite is present, executes the project's test/build commands, and reports a one-word verdict by default. It reports **PASS** only when every detected or explicitly required language has test evidence and every configured command exits successfully.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ python -m pip install --upgrade polyglot-code-guard
34
+ ```
35
+
36
+ ## Run
37
+
38
+ From the target repository:
39
+
40
+ ```bash
41
+ polyguard verify
42
+ ```
43
+
44
+ Normal output is exactly one verdict:
45
+
46
+ ```text
47
+ PASS
48
+ ```
49
+
50
+ or:
51
+
52
+ ```text
53
+ FAIL
54
+ ```
55
+
56
+ Useful diagnostic modes:
57
+
58
+ ```bash
59
+ polyguard verify --details
60
+ polyguard verify --json
61
+ polyguard verify --path ./my-project --timeout 180
62
+ polyguard verify --config ./ci/polyguard.toml
63
+ polyguard --version
64
+ ```
65
+
66
+ Exit code is **0** for PASS and **1** for FAIL. A missing project, malformed configuration, missing test suite, missing toolchain, command error, or timeout fails closed.
67
+
68
+ ## Configure project-specific test commands
69
+
70
+ Automatic detection is useful for conventional projects, but real repositories often use custom layouts and test runners. Put a `.polyguard.toml` file in the project root, or pass a file with `--config`.
71
+
72
+ Example:
73
+
74
+ ```toml
75
+ [project]
76
+ # Every listed language is required for an overall PASS.
77
+ languages = ["python", "rust"]
78
+
79
+ [checks.python]
80
+ commands = [
81
+ ["python3", "-m", "compileall", "-q", "src"],
82
+ ["python3", "-m", "pytest", "-q"],
83
+ ]
84
+ test_patterns = ["tests/test_*.py", "tests/**/*.py"]
85
+
86
+ [checks.rust]
87
+ commands = [["cargo", "test", "--all-targets"]]
88
+ test_patterns = ["tests/**/*.rs", "src/**/*.rs"]
89
+ ```
90
+
91
+ Rules:
92
+ - `commands` is a non-empty list of argument arrays. Commands are launched without a shell.
93
+ - `test_patterns` must match at least one file inside the project root.
94
+ - A language under `[project].languages` is mandatory even if automatic detection misses it.
95
+ - A custom check overrides the built-in commands and test-file heuristic for that language.
96
+ - Patterns containing parent-directory traversal (`..`) are rejected.
97
+ - Do not use a command that merely prints success; it must execute the actual test suite.
98
+
99
+ A starter file is available as `.polyguard.example.toml`.
100
+
101
+ ## Initial built-in language support
102
+
103
+ | Language | Default command |
104
+ | --- | --- |
105
+ | Python | `python -m compileall`, then `python -m pytest` |
106
+ | Rust | `cargo test --all-targets` |
107
+ | Go | `go test ./...` |
108
+ | JavaScript / TypeScript | `npm test`; TypeScript also runs `tsc --noEmit` when configured |
109
+ | Java | Maven `test` or Gradle `test` |
110
+ | C# | `dotnet test` |
111
+ | PHP | PHPUnit |
112
+ | Ruby | RSpec or Rake test |
113
+ | Swift | `swift test` |
114
+ | C / C++ | CMake build and CTest |
115
+
116
+ Automatic test evidence is detected using language-specific test names, declarations, or annotations. For unconventional frameworks, use `.polyguard.toml` to define the actual test commands and test file patterns.
117
+
118
+ ## AI coding-agent skill
119
+
120
+ The repository contains `SKILL.md`. Add it to the coding agent's instruction/skills directory and require the agent to run:
121
+
122
+ ```bash
123
+ polyguard verify --path . --details
124
+ ```
125
+
126
+ Agents must not claim successful verification unless the command exits 0 and returns PASS. If any language fails, the overall result is FAIL. Agents must not delete, skip, or weaken tests to obtain PASS.
127
+
128
+ ## Important limitations and security
129
+
130
+ Polyguard is a test execution gate, **not a formal proof of correctness**. PASS means the configured commands completed successfully; it does not guarantee comprehensive test coverage, correct requirements, or absence of defects. Tests can be weak or misleading. Test quality remains a separate responsibility.
131
+
132
+ The verifier executes project build scripts, package managers, and test commands. Treat repositories and dependencies as untrusted. Run them in a disposable container or VM without credentials, privileged access, or sensitive host mounts. Polyguard does not itself provide operating-system isolation.
133
+
134
+ Built-in language recognition is intentionally conservative. Use explicit configuration for monorepos, non-standard directory structures, custom test frameworks, or multiple packages in one repository.
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ python -m pip install -e ".[test]"
140
+ python -m pytest -q
141
+ python -m build
142
+ python -m twine check dist/*
143
+ ```
144
+
145
+ ## Publishing
146
+
147
+ The GitHub Actions workflow builds the distributions and publishes using PyPI Trusted Publishing. Configure the PyPI publisher for:
148
+ - Owner: `Furox-Art`
149
+ - Repository: `polyglot-code-guard`
150
+ - Workflow: `publish.yml`
151
+ - Environment: `pypi`
152
+
153
+ ## License
154
+
155
+ MIT
@@ -0,0 +1,6 @@
1
+
2
+ [:python_version < "3.11"]
3
+ tomli>=2
4
+
5
+ [test]
6
+ pytest>=8.0
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: polyglot-code-verification
3
+ description: Verify AI-generated code with real project test commands and fail closed when tests are missing or fail.
4
+ ---
5
+
6
+ # Polyglot Code Verification
7
+
8
+ Use this skill whenever code is generated, changed, refactored, or described as complete.
9
+
10
+ ## Required workflow
11
+
12
+ 1. Identify all languages, build systems, packages, and project roots touched by the change.
13
+ 2. Review the user's requirements and create or update tests for normal behavior, edge cases, invalid inputs, error paths, and regressions.
14
+ 3. For conventional repositories, run `polyguard verify --path . --details`.
15
+ 4. For a custom layout or test runner, add a `.polyguard.toml` with explicit commands and test file patterns. Never use a command that simply prints success.
16
+ 5. Run the complete configured test suite. Do not omit a detected or required language.
17
+ 6. If any command fails, the toolchain is missing, tests cannot be found, configuration is invalid, or a timeout occurs, the final verdict is FAIL.
18
+ 7. Fix the implementation or tests and rerun all checks. Never delete, skip, weaken, or rewrite a valid test merely to obtain PASS.
19
+ 8. Retain command output and the JSON report when the user requests inspectable evidence.
20
+
21
+ ## Output contract
22
+
23
+ - All detected and required language checks pass: PASS
24
+ - Any failure or incomplete verification: FAIL
25
+
26
+ The CLI exits 0 only for PASS and 1 for FAIL. The default output is exactly one word; use `--details` or `--json` for diagnostics.
27
+
28
+ ## Security
29
+
30
+ The verifier executes build tools, package managers, scripts, and tests from the target repository. Run untrusted code in a disposable container or isolated virtual machine without secrets, privileged access, or sensitive host mounts. Polyguard is not an operating-system sandbox.
31
+
32
+ ## Scope
33
+
34
+ Built-in support: Python, Rust, Go, JavaScript/TypeScript, Java, C#, PHP, Ruby, Swift, and C/C++ with CMake. Use project configuration for unconventional layouts, custom test runners, and monorepos.
@@ -1,3 +1,3 @@
1
1
  """Polyguard: fail-closed verification for multi-language projects."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
@@ -5,27 +5,28 @@ from __future__ import annotations
5
5
  import argparse
6
6
  from pathlib import Path
7
7
 
8
+ from . import __version__
8
9
  from .runner import render_report, run_checks
9
10
 
10
11
 
11
12
  def build_parser() -> argparse.ArgumentParser:
12
13
  parser = argparse.ArgumentParser(
13
14
  prog="polyguard",
14
- description="Run available language test suites and fail closed when proof is missing.",
15
+ description="Run project test suites and fail closed when verification is incomplete.",
15
16
  )
16
17
  parser.add_argument("verify", nargs="?", choices=["verify"], default="verify")
17
18
  parser.add_argument("--path", default=".", help="Project directory to verify.")
19
+ parser.add_argument("--config", help="Path to a Polyguard TOML config (default: .polyguard.toml in project root).")
18
20
  parser.add_argument("--timeout", type=int, default=120, help="Timeout per command in seconds.")
19
21
  parser.add_argument("--details", action="store_true", help="Show per-language diagnostics.")
20
22
  parser.add_argument("--json", action="store_true", help="Emit a machine-readable JSON report.")
23
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
21
24
  return parser
22
25
 
23
26
 
24
27
  def main() -> int:
25
28
  args = build_parser().parse_args()
26
- if args.timeout < 1:
27
- raise SystemExit("--timeout must be at least 1 second.")
28
- report = run_checks(Path(args.path), timeout=args.timeout)
29
+ report = run_checks(Path(args.path), timeout=args.timeout, config_path=args.config)
29
30
  print(render_report(report, details=args.details, as_json=args.json))
30
31
  return 0 if report["status"] == "PASS" else 1
31
32