cli-usereq 0.74.0__tar.gz → 0.75.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 (70) hide show
  1. {cli_usereq-0.74.0/src/cli_usereq.egg-info → cli_usereq-0.75.0}/PKG-INFO +4 -4
  2. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/README.md +3 -3
  3. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/pyproject.toml +1 -1
  4. {cli_usereq-0.74.0 → cli_usereq-0.75.0/src/cli_usereq.egg-info}/PKG-INFO +4 -4
  5. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/__init__.py +1 -1
  6. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/cli.py +54 -31
  7. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_cli.py +55 -23
  8. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/LICENSE +0 -0
  9. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/setup.cfg +0 -0
  10. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/cli_usereq.egg-info/SOURCES.txt +0 -0
  11. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/cli_usereq.egg-info/dependency_links.txt +0 -0
  12. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/cli_usereq.egg-info/entry_points.txt +0 -0
  13. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/cli_usereq.egg-info/requires.txt +0 -0
  14. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/cli_usereq.egg-info/top_level.txt +0 -0
  15. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/__main__.py +0 -0
  16. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/compress.py +0 -0
  17. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/compress_files.py +0 -0
  18. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/doxygen_parser.py +0 -0
  19. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/find_constructs.py +0 -0
  20. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/generate_markdown.py +0 -0
  21. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/guidelines/Google_C++_Style_Guide.md +0 -0
  22. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/guidelines/Google_Python_Style_Guide.md +0 -0
  23. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/guidelines/Google_TypeScript_Style_Guide.md +0 -0
  24. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/guidelines/RFC2119.md +0 -0
  25. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/analyze.md +0 -0
  26. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/change.md +0 -0
  27. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/check.md +0 -0
  28. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/cover.md +0 -0
  29. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/create.md +0 -0
  30. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/fix.md +0 -0
  31. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/flowchart.md +0 -0
  32. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/implement.md +0 -0
  33. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/new.md +0 -0
  34. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/orchestrate.md +0 -0
  35. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/readme.md +0 -0
  36. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/recreate.md +0 -0
  37. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/refactor.md +0 -0
  38. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/references.md +0 -0
  39. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/renumber.md +0 -0
  40. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/workflow.md +0 -0
  41. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts/write.md +0 -0
  42. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/prompts-version.txt +0 -0
  43. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/templates/Agentic_Text_Authoring_Guidance.md +0 -0
  44. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/templates/Document_Source_Code_in_Doxygen_Style.md +0 -0
  45. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/templates/HDT_Test_Authoring_Guide.md +0 -0
  46. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/resources/templates/Requirements_Template.md +0 -0
  47. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/source_analyzer.py +0 -0
  48. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/static_check.py +0 -0
  49. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/src/usereq/token_counter.py +0 -0
  50. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_cli.py +0 -0
  51. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_comments.py +0 -0
  52. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_core.py +0 -0
  53. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_errors.py +0 -0
  54. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_format.py +0 -0
  55. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_analyzer_helpers.py +0 -0
  56. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_compress.py +0 -0
  57. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_dependency_manifests.py +0 -0
  58. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_doxygen_parser.py +0 -0
  59. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_files_commands.py +0 -0
  60. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_find_constructs.py +0 -0
  61. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_find_constructs_comprehensive.py +0 -0
  62. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_generate_markdown.py +0 -0
  63. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_helpers.py +0 -0
  64. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_import_isolation.py +0 -0
  65. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_pre_release_check.py +0 -0
  66. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_release_workflow.py +0 -0
  67. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_source_analyzer.py +0 -0
  68. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_static_check.py +0 -0
  69. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_token_counter.py +0 -0
  70. {cli_usereq-0.74.0 → cli_usereq-0.75.0}/tests/test_update_check.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli-usereq
3
- Version: 0.74.0
3
+ Version: 0.75.0
4
4
  Summary: Initialize a project with prompts, agents, and templates from the useReq repository.
5
5
  Author: Ogekuri
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -709,7 +709,7 @@ Dynamic: license-file
709
709
  > * **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.
710
710
  > * **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.
711
711
 
712
- # useReq / req (0.74.0)
712
+ # useReq / req (0.75.0)
713
713
 
714
714
  <p align="center">
715
715
  <img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
@@ -856,7 +856,7 @@ Canonical keys: `docs-dir`, `tests-dir`, `src-dir`, `providers`, `static-check`,
856
856
 
857
857
  ### Project directories
858
858
 
859
- - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it).
859
+ - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it). Install-time prompt substitution renders `%%DOC_PATH%%`/`%%SRC_PATHS%%`/`%%TEST_PATH%%` from these values, defaulting to `usereq/docs`, `src`, and `tests` when unset.
860
860
  - Defaults when the configuration stores no value: `usereq` (docs), `src` (sources), `tests` (tests).
861
861
  - On fresh installation, missing configured directories (including parents) are created automatically under `--prj-base`.
862
862
 
@@ -1062,7 +1062,7 @@ Click to zoom flowchart image.
1062
1062
 
1063
1063
  ## Guidelines
1064
1064
 
1065
- `GUIDELINES_DIR` is fixed to `~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines` and is not configurable. Generated prompts and skills reference it through home-relative paths; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after the installed guidelines change.
1065
+ `GUIDELINES_DIR` is fixed to the packaged `resources/guidelines` directory of the running installation and is not configurable. Generated prompts and skills reference the packaged resources of the active installation through home-relative paths, including `%%TEMPLATE_PATH%%` for templates; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after an upgrade so rendered paths follow the active installation.
1066
1066
 
1067
1067
  ## Repository Documentation
1068
1068
 
@@ -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.74.0)
13
+ # useReq / req (0.75.0)
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+">
@@ -157,7 +157,7 @@ Canonical keys: `docs-dir`, `tests-dir`, `src-dir`, `providers`, `static-check`,
157
157
 
158
158
  ### Project directories
159
159
 
160
- - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it).
160
+ - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it). Install-time prompt substitution renders `%%DOC_PATH%%`/`%%SRC_PATHS%%`/`%%TEST_PATH%%` from these values, defaulting to `usereq/docs`, `src`, and `tests` when unset.
161
161
  - Defaults when the configuration stores no value: `usereq` (docs), `src` (sources), `tests` (tests).
162
162
  - On fresh installation, missing configured directories (including parents) are created automatically under `--prj-base`.
163
163
 
@@ -363,7 +363,7 @@ Click to zoom flowchart image.
363
363
 
364
364
  ## Guidelines
365
365
 
366
- `GUIDELINES_DIR` is fixed to `~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines` and is not configurable. Generated prompts and skills reference it through home-relative paths; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after the installed guidelines change.
366
+ `GUIDELINES_DIR` is fixed to the packaged `resources/guidelines` directory of the running installation and is not configurable. Generated prompts and skills reference the packaged resources of the active installation through home-relative paths, including `%%TEMPLATE_PATH%%` for templates; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after an upgrade so rendered paths follow the active installation.
367
367
 
368
368
  ## Repository Documentation
369
369
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cli-usereq"
7
- version = "0.74.0"
7
+ version = "0.75.0"
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"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli-usereq
3
- Version: 0.74.0
3
+ Version: 0.75.0
4
4
  Summary: Initialize a project with prompts, agents, and templates from the useReq repository.
5
5
  Author: Ogekuri
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -709,7 +709,7 @@ Dynamic: license-file
709
709
  > * **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.
710
710
  > * **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.
711
711
 
712
- # useReq / req (0.74.0)
712
+ # useReq / req (0.75.0)
713
713
 
714
714
  <p align="center">
715
715
  <img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
@@ -856,7 +856,7 @@ Canonical keys: `docs-dir`, `tests-dir`, `src-dir`, `providers`, `static-check`,
856
856
 
857
857
  ### Project directories
858
858
 
859
- - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it).
859
+ - `--set-docs-dir DOCS_DIR`, `--set-src-dir SRC_DIR` (repeatable), and `--set-tests-dir TESTS_DIR` persist project-relative directory values (each requires `--prj-base`; values must resolve under it). Install-time prompt substitution renders `%%DOC_PATH%%`/`%%SRC_PATHS%%`/`%%TEST_PATH%%` from these values, defaulting to `usereq/docs`, `src`, and `tests` when unset.
860
860
  - Defaults when the configuration stores no value: `usereq` (docs), `src` (sources), `tests` (tests).
861
861
  - On fresh installation, missing configured directories (including parents) are created automatically under `--prj-base`.
862
862
 
@@ -1062,7 +1062,7 @@ Click to zoom flowchart image.
1062
1062
 
1063
1063
  ## Guidelines
1064
1064
 
1065
- `GUIDELINES_DIR` is fixed to `~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines` and is not configurable. Generated prompts and skills reference it through home-relative paths; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after the installed guidelines change.
1065
+ `GUIDELINES_DIR` is fixed to the packaged `resources/guidelines` directory of the running installation and is not configurable. Generated prompts and skills reference the packaged resources of the active installation through home-relative paths, including `%%TEMPLATE_PATH%%` for templates; guideline files themselves are never copied, created, or modified in project or user directories. Re-run `req install` after an upgrade so rendered paths follow the active installation.
1066
1066
 
1067
1067
  ## Repository Documentation
1068
1068
 
@@ -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.74.0"
21
+ __version__ = "0.75.0"
22
22
  """! @brief Semantic version string of the package."""
23
23
 
24
24
 
@@ -59,7 +59,7 @@ AUTO_INSTALL_CONFIG_KEY = "auto-install"
59
59
  DEFAULT_AUTO_INSTALL = True
60
60
  """! @brief Default auto-install state when the configuration stores no entry (SRS-420)."""
61
61
 
62
- DEFAULT_DOCS_DIR = "usereq"
62
+ DEFAULT_DOCS_DIR = "usereq/docs"
63
63
  """! @brief Default docs-dir value stored when the configuration has no docs-dir (SRS-359)."""
64
64
 
65
65
  DEFAULT_TESTS_DIR = "tests"
@@ -102,18 +102,6 @@ DEFAULT_STATIC_CHECK: dict = {
102
102
  defaults (SRS-424, SRS-425, SRS-426). The `pyright` and `ruff` checkers from the external
103
103
  configuration trace map to the native `Pylance` and `Ruff` modules (SRS-338, SRS-339)."""
104
104
 
105
- GUIDELINES_DIR_RELATIVE_TO_HOME = (
106
- Path(".pi")
107
- / "agent"
108
- / "npm"
109
- / "node_modules"
110
- / "pi-usereq"
111
- / "src"
112
- / "resources"
113
- / "guidelines"
114
- )
115
- """! @brief Home-relative, non-configurable installation path of GUIDELINES_DIR (SRS-360)."""
116
-
117
105
  VALID_PROVIDERS = frozenset(
118
106
  {"antigravity", "claude", "codex", "copilot", "openclaw", "opencode", "pi"}
119
107
  )
@@ -158,13 +146,26 @@ def get_global_config_path() -> Path:
158
146
 
159
147
  def guidelines_dir() -> Path:
160
148
  """!
161
- @brief Resolve the fixed installation-owned guidelines directory.
162
- @details Composes the effective user HOME returned by :func:`home_dir` with the
163
- non-configurable :data:`GUIDELINES_DIR_RELATIVE_TO_HOME` suffix.
164
- @return {Path} Absolute path of the installed guidelines directory.
165
- @satisfies SRS-360
149
+ @brief Resolve the packaged guidelines directory of the running installation.
150
+ @details Composes the packaged resources root of the running installation with the
151
+ non-configurable ``guidelines`` suffix so installed skills reference the resources
152
+ shipped with this installation instead of any external copy (SRS-360, SRS-497).
153
+ @return {Path} Absolute path of the packaged guidelines directory.
154
+ @satisfies SRS-360, SRS-497
155
+ """
156
+ return RESOURCE_ROOT / "guidelines"
157
+
158
+
159
+ def templates_dir() -> Path:
160
+ """!
161
+ @brief Resolve the packaged document-template directory of the running installation.
162
+ @details Composes the packaged resources root of the running installation with the
163
+ non-configurable ``templates`` suffix feeding the ``%%TEMPLATE_PATH%%`` substitution
164
+ so installed skills reference the templates shipped with this installation (SRS-498).
165
+ @return {Path} Absolute path of the packaged templates directory.
166
+ @satisfies SRS-495, SRS-498
166
167
  """
167
- return home_dir() / GUIDELINES_DIR_RELATIVE_TO_HOME
168
+ return RESOURCE_ROOT / "templates"
168
169
 
169
170
 
170
171
  def format_home_relative_path(path: Path) -> str:
@@ -1982,7 +1983,7 @@ def load_config() -> dict[str, str | list[str]]:
1982
1983
  @brief Loads directory parameters from the user-global configuration file.
1983
1984
  @return Dictionary containing `docs-dir`, `tests-dir`, and `src-dir` values.
1984
1985
  @details Reads `~/.config/usereq/config.json`; when the file is absent every key falls
1985
- back to its default (`usereq`, `tests`, `src`). Present but invalid values raise
1986
+ back to its default (`usereq/docs`, `tests`, `src`). Present but invalid values raise
1986
1987
  `ReqError`; `--prj-base` and `--git-base` are never read from the file
1987
1988
  (SRS-359, SRS-361, SRS-362, SRS-394, SRS-407).
1988
1989
  @throws ReqError If the global config file is invalid or holds invalid directory values.
@@ -2407,10 +2408,10 @@ def run_config_commands(args: Namespace) -> None:
2407
2408
  def generate_guidelines_file_list() -> str:
2408
2409
  """!
2409
2410
  @brief Build the `%%GUIDELINES_FILES%%` substitution payload from GUIDELINES_DIR.
2410
- @details Enumerates non-hidden regular files in :func:`guidelines_dir` in deterministic
2411
- sorted order and renders each as a backticked home-relative path (SRS-402). When the
2412
- directory is absent or empty, renders the home-relative directory itself with a trailing
2413
- slash.
2411
+ @details Enumerates non-hidden regular files in :func:`guidelines_dir` (packaged
2412
+ `resources/guidelines` of the running installation, SRS-360) in deterministic sorted
2413
+ order and renders each as a backticked home-relative path (SRS-402). When the directory
2414
+ is absent or empty, renders the home-relative directory itself with a trailing slash.
2414
2415
  @return {str} Comma-separated backticked home-relative paths, or the directory fallback.
2415
2416
  @satisfies SRS-403
2416
2417
  """
@@ -2432,8 +2433,9 @@ def generate_guidelines_file_items() -> list[str]:
2432
2433
  """!
2433
2434
  @brief List the home-relative guideline entries reported after installation.
2434
2435
  @details Returns one home-relative path per non-hidden regular file in
2435
- :func:`guidelines_dir`; when the directory is absent or empty, returns the home-relative
2436
- directory itself with a trailing slash.
2436
+ :func:`guidelines_dir` (packaged `resources/guidelines` of the running installation);
2437
+ when the directory is absent or empty, returns the home-relative directory itself with
2438
+ a trailing slash.
2437
2439
  @return {list[str]} Ordered home-relative guideline paths.
2438
2440
  @satisfies SRS-360, SRS-403
2439
2441
  """
@@ -3041,15 +3043,17 @@ def run(args: Namespace) -> None:
3041
3043
  @details Loads the persisted `"providers"` names from `~/.config/usereq/config.json`
3042
3044
  (SRS-064, SRS-279) and requires at least one enabled provider (SRS-035), installs
3043
3045
  `req-<prompt_name>/SKILL.md` skill artifacts into the user-level hardcoded skills
3044
- roots (SRS-381..SRS-386, SRS-464, SRS-486) with home-relative GUIDELINES_DIR token
3045
- substitution (SRS-402, SRS-403), and never rewrites the user-global configuration
3046
+ roots (SRS-381..SRS-386, SRS-464, SRS-486) with home-relative packaged-resource token
3047
+ substitution for `%%GUIDELINES_FILES%%`, `%%GUIDELINES_PATH%%`, `%%TEMPLATE_PATH%%`,
3048
+ `%%DOC_PATH%%`, `%%SRC_PATHS%%`, and `%%TEST_PATH%%` (SRS-360, SRS-402, SRS-403,
3049
+ SRS-498, SRS-500, SRS-501, SRS-502), and never rewrites the user-global configuration
3046
3050
  file (SRS-448). Install does not consume `--prj-base` (SRS-447); project scaffolding,
3047
3051
  containment validation, and directory persistence are removed legacy behaviors
3048
3052
  (SRS-363, SRS-407, SRS-449).
3049
3053
  @param args Parsed CLI namespace.
3050
3054
  @return {None} Function return value.
3051
3055
  @throws ReqError If no provider is enabled.
3052
- @satisfies SRS-035, SRS-064, SRS-279, SRS-381, SRS-387, SRS-388, SRS-402, SRS-403, SRS-418, SRS-447, SRS-448
3056
+ @satisfies SRS-035, SRS-064, SRS-279, SRS-359, SRS-360, SRS-361, SRS-362, SRS-381, SRS-387, SRS-388, SRS-402, SRS-403, SRS-418, SRS-447, SRS-448, SRS-498, SRS-500, SRS-501, SRS-502
3053
3057
  """
3054
3058
  global VERBOSE, DEBUG
3055
3059
  VERBOSE = getattr(args, "verbose", False)
@@ -3079,12 +3083,27 @@ def run(args: Namespace) -> None:
3079
3083
  # providers are already stored by --enable and directory persistence is a removed
3080
3084
  # legacy behavior (SRS-363, SRS-407, SRS-449).
3081
3085
 
3082
- # Resolve the installation-owned guidelines substitution values (SRS-360, SRS-402, SRS-403).
3086
+ # Resolve the packaged-resource substitution values (SRS-360, SRS-402, SRS-403, SRS-498).
3083
3087
  guidelines_file_list = generate_guidelines_file_list()
3084
3088
  guidelines_path_value = f"{format_home_relative_path(guidelines_dir())}/"
3089
+ templates_path_value = f"{format_home_relative_path(templates_dir())}/"
3085
3090
 
3086
3091
  dlog(f"GUIDELINES_DIR={guidelines_path_value}")
3087
3092
  dlog(f"GUIDELINES_FILE_LIST={guidelines_file_list}")
3093
+ dlog(f"TEMPLATE_PATH={templates_path_value}")
3094
+
3095
+ # Resolve the configured directory substitution values (SRS-359, SRS-361, SRS-362,
3096
+ # SRS-500, SRS-501, SRS-502); install reads them without persisting (SRS-448).
3097
+ directory_config = load_config()
3098
+ doc_path_value = directory_config["docs-dir"]
3099
+ src_paths_value = ", ".join(
3100
+ f"`{src_entry}/`" for src_entry in directory_config["src-dir"]
3101
+ )
3102
+ test_path_value = f"`{directory_config['tests-dir']}/`"
3103
+
3104
+ dlog(f"DOC_PATH={doc_path_value}")
3105
+ dlog(f"SRC_PATHS={src_paths_value}")
3106
+ dlog(f"TEST_PATH={test_path_value}")
3088
3107
 
3089
3108
  # Resolve user-level skills roots under the user HOME (SRS-381..SRS-386, SRS-486).
3090
3109
  skills_roots: dict[str, Path] = {
@@ -3116,10 +3135,14 @@ def run(args: Namespace) -> None:
3116
3135
 
3117
3136
  # Skills are the only generated artifact: every enabled provider receives
3118
3137
  # req-<prompt_name>/SKILL.md under its hardcoded user-level skills root
3119
- # (SRS-095, SRS-368, SRS-464).
3138
+ # (SRS-095, SRS-368, SRS-464, SRS-498, SRS-500, SRS-501, SRS-502).
3120
3139
  skill_replacements = {
3121
3140
  "%%GUIDELINES_FILES%%": guidelines_file_list,
3122
3141
  "%%GUIDELINES_PATH%%": guidelines_path_value,
3142
+ "%%TEMPLATE_PATH%%": templates_path_value,
3143
+ "%%DOC_PATH%%": doc_path_value,
3144
+ "%%SRC_PATHS%%": src_paths_value,
3145
+ "%%TEST_PATH%%": test_path_value,
3123
3146
  "%%ARGS%%": "$ARGUMENTS",
3124
3147
  }
3125
3148
  skill_desc_yaml = yaml_double_quote_escape(
@@ -308,15 +308,24 @@ class TestUserLevelInstall(HomeIsolatedTestCase):
308
308
  )
309
309
 
310
310
  def test_guidelines_tokens_replaced(self) -> None:
311
- """SRS-402/SRS-403: guidelines tokens are substituted with home-relative paths."""
311
+ """SRS-402/SRS-403/SRS-499: packaged-resource tokens are fully substituted."""
312
312
  skill = self.HOME / ".claude" / "skills" / "req-analyze" / "SKILL.md"
313
313
  content = skill.read_text(encoding="utf-8")
314
314
  self.assertNotIn("%%GUIDELINES_PATH%%", content)
315
315
  self.assertNotIn("%%GUIDELINES_FILES%%", content)
316
- self.assertIn(
317
- "~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines",
318
- content,
319
- )
316
+ self.assertNotIn("%%TEMPLATE_PATH%%", content)
317
+ self.assertIn("src/usereq/resources/guidelines", content)
318
+ self.assertIn("src/usereq/resources/templates", content)
319
+
320
+ def test_directory_tokens_use_configured_values(self) -> None:
321
+ """SRS-500/SRS-501/SRS-502/SRS-503: configured directory values are rendered."""
322
+ skill = self.HOME / ".claude" / "skills" / "req-analyze" / "SKILL.md"
323
+ content = skill.read_text(encoding="utf-8")
324
+ self.assertNotIn("%%DOC_PATH%%", content)
325
+ self.assertNotIn("%%SRC_PATHS%%", content)
326
+ self.assertNotIn("%%TEST_PATH%%", content)
327
+ self.assertIn("docs/REQUIREMENTS.md", content)
328
+ self.assertIn("`src/`", content)
320
329
 
321
330
 
322
331
  class TestProviderNameParsing(unittest.TestCase):
@@ -515,24 +524,22 @@ class TestInstallDefaultDirectories(HomeIsolatedTestCase):
515
524
 
516
525
 
517
526
  class TestGuidelinesDirectory(HomeIsolatedTestCase):
518
- """SRS-360/SRS-402/SRS-403/SRS-404: fixed installation-owned guidelines directory."""
527
+ """SRS-360/SRS-402/SRS-403/SRS-404/SRS-498: packaged resources of the running installation."""
519
528
 
520
529
  def setUp(self) -> None:
521
530
  super().setUp()
522
- self.guidelines = (
523
- self.HOME
524
- / ".pi"
525
- / "agent"
526
- / "npm"
527
- / "node_modules"
528
- / "pi-usereq"
529
- / "src"
530
- / "resources"
531
- / "guidelines"
531
+ self.resource_root = self.HOME / "resources"
532
+ self.guidelines = self.resource_root / "guidelines"
533
+ self.templates = self.resource_root / "templates"
534
+ (self.resource_root / "prompts").mkdir(parents=True, exist_ok=True)
535
+ self.original_resource_root = cli.RESOURCE_ROOT
536
+ cli.RESOURCE_ROOT = self.resource_root
537
+ self.addCleanup(
538
+ setattr, cli, "RESOURCE_ROOT", self.original_resource_root
532
539
  )
533
540
 
534
541
  def test_guidelines_dir_is_fixed_home_relative_path(self) -> None:
535
- """SRS-360: GUIDELINES_DIR resolves under HOME and is not configurable."""
542
+ """SRS-360: GUIDELINES_DIR resolves to packaged resources and is not configurable."""
536
543
  self.assertEqual(cli.guidelines_dir(), self.guidelines)
537
544
  project = Path(tempfile.mkdtemp(prefix="usereq-guidelines-"))
538
545
  self.addCleanup(shutil.rmtree, project, ignore_errors=True)
@@ -552,7 +559,7 @@ class TestGuidelinesDirectory(HomeIsolatedTestCase):
552
559
  self.assertEqual(cli.format_home_relative_path(self.HOME), "~")
553
560
  self.assertEqual(
554
561
  cli.format_home_relative_path(self.guidelines / "RFC2119.md"),
555
- "~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines/RFC2119.md",
562
+ "~/resources/guidelines/RFC2119.md",
556
563
  )
557
564
 
558
565
  def test_guidelines_file_list_uses_installed_directory(self) -> None:
@@ -561,22 +568,25 @@ class TestGuidelinesDirectory(HomeIsolatedTestCase):
561
568
  (self.guidelines / "RFC2119.md").write_text("rfc\n", encoding="utf-8")
562
569
  self.assertEqual(
563
570
  cli.generate_guidelines_file_list(),
564
- "`~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines/RFC2119.md`",
571
+ "`~/resources/guidelines/RFC2119.md`",
565
572
  )
566
573
  self.assertEqual(
567
574
  cli.generate_guidelines_file_items(),
568
- [
569
- "~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines/RFC2119.md"
570
- ],
575
+ ["~/resources/guidelines/RFC2119.md"],
571
576
  )
572
577
 
573
578
  def test_guidelines_file_list_falls_back_to_directory(self) -> None:
574
579
  """SRS-402: missing guidelines directory renders the directory with a trailing slash."""
575
580
  self.assertEqual(
576
581
  cli.generate_guidelines_file_list(),
577
- "`~/.pi/agent/npm/node_modules/pi-usereq/src/resources/guidelines/`",
582
+ "`~/resources/guidelines/`",
578
583
  )
579
584
 
585
+ def test_templates_dir_resolves_packaged_templates_directory(self) -> None:
586
+ """SRS-498: %%TEMPLATE_PATH%% renders the packaged templates directory."""
587
+ self.assertEqual(cli.templates_dir(), self.templates)
588
+ self.assertEqual(cli.templates_dir(), self.resource_root / "templates")
589
+
580
590
  def test_install_does_not_copy_guidelines_into_project(self) -> None:
581
591
  """SRS-404: installation never writes guideline files into the project."""
582
592
  project = Path(tempfile.mkdtemp(prefix="usereq-guidelines-"))
@@ -589,6 +599,28 @@ class TestGuidelinesDirectory(HomeIsolatedTestCase):
589
599
  self.assertFalse((project / "usereq" / "guidelines").exists())
590
600
 
591
601
 
602
+ class TestDirectoryTokenSubstitution(HomeIsolatedTestCase):
603
+ """SRS-359/SRS-500..SRS-503: default directory token substitution."""
604
+
605
+ def test_defaults_apply_without_persisted_directory_keys(self) -> None:
606
+ """SRS-359/SRS-500..SRS-502: absent config keys fall back to defaults."""
607
+ config = cli.load_config()
608
+ self.assertEqual(config["docs-dir"], "usereq/docs")
609
+ self.assertEqual(config["src-dir"], ["src"])
610
+ self.assertEqual(config["tests-dir"], "tests")
611
+
612
+ def test_install_substitutes_directory_tokens_with_defaults(self) -> None:
613
+ """SRS-500/SRS-501/SRS-503: install renders default directory tokens."""
614
+ self.run_cli(["--enable", "claude", "install"])
615
+ skill = self.HOME / ".claude" / "skills" / "req-analyze" / "SKILL.md"
616
+ content = skill.read_text(encoding="utf-8")
617
+ self.assertNotIn("%%DOC_PATH%%", content)
618
+ self.assertNotIn("%%SRC_PATHS%%", content)
619
+ self.assertNotIn("%%TEST_PATH%%", content)
620
+ self.assertIn("usereq/docs/REQUIREMENTS.md", content)
621
+ self.assertIn("`src/`", content)
622
+
623
+
592
624
  class TestPackagedTemplatesDirectory(unittest.TestCase):
593
625
  """SRS-495: packaged document templates resolve under resources/templates."""
594
626
 
File without changes
File without changes