developer-assistant 0.2.1__tar.gz → 0.3.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.
- {developer_assistant-0.2.1/developer_assistant.egg-info → developer_assistant-0.3.0}/PKG-INFO +38 -24
- developer_assistant-0.3.0/PYPI.md +102 -0
- developer_assistant-0.3.0/README.md +136 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/default/default-memory.ini +2 -1
- developer_assistant-0.3.0/da/default/test-project.ini +7 -0
- developer_assistant-0.3.0/da/interface.py +303 -0
- developer_assistant-0.3.0/da/intro.md +78 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/modules/config_manager.py +86 -62
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/modules/opener.py +2 -5
- developer_assistant-0.3.0/da/modules/projects_manager.py +267 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/modules/version_logic.py +123 -56
- {developer_assistant-0.2.1 → developer_assistant-0.3.0/developer_assistant.egg-info}/PKG-INFO +38 -24
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/pyproject.toml +2 -2
- developer_assistant-0.2.1/PYPI.md +0 -88
- developer_assistant-0.2.1/README.md +0 -121
- developer_assistant-0.2.1/da/default/test-project.ini +0 -5
- developer_assistant-0.2.1/da/interface.py +0 -241
- developer_assistant-0.2.1/da/intro.md +0 -62
- developer_assistant-0.2.1/da/modules/projects_manager.py +0 -120
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/LICENSE +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/__init__.py +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/default/default-changelog.md +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/modules/__init__.py +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/templates/changelog_template.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/templates/entry_template.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/da/templates/header_template.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/developer_assistant.egg-info/SOURCES.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/developer_assistant.egg-info/dependency_links.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/developer_assistant.egg-info/entry_points.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/developer_assistant.egg-info/requires.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/developer_assistant.egg-info/top_level.txt +0 -0
- {developer_assistant-0.2.1 → developer_assistant-0.3.0}/setup.cfg +0 -0
{developer_assistant-0.2.1/developer_assistant.egg-info → developer_assistant-0.3.0}/PKG-INFO
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: developer-assistant
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: A lightweight TUI
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A lightweight TUI app for managing and simplifying your Markdown changelogs.
|
|
5
5
|
License: The MIT License (MIT)
|
|
6
6
|
|
|
7
7
|
Copyright (c) 2026 Ivori Huobolainen
|
|
@@ -42,6 +42,10 @@ Dynamic: license-file
|
|
|
42
42
|
|
|
43
43
|
> **Tip:** Once setup is complete and you start the program, an intro with all the necessary information will be displayed for you in the terminal.
|
|
44
44
|
|
|
45
|
+
> **Linux note:**
|
|
46
|
+
> Avoid using `sudo pip install` because it installs into the system Python.
|
|
47
|
+
If you want a system‑wide install, use the uv method or use `pip install --user`
|
|
48
|
+
|
|
45
49
|
## Updating DA
|
|
46
50
|
Two possibilities, depending on how you installed.
|
|
47
51
|
|
|
@@ -52,14 +56,14 @@ B. **Using pip:** `python -m pip install -U developer-assistant`
|
|
|
52
56
|
## Introduction
|
|
53
57
|
|
|
54
58
|
### What does this tool do?
|
|
55
|
-
Developer Assistant is a lightweight TUI
|
|
59
|
+
Developer Assistant is a lightweight TUI app for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
|
|
56
60
|
|
|
57
|
-
You can
|
|
61
|
+
You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
|
|
58
62
|
|
|
59
|
-
Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only
|
|
63
|
+
Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
|
|
60
64
|
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
## Using the program.
|
|
63
67
|
1. **What *not* to do**
|
|
64
68
|
|
|
65
69
|
Don't change the folder structure or modify variable names inside `.ini` files.
|
|
@@ -68,52 +72,62 @@ Don't change the folder structure or modify variable names inside `.ini` files.
|
|
|
68
72
|
|
|
69
73
|
**The user's data (`Templates/`, `Projects/`, `memory.ini`) is stored in standard locations:**
|
|
70
74
|
|
|
71
|
-
Windows: `C:\Users\...\AppData\Roaming\da-ui\`
|
|
75
|
+
* Windows: `C:\Users\...\AppData\Roaming\da-ui\`
|
|
72
76
|
|
|
73
|
-
Linux: `~/.config/da-ui/`
|
|
77
|
+
* Linux: `~/.config/da-ui/`
|
|
74
78
|
|
|
75
|
-
macOS: `~/Library/Application Support/da-ui/`
|
|
79
|
+
* macOS: `~/Library/Application Support/da-ui/`
|
|
76
80
|
|
|
77
|
-
The `da-ui/` folder will be created automatically.
|
|
81
|
+
The `da-ui/` folder and subfolders will be created automatically.
|
|
78
82
|
|
|
79
83
|
You can access its content quickly when going to: `Main menu / Settings`
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
**Profiles for seperate projects and templates**
|
|
86
|
+
|
|
87
|
+
The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
|
|
88
|
+
|
|
89
|
+
Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
|
|
90
|
+
|
|
91
|
+
**Customizable templates**
|
|
82
92
|
|
|
83
93
|
In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
|
|
84
94
|
|
|
85
|
-
|
|
95
|
+
**Linked projects all in one place**
|
|
86
96
|
|
|
87
97
|
The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
|
|
88
98
|
|
|
89
|
-
|
|
99
|
+
**Safe changelog updates**
|
|
90
100
|
|
|
91
101
|
Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
|
|
92
|
-
New changes are first written to a temporary file and only
|
|
102
|
+
New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
|
|
103
|
+
|
|
93
104
|
This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
|
|
94
105
|
If the temporary changelog is present on startup you are prompted to remove or keep it.
|
|
95
106
|
|
|
96
|
-
|
|
107
|
+
**Ease of navigation**
|
|
97
108
|
|
|
98
109
|
You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
**Configuration**
|
|
101
112
|
|
|
102
113
|
The `memory.ini` file does exactly what you'd expect, it features:
|
|
103
114
|
|
|
104
|
-
|
|
115
|
+
* Last project
|
|
116
|
+
|
|
117
|
+
* Pinned projects
|
|
118
|
+
|
|
119
|
+
* Active profile
|
|
105
120
|
|
|
106
|
-
|
|
121
|
+
* Custom colour
|
|
107
122
|
|
|
108
|
-
|
|
123
|
+
Last project & active profile get updated automatically, the rest are up to you.
|
|
109
124
|
|
|
110
|
-
|
|
125
|
+
**`Ctrl+C` works everywhere to quickly exit DA.**
|
|
111
126
|
|
|
112
|
-
- *`Ctrl+C` works everywhere to quickly exit DA.*
|
|
113
127
|
|
|
114
|
-
### Setting up
|
|
115
|
-
For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `
|
|
128
|
+
### Setting up the test project
|
|
129
|
+
For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
|
|
116
130
|
|
|
117
|
-
|
|
131
|
+
The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
|
|
118
132
|
|
|
119
133
|
Once configured, you can create as many changelog entries as you want by picking that project in the menu.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Developer Assistant
|
|
2
|
+
|
|
3
|
+
## Installing from PyPI
|
|
4
|
+
**Using uv:**
|
|
5
|
+
`uv tool install developer-assistant`
|
|
6
|
+
|
|
7
|
+
**Using pip:**
|
|
8
|
+
`pip install developer-assistant`
|
|
9
|
+
|
|
10
|
+
**Then use `da-ui` anywhere in your terminal to run it**
|
|
11
|
+
|
|
12
|
+
> **Tip:** Once setup is complete and you start the program, an intro with all the necessary information will be displayed for you in the terminal.
|
|
13
|
+
|
|
14
|
+
> **Linux note:**
|
|
15
|
+
> Avoid using `sudo pip install` because it installs into the system Python.
|
|
16
|
+
If you want a system‑wide install, use the uv method or use `pip install --user`
|
|
17
|
+
|
|
18
|
+
## Updating DA
|
|
19
|
+
Two possibilities, depending on how you installed.
|
|
20
|
+
|
|
21
|
+
A. **Using uv:** `uv tool upgrade developer-assistant`
|
|
22
|
+
|
|
23
|
+
B. **Using pip:** `python -m pip install -U developer-assistant`
|
|
24
|
+
|
|
25
|
+
## Introduction
|
|
26
|
+
|
|
27
|
+
### What does this tool do?
|
|
28
|
+
Developer Assistant is a lightweight TUI app for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
|
|
29
|
+
|
|
30
|
+
You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
|
|
31
|
+
|
|
32
|
+
Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Using the program.
|
|
36
|
+
1. **What *not* to do**
|
|
37
|
+
|
|
38
|
+
Don't change the folder structure or modify variable names inside `.ini` files.
|
|
39
|
+
|
|
40
|
+
2. **Features and information**
|
|
41
|
+
|
|
42
|
+
**The user's data (`Templates/`, `Projects/`, `memory.ini`) is stored in standard locations:**
|
|
43
|
+
|
|
44
|
+
* Windows: `C:\Users\...\AppData\Roaming\da-ui\`
|
|
45
|
+
|
|
46
|
+
* Linux: `~/.config/da-ui/`
|
|
47
|
+
|
|
48
|
+
* macOS: `~/Library/Application Support/da-ui/`
|
|
49
|
+
|
|
50
|
+
The `da-ui/` folder and subfolders will be created automatically.
|
|
51
|
+
|
|
52
|
+
You can access its content quickly when going to: `Main menu / Settings`
|
|
53
|
+
|
|
54
|
+
**Profiles for seperate projects and templates**
|
|
55
|
+
|
|
56
|
+
The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
|
|
57
|
+
|
|
58
|
+
Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
|
|
59
|
+
|
|
60
|
+
**Customizable templates**
|
|
61
|
+
|
|
62
|
+
In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
|
|
63
|
+
|
|
64
|
+
**Linked projects all in one place**
|
|
65
|
+
|
|
66
|
+
The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
|
|
67
|
+
|
|
68
|
+
**Safe changelog updates**
|
|
69
|
+
|
|
70
|
+
Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
|
|
71
|
+
New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
|
|
72
|
+
|
|
73
|
+
This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
|
|
74
|
+
If the temporary changelog is present on startup you are prompted to remove or keep it.
|
|
75
|
+
|
|
76
|
+
**Ease of navigation**
|
|
77
|
+
|
|
78
|
+
You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
|
|
79
|
+
|
|
80
|
+
**Configuration**
|
|
81
|
+
|
|
82
|
+
The `memory.ini` file does exactly what you'd expect, it features:
|
|
83
|
+
|
|
84
|
+
* Last project
|
|
85
|
+
|
|
86
|
+
* Pinned projects
|
|
87
|
+
|
|
88
|
+
* Active profile
|
|
89
|
+
|
|
90
|
+
* Custom colour
|
|
91
|
+
|
|
92
|
+
Last project & active profile get updated automatically, the rest are up to you.
|
|
93
|
+
|
|
94
|
+
**`Ctrl+C` works everywhere to quickly exit DA.**
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Setting up the test project
|
|
98
|
+
For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
|
|
99
|
+
|
|
100
|
+
The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
|
|
101
|
+
|
|
102
|
+
Once configured, you can create as many changelog entries as you want by picking that project in the menu.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Developer Assistant
|
|
2
|
+
[](https://pypi.org/project/developer-assistant/)
|
|
3
|
+
|
|
4
|
+
> **A lightweight TUI app for managing and simplifying your Markdown changelogs.**
|
|
5
|
+
|
|
6
|
+
* **Setup:** Start with [SETUP](./SETUP.md) to get started.
|
|
7
|
+
|
|
8
|
+
* **Changes:** Yes, I keep a [CHANGELOG](./CHANGELOG.md)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
* **Requirements:** Python 3.10 or later.
|
|
13
|
+
|
|
14
|
+
* **Cross-platform:** Windows, Linux, macOS(*unverified*)
|
|
15
|
+
|
|
16
|
+
* **Specifics:** [SYSTEM STRUCTURE](./documents/SYSTEM_STRUCTURE.txt)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Appearance
|
|
20
|
+
|
|
21
|
+
### Coloured, easy-to-use menus
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
### Beautiful changelog previews
|
|
25
|
+
Preview your Markdown changelogs directly in the terminal with Rich rendering:
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Introduction
|
|
31
|
+
|
|
32
|
+
### What does this tool do?
|
|
33
|
+
Developer Assistant is a lightweight TUI for simplifying and managing your changelogs. You can customize the templates for each profile to match your existing format, and use DA as a central hub to access every changelog and project folder you maintain.
|
|
34
|
+
|
|
35
|
+
You can create as many profiles as you need. Each profile gets its own **project specific** `.ini` files, created automatically through the menu based on the information you provide. These act as links that tell DA where your changelogs are and what's the last version number.
|
|
36
|
+
|
|
37
|
+
Your files are kept safe at all times. Before adding new changes, your existing `CHANGELOG.md` is automatically backed up. While editing, all changes are written to a temporary file first and only prepended to & replaced with your real changelog once you confirm them.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Using the program.
|
|
42
|
+
1. **What *not* to do**
|
|
43
|
+
|
|
44
|
+
Don't change the folder structure or modify variable names inside `.ini` files.
|
|
45
|
+
|
|
46
|
+
2. **Features and information**
|
|
47
|
+
|
|
48
|
+
**The user's data (`Templates/`, `Projects/`, `memory.ini`) is stored in standard locations:**
|
|
49
|
+
|
|
50
|
+
* Windows: `C:\Users\...\AppData\Roaming\da-ui\`
|
|
51
|
+
|
|
52
|
+
* Linux: `~/.config/da-ui/`
|
|
53
|
+
|
|
54
|
+
* macOS: `~/Library/Application Support/da-ui/`
|
|
55
|
+
|
|
56
|
+
The `da-ui/` folder and subfolders will be created automatically.
|
|
57
|
+
|
|
58
|
+
You can access its content quickly when going to: `Main menu / Settings`
|
|
59
|
+
|
|
60
|
+
**Profiles for seperate projects and templates**
|
|
61
|
+
|
|
62
|
+
The program comes with the "Default" profile, you can choose to either stick with this one or create your own profiles in `Main menu / Profiles`. Each profile has seperate projects and they can't be accessed by other profiles. You can choose to customize the templates seperately too.
|
|
63
|
+
|
|
64
|
+
Migrating a project or template from one profile to another is currently manual, **make sure to also change the "*owner*" value in `.ini` files accordingly**.
|
|
65
|
+
|
|
66
|
+
**Customizable templates**
|
|
67
|
+
|
|
68
|
+
In the **local** `Templates/` folder you can modify the template contents to your liking - **just avoid changing the `{{placeholder}}` names**.
|
|
69
|
+
|
|
70
|
+
**Linked projects all in one place**
|
|
71
|
+
|
|
72
|
+
The `Projects/` folder holds the `.ini` files you create when starting a new project with DA.
|
|
73
|
+
|
|
74
|
+
**Safe changelog updates**
|
|
75
|
+
|
|
76
|
+
Before applying any changes, your previous `CHANGELOG.md` is automatically backed up into your project folder.
|
|
77
|
+
New changes are first written to a temporary file and only prepended to & replaced with your real changelog once you confirm them.
|
|
78
|
+
|
|
79
|
+
This ensures your existing changelog is never overwritten or corrupted, and you always have a fallback copy.
|
|
80
|
+
If the temporary changelog is present on startup you are prompted to remove or keep it.
|
|
81
|
+
|
|
82
|
+
**Ease of navigation**
|
|
83
|
+
|
|
84
|
+
You can access files/folders and configuration straight from the menus, so you shouldn't find yourself searching through the program's directory or even your local user data very often.
|
|
85
|
+
|
|
86
|
+
**Configuration**
|
|
87
|
+
|
|
88
|
+
The `memory.ini` file does exactly what you'd expect, it features:
|
|
89
|
+
|
|
90
|
+
* Last project
|
|
91
|
+
|
|
92
|
+
* Pinned projects
|
|
93
|
+
|
|
94
|
+
* Active profile
|
|
95
|
+
|
|
96
|
+
* Custom colour
|
|
97
|
+
|
|
98
|
+
Last project & active profile get updated automatically, the rest are up to you.
|
|
99
|
+
|
|
100
|
+
**`Ctrl+C` works everywhere to quickly exit DA.**
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Setting up the test project
|
|
105
|
+
For a dummy changelog to experiment with, navigate to `Main menu / Projects`, choose `test-project`, then choose option `3.` to start adjusting this projects paths. **Before setting up your own profile don't change "*Default*"**
|
|
106
|
+
|
|
107
|
+
The `test-project/` folder is included in the programs root folder **for repo clones** and is safe to experiment with. If you installed from PyPI just make a `CHANGELOG.md` anywhere and point the `.ini` file to it.
|
|
108
|
+
|
|
109
|
+
Once configured, you can create as many changelog entries as you want by picking that project in the menu.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
## Updating DA
|
|
113
|
+
Two possibilities, depending on how you installed.
|
|
114
|
+
|
|
115
|
+
### 1. Installed from PyPI
|
|
116
|
+
A. **Using uv:** `uv tool upgrade developer-assistant`
|
|
117
|
+
|
|
118
|
+
B. **Using pip:** `python -m pip install -U developer-assistant`
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### 2. Installed from a local clone
|
|
122
|
+
*Run all terminal commands in the repo folder*
|
|
123
|
+
|
|
124
|
+
A. **Using uv:**
|
|
125
|
+
|
|
126
|
+
1. `git pull`
|
|
127
|
+
2. `uv tool install .`
|
|
128
|
+
|
|
129
|
+
B. **Using pip:**
|
|
130
|
+
|
|
131
|
+
1. `git pull`
|
|
132
|
+
2. `pip install .`
|
|
133
|
+
|
|
134
|
+
C. **No install, running from repo root:**
|
|
135
|
+
|
|
136
|
+
Just `git pull`
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import os, sys
|
|
2
|
+
import time
|
|
3
|
+
import platform
|
|
4
|
+
import subprocess
|
|
5
|
+
import shutil
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from termcolor import colored
|
|
9
|
+
from rich.progress import track
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
from rich.markdown import Markdown
|
|
12
|
+
|
|
13
|
+
from da.modules.projects_manager import ProjectsManager
|
|
14
|
+
from da.modules.config_manager import ConfigManager
|
|
15
|
+
from da.modules.opener import Opener
|
|
16
|
+
from importlib import resources
|
|
17
|
+
|
|
18
|
+
class Interface:
|
|
19
|
+
def __init__(self):
|
|
20
|
+
self.version = "0.3.0"
|
|
21
|
+
self.clear = 'cls' if platform.system() == 'Windows' else 'clear'
|
|
22
|
+
|
|
23
|
+
title = f"DA - {self.version}"
|
|
24
|
+
|
|
25
|
+
if platform.system() == "Windows":
|
|
26
|
+
os.system(f'title {title}')
|
|
27
|
+
else:
|
|
28
|
+
print(f'\33]0;{title}\a', end='', flush=True)
|
|
29
|
+
|
|
30
|
+
self.config = ConfigManager('memory.ini', profile="Default")
|
|
31
|
+
|
|
32
|
+
self.memory = None
|
|
33
|
+
self.color = None
|
|
34
|
+
self.header = None
|
|
35
|
+
self.user_path = None
|
|
36
|
+
|
|
37
|
+
self.first_run = False
|
|
38
|
+
|
|
39
|
+
def run(self):
|
|
40
|
+
steps = [
|
|
41
|
+
("Initializing runtime...", self.runtime_init),
|
|
42
|
+
("Checking configuration...", self.config.data_check)
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
for label, step in track(steps):
|
|
46
|
+
os.system(self.clear)
|
|
47
|
+
print(label.center(65))
|
|
48
|
+
result = step()
|
|
49
|
+
time.sleep(0.30)
|
|
50
|
+
if isinstance(result, list):
|
|
51
|
+
for msg in result:
|
|
52
|
+
print(msg.center(65))
|
|
53
|
+
time.sleep(2)
|
|
54
|
+
|
|
55
|
+
temp_log = Path(__file__).parent / "CHANGELOG.tmp"
|
|
56
|
+
|
|
57
|
+
if os.path.exists(temp_log):
|
|
58
|
+
while True:
|
|
59
|
+
os.system(self.clear)
|
|
60
|
+
print(colored(f"Temporary changelog detected in:\n{temp_log}\n", "yellow"))
|
|
61
|
+
print(colored("D", "light_red") + "elete or " + colored("K", "light_red") + "eep?\n")
|
|
62
|
+
choice = input(f"{self.user_path}> ").lower()
|
|
63
|
+
if choice == "d":
|
|
64
|
+
os.remove(temp_log)
|
|
65
|
+
break
|
|
66
|
+
elif choice == "k":
|
|
67
|
+
break
|
|
68
|
+
else:
|
|
69
|
+
print(colored("\nPlease make a valid choice.", "light_red"))
|
|
70
|
+
time.sleep(1.5)
|
|
71
|
+
|
|
72
|
+
state = "intro" if self.first_run else "menu"
|
|
73
|
+
|
|
74
|
+
while state != "exit":
|
|
75
|
+
if state == "intro":
|
|
76
|
+
self.intro()
|
|
77
|
+
state = "menu"
|
|
78
|
+
|
|
79
|
+
elif state == "menu":
|
|
80
|
+
result = self.menu()
|
|
81
|
+
if result == "profiles":
|
|
82
|
+
self.profiles()
|
|
83
|
+
state = "menu"
|
|
84
|
+
|
|
85
|
+
elif result == "settings":
|
|
86
|
+
self.settings()
|
|
87
|
+
state = "menu"
|
|
88
|
+
|
|
89
|
+
elif result == "exit":
|
|
90
|
+
state = "exit"
|
|
91
|
+
|
|
92
|
+
def menu(self):
|
|
93
|
+
self.active_profile = self.memory.get('profile')
|
|
94
|
+
|
|
95
|
+
projects_manager = ProjectsManager(
|
|
96
|
+
config=self.config,
|
|
97
|
+
color=self.color,
|
|
98
|
+
header=self.header,
|
|
99
|
+
cls=self.clear,
|
|
100
|
+
user_path=self.user_path
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
last_project = self.memory.get('last_project')
|
|
104
|
+
while True:
|
|
105
|
+
os.system(self.clear)
|
|
106
|
+
print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu")
|
|
107
|
+
print(self.header.center(127, "="))
|
|
108
|
+
print("E. Exit\n")
|
|
109
|
+
print("Last project:")
|
|
110
|
+
print(colored(last_project, f"{self.color}"))
|
|
111
|
+
print("\n1. Projects")
|
|
112
|
+
print("2. Profiles")
|
|
113
|
+
print("3. Settings\n")
|
|
114
|
+
|
|
115
|
+
choice = input(f"{self.user_path}> ").strip()
|
|
116
|
+
|
|
117
|
+
if choice.lower() == "e":
|
|
118
|
+
os.system(self.clear)
|
|
119
|
+
print(self.header.center(127, "="))
|
|
120
|
+
print("Bye!")
|
|
121
|
+
time.sleep(1)
|
|
122
|
+
return "exit"
|
|
123
|
+
|
|
124
|
+
elif choice == "1":
|
|
125
|
+
projects_manager.projects(self.active_profile)
|
|
126
|
+
|
|
127
|
+
elif choice == "2":
|
|
128
|
+
return "profiles"
|
|
129
|
+
|
|
130
|
+
elif choice == "3":
|
|
131
|
+
return "settings"
|
|
132
|
+
else:
|
|
133
|
+
print("")
|
|
134
|
+
print(colored("Unknown option...", "light_red", attrs=["blink"]))
|
|
135
|
+
time.sleep(1)
|
|
136
|
+
|
|
137
|
+
def settings(self):
|
|
138
|
+
while True:
|
|
139
|
+
os.system(self.clear)
|
|
140
|
+
print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu / Settings")
|
|
141
|
+
print(self.header.center(127, "="))
|
|
142
|
+
print("E. Back\n")
|
|
143
|
+
|
|
144
|
+
print(colored("Configuration options", attrs=["underline"]))
|
|
145
|
+
print("1. Edit pinned projects [WIP]")
|
|
146
|
+
print("2. Change program's color [WIP]\n")
|
|
147
|
+
|
|
148
|
+
print(colored("Other options", attrs=["underline"]))
|
|
149
|
+
print("3. Open memory.ini manually")
|
|
150
|
+
print("4. Open the Projects folder")
|
|
151
|
+
print("5. Open the Templates folder\n")
|
|
152
|
+
|
|
153
|
+
choice = input(f"{self.user_path}> ").strip()
|
|
154
|
+
|
|
155
|
+
if choice.lower() == "e":
|
|
156
|
+
return
|
|
157
|
+
#elif choice == "1":
|
|
158
|
+
#pass
|
|
159
|
+
#elif choice == "2":
|
|
160
|
+
#pass
|
|
161
|
+
elif choice == "3":
|
|
162
|
+
Opener.open(self.config.memory_ini)
|
|
163
|
+
elif choice == "4":
|
|
164
|
+
Opener.open(self.config.projects_folder)
|
|
165
|
+
elif choice == "5":
|
|
166
|
+
Opener.open(self.config.templates_folder)
|
|
167
|
+
else:
|
|
168
|
+
print("")
|
|
169
|
+
print(colored("Unknown option...", "light_red", attrs=["blink"]))
|
|
170
|
+
time.sleep(1)
|
|
171
|
+
|
|
172
|
+
def profiles(self):
|
|
173
|
+
while True:
|
|
174
|
+
os.system(self.clear)
|
|
175
|
+
print(colored(f"{self.active_profile}", f"{self.color}") + " / Main menu / Profiles")
|
|
176
|
+
print(self.header.center(127, "="))
|
|
177
|
+
print("E. Back\n")
|
|
178
|
+
|
|
179
|
+
print("1. Create a new profile")
|
|
180
|
+
print("2. Switch profiles\n")
|
|
181
|
+
|
|
182
|
+
choice = input(f"{self.user_path}> ").strip()
|
|
183
|
+
|
|
184
|
+
if choice.lower() == "e":
|
|
185
|
+
return
|
|
186
|
+
elif choice == "1":
|
|
187
|
+
self.new_profile()
|
|
188
|
+
elif choice == "2":
|
|
189
|
+
self.switch_profile()
|
|
190
|
+
else:
|
|
191
|
+
print("")
|
|
192
|
+
print(colored("Unknown option...", "light_red", attrs=["blink"]))
|
|
193
|
+
time.sleep(1)
|
|
194
|
+
|
|
195
|
+
def switch_profile(self):
|
|
196
|
+
while True:
|
|
197
|
+
prof_dir = self.config.profile_dir
|
|
198
|
+
contents = os.listdir(prof_dir)
|
|
199
|
+
|
|
200
|
+
print("\nYour profiles:")
|
|
201
|
+
for item in contents:
|
|
202
|
+
print(colored(f" - {item}", f"{self.color}"))
|
|
203
|
+
|
|
204
|
+
name = input("\nProfile name > ").strip()
|
|
205
|
+
|
|
206
|
+
if name in contents:
|
|
207
|
+
self.config.update_memory("CONFIG", "profile", name)
|
|
208
|
+
|
|
209
|
+
self.memory = self.config.load_memory()
|
|
210
|
+
|
|
211
|
+
profile = self.memory.get('profile')
|
|
212
|
+
self.config = ConfigManager("memory.ini", profile=profile)
|
|
213
|
+
|
|
214
|
+
self.memory = self.config.load_memory()
|
|
215
|
+
self.active_profile = self.memory.get('profile')
|
|
216
|
+
return
|
|
217
|
+
else:
|
|
218
|
+
print(colored("\nInvalid name!", "yellow"))
|
|
219
|
+
time.sleep(1)
|
|
220
|
+
os.system(self.clear)
|
|
221
|
+
|
|
222
|
+
def new_profile(self):
|
|
223
|
+
name = input("\nNew profile name > ").strip()
|
|
224
|
+
|
|
225
|
+
profile_dir = self.config.profile_dir / name
|
|
226
|
+
profile_dir.mkdir(parents=True, exist_ok=True)
|
|
227
|
+
|
|
228
|
+
(profile_dir / "Projects").mkdir(exist_ok=True)
|
|
229
|
+
(profile_dir / "Templates").mkdir(exist_ok=True)
|
|
230
|
+
|
|
231
|
+
default_templates = resources.files("da.templates")
|
|
232
|
+
for item in default_templates.iterdir():
|
|
233
|
+
dest = profile_dir / "Templates"
|
|
234
|
+
shutil.copy(item, dest)
|
|
235
|
+
|
|
236
|
+
self.config.update_memory("CONFIG", "profile", name)
|
|
237
|
+
|
|
238
|
+
self.memory = self.config.load_memory()
|
|
239
|
+
|
|
240
|
+
profile = self.memory.get('profile')
|
|
241
|
+
self.config = ConfigManager("memory.ini", profile=profile)
|
|
242
|
+
|
|
243
|
+
self.memory = self.config.load_memory()
|
|
244
|
+
self.active_profile = self.memory.get('profile')
|
|
245
|
+
return
|
|
246
|
+
|
|
247
|
+
def runtime_init(self):
|
|
248
|
+
if not self.config.memory_ini.exists():
|
|
249
|
+
self.local_init()
|
|
250
|
+
self.first_run = True
|
|
251
|
+
|
|
252
|
+
self.memory = self.config.load_memory()
|
|
253
|
+
active_profile = self.memory.get("profile") or "Default"
|
|
254
|
+
|
|
255
|
+
self.config = ConfigManager("memory.ini", profile=active_profile)
|
|
256
|
+
self.memory = self.config.load_memory()
|
|
257
|
+
|
|
258
|
+
self.color = self.memory.get('color') or "light_blue"
|
|
259
|
+
self.header = (colored(" Developer Assistant ", f"{self.color}"))
|
|
260
|
+
self.user_path = os.environ.get('USERPROFILE') or os.environ.get('HOME', 'User')
|
|
261
|
+
|
|
262
|
+
def local_init(self):
|
|
263
|
+
default_files = resources.files("da.default")
|
|
264
|
+
dest = self.config.memory_ini
|
|
265
|
+
|
|
266
|
+
for item in default_files.iterdir():
|
|
267
|
+
if item.name == "default-memory.ini":
|
|
268
|
+
shutil.copy(item, dest)
|
|
269
|
+
|
|
270
|
+
self.config.projects_folder.mkdir(parents=True, exist_ok=True)
|
|
271
|
+
# Add Test-Project
|
|
272
|
+
dest = self.config.projects_folder
|
|
273
|
+
for item in default_files.iterdir():
|
|
274
|
+
if item.name == "test-project.ini":
|
|
275
|
+
shutil.copy(item, dest)
|
|
276
|
+
|
|
277
|
+
def intro(self):
|
|
278
|
+
os.system(self.clear)
|
|
279
|
+
print(colored("Welcome to the Developer Assistant\n", f"{self.color}", attrs=["bold"]))
|
|
280
|
+
print("Here's everything you need to get started...\n")
|
|
281
|
+
|
|
282
|
+
time.sleep(2)
|
|
283
|
+
|
|
284
|
+
readme_content = resources.files("da").joinpath("intro.md").read_text()
|
|
285
|
+
|
|
286
|
+
MARKDOWN = readme_content
|
|
287
|
+
console = Console()
|
|
288
|
+
md = Markdown(MARKDOWN)
|
|
289
|
+
console.print(md)
|
|
290
|
+
|
|
291
|
+
input("\nContinue..." + colored("[Enter]", f"{self.color}"))
|
|
292
|
+
|
|
293
|
+
def main():
|
|
294
|
+
try:
|
|
295
|
+
app = Interface()
|
|
296
|
+
app.run()
|
|
297
|
+
except KeyboardInterrupt:
|
|
298
|
+
print("\n\n" + colored("Execution interrupted. Exiting...", "cyan", attrs=["bold"]))
|
|
299
|
+
time.sleep(1)
|
|
300
|
+
sys.exit(0)
|
|
301
|
+
|
|
302
|
+
if __name__ == "__main__":
|
|
303
|
+
main()
|