Problem
CLI has placeholder commands for managing analyzed packages, but they're not implemented. Users can analyze code but can't:
- List what packages are stored
- View package details/statistics
- Export graph data
- Delete packages from database
Current State
mapper analyse list # Shows "Not implemented yet"
mapper analyse get my-pkg # Shows "Not implemented yet"
mapper analyse export my-pkg # Shows "Not implemented yet"
mapper analyse delete my-pkg # Shows "Not implemented yet"
Required Commands
mapper analyse list
List all analyzed packages in database.
Options:
--detailed - Show full stats (node counts, relationships, timestamps)
--json - Output as JSON
Output:
Analyzed Packages:
my-app 50 modules, 200 classes, 500 functions 2026-03-26
utils 10 modules, 30 classes, 100 functions 2026-03-25
service 25 modules, 120 classes, 300 functions 2026-03-24
mapper analyse get <package>
Show detailed package statistics.
Options:
--depth N - Max depth for relationship traversal (default: 3)
--stats-only - Show only statistics, no graph details
Output:
Package: my-app
Analyzed: 2026-03-26 14:30:00
Nodes:
Modules: 50
Classes: 200
Functions: 500
Methods: 1200
Relationships:
DEFINES: 750
CONTAINS: 1200
CALLS: 3500
IMPORTS: 200
INHERITS: 50
Most Connected:
utils.helpers.format_data (45 incoming calls)
models.Base (30 child classes)
mapper analyse export <package>
Export graph data in various formats.
Options:
--format <fmt> - Export format: json, cypher, graphml, dot, csv (default: json)
--output <path> - Output file path (default: stdout)
--only <type> - Export only nodes or relationships
--node-type <type> - Filter by node type (Module, Class, Function, Method)
--relationship-type <type> - Filter by relationship type
--pretty - Pretty-print output
Formats:
JSON:
{
"nodes": [
{"id": "...", "label": "Class", "properties": {...}},
...
],
"relationships": [
{"from": "...", "to": "...", "type": "CALLS"},
...
]
}
Cypher (for importing into another Neo4j instance):
CREATE (n1:Module {name: "main", fqn: "main", ...});
CREATE (n2:Class {name: "App", fqn: "main.App", ...});
CREATE (n1)-[:DEFINES]->(n2);
...
GraphML (standard graph format):
<graphml>
<node id="n1"><data key="label">Class</data>...</node>
<edge source="n1" target="n2" label="INHERITS"/>
</graphml>
DOT (Graphviz format for visualization):
digraph G {
n1 [label="MyClass"];
n2 [label="BaseClass"];
n1 -> n2 [label="INHERITS"];
}
CSV (two files: nodes.csv and relationships.csv):
id,label,name,fqn,package
n1,Class,MyClass,module.MyClass,my-app
mapper analyse delete <package>
Delete a package from the database.
Options:
--force - Skip confirmation prompt
--dry-run - Show what would be deleted without deleting
Output:
Deleting package: my-app
Nodes to delete:
50 Modules
200 Classes
500 Functions
1200 Methods
Total: 1950 nodes, 5700 relationships
Are you sure? [y/N]: y
Deleted 1950 nodes and 5700 relationships
Implementation Notes
Query Patterns
List packages:
MATCH (n)
RETURN DISTINCT n.package, count(n) as nodes
ORDER BY n.package
Get package stats:
MATCH (n {package: $package})
RETURN labels(n)[0] as type, count(*) as count
Count relationships:
MATCH (a {package: $package})-[r]-(b)
RETURN type(r) as rel_type, count(r) as count
Delete package:
MATCH (n {package: $package})
DETACH DELETE n
RETURN count(n) as deleted
Export Implementation
- Use
Neo4jConnection.driver.session() to query data
- Stream results for large exports
- Format conversion in separate modules (exporters/)
- Progress bar for large datasets
Acceptance Criteria
Related
- Required for production usage
- Mentioned in ROADMAP.md lines 89-93
- Enables package management workflow
- Export enables data portability
Priority
MEDIUM - Needed for production but not blocking analysis workflow.
Problem
CLI has placeholder commands for managing analyzed packages, but they're not implemented. Users can analyze code but can't:
Current State
Required Commands
mapper analyse listList all analyzed packages in database.
Options:
--detailed- Show full stats (node counts, relationships, timestamps)--json- Output as JSONOutput:
mapper analyse get <package>Show detailed package statistics.
Options:
--depth N- Max depth for relationship traversal (default: 3)--stats-only- Show only statistics, no graph detailsOutput:
mapper analyse export <package>Export graph data in various formats.
Options:
--format <fmt>- Export format:json,cypher,graphml,dot,csv(default: json)--output <path>- Output file path (default: stdout)--only <type>- Export onlynodesorrelationships--node-type <type>- Filter by node type (Module, Class, Function, Method)--relationship-type <type>- Filter by relationship type--pretty- Pretty-print outputFormats:
JSON:
{ "nodes": [ {"id": "...", "label": "Class", "properties": {...}}, ... ], "relationships": [ {"from": "...", "to": "...", "type": "CALLS"}, ... ] }Cypher (for importing into another Neo4j instance):
GraphML (standard graph format):
DOT (Graphviz format for visualization):
CSV (two files: nodes.csv and relationships.csv):
mapper analyse delete <package>Delete a package from the database.
Options:
--force- Skip confirmation prompt--dry-run- Show what would be deleted without deletingOutput:
Implementation Notes
Query Patterns
List packages:
Get package stats:
Count relationships:
Delete package:
Export Implementation
Neo4jConnection.driver.session()to query dataAcceptance Criteria
mapper analyse listshows all packagesmapper analyse get <pkg>shows package detailsmapper analyse export <pkg>exports to all formatsmapper analyse delete <pkg>removes package safely--jsonoutput for scriptingRelated
Priority
MEDIUM - Needed for production but not blocking analysis workflow.