siftcode 0.3.0__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.
@@ -0,0 +1,215 @@
1
+ """
2
+ Prompt templates for Siftcode.
3
+
4
+ All LLM prompts live here so they can be iterated independently of
5
+ the analysis logic. Templates use Python's str.format() syntax.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+
11
+ # ---------------------------------------------------------------------------
12
+ # System prompts — the "persona" for each analysis stage
13
+ # ---------------------------------------------------------------------------
14
+
15
+ SYSTEM_ROOT = (
16
+ "You are a senior software engineer who summarizes projects from their "
17
+ "directory structure and file names. Be factual and concise.\n\n"
18
+ "CRITICAL: Only report what you can actually see in the directory "
19
+ "listing. Do NOT invent common files like setup.py, requirements.txt, "
20
+ "config.yaml, or Dockerfile unless they appear in the listing. If a "
21
+ "typical file is missing, say so explicitly rather than assuming it "
22
+ "exists."
23
+ )
24
+
25
+ SYSTEM_FILE = (
26
+ "You are a senior software engineer who analyzes source code files. "
27
+ "Be precise and factual.\n\n"
28
+ "CRITICAL: Report only what is literally present in the code. Do NOT "
29
+ "invent functions, classes, parameters, or interfaces that are not "
30
+ "shown. If a file imports a module, report the import — do not "
31
+ "speculate about what that module contains. If you cannot determine "
32
+ "something from the code, say 'not shown in this file' rather than "
33
+ "guessing."
34
+ )
35
+
36
+ SYSTEM_DIRECTORY = (
37
+ "You are a senior software engineer who summarizes the purpose of a "
38
+ "directory based on its files. Be concise and factual. Base your "
39
+ "summary only on the file summaries provided."
40
+ )
41
+
42
+ SYSTEM_GUIDE = (
43
+ "You are a technical writer who creates clear, well-organized developer "
44
+ "guides in Markdown. Write for a developer who is new to the project.\n\n"
45
+ "CRITICAL RULES:\n"
46
+ "1. Base every statement on the project analysis provided below. "
47
+ "Never invent files, functions, or configuration that is not in the "
48
+ "analysis.\n"
49
+ "2. If the analysis does not mention a common file (e.g. setup.py, "
50
+ "requirements.txt), do not assume it exists.\n"
51
+ "3. If you cannot determine something, write 'Not documented' rather "
52
+ "than guessing.\n"
53
+ "4. Report only issues that are directly supported by the analysis. "
54
+ "If no significant issues are found, write 'No significant issues "
55
+ "detected.'\n"
56
+ )
57
+
58
+
59
+ # ---------------------------------------------------------------------------
60
+ # Root summary
61
+ # ---------------------------------------------------------------------------
62
+
63
+ ROOT_SUMMARY = """Project directory: {project_dir}
64
+
65
+ Directory contents (excluding common noise):
66
+ {contents}
67
+
68
+ Answer these questions in order:
69
+
70
+ 1. **Main language(s)**: What programming language(s) does this project use?
71
+ 2. **Project purpose**: What does this project do? Infer from file and directory names.
72
+ 3. **Architecture layers**: What are the main layers or components?
73
+ 4. **Notable technologies**: What frameworks, libraries, or tools are indicated by config files?
74
+
75
+ IMPORTANT:
76
+ - List ONLY files that appear in the directory contents above.
77
+ - Do NOT list common file names (setup.py, requirements.txt, config.yaml) unless they are actually in the listing.
78
+ - If a file typically found in this kind of project is MISSING, note it explicitly as missing.
79
+
80
+ Keep the answer under 300 words.
81
+ """
82
+
83
+
84
+ # ---------------------------------------------------------------------------
85
+ # File analysis
86
+ # ---------------------------------------------------------------------------
87
+
88
+ FILE_ANALYSIS = """{context}Analyze this file: {path}
89
+
90
+ Content:
91
+ {content}
92
+
93
+ Provide:
94
+
95
+ 1. **Purpose** (1-2 sentences)
96
+ 2. **Fields/variables**: name and purpose of each
97
+ 3. **Functions**: name, inputs, outputs, purpose
98
+ 4. **Classes/structs**: name and significance
99
+ 5. **Integration**: how this file fits into the project
100
+
101
+ IMPORTANT:
102
+ - Report only what is literally in this file.
103
+ - Do NOT invent classes, interfaces, or functions that are not shown.
104
+ - If a section has nothing to report, write "none".
105
+ """
106
+
107
+
108
+ # ---------------------------------------------------------------------------
109
+ # Directory summary
110
+ # ---------------------------------------------------------------------------
111
+
112
+ DIRECTORY_SUMMARY = """Directory: {path}
113
+
114
+ Files in this directory:
115
+ {file_summaries}
116
+
117
+ Provide a short summary (2-4 sentences) of:
118
+ 1. The purpose of this directory
119
+ 2. How the files work together
120
+ 3. What a developer should know when working here
121
+ """
122
+
123
+
124
+ # ---------------------------------------------------------------------------
125
+ # Developer guide
126
+ # ---------------------------------------------------------------------------
127
+
128
+ DEVELOPER_GUIDE = """Based on the project analysis below, create a comprehensive developer guide in Markdown.
129
+
130
+ {context}
131
+
132
+ ---
133
+
134
+ # Project analysis
135
+
136
+ ## Root summary
137
+
138
+ {root_summary}
139
+
140
+ ## Directory summaries
141
+
142
+ {directory_summaries}
143
+
144
+ ## File summaries
145
+
146
+ {file_summaries}
147
+
148
+ ---
149
+
150
+ Create the developer guide with the following structure:
151
+
152
+ ## 1. Executive Summary
153
+ - Project purpose
154
+ - Main technologies
155
+ - Key features
156
+
157
+ ## 2. Architecture
158
+ - High-level overview
159
+ - Key components and their relationships
160
+ - Design patterns observed
161
+
162
+ ## 3. Setup & Installation
163
+ - Prerequisites
164
+ - Installation steps
165
+ - Configuration
166
+
167
+ ## 4. Code Organization
168
+ - Directory structure
169
+ - Purpose of each major directory
170
+ - Key files
171
+
172
+ ## 5. Core Concepts
173
+ - Main abstractions
174
+ - Data models
175
+ - Important interfaces
176
+
177
+ ## 6. Development Workflow
178
+ - Building
179
+ - Testing
180
+ - Running
181
+
182
+ ## 7. API Reference
183
+ - Key functions with signatures and purposes
184
+ - Important classes
185
+
186
+ ## 8. Common Tasks
187
+ - Example workflows
188
+ - Code snippets
189
+
190
+ STRICT RULES:
191
+ - Use ONLY information from the analysis above. Do not invent files, commands, or APIs.
192
+ - If a section has no useful information from the analysis, write "Not documented" and move on.
193
+ - For the "Setup & Installation" section: report exactly what the analysis shows about dependencies and build tooling. If the project uses pyproject.toml, say so. Do NOT mention requirements.txt or setup.py unless they appear in the analysis.
194
+ - For the "Notable Issues" section: report only issues that are directly visible in the analysis (missing files that are referenced but not present, typos visible in file names, inconsistencies in the analysis data). If you find no significant issues, write exactly: "No significant issues detected."
195
+ - Do NOT invent typos, missing files, or inconsistencies. Only report what the analysis actually shows.
196
+ - Write in Markdown with clear headings and code blocks.
197
+ """
198
+
199
+
200
+ # ---------------------------------------------------------------------------
201
+ # Guide language
202
+ # ---------------------------------------------------------------------------
203
+
204
+ GUIDE_LANGUAGES = {
205
+ "en": "English",
206
+ "fi": "Finnish (suomi)",
207
+ }
208
+
209
+
210
+ def guide_language_instruction(language_code: str) -> str:
211
+ """Return a sentence telling the LLM which language to write in."""
212
+ if language_code == "en" or language_code not in GUIDE_LANGUAGES:
213
+ return ""
214
+ lang = GUIDE_LANGUAGES[language_code]
215
+ return f"\n\nWrite the entire guide in {lang}."
File without changes
Binary file
@@ -0,0 +1,9 @@
1
+ """GTK4 front-end for Siftcode.
2
+
3
+ All identifiers are re-exported from siftcode._version, which is the
4
+ single source of truth for the application's metadata.
5
+ """
6
+
7
+ from siftcode._version import APP_ID, APP_NAME, APP_TAGLINE
8
+
9
+ __all__ = ["APP_ID", "APP_NAME", "APP_TAGLINE"]