raiz 0.1.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.
raiz-0.1.0/LICENSE ADDED
@@ -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 [yyyy] [name of copyright owner]
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.
raiz-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: raiz
3
+ Version: 0.1.0
4
+ Summary: Raiz - Simple CLI Requirements Management Tool
5
+ Author-email: daleonpz <daniel@baremetallics.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/daleonpz/raiz
8
+ Project-URL: Issues, https://github.com/daleonpz/raiz/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Software Development :: Build Tools
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Utilities
19
+ Classifier: Environment :: Console
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: typer>=0.12.0
24
+ Requires-Dist: PyYAML>=6.0
25
+ Requires-Dist: rich>=13.0.0
26
+ Requires-Dist: robotframework>=7.0
27
+ Requires-Dist: robotframework-jsonlibrary>=0.4
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0; extra == "dev"
30
+ Requires-Dist: black>=24.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.7; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+
35
+ ```mermaid
36
+
37
+ flowchart TD
38
+ A[Start] --> B{Is it a weekday?}
39
+ B -- Yes --> C[Go to work]
40
+ B -- No --> D[Relax at home]
41
+ C --> E[Finish work]
42
+ D --> E
43
+ E --> F[End of day]
44
+ ```
45
+
46
+ ```plantuml
47
+ @startuml
48
+ start
49
+ if (Is it a weekday?) then (yes)
50
+ :Go to work;
51
+ else (no)
52
+ :Relax at home;
53
+ endif
54
+ :Finish work;
55
+ stop
56
+ @enduml
57
+ ```
58
+
59
+ ```dot
60
+ digraph G {
61
+ A [label="Start"]
62
+ B [label="Is it a weekday?"]
63
+ C [label="Go to work"]
64
+ D [label="Relax at home"]
65
+ E [label="Finish work"]
66
+ F [label="End of day"]
67
+
68
+ A -> B
69
+ B -> C [label="Yes"]
70
+ B -> D [label="No"]
71
+ C -> E
72
+ D -> E
73
+ E -> F
74
+ }
75
+ ```
76
+
77
+ ```mermaid
78
+ sequenceDiagram
79
+ actor Alice as Alice
80
+ actor Bob as Bob
81
+ actor A1 as New Actor
82
+
83
+ Note right of Alice: A typical message
84
+ Alice ->> Bob: HimmsdnoteoverA1: aeu
85
+ Alice ->> A1: send
86
+ A1 --) Alice: receive
87
+ A1 --) Bob: new msg
88
+ Bob ->> Bob: new msg
89
+ Bob ->> Alice: Hi Alice
90
+
91
+ ```
raiz-0.1.0/README.md ADDED
@@ -0,0 +1,58 @@
1
+
2
+ ```mermaid
3
+
4
+ flowchart TD
5
+ A[Start] --> B{Is it a weekday?}
6
+ B -- Yes --> C[Go to work]
7
+ B -- No --> D[Relax at home]
8
+ C --> E[Finish work]
9
+ D --> E
10
+ E --> F[End of day]
11
+ ```
12
+
13
+ ```plantuml
14
+ @startuml
15
+ start
16
+ if (Is it a weekday?) then (yes)
17
+ :Go to work;
18
+ else (no)
19
+ :Relax at home;
20
+ endif
21
+ :Finish work;
22
+ stop
23
+ @enduml
24
+ ```
25
+
26
+ ```dot
27
+ digraph G {
28
+ A [label="Start"]
29
+ B [label="Is it a weekday?"]
30
+ C [label="Go to work"]
31
+ D [label="Relax at home"]
32
+ E [label="Finish work"]
33
+ F [label="End of day"]
34
+
35
+ A -> B
36
+ B -> C [label="Yes"]
37
+ B -> D [label="No"]
38
+ C -> E
39
+ D -> E
40
+ E -> F
41
+ }
42
+ ```
43
+
44
+ ```mermaid
45
+ sequenceDiagram
46
+ actor Alice as Alice
47
+ actor Bob as Bob
48
+ actor A1 as New Actor
49
+
50
+ Note right of Alice: A typical message
51
+ Alice ->> Bob: HimmsdnoteoverA1: aeu
52
+ Alice ->> A1: send
53
+ A1 --) Alice: receive
54
+ A1 --) Bob: new msg
55
+ Bob ->> Bob: new msg
56
+ Bob ->> Alice: Hi Alice
57
+
58
+ ```
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "raiz"
3
+ version = "0.1.0"
4
+ description = "Raiz - Simple CLI Requirements Management Tool"
5
+ authors = [
6
+ { name = "daleonpz", email = "daniel@baremetallics.com" },
7
+ ]
8
+ requires-python = ">=3.8"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+
13
+ dependencies = [
14
+ "typer>=0.12.0",
15
+ "PyYAML>=6.0",
16
+ "rich>=13.0.0",
17
+ "robotframework>=7.0",
18
+ "robotframework-jsonlibrary>=0.4"
19
+ ]
20
+
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Developers",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.8",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Topic :: Software Development :: Build Tools",
30
+ "Topic :: Software Development :: Libraries :: Python Modules",
31
+ "Topic :: Utilities",
32
+ "Environment :: Console",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/daleonpz/raiz"
37
+ Issues = "https://github.com/daleonpz/raiz/issues"
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=8.0",
42
+ "black>=24.0",
43
+ "ruff>=0.7"
44
+ ]
45
+
46
+ [project.scripts]
47
+ raiz = "raiz.cli:main"
48
+
49
+ [build-system]
50
+ requires = ["setuptools>=61.0"]
51
+ build-backend = "setuptools.build_meta"
52
+
raiz-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,37 @@
1
+ # Copyright (c) 2025 Daniel Paredes (daleonpz)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ import typer
5
+ import raiz.commands as commands
6
+ from importlib.metadata import version
7
+ from rich.traceback import install
8
+ install(show_locals=True)
9
+
10
+ app = typer.Typer(help="Raiz CLI - Manage your requirements from the command line")
11
+ show_app = typer.Typer()
12
+ sync_app = typer.Typer()
13
+
14
+ app.add_typer(show_app, name="show", help="Show requirements, types, or domains")
15
+ app.add_typer(sync_app, name="sync", help="Sync requirements with YAML file")
16
+
17
+ # Add subcommands
18
+ app.command("trace")(commands.trace)
19
+ app.command("add")(commands.add)
20
+ app.command("rm")(commands.remove)
21
+ app.command("update")(commands.update)
22
+
23
+ show_app.command("domains")(commands.show_domains)
24
+ show_app.command("types")(commands.show_types)
25
+ show_app.command("all")(commands.show_requirements)
26
+
27
+ sync_app.command("to-yaml")(commands.sync_to_yaml)
28
+ sync_app.command("from-yaml")(commands.sync_from_yaml)
29
+
30
+ def main():
31
+ """
32
+ Main entry point for the CLI application.
33
+ """
34
+ app()
35
+
36
+ if __name__ == "__main__":
37
+ main()
@@ -0,0 +1,241 @@
1
+ # Copyright (c) 2025 Daniel Paredes (daleonpz)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # TODO: should i update the yaml always after each command, bzw after each update of the database?
5
+ # use sync_to_yaml always after each command?
6
+ # 1. rename variables as _XXX to indicate they are private
7
+ from raiz.utils.database import RequirementsDB
8
+ from raiz.utils.report_generator import ReportWriter
9
+
10
+ import typer
11
+ import os
12
+ from pathlib import Path
13
+ from robot.api import ExecutionResult
14
+ from typing import Optional
15
+ import yaml
16
+ from collections import defaultdict
17
+ from datetime import datetime
18
+ import logging
19
+ import json
20
+ from rich.traceback import install
21
+ install(show_locals=True)
22
+
23
+ db = RequirementsDB()
24
+
25
+ REQS_DIR = Path("requirements")
26
+ REQS_DIR.mkdir(exist_ok=True)
27
+ REQ_FILE = REQS_DIR / "requirements.yaml"
28
+
29
+ logging.basicConfig(
30
+ level=logging.INFO,
31
+ format="%(asctime)s - %(levelname)s - %(message)s",
32
+ datefmt="%Y-%m-%d %H:%M:%S",
33
+ )
34
+
35
+ def add():
36
+ """Add a new requirement interactively."""
37
+ description = typer.prompt("Description")
38
+ req_type = typer.prompt("Type [functional, non-functional, constraint]")
39
+ domain = typer.prompt("Domain [e.g., logging, ble, data-processing]")
40
+
41
+ db.add_requirement(description=description, req_type=req_type, domain=domain)
42
+
43
+ def remove(
44
+ req_id: int = typer.Argument(..., help="Requirement ID to remove (e.g., 1)")
45
+ ):
46
+ """Remove a requirement by ID and renumber the rest."""
47
+ if req_id < 1:
48
+ typer.echo("Requirement ID must be greater than 0.")
49
+ raise typer.Exit(code=1)
50
+
51
+ db.rm(req_id)
52
+
53
+ def update(
54
+ req_id: int = typer.Argument(..., help="Requirement ID to update (e.g., 1)"),
55
+ field: Optional[str] = typer.Option(None, '--field', '-f', help="Field to update (description, type, domain)"),
56
+ value: Optional[str] = typer.Option(None, '--value', '-v', help="New value for the field")
57
+ ):
58
+ """Update a requirement by REQ ID. Interactive or field-based."""
59
+ db.update_requirement(req_id, field, value)
60
+
61
+ def show_requirements(
62
+ req_type: Optional[str] = typer.Option(None,'--type', help="Filter by requirement type (functional, non-functional, constraint)"),
63
+ domain: Optional[str] = typer.Option(None, help="Filter by requirement domain (e.g., logging, ble, data-processing)"),
64
+ json: Optional[bool] = typer.Option(False, help="Output in JSON format")
65
+ ):
66
+ """Show requirements with optional filtering by type/domain."""
67
+ db.show_requirements(req_type, domain, json)
68
+
69
+ def show_types():
70
+ """Show all unique types."""
71
+ db.show_characteristic("type")
72
+
73
+ def show_domains():
74
+ """Show all unique domains."""
75
+ db.show_characteristic("domain")
76
+
77
+ def sync_to_yaml(
78
+ file: Optional[Path] = typer.Option(REQ_FILE, help="Path to output YAML file")
79
+ ):
80
+ """Dump current SQLite requirements to YAML."""
81
+ reqs = db.get_requirements()
82
+
83
+ if file:
84
+ REQ_FILE = Path(file)
85
+ typer.echo(f"Using provided YAML file: {REQ_FILE}")
86
+
87
+ if isinstance(reqs, defaultdict):
88
+ reqs = dict(reqs)
89
+
90
+ # flat list for YAML it's consistent with the original format
91
+ flat_list = []
92
+ for req_id, req_data in reqs.items():
93
+ entry = {"id": req_id}
94
+ entry.update(req_data)
95
+ flat_list.append(entry)
96
+
97
+ with open(REQ_FILE, "w") as f:
98
+ yaml.dump(flat_list, f, default_flow_style=False, sort_keys=False)
99
+
100
+ typer.echo(f"Exported {len(reqs)} requirements to {REQ_FILE}")
101
+
102
+ def sync_from_yaml(
103
+ file: Optional[Path] = typer.Option(REQ_FILE, help="Path to YAML file with requirements")
104
+ ):
105
+ """Import requirements from YAML into SQLite (overwrites DB)."""
106
+ if file:
107
+ REQ_FILE = Path(file)
108
+ typer.echo(f"Using provided YAML file: {REQ_FILE}")
109
+
110
+ if not REQ_FILE.exists():
111
+ typer.echo(f"Error: {REQ_FILE} not found.")
112
+ raise typer.Exit()
113
+
114
+ with open(REQ_FILE, "r") as f:
115
+ reqs = yaml.safe_load(f)
116
+
117
+ db.create_from_yaml(reqs)
118
+ typer.echo(f"Requirements imported from {REQ_FILE}")
119
+
120
+
121
+ def _default_stat():
122
+ return {
123
+ "total_requirements": 0,
124
+ "tested_requirements": 0,
125
+ "total_tests": 0,
126
+ "passed_tests": 0,
127
+ "pass_rate": 0.0,
128
+ "coverage_rate": 0.0
129
+ }
130
+
131
+ def _finalize(stat):
132
+ if stat["total_requirements"]:
133
+ stat["coverage_rate"] = round(stat["tested_requirements"] / stat["total_requirements"] * 100, 2)
134
+ if stat["total_tests"]:
135
+ stat["pass_rate"] = round(stat["passed_tests"] / stat["total_tests"] * 100, 2)
136
+ # Remove raw passed_tests and total_tests if not needed
137
+ del stat["passed_tests"]
138
+ del stat["total_tests"]
139
+ def trace(
140
+ output: str = typer.Option("traceability", help="Output report filename"),
141
+ robot_output: str = typer.Option("output.xml", help="Path to Robot Framework output.xml"),
142
+ fmt: str = typer.Option("json", help="Output format: console, json"),
143
+ domain: Optional[str] = typer.Option(None, help="Filter by domain (only in console)"),
144
+ req_type: Optional[str] = typer.Option(None,'--type', help="Filter by requirement type (only in console)"),
145
+ detail: bool = typer.Option(False, help="Show detailed trace report (only in console)")
146
+ ):
147
+ """
148
+ Generate traceability report linking REQ-IDs to Robot tests.
149
+ """
150
+ if not Path(robot_output).exists():
151
+ typer.echo(f"Robot output file '{robot_output}' not found.")
152
+ raise typer.Exit()
153
+
154
+ result = ExecutionResult(robot_output)
155
+
156
+ req_map = defaultdict(list)
157
+
158
+ root_source = result.suite.source
159
+
160
+ for suite in result.suite.suites:
161
+ suite_filename = os.path.basename(suite.source or root_source)
162
+ for test in suite.tests:
163
+ for tag in test.tags:
164
+ if tag.startswith("REQ-"):
165
+ logging.debug(f"Found REQ tag: {tag} in test {test.name} in suite {suite_filename}")
166
+ req_map.setdefault(tag, []).append((suite_filename, test.name, test.status))
167
+
168
+ logging.debug(f"REQ Map: {json.dumps(req_map, indent=2)}")
169
+
170
+ reqs = db.get_requirements()
171
+ logging.debug(f"Requirements List (REQs): {json.dumps(reqs, indent=2)}")
172
+
173
+ for req_id in reqs:
174
+ reqs[req_id]["linked_tests"] = [test[1] for test in req_map.get(req_id, [])]
175
+ reqs[req_id]["test_results"] = req_map.get(req_id, [])
176
+
177
+ logging.debug(f"Updated Requirements with Test Results: {json.dumps(reqs, indent=2)}")
178
+
179
+ stats = _default_stat()
180
+ detailed_stats = {
181
+ "domains": defaultdict(_default_stat),
182
+ "types": defaultdict(_default_stat)
183
+ }
184
+
185
+ # Process reqs
186
+ for req in reqs.values():
187
+ rdomain = req["domain"]
188
+ rtype = req["type"]
189
+ tested = bool(req["linked_tests"])
190
+ total_tests = len(req["test_results"])
191
+ passed_count = sum(1 for test in req["test_results"] if test[2] == "PASS")
192
+
193
+ # Update global stats
194
+ stats["total_requirements"] += 1
195
+ if tested:
196
+ stats["tested_requirements"] += 1
197
+ stats["total_tests"] += total_tests
198
+ stats["passed_tests"] += passed_count
199
+
200
+ # Update domain stats
201
+ d = detailed_stats["domains"][rdomain]
202
+ d["total_requirements"] += 1
203
+ if tested:
204
+ d["tested_requirements"] += 1
205
+ d["total_tests"] += total_tests
206
+ d["passed_tests"] += passed_count
207
+
208
+ # Update type stats
209
+ t = detailed_stats["types"][rtype]
210
+ t["total_requirements"] += 1
211
+ if tested:
212
+ t["tested_requirements"] += 1
213
+ t["total_tests"] += total_tests
214
+ t["passed_tests"] += passed_count
215
+
216
+ _finalize(stats)
217
+ for group in ["domains", "types"]:
218
+ for key, val in detailed_stats[group].items():
219
+ _finalize(val)
220
+
221
+ # Output
222
+ logging.debug(f"Final Stats: {json.dumps(stats, indent=2)}")
223
+ logging.debug(f"Detailed Stats: {json.dumps(detailed_stats, indent=2)}")
224
+
225
+ report = {
226
+ "timestamp": datetime.now().isoformat(),
227
+ "coverage": stats,
228
+ "report": reqs,
229
+ "detailed_report": {
230
+ "domains": dict(detailed_stats["domains"]),
231
+ "types": dict(detailed_stats["types"])
232
+ }
233
+ }
234
+ writer = ReportWriter(report)
235
+
236
+ for req_id, req_data in reqs.items():
237
+ tests = req_data["linked_tests"]
238
+ uuid = req_data.get("uuid")
239
+ db.link_tests(tests=tests, uuid=uuid)
240
+
241
+ writer.write(fmt, output, domain, req_type, detail)
File without changes
@@ -0,0 +1,288 @@
1
+ # Copyright (c) 2025 Daniel Paredes (daleonpz)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ from raiz.utils.report_generator import ReportWriter
5
+
6
+ import sqlite3
7
+ from typing import Optional, List, Dict
8
+ import uuid
9
+ from pathlib import Path
10
+ from collections import defaultdict
11
+ import typer
12
+ from rich.console import Console
13
+ from rich.traceback import install
14
+ install(show_locals=True)
15
+
16
+ REQ_CACHE_DIR = Path(".req_cache")
17
+ REQ_CACHE_DIR.mkdir(exist_ok=True)
18
+ DB_PATH = REQ_CACHE_DIR / "requirements.db"
19
+
20
+ REQS_DIR = Path("requirements")
21
+ REQS_DIR.mkdir(exist_ok=True)
22
+ REQ_FILE = REQS_DIR / "requirements.yaml"
23
+
24
+ HEADER_STYLE = "bold magenta"
25
+ MAIN_COLUMN_STYLE = "cyan"
26
+
27
+ console = Console()
28
+
29
+ class Database:
30
+ def __init__(self, db_path: str = str(DB_PATH)):
31
+ self.db_path = db_path
32
+ self.conn = None
33
+ self.initialize()
34
+
35
+ def initialize(self):
36
+ """Initialize the database and create the requirements table if it doesn't exist."""
37
+ with self as conn:
38
+ conn.execute("""
39
+ CREATE TABLE IF NOT EXISTS requirements (
40
+ uuid TEXT PRIMARY KEY,
41
+ seq_no INTEGER NOT NULL,
42
+ description TEXT NOT NULL,
43
+ type TEXT NOT NULL,
44
+ domain TEXT NOT NULL,
45
+ linked_tests TEXT DEFAULT ''
46
+ )
47
+ """)
48
+ conn.commit()
49
+
50
+ def __enter__(self):
51
+ self.conn = sqlite3.connect(self.db_path)
52
+ self.conn.row_factory = sqlite3.Row
53
+ return self.conn
54
+
55
+ def __exit__(self, exc_type, exc_val, exc_tb):
56
+ if self.conn:
57
+ self.conn.commit()
58
+ self.conn.close()
59
+ self.conn = None
60
+
61
+ class RequirementsDB:
62
+ def __init__(self, database: Optional[Database] = None):
63
+ self.database = database or Database()
64
+
65
+ def add_requirement(self, description: str, req_type: str, domain: str):
66
+ with self.database as conn:
67
+ cur = conn.execute("SELECT MAX(seq_no) FROM requirements")
68
+ max_seq = cur.fetchone()[0] or 0
69
+ seq_no = max_seq + 1
70
+ conn.execute(
71
+ "INSERT INTO requirements (uuid, seq_no, description, type, domain) VALUES (?, ?, ?, ?, ?)",
72
+ (str(uuid.uuid4()), seq_no, description, req_type, domain)
73
+ )
74
+ conn.commit()
75
+
76
+ console.print(f"[bold green]REQ-{seq_no:03} added[/bold green]")
77
+
78
+ def rm(self, seq_no: int):
79
+ """Remove a requirement by sequence number and renumber the rest."""
80
+ with self.database as conn:
81
+ conn.execute("DELETE FROM requirements WHERE seq_no = ?", (seq_no,))
82
+ conn.commit()
83
+ self.renumber_all()
84
+
85
+ console.print(f"[bold red]REQ-{seq_no:03} removed[/bold red]")
86
+
87
+ def renumber_all(self):
88
+ with self.database as conn:
89
+ cur = conn.execute("SELECT uuid FROM requirements ORDER BY seq_no ASC")
90
+ uuids = [row["uuid"] for row in cur.fetchall()]
91
+ for i, uid in enumerate(uuids, start=1):
92
+ conn.execute("UPDATE requirements SET seq_no = ? WHERE uuid = ?", (i, uid))
93
+ conn.commit()
94
+
95
+
96
+ def update_requirement(self, seq_no: int, field: str, value: str):
97
+ VALID_FIELDS = {"description", "type", "domain"}
98
+
99
+ with self.database as conn:
100
+ cur = conn.execute("SELECT * FROM requirements WHERE seq_no = ?", (seq_no,))
101
+ row = cur.fetchone()
102
+ if not row:
103
+ console.print("[bold red]Requirement REQ-{seq_no:03} not found.[/bold red]")
104
+ raise typer.Exit()
105
+
106
+ if field and value:
107
+ if field not in VALID_FIELDS:
108
+ typer.echo(f"Invalid field: {field}. Must be one of: {', '.join(VALID_FIELDS)}.")
109
+ raise typer.Exit()
110
+ conn.execute(f"UPDATE requirements SET {field} = ? WHERE seq_no = ?", (value, seq_no))
111
+ conn.commit()
112
+ console.print(f"[bold green]Updated REQ-{seq_no:03}: set {field} to '{value}'[/bold green]")
113
+ return
114
+
115
+ console.print(f"[bold yellow]Updating REQ-{seq_no:03} interactively. Leave blank to keep existing values.[/bold yellow]")
116
+
117
+ for f in VALID_FIELDS:
118
+ current = row[f]
119
+ new_val = typer.prompt(f"{f.capitalize()} [{current}]", default=current)
120
+ conn.execute(f"UPDATE requirements SET {f} = ? WHERE seq_no = ?", (new_val, seq_no))
121
+
122
+ conn.commit()
123
+ console.print(f"[bold green]REQ-{seq_no:03} updated successfully![/bold green]")
124
+
125
+ def show_requirements(self, req_type: Optional[str] = None, domain: Optional[str] = None, json: Optional[bool] = False):
126
+ with self.database as conn:
127
+ query = "SELECT * FROM requirements WHERE 1=1"
128
+ filters = []
129
+ args = []
130
+
131
+ if req_type:
132
+ filters.append("type = ?")
133
+ args.append(req_type)
134
+
135
+ if domain:
136
+ filters.append("domain = ?")
137
+ args.append(domain)
138
+
139
+ if filters:
140
+ query += " AND " + " ".join(filters)
141
+
142
+ cur = conn.execute(query, args)
143
+ rows = cur.fetchall()
144
+
145
+ if not json:
146
+ req_table = [["REQ-ID", "Description", "Type", "Domain"]]
147
+ for row in rows:
148
+ req_table.append([
149
+ f"REQ-{row['seq_no']:03}",
150
+ row["description"],
151
+ row["type"],
152
+ row["domain"]
153
+ ])
154
+ if not req_table:
155
+ console.print("[bold yellow]No requirements found.[/bold yellow]")
156
+ return
157
+
158
+ ReportWriter.print_table_console(req_table, title=None, with_title= False)
159
+ else:
160
+ req_list = []
161
+ for row in rows:
162
+ req_list.append({
163
+ "id": f"REQ-{row['seq_no']:03}",
164
+ "uuid": row["uuid"],
165
+ "description": row["description"],
166
+ "type": row["type"],
167
+ "domain": row["domain"],
168
+ "linked_tests": row["linked_tests"].split(",") if row["linked_tests"] else [],
169
+ })
170
+
171
+ ReportWriter.print_table_json(req_list)
172
+
173
+
174
+ def show_characteristic(self, char: str):
175
+ """Show all requirements with a specific characteristic."""
176
+
177
+ if char not in ["type", "domain"]:
178
+ console.print(f"[bold red]Invalid characteristic: {char}[/bold red]")
179
+ return
180
+
181
+ table = [[char.capitalize()]]
182
+ with self.database:
183
+ values = self.get_characteristic(char)
184
+ for value in values:
185
+ table.append([value])
186
+
187
+ ReportWriter.print_table_console(table, title=None, with_title = False)
188
+
189
+ def get_characteristic(self, char: str) -> List[str]:
190
+ """Get all unique values for a specific characteristic."""
191
+ if char not in ["type", "domain"]:
192
+ console.print(f"[bold red]Invalid characteristic: {char}[/bold red]")
193
+ return []
194
+
195
+ with self.database as conn:
196
+ cur = conn.execute(f"SELECT DISTINCT {char} FROM requirements")
197
+ values = [row[char] for row in cur.fetchall()]
198
+ return sorted(values)
199
+
200
+ def get_stats_by_characteristic(self, char: str, value: str, report = None
201
+ ) -> Dict[str, int]:
202
+ """Get the number of requirements for each value of a characteristic."""
203
+ if char not in ["type", "domain"]:
204
+ console.print(f"[bold red]Invalid characteristic: {char}[/bold red]")
205
+ return {}
206
+
207
+ with self.database as conn:
208
+ cur = conn.execute(f"SELECT COUNT(*) FROM requirements WHERE {char} = ?", (value,))
209
+ total = cur.fetchone()[0]
210
+
211
+ cur = conn.execute(
212
+ f"SELECT uuid FROM requirements WHERE {char} = ? AND linked_tests != ''",
213
+ (value,)
214
+ )
215
+
216
+ fetched_data = cur.fetchall()
217
+ total_tested = len(fetched_data)
218
+
219
+ total_passed = [ report[row["uuid"]]["STATUS"] for row in fetched_data if row["uuid"] in report ] \
220
+ .count("PASSED") if report else 0
221
+
222
+ return {"total": total, "tested": total_tested, "passed": total_passed}
223
+
224
+ def get_requirements(self) -> Dict[str, Dict[str, str]]:
225
+ """Get all requirements as a list of dictionaries."""
226
+ with self.database as conn:
227
+ cur = conn.execute("SELECT * FROM requirements ORDER BY seq_no ASC")
228
+ reqs = defaultdict(dict)
229
+ for row in cur.fetchall():
230
+ reqs[f"REQ-{row['seq_no']:03}"] = {
231
+ "uuid": row["uuid"],
232
+ "description": row["description"],
233
+ "type": row["type"],
234
+ "domain": row["domain"],
235
+ "linked_tests": row["linked_tests"].split(",") if row["linked_tests"] else [],
236
+ }
237
+ return reqs
238
+
239
+ def get_requirements_uuids(self) -> Dict[str, str]:
240
+ """Get all requirements as a mapping of REQ-ID to UUID."""
241
+ with self.database as conn:
242
+ cur = conn.execute("SELECT uuid, seq_no FROM requirements")
243
+ req_dict = {f"REQ-{row['seq_no']:03}": row["uuid"] for row in cur.fetchall()}
244
+
245
+ return req_dict
246
+
247
+ def link_tests(self, tests: list = None, uuid: str = None):
248
+ """Link tests to a requirement by UUID."""
249
+
250
+ # tests can be deleted or empty, so we only check if uuid is provided
251
+ if not uuid:
252
+ console.print("[bold red]No UUID provided for linking.[/bold red]")
253
+ return
254
+
255
+ if not isinstance(tests, list):
256
+ console.print("[bold red]Tests must be provided as a list.[/bold red]")
257
+ return
258
+
259
+ with self.database as conn:
260
+ conn.execute(
261
+ "UPDATE requirements SET linked_tests = ? WHERE uuid = ?",
262
+ (",".join(tests), uuid),
263
+ )
264
+
265
+
266
+ def create_from_yaml(self, reqs: List[Dict[str, str]]):
267
+ """Create requirements from a YAML-like structure."""
268
+ if not reqs:
269
+ console.print("[bold red]No requirements provided for creation.[/bold red]")
270
+ return
271
+
272
+ with self.database as conn:
273
+ conn.execute("DELETE FROM requirements")
274
+ for idx, req in enumerate(reqs, start=1):
275
+ conn.execute(
276
+ "INSERT INTO requirements (uuid, seq_no, description, type, domain, linked_tests) VALUES (?, ?, ?, ?, ?, ?)",
277
+ (
278
+ req["uuid"],
279
+ idx,
280
+ req["description"],
281
+ req["type"],
282
+ req["domain"],
283
+ ",".join(req.get("linked_tests", []))
284
+ )
285
+ )
286
+ conn.commit()
287
+
288
+
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2025 Daniel Paredes (daleonpz)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ import sqlite3
5
+ from pathlib import Path
6
+
7
+ REQ_CACHE_DIR = Path(".req_cache")
8
+ REQ_CACHE_DIR.mkdir(exist_ok=True)
9
+ DB_FILE = REQ_CACHE_DIR / "requirements.db"
10
+
11
+ def db_conn():
12
+ conn = sqlite3.connect(DB_FILE)
13
+ conn.row_factory = sqlite3.Row
14
+ return conn
15
+
16
+ def init_db():
17
+ with db_conn() as conn:
18
+ conn.execute("""
19
+ CREATE TABLE IF NOT EXISTS requirements (
20
+ uuid TEXT PRIMARY KEY,
21
+ seq_no INTEGER UNIQUE,
22
+ description TEXT NOT NULL,
23
+ type TEXT NOT NULL,
24
+ domain TEXT NOT NULL,
25
+ linked_tests TEXT DEFAULT ''
26
+ """)
27
+ conn.commit()
28
+
29
+ def renumber_all():
30
+ with db_conn() as conn:
31
+ cur = conn.execute("SELECT uuid FROM requirements ORDER BY seq_no ASC")
32
+ uuids = [row["uuid"] for row in cur.fetchall()]
33
+ for i, uid in enumerate(uuids, start=1):
34
+ conn.execute("UPDATE requirements SET seq_no = ? WHERE uuid = ?", (i, uid))
35
+ conn.commit()
36
+
@@ -0,0 +1,187 @@
1
+ # Copyright (c) 2025 Daniel Paredes (daleonpz)
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ import json
4
+ from rich.table import Table
5
+ from rich.console import Console
6
+ from pathlib import Path
7
+
8
+ from typing import List, Optional, Callable, Union
9
+ from rich.style import Style
10
+
11
+ console = Console()
12
+
13
+ class ReportWriter:
14
+ def __init__(self, report_data ):
15
+ self.report_data = report_data
16
+ self.fields = ["REQ-ID", "Status", "suite", "linked_test"]
17
+ self.console = Console()
18
+
19
+ @staticmethod
20
+ # [ [ header1, header2, header3 ], [ row1col1, row1col2, row1col3 ], ... ]
21
+ def print_table_console(data: List[List[str]],
22
+ title: str = "Report",
23
+ with_title: bool = True,
24
+ cell_styles: Optional[dict] = {},
25
+ row_style_cb: Optional[Callable[[List[str], int], Union[str, Style, None]]] = None
26
+ ):
27
+ """Prints a table to the console using Rich."""
28
+
29
+ table = Table(title=title if with_title else None, show_header=True, header_style="bold magenta")
30
+
31
+ if not data:
32
+ print("No data to display.")
33
+ return
34
+
35
+ headers = data[0]
36
+ for header in headers:
37
+ table.add_column(header, style="cyan")
38
+ data_rows = data[1:] if len(data) > 1 else []
39
+
40
+ # Add rows with styling
41
+ for row_idx, row in enumerate(data_rows):
42
+ # Prepare styled row cells
43
+ styled_row = []
44
+ for cell in row:
45
+ style = cell_styles.get(cell, None)
46
+ styled_cell = f"[{style}]{cell}[/]" if style else cell
47
+ styled_row.append(styled_cell)
48
+
49
+ row_style = None
50
+ if row_style_cb:
51
+ row_style = row_style_cb(row, row_idx)
52
+
53
+ table.add_row(*styled_row, style=row_style)
54
+
55
+ console.print(table)
56
+
57
+ @staticmethod
58
+ def print_table_json(data: List):
59
+ """Prints a table to the console in JSON format."""
60
+ console.print_json(data=data, indent=2)
61
+
62
+ def write_console(self, domain: str = None, req_type: str = None, detail: bool = False):
63
+ """Pretty-prints the report to the console using Rich."""
64
+
65
+ console.print(f"[blink][bold green]Traceability Report - {self.report_data['timestamp']}[/blink][/bold green]", justify="center")
66
+
67
+ coverage_table = []
68
+ coverage_table.append([
69
+ "Total Requirements",
70
+ "Tested Requirements",
71
+ "Pass Rate",
72
+ "Coverage",])
73
+
74
+ if domain or req_type:
75
+ print(f"Filtering coverage for domain: {domain}, type: {req_type}")
76
+ if domain:
77
+ coverage = self.report_data["detailed_report"]["domains"].get(domain, {})
78
+ elif req_type:
79
+ coverage = self.report_data["detailed_report"]["types"].get(req_type, {})
80
+ else :
81
+ coverage = self.report_data["coverage"]
82
+
83
+ coverage_table.append([
84
+ str(coverage.get("total_requirements", 0)),
85
+ str(coverage.get("tested_requirements", 0)),
86
+ f"{coverage.get('pass_rate', 0)}%",
87
+ f"{coverage.get('coverage_rate', 0)}%"
88
+ ])
89
+
90
+ self.print_table_console(coverage_table, title="Coverage Summary", with_title=True)
91
+
92
+ traceability_report = []
93
+ traceability_report.append(self.fields)
94
+
95
+ if domain or req_type:
96
+ filtered_report = {}
97
+ for req_id, data in self.report_data["report"].items():
98
+ if (domain and data.get("domain") == domain) or (req_type and data.get("type") == req_type):
99
+ filtered_report[req_id] = data
100
+ self.report_data["report"] = filtered_report
101
+
102
+ for req_id, data in self.report_data["report"].items():
103
+ # sometimes the values are [] and sometimes they are not
104
+ test_results = data.get("test_results", [])
105
+ for test in test_results:
106
+ suite, test_name, status = test
107
+ traceability_report.append([
108
+ req_id,
109
+ status if status else "-",
110
+ suite if suite else "-",
111
+ test_name if test_name else "-",
112
+ ])
113
+
114
+ ## if test_results is empty, we still want to show the requirement
115
+ if not test_results:
116
+ traceability_report.append([
117
+ req_id,
118
+ "NOT TESTED",
119
+ "-",
120
+ "-",
121
+ ])
122
+
123
+ # Define cell styles
124
+ cell_styles = {
125
+ "FAIL": Style(color="white", blink=True, bold=True),
126
+ "PASS": "green",
127
+ "NOT TESTED": "yellow",
128
+ }
129
+
130
+ # Define row style callback (e.g., yellow background for rows where Status is "FAIL")
131
+ def row_style_callback(row: List[str], row_idx: int) -> Optional[str]:
132
+ return "on red" if row[1] == "FAIL" else None
133
+
134
+ self.print_table_console(traceability_report, title="Requirement Traceability Report", with_title=True,
135
+ cell_styles=cell_styles, row_style_cb=row_style_callback)
136
+
137
+ if detail and not (domain or req_type):
138
+ detailed_stats = self.report_data.get("detailed_report", {})
139
+ domain_tables = [["Domain", "Total Requirements", "Number of Tested Requirements", "Pass Rate", "Coverage Rate"]]
140
+ for domain, val in detailed_stats["domains"].items():
141
+ domain_tables.append([
142
+ domain,
143
+ str(val["total_requirements"]),
144
+ str(val["tested_requirements"]),
145
+ f"{val['pass_rate']}%",
146
+ f"{val['coverage_rate']}%"
147
+ ])
148
+
149
+ type_tables= [["Type", "Total Requirements", "Number of Tested Requirements", "Pass Rate", "Coverage Rate"]]
150
+ for typ, val in detailed_stats["types"].items():
151
+ type_tables.append([
152
+ typ,
153
+ str(val["total_requirements"]),
154
+ str(val["tested_requirements"]),
155
+ f"{val['pass_rate']}%",
156
+ f"{val['coverage_rate']}%"
157
+ ])
158
+
159
+ self.print_table_console(domain_tables, title="Domain Statistics", with_title=True)
160
+ self.print_table_console(type_tables, title="Type Statistics", with_title=True)
161
+
162
+ def write_json(self, output_path: str,
163
+ domain: str = None,
164
+ req_type: str = None,
165
+ detail: bool = False):
166
+ """Writes the report to a JSON file."""
167
+ output_file = Path(output_path)
168
+ output_file.parent.mkdir(parents=True, exist_ok=True)
169
+
170
+ with open(output_file, "w") as f:
171
+ json.dump(self.report_data, f, indent=4)
172
+
173
+ def write(self, fmt: str,
174
+ output_path: str = "",
175
+ domain: str = None,
176
+ req_type: str = None,
177
+ detail: bool = False):
178
+ """Dispatch writer based on fmt."""
179
+ output_path = output_path + "." + fmt
180
+ if fmt == "console":
181
+ self.write_console(domain=domain, req_type=req_type, detail=detail)
182
+ elif fmt == "json":
183
+ self.write_json(output_path)
184
+ self.console.print(f"[green]Traceability JSON report saved to {output_path}[/green]")
185
+ else:
186
+ self.console.print(f"[red]Unsupported fmt: {fmt}[/red]")
187
+
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: raiz
3
+ Version: 0.1.0
4
+ Summary: Raiz - Simple CLI Requirements Management Tool
5
+ Author-email: daleonpz <daniel@baremetallics.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/daleonpz/raiz
8
+ Project-URL: Issues, https://github.com/daleonpz/raiz/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Software Development :: Build Tools
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Utilities
19
+ Classifier: Environment :: Console
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: typer>=0.12.0
24
+ Requires-Dist: PyYAML>=6.0
25
+ Requires-Dist: rich>=13.0.0
26
+ Requires-Dist: robotframework>=7.0
27
+ Requires-Dist: robotframework-jsonlibrary>=0.4
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8.0; extra == "dev"
30
+ Requires-Dist: black>=24.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.7; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+
35
+ ```mermaid
36
+
37
+ flowchart TD
38
+ A[Start] --> B{Is it a weekday?}
39
+ B -- Yes --> C[Go to work]
40
+ B -- No --> D[Relax at home]
41
+ C --> E[Finish work]
42
+ D --> E
43
+ E --> F[End of day]
44
+ ```
45
+
46
+ ```plantuml
47
+ @startuml
48
+ start
49
+ if (Is it a weekday?) then (yes)
50
+ :Go to work;
51
+ else (no)
52
+ :Relax at home;
53
+ endif
54
+ :Finish work;
55
+ stop
56
+ @enduml
57
+ ```
58
+
59
+ ```dot
60
+ digraph G {
61
+ A [label="Start"]
62
+ B [label="Is it a weekday?"]
63
+ C [label="Go to work"]
64
+ D [label="Relax at home"]
65
+ E [label="Finish work"]
66
+ F [label="End of day"]
67
+
68
+ A -> B
69
+ B -> C [label="Yes"]
70
+ B -> D [label="No"]
71
+ C -> E
72
+ D -> E
73
+ E -> F
74
+ }
75
+ ```
76
+
77
+ ```mermaid
78
+ sequenceDiagram
79
+ actor Alice as Alice
80
+ actor Bob as Bob
81
+ actor A1 as New Actor
82
+
83
+ Note right of Alice: A typical message
84
+ Alice ->> Bob: HimmsdnoteoverA1: aeu
85
+ Alice ->> A1: send
86
+ A1 --) Alice: receive
87
+ A1 --) Bob: new msg
88
+ Bob ->> Bob: new msg
89
+ Bob ->> Alice: Hi Alice
90
+
91
+ ```
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/raiz/__init__.py
5
+ src/raiz/cli.py
6
+ src/raiz/commands.py
7
+ src/raiz.egg-info/PKG-INFO
8
+ src/raiz.egg-info/SOURCES.txt
9
+ src/raiz.egg-info/dependency_links.txt
10
+ src/raiz.egg-info/entry_points.txt
11
+ src/raiz.egg-info/requires.txt
12
+ src/raiz.egg-info/top_level.txt
13
+ src/raiz/utils/__init__.py
14
+ src/raiz/utils/database.py
15
+ src/raiz/utils/db.py
16
+ src/raiz/utils/report_generator.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ raiz = raiz.cli:main
@@ -0,0 +1,10 @@
1
+ typer>=0.12.0
2
+ PyYAML>=6.0
3
+ rich>=13.0.0
4
+ robotframework>=7.0
5
+ robotframework-jsonlibrary>=0.4
6
+
7
+ [dev]
8
+ pytest>=8.0
9
+ black>=24.0
10
+ ruff>=0.7
@@ -0,0 +1 @@
1
+ raiz