Skip to content

(feat): Return consistent json object for repository tree instead of plain ascii tree #418

@ix-56h

Description

@ix-56h

Feature summary

Return a json object describing the repository file tree instead of the current ascii style tree

Problem / motivation

This is needed for better handling in frontend, better usage for package users.

This is mandatory for #112 , #302 , #368 and #414 (and any other features that are patterns/tree related).

Proposed solution

Instead of :

Directory structure:
└── coderamp-labs-gitingest/
    └── src/
        └── gitingest/
            └── schemas/
                ├── __init__.py
                ├── filesystem.py
                └── ingestion.py

Return a simple json object :

{
    "tree": [
        {
            "contents": [
                {
                    "name": "__init__.py",
                    "type": "file"
                },
                {
                    "contents": [
                        {
                            "name": "__init__.cpython-310.pyc",
                            "type": "file"
                        },
                        {
                            "name": "filesystem.cpython-310.pyc",
                            "type": "file"
                        },
                        {
                            "name": "ingestion.cpython-310.pyc",
                            "type": "file"
                        }
                    ],
                    "name": "__pycache__",
                    "type": "directory"
                },
                {
                    "name": "filesystem.py",
                    "type": "file"
                },
                {
                    "name": "ingestion.py",
                    "type": "file"
                }
            ],
            "name": "schemas",
            "type": "directory"
        },
        {
            "directories": 1,
            "files": 6,
            "type": "report"
        }
    ]
}

Alternatives considered

No response

Which interface would this affect?

package, front and back

How important is this to you?

high priority

Would you like to work on this feature yourself?

Yes

Would you need support from the maintainers (if you're implementing it yourself)?

Idk

Additional context, screenshots, or examples

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions