cli-usereq 0.75.16__tar.gz → 0.75.23__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.
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/PKG-INFO +19 -8
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/README.md +17 -7
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/pyproject.toml +2 -1
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/__init__.py +1 -1
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/cli.py +153 -83
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/compress.py +20 -32
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/compress_files.py +12 -22
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/config_cli.py +5 -7
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/config_schema.py +49 -7
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/find_constructs.py +20 -78
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/analyze.md +18 -47
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/change.md +20 -47
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/check.md +18 -46
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/cover.md +20 -47
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/create.md +10 -11
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/fix.md +21 -49
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/flowchart.md +15 -44
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/implement.md +20 -13
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/new.md +24 -52
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/orchestrate.md +12 -12
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/readme.md +17 -45
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/recreate.md +16 -45
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/refactor.md +21 -47
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/references.md +10 -10
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/renumber.md +10 -10
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/workflow.md +16 -45
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/prompts/write.md +10 -10
- cli_usereq-0.75.23/src/usereq/resources/prompts-version.txt +1 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/static_check.py +146 -13
- cli_usereq-0.75.23/src/usereq/table_style.py +153 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/uv.lock +61 -1
- cli_usereq-0.75.16/src/usereq/resources/prompts-version.txt +0 -1
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/LICENSE +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/MANIFEST.in +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/setup.cfg +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/setup.py +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/__main__.py +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/doxygen_parser.py +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/generate_markdown.py +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/guidelines/Google_C++_Style_Guide.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/guidelines/Google_Python_Style_Guide.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/guidelines/Google_TypeScript_Style_Guide.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/guidelines/RFC2119.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/templates/Agentic_Text_Authoring_Guidance.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/templates/Document_Source_Code_in_Doxygen_Style.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/templates/HDT_Test_Authoring_Guide.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/resources/templates/Requirements_Template.md +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/source_analyzer.py +0 -0
- {cli_usereq-0.75.16 → cli_usereq-0.75.23}/src/usereq/token_counter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cli-usereq
|
|
3
|
-
Version: 0.75.
|
|
3
|
+
Version: 0.75.23
|
|
4
4
|
Summary: Initialize a project with prompts, agents, and templates from the useReq repository.
|
|
5
5
|
Author: Ogekuri
|
|
6
6
|
License-Expression: GPL-3.0-only
|
|
@@ -20,6 +20,7 @@ Requires-Dist: tiktoken
|
|
|
20
20
|
Requires-Dist: pyyaml
|
|
21
21
|
Requires-Dist: ruff
|
|
22
22
|
Requires-Dist: pyright
|
|
23
|
+
Requires-Dist: bandit
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
|
|
25
26
|
> [!CAUTION]
|
|
@@ -34,7 +35,7 @@ Dynamic: license-file
|
|
|
34
35
|
> * **No Support or Feature Requests:** Please **do not** open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage of development.
|
|
35
36
|
> * **No Warranty:** This software is provided **"AS IS"**, without warranty of any kind, express or implied. You may use it strictly for **testing and evaluation purposes** at your own sole risk.
|
|
36
37
|
|
|
37
|
-
# useReq / req (0.75.
|
|
38
|
+
# useReq / req (0.75.23)
|
|
38
39
|
|
|
39
40
|
<p align="center">
|
|
40
41
|
<img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
|
|
@@ -276,11 +277,21 @@ Each stored entry exposes the fields `module`, `cmd`, and `params` as writable c
|
|
|
276
277
|
|
|
277
278
|
A standalone testbed is available: `req --test-static-check {dummy,pylance,ruff,command <cmd>} [FILES...]`, where `[FILES]` may be files, directories (direct children only), or glob patterns including `**` recursive expansion.
|
|
278
279
|
|
|
280
|
+
### Static-check installation audit
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
req audit # audit static-check tool installation; --prj-base is optional
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
- `req audit` loads the configured static-check entries from `~/.config/usereq/config.json` (applying the default static-check configuration when the `"static-check"` key is absent) and prints exactly one table with the `Language`, `Static-Check`, and `Installed` columns, one row per configured `Command` entry. Only static-checks of type `Command` (external executables invoked as commands) are audited; internally implemented modules (`Dummy`, `Pylance`, `Ruff`) run through the active Python interpreter and are not audited.
|
|
287
|
+
- Rows are grouped by canonical language in alphabetical order; entries of the same language keep their persisted insertion order. The `Static-Check` cell shows the external binary name (the entry's `cmd` token, for example `cppcheck`); the `Installed` cell shows `yes` or `no` according to a `PATH` lookup of that binary.
|
|
288
|
+
- `--prj-base` is optional: the command runs without it; when provided, it is validated and used as the project-base context of the audit. The audit never executes any checker, so unavailable tools are reported in the table without changing the exit code (always 0).
|
|
289
|
+
|
|
279
290
|
## Command Reference
|
|
280
291
|
|
|
281
292
|
`req` can be run from any directory. Two path arguments drive location resolution:
|
|
282
293
|
|
|
283
|
-
- `--prj-base <project-folder>` — mandatory for commands that read or write project files (`--docs-check`, `--set-*-dir`, and the project-scan subcommands `tokens`, `references`, `compress`, `find`, `static-check`, `files-static-check`); the `install` subcommand neither requires nor accepts it.
|
|
294
|
+
- `--prj-base <project-folder>` — mandatory for commands that read or write project files (`--docs-check`, `--set-*-dir`, and the project-scan subcommands `tokens`, `references`, `compress`, `find`, `static-check`, `files-static-check`); the `install` subcommand neither requires nor accepts it, while `audit` accepts it as optional context.
|
|
284
295
|
- `--git-base <git-repository-folder>` — mandatory for the git commands (`--git-check`, `--git-wt-name`, `--git-wt-create`, `--git-wt-delete`); not required by any analysis subcommand.
|
|
285
296
|
- `--prj-base` and `--git-base` are never persisted in `~/.config/usereq/config.json`.
|
|
286
297
|
- The configuration commands `--print`, `--info`, `--print-raw`, `--get`, `--set`, and `--unset` require neither base argument; paths are resolved from the configuration schema, not from a project.
|
|
@@ -293,18 +304,18 @@ The analysis commands are bare subcommands (no `--` prefix); the project-scan on
|
|
|
293
304
|
| --- | --- |
|
|
294
305
|
| `files-tokens FILE [FILE ...]` | Count tokens and chars for the given files |
|
|
295
306
|
| `files-references FILE [FILE ...]` | Generate LLM reference markdown for the given files |
|
|
296
|
-
| `files-compress
|
|
297
|
-
| `files-find
|
|
307
|
+
| `files-compress FILE [FILE ...]` | Generate compressed output for the given files (lines prefixed with original `<n>:` line numbers) |
|
|
308
|
+
| `files-find TAG PATTERN FILE [FILE ...]` | Find and extract specific constructs from the given files (as-is code, lines prefixed with original `<n>:` line numbers) |
|
|
298
309
|
| `files-static-check --prj-base P FILE [FILE ...]` | Run static analysis on the given files |
|
|
299
310
|
| `tokens --prj-base P` | Count tokens/chars for canonical docs (`REQUIREMENTS.md`, `WORKFLOW.md`, `REFERENCES.md`) in configured `docs-dir` |
|
|
300
311
|
| `references --prj-base P` | Reference markdown for source files selected by `git ls-files --cached --others --exclude-standard` under configured `src-dir` |
|
|
301
|
-
| `compress --prj-base P
|
|
302
|
-
| `find --prj-base P
|
|
312
|
+
| `compress --prj-base P` | Compressed output for the same project selection (lines prefixed with original `<n>:` line numbers) |
|
|
313
|
+
| `find --prj-base P TAG PATTERN` | Extract constructs from the same project selection (as-is code, lines prefixed with original `<n>:` line numbers) |
|
|
303
314
|
| `static-check --prj-base P` | Static analysis on `src-dir` + `tests-dir` selections (excluding `fixtures/`) |
|
|
304
315
|
|
|
305
316
|
Notes:
|
|
306
317
|
|
|
307
|
-
-
|
|
318
|
+
- `files-compress`, `compress`, `files-find`, and `find` always prefix code lines with `<n>:` original source line numbers; no option is needed or available (`--enable-line-numbers` is not accepted). `compress`/`files-compress` strip comments and blank lines; `find`/`files-find` emit extracted construct code as-is, preserving comments.
|
|
308
319
|
- `files-static-check` and `static-check` exit with code 0 when all checked files pass (or none are checked) and 1 when at least one file fails; passing checks produce no output (`fail_only` mode).
|
|
309
320
|
- `static-check` includes files from both `src-dir` and `tests-dir`; if `tests-dir` is missing or invalid, test-directory inclusion is skipped without error.
|
|
310
321
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
> * **No Support or Feature Requests:** Please **do not** open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage of development.
|
|
11
11
|
> * **No Warranty:** This software is provided **"AS IS"**, without warranty of any kind, express or implied. You may use it strictly for **testing and evaluation purposes** at your own sole risk.
|
|
12
12
|
|
|
13
|
-
# useReq / req (0.75.
|
|
13
|
+
# useReq / req (0.75.23)
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
16
|
<img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
|
|
@@ -252,11 +252,21 @@ Each stored entry exposes the fields `module`, `cmd`, and `params` as writable c
|
|
|
252
252
|
|
|
253
253
|
A standalone testbed is available: `req --test-static-check {dummy,pylance,ruff,command <cmd>} [FILES...]`, where `[FILES]` may be files, directories (direct children only), or glob patterns including `**` recursive expansion.
|
|
254
254
|
|
|
255
|
+
### Static-check installation audit
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
req audit # audit static-check tool installation; --prj-base is optional
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- `req audit` loads the configured static-check entries from `~/.config/usereq/config.json` (applying the default static-check configuration when the `"static-check"` key is absent) and prints exactly one table with the `Language`, `Static-Check`, and `Installed` columns, one row per configured `Command` entry. Only static-checks of type `Command` (external executables invoked as commands) are audited; internally implemented modules (`Dummy`, `Pylance`, `Ruff`) run through the active Python interpreter and are not audited.
|
|
262
|
+
- Rows are grouped by canonical language in alphabetical order; entries of the same language keep their persisted insertion order. The `Static-Check` cell shows the external binary name (the entry's `cmd` token, for example `cppcheck`); the `Installed` cell shows `yes` or `no` according to a `PATH` lookup of that binary.
|
|
263
|
+
- `--prj-base` is optional: the command runs without it; when provided, it is validated and used as the project-base context of the audit. The audit never executes any checker, so unavailable tools are reported in the table without changing the exit code (always 0).
|
|
264
|
+
|
|
255
265
|
## Command Reference
|
|
256
266
|
|
|
257
267
|
`req` can be run from any directory. Two path arguments drive location resolution:
|
|
258
268
|
|
|
259
|
-
- `--prj-base <project-folder>` — mandatory for commands that read or write project files (`--docs-check`, `--set-*-dir`, and the project-scan subcommands `tokens`, `references`, `compress`, `find`, `static-check`, `files-static-check`); the `install` subcommand neither requires nor accepts it.
|
|
269
|
+
- `--prj-base <project-folder>` — mandatory for commands that read or write project files (`--docs-check`, `--set-*-dir`, and the project-scan subcommands `tokens`, `references`, `compress`, `find`, `static-check`, `files-static-check`); the `install` subcommand neither requires nor accepts it, while `audit` accepts it as optional context.
|
|
260
270
|
- `--git-base <git-repository-folder>` — mandatory for the git commands (`--git-check`, `--git-wt-name`, `--git-wt-create`, `--git-wt-delete`); not required by any analysis subcommand.
|
|
261
271
|
- `--prj-base` and `--git-base` are never persisted in `~/.config/usereq/config.json`.
|
|
262
272
|
- The configuration commands `--print`, `--info`, `--print-raw`, `--get`, `--set`, and `--unset` require neither base argument; paths are resolved from the configuration schema, not from a project.
|
|
@@ -269,18 +279,18 @@ The analysis commands are bare subcommands (no `--` prefix); the project-scan on
|
|
|
269
279
|
| --- | --- |
|
|
270
280
|
| `files-tokens FILE [FILE ...]` | Count tokens and chars for the given files |
|
|
271
281
|
| `files-references FILE [FILE ...]` | Generate LLM reference markdown for the given files |
|
|
272
|
-
| `files-compress
|
|
273
|
-
| `files-find
|
|
282
|
+
| `files-compress FILE [FILE ...]` | Generate compressed output for the given files (lines prefixed with original `<n>:` line numbers) |
|
|
283
|
+
| `files-find TAG PATTERN FILE [FILE ...]` | Find and extract specific constructs from the given files (as-is code, lines prefixed with original `<n>:` line numbers) |
|
|
274
284
|
| `files-static-check --prj-base P FILE [FILE ...]` | Run static analysis on the given files |
|
|
275
285
|
| `tokens --prj-base P` | Count tokens/chars for canonical docs (`REQUIREMENTS.md`, `WORKFLOW.md`, `REFERENCES.md`) in configured `docs-dir` |
|
|
276
286
|
| `references --prj-base P` | Reference markdown for source files selected by `git ls-files --cached --others --exclude-standard` under configured `src-dir` |
|
|
277
|
-
| `compress --prj-base P
|
|
278
|
-
| `find --prj-base P
|
|
287
|
+
| `compress --prj-base P` | Compressed output for the same project selection (lines prefixed with original `<n>:` line numbers) |
|
|
288
|
+
| `find --prj-base P TAG PATTERN` | Extract constructs from the same project selection (as-is code, lines prefixed with original `<n>:` line numbers) |
|
|
279
289
|
| `static-check --prj-base P` | Static analysis on `src-dir` + `tests-dir` selections (excluding `fixtures/`) |
|
|
280
290
|
|
|
281
291
|
Notes:
|
|
282
292
|
|
|
283
|
-
-
|
|
293
|
+
- `files-compress`, `compress`, `files-find`, and `find` always prefix code lines with `<n>:` original source line numbers; no option is needed or available (`--enable-line-numbers` is not accepted). `compress`/`files-compress` strip comments and blank lines; `find`/`files-find` emit extracted construct code as-is, preserving comments.
|
|
284
294
|
- `files-static-check` and `static-check` exit with code 0 when all checked files pass (or none are checked) and 1 when at least one file fails; passing checks produce no output (`fail_only` mode).
|
|
285
295
|
- `static-check` includes files from both `src-dir` and `tests-dir`; if `tests-dir` is missing or invalid, test-directory inclusion is skipped without error.
|
|
286
296
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cli-usereq"
|
|
7
|
-
version = "0.75.
|
|
7
|
+
version = "0.75.23"
|
|
8
8
|
description = "Initialize a project with prompts, agents, and templates from the useReq repository."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -15,6 +15,7 @@ dependencies = [
|
|
|
15
15
|
"pyyaml",
|
|
16
16
|
"ruff",
|
|
17
17
|
"pyright",
|
|
18
|
+
"bandit",
|
|
18
19
|
]
|
|
19
20
|
authors = [
|
|
20
21
|
{ name = "Ogekuri" }
|
|
@@ -18,7 +18,7 @@ from . import source_analyzer # usereq.source_analyzer submodule
|
|
|
18
18
|
from . import token_counter # usereq.token_counter submodule
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
-
__version__ = "0.75.
|
|
21
|
+
__version__ = "0.75.23"
|
|
22
22
|
"""! @brief Semantic version string of the package."""
|
|
23
23
|
|
|
24
24
|
|
|
@@ -38,6 +38,13 @@ from .config_schema import (
|
|
|
38
38
|
DEFAULT_TESTS_DIR,
|
|
39
39
|
VALID_PROVIDER_NAMES,
|
|
40
40
|
)
|
|
41
|
+
from .table_style import (
|
|
42
|
+
TABLE_BORDER_GLYPHS,
|
|
43
|
+
bottom_border,
|
|
44
|
+
header_separator,
|
|
45
|
+
row_separator,
|
|
46
|
+
top_border,
|
|
47
|
+
)
|
|
41
48
|
|
|
42
49
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
43
50
|
"""! @brief The absolute path to the repository root."""
|
|
@@ -410,18 +417,19 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
410
417
|
``_require_prj_base``) and ``--git-base`` is never mandatory for any SRS-408 subcommand
|
|
411
418
|
(SRS-392, SRS-393, SRS-396, SRS-397, SRS-410). The ``--force`` auxiliary argument is
|
|
412
419
|
accepted by ``--upgrade`` (with or without ``--develop``/``--dev``) and forces full
|
|
413
|
-
package download and complete reinstallation (SRS-508, SRS-511).
|
|
420
|
+
package download and complete reinstallation (SRS-508, SRS-511). The ``audit``
|
|
421
|
+
subcommand accepts optional ``--prj-base`` context, audits every configured
|
|
422
|
+
static-check entry installation, and never requires ``--prj-base`` (SRS-621..SRS-628).
|
|
414
423
|
"""
|
|
415
424
|
usage = (
|
|
416
425
|
"req [-h] [--upgrade] [--develop] [--dev] [--force] [--uninstall] [--prj-base PRJ_BASE] [--git-base GIT_BASE] "
|
|
417
426
|
"[--set-docs-dir DOCS_DIR] [--set-src-dir SRC_DIR] [--set-tests-dir TESTS_DIR] [--verbose] [--debug] "
|
|
418
427
|
"[--print [PATH]] [--info [PATH]] [--print-raw] [--write-config] [--get PATH] [--set PATH VALUE] [--unset PATH] "
|
|
419
428
|
"[--enable PROVIDER] [--disable PROVIDER] [--enable-auto-install] [--disable-auto-install] "
|
|
420
|
-
"[--enable-line-numbers] "
|
|
421
429
|
"[--enable-static-check SPEC] [--disable-static-check SPEC] "
|
|
422
430
|
"[--test-static-check {dummy,pylance,ruff,command} [FILES...]] "
|
|
423
431
|
"[--git-check] [--docs-check] [--git-wt-name] [--git-wt-create WT_NAME] [--git-wt-delete WT_NAME] "
|
|
424
|
-
"{files-tokens,files-references,files-compress,files-find,tokens,references,compress,find,files-static-check,static-check,install,uninstall,show} ..."
|
|
432
|
+
"{files-tokens,files-references,files-compress,files-find,tokens,references,compress,find,files-static-check,static-check,install,audit,uninstall,show} ..."
|
|
425
433
|
)
|
|
426
434
|
parser = argparse.ArgumentParser(
|
|
427
435
|
description="Initialize a project with useReq resources.",
|
|
@@ -621,12 +629,6 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
621
629
|
dest="disable_auto_install",
|
|
622
630
|
help="Skip automatic provider reinstallation after a successful --upgrade.",
|
|
623
631
|
)
|
|
624
|
-
parser.add_argument(
|
|
625
|
-
"--enable-line-numbers",
|
|
626
|
-
action="store_true",
|
|
627
|
-
default=False,
|
|
628
|
-
help="Enable line number prefixes (<n>:) in output for files-compress, compress, files-find, and find subcommands (disabled by default).",
|
|
629
|
-
)
|
|
630
632
|
parser.add_argument(
|
|
631
633
|
"--test-static-check",
|
|
632
634
|
nargs=argparse.REMAINDER,
|
|
@@ -736,14 +738,6 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
736
738
|
dest="git_base",
|
|
737
739
|
help="Absolute git repository base directory; optional runtime context for analysis subcommands.",
|
|
738
740
|
)
|
|
739
|
-
line_number_options = argparse.ArgumentParser(add_help=False)
|
|
740
|
-
line_number_options.add_argument(
|
|
741
|
-
"--enable-line-numbers",
|
|
742
|
-
action="store_true",
|
|
743
|
-
default=argparse.SUPPRESS,
|
|
744
|
-
dest="enable_line_numbers",
|
|
745
|
-
help="Enable line number prefixes (<n>:) in output (disabled by default).",
|
|
746
|
-
)
|
|
747
741
|
# SRS-447: the install subparser does not define or consume --prj-base; install
|
|
748
742
|
# is fully user-level and performs no project-side operations (SRS-448).
|
|
749
743
|
install_options = argparse.ArgumentParser(add_help=False)
|
|
@@ -758,7 +752,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
758
752
|
metavar=(
|
|
759
753
|
"{files-tokens,files-references,files-compress,files-find,tokens,"
|
|
760
754
|
"references,compress,find,files-static-check,static-check,"
|
|
761
|
-
"install,uninstall,show}"
|
|
755
|
+
"install,audit,uninstall,show}"
|
|
762
756
|
),
|
|
763
757
|
)
|
|
764
758
|
|
|
@@ -780,20 +774,24 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
780
774
|
|
|
781
775
|
sub = subparsers.add_parser(
|
|
782
776
|
"files-compress",
|
|
783
|
-
parents=[base_options
|
|
784
|
-
usage="req files-compress
|
|
785
|
-
help=
|
|
777
|
+
parents=[base_options],
|
|
778
|
+
usage="req files-compress FILE [FILE ...]",
|
|
779
|
+
help=(
|
|
780
|
+
"Generate compressed output for the given files; code lines carry "
|
|
781
|
+
"`<n>:` source line-number prefixes by default."
|
|
782
|
+
),
|
|
786
783
|
)
|
|
787
784
|
sub.add_argument("files_compress", nargs="+", metavar="FILE")
|
|
788
785
|
|
|
789
786
|
sub = subparsers.add_parser(
|
|
790
787
|
"files-find",
|
|
791
|
-
parents=[base_options
|
|
792
|
-
usage="req files-find
|
|
788
|
+
parents=[base_options],
|
|
789
|
+
usage="req files-find TAG PATTERN FILE [FILE ...]",
|
|
793
790
|
help=(
|
|
794
791
|
"Find and extract specific constructs: files-find TAG PATTERN FILE ... "
|
|
795
792
|
"TAG accepts pipe-separated tags; the per-language tag catalog is "
|
|
796
|
-
"printed on invalid TAG or non-matching filter errors."
|
|
793
|
+
"printed on invalid TAG or non-matching filter errors. Extracted code "
|
|
794
|
+
"is emitted as-is with `<n>:` source line-number prefixes."
|
|
797
795
|
),
|
|
798
796
|
)
|
|
799
797
|
sub.add_argument("files_find", nargs="+", metavar="ARG")
|
|
@@ -820,22 +818,25 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
820
818
|
|
|
821
819
|
sub = subparsers.add_parser(
|
|
822
820
|
"compress",
|
|
823
|
-
parents=[base_options
|
|
824
|
-
usage="req compress --prj-base PRJ_BASE
|
|
821
|
+
parents=[base_options],
|
|
822
|
+
usage="req compress --prj-base PRJ_BASE",
|
|
825
823
|
help=(
|
|
826
824
|
"Generate compressed output for all source files in the configured "
|
|
827
|
-
"src-dir directories
|
|
825
|
+
"src-dir directories; code lines carry `<n>:` source line-number "
|
|
826
|
+
"prefixes by default."
|
|
828
827
|
),
|
|
829
828
|
)
|
|
830
829
|
|
|
831
830
|
sub = subparsers.add_parser(
|
|
832
831
|
"find",
|
|
833
|
-
parents=[base_options
|
|
834
|
-
usage=
|
|
832
|
+
parents=[base_options],
|
|
833
|
+
usage="req find --prj-base PRJ_BASE TAG PATTERN",
|
|
835
834
|
help=(
|
|
836
835
|
"Find and extract specific constructs from the configured src-dir: "
|
|
837
836
|
"find TAG PATTERN. TAG accepts pipe-separated tags; the per-language "
|
|
838
|
-
"tag catalog is printed on invalid TAG or non-matching filter errors."
|
|
837
|
+
"tag catalog is printed on invalid TAG or non-matching filter errors. "
|
|
838
|
+
"Extracted code is emitted as-is with `<n>:` source line-number "
|
|
839
|
+
"prefixes."
|
|
839
840
|
),
|
|
840
841
|
)
|
|
841
842
|
sub.add_argument("find", nargs=2, metavar=("TAG", "PATTERN"))
|
|
@@ -887,6 +888,19 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
887
888
|
"and enabled static-check entries as tables."
|
|
888
889
|
),
|
|
889
890
|
)
|
|
891
|
+
|
|
892
|
+
# audit (SRS-621..SRS-628): audits the installation of every configured
|
|
893
|
+
# static-check entry; --prj-base is optional context and is never mandatory.
|
|
894
|
+
sub = subparsers.add_parser(
|
|
895
|
+
"audit",
|
|
896
|
+
parents=[base_options],
|
|
897
|
+
usage="req audit",
|
|
898
|
+
help=(
|
|
899
|
+
"Audit the installation of every configured static-check tool and "
|
|
900
|
+
"print one table with Language, Static-Check, and Installed columns; "
|
|
901
|
+
"--prj-base is optional context."
|
|
902
|
+
),
|
|
903
|
+
)
|
|
890
904
|
return parser
|
|
891
905
|
|
|
892
906
|
|
|
@@ -2904,7 +2918,7 @@ def _render_simple_table(headers: list[str], rows: list[list[str]]) -> str:
|
|
|
2904
2918
|
@brief Render one Unicode box-drawing table from headers and rows.
|
|
2905
2919
|
@param headers {list[str]} Column header labels.
|
|
2906
2920
|
@param rows {list[list[str]]} Cell values per row; every row matches the header count.
|
|
2907
|
-
@return {str} Multi-line table with `│` separators and
|
|
2921
|
+
@return {str} Multi-line table with rounded `╭`/`╮`/`╰`/`╯` borders, `│` separators, and the double-line `╞`/`═`/`╪`/`╡` header separator (SRS-636, SRS-637), no ANSI styling.
|
|
2908
2922
|
@details Pure deterministic formatting used by the `show` subcommand (SRS-416, SRS-417).
|
|
2909
2923
|
"""
|
|
2910
2924
|
widths = [len(header) for header in headers]
|
|
@@ -2919,12 +2933,9 @@ def _render_simple_table(headers: list[str], rows: list[list[str]]) -> str:
|
|
|
2919
2933
|
+ " │"
|
|
2920
2934
|
)
|
|
2921
2935
|
|
|
2922
|
-
|
|
2923
|
-
return left + middle.join("─" * (width + 2) for width in widths) + right
|
|
2924
|
-
|
|
2925
|
-
lines = [_border("┌", "┬", "┐"), _line(headers), _border("├", "┼", "┤")]
|
|
2936
|
+
lines = [top_border(widths), _line(headers), header_separator(widths)]
|
|
2926
2937
|
lines.extend(_line(row) for row in rows)
|
|
2927
|
-
lines.append(
|
|
2938
|
+
lines.append(bottom_border(widths))
|
|
2928
2939
|
return "\n".join(lines)
|
|
2929
2940
|
|
|
2930
2941
|
|
|
@@ -3097,6 +3108,48 @@ def run_show(args: Namespace) -> None:
|
|
|
3097
3108
|
print("(none)")
|
|
3098
3109
|
|
|
3099
3110
|
|
|
3111
|
+
def run_audit(args: Namespace) -> None:
|
|
3112
|
+
"""!
|
|
3113
|
+
@brief Execute audit: audit configured static-check tool installation as a table.
|
|
3114
|
+
@param args Parsed CLI namespace carrying the optional `--prj-base` value.
|
|
3115
|
+
@return {None} Function return value.
|
|
3116
|
+
@details Resolves the optional `--prj-base` through the SRS-395 existence validation
|
|
3117
|
+
when provided and never requires it (SRS-621, SRS-622); loads the static-check entries
|
|
3118
|
+
from `~/.config/usereq/config.json`, resolving the SRS-424 default configuration when
|
|
3119
|
+
the `"static-check"` key is absent (SRS-623); audits only `Command` entries through
|
|
3120
|
+
`shutil.which(cmd)` (SRS-624) and prints exactly one audit table with `Language`,
|
|
3121
|
+
`Static-Check`, and `Installed` columns whose `Static-Check` cells render the complete
|
|
3122
|
+
checker command (`cmd` followed by every `params` element in stored order, SRS-627)
|
|
3123
|
+
and whose `Installed` cells render `yes`/`no` per `PATH` resolution (SRS-640)
|
|
3124
|
+
(SRS-625, SRS-626). No checker subprocess executes, so individual unavailable binaries
|
|
3125
|
+
never change the exit code (SRS-628). Complexity: O(E) over E configured entries.
|
|
3126
|
+
Side effects: one stdout audit-table emission.
|
|
3127
|
+
@throws ReqError If a provided `--prj-base` is absent or does not exist (SRS-395).
|
|
3128
|
+
@satisfies SRS-621, SRS-622, SRS-623, SRS-624, SRS-625, SRS-626, SRS-627, SRS-628, SRS-640
|
|
3129
|
+
"""
|
|
3130
|
+
from .static_check import audit_static_check_installation
|
|
3131
|
+
|
|
3132
|
+
prj_base = getattr(args, "prj_base", None)
|
|
3133
|
+
if prj_base is not None:
|
|
3134
|
+
_require_prj_base(args)
|
|
3135
|
+
static_check_config = load_static_check_from_config()
|
|
3136
|
+
audit_rows = audit_static_check_installation(static_check_config)
|
|
3137
|
+
table_rows = [
|
|
3138
|
+
[language, label, "yes" if installed else "no"]
|
|
3139
|
+
for language, label, installed in audit_rows
|
|
3140
|
+
]
|
|
3141
|
+
print()
|
|
3142
|
+
print("Static Checks Installation Audit")
|
|
3143
|
+
if table_rows:
|
|
3144
|
+
print(
|
|
3145
|
+
_render_simple_table(
|
|
3146
|
+
["Language", "Static-Check", "Installed"], table_rows
|
|
3147
|
+
)
|
|
3148
|
+
)
|
|
3149
|
+
else:
|
|
3150
|
+
print("(none)")
|
|
3151
|
+
|
|
3152
|
+
|
|
3100
3153
|
def _maybe_auto_install_after_upgrade(argv_list: list[str]) -> None:
|
|
3101
3154
|
"""!
|
|
3102
3155
|
@brief Run the provider installation flow after a successful `--upgrade`.
|
|
@@ -3367,14 +3420,14 @@ def run(args: Namespace) -> None:
|
|
|
3367
3420
|
and `Skills Installed` columns (SRS-291). Rows are rendered only for providers
|
|
3368
3421
|
whose skills were installed during the current invocation (SRS-036), in
|
|
3369
3422
|
alphabetical order. `Skills Installed` wraps overflowing content onto
|
|
3370
|
-
subsequent lines at a maximum width of 50 characters (SRS-290). Borders
|
|
3371
|
-
|
|
3372
|
-
(SRS-049).
|
|
3423
|
+
subsequent lines at a maximum width of 50 characters (SRS-290). Borders use
|
|
3424
|
+
rounded corner glyphs, the double-line header separator, single-line inter-row
|
|
3425
|
+
separators, and bright-red ANSI styling (SRS-049, SRS-636, SRS-637, SRS-638).
|
|
3373
3426
|
@note Complexity: O(C * (S log S)) where C is provider count and S is installed skills per provider.
|
|
3374
3427
|
@note Side effects: None (pure formatting).
|
|
3375
3428
|
@param skills_map {dict[str, set[str]]} Mapping: provider name -> installed skill identifiers.
|
|
3376
3429
|
@return {list[str]} Fully formatted table lines (including separators) ready for printing.
|
|
3377
|
-
@satisfies SRS-036, SRS-049, SRS-290, SRS-291
|
|
3430
|
+
@satisfies SRS-036, SRS-049, SRS-290, SRS-291, SRS-636, SRS-637, SRS-638
|
|
3378
3431
|
"""
|
|
3379
3432
|
columns = ("Provider", "Skills Installed")
|
|
3380
3433
|
rows: list[tuple[str, str]] = []
|
|
@@ -3436,19 +3489,19 @@ def run(args: Namespace) -> None:
|
|
|
3436
3489
|
lines.append(f"\u2502 {provider_part} \u2502 {skill_part} \u2502")
|
|
3437
3490
|
return lines
|
|
3438
3491
|
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
bottom =
|
|
3492
|
+
column_widths = [provider_width, skills_width]
|
|
3493
|
+
top = top_border(column_widths)
|
|
3494
|
+
header_sep = header_separator(column_widths)
|
|
3495
|
+
row_sep = row_separator(column_widths)
|
|
3496
|
+
bottom = bottom_border(column_widths)
|
|
3444
3497
|
|
|
3445
3498
|
lines: list[str] = [top]
|
|
3446
3499
|
lines.extend(_render_row(*columns))
|
|
3447
|
-
lines.append(
|
|
3500
|
+
lines.append(header_sep)
|
|
3448
3501
|
for index, row in enumerate(rows):
|
|
3449
3502
|
lines.extend(_render_row(*row))
|
|
3450
3503
|
if index != len(rows) - 1:
|
|
3451
|
-
lines.append(
|
|
3504
|
+
lines.append(row_sep)
|
|
3452
3505
|
lines.append(bottom)
|
|
3453
3506
|
return lines
|
|
3454
3507
|
|
|
@@ -3459,9 +3512,7 @@ def run(args: Namespace) -> None:
|
|
|
3459
3512
|
@param line {str} One already-rendered table line.
|
|
3460
3513
|
@return {str} Line with border glyphs wrapped in ANSI bright-red and reset sequences.
|
|
3461
3514
|
"""
|
|
3462
|
-
border_chars =
|
|
3463
|
-
"\u250c\u252c\u2510\u251c\u253c\u2524\u2514\u2534\u2518\u2500\u2502"
|
|
3464
|
-
)
|
|
3515
|
+
border_chars = TABLE_BORDER_GLYPHS
|
|
3465
3516
|
return "".join(
|
|
3466
3517
|
f"{ANSI_BRIGHT_RED}{char}{ANSI_RESET}" if char in border_chars else char
|
|
3467
3518
|
for char in line
|
|
@@ -3520,6 +3571,20 @@ This repository is structured exclusively for documentation or otherwise lacks a
|
|
|
3520
3571
|
</system_directive>"""
|
|
3521
3572
|
"""Canonical empty-references system-directive payload emitted when no supported source file is selected (SRS-581, SRS-582)."""
|
|
3522
3573
|
|
|
3574
|
+
EMPTY_STATIC_CHECK_DIRECTIVE = """<system_directive>
|
|
3575
|
+
[STATUS]: SUCCESS
|
|
3576
|
+
[STATIC_CHECK_RESULT]: NO_SOURCE_CODE_DETECTED
|
|
3577
|
+
|
|
3578
|
+
[CONTEXT_UPDATE]
|
|
3579
|
+
This repository is structured exclusively for documentation or otherwise lacks analyzable source code. Consequently, this `req-static-check` return SUCCESS by definition.
|
|
3580
|
+
|
|
3581
|
+
[AGENT_INSTRUCTIONS]
|
|
3582
|
+
1. Do not attempt to search, extract, or index source code references within this project.
|
|
3583
|
+
2. Update current context to reflect that the `req-static-check` skill and the `/req-static-check` command are **UNNECESSARY** and **DEPRECATED** for this specific repository.
|
|
3584
|
+
3. Do not invoke or prompt the user to execute the `/req-static-check` command during any future interactions within this workspace.
|
|
3585
|
+
</system_directive>"""
|
|
3586
|
+
"""Canonical empty-static-check system-directive payload emitted when the static-check selection contains zero supported source files (SRS-614..SRS-617)."""
|
|
3587
|
+
|
|
3523
3588
|
|
|
3524
3589
|
def _collect_source_files(src_dirs: list[str], project_base: Path) -> list[str]:
|
|
3525
3590
|
"""!
|
|
@@ -4060,34 +4125,31 @@ def run_files_references(files: list[str]) -> None:
|
|
|
4060
4125
|
print(md)
|
|
4061
4126
|
|
|
4062
4127
|
|
|
4063
|
-
def run_files_compress(files: list[str]
|
|
4128
|
+
def run_files_compress(files: list[str]) -> None:
|
|
4064
4129
|
"""!
|
|
4065
|
-
@brief Execute files-compress: compress arbitrary files.
|
|
4066
|
-
@param files List of source file paths to compress.
|
|
4067
|
-
@
|
|
4068
|
-
@details Renders output header paths relative to current working directory.
|
|
4130
|
+
@brief Execute files-compress: compress arbitrary files with line-numbered output.
|
|
4131
|
+
@param files {List[str]} List of source file paths to compress.
|
|
4132
|
+
@details Renders output header paths relative to current working directory. Line numbers are always emitted (SRS-605); no line-number option exists (SRS-606).
|
|
4069
4133
|
@return {None} Function return value.
|
|
4070
|
-
@satisfies SRS-408
|
|
4134
|
+
@satisfies SRS-408, SRS-605, SRS-606
|
|
4071
4135
|
"""
|
|
4072
4136
|
from .compress_files import compress_files
|
|
4073
4137
|
|
|
4074
4138
|
output = compress_files(
|
|
4075
4139
|
files,
|
|
4076
|
-
include_line_numbers=enable_line_numbers,
|
|
4077
4140
|
verbose=VERBOSE,
|
|
4078
4141
|
output_base=Path.cwd().resolve(),
|
|
4079
4142
|
)
|
|
4080
4143
|
print(output)
|
|
4081
4144
|
|
|
4082
4145
|
|
|
4083
|
-
def run_files_find(args_list: list[str]
|
|
4146
|
+
def run_files_find(args_list: list[str]) -> None:
|
|
4084
4147
|
"""!
|
|
4085
|
-
@brief Execute files-find: find constructs in arbitrary files.
|
|
4086
|
-
@param args_list Combined list: [TAG, PATTERN, FILE1, FILE2, ...].
|
|
4087
|
-
|
|
4088
|
-
@details Implements the run_files_find function behavior with deterministic control flow.
|
|
4148
|
+
@brief Execute files-find: find constructs in arbitrary files with as-is line-numbered extracts.
|
|
4149
|
+
@param args_list {List[str]} Combined list: [TAG, PATTERN, FILE1, FILE2, ...].
|
|
4150
|
+
@details Line numbers are always emitted (SRS-605); extracted code is copied as-is without comment stripping (SRS-609).
|
|
4089
4151
|
@return {None} Function return value.
|
|
4090
|
-
@satisfies SRS-236, SRS-408
|
|
4152
|
+
@satisfies SRS-236, SRS-408, SRS-605, SRS-609
|
|
4091
4153
|
"""
|
|
4092
4154
|
from .find_constructs import find_constructs_in_files
|
|
4093
4155
|
|
|
@@ -4104,7 +4166,6 @@ def run_files_find(args_list: list[str], enable_line_numbers: bool = False) -> N
|
|
|
4104
4166
|
files,
|
|
4105
4167
|
tag_filter,
|
|
4106
4168
|
pattern,
|
|
4107
|
-
include_line_numbers=enable_line_numbers,
|
|
4108
4169
|
verbose=VERBOSE,
|
|
4109
4170
|
)
|
|
4110
4171
|
print(output)
|
|
@@ -4152,7 +4213,6 @@ def run_compress_cmd(args: Namespace) -> None:
|
|
|
4152
4213
|
raise ReqError("Error: no source files found in configured directories.", 1)
|
|
4153
4214
|
output = compress_files(
|
|
4154
4215
|
files,
|
|
4155
|
-
include_line_numbers=getattr(args, "enable_line_numbers", False),
|
|
4156
4216
|
verbose=VERBOSE,
|
|
4157
4217
|
output_base=project_base,
|
|
4158
4218
|
)
|
|
@@ -4182,7 +4242,6 @@ def run_find(args: Namespace) -> None:
|
|
|
4182
4242
|
files,
|
|
4183
4243
|
tag_filter,
|
|
4184
4244
|
pattern,
|
|
4185
|
-
include_line_numbers=getattr(args, "enable_line_numbers", False),
|
|
4186
4245
|
verbose=VERBOSE,
|
|
4187
4246
|
)
|
|
4188
4247
|
print(output)
|
|
@@ -4237,12 +4296,14 @@ def run_files_static_check_cmd(files: list[str], args: Namespace) -> int:
|
|
|
4237
4296
|
- Looks up language in the `"static-check"` config section; skips silently if absent.
|
|
4238
4297
|
- Executes each configured language entry sequentially via
|
|
4239
4298
|
`dispatch_static_check_for_file(filepath, lang_config, fail_only=True, project_base=...)`.
|
|
4240
|
-
- For `Command` module entries, execution order is `<cmd> [params...] <filename
|
|
4299
|
+
- For `Command` module entries, execution order is `<cmd> [params...] <filename>`;
|
|
4300
|
+
Command `cargo` entries dispatch crate-level `<cmd> [params...]` with the subprocess
|
|
4301
|
+
working directory set to the input file's parent directory (SRS-632).
|
|
4241
4302
|
Dispatch context provides project root for checker runtime execution.
|
|
4242
4303
|
All checks execute with `fail_only=True`: passing checks produce no stdout output (SRS-253).
|
|
4243
4304
|
The command ignores `"scan-by-dir"` and always dispatches per explicit input file (SRS-591).
|
|
4244
4305
|
Overall exit code: max of all per-file codes (0=all pass, 1=any fail). (SRS-253, SRS-255)
|
|
4245
|
-
@see SRS-253, SRS-254, SRS-255, SRS-341, SRS-396, SRS-408, SRS-591
|
|
4306
|
+
@see SRS-253, SRS-254, SRS-255, SRS-341, SRS-396, SRS-408, SRS-591, SRS-632
|
|
4246
4307
|
"""
|
|
4247
4308
|
from .static_check import STATIC_CHECK_EXT_TO_LANG, dispatch_static_check_for_file
|
|
4248
4309
|
|
|
@@ -4292,7 +4353,8 @@ def run_project_static_check_cmd(args: Namespace) -> int:
|
|
|
4292
4353
|
"""!
|
|
4293
4354
|
@brief Execute `static-check`: run static analysis on project source and test files.
|
|
4294
4355
|
@param args Parsed CLI namespace; requires the mandatory `--prj-base` argument.
|
|
4295
|
-
@return Exit code: 0 if all checked files pass
|
|
4356
|
+
@return Exit code: 0 if all checked files pass, when none are checked, or when zero supported
|
|
4357
|
+
source files are selected (SRS-614 payload printed to stdout); 1 if any file fails.
|
|
4296
4358
|
@details
|
|
4297
4359
|
Collects files from configured `src-dir` directories and the `tests-dir` directory
|
|
4298
4360
|
(SRS-256, SRS-336), applies `EXCLUDED_DIRS` filtering and `SUPPORTED_EXTENSIONS` matching.
|
|
@@ -4312,18 +4374,26 @@ def run_project_static_check_cmd(args: Namespace) -> int:
|
|
|
4312
4374
|
(SRS-584, SRS-585).
|
|
4313
4375
|
- Dispatches `"scan-by-dir"`-false entries per selected file via
|
|
4314
4376
|
`dispatch_static_check_for_file(filepath, lang_config, fail_only=True, project_base=...)`
|
|
4315
|
-
(SRS-587); for `Command` entries, execution order is `<cmd> [params...] <filename
|
|
4377
|
+
(SRS-587); for `Command` entries, execution order is `<cmd> [params...] <filename>`,
|
|
4378
|
+
except Command `cargo` entries which dispatch crate-level `<cmd> [params...]` with the
|
|
4379
|
+
subprocess working directory set to the input file's parent directory (SRS-632).
|
|
4316
4380
|
- Dispatches `"scan-by-dir"`-true entries as exactly one recursive
|
|
4317
4381
|
`dispatch_static_check_for_directory(root, lang_config, fail_only=True, project_base=...)`
|
|
4318
4382
|
invocation per root containing selected files of the entry's language (SRS-588, SRS-589);
|
|
4319
|
-
for `Command` entries, execution order is `<cmd> [params...] <root
|
|
4383
|
+
for `Command` entries, execution order is `<cmd> [params...] <root>`, except Command
|
|
4384
|
+
`cargo` entries which dispatch crate-level `<cmd> [params...]` with the subprocess
|
|
4385
|
+
working directory set to the scanned root (SRS-633).
|
|
4320
4386
|
- Excludes existing fixture-corpus directories from directory invocations through
|
|
4321
|
-
module-native exclusion flags (SRS-590)
|
|
4387
|
+
module-native exclusion flags (SRS-590); Command `cargo` invocations receive no
|
|
4388
|
+
exclusion flags and rely on cargo manifest dependency-graph discovery (SRS-634).
|
|
4322
4389
|
Dispatch context provides project root for checker runtime execution.
|
|
4323
4390
|
All checks execute with `fail_only=True`: passing checks produce no stdout output (SRS-256).
|
|
4391
|
+
When the selection contains zero supported source files, prints the canonical
|
|
4392
|
+
`EMPTY_STATIC_CHECK_DIRECTIVE` system-directive payload to stdout and returns 0 instead
|
|
4393
|
+
of raising (SRS-614..SRS-617).
|
|
4324
4394
|
Overall exit code: max of all dispatch codes (0=all pass, 1=any fail). (SRS-256, SRS-257)
|
|
4325
|
-
@throws ReqError
|
|
4326
|
-
@see SRS-256, SRS-257, SRS-336, SRS-341, SRS-396, SRS-408, SRS-584, SRS-585, SRS-587, SRS-588, SRS-589, SRS-590, SRS-592
|
|
4395
|
+
@throws ReqError Raised when `--prj-base` is absent or a configured directory value is invalid.
|
|
4396
|
+
@see SRS-256, SRS-257, SRS-336, SRS-341, SRS-396, SRS-408, SRS-584, SRS-585, SRS-587, SRS-588, SRS-589, SRS-590, SRS-592, SRS-614, SRS-615, SRS-616, SRS-617, SRS-632, SRS-633, SRS-634
|
|
4327
4397
|
"""
|
|
4328
4398
|
from .static_check import (
|
|
4329
4399
|
STATIC_CHECK_EXT_TO_LANG,
|
|
@@ -4379,7 +4449,10 @@ def run_project_static_check_cmd(args: Namespace) -> int:
|
|
|
4379
4449
|
filtered_files.append(filepath)
|
|
4380
4450
|
files = filtered_files
|
|
4381
4451
|
if not files:
|
|
4382
|
-
|
|
4452
|
+
# SRS-614: zero supported source files print the canonical empty-static-check
|
|
4453
|
+
# system-directive payload to stdout and succeed instead of failing.
|
|
4454
|
+
print(EMPTY_STATIC_CHECK_DIRECTIVE)
|
|
4455
|
+
return 0
|
|
4383
4456
|
|
|
4384
4457
|
# SRS-588: ordered, deduplicated scan roots = configured src-dir entries plus tests-dir.
|
|
4385
4458
|
scan_roots: list[Path] = []
|
|
@@ -4657,6 +4730,9 @@ def main(argv: Optional[list[str]] = None) -> int:
|
|
|
4657
4730
|
if command == "show":
|
|
4658
4731
|
run_show(args)
|
|
4659
4732
|
return 0
|
|
4733
|
+
if command == "audit":
|
|
4734
|
+
run_audit(args)
|
|
4735
|
+
return 0
|
|
4660
4736
|
# Bare analysis subcommands (SRS-408); --prj-base is enforced by the handlers
|
|
4661
4737
|
# that consume it (SRS-396, SRS-410) and no subcommand requires --git-base.
|
|
4662
4738
|
if command is not None:
|
|
@@ -4665,15 +4741,9 @@ def main(argv: Optional[list[str]] = None) -> int:
|
|
|
4665
4741
|
elif command == "files-references":
|
|
4666
4742
|
run_files_references(args.files_references)
|
|
4667
4743
|
elif command == "files-compress":
|
|
4668
|
-
run_files_compress(
|
|
4669
|
-
args.files_compress,
|
|
4670
|
-
enable_line_numbers=getattr(args, "enable_line_numbers", False),
|
|
4671
|
-
)
|
|
4744
|
+
run_files_compress(args.files_compress)
|
|
4672
4745
|
elif command == "files-find":
|
|
4673
|
-
run_files_find(
|
|
4674
|
-
args.files_find,
|
|
4675
|
-
enable_line_numbers=getattr(args, "enable_line_numbers", False),
|
|
4676
|
-
)
|
|
4746
|
+
run_files_find(args.files_find)
|
|
4677
4747
|
elif command == "files-static-check":
|
|
4678
4748
|
return run_files_static_check_cmd(args.files_static_check, args)
|
|
4679
4749
|
elif command == "references":
|