ApiLogicServer 15.2.0__py3-none-any.whl → 15.2.3__py3-none-any.whl
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.
- api_logic_server_cli/api_logic_server.py +2 -2
- api_logic_server_cli/prototypes/base/.github/.copilot-instructions.md +22 -0
- api_logic_server_cli/prototypes/base/docs/training/testing.md +21 -9
- api_logic_server_cli/prototypes/base/test/api_logic_server_behave/behave_logic_report.py +55 -29
- api_logic_server_cli/prototypes/base/test/api_logic_server_behave/behave_logic_report.py.bak +285 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/test/api_logic_server_behave/reports/Behave Logic Report Intro micro.md +35 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/test/api_logic_server_behave/reports/Behave Logic Report Intro.md +35 -0
- api_logic_server_cli/prototypes/manager/samples/basic_demo_sample/docs/training/testing.md +210 -12
- api_logic_server_cli/prototypes/manager/samples/basic_demo_sample/test/api_logic_server_behave/behave_logic_report.py +13 -84
- api_logic_server_cli/prototypes/manager/samples/basic_demo_sample/test/api_logic_server_behave/behave_logic_report.py.bak +282 -0
- api_logic_server_cli/prototypes/manager/system/ApiLogicServer-Internal-Dev/copilot-dev-context.md +39 -4
- api_logic_server_cli/prototypes/manager/system/app_model_editor/test/api_logic_server_behave/behave_logic_report.py +13 -75
- api_logic_server_cli/prototypes/manager/system/app_model_editor/test/api_logic_server_behave/behave_logic_report.py.bak +256 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/test/api_logic_server_behave/behave_logic_report.py +13 -75
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/test/api_logic_server_behave/behave_logic_report.py.bak +256 -0
- api_logic_server_cli/prototypes/nw/test/api_logic_server_behave/reports/Behave Logic Report Intro micro.md +17 -0
- api_logic_server_cli/prototypes/nw/test/api_logic_server_behave/reports/Behave Logic Report Intro.md +17 -0
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/METADATA +79 -8
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/RECORD +23 -16
- api_logic_server_cli/prototypes/base/.github/.copilot-instructionsZ.mdx +0 -661
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/WHEEL +0 -0
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.2.0.dist-info → apilogicserver-15.2.3.dist-info}/top_level.txt +0 -0
api_logic_server_cli/prototypes/manager/system/ApiLogicServer-Internal-Dev/copilot-dev-context.md
CHANGED
|
@@ -75,10 +75,33 @@ This document contains **everything** you need to understand the system:
|
|
|
75
75
|
|
|
76
76
|
### For Creating New Projects:
|
|
77
77
|
- **Manager-level `.copilot-instructions.md`** - How to CREATE projects (in workspace root)
|
|
78
|
-
-
|
|
78
|
+
- **Location:** `prototypes/manager/.github/.copilot-instructions.md`
|
|
79
|
+
- **Size:** ~86 lines
|
|
80
|
+
- **Scope:** Creating projects ONLY (3 methods: existing DB, GenAI, new DB)
|
|
81
|
+
- **Purpose:** Instructions for creating new projects with `genai-logic create` commands
|
|
82
|
+
- **Does NOT contain:** Project customization, logic patterns, testing, security, etc.
|
|
79
83
|
|
|
80
84
|
### For Working Within Created Projects:
|
|
81
85
|
- **Project-level `.copilot-instructions.md`** - How to EXTEND/CUSTOMIZE projects (auto-generated in each project)
|
|
86
|
+
- **Location:** `prototypes/base/.github/.copilot-instructions.md` (template)
|
|
87
|
+
- **Size:** ~740 lines
|
|
88
|
+
- **Scope:** Complete architecture guide for EACH created project
|
|
89
|
+
- **Purpose:** 13 Main Services (what AI can do in a project):
|
|
90
|
+
1. **Run Project** - F5 debug, `api_logic_server_run.py`
|
|
91
|
+
2. **Adding Business Logic** - Translate NL → LogicBank rules (sums, formulas, constraints, events)
|
|
92
|
+
3. **Discovery Systems** - Auto-load logic from `logic/logic_discovery/*.py`, APIs from `api/api_discovery/*.py`
|
|
93
|
+
4. **Automated Testing** - Behave tests with BLT reports (requirements traceability)
|
|
94
|
+
5. **Adding MCP** - Enable MCP client UI with `genai-logic genai-add-mcp-client`
|
|
95
|
+
6. **Configuring Admin UI** - Edit `ui/admin/admin.yaml` for customization
|
|
96
|
+
7. **Create React Apps** - `genai-logic genai-add-app` for custom UIs
|
|
97
|
+
8. **Security - RBAC** - `als add-auth` for SQL/Keycloak, `security/declare_security.py` for grants
|
|
98
|
+
9. **Custom API Endpoints** - Add routes in `api/customize_api.py`
|
|
99
|
+
10. **B2B Integration APIs** - Complex endpoints with Row Dict Mappers for partner integration
|
|
100
|
+
11. **Customize Models** - Add tables, attributes, derived fields
|
|
101
|
+
12. **Adding Events** - Row events for integrations (Kafka, webhooks, etc.)
|
|
102
|
+
13. **Critical Patterns** - React component best practices, null-safe constraints, test repeatability
|
|
103
|
+
- ⚠️ **CRITICAL:** These are TWO DIFFERENT FILES - never replace the per-project version with the manager version!
|
|
104
|
+
- 🚨 **PROPAGATION PROBLEM:** Changes to project-level instructions must be carefully copied to `prototypes/base/.github/.copilot-instructions.md`
|
|
82
105
|
- **`docs/training/logic_bank_api.prompt`** - LogicBank API reference (Rosetta Stone for rules)
|
|
83
106
|
- **`docs/training/testing.md`** - Behave testing guide (1755 lines, read BEFORE creating tests)
|
|
84
107
|
|
|
@@ -110,11 +133,14 @@ This document contains **everything** you need to understand the system:
|
|
|
110
133
|
1. **Read [Architecture-Internals.md](https://apilogicserver.github.io/Docs/Architecture-Internals/)** for complete technical context
|
|
111
134
|
2. Identify which documentation to consult based on task:
|
|
112
135
|
- Framework development → Architecture-Internals.md
|
|
113
|
-
- Project creation → Manager-level `.copilot-instructions.md`
|
|
114
|
-
- Project customization → Project-level `.copilot-instructions.md`
|
|
136
|
+
- Project creation → Manager-level `.copilot-instructions.md` (86 lines, in prototypes/manager/)
|
|
137
|
+
- Project customization → Project-level `.copilot-instructions.md` (740 lines, in prototypes/base/)
|
|
115
138
|
- Adding logic → `docs/training/logic_bank_api.prompt`
|
|
116
139
|
- Creating tests → `docs/training/testing.md`
|
|
117
|
-
3.
|
|
140
|
+
3. **CRITICAL:** Never confuse the two `.copilot-instructions.md` files:
|
|
141
|
+
- Manager version = how to CREATE projects (small, workspace-level)
|
|
142
|
+
- Project version = how to CUSTOMIZE projects (large, per-project with architecture details)
|
|
143
|
+
4. When role unclear, ask: "Are you testing as a user or working on internals?"
|
|
118
144
|
|
|
119
145
|
### Key Principles:
|
|
120
146
|
- **Assume deep technical expertise** - Technology refined over 40+ years
|
|
@@ -122,6 +148,15 @@ This document contains **everything** you need to understand the system:
|
|
|
122
148
|
- **Respect the architecture** - Patterns represent battle-tested solutions from thousands of deployments
|
|
123
149
|
- **Check training materials** - `logic_bank_api.prompt` and `testing.md` prevent common AI mistakes
|
|
124
150
|
|
|
151
|
+
### Communication Tone Guidelines:
|
|
152
|
+
- **Confident but NEVER hyperbolic** - Make only claims backed by specific, measurable evidence
|
|
153
|
+
- **Cite concrete metrics** - "200 lines → 5 rules (40X)" not "transforms years into days"
|
|
154
|
+
- **Reference historical facts** - "40+ years, 6,000+ deployments" establishes credibility
|
|
155
|
+
- **Avoid unfounded superlatives** - No "revolutionary", "game-changing", or time-compression claims without data
|
|
156
|
+
- **Be specific** - "Creates working API in 5 seconds" vs "drastically reduces development time"
|
|
157
|
+
- **NEVER claim** - Time compression like "30-40 years → 3-4 days" - these are unmeasurable and unfounded
|
|
158
|
+
- **DO claim** - Specific productivity gains with evidence: "40X code reduction", "instant API from database"
|
|
159
|
+
|
|
125
160
|
|
|
126
161
|
|
|
127
162
|
## 🔄 Development Workflow
|
|
@@ -176,81 +176,19 @@ def main(behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
|
176
176
|
wiki_data.append(" ")
|
|
177
177
|
each_line = "## " + each_line
|
|
178
178
|
if each_line.startswith(" Scenario"):
|
|
179
|
-
|
|
180
|
-
if each_line.startswith(" Given") or \
|
|
181
|
-
each_line.startswith(" When") or \
|
|
182
|
-
each_line.startswith(" Then"):
|
|
183
|
-
if each_line.startswith(" Then"):
|
|
184
|
-
just_saw_then = True
|
|
185
|
-
each_line = tab + tab + each_line
|
|
186
|
-
|
|
187
|
-
each_line = each_line[:-1]
|
|
188
|
-
debug_loc = each_line.find(behave_debug_info)
|
|
189
|
-
if debug_loc > 0:
|
|
190
|
-
each_line = each_line[0 : debug_loc]
|
|
191
|
-
each_line = each_line.rstrip()
|
|
192
|
-
if "Scenario" in each_line:
|
|
179
|
+
# Extract scenario name for logic lookup
|
|
193
180
|
current_scenario = each_line[18:]
|
|
194
181
|
wiki_data.append(" ")
|
|
195
182
|
wiki_data.append(" ")
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
def print_args(args, msg):
|
|
210
|
-
print(msg)
|
|
211
|
-
for each_arg in args:
|
|
212
|
-
print(f' {each_arg}')
|
|
213
|
-
print(" ")
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
@click.group()
|
|
217
|
-
@click.pass_context
|
|
218
|
-
def cli(ctx):
|
|
219
|
-
"""
|
|
220
|
-
Combine behave.log and scenario_logic_logs to create Behave Logic Report
|
|
221
|
-
|
|
222
|
-
"""
|
|
223
|
-
pass
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
@cli.command("run")
|
|
227
|
-
@click.pass_context
|
|
228
|
-
@click.option('--behave_log',
|
|
229
|
-
default=f'logs/behave.log', # cwd set to test/api_logic_server_behave
|
|
230
|
-
# prompt="Log from behave test suite run [behave.log]",
|
|
231
|
-
help="Help")
|
|
232
|
-
@click.option('--scenario_logs',
|
|
233
|
-
default=f'logs/scenario_logic_logs',
|
|
234
|
-
# prompt="Logic Log directory from ",
|
|
235
|
-
help="Help")
|
|
236
|
-
@click.option('--wiki',
|
|
237
|
-
default=f'reports/Behave Logic Report.md',
|
|
238
|
-
# prompt="Log from behave test suite run [api_logic_server_behave]",
|
|
239
|
-
help="Help")
|
|
240
|
-
@click.option('--prepend_wiki',
|
|
241
|
-
default=f'reports/Behave Logic Report Intro micro.md',
|
|
242
|
-
# prompt="Log from behave test suite run [Behave Logic Report Intro]",
|
|
243
|
-
help="Help")
|
|
244
|
-
def run(ctx, behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
245
|
-
main(behave_log = behave_log, scenario_logs = scenario_logs, wiki = wiki, prepend_wiki = prepend_wiki)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if __name__ == '__main__': # debugger & python command line start here
|
|
249
|
-
# eg: python api_logic_server_cli/cli.py create --project_name=~/Desktop/test_project
|
|
250
|
-
# unix: python api_logic_server_cli/cli.py create --project_name=/home/ApiLogicProject
|
|
251
|
-
|
|
252
|
-
print(f'\nBehave Logic Report 1.1, started at {os.getcwd()}')
|
|
253
|
-
commands = sys.argv
|
|
254
|
-
if len(sys.argv) > 1:
|
|
255
|
-
print_args(commands, f'\n\nCommand Line Arguments:')
|
|
256
|
-
cli()
|
|
183
|
+
# Remove the debug info (# features/...) from the scenario name
|
|
184
|
+
debug_loc = current_scenario.find(behave_debug_info)
|
|
185
|
+
if debug_loc > 0:
|
|
186
|
+
current_scenario = current_scenario[0:debug_loc].strip()
|
|
187
|
+
wiki_data.append(" ")
|
|
188
|
+
wiki_data.append(" ")
|
|
189
|
+
# Remove debug info from header line too
|
|
190
|
+
header_line = each_line[2:]
|
|
191
|
+
debug_loc = header_line.find(behave_debug_info)
|
|
192
|
+
if debug_loc > 0:
|
|
193
|
+
header_line = header_line[0:debug_loc].rstrip()
|
|
194
|
+
wiki_data.append("### " + header_line) # Add scenario header
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import os
|
|
4
|
+
import ast
|
|
5
|
+
import sys
|
|
6
|
+
import click
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Creates wiki file from test/behave/behave.log, with rule use.
|
|
10
|
+
|
|
11
|
+
Tips
|
|
12
|
+
* use 2 spaces (at end) for newline
|
|
13
|
+
* for tab: & emsp;
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
tab = " "
|
|
18
|
+
behave_debug_info = " # "
|
|
19
|
+
wiki_data = []
|
|
20
|
+
debug_scenario = "XXGood Order Custom Service"
|
|
21
|
+
|
|
22
|
+
scenario_doc_strings = {}
|
|
23
|
+
""" dict of scenario_name, array of strings """
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def remove_trailer(line: str) -> str:
|
|
27
|
+
""" remove everything after the ## """
|
|
28
|
+
end_here = line.find("\t\t##")
|
|
29
|
+
result = line[0:end_here]
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
def line_spacer():
|
|
33
|
+
wiki_data.append("\n")
|
|
34
|
+
wiki_data.append(" ")
|
|
35
|
+
wiki_data.append(" ")
|
|
36
|
+
wiki_data.append("\n")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def get_current_readme(prepend_wiki: str):
|
|
40
|
+
""" initialize wiki_data with readme up to {report_name} """
|
|
41
|
+
report_name = "Behave Logic Report"
|
|
42
|
+
with open(prepend_wiki) as readme:
|
|
43
|
+
readme_lines = readme.readlines()
|
|
44
|
+
need_spacer = True
|
|
45
|
+
for each_readme_line in readme_lines:
|
|
46
|
+
if '# ' + report_name in each_readme_line:
|
|
47
|
+
need_spacer = False
|
|
48
|
+
break
|
|
49
|
+
wiki_data.append(each_readme_line[0:-1])
|
|
50
|
+
if need_spacer:
|
|
51
|
+
line_spacer()
|
|
52
|
+
wiki_data.append(f'# {report_name}')
|
|
53
|
+
|
|
54
|
+
def get_truncated_scenario_name(scenario_name: str) -> str:
|
|
55
|
+
""" address max file length (chop at 26), illegal characters """
|
|
56
|
+
scenario_trunc = scenario_name
|
|
57
|
+
if scenario_trunc is not None and len(scenario_trunc) >= 26:
|
|
58
|
+
scenario_trunc = scenario_name[0:25]
|
|
59
|
+
scenario_trunc = f'{str(scenario_trunc).replace(" ", "_")}'
|
|
60
|
+
return scenario_trunc
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def show_logic(scenario: str, logic_logs_dir: str):
|
|
64
|
+
""" insert s{logic_logs_dir}/scenario.log into wiki_data as disclosure area """
|
|
65
|
+
scenario_trunc = get_truncated_scenario_name(scenario)
|
|
66
|
+
logic_file_name = f'{logic_logs_dir}/{scenario_trunc}.log'
|
|
67
|
+
logic_file_name_path = Path(logic_file_name)
|
|
68
|
+
if not logic_file_name_path.is_file(): # debug code
|
|
69
|
+
# wiki_data.append(f'unable to find Logic Log file: {logic_file_name}')
|
|
70
|
+
if scenario == debug_scenario:
|
|
71
|
+
print(f'RELATIVE: {logic_file_name} in {os.getcwd()}')
|
|
72
|
+
full_name = f'{os.getcwd()}/{logic_file_name}'
|
|
73
|
+
print(f'..FULL: {os.getcwd()}/{logic_file_name}')
|
|
74
|
+
logic_file_name = '{logic_logs_dir}/test.log'
|
|
75
|
+
with open(logic_file_name) as logic:
|
|
76
|
+
logic_lines = logic.readlines()
|
|
77
|
+
else:
|
|
78
|
+
logic_log = []
|
|
79
|
+
rules_used = []
|
|
80
|
+
wiki_data.append("<details markdown>")
|
|
81
|
+
wiki_data.append("<summary>Tests - and their logic - are transparent.. click to see Logic</summary>")
|
|
82
|
+
line_spacer()
|
|
83
|
+
scenario_trunc = get_truncated_scenario_name(scenario)
|
|
84
|
+
if scenario_trunc in scenario_doc_strings:
|
|
85
|
+
wiki_data.append(f'**Logic Doc** for scenario: {scenario}')
|
|
86
|
+
wiki_data.append(" ")
|
|
87
|
+
for each_doc_string_line in scenario_doc_strings[scenario_trunc]:
|
|
88
|
+
wiki_data.append(each_doc_string_line[0: -1])
|
|
89
|
+
line_spacer()
|
|
90
|
+
wiki_data.append(f'**Rules Used** in Scenario: {scenario}')
|
|
91
|
+
wiki_data.append("```")
|
|
92
|
+
with open(logic_file_name) as logic:
|
|
93
|
+
logic_lines = logic.readlines()
|
|
94
|
+
is_logic_log = True
|
|
95
|
+
for each_logic_line in logic_lines:
|
|
96
|
+
each_logic_line = remove_trailer(each_logic_line)
|
|
97
|
+
if is_logic_log:
|
|
98
|
+
if "Rules Fired" in each_logic_line:
|
|
99
|
+
is_logic_log = False
|
|
100
|
+
continue
|
|
101
|
+
else:
|
|
102
|
+
logic_log.append(each_logic_line)
|
|
103
|
+
else:
|
|
104
|
+
if 'logic_logger - INFO' in each_logic_line:
|
|
105
|
+
pass
|
|
106
|
+
break
|
|
107
|
+
wiki_data.append(each_logic_line + " ")
|
|
108
|
+
wiki_data.append("```")
|
|
109
|
+
wiki_data.append(f'**Logic Log** in Scenario: {scenario}')
|
|
110
|
+
wiki_data.append("```")
|
|
111
|
+
for each_logic_log in logic_log:
|
|
112
|
+
each_line = remove_trailer(each_logic_log)
|
|
113
|
+
wiki_data.append(each_line)
|
|
114
|
+
wiki_data.append("```")
|
|
115
|
+
wiki_data.append("</details>")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def get_docStrings(steps_dir: str):
|
|
119
|
+
steps_dir_files = os.listdir(steps_dir)
|
|
120
|
+
indent = 4 # skip leading blanks
|
|
121
|
+
for each_steps_dir_file in steps_dir_files:
|
|
122
|
+
each_steps_dir_file_path = Path(steps_dir).joinpath(each_steps_dir_file)
|
|
123
|
+
if each_steps_dir_file_path.is_file():
|
|
124
|
+
with open(each_steps_dir_file_path) as f:
|
|
125
|
+
step_code = f.readlines()
|
|
126
|
+
# print(f'Found File: {str(each_steps_dir_file_path)}')
|
|
127
|
+
for index, each_step_code_line in enumerate(step_code):
|
|
128
|
+
if each_step_code_line.startswith('@when'):
|
|
129
|
+
comment_start = index + 2
|
|
130
|
+
if '"""' in step_code[comment_start]:
|
|
131
|
+
# print(".. found doc string")
|
|
132
|
+
doc_string_line = comment_start+1
|
|
133
|
+
doc_string = []
|
|
134
|
+
while (True):
|
|
135
|
+
if '"""' in step_code[doc_string_line]:
|
|
136
|
+
break
|
|
137
|
+
doc_string.append(step_code[doc_string_line][indent:])
|
|
138
|
+
doc_string_line += 1
|
|
139
|
+
scenario_line = doc_string_line+1
|
|
140
|
+
if 'scenario_name' not in step_code[scenario_line]:
|
|
141
|
+
print(f'\n** Warning - scenario_name not found '\
|
|
142
|
+
f'in file {str(each_steps_dir_file_path)}, '\
|
|
143
|
+
f'after line {scenario_line} -- skipped')
|
|
144
|
+
else:
|
|
145
|
+
scenario_code_line = step_code[scenario_line]
|
|
146
|
+
scenario_name_start = scenario_code_line.find("'") + 1
|
|
147
|
+
scenario_name_end = scenario_code_line[scenario_name_start+1:].find("'")
|
|
148
|
+
scenario_name = scenario_code_line[scenario_name_start:
|
|
149
|
+
scenario_name_end + scenario_name_start+1]
|
|
150
|
+
if scenario_name == debug_scenario:
|
|
151
|
+
print(f'got {debug_scenario}')
|
|
152
|
+
scenario_trunc = get_truncated_scenario_name(scenario_name)
|
|
153
|
+
# print(f'.... truncated scenario_name: {scenario_trunc} in {scenario_code_line}')
|
|
154
|
+
scenario_doc_strings[scenario_trunc] = doc_string
|
|
155
|
+
# print("that's all, folks")
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def main(behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
159
|
+
""" main driver """
|
|
160
|
+
get_docStrings(steps_dir="features/steps")
|
|
161
|
+
|
|
162
|
+
get_current_readme(prepend_wiki=prepend_wiki)
|
|
163
|
+
|
|
164
|
+
contents = None
|
|
165
|
+
with open(behave_log) as f:
|
|
166
|
+
contents = f.readlines()
|
|
167
|
+
|
|
168
|
+
just_saw_then = False
|
|
169
|
+
current_scenario = ""
|
|
170
|
+
for each_line in contents:
|
|
171
|
+
if just_saw_then and each_line == "\n":
|
|
172
|
+
show_logic(scenario=current_scenario, logic_logs_dir=scenario_logs)
|
|
173
|
+
just_saw_then = False
|
|
174
|
+
if each_line.startswith("Feature"):
|
|
175
|
+
wiki_data.append(" ")
|
|
176
|
+
wiki_data.append(" ")
|
|
177
|
+
each_line = "## " + each_line
|
|
178
|
+
if each_line.startswith(" Scenario"):
|
|
179
|
+
each_line = tab + each_line
|
|
180
|
+
if each_line.startswith(" Given") or \
|
|
181
|
+
each_line.startswith(" When") or \
|
|
182
|
+
each_line.startswith(" Then"):
|
|
183
|
+
if each_line.startswith(" Then"):
|
|
184
|
+
just_saw_then = True
|
|
185
|
+
each_line = tab + tab + each_line
|
|
186
|
+
|
|
187
|
+
each_line = each_line[:-1]
|
|
188
|
+
debug_loc = each_line.find(behave_debug_info)
|
|
189
|
+
if debug_loc > 0:
|
|
190
|
+
each_line = each_line[0 : debug_loc]
|
|
191
|
+
each_line = each_line.rstrip()
|
|
192
|
+
if "Scenario" in each_line:
|
|
193
|
+
current_scenario = each_line[18:]
|
|
194
|
+
wiki_data.append(" ")
|
|
195
|
+
wiki_data.append(" ")
|
|
196
|
+
wiki_data.append("### " + each_line[8:])
|
|
197
|
+
|
|
198
|
+
each_line = each_line + " " # wiki for "new line"
|
|
199
|
+
|
|
200
|
+
wiki_data.append(each_line)
|
|
201
|
+
|
|
202
|
+
with open(wiki, 'w') as rpt:
|
|
203
|
+
rpt.write('\n'.join(wiki_data))
|
|
204
|
+
wiki_full_path = Path(wiki).absolute()
|
|
205
|
+
print(f'Wiki Output: {wiki_full_path}\n\n')
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def print_args(args, msg):
|
|
210
|
+
print(msg)
|
|
211
|
+
for each_arg in args:
|
|
212
|
+
print(f' {each_arg}')
|
|
213
|
+
print(" ")
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@click.group()
|
|
217
|
+
@click.pass_context
|
|
218
|
+
def cli(ctx):
|
|
219
|
+
"""
|
|
220
|
+
Combine behave.log and scenario_logic_logs to create Behave Logic Report
|
|
221
|
+
|
|
222
|
+
"""
|
|
223
|
+
pass
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
@cli.command("run")
|
|
227
|
+
@click.pass_context
|
|
228
|
+
@click.option('--behave_log',
|
|
229
|
+
default=f'logs/behave.log', # cwd set to test/api_logic_server_behave
|
|
230
|
+
# prompt="Log from behave test suite run [behave.log]",
|
|
231
|
+
help="Help")
|
|
232
|
+
@click.option('--scenario_logs',
|
|
233
|
+
default=f'logs/scenario_logic_logs',
|
|
234
|
+
# prompt="Logic Log directory from ",
|
|
235
|
+
help="Help")
|
|
236
|
+
@click.option('--wiki',
|
|
237
|
+
default=f'reports/Behave Logic Report.md',
|
|
238
|
+
# prompt="Log from behave test suite run [api_logic_server_behave]",
|
|
239
|
+
help="Help")
|
|
240
|
+
@click.option('--prepend_wiki',
|
|
241
|
+
default=f'reports/Behave Logic Report Intro micro.md',
|
|
242
|
+
# prompt="Log from behave test suite run [Behave Logic Report Intro]",
|
|
243
|
+
help="Help")
|
|
244
|
+
def run(ctx, behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
245
|
+
main(behave_log = behave_log, scenario_logs = scenario_logs, wiki = wiki, prepend_wiki = prepend_wiki)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if __name__ == '__main__': # debugger & python command line start here
|
|
249
|
+
# eg: python api_logic_server_cli/cli.py create --project_name=~/Desktop/test_project
|
|
250
|
+
# unix: python api_logic_server_cli/cli.py create --project_name=/home/ApiLogicProject
|
|
251
|
+
|
|
252
|
+
print(f'\nBehave Logic Report 1.1, started at {os.getcwd()}')
|
|
253
|
+
commands = sys.argv
|
|
254
|
+
if len(sys.argv) > 1:
|
|
255
|
+
print_args(commands, f'\n\nCommand Line Arguments:')
|
|
256
|
+
cli()
|
|
@@ -176,81 +176,19 @@ def main(behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
|
176
176
|
wiki_data.append(" ")
|
|
177
177
|
each_line = "## " + each_line
|
|
178
178
|
if each_line.startswith(" Scenario"):
|
|
179
|
-
|
|
180
|
-
if each_line.startswith(" Given") or \
|
|
181
|
-
each_line.startswith(" When") or \
|
|
182
|
-
each_line.startswith(" Then"):
|
|
183
|
-
if each_line.startswith(" Then"):
|
|
184
|
-
just_saw_then = True
|
|
185
|
-
each_line = tab + tab + each_line
|
|
186
|
-
|
|
187
|
-
each_line = each_line[:-1]
|
|
188
|
-
debug_loc = each_line.find(behave_debug_info)
|
|
189
|
-
if debug_loc > 0:
|
|
190
|
-
each_line = each_line[0 : debug_loc]
|
|
191
|
-
each_line = each_line.rstrip()
|
|
192
|
-
if "Scenario" in each_line:
|
|
179
|
+
# Extract scenario name for logic lookup
|
|
193
180
|
current_scenario = each_line[18:]
|
|
194
181
|
wiki_data.append(" ")
|
|
195
182
|
wiki_data.append(" ")
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
def print_args(args, msg):
|
|
210
|
-
print(msg)
|
|
211
|
-
for each_arg in args:
|
|
212
|
-
print(f' {each_arg}')
|
|
213
|
-
print(" ")
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
@click.group()
|
|
217
|
-
@click.pass_context
|
|
218
|
-
def cli(ctx):
|
|
219
|
-
"""
|
|
220
|
-
Combine behave.log and scenario_logic_logs to create Behave Logic Report
|
|
221
|
-
|
|
222
|
-
"""
|
|
223
|
-
pass
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
@cli.command("run")
|
|
227
|
-
@click.pass_context
|
|
228
|
-
@click.option('--behave_log',
|
|
229
|
-
default=f'logs/behave.log', # cwd set to test/api_logic_server_behave
|
|
230
|
-
# prompt="Log from behave test suite run [behave.log]",
|
|
231
|
-
help="Help")
|
|
232
|
-
@click.option('--scenario_logs',
|
|
233
|
-
default=f'logs/scenario_logic_logs',
|
|
234
|
-
# prompt="Logic Log directory from ",
|
|
235
|
-
help="Help")
|
|
236
|
-
@click.option('--wiki',
|
|
237
|
-
default=f'reports/Behave Logic Report.md',
|
|
238
|
-
# prompt="Log from behave test suite run [api_logic_server_behave]",
|
|
239
|
-
help="Help")
|
|
240
|
-
@click.option('--prepend_wiki',
|
|
241
|
-
default=f'reports/Behave Logic Report Intro micro.md',
|
|
242
|
-
# prompt="Log from behave test suite run [Behave Logic Report Intro]",
|
|
243
|
-
help="Help")
|
|
244
|
-
def run(ctx, behave_log: str, scenario_logs: str, wiki: str, prepend_wiki: str):
|
|
245
|
-
main(behave_log = behave_log, scenario_logs = scenario_logs, wiki = wiki, prepend_wiki = prepend_wiki)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if __name__ == '__main__': # debugger & python command line start here
|
|
249
|
-
# eg: python api_logic_server_cli/cli.py create --project_name=~/Desktop/test_project
|
|
250
|
-
# unix: python api_logic_server_cli/cli.py create --project_name=/home/ApiLogicProject
|
|
251
|
-
|
|
252
|
-
print(f'\nBehave Logic Report 1.1, started at {os.getcwd()}')
|
|
253
|
-
commands = sys.argv
|
|
254
|
-
if len(sys.argv) > 1:
|
|
255
|
-
print_args(commands, f'\n\nCommand Line Arguments:')
|
|
256
|
-
cli()
|
|
183
|
+
# Remove the debug info (# features/...) from the scenario name
|
|
184
|
+
debug_loc = current_scenario.find(behave_debug_info)
|
|
185
|
+
if debug_loc > 0:
|
|
186
|
+
current_scenario = current_scenario[0:debug_loc].strip()
|
|
187
|
+
wiki_data.append(" ")
|
|
188
|
+
wiki_data.append(" ")
|
|
189
|
+
# Remove debug info from header line too
|
|
190
|
+
header_line = each_line[2:]
|
|
191
|
+
debug_loc = header_line.find(behave_debug_info)
|
|
192
|
+
if debug_loc > 0:
|
|
193
|
+
header_line = header_line[0:debug_loc].rstrip()
|
|
194
|
+
wiki_data.append("### " + header_line) # Add scenario header
|