lv24-vigil 0.4.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,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 LevapVeeskela
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: lv24-vigil
3
+ Version: 0.4.0
4
+ Summary: Python launcher for the lv24-vigil (Vigil) CLI
5
+ Author: LevapVeeskela
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/LevapVeeskela/lv24-vigil
8
+ Project-URL: Repository, https://github.com/LevapVeeskela/lv24-vigil
9
+ Project-URL: Issues, https://github.com/LevapVeeskela/lv24-vigil/issues
10
+ Project-URL: Documentation, https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md
11
+ Project-URL: Changelog, https://github.com/LevapVeeskela/lv24-vigil/blob/main/CHANGELOG.md
12
+ Keywords: security,audit,sast,cli,launcher
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: license-file
19
+
20
+ # lv24-vigil (Python launcher)
21
+
22
+ A thin Python launcher for **Vigil**, a local-first security auditor for code.
23
+ Vigil itself is a Go binary distributed as a Node.js command-line tool published
24
+ on npm as [`lv24-vigil`](https://www.npmjs.com/package/lv24-vigil). This package
25
+ does not reimplement Vigil and does not bundle Node.js: the `vigil` command
26
+ delegates to the npm package through `npx`.
27
+
28
+ The npm package remains the canonical distribution. The PyPI package only
29
+ contains this launcher.
30
+
31
+ ## Prerequisites
32
+
33
+ - **Node.js 18 or newer**, including npm and npx
34
+ ([nodejs.org](https://nodejs.org/)).
35
+ - Network access on first run, or an npm cache that already contains the
36
+ requested package, because `npx` may download it.
37
+ - Python 3.9 or newer.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install lv24-vigil
43
+ ```
44
+
45
+ This installs two equivalent console scripts:
46
+
47
+ - `vigil`
48
+ - `lv24-vigil`
49
+
50
+ ## Usage
51
+
52
+ ```bash
53
+ vigil version
54
+ vigil scan --no-llm
55
+ vigil status
56
+ ```
57
+
58
+ All arguments are forwarded unchanged to the npm CLI. The child process
59
+ inherits the terminal, environment and working directory, and its exit code is
60
+ propagated. You can also run:
61
+
62
+ ```bash
63
+ python -m lv24_vigil --help
64
+ ```
65
+
66
+ If `npx` cannot be found, the launcher exits with code `127` and prints an
67
+ installation hint. An interrupted run exits with code `130`.
68
+
69
+ ## Version pinning
70
+
71
+ By default the launcher runs the npm package version matching its own version
72
+ (currently `0.4.0`). Override it with `VIGIL_NPM_VERSION` to use any npm version
73
+ or tag:
74
+
75
+ ```bash
76
+ VIGIL_NPM_VERSION=latest vigil --help
77
+ VIGIL_NPM_VERSION=0.4.0 vigil scan --no-llm
78
+ ```
79
+
80
+ PowerShell:
81
+
82
+ ```powershell
83
+ $env:VIGIL_NPM_VERSION = "latest"; vigil --help
84
+ ```
85
+
86
+ ## Links
87
+
88
+ - Main repository and documentation:
89
+ <https://github.com/LevapVeeskela/lv24-vigil>
90
+ - Installation options:
91
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/install.md>
92
+ - PyPI publishing and Trusted Publishing:
93
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md>
94
+ - Issues:
95
+ <https://github.com/LevapVeeskela/lv24-vigil/issues>
96
+ - npm package:
97
+ <https://www.npmjs.com/package/lv24-vigil>
98
+
99
+ ## License
100
+
101
+ Apache-2.0, same as the Vigil repository and the canonical npm package.
@@ -0,0 +1,82 @@
1
+ # lv24-vigil (Python launcher)
2
+
3
+ A thin Python launcher for **Vigil**, a local-first security auditor for code.
4
+ Vigil itself is a Go binary distributed as a Node.js command-line tool published
5
+ on npm as [`lv24-vigil`](https://www.npmjs.com/package/lv24-vigil). This package
6
+ does not reimplement Vigil and does not bundle Node.js: the `vigil` command
7
+ delegates to the npm package through `npx`.
8
+
9
+ The npm package remains the canonical distribution. The PyPI package only
10
+ contains this launcher.
11
+
12
+ ## Prerequisites
13
+
14
+ - **Node.js 18 or newer**, including npm and npx
15
+ ([nodejs.org](https://nodejs.org/)).
16
+ - Network access on first run, or an npm cache that already contains the
17
+ requested package, because `npx` may download it.
18
+ - Python 3.9 or newer.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ pip install lv24-vigil
24
+ ```
25
+
26
+ This installs two equivalent console scripts:
27
+
28
+ - `vigil`
29
+ - `lv24-vigil`
30
+
31
+ ## Usage
32
+
33
+ ```bash
34
+ vigil version
35
+ vigil scan --no-llm
36
+ vigil status
37
+ ```
38
+
39
+ All arguments are forwarded unchanged to the npm CLI. The child process
40
+ inherits the terminal, environment and working directory, and its exit code is
41
+ propagated. You can also run:
42
+
43
+ ```bash
44
+ python -m lv24_vigil --help
45
+ ```
46
+
47
+ If `npx` cannot be found, the launcher exits with code `127` and prints an
48
+ installation hint. An interrupted run exits with code `130`.
49
+
50
+ ## Version pinning
51
+
52
+ By default the launcher runs the npm package version matching its own version
53
+ (currently `0.4.0`). Override it with `VIGIL_NPM_VERSION` to use any npm version
54
+ or tag:
55
+
56
+ ```bash
57
+ VIGIL_NPM_VERSION=latest vigil --help
58
+ VIGIL_NPM_VERSION=0.4.0 vigil scan --no-llm
59
+ ```
60
+
61
+ PowerShell:
62
+
63
+ ```powershell
64
+ $env:VIGIL_NPM_VERSION = "latest"; vigil --help
65
+ ```
66
+
67
+ ## Links
68
+
69
+ - Main repository and documentation:
70
+ <https://github.com/LevapVeeskela/lv24-vigil>
71
+ - Installation options:
72
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/install.md>
73
+ - PyPI publishing and Trusted Publishing:
74
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md>
75
+ - Issues:
76
+ <https://github.com/LevapVeeskela/lv24-vigil/issues>
77
+ - npm package:
78
+ <https://www.npmjs.com/package/lv24-vigil>
79
+
80
+ ## License
81
+
82
+ Apache-2.0, same as the Vigil repository and the canonical npm package.
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "lv24-vigil"
7
+ version = "0.4.0"
8
+ description = "Python launcher for the lv24-vigil (Vigil) CLI"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ { name = "LevapVeeskela" },
15
+ ]
16
+ keywords = [
17
+ "security",
18
+ "audit",
19
+ "sast",
20
+ "cli",
21
+ "launcher",
22
+ ]
23
+ classifiers = [
24
+ "Programming Language :: Python :: 3",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/LevapVeeskela/lv24-vigil"
30
+ Repository = "https://github.com/LevapVeeskela/lv24-vigil"
31
+ Issues = "https://github.com/LevapVeeskela/lv24-vigil/issues"
32
+ Documentation = "https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md"
33
+ Changelog = "https://github.com/LevapVeeskela/lv24-vigil/blob/main/CHANGELOG.md"
34
+
35
+ [project.scripts]
36
+ vigil = "lv24_vigil.cli:main"
37
+ lv24-vigil = "lv24_vigil.cli:main"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Python launcher for the Vigil Node.js CLI."""
2
+
3
+ __version__ = "0.4.0"
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,6 @@
1
+ """Allow running the launcher with ``python -m lv24_vigil``."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,55 @@
1
+ """Command-line entry point that delegates to the npm Vigil CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ from typing import Optional, Sequence
10
+
11
+ from . import __version__
12
+
13
+ NPM_PACKAGE = "lv24-vigil"
14
+ NPM_VERSION_ENV = "VIGIL_NPM_VERSION"
15
+
16
+ _NPX_MISSING_MESSAGE = """\
17
+ vigil: npx was not found on PATH.
18
+
19
+ This package is a Python launcher for the Node.js Vigil CLI; it does not bundle
20
+ Node.js. Install Node.js 18 or newer (npm and npx are included) from
21
+ https://nodejs.org/ and run `vigil` again. Alternatively, install the standalone
22
+ binary or use Go:
23
+ https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/install.md
24
+
25
+ The npm package lv24-vigil remains the canonical distribution.
26
+ """
27
+
28
+
29
+ def npm_spec() -> str:
30
+ """Return the npm package spec, honoring VIGIL_NPM_VERSION."""
31
+ version = os.environ.get(NPM_VERSION_ENV, "").strip() or __version__
32
+ return "{0}@{1}".format(NPM_PACKAGE, version)
33
+
34
+
35
+ def main(argv: Optional[Sequence[str]] = None) -> int:
36
+ """Run the npm CLI through npx and return its exit code."""
37
+ args = list(sys.argv[1:] if argv is None else argv)
38
+
39
+ npx = shutil.which("npx")
40
+ if npx is None:
41
+ sys.stderr.write(_NPX_MISSING_MESSAGE)
42
+ return 127
43
+
44
+ command = [npx, "--yes", npm_spec(), *args]
45
+
46
+ try:
47
+ completed = subprocess.run(command, check=False)
48
+ return completed.returncode
49
+ except KeyboardInterrupt:
50
+ return 130
51
+ except OSError as exc:
52
+ sys.stderr.write(
53
+ "vigil: failed to start {0}: {1}\n".format(npx, exc)
54
+ )
55
+ return 127
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: lv24-vigil
3
+ Version: 0.4.0
4
+ Summary: Python launcher for the lv24-vigil (Vigil) CLI
5
+ Author: LevapVeeskela
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/LevapVeeskela/lv24-vigil
8
+ Project-URL: Repository, https://github.com/LevapVeeskela/lv24-vigil
9
+ Project-URL: Issues, https://github.com/LevapVeeskela/lv24-vigil/issues
10
+ Project-URL: Documentation, https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md
11
+ Project-URL: Changelog, https://github.com/LevapVeeskela/lv24-vigil/blob/main/CHANGELOG.md
12
+ Keywords: security,audit,sast,cli,launcher
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: license-file
19
+
20
+ # lv24-vigil (Python launcher)
21
+
22
+ A thin Python launcher for **Vigil**, a local-first security auditor for code.
23
+ Vigil itself is a Go binary distributed as a Node.js command-line tool published
24
+ on npm as [`lv24-vigil`](https://www.npmjs.com/package/lv24-vigil). This package
25
+ does not reimplement Vigil and does not bundle Node.js: the `vigil` command
26
+ delegates to the npm package through `npx`.
27
+
28
+ The npm package remains the canonical distribution. The PyPI package only
29
+ contains this launcher.
30
+
31
+ ## Prerequisites
32
+
33
+ - **Node.js 18 or newer**, including npm and npx
34
+ ([nodejs.org](https://nodejs.org/)).
35
+ - Network access on first run, or an npm cache that already contains the
36
+ requested package, because `npx` may download it.
37
+ - Python 3.9 or newer.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install lv24-vigil
43
+ ```
44
+
45
+ This installs two equivalent console scripts:
46
+
47
+ - `vigil`
48
+ - `lv24-vigil`
49
+
50
+ ## Usage
51
+
52
+ ```bash
53
+ vigil version
54
+ vigil scan --no-llm
55
+ vigil status
56
+ ```
57
+
58
+ All arguments are forwarded unchanged to the npm CLI. The child process
59
+ inherits the terminal, environment and working directory, and its exit code is
60
+ propagated. You can also run:
61
+
62
+ ```bash
63
+ python -m lv24_vigil --help
64
+ ```
65
+
66
+ If `npx` cannot be found, the launcher exits with code `127` and prints an
67
+ installation hint. An interrupted run exits with code `130`.
68
+
69
+ ## Version pinning
70
+
71
+ By default the launcher runs the npm package version matching its own version
72
+ (currently `0.4.0`). Override it with `VIGIL_NPM_VERSION` to use any npm version
73
+ or tag:
74
+
75
+ ```bash
76
+ VIGIL_NPM_VERSION=latest vigil --help
77
+ VIGIL_NPM_VERSION=0.4.0 vigil scan --no-llm
78
+ ```
79
+
80
+ PowerShell:
81
+
82
+ ```powershell
83
+ $env:VIGIL_NPM_VERSION = "latest"; vigil --help
84
+ ```
85
+
86
+ ## Links
87
+
88
+ - Main repository and documentation:
89
+ <https://github.com/LevapVeeskela/lv24-vigil>
90
+ - Installation options:
91
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/install.md>
92
+ - PyPI publishing and Trusted Publishing:
93
+ <https://github.com/LevapVeeskela/lv24-vigil/blob/main/docs/pypi.md>
94
+ - Issues:
95
+ <https://github.com/LevapVeeskela/lv24-vigil/issues>
96
+ - npm package:
97
+ <https://www.npmjs.com/package/lv24-vigil>
98
+
99
+ ## License
100
+
101
+ Apache-2.0, same as the Vigil repository and the canonical npm package.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/lv24_vigil/__init__.py
5
+ src/lv24_vigil/__main__.py
6
+ src/lv24_vigil/cli.py
7
+ src/lv24_vigil.egg-info/PKG-INFO
8
+ src/lv24_vigil.egg-info/SOURCES.txt
9
+ src/lv24_vigil.egg-info/dependency_links.txt
10
+ src/lv24_vigil.egg-info/entry_points.txt
11
+ src/lv24_vigil.egg-info/top_level.txt
12
+ tests/test_cli.py
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ lv24-vigil = lv24_vigil.cli:main
3
+ vigil = lv24_vigil.cli:main
@@ -0,0 +1 @@
1
+ lv24_vigil
@@ -0,0 +1,194 @@
1
+ """Tests for the Python launcher that delegates to the npm Vigil CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import contextlib
6
+ import io
7
+ import json
8
+ import os
9
+ import re
10
+ import stat
11
+ import sys
12
+ import tempfile
13
+ import unittest
14
+ from pathlib import Path
15
+ from unittest import mock
16
+
17
+ PYTHON_DIR = Path(__file__).resolve().parents[1]
18
+ SRC_DIR = PYTHON_DIR / "src"
19
+ if str(SRC_DIR) not in sys.path:
20
+ sys.path.insert(0, str(SRC_DIR))
21
+
22
+ from lv24_vigil import __version__
23
+ from lv24_vigil.cli import NPM_PACKAGE, NPM_VERSION_ENV, main
24
+
25
+ _FAKE_NPX = '''\
26
+ import json
27
+ import os
28
+ import sys
29
+
30
+ record = {
31
+ "argv": sys.argv[1:],
32
+ "env": {
33
+ key: value
34
+ for key, value in os.environ.items()
35
+ if key.startswith("VIGIL_") or key == "PATH"
36
+ },
37
+ }
38
+ with open(os.environ["VIGIL_TEST_LOG"], "a", encoding="utf-8") as handle:
39
+ handle.write(json.dumps(record, sort_keys=True) + "\\n")
40
+ raise SystemExit(3)
41
+ '''
42
+
43
+
44
+ class MainTests(unittest.TestCase):
45
+ def setUp(self):
46
+ self._tempdir = tempfile.TemporaryDirectory()
47
+ self.addCleanup(self._tempdir.cleanup)
48
+ self.root = Path(self._tempdir.name)
49
+ self.bin_dir = self.root / "bin"
50
+ self.bin_dir.mkdir()
51
+ self.empty_dir = self.root / "empty"
52
+ self.empty_dir.mkdir()
53
+ self.log_path = self.root / "calls.jsonl"
54
+
55
+ self._saved_env = {
56
+ key: os.environ.get(key)
57
+ for key in ("VIGIL_NPM_VERSION", "VIGIL_TEST_LOG")
58
+ }
59
+ self.addCleanup(self._restore_env)
60
+ os.environ.pop("VIGIL_NPM_VERSION", None)
61
+ os.environ["VIGIL_TEST_LOG"] = str(self.log_path)
62
+
63
+ self._write_fake_npx()
64
+
65
+ def _restore_env(self):
66
+ for key, value in self._saved_env.items():
67
+ if value is None:
68
+ os.environ.pop(key, None)
69
+ else:
70
+ os.environ[key] = value
71
+
72
+ def _write_fake_npx(self):
73
+ script = self.bin_dir / "fake_npx.py"
74
+ script.write_text(_FAKE_NPX, encoding="utf-8")
75
+
76
+ if os.name == "nt":
77
+ launcher = self.bin_dir / "npx.cmd"
78
+ content = '@echo off\r\n"{0}" "%~dp0fake_npx.py" %*\r\n'.format(
79
+ sys.executable
80
+ )
81
+ with launcher.open("w", encoding="utf-8", newline="") as handle:
82
+ handle.write(content)
83
+ else:
84
+ launcher = self.bin_dir / "npx"
85
+ content = '#!/bin/sh\nexec "{0}" "${{0%/*}}/fake_npx.py" "$@"\n'.format(
86
+ sys.executable
87
+ )
88
+ launcher.write_text(content, encoding="utf-8")
89
+ launcher.chmod(
90
+ launcher.stat().st_mode
91
+ | stat.S_IXUSR
92
+ | stat.S_IXGRP
93
+ | stat.S_IXOTH
94
+ )
95
+
96
+ def _invoke(self, args, *, env=None, path=None, cwd=None):
97
+ call_env = {
98
+ "PATH": str(self.bin_dir if path is None else path),
99
+ "VIGIL_TEST_LOG": str(self.log_path),
100
+ }
101
+ if os.name == "nt":
102
+ call_env["PATHEXT"] = ".COM;.EXE;.BAT;.CMD"
103
+ if env:
104
+ call_env.update(env)
105
+
106
+ stderr = io.StringIO()
107
+ previous_cwd = os.getcwd()
108
+ if cwd is not None:
109
+ os.chdir(cwd)
110
+ try:
111
+ with mock.patch.dict(os.environ, call_env, clear=False):
112
+ with contextlib.redirect_stderr(stderr):
113
+ code = main(list(args))
114
+ finally:
115
+ if cwd is not None:
116
+ os.chdir(previous_cwd)
117
+ return code, stderr.getvalue()
118
+
119
+ def _calls(self):
120
+ if not self.log_path.exists():
121
+ return []
122
+ return [
123
+ json.loads(line)
124
+ for line in self.log_path.read_text(encoding="utf-8").splitlines()
125
+ if line
126
+ ]
127
+
128
+ def test_forwards_arguments_and_returns_child_exit_code(self):
129
+ code, stderr = self._invoke(["scan", "--no-llm", "."])
130
+
131
+ self.assertEqual(code, 3)
132
+ self.assertEqual(stderr, "")
133
+ calls = self._calls()
134
+ self.assertEqual(len(calls), 1)
135
+ self.assertEqual(
136
+ calls[0]["argv"],
137
+ [
138
+ "--yes",
139
+ "{0}@{1}".format(NPM_PACKAGE, __version__),
140
+ "scan",
141
+ "--no-llm",
142
+ ".",
143
+ ],
144
+ )
145
+
146
+ def test_version_matches_pyproject(self):
147
+ pyproject = PYTHON_DIR / "pyproject.toml"
148
+ match = re.search(
149
+ r'^version\s*=\s*"([^"]+)"',
150
+ pyproject.read_text(encoding="utf-8"),
151
+ re.MULTILINE,
152
+ )
153
+ self.assertIsNotNone(match)
154
+ self.assertEqual(match.group(1), __version__)
155
+
156
+ def test_uses_env_override_and_inherits_it(self):
157
+ code, stderr = self._invoke(
158
+ ["--help"], env={NPM_VERSION_ENV: "latest"}
159
+ )
160
+
161
+ self.assertEqual(code, 3)
162
+ self.assertEqual(stderr, "")
163
+ call = self._calls()[0]
164
+ self.assertEqual(
165
+ call["argv"],
166
+ ["--yes", "{0}@latest".format(NPM_PACKAGE), "--help"],
167
+ )
168
+ self.assertEqual(call["env"][NPM_VERSION_ENV], "latest")
169
+
170
+ def test_missing_npx_returns_127_with_install_hint(self):
171
+ code, stderr = self._invoke(
172
+ [], path=self.empty_dir, cwd=self.empty_dir
173
+ )
174
+
175
+ self.assertEqual(code, 127)
176
+ self.assertIn("npx", stderr)
177
+ self.assertIn("Node.js", stderr)
178
+ self.assertIn("npm", stderr)
179
+ self.assertIn("lv24-vigil", stderr)
180
+ self.assertEqual(self._calls(), [])
181
+
182
+ def test_keyboard_interrupt_returns_130(self):
183
+ with mock.patch(
184
+ "lv24_vigil.cli.subprocess.run",
185
+ side_effect=KeyboardInterrupt,
186
+ ):
187
+ code, stderr = self._invoke([])
188
+
189
+ self.assertEqual(code, 130)
190
+ self.assertEqual(stderr, "")
191
+
192
+
193
+ if __name__ == "__main__":
194
+ unittest.main()