sourcecode 0.2.0__py3-none-any.whl → 0.4.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.
- sourcecode/__init__.py +1 -1
- sourcecode/cli.py +78 -0
- sourcecode/dependency_analyzer.py +932 -0
- sourcecode/graph_analyzer.py +759 -0
- sourcecode/schema.py +76 -0
- {sourcecode-0.2.0.dist-info → sourcecode-0.4.0.dist-info}/METADATA +115 -1
- {sourcecode-0.2.0.dist-info → sourcecode-0.4.0.dist-info}/RECORD +9 -7
- {sourcecode-0.2.0.dist-info → sourcecode-0.4.0.dist-info}/WHEEL +0 -0
- {sourcecode-0.2.0.dist-info → sourcecode-0.4.0.dist-info}/entry_points.txt +0 -0
sourcecode/schema.py
CHANGED
|
@@ -68,6 +68,79 @@ class EntryPoint:
|
|
|
68
68
|
source: str = "manifest"
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
@dataclass
|
|
72
|
+
class DependencyRecord:
|
|
73
|
+
"""Dependencia detectada del proyecto."""
|
|
74
|
+
|
|
75
|
+
name: str
|
|
76
|
+
ecosystem: str
|
|
77
|
+
scope: str = "direct"
|
|
78
|
+
declared_version: Optional[str] = None
|
|
79
|
+
resolved_version: Optional[str] = None
|
|
80
|
+
source: str = "manifest"
|
|
81
|
+
parent: Optional[str] = None
|
|
82
|
+
manifest_path: Optional[str] = None
|
|
83
|
+
workspace: Optional[str] = None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class DependencySummary:
|
|
88
|
+
"""Resumen del analisis de dependencias."""
|
|
89
|
+
|
|
90
|
+
requested: bool = False
|
|
91
|
+
total_count: int = 0
|
|
92
|
+
direct_count: int = 0
|
|
93
|
+
transitive_count: int = 0
|
|
94
|
+
ecosystems: list[str] = field(default_factory=list)
|
|
95
|
+
sources: list[str] = field(default_factory=list)
|
|
96
|
+
limitations: list[str] = field(default_factory=list)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@dataclass
|
|
100
|
+
class GraphNode:
|
|
101
|
+
"""Nodo del grafo estructural del codigo."""
|
|
102
|
+
|
|
103
|
+
id: str
|
|
104
|
+
kind: str
|
|
105
|
+
language: str
|
|
106
|
+
path: str
|
|
107
|
+
symbol: Optional[str] = None
|
|
108
|
+
display_name: Optional[str] = None
|
|
109
|
+
workspace: Optional[str] = None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass
|
|
113
|
+
class GraphEdge:
|
|
114
|
+
"""Arista del grafo estructural del codigo."""
|
|
115
|
+
|
|
116
|
+
source: str
|
|
117
|
+
target: str
|
|
118
|
+
kind: str
|
|
119
|
+
confidence: Literal["high", "medium", "low"] = "medium"
|
|
120
|
+
method: Literal["ast", "heuristic", "unresolved"] = "heuristic"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class ModuleGraphSummary:
|
|
125
|
+
"""Resumen del analisis estructural del grafo."""
|
|
126
|
+
|
|
127
|
+
requested: bool = False
|
|
128
|
+
node_count: int = 0
|
|
129
|
+
edge_count: int = 0
|
|
130
|
+
languages: list[str] = field(default_factory=list)
|
|
131
|
+
methods: list[str] = field(default_factory=list)
|
|
132
|
+
limitations: list[str] = field(default_factory=list)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass
|
|
136
|
+
class ModuleGraph:
|
|
137
|
+
"""Grafo de modulos, simbolos y relaciones del proyecto."""
|
|
138
|
+
|
|
139
|
+
nodes: list[GraphNode] = field(default_factory=list)
|
|
140
|
+
edges: list[GraphEdge] = field(default_factory=list)
|
|
141
|
+
summary: ModuleGraphSummary = field(default_factory=ModuleGraphSummary)
|
|
142
|
+
|
|
143
|
+
|
|
71
144
|
@dataclass
|
|
72
145
|
class SourceMap:
|
|
73
146
|
"""Schema completo del output v1.0.
|
|
@@ -85,3 +158,6 @@ class SourceMap:
|
|
|
85
158
|
stacks: list[StackDetection] = field(default_factory=list)
|
|
86
159
|
project_type: Optional[str] = None # relleno en Fase 3
|
|
87
160
|
entry_points: list[EntryPoint] = field(default_factory=list)
|
|
161
|
+
dependencies: list[DependencyRecord] = field(default_factory=list)
|
|
162
|
+
dependency_summary: Optional[DependencySummary] = None
|
|
163
|
+
module_graph: Optional[ModuleGraph] = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourcecode
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Genera un mapa de contexto estructurado de proyectos de software para agentes IA
|
|
5
5
|
License: MIT
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -46,6 +46,18 @@ Analyze another directory and write YAML to a file:
|
|
|
46
46
|
sourcecode --format yaml --output sourcecode.yaml /path/to/project
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
Include direct dependencies, exact versions, and transitive dependencies when compatible lockfiles are available:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
sourcecode . --dependencies
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Include an internal module graph with imports and simple structural relations:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
sourcecode . --graph-modules
|
|
59
|
+
```
|
|
60
|
+
|
|
49
61
|
Show the version:
|
|
50
62
|
|
|
51
63
|
```bash
|
|
@@ -57,6 +69,8 @@ Main options:
|
|
|
57
69
|
- `--format json|yaml`: output format.
|
|
58
70
|
- `--output PATH`: write to a file instead of `stdout`.
|
|
59
71
|
- `--compact`: return a reduced view with `schema_version`, `project_type`, `stacks`, `entry_points`, and `file_tree_depth1`.
|
|
72
|
+
- `--dependencies`: include direct dependencies, resolved versions, and transitive relationships when lockfiles make that possible.
|
|
73
|
+
- `--graph-modules`: include a structural graph with modules, imports, and simple relations such as `contains`, `calls`, or `extends`.
|
|
60
74
|
- `--depth INTEGER`: maximum file tree depth.
|
|
61
75
|
- `--no-redact`: disable secret redaction.
|
|
62
76
|
|
|
@@ -152,6 +166,106 @@ The full schema includes:
|
|
|
152
166
|
- `stacks`: stack detections with confidence, frameworks, manifests, `primary`, `root`, `workspace`, and `signals`.
|
|
153
167
|
- `project_type`: overall project classification.
|
|
154
168
|
- `entry_points`: detected entry points by stack.
|
|
169
|
+
- `dependencies`: optional dependency records with declared and resolved versions.
|
|
170
|
+
- `dependency_summary`: optional summary with ecosystem coverage, counts, and known limitations.
|
|
171
|
+
- `module_graph`: optional structural graph with nodes, edges, and analysis limits.
|
|
172
|
+
|
|
173
|
+
Example dependency block:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"dependencies": [
|
|
178
|
+
{
|
|
179
|
+
"name": "fastapi",
|
|
180
|
+
"ecosystem": "python",
|
|
181
|
+
"scope": "direct",
|
|
182
|
+
"declared_version": ">=0.115",
|
|
183
|
+
"resolved_version": "0.115.2",
|
|
184
|
+
"source": "lockfile",
|
|
185
|
+
"parent": null,
|
|
186
|
+
"manifest_path": "poetry.lock",
|
|
187
|
+
"workspace": "packages/api"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "starlette",
|
|
191
|
+
"ecosystem": "python",
|
|
192
|
+
"scope": "transitive",
|
|
193
|
+
"declared_version": null,
|
|
194
|
+
"resolved_version": "0.38.6",
|
|
195
|
+
"source": "lockfile",
|
|
196
|
+
"parent": "fastapi",
|
|
197
|
+
"manifest_path": "poetry.lock",
|
|
198
|
+
"workspace": "packages/api"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"dependency_summary": {
|
|
202
|
+
"requested": true,
|
|
203
|
+
"total_count": 2,
|
|
204
|
+
"direct_count": 1,
|
|
205
|
+
"transitive_count": 1,
|
|
206
|
+
"ecosystems": ["python"],
|
|
207
|
+
"sources": ["lockfile"],
|
|
208
|
+
"limitations": []
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Dependency analysis is still offline and conservative: if a lockfile does not expose a reliable transitive graph, `sourcecode` reports direct dependencies and records the limitation instead of guessing.
|
|
214
|
+
|
|
215
|
+
Example module graph block:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"module_graph": {
|
|
220
|
+
"nodes": [
|
|
221
|
+
{
|
|
222
|
+
"id": "module:app/main.py",
|
|
223
|
+
"kind": "module",
|
|
224
|
+
"language": "python",
|
|
225
|
+
"path": "app/main.py",
|
|
226
|
+
"symbol": null,
|
|
227
|
+
"display_name": "app/main.py",
|
|
228
|
+
"workspace": null
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "function:app/main.py:run",
|
|
232
|
+
"kind": "function",
|
|
233
|
+
"language": "python",
|
|
234
|
+
"path": "app/main.py",
|
|
235
|
+
"symbol": "run",
|
|
236
|
+
"display_name": "run",
|
|
237
|
+
"workspace": null
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"edges": [
|
|
241
|
+
{
|
|
242
|
+
"source": "module:app/main.py",
|
|
243
|
+
"target": "module:app/utils.py",
|
|
244
|
+
"kind": "imports",
|
|
245
|
+
"confidence": "high",
|
|
246
|
+
"method": "ast"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"source": "function:app/main.py:run",
|
|
250
|
+
"target": "function:app/utils.py:helper",
|
|
251
|
+
"kind": "calls",
|
|
252
|
+
"confidence": "medium",
|
|
253
|
+
"method": "ast"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"summary": {
|
|
257
|
+
"requested": true,
|
|
258
|
+
"node_count": 2,
|
|
259
|
+
"edge_count": 2,
|
|
260
|
+
"languages": ["python"],
|
|
261
|
+
"methods": ["ast"],
|
|
262
|
+
"limitations": []
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Graph analysis is also offline and conservative. `sourcecode` prefers partial but defensible edges over pretending to build a perfect semantic call graph, and it records parse failures, unresolved imports, or analysis budgets in `module_graph.summary.limitations`.
|
|
155
269
|
|
|
156
270
|
Detailed reference: [docs/schema.md](/Users/user/Documents/workspace/atlas/atlas-cli/docs/schema.md).
|
|
157
271
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
sourcecode/__init__.py,sha256=
|
|
1
|
+
sourcecode/__init__.py,sha256=iBHGXEsmbN21QO7wvQ3ZZhBy96xjvWrfacPsjTSGcds,99
|
|
2
2
|
sourcecode/classifier.py,sha256=7ubGTn5vfw9z-9eosLIYDtQUu7d8dvB4XKKDxysUVSM,6910
|
|
3
|
-
sourcecode/cli.py,sha256=
|
|
3
|
+
sourcecode/cli.py,sha256=NysuO95KIxpBEpRiwor93_WFvdMvjk0ArDRv8KPX440,10136
|
|
4
|
+
sourcecode/dependency_analyzer.py,sha256=c8tSbUpug-2avKNWCP4-_e2_uhBwWl96LwL1Be8O90M,39067
|
|
5
|
+
sourcecode/graph_analyzer.py,sha256=hskmEr-c5z3HjWr2S_2ccaVSMrpikYdMY-ExbAiaK60,29353
|
|
4
6
|
sourcecode/redactor.py,sha256=abSf5jH_IzYzpjF3lEN6hCwdXxvmyHs-3DHz9fd8Mic,2883
|
|
5
7
|
sourcecode/scanner.py,sha256=TvcuD77m_NF8OlTj3XH1b_jO0qrto8c90fND96ecqb0,6182
|
|
6
|
-
sourcecode/schema.py,sha256=
|
|
8
|
+
sourcecode/schema.py,sha256=h5uemXKCrPVpEslO2iM_Kw3ax-4UmpOpkfK50HgTNo4,4517
|
|
7
9
|
sourcecode/serializer.py,sha256=hezTYOAAvZ2yPn7Te7Eu42ajbMhVCsUkuUZtqx4wjAs,3085
|
|
8
10
|
sourcecode/tree_utils.py,sha256=5WHQc2L-AGqxKFfYYcQftE6hETxgUxP9MWDuaThcAUw,991
|
|
9
11
|
sourcecode/workspace.py,sha256=1L4xH38gU89fLeMYSuF3ft7lSdCyTfMfJ9NQt5q4Ric,6904
|
|
@@ -26,7 +28,7 @@ sourcecode/detectors/rust.py,sha256=iUz9lE4HfBy8CBaDwGhfh6kLsNIovrH2ay2v3y6qNDc,
|
|
|
26
28
|
sourcecode/detectors/systems.py,sha256=qf5M9tio1H6XDorSstTWIxKe0xVLR_QGTJpFGyhDz4A,1690
|
|
27
29
|
sourcecode/detectors/terraform.py,sha256=5EOKQtTViWo7u3tFK0h45YD8GQPwhrww0cOicxGPPn4,1732
|
|
28
30
|
sourcecode/detectors/tooling.py,sha256=wPvudLCJZ8_cr9GIx44C8jkLAlEN9uTUZcJsP7eVYnQ,1937
|
|
29
|
-
sourcecode-0.
|
|
30
|
-
sourcecode-0.
|
|
31
|
-
sourcecode-0.
|
|
32
|
-
sourcecode-0.
|
|
31
|
+
sourcecode-0.4.0.dist-info/METADATA,sha256=gj14EtCMRfrSsiMpfMN1E2AaRObCQCU3Z_Io7Xpx_b4,7339
|
|
32
|
+
sourcecode-0.4.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
33
|
+
sourcecode-0.4.0.dist-info/entry_points.txt,sha256=voDtdlGU2-jR3wCZpQoOls_0eUKaDVCKIfajGHFDATs,50
|
|
34
|
+
sourcecode-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|