code2llm 0.5.92__tar.gz → 0.5.93__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.
- {code2llm-0.5.92 → code2llm-0.5.93}/PKG-INFO +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/__init__.py +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_exports/prompt.py +82 -16
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/readme_exporter.py +2 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/__init__.py +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/PKG-INFO +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/pyproject.toml +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/setup.py +1 -1
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_prompt_txt.py +34 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/LICENSE +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/README.md +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/__main__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/call_graph.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/cfg.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/coupling.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/data_analysis.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/dfg.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/pipeline_detector.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/side_effects.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/smells.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/analysis/type_inference.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/api.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_analysis.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_commands.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_exports/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_exports/code2logic.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_exports/formats.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_exports/orchestrator.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/cli_parser.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/analyzer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/config.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/file_analyzer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/file_cache.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/file_filter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/gitignore.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/base.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/cpp.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/csharp.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/generic.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/go_lang.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/java.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/php.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/ruby.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/rust.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/lang/typescript.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/large_repo.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/models.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/refactoring.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/repo_files.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/cache.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/incremental.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/prioritizer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/scanner.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming/strategies.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/streaming_analyzer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/core/toon_size_manager.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/article_view.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/base.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/context_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/context_view.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/evolution_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/flow_constants.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/flow_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/flow_renderer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/html_dashboard.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/index_generator.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/json_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/llm_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/map_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/mermaid_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/project_yaml_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/report_generators.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon/helpers.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon/metrics.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon/module_detail.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon/renderer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/toon_view.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/validate_project.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/exporters/yaml_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/generators/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/generators/llm_flow.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/generators/llm_task.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/generators/mermaid.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/config.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/entity_resolution.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/intent_matching.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/normalization.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/nlp/pipeline.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/patterns/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/patterns/detector.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/refactor/__init__.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm/refactor/prompt_engine.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/SOURCES.txt +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/dependency_links.txt +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/entry_points.txt +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/requires.txt +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/code2llm.egg-info/top_level.txt +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/setup.cfg +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_advanced_analysis.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_analyzer.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_deep_analysis.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_edge_cases.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_flow_exporter.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_format_quality.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_multilanguage_e2e.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_nlp_pipeline.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_nonpython_cc_calls.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_pipeline_detector.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_project_toon_export.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_prompt_engine.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_refactoring_engine.py +0 -0
- {code2llm-0.5.92 → code2llm-0.5.93}/tests/test_toon_v2.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.93
|
|
4
4
|
Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
|
|
5
5
|
Home-page: https://github.com/wronai/stts
|
|
6
6
|
Author: STTS Project
|
|
@@ -8,7 +8,7 @@ Includes NLP Processing Pipeline for query normalization, intent matching,
|
|
|
8
8
|
and entity resolution with multilingual support.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
__version__ = "0.5.
|
|
11
|
+
__version__ = "0.5.93"
|
|
12
12
|
__author__ = "STTS Project"
|
|
13
13
|
|
|
14
14
|
# Core analysis components (lightweight, always needed)
|
|
@@ -21,7 +21,10 @@ def _export_prompt_txt(args, output_dir: Path, formats: list[str], source_path:
|
|
|
21
21
|
lines.append("")
|
|
22
22
|
lines.append("Missing files (not generated in this run):")
|
|
23
23
|
for name in missing:
|
|
24
|
-
|
|
24
|
+
if output_rel_path:
|
|
25
|
+
lines.append(f"- {output_rel_path}/{name}")
|
|
26
|
+
else:
|
|
27
|
+
lines.append(f"- {name}")
|
|
25
28
|
|
|
26
29
|
# Analyze generated files and build dynamic footer
|
|
27
30
|
file_analysis = _analyze_generated_files(output_dir)
|
|
@@ -69,14 +72,16 @@ def _get_prompt_paths(source_path: Optional[Path], output_dir: Path) -> Tuple[st
|
|
|
69
72
|
try:
|
|
70
73
|
output_rel_path = str(output_dir.relative_to(source_path))
|
|
71
74
|
except ValueError:
|
|
72
|
-
|
|
75
|
+
# When output is not relative to source, use empty string for just filenames
|
|
76
|
+
output_rel_path = ""
|
|
73
77
|
else:
|
|
74
78
|
cwd = Path.cwd()
|
|
75
79
|
project_path = cwd.name
|
|
76
80
|
try:
|
|
77
81
|
output_rel_path = str(output_dir.relative_to(cwd))
|
|
78
82
|
except ValueError:
|
|
79
|
-
|
|
83
|
+
# When output is not relative to cwd, use empty string for just filenames
|
|
84
|
+
output_rel_path = ""
|
|
80
85
|
return project_path, output_rel_path
|
|
81
86
|
|
|
82
87
|
|
|
@@ -107,6 +112,7 @@ def _build_prompt_header(project_path: str) -> List[str]:
|
|
|
107
112
|
return [
|
|
108
113
|
"You are an AI assistant helping me understand and improve a codebase.",
|
|
109
114
|
"Use the attached/generated files as the authoritative context.",
|
|
115
|
+
"Your goal is to refactor the project based on these files, not just summarize it.",
|
|
110
116
|
"",
|
|
111
117
|
f"we are in project path: {project_path}",
|
|
112
118
|
"",
|
|
@@ -134,7 +140,10 @@ def _build_prompt_file_lines(output_dir: Path, output_rel_path: str, files: list
|
|
|
134
140
|
|
|
135
141
|
file_path = output_dir / existing
|
|
136
142
|
size_str = _format_size(file_path.stat().st_size)
|
|
137
|
-
|
|
143
|
+
if output_rel_path:
|
|
144
|
+
lines.append(f"- {output_rel_path}/{existing} ({desc}) [{size_str}]")
|
|
145
|
+
else:
|
|
146
|
+
lines.append(f"- {existing} ({desc}) [{size_str}]")
|
|
138
147
|
|
|
139
148
|
return lines
|
|
140
149
|
|
|
@@ -232,9 +241,15 @@ def _build_missing_files_section(output_dir: Path, output_rel_path: str) -> List
|
|
|
232
241
|
for name in missing:
|
|
233
242
|
# Special handling for validation and duplication files
|
|
234
243
|
if name in ['validation.toon.yaml', 'duplication.toon.yaml']:
|
|
235
|
-
|
|
244
|
+
if output_rel_path:
|
|
245
|
+
lines.append(f"- {output_rel_path}/project/{name}")
|
|
246
|
+
else:
|
|
247
|
+
lines.append(f"- project/{name}")
|
|
236
248
|
else:
|
|
237
|
-
|
|
249
|
+
if output_rel_path:
|
|
250
|
+
lines.append(f"- {output_rel_path}/{name}")
|
|
251
|
+
else:
|
|
252
|
+
lines.append(f"- {name}")
|
|
238
253
|
return lines
|
|
239
254
|
|
|
240
255
|
|
|
@@ -340,35 +355,78 @@ def _build_dynamic_tasks(file_analysis: dict) -> List[str]:
|
|
|
340
355
|
project_logic_file = file_analysis.get('project_logic_file', 'project.toon')
|
|
341
356
|
|
|
342
357
|
tasks = [
|
|
343
|
-
"-
|
|
344
|
-
"-
|
|
345
|
-
"- If you
|
|
358
|
+
"- Treat this prompt as a refactoring brief: identify the highest-priority changes and prepare concrete edits.",
|
|
359
|
+
"- Use the file set to decide whether the first pass should focus on correctness, duplication, complexity reduction, or architecture cleanup.",
|
|
360
|
+
"- If you can safely implement the refactor, do it; otherwise give an exact file-by-file change plan and test plan.",
|
|
346
361
|
]
|
|
347
362
|
|
|
348
363
|
if file_analysis['has_analysis_toon']:
|
|
349
|
-
tasks.append(f"-
|
|
364
|
+
tasks.append(f"- Use {analysis_file} to locate high-CC functions and god modules that should be split first.")
|
|
350
365
|
|
|
351
366
|
if file_analysis['has_map_toon']:
|
|
352
|
-
tasks.append(f"-
|
|
367
|
+
tasks.append(f"- Keep module boundaries intact and update imports/exports according to {map_file}.")
|
|
353
368
|
|
|
354
369
|
if file_analysis['has_evolution_toon']:
|
|
355
|
-
tasks.append(f"-
|
|
370
|
+
tasks.append(f"- Use {evolution_file} as the execution backlog and work from the top-ranked items.")
|
|
356
371
|
|
|
357
372
|
if file_analysis.get('has_project_toon_yaml'):
|
|
358
|
-
tasks.append(f"-
|
|
373
|
+
tasks.append(f"- Keep {project_toon_file} aligned with the refactored architecture.")
|
|
359
374
|
|
|
360
375
|
if file_analysis.get('has_project_logic'):
|
|
361
|
-
tasks.append(f"- Use {project_logic_file}
|
|
376
|
+
tasks.append(f"- Use {project_logic_file} only as a legacy cross-check when needed.")
|
|
362
377
|
|
|
363
378
|
if file_analysis['has_validation_toon']:
|
|
364
|
-
tasks.append(f"-
|
|
379
|
+
tasks.append(f"- Treat {validation_file} as a P0 blocker and resolve validation problems before structural cleanup.")
|
|
365
380
|
|
|
366
381
|
if file_analysis['has_duplication_toon']:
|
|
367
|
-
tasks.append(f"-
|
|
382
|
+
tasks.append(f"- Treat {duplication_file} as a P0/P1 issue and remove duplicated logic after blockers.")
|
|
368
383
|
|
|
369
384
|
return tasks
|
|
370
385
|
|
|
371
386
|
|
|
387
|
+
def _build_priority_order(file_analysis: dict) -> List[str]:
|
|
388
|
+
"""Build a state-dependent priority order for refactoring."""
|
|
389
|
+
analysis_file = file_analysis.get('analysis_file', 'analysis.toon')
|
|
390
|
+
map_file = file_analysis.get('map_file', 'map.toon.yaml')
|
|
391
|
+
evolution_file = file_analysis.get('evolution_file', 'evolution.toon.yaml')
|
|
392
|
+
project_toon_file = file_analysis.get('project_toon_file', 'project.toon.yaml')
|
|
393
|
+
project_logic_file = file_analysis.get('project_logic_file', 'project.toon')
|
|
394
|
+
validation_file = file_analysis.get('validation_file', 'project/validation.toon.yaml')
|
|
395
|
+
duplication_file = file_analysis.get('duplication_file', 'project/duplication.toon.yaml')
|
|
396
|
+
|
|
397
|
+
priorities = []
|
|
398
|
+
|
|
399
|
+
if file_analysis.get('has_validation_toon'):
|
|
400
|
+
priorities.append(f"P0 — Fix validation issues from {validation_file} first.")
|
|
401
|
+
|
|
402
|
+
if file_analysis.get('has_duplication_toon'):
|
|
403
|
+
priorities.append(f"P0/P1 — Remove duplicated logic reported in {duplication_file}.")
|
|
404
|
+
|
|
405
|
+
if file_analysis.get('has_analysis_toon'):
|
|
406
|
+
priorities.append(f"P1 — Split or simplify the highest-CC / god modules identified in {analysis_file}.")
|
|
407
|
+
|
|
408
|
+
if file_analysis.get('has_map_toon'):
|
|
409
|
+
priorities.append(f"P1 — Preserve module boundaries and update imports/exports according to {map_file}.")
|
|
410
|
+
|
|
411
|
+
if file_analysis.get('has_project_toon_yaml'):
|
|
412
|
+
priorities.append(f"P2 — Keep the compact project overview in {project_toon_file} aligned with the refactor.")
|
|
413
|
+
|
|
414
|
+
if file_analysis.get('has_evolution_toon'):
|
|
415
|
+
priorities.append(f"P2 — Execute the highest-impact items from {evolution_file} in order of benefit/risk.")
|
|
416
|
+
|
|
417
|
+
if file_analysis.get('has_project_logic'):
|
|
418
|
+
priorities.append(f"P3 — Use {project_logic_file} only as a legacy cross-check.")
|
|
419
|
+
|
|
420
|
+
if not priorities:
|
|
421
|
+
priorities = [
|
|
422
|
+
"P1 — Inspect analysis.toon and map.toon.yaml to identify the safest first refactor.",
|
|
423
|
+
"P2 — Turn the findings into concrete code edits and tests.",
|
|
424
|
+
"P3 — Keep changes minimal, backward compatible, and reversible.",
|
|
425
|
+
]
|
|
426
|
+
|
|
427
|
+
return priorities
|
|
428
|
+
|
|
429
|
+
|
|
372
430
|
def _build_prompt_footer(chunked: bool = False, file_analysis: dict = None) -> List[str]:
|
|
373
431
|
"""Build dynamic footer section of prompt based on generated files."""
|
|
374
432
|
if file_analysis is None:
|
|
@@ -381,6 +439,14 @@ def _build_prompt_footer(chunked: bool = False, file_analysis: dict = None) -> L
|
|
|
381
439
|
tasks = _build_dynamic_tasks(file_analysis)
|
|
382
440
|
for task in tasks:
|
|
383
441
|
lines.append(task)
|
|
442
|
+
|
|
443
|
+
# Priority order
|
|
444
|
+
priorities = _build_priority_order(file_analysis)
|
|
445
|
+
if priorities:
|
|
446
|
+
lines.append("")
|
|
447
|
+
lines.append("Priority Order:")
|
|
448
|
+
for priority in priorities:
|
|
449
|
+
lines.append(priority)
|
|
384
450
|
|
|
385
451
|
# Dynamic focus areas
|
|
386
452
|
focus_areas = _build_dynamic_focus_areas(file_analysis)
|
|
@@ -238,7 +238,8 @@ grep -E "^ .*[0-9]{{3,}}$" project.toon.yaml | sort -t',' -k2 -n -r | head -10
|
|
|
238
238
|
- **Files section**: Lists all existing generated files with descriptions, including `project.toon.yaml` when generated by `-f all`
|
|
239
239
|
- **Source files section**: Highlights important source files such as `cli_exports/orchestrator.py`
|
|
240
240
|
- **Missing section**: Shows which files weren't generated (if any)
|
|
241
|
-
- **Task section**:
|
|
241
|
+
- **Task section**: Refactoring brief with concrete execution instructions, not just analysis
|
|
242
|
+
- **Priority Order section**: State-dependent refactoring priorities, starting with blockers and then architecture cleanup
|
|
242
243
|
- **Requirements section**: Guidelines for suggested changes
|
|
243
244
|
|
|
244
245
|
**Example usage**:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code2llm
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.93
|
|
4
4
|
Summary: High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries
|
|
5
5
|
Home-page: https://github.com/wronai/stts
|
|
6
6
|
Author: STTS Project
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code2llm"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.93"
|
|
8
8
|
description = "High-performance Python code flow analysis with optimized TOON format - CFG, DFG, call graphs, and intelligent code queries"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -121,9 +121,43 @@ class TestPromptTxtGeneration:
|
|
|
121
121
|
# Check for key sections
|
|
122
122
|
assert "You are an AI assistant" in content, "Main instruction should be present"
|
|
123
123
|
assert "Task:" in content, "Task section should be present"
|
|
124
|
+
assert "refactoring brief" in content, "Task section should instruct refactoring"
|
|
125
|
+
assert "Priority Order:" in content, "Priority section should be present"
|
|
124
126
|
assert "Constraints:" in content, "Constraints section should be present"
|
|
125
127
|
assert "we are in project path:" in content, "Project path should be present"
|
|
126
128
|
|
|
129
|
+
def test_prompt_txt_prioritizes_blockers_when_validation_and_duplication_exist(self, temp_output_dir, mock_args):
|
|
130
|
+
"""Test that prompt.txt orders blockers first when validation and duplication outputs exist."""
|
|
131
|
+
formats = ['all']
|
|
132
|
+
source_path = Path('/home/user/myproject')
|
|
133
|
+
|
|
134
|
+
# Create the main generated files plus blocker files
|
|
135
|
+
generated_files = [
|
|
136
|
+
'analysis.toon',
|
|
137
|
+
'map.toon.yaml',
|
|
138
|
+
'evolution.toon.yaml',
|
|
139
|
+
'project.toon.yaml',
|
|
140
|
+
'context.md',
|
|
141
|
+
'README.md',
|
|
142
|
+
]
|
|
143
|
+
for f in generated_files:
|
|
144
|
+
(temp_output_dir / f).write_text('test')
|
|
145
|
+
|
|
146
|
+
(temp_output_dir / 'project').mkdir(parents=True, exist_ok=True)
|
|
147
|
+
(temp_output_dir / 'project' / 'validation.toon.yaml').write_text('validation')
|
|
148
|
+
(temp_output_dir / 'project' / 'duplication.toon.yaml').write_text('duplication')
|
|
149
|
+
|
|
150
|
+
_export_prompt_txt(mock_args, temp_output_dir, formats, source_path)
|
|
151
|
+
|
|
152
|
+
prompt_file = temp_output_dir / 'prompt.txt'
|
|
153
|
+
content = prompt_file.read_text()
|
|
154
|
+
|
|
155
|
+
assert "Priority Order:" in content, "Priority section should be present"
|
|
156
|
+
assert "P0 — Fix validation issues" in content, "Validation issues should be first priority"
|
|
157
|
+
assert "P0/P1 — Remove duplicated logic" in content, "Duplication issues should be prioritized next"
|
|
158
|
+
assert "P1 — Split or simplify the highest-CC / god modules" in content, "Analysis-driven refactoring should follow blockers"
|
|
159
|
+
assert "P2 — Keep the compact project overview" in content, "Project overview should be preserved as a later priority"
|
|
160
|
+
|
|
127
161
|
def test_prompt_txt_includes_orchestrator_source_file_description(self, temp_output_dir, temp_source_dir, mock_args):
|
|
128
162
|
"""Test that prompt.txt includes the orchestrator.py source file description."""
|
|
129
163
|
formats = ['code2logic']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|