mafia-graph 0.9.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.
- mafia_graph-0.9.0/.amazonq/rules/mafia-agent.md +88 -0
- mafia_graph-0.9.0/.amazonq/rules/mafia-skills.md +69 -0
- mafia_graph-0.9.0/.continue/config.json +3 -0
- mafia_graph-0.9.0/.cursor/rules/mafia-agent.mdc +60 -0
- mafia_graph-0.9.0/.github/copilot-instructions.md +34 -0
- mafia_graph-0.9.0/.kiro/rules/mafia-agent.md +88 -0
- mafia_graph-0.9.0/.kiro/skills.md +44 -0
- mafia_graph-0.9.0/.windsurf/rules/mafia-agent.md +64 -0
- mafia_graph-0.9.0/.zed/rules.md +27 -0
- mafia_graph-0.9.0/AGENTS.md +72 -0
- mafia_graph-0.9.0/ARTIFACT_CONTRACT.md +195 -0
- mafia_graph-0.9.0/CLAUDE.md +81 -0
- mafia_graph-0.9.0/DEVELOPERS.md +472 -0
- mafia_graph-0.9.0/LICENSE +21 -0
- mafia_graph-0.9.0/MANIFEST.in +20 -0
- mafia_graph-0.9.0/PKG-INFO +711 -0
- mafia_graph-0.9.0/README.md +656 -0
- mafia_graph-0.9.0/mafia/__init__.py +19 -0
- mafia_graph-0.9.0/mafia/api.py +240 -0
- mafia_graph-0.9.0/mafia/compat.py +8 -0
- mafia_graph-0.9.0/mafia/config.py +16 -0
- mafia_graph-0.9.0/mafia/graph.py +67 -0
- mafia_graph-0.9.0/mafia/ids.py +60 -0
- mafia_graph-0.9.0/mafia/migrate.py +92 -0
- mafia_graph-0.9.0/mafia/plugins.py +64 -0
- mafia_graph-0.9.0/mafia/skill.py +183 -0
- mafia_graph-0.9.0/mafia_cli.py +1156 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/PKG-INFO +711 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/SOURCES.txt +154 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/dependency_links.txt +1 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/entry_points.txt +26 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/requires.txt +38 -0
- mafia_graph-0.9.0/mafia_graph.egg-info/top_level.txt +19 -0
- mafia_graph-0.9.0/phase10_ast/__init__.py +1 -0
- mafia_graph-0.9.0/phase10_ast/run_ast_summaries.py +655 -0
- mafia_graph-0.9.0/phase10_intelligence/__init__.py +1 -0
- mafia_graph-0.9.0/phase10_intelligence/component_intelligence.py +647 -0
- mafia_graph-0.9.0/phase10_intelligence/flow_intelligence.py +399 -0
- mafia_graph-0.9.0/phase10_intelligence/issue_diagnosis.py +337 -0
- mafia_graph-0.9.0/phase10_intelligence/provenance.py +84 -0
- mafia_graph-0.9.0/phase11_search/__init__.py +1 -0
- mafia_graph-0.9.0/phase11_search/bigquery_store.py +168 -0
- mafia_graph-0.9.0/phase11_search/chat_engine.py +381 -0
- mafia_graph-0.9.0/phase11_search/code_reader.py +264 -0
- mafia_graph-0.9.0/phase11_search/document_builder.py +433 -0
- mafia_graph-0.9.0/phase11_search/graph_retriever.py +317 -0
- mafia_graph-0.9.0/phase11_search/ingestion/__init__.py +1 -0
- mafia_graph-0.9.0/phase11_search/ingestion/doc_extractor.py +252 -0
- mafia_graph-0.9.0/phase11_search/ingestion/doc_store.py +309 -0
- mafia_graph-0.9.0/phase11_search/pipeline_runner.py +410 -0
- mafia_graph-0.9.0/phase11_search/search_api.py +1292 -0
- mafia_graph-0.9.0/phase11_search/search_api1.py +2404 -0
- mafia_graph-0.9.0/phase11_search/vector_index.py +425 -0
- mafia_graph-0.9.0/phase12_ui/__init__.py +0 -0
- mafia_graph-0.9.0/phase12_ui/index.html +175 -0
- mafia_graph-0.9.0/phase12_ui/landing.html +343 -0
- mafia_graph-0.9.0/phase12_ui/static/app.js +3431 -0
- mafia_graph-0.9.0/phase12_ui/static/chat.js +543 -0
- mafia_graph-0.9.0/phase12_ui/static/landing.css +1422 -0
- mafia_graph-0.9.0/phase12_ui/static/landing.js +812 -0
- mafia_graph-0.9.0/phase12_ui/static/styles.css +2137 -0
- mafia_graph-0.9.0/phase12_ui/static/v2/app.js +3110 -0
- mafia_graph-0.9.0/phase12_ui/static/v2/styles.css +1514 -0
- mafia_graph-0.9.0/phase12_ui/v2/index.html +152 -0
- mafia_graph-0.9.0/phase13_evaluation/__init__.py +1 -0
- mafia_graph-0.9.0/phase13_evaluation/gold_dataset_builder.py +171 -0
- mafia_graph-0.9.0/phase13_evaluation/metric_calculators.py +179 -0
- mafia_graph-0.9.0/phase14_orchestration/__init__.py +1 -0
- mafia_graph-0.9.0/phase14_orchestration/artifact_versioning.py +134 -0
- mafia_graph-0.9.0/phase14_orchestration/orchestrator.py +17 -0
- mafia_graph-0.9.0/phase14_orchestration/run_state.py +103 -0
- mafia_graph-0.9.0/phase2_repo_intake/__init__.py +1 -0
- mafia_graph-0.9.0/phase2_repo_intake/arch_detector.py +526 -0
- mafia_graph-0.9.0/phase2_repo_intake/manifest_writer.py +83 -0
- mafia_graph-0.9.0/phase2_repo_intake/repo_scanner.py +667 -0
- mafia_graph-0.9.0/phase2_repo_intake/scope_discovery.py +142 -0
- mafia_graph-0.9.0/phase2_repo_intake/source_adapters.py +153 -0
- mafia_graph-0.9.0/phase2_repo_intake/stack_detector.py +140 -0
- mafia_graph-0.9.0/phase3_extraction_framework/__init__.py +1 -0
- mafia_graph-0.9.0/phase3_extraction_framework/base_extractor.py +407 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/__init__.py +97 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/artifact_stitcher.py +54 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/cross_workspace_imports.py +104 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/shared_env_stitcher.py +50 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/shared_lib_stitcher.py +61 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/shared_table_stitcher.py +70 -0
- mafia_graph-0.9.0/phase3_extraction_framework/cross_scope/workspace_dep_stitcher.py +102 -0
- mafia_graph-0.9.0/phase3_extraction_framework/dispatcher.py +311 -0
- mafia_graph-0.9.0/phase3_extraction_framework/run_extraction.py +428 -0
- mafia_graph-0.9.0/phase3_extraction_framework/skeleton_extractors.py +224 -0
- mafia_graph-0.9.0/phase3_extraction_framework/structural_relations.py +1686 -0
- mafia_graph-0.9.0/phase3_extraction_framework/symbol_resolver.py +375 -0
- mafia_graph-0.9.0/phase4_extractors/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/api/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/api/api_extractor.py +595 -0
- mafia_graph-0.9.0/phase4_extractors/ast_helpers.py +268 -0
- mafia_graph-0.9.0/phase4_extractors/bff/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/bff/bff_extractor.py +377 -0
- mafia_graph-0.9.0/phase4_extractors/config/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/config/config_extractor.py +132 -0
- mafia_graph-0.9.0/phase4_extractors/db/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/db/bigquery_extractor.py +285 -0
- mafia_graph-0.9.0/phase4_extractors/db/databricks_extractor.py +274 -0
- mafia_graph-0.9.0/phase4_extractors/db/pg_sql_extractor.py +529 -0
- mafia_graph-0.9.0/phase4_extractors/generic/__init__.py +0 -0
- mafia_graph-0.9.0/phase4_extractors/generic/ast_extractor.py +293 -0
- mafia_graph-0.9.0/phase4_extractors/ts_extractor.py +551 -0
- mafia_graph-0.9.0/phase4_extractors/ui/__init__.py +1 -0
- mafia_graph-0.9.0/phase4_extractors/ui/ui_extractor.py +643 -0
- mafia_graph-0.9.0/phase5_compatibility/__init__.py +1 -0
- mafia_graph-0.9.0/phase5_compatibility/legacy_generators.py +271 -0
- mafia_graph-0.9.0/phase6_coverage/__init__.py +1 -0
- mafia_graph-0.9.0/phase6_coverage/coverage_builder.py +509 -0
- mafia_graph-0.9.0/phase7_genai/__init__.py +1 -0
- mafia_graph-0.9.0/phase7_genai/gemini_client.py +212 -0
- mafia_graph-0.9.0/phase7_genai/pattern_discovery.py +559 -0
- mafia_graph-0.9.0/phase7_genai/prompt_templates.py +181 -0
- mafia_graph-0.9.0/phase7_mapping/__init__.py +1 -0
- mafia_graph-0.9.0/phase7_mapping/mapping_evaluator.py +246 -0
- mafia_graph-0.9.0/phase8_hardening/__init__.py +1 -0
- mafia_graph-0.9.0/phase8_hardening/graph_diff.py +156 -0
- mafia_graph-0.9.0/phase8_hardening/quality_gate.py +231 -0
- mafia_graph-0.9.0/phase8_hardening/regression_runner.py +201 -0
- mafia_graph-0.9.0/phase9_graph/__init__.py +1 -0
- mafia_graph-0.9.0/phase9_graph/annotation_store.py +165 -0
- mafia_graph-0.9.0/phase9_graph/blast_radius_engine.py +451 -0
- mafia_graph-0.9.0/phase9_graph/change_simulator.py +247 -0
- mafia_graph-0.9.0/phase9_graph/confidence_propagation.py +175 -0
- mafia_graph-0.9.0/phase9_graph/graph_builder.py +740 -0
- mafia_graph-0.9.0/phase9_graph/graph_query.py +565 -0
- mafia_graph-0.9.0/phase9_graph/graph_validator.py +215 -0
- mafia_graph-0.9.0/phase9_graph/graph_visualizer.py +331 -0
- mafia_graph-0.9.0/phase9_graph/temporal_snapshots.py +304 -0
- mafia_graph-0.9.0/phase9_graph/topology_analyzer.py +429 -0
- mafia_graph-0.9.0/phase9_graph/weak_point_detector.py +288 -0
- mafia_graph-0.9.0/pyproject.toml +134 -0
- mafia_graph-0.9.0/requirements.txt +27 -0
- mafia_graph-0.9.0/schemas/__init__.py +1 -0
- mafia_graph-0.9.0/schemas/artifact_schemas.json +314 -0
- mafia_graph-0.9.0/schemas/emitter.py +425 -0
- mafia_graph-0.9.0/schemas/id_format.py +228 -0
- mafia_graph-0.9.0/schemas/samples/repo_manifest_sample.json +71 -0
- mafia_graph-0.9.0/schemas/scope.py +75 -0
- mafia_graph-0.9.0/schemas/validator.py +230 -0
- mafia_graph-0.9.0/setup.bat +163 -0
- mafia_graph-0.9.0/setup.cfg +4 -0
- mafia_graph-0.9.0/skills.md +357 -0
- mafia_graph-0.9.0/utils/__init__.py +1 -0
- mafia_graph-0.9.0/utils/ai_config.py +192 -0
- mafia_graph-0.9.0/utils/ast_summarizer.py +579 -0
- mafia_graph-0.9.0/utils/file_cache.py +100 -0
- mafia_graph-0.9.0/utils/file_classifier.py +195 -0
- mafia_graph-0.9.0/utils/fuzzy.py +84 -0
- mafia_graph-0.9.0/utils/ignore_loader.py +65 -0
- mafia_graph-0.9.0/utils/security.py +51 -0
- mafia_graph-0.9.0/utils/ts_parser.py +575 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MANDATORY - Use mafia CLI for ALL code questions before any other tool
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CRITICAL RULE: Use `mafia` CLI FIRST for ALL code questions
|
|
7
|
+
|
|
8
|
+
This project has a live dependency graph with 343 entities and 1433 relations.
|
|
9
|
+
The `mafia` CLI is installed and initialized. You MUST use it.
|
|
10
|
+
|
|
11
|
+
## MANDATORY BEHAVIOR
|
|
12
|
+
|
|
13
|
+
**BEFORE using fileSearch, grep, find, or reading source files to answer ANY question
|
|
14
|
+
about code structure, functions, classes, dependencies, imports, usage, or behavior —
|
|
15
|
+
you MUST first run the appropriate `mafia` command via executeBash.**
|
|
16
|
+
|
|
17
|
+
This applies to ALL of these question patterns (not just exact matches):
|
|
18
|
+
|
|
19
|
+
| User asks about... | Run this FIRST |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Any function, class, method, table, endpoint by name | `mafia search "<name>" --limit 10` |
|
|
22
|
+
| "where is X used" / "who uses X" / "who calls X" | `mafia search "<X>"` then `mafia neighbors "<id>" --direction upstream` |
|
|
23
|
+
| "what does X call" / "what does X depend on" | `mafia neighbors "<id>" --direction downstream` |
|
|
24
|
+
| "what breaks if I change X" / "impact of changing X" | `mafia blast "<id>" --direction downstream` |
|
|
25
|
+
| "how does X connect to Y" / "relationship between X and Y" | `mafia path "<X_id>" "<Y_id>"` |
|
|
26
|
+
| "trace the flow" / "end to end" / "full chain" | `mafia trace "<id>" --depth 10` or `mafia flows --node "<id>"` |
|
|
27
|
+
| "show me the flow for X" / "what flows involve X" | `mafia flows --node "<id>"` |
|
|
28
|
+
| "unused code" / "dead code" / "orphans" | `mafia orphans` |
|
|
29
|
+
| "how is the project structured" / "overview" | `mafia status` |
|
|
30
|
+
| "find X" / "locate X" / "where is X defined" | `mafia search "<X>" --limit 10` |
|
|
31
|
+
| "explain how X works" / "what does X do" | `mafia search "<X>"` → get ID → `mafia neighbors "<id>" --direction both` → THEN read source |
|
|
32
|
+
| "list all endpoints" / "list all tables" | `mafia search "endpoint" --limit 50` or search by type |
|
|
33
|
+
| "what changed" / "refresh" | `mafia update` |
|
|
34
|
+
|
|
35
|
+
## WORKFLOW
|
|
36
|
+
|
|
37
|
+
1. **Always start with `mafia search`** to find the entity ID
|
|
38
|
+
2. **Use the entity ID** in follow-up commands (neighbors, blast, trace, flows, path)
|
|
39
|
+
3. **Only THEN read source files** if the user needs to see actual code
|
|
40
|
+
|
|
41
|
+
## DO NOT
|
|
42
|
+
|
|
43
|
+
- Do NOT use fileSearch/grep to find function definitions when mafia search can find them
|
|
44
|
+
- Do NOT manually read import statements to trace dependencies when mafia neighbors exists
|
|
45
|
+
- Do NOT guess at call chains when mafia trace gives the real graph
|
|
46
|
+
- Do NOT scan files to find usages when mafia neighbors --direction upstream gives them
|
|
47
|
+
|
|
48
|
+
## Commands (real examples from this project)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Search for any entity (function, class, table, endpoint)
|
|
52
|
+
mafia search "py" --limit 10
|
|
53
|
+
|
|
54
|
+
# Who calls this (upstream neighbors)
|
|
55
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction upstream
|
|
56
|
+
|
|
57
|
+
# What this calls (downstream neighbors)
|
|
58
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
59
|
+
|
|
60
|
+
# Full blast radius — what breaks if this changes
|
|
61
|
+
mafia blast "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
62
|
+
|
|
63
|
+
# Trace the downstream call chain
|
|
64
|
+
mafia trace "code:module:MAFIA_Phase1_Execution:install.py" --depth 10
|
|
65
|
+
|
|
66
|
+
# End-to-end flows through a node
|
|
67
|
+
mafia flows --node "code:module:MAFIA_Phase1_Execution:install.py"
|
|
68
|
+
|
|
69
|
+
# Shortest path between two entities
|
|
70
|
+
mafia path "code:module:MAFIA_Phase1_Execution:install.py" "api:service:MAFIA_Phase1_Execution:mafia/api.py::MAFIA"
|
|
71
|
+
|
|
72
|
+
# Dead code candidates
|
|
73
|
+
mafia orphans
|
|
74
|
+
|
|
75
|
+
# Project graph stats
|
|
76
|
+
mafia status
|
|
77
|
+
|
|
78
|
+
# Refresh graph after code changes
|
|
79
|
+
mafia update
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
83
|
+
|
|
84
|
+
## Entity ID format
|
|
85
|
+
|
|
86
|
+
`{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
87
|
+
|
|
88
|
+
Layers: ui, bff, api, db, config, shared
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MAFIA codebase analysis system — skills and capabilities reference
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MAFIA System Context
|
|
7
|
+
|
|
8
|
+
This workspace is the MAFIA (Multi-Artifact Flow Intelligence Architecture) codebase analysis pipeline. When working in this project, you have access to these capabilities:
|
|
9
|
+
|
|
10
|
+
## Quick Reference
|
|
11
|
+
|
|
12
|
+
- **Scan repos:** `python -m phase2_repo_intake.repo_scanner --source-roots /path`
|
|
13
|
+
- **Run pipeline:** `python -m phase3_extraction_framework.run_extraction` (incremental) or `--full`
|
|
14
|
+
- **Rebuild graph only:** `python -m phase3_extraction_framework.run_extraction --from-phase 9`
|
|
15
|
+
- **AST summaries:** `python -m phase10_ast.run_ast_summaries --discover`
|
|
16
|
+
- **Build search index:** `python -m phase11_search.vector_index --incremental`
|
|
17
|
+
- **Start server:** `python -m phase11_search.search_api1` → http://localhost:5001
|
|
18
|
+
|
|
19
|
+
## Key Artifacts (all in output/)
|
|
20
|
+
|
|
21
|
+
- `repo_manifest.json` — discovered repos with classification
|
|
22
|
+
- `entities.jsonl` — all extracted entities (ID format: `layer:type:repo:qualifier`)
|
|
23
|
+
- `relations.jsonl` — all edges between entities
|
|
24
|
+
- `system_graph.json` — full graph (nodes + edges)
|
|
25
|
+
- `e2e_flows.json` — end-to-end flows across catalogs
|
|
26
|
+
- `ast_summaries.jsonl` — method-level structural summaries
|
|
27
|
+
- `coverage_report.json`, `quality_gate_report.json` — health metrics
|
|
28
|
+
|
|
29
|
+
## Architecture Layers
|
|
30
|
+
|
|
31
|
+
UI (React) → BFF (Koa/Express) → API (Spring Boot) → DB (Postgres/Databricks)
|
|
32
|
+
|
|
33
|
+
## When reading/modifying extractors
|
|
34
|
+
|
|
35
|
+
- All extractors subclass `BaseExtractor` in `phase3_extraction_framework/base_extractor.py`
|
|
36
|
+
- Extractors live in `phase4_extractors/` organized by layer
|
|
37
|
+
- Entity IDs use canonical format: `{layer}:{type}:{repo}:{qualifier}`
|
|
38
|
+
- Relations use: `{source_id}--{type}-->{target_id}`
|
|
39
|
+
- Valid layers/types/relations defined in `schemas/id_format.py`
|
|
40
|
+
- Emission goes through `schemas/emitter.py` (thread-safe, deduplicating)
|
|
41
|
+
|
|
42
|
+
## When working on the UI
|
|
43
|
+
|
|
44
|
+
- UI files in `phase12_ui/` — served by Flask at localhost:5001
|
|
45
|
+
- API endpoints defined in `phase11_search/search_api1.py`
|
|
46
|
+
- Key API routes: /search, /node/{id}, /flows, /flow/{id}, /blast_radius, /chat, /coverage
|
|
47
|
+
|
|
48
|
+
## Agent CLI (for any project)
|
|
49
|
+
|
|
50
|
+
MAFIA can be initialized on any project to give the agent codebase intelligence:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Initialize on a project (scans, extracts, builds graph)
|
|
54
|
+
python mafia_cli.py init --project-root /path/to/project
|
|
55
|
+
|
|
56
|
+
# Query from the agent (no server needed)
|
|
57
|
+
python mafia_cli.py search "getUserProfile" --limit 10
|
|
58
|
+
python mafia_cli.py trace "api:endpoint:user_api:GET:/users"
|
|
59
|
+
python mafia_cli.py blast "api:service:user_api:UserService" --direction downstream
|
|
60
|
+
python mafia_cli.py flows --node "bff:endpoint:user_bff:/users"
|
|
61
|
+
python mafia_cli.py neighbors "api:controller:user_api:UserController" --direction both
|
|
62
|
+
python mafia_cli.py path "ui:fetch_def:web:getUsers" "db:table:pg:users"
|
|
63
|
+
python mafia_cli.py orphans
|
|
64
|
+
python mafia_cli.py update # incremental after code changes
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Init creates `.mafia/` in the target project with artifacts + installs agent rules into `.amazonq/rules/mafia-agent.md` and `CLAUDE.md` automatically.
|
|
68
|
+
|
|
69
|
+
## For full skills reference, see skills.md in the project root.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{
|
|
2
|
+
"systemMessage": "CRITICAL RULE: Use `mafia` CLI FIRST for ALL code questions in this project.\n\nThis project has a live dependency graph (343 entities, 1433 relations). The `mafia` CLI is installed.\n\nBEFORE reading source files or answering questions about structure, dependencies, or behavior — run the appropriate `mafia` command.\n\nCommands (run from C:\\Users\\MML\\Downloads\\Graphify-MAFIA\\MAFIA_Phase1_Execution):\n- mafia search \"<name>\" --limit 10 # find any entity\n- mafia neighbors \"<id>\" --direction upstream # who calls X\n- mafia neighbors \"<id>\" --direction downstream # what X calls\n- mafia blast \"<id>\" --direction downstream # blast radius\n- mafia trace \"<id>\" --depth 10 # call chain\n- mafia flows --node \"<id>\" # e2e flows\n- mafia path \"<X_id>\" \"<Y_id>\" # shortest path\n- mafia orphans # dead code\n- mafia status # project overview\n- mafia update # refresh graph\n\nWorkflow: mafia search → get ID → use ID in follow-up commands → read source only if needed.\nEntity ID format: {layer}:{type}:{repo}:{qualifier}"
|
|
3
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MANDATORY - Use mafia CLI for ALL code questions before any other tool
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CRITICAL RULE: Use `mafia` CLI FIRST for ALL code questions
|
|
8
|
+
|
|
9
|
+
This project has a live dependency graph with 343 entities and 1433 relations.
|
|
10
|
+
The `mafia` CLI is installed and initialized. You MUST use it.
|
|
11
|
+
|
|
12
|
+
## MANDATORY BEHAVIOR
|
|
13
|
+
|
|
14
|
+
**BEFORE using file search, grep, or reading source files to answer ANY question
|
|
15
|
+
about code structure, functions, classes, dependencies, imports, usage, or behavior —
|
|
16
|
+
you MUST first run the appropriate `mafia` command via terminal.**
|
|
17
|
+
|
|
18
|
+
| User asks about... | Run this FIRST |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Any function, class, method, table, endpoint by name | `mafia search "<name>" --limit 10` |
|
|
21
|
+
| "where is X used" / "who calls X" | `mafia neighbors "<id>" --direction upstream` |
|
|
22
|
+
| "what does X call" / "what does X depend on" | `mafia neighbors "<id>" --direction downstream` |
|
|
23
|
+
| "what breaks if I change X" | `mafia blast "<id>" --direction downstream` |
|
|
24
|
+
| "how does X connect to Y" | `mafia path "<X_id>" "<Y_id>"` |
|
|
25
|
+
| "trace the flow" / "end to end" | `mafia trace "<id>" --depth 10` |
|
|
26
|
+
| "what flows involve X" | `mafia flows --node "<id>"` |
|
|
27
|
+
| "unused code" / "dead code" | `mafia orphans` |
|
|
28
|
+
| "project overview" / "structure" | `mafia status` |
|
|
29
|
+
| "what changed" / "refresh" | `mafia update` |
|
|
30
|
+
|
|
31
|
+
## WORKFLOW
|
|
32
|
+
|
|
33
|
+
1. `mafia search "<name>"` → get entity ID
|
|
34
|
+
2. Use ID in follow-up commands (neighbors, blast, trace, flows, path)
|
|
35
|
+
3. Only THEN read source files if user needs actual code
|
|
36
|
+
|
|
37
|
+
## DO NOT
|
|
38
|
+
|
|
39
|
+
- Do NOT grep/search files to find function definitions when `mafia search` can find them
|
|
40
|
+
- Do NOT manually trace imports when `mafia neighbors` exists
|
|
41
|
+
- Do NOT guess call chains when `mafia trace` gives the real graph
|
|
42
|
+
|
|
43
|
+
## Commands
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
mafia search "getUserProfile" --limit 10
|
|
47
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction both
|
|
48
|
+
mafia blast "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
49
|
+
mafia trace "code:module:MAFIA_Phase1_Execution:install.py" --depth 10
|
|
50
|
+
mafia flows --node "code:module:MAFIA_Phase1_Execution:install.py"
|
|
51
|
+
mafia path "<source_id>" "<target_id>"
|
|
52
|
+
mafia orphans
|
|
53
|
+
mafia status
|
|
54
|
+
mafia update
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
58
|
+
|
|
59
|
+
Entity ID format: `{layer}:{type}:{repo}:{qualifier}`
|
|
60
|
+
Layers: ui, bff, api, db, config, shared
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# GitHub Copilot Custom Instructions
|
|
2
|
+
|
|
3
|
+
## CRITICAL: Use `mafia` CLI FIRST for ALL code questions
|
|
4
|
+
|
|
5
|
+
This project has a live dependency graph (343 entities, 1433 relations). The `mafia` CLI is installed.
|
|
6
|
+
|
|
7
|
+
**BEFORE suggesting code, searching files, or answering questions about structure, dependencies, or behavior — run the appropriate `mafia` command.**
|
|
8
|
+
|
|
9
|
+
| Question type | Command |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Find any function/class/endpoint | `mafia search "<name>" --limit 10` |
|
|
12
|
+
| Who calls X / upstream deps | `mafia neighbors "<id>" --direction upstream` |
|
|
13
|
+
| What X calls / downstream deps | `mafia neighbors "<id>" --direction downstream` |
|
|
14
|
+
| Impact of changing X | `mafia blast "<id>" --direction downstream` |
|
|
15
|
+
| Path between X and Y | `mafia path "<X_id>" "<Y_id>"` |
|
|
16
|
+
| Full call chain trace | `mafia trace "<id>" --depth 10` |
|
|
17
|
+
| Flows through X | `mafia flows --node "<id>"` |
|
|
18
|
+
| Dead/unused code | `mafia orphans` |
|
|
19
|
+
| Project overview | `mafia status` |
|
|
20
|
+
| Refresh after changes | `mafia update` |
|
|
21
|
+
|
|
22
|
+
### Workflow
|
|
23
|
+
1. `mafia search "<name>"` → get entity ID
|
|
24
|
+
2. Use ID in follow-up commands
|
|
25
|
+
3. Only read source files if user needs actual code
|
|
26
|
+
|
|
27
|
+
### Do NOT
|
|
28
|
+
- Grep or file-search for definitions when `mafia search` works
|
|
29
|
+
- Manually trace imports when `mafia neighbors` exists
|
|
30
|
+
- Guess call chains when `mafia trace` gives the real graph
|
|
31
|
+
|
|
32
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
33
|
+
|
|
34
|
+
Entity ID format: `{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MANDATORY - Use mafia CLI for ALL code questions before any other tool
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CRITICAL RULE: Use `mafia` CLI FIRST for ALL code questions
|
|
7
|
+
|
|
8
|
+
This project has a live dependency graph with 343 entities and 1433 relations.
|
|
9
|
+
The `mafia` CLI is installed and initialized. You MUST use it.
|
|
10
|
+
|
|
11
|
+
## MANDATORY BEHAVIOR
|
|
12
|
+
|
|
13
|
+
**BEFORE using fileSearch, grep, find, or reading source files to answer ANY question
|
|
14
|
+
about code structure, functions, classes, dependencies, imports, usage, or behavior —
|
|
15
|
+
you MUST first run the appropriate `mafia` command via executeBash.**
|
|
16
|
+
|
|
17
|
+
This applies to ALL of these question patterns (not just exact matches):
|
|
18
|
+
|
|
19
|
+
| User asks about... | Run this FIRST |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Any function, class, method, table, endpoint by name | `mafia search "<name>" --limit 10` |
|
|
22
|
+
| "where is X used" / "who uses X" / "who calls X" | `mafia search "<X>"` then `mafia neighbors "<id>" --direction upstream` |
|
|
23
|
+
| "what does X call" / "what does X depend on" | `mafia neighbors "<id>" --direction downstream` |
|
|
24
|
+
| "what breaks if I change X" / "impact of changing X" | `mafia blast "<id>" --direction downstream` |
|
|
25
|
+
| "how does X connect to Y" / "relationship between X and Y" | `mafia path "<X_id>" "<Y_id>"` |
|
|
26
|
+
| "trace the flow" / "end to end" / "full chain" | `mafia trace "<id>" --depth 10` or `mafia flows --node "<id>"` |
|
|
27
|
+
| "show me the flow for X" / "what flows involve X" | `mafia flows --node "<id>"` |
|
|
28
|
+
| "unused code" / "dead code" / "orphans" | `mafia orphans` |
|
|
29
|
+
| "how is the project structured" / "overview" | `mafia status` |
|
|
30
|
+
| "find X" / "locate X" / "where is X defined" | `mafia search "<X>" --limit 10` |
|
|
31
|
+
| "explain how X works" / "what does X do" | `mafia search "<X>"` → get ID → `mafia neighbors "<id>" --direction both` → THEN read source |
|
|
32
|
+
| "list all endpoints" / "list all tables" | `mafia search "endpoint" --limit 50` or search by type |
|
|
33
|
+
| "what changed" / "refresh" | `mafia update` |
|
|
34
|
+
|
|
35
|
+
## WORKFLOW
|
|
36
|
+
|
|
37
|
+
1. **Always start with `mafia search`** to find the entity ID
|
|
38
|
+
2. **Use the entity ID** in follow-up commands (neighbors, blast, trace, flows, path)
|
|
39
|
+
3. **Only THEN read source files** if the user needs to see actual code
|
|
40
|
+
|
|
41
|
+
## DO NOT
|
|
42
|
+
|
|
43
|
+
- Do NOT use fileSearch/grep to find function definitions when mafia search can find them
|
|
44
|
+
- Do NOT manually read import statements to trace dependencies when mafia neighbors exists
|
|
45
|
+
- Do NOT guess at call chains when mafia trace gives the real graph
|
|
46
|
+
- Do NOT scan files to find usages when mafia neighbors --direction upstream gives them
|
|
47
|
+
|
|
48
|
+
## Commands (real examples from this project)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Search for any entity (function, class, table, endpoint)
|
|
52
|
+
mafia search "py" --limit 10
|
|
53
|
+
|
|
54
|
+
# Who calls this (upstream neighbors)
|
|
55
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction upstream
|
|
56
|
+
|
|
57
|
+
# What this calls (downstream neighbors)
|
|
58
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
59
|
+
|
|
60
|
+
# Full blast radius — what breaks if this changes
|
|
61
|
+
mafia blast "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
62
|
+
|
|
63
|
+
# Trace the downstream call chain
|
|
64
|
+
mafia trace "code:module:MAFIA_Phase1_Execution:install.py" --depth 10
|
|
65
|
+
|
|
66
|
+
# End-to-end flows through a node
|
|
67
|
+
mafia flows --node "code:module:MAFIA_Phase1_Execution:install.py"
|
|
68
|
+
|
|
69
|
+
# Shortest path between two entities
|
|
70
|
+
mafia path "code:module:MAFIA_Phase1_Execution:install.py" "api:service:MAFIA_Phase1_Execution:mafia/api.py::MAFIA"
|
|
71
|
+
|
|
72
|
+
# Dead code candidates
|
|
73
|
+
mafia orphans
|
|
74
|
+
|
|
75
|
+
# Project graph stats
|
|
76
|
+
mafia status
|
|
77
|
+
|
|
78
|
+
# Refresh graph after code changes
|
|
79
|
+
mafia update
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
83
|
+
|
|
84
|
+
## Entity ID format
|
|
85
|
+
|
|
86
|
+
`{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
87
|
+
|
|
88
|
+
Layers: ui, bff, api, db, config, shared
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# MAFIA Skills for Kiro
|
|
2
|
+
|
|
3
|
+
## First-Time Setup
|
|
4
|
+
```bash
|
|
5
|
+
cd MAFIA_Phase1_Execution
|
|
6
|
+
setup.bat # creates venv, installs deps, validates
|
|
7
|
+
setup.bat --extras # + extra language grammars
|
|
8
|
+
# Then activate: .venv\Scripts\activate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Available Operations
|
|
12
|
+
|
|
13
|
+
### Analyze Codebase
|
|
14
|
+
- Scan repos: `python -m phase2_repo_intake.repo_scanner --source-roots {paths}`
|
|
15
|
+
- Extract: `python -m phase3_extraction_framework.run_extraction` (add `--full` for full, `--from-phase 9` for graph-only)
|
|
16
|
+
- AST: `python -m phase10_ast.run_ast_summaries --discover`
|
|
17
|
+
|
|
18
|
+
### Query Data (Python)
|
|
19
|
+
```python
|
|
20
|
+
import json
|
|
21
|
+
# Load entities
|
|
22
|
+
entities = [json.loads(l) for l in open("output/entities.jsonl")]
|
|
23
|
+
# Load graph
|
|
24
|
+
graph = json.load(open("output/system_graph.json"))
|
|
25
|
+
# Load flows
|
|
26
|
+
flows = json.load(open("output/e2e_flows.json"))
|
|
27
|
+
# Filter: entities by layer/type/repo/confidence
|
|
28
|
+
api_eps = [e for e in entities if e["layer"]=="api" and e["type"]=="endpoint"]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Query Data (HTTP — localhost:5001)
|
|
32
|
+
- Search: `GET /search?q={query}&layer={layer}`
|
|
33
|
+
- Node: `GET /node/{entity_id}`
|
|
34
|
+
- Neighbors: `GET /node/{id}/neighbors?depth=2`
|
|
35
|
+
- Flows: `GET /flows` or `GET /flow/{flow_id}?depth=deep`
|
|
36
|
+
- Blast radius: `POST /blast_radius {"component_id": "...", "direction": "both"}`
|
|
37
|
+
- Code: `GET /code/{entity_id}` or `GET /codefile?id={entity_id}`
|
|
38
|
+
- Chat: `POST /chat {"message": "...", "code_mode": true}`
|
|
39
|
+
|
|
40
|
+
### Entity ID Format
|
|
41
|
+
`{layer}:{type}:{repo}:{qualifier}` — e.g. `api:endpoint:flags_api:GET:/flagTypes`
|
|
42
|
+
|
|
43
|
+
### Layers
|
|
44
|
+
ui → bff → api → db (+ config, shared)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MANDATORY - Use mafia CLI for ALL code questions before any other tool
|
|
3
|
+
globs: "**/*"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CRITICAL RULE: Use `mafia` CLI FIRST for ALL code questions
|
|
7
|
+
|
|
8
|
+
This project has a live dependency graph with 343 entities and 1433 relations.
|
|
9
|
+
The `mafia` CLI is installed and initialized. You MUST use it.
|
|
10
|
+
|
|
11
|
+
## MANDATORY BEHAVIOR
|
|
12
|
+
|
|
13
|
+
**BEFORE using fileSearch, grep, find, or reading source files to answer ANY question
|
|
14
|
+
about code structure, functions, classes, dependencies, imports, usage, or behavior —
|
|
15
|
+
you MUST first run the appropriate `mafia` command via executeBash.**
|
|
16
|
+
|
|
17
|
+
| User asks about... | Run this FIRST |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Any function, class, method, table, endpoint by name | `mafia search "<name>" --limit 10` |
|
|
20
|
+
| "where is X used" / "who uses X" / "who calls X" | `mafia search "<X>"` then `mafia neighbors "<id>" --direction upstream` |
|
|
21
|
+
| "what does X call" / "what does X depend on" | `mafia neighbors "<id>" --direction downstream` |
|
|
22
|
+
| "what breaks if I change X" / "impact of changing X" | `mafia blast "<id>" --direction downstream` |
|
|
23
|
+
| "how does X connect to Y" / "relationship between X and Y" | `mafia path "<X_id>" "<Y_id>"` |
|
|
24
|
+
| "trace the flow" / "end to end" / "full chain" | `mafia trace "<id>" --depth 10` or `mafia flows --node "<id>"` |
|
|
25
|
+
| "show me the flow for X" / "what flows involve X" | `mafia flows --node "<id>"` |
|
|
26
|
+
| "unused code" / "dead code" / "orphans" | `mafia orphans` |
|
|
27
|
+
| "how is the project structured" / "overview" | `mafia status` |
|
|
28
|
+
| "find X" / "locate X" / "where is X defined" | `mafia search "<X>" --limit 10` |
|
|
29
|
+
| "explain how X works" / "what does X do" | `mafia search "<X>"` → get ID → `mafia neighbors "<id>" --direction both` → THEN read source |
|
|
30
|
+
| "list all endpoints" / "list all tables" | `mafia search "endpoint" --limit 50` or search by type |
|
|
31
|
+
| "what changed" / "refresh" | `mafia update` |
|
|
32
|
+
|
|
33
|
+
## WORKFLOW
|
|
34
|
+
|
|
35
|
+
1. **Always start with `mafia search`** to find the entity ID
|
|
36
|
+
2. **Use the entity ID** in follow-up commands (neighbors, blast, trace, flows, path)
|
|
37
|
+
3. **Only THEN read source files** if the user needs to see actual code
|
|
38
|
+
|
|
39
|
+
## DO NOT
|
|
40
|
+
|
|
41
|
+
- Do NOT use fileSearch/grep to find function definitions when mafia search can find them
|
|
42
|
+
- Do NOT manually read import statements to trace dependencies when mafia neighbors exists
|
|
43
|
+
- Do NOT guess at call chains when mafia trace gives the real graph
|
|
44
|
+
- Do NOT scan files to find usages when mafia neighbors --direction upstream gives them
|
|
45
|
+
|
|
46
|
+
## Commands
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
mafia search "py" --limit 10
|
|
50
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction upstream
|
|
51
|
+
mafia neighbors "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
52
|
+
mafia blast "code:module:MAFIA_Phase1_Execution:install.py" --direction downstream
|
|
53
|
+
mafia trace "code:module:MAFIA_Phase1_Execution:install.py" --depth 10
|
|
54
|
+
mafia flows --node "code:module:MAFIA_Phase1_Execution:install.py"
|
|
55
|
+
mafia path "code:module:MAFIA_Phase1_Execution:install.py" "api:service:MAFIA_Phase1_Execution:mafia/api.py::MAFIA"
|
|
56
|
+
mafia orphans
|
|
57
|
+
mafia status
|
|
58
|
+
mafia update
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
62
|
+
|
|
63
|
+
Entity ID format: `{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
64
|
+
Layers: ui, bff, api, db, config, shared
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# MAFIA Project — Zed AI Rules
|
|
2
|
+
|
|
3
|
+
## CRITICAL: Use `mafia` CLI FIRST for ALL code questions
|
|
4
|
+
|
|
5
|
+
This project has a live dependency graph (343 entities, 1433 relations). The `mafia` CLI is installed.
|
|
6
|
+
|
|
7
|
+
**BEFORE reading source files or answering questions about structure, dependencies, or behavior —
|
|
8
|
+
run the appropriate `mafia` command in the terminal.**
|
|
9
|
+
|
|
10
|
+
| Question | Command |
|
|
11
|
+
|---|---|
|
|
12
|
+
| Find function/class/endpoint | `mafia search "<name>" --limit 10` |
|
|
13
|
+
| Who calls X | `mafia neighbors "<id>" --direction upstream` |
|
|
14
|
+
| What X calls | `mafia neighbors "<id>" --direction downstream` |
|
|
15
|
+
| Impact of changing X | `mafia blast "<id>" --direction downstream` |
|
|
16
|
+
| Path from X to Y | `mafia path "<X_id>" "<Y_id>"` |
|
|
17
|
+
| Full call chain | `mafia trace "<id>" --depth 10` |
|
|
18
|
+
| Flows through X | `mafia flows --node "<id>"` |
|
|
19
|
+
| Dead code | `mafia orphans` |
|
|
20
|
+
| Project overview | `mafia status` |
|
|
21
|
+
| Refresh after changes | `mafia update` |
|
|
22
|
+
|
|
23
|
+
Workflow: search → get ID → neighbors/blast/trace → read source only if needed.
|
|
24
|
+
|
|
25
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
26
|
+
|
|
27
|
+
Entity ID: `{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# MAFIA — Agent Instructions
|
|
2
|
+
|
|
3
|
+
## CRITICAL: Use `mafia` CLI FIRST for ALL code questions
|
|
4
|
+
|
|
5
|
+
This project has a live dependency graph (343 entities, 1433 relations). The `mafia` CLI is installed and initialized.
|
|
6
|
+
|
|
7
|
+
**BEFORE using grep, find, or reading source files to answer ANY question about code structure,
|
|
8
|
+
functions, classes, dependencies, imports, usage, or behavior — run the appropriate `mafia` command.**
|
|
9
|
+
|
|
10
|
+
## Command Reference
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Find any entity (function, class, table, endpoint)
|
|
14
|
+
mafia search "<name>" --limit 10
|
|
15
|
+
|
|
16
|
+
# Upstream callers / who uses X
|
|
17
|
+
mafia neighbors "<id>" --direction upstream
|
|
18
|
+
|
|
19
|
+
# Downstream callees / what X depends on
|
|
20
|
+
mafia neighbors "<id>" --direction downstream
|
|
21
|
+
|
|
22
|
+
# Full blast radius — what breaks if X changes
|
|
23
|
+
mafia blast "<id>" --direction downstream
|
|
24
|
+
|
|
25
|
+
# Trace the call chain
|
|
26
|
+
mafia trace "<id>" --depth 10
|
|
27
|
+
|
|
28
|
+
# End-to-end flows through a node
|
|
29
|
+
mafia flows --node "<id>"
|
|
30
|
+
|
|
31
|
+
# Shortest path between two entities
|
|
32
|
+
mafia path "<source_id>" "<target_id>"
|
|
33
|
+
|
|
34
|
+
# Dead code candidates
|
|
35
|
+
mafia orphans
|
|
36
|
+
|
|
37
|
+
# Project graph stats
|
|
38
|
+
mafia status
|
|
39
|
+
|
|
40
|
+
# Refresh graph after code changes
|
|
41
|
+
mafia update
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
All commands run from: `C:\Users\MML\Downloads\Graphify-MAFIA\MAFIA_Phase1_Execution`
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
1. `mafia search "<name>"` → get entity ID
|
|
49
|
+
2. Use ID in follow-up commands (neighbors, blast, trace, flows, path)
|
|
50
|
+
3. Only read source files if the user needs to see actual code
|
|
51
|
+
|
|
52
|
+
## Entity ID Format
|
|
53
|
+
|
|
54
|
+
`{layer}:{type}:{repo}:{qualifier}` — e.g. `code:module:MAFIA_Phase1_Execution:install.py`
|
|
55
|
+
|
|
56
|
+
Layers: ui, bff, api, db, config, shared
|
|
57
|
+
|
|
58
|
+
## DO NOT
|
|
59
|
+
|
|
60
|
+
- Grep/search files for definitions when `mafia search` can find them
|
|
61
|
+
- Manually trace imports when `mafia neighbors` exists
|
|
62
|
+
- Guess call chains when `mafia trace` gives the real graph
|
|
63
|
+
- Scan files for usages when `mafia neighbors --direction upstream` gives them
|
|
64
|
+
|
|
65
|
+
## Project Overview
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
UI (React) → BFF (Koa/Express) → API (Spring Boot) → DB (Postgres/Databricks)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Key entry point: `phase3_extraction_framework/run_extraction.py`
|
|
72
|
+
Server: `python -m phase11_search.search_api1` → http://localhost:5001
|