odooflow-cli 0.1.0__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.
- odooflow_cli-0.3.0/PKG-INFO +290 -0
- odooflow_cli-0.3.0/README.md +257 -0
- odooflow_cli-0.3.0/odooflow/__init__.py +1 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/cli.py +16 -4
- odooflow_cli-0.3.0/odooflow/commands/clone_module.py +273 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/commands/config.py +38 -10
- odooflow_cli-0.3.0/odooflow/commands/gitlab.py +84 -0
- odooflow_cli-0.3.0/odooflow/commands/init_module_env.py +80 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/commands/push.py +21 -4
- odooflow_cli-0.3.0/odooflow/commands/remote.py +238 -0
- odooflow_cli-0.3.0/odooflow/commands/server.py +559 -0
- odooflow_cli-0.3.0/odooflow/commands/setup.py +131 -0
- odooflow_cli-0.3.0/odooflow/config_manager.py +198 -0
- odooflow_cli-0.3.0/odooflow/errors.py +308 -0
- odooflow_cli-0.3.0/odooflow/utils/env.py +80 -0
- odooflow_cli-0.3.0/odooflow/utils/server_profile.py +319 -0
- odooflow_cli-0.3.0/odooflow_cli.egg-info/PKG-INFO +290 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow_cli.egg-info/SOURCES.txt +9 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/pyproject.toml +1 -1
- odooflow_cli-0.3.0/tests/test_clone_module.py +219 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_commands_init_module_env.py +3 -3
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_commands_remote.py +4 -2
- odooflow_cli-0.3.0/tests/test_commands_server.py +504 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_config_manager.py +61 -13
- odooflow_cli-0.3.0/tests/test_gitlab.py +110 -0
- odooflow_cli-0.3.0/tests/test_server_profile.py +339 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_utils_env.py +21 -21
- odooflow_cli-0.1.0/PKG-INFO +0 -174
- odooflow_cli-0.1.0/README.md +0 -141
- odooflow_cli-0.1.0/odooflow/__init__.py +0 -1
- odooflow_cli-0.1.0/odooflow/commands/clone_module.py +0 -160
- odooflow_cli-0.1.0/odooflow/commands/init_module_env.py +0 -37
- odooflow_cli-0.1.0/odooflow/commands/remote.py +0 -133
- odooflow_cli-0.1.0/odooflow/config_manager.py +0 -56
- odooflow_cli-0.1.0/odooflow/utils/env.py +0 -40
- odooflow_cli-0.1.0/odooflow_cli.egg-info/PKG-INFO +0 -174
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/LICENSE +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/commands/__init__.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/commands/keygen.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/commands/sync_env.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow/utils/ssh.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow_cli.egg-info/dependency_links.txt +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow_cli.egg-info/entry_points.txt +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow_cli.egg-info/requires.txt +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/odooflow_cli.egg-info/top_level.txt +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/setup.cfg +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/__init__.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_commands_config.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_commands_keygen.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_commands_sync_env.py +0 -0
- {odooflow_cli-0.1.0 → odooflow_cli-0.3.0}/tests/test_utils_ssh.py +0 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: odooflow-cli
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: OdooFlow CLI - streamline your Odoo development workflow
|
|
5
|
+
Author: Mohammad A. Hamdan
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/anomalyco/odooflow
|
|
8
|
+
Project-URL: Repository, https://github.com/anomalyco/odooflow
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: typer[all]
|
|
19
|
+
Requires-Dist: rich
|
|
20
|
+
Requires-Dist: GitPython>=3.1.44
|
|
21
|
+
Requires-Dist: requests>=2.32.3
|
|
22
|
+
Requires-Dist: paramiko>=3.5.1
|
|
23
|
+
Requires-Dist: tqdm>=4.67.1
|
|
24
|
+
Requires-Dist: bcrypt>=4.3.0
|
|
25
|
+
Requires-Dist: cryptography>=45.0.3
|
|
26
|
+
Requires-Dist: PyNaCl>=1.5.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: build>=1.2.2; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# 🌀 Odooflow CLI
|
|
35
|
+
|
|
36
|
+
**OdooFlow CLI** is a command-line interface tool designed to streamline the development workflow for Odoo projects. It helps clone Odoo modules (and their dependencies), handles GitLab lookups, and provides bounded recursive cloning via a configurable depth.
|
|
37
|
+
|
|
38
|
+
## 🚀 Features
|
|
39
|
+
|
|
40
|
+
- Clone an Odoo module by Git URL
|
|
41
|
+
- Recursively resolve and clone dependencies up to a configurable depth
|
|
42
|
+
- Smart skip of Odoo core modules
|
|
43
|
+
- Branch selection for cloning
|
|
44
|
+
- Post-push command execution on the remote server
|
|
45
|
+
- **Named server profiles** (staging/QA/prod) with first-class `odooflow server list|add|show|use|remove|test`
|
|
46
|
+
- Built-in SSH key generation
|
|
47
|
+
- Helpful and colorful CLI output
|
|
48
|
+
- Built using [Typer](https://typer.tiangolo.com/) and Python 3.7+
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📦 Installation & first-run setup
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/anomalyco/odooflow-cli.git
|
|
56
|
+
cd odooflow-cli
|
|
57
|
+
pip install .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or install directly from source for development (with test/lint extras):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install -e .[dev]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Install from PyPI (once published):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install odooflow-cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### First-run wizard
|
|
73
|
+
|
|
74
|
+
After installing, configure odooflow with your GitLab access token:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
odooflow setup
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The wizard writes `~/.odooflowrc` (with `chmod 600` permissions), prompting for:
|
|
81
|
+
|
|
82
|
+
1. **GitLab access token** — kept private in the rc file; typed input is masked.
|
|
83
|
+
2. **GitLab URL** — defaults to the bundled one, override for self-hosted.
|
|
84
|
+
3. **Core modules** — comma-separated list, used to skip framework deps.
|
|
85
|
+
|
|
86
|
+
If you don't have a token yet, create one at *GitLab → Preferences → Access Tokens* with scopes `api`, `read_api`, and `write_repository`.
|
|
87
|
+
|
|
88
|
+
Prefer environment variables? You can skip the rc entirely:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
export ODOOFLOW_ACCESS_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
|
|
92
|
+
odooflow clone <your-module-url>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🛠️ Usage
|
|
98
|
+
|
|
99
|
+
Once installed, you can use the CLI by running:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
odooflow --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Available Commands:
|
|
106
|
+
|
|
107
|
+
- **`setup`**: Interactive wizard for first-run configuration (`~/.odooflowrc`).
|
|
108
|
+
- **`init`**: Initialize the Odoo module environment file and sync metadata with manifest
|
|
109
|
+
- **`sync-env`**: Sync the environment file from manifest
|
|
110
|
+
- **`config`**: Update or show OdooFlow CLI configuration
|
|
111
|
+
- **`clone`**: Clone a module and its dependencies from a git repository
|
|
112
|
+
- **`remote`**: Manage remote connections for Git and deployment server
|
|
113
|
+
- **`server`**: Manage named server profiles (staging/QA/prod) — `list`, `add`, `show`, `use`, `remove`, `test`
|
|
114
|
+
- **`ssh-keygen`**: Generate a secure SSH key pair
|
|
115
|
+
- **`push`**: Push the current Git branch and upload the project to the test server
|
|
116
|
+
|
|
117
|
+
### Clone Command Options:
|
|
118
|
+
|
|
119
|
+
| Flag | Description |
|
|
120
|
+
|----------------|--------------------------------------------------------------------------------------------------------|
|
|
121
|
+
| `--url` | Full HTTP URL of the module repo |
|
|
122
|
+
| `--branch`/`-b`| (Optional) Git branch to clone from |
|
|
123
|
+
| `--depth`/`-d` | Max dependency depth to clone. `1` clones only the target module, `2` clones target + immediate deps, etc. (default: `1`) |
|
|
124
|
+
|
|
125
|
+
### Push Command Options:
|
|
126
|
+
|
|
127
|
+
| Flag | Description |
|
|
128
|
+
|-----------------|----------------------------------------------------------------------------------------------------------|
|
|
129
|
+
| `--server`/`-s` | Named server profile from `odooflow server list` (defaults to the configured default). |
|
|
130
|
+
| `--remote-only` | Skip Git push and only upload to server |
|
|
131
|
+
| `--exec` | Custom shell command to execute on the server after pushing |
|
|
132
|
+
|
|
133
|
+
### Server Profile Commands:
|
|
134
|
+
|
|
135
|
+
| Command | What it does |
|
|
136
|
+
|--------------------------------------|-------------------------------------------------------|
|
|
137
|
+
| `odooflow server list` | Tabular view of every configured profile. |
|
|
138
|
+
| `odooflow server list --json` | Machine-readable output (passwords omitted). |
|
|
139
|
+
| `odooflow server add <name>` | Interactive wizard (or `--host`, `--user`, `--key-path` for non-interactive). Validates inputs and tests SSH on save. |
|
|
140
|
+
| `odooflow server show [<name>]` | Show fields of a profile. Default = the current default. Passwords are masked unless `--reveal-password`. |
|
|
141
|
+
| `odooflow server use <name>` | Set the default profile used by `odooflow push`. |
|
|
142
|
+
| `odooflow server remove <name>` | Delete a profile (the default reverts to another if any are left). |
|
|
143
|
+
| `odooflow server test [<name>]` | Verify TCP reachability, SSH auth, and directory existence without uploading anything. |
|
|
144
|
+
|
|
145
|
+
### 🔍 Examples:
|
|
146
|
+
|
|
147
|
+
Clone a single module:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Clone with specific branch:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --branch 17.0
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Clone target + immediate dependencies (depth 2):
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --depth 2
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Clone the full dependency tree (depth 5):
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --depth 5
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Push current branch to Git and upload to the configured server:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
odooflow push
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Push and execute a custom command on the remote server after upload:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
odooflow push --exec "sudo systemctl restart odoo"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Skip Git push, only upload to server:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
odooflow push --remote-only
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Push to a specific server (when you have several profiles):
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
odooflow push --server staging
|
|
193
|
+
odooflow push --server prod --remote-only --exec 'sudo systemctl restart odoo-prod'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 📡 Server profiles — a faster flow for `staging` / `qa` / `prod`
|
|
197
|
+
|
|
198
|
+
Add as many named profiles as you want. The first one you create is the default for `odooflow push`:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Interactive wizard — validates every field and tests SSH before saving.
|
|
202
|
+
odooflow server add staging
|
|
203
|
+
|
|
204
|
+
# Non-interactive / scriptable:
|
|
205
|
+
odooflow server add qa \
|
|
206
|
+
--host 10.0.0.5 --port 22 --user deploy \
|
|
207
|
+
--directory /opt/odoo/qa --key-path ~/.ssh/odooflow_rsa
|
|
208
|
+
|
|
209
|
+
# Review what you have:
|
|
210
|
+
odooflow server list
|
|
211
|
+
odooflow server show staging # password is masked; --reveal-password to see it
|
|
212
|
+
|
|
213
|
+
# Switch the default:
|
|
214
|
+
odooflow server use prod
|
|
215
|
+
|
|
216
|
+
# Verify connectivity without uploading:
|
|
217
|
+
odooflow server test staging
|
|
218
|
+
|
|
219
|
+
# Reorder / remove:
|
|
220
|
+
odooflow server remove qa
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Existing single-server configs are auto-migrated into a `default` profile on first `odooflow server add`, so nothing you've already configured is lost.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 📁 Project Structure
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
odooflow/
|
|
231
|
+
├── odooflow/
|
|
232
|
+
│ ├── __init__.py
|
|
233
|
+
│ ├── cli.py
|
|
234
|
+
│ ├── config_manager.py
|
|
235
|
+
│ ├── commands/
|
|
236
|
+
│ │ ├── __init__.py
|
|
237
|
+
│ │ ├── clone_module.py
|
|
238
|
+
│ │ ├── config.py
|
|
239
|
+
│ │ ├── init_module_env.py
|
|
240
|
+
│ │ ├── keygen.py
|
|
241
|
+
│ │ ├── push.py
|
|
242
|
+
│ │ ├── remote.py
|
|
243
|
+
│ │ ├── server.py
|
|
244
|
+
│ │ └── sync_env.py
|
|
245
|
+
│ └── utils/
|
|
246
|
+
│ ├── env.py
|
|
247
|
+
│ ├── server_profile.py
|
|
248
|
+
│ └── ssh.py
|
|
249
|
+
├── tests/
|
|
250
|
+
├── README.md
|
|
251
|
+
├── requirements.txt
|
|
252
|
+
├── pyproject.toml
|
|
253
|
+
└── LICENSE
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 🤝 Contributing
|
|
259
|
+
|
|
260
|
+
Contributions are welcome! Please open an issue or submit a pull request with any improvements, bug fixes, or new features.
|
|
261
|
+
|
|
262
|
+
1. Fork the repository
|
|
263
|
+
2. Create a new branch (`git checkout -b feature/your-feature`)
|
|
264
|
+
3. Commit your changes (`git commit -am 'Add new feature'`)
|
|
265
|
+
4. Push to the branch (`git push origin feature/your-feature`)
|
|
266
|
+
5. Open a Pull Request
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 📝 License
|
|
271
|
+
|
|
272
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## WISH-LIST:
|
|
277
|
+
|
|
278
|
+
Move this CLI into fully-integrated Odoo environment, using Odoo, users can create issues, add the amount of details, then sync these issues with Odooflow.
|
|
279
|
+
|
|
280
|
+
We can do integration with any code agent to help developers to achieve these issues
|
|
281
|
+
|
|
282
|
+
same thing for pipelines, I think it will be amazing if developers can build pipelines using Odoo, then apply the same pipelines using Odooflow.
|
|
283
|
+
|
|
284
|
+
I have many things in my head, I will back soon to this project.
|
|
285
|
+
|
|
286
|
+
## 👨💻 Author
|
|
287
|
+
|
|
288
|
+
Made with ❤️ by Mohammad A. Hamdan
|
|
289
|
+
|
|
290
|
+
---
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# 🌀 Odooflow CLI
|
|
2
|
+
|
|
3
|
+
**OdooFlow CLI** is a command-line interface tool designed to streamline the development workflow for Odoo projects. It helps clone Odoo modules (and their dependencies), handles GitLab lookups, and provides bounded recursive cloning via a configurable depth.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- Clone an Odoo module by Git URL
|
|
8
|
+
- Recursively resolve and clone dependencies up to a configurable depth
|
|
9
|
+
- Smart skip of Odoo core modules
|
|
10
|
+
- Branch selection for cloning
|
|
11
|
+
- Post-push command execution on the remote server
|
|
12
|
+
- **Named server profiles** (staging/QA/prod) with first-class `odooflow server list|add|show|use|remove|test`
|
|
13
|
+
- Built-in SSH key generation
|
|
14
|
+
- Helpful and colorful CLI output
|
|
15
|
+
- Built using [Typer](https://typer.tiangolo.com/) and Python 3.7+
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Installation & first-run setup
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/anomalyco/odooflow-cli.git
|
|
23
|
+
cd odooflow-cli
|
|
24
|
+
pip install .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or install directly from source for development (with test/lint extras):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install -e .[dev]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Install from PyPI (once published):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install odooflow-cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### First-run wizard
|
|
40
|
+
|
|
41
|
+
After installing, configure odooflow with your GitLab access token:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
odooflow setup
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The wizard writes `~/.odooflowrc` (with `chmod 600` permissions), prompting for:
|
|
48
|
+
|
|
49
|
+
1. **GitLab access token** — kept private in the rc file; typed input is masked.
|
|
50
|
+
2. **GitLab URL** — defaults to the bundled one, override for self-hosted.
|
|
51
|
+
3. **Core modules** — comma-separated list, used to skip framework deps.
|
|
52
|
+
|
|
53
|
+
If you don't have a token yet, create one at *GitLab → Preferences → Access Tokens* with scopes `api`, `read_api`, and `write_repository`.
|
|
54
|
+
|
|
55
|
+
Prefer environment variables? You can skip the rc entirely:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
export ODOOFLOW_ACCESS_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
|
|
59
|
+
odooflow clone <your-module-url>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🛠️ Usage
|
|
65
|
+
|
|
66
|
+
Once installed, you can use the CLI by running:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
odooflow --help
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Available Commands:
|
|
73
|
+
|
|
74
|
+
- **`setup`**: Interactive wizard for first-run configuration (`~/.odooflowrc`).
|
|
75
|
+
- **`init`**: Initialize the Odoo module environment file and sync metadata with manifest
|
|
76
|
+
- **`sync-env`**: Sync the environment file from manifest
|
|
77
|
+
- **`config`**: Update or show OdooFlow CLI configuration
|
|
78
|
+
- **`clone`**: Clone a module and its dependencies from a git repository
|
|
79
|
+
- **`remote`**: Manage remote connections for Git and deployment server
|
|
80
|
+
- **`server`**: Manage named server profiles (staging/QA/prod) — `list`, `add`, `show`, `use`, `remove`, `test`
|
|
81
|
+
- **`ssh-keygen`**: Generate a secure SSH key pair
|
|
82
|
+
- **`push`**: Push the current Git branch and upload the project to the test server
|
|
83
|
+
|
|
84
|
+
### Clone Command Options:
|
|
85
|
+
|
|
86
|
+
| Flag | Description |
|
|
87
|
+
|----------------|--------------------------------------------------------------------------------------------------------|
|
|
88
|
+
| `--url` | Full HTTP URL of the module repo |
|
|
89
|
+
| `--branch`/`-b`| (Optional) Git branch to clone from |
|
|
90
|
+
| `--depth`/`-d` | Max dependency depth to clone. `1` clones only the target module, `2` clones target + immediate deps, etc. (default: `1`) |
|
|
91
|
+
|
|
92
|
+
### Push Command Options:
|
|
93
|
+
|
|
94
|
+
| Flag | Description |
|
|
95
|
+
|-----------------|----------------------------------------------------------------------------------------------------------|
|
|
96
|
+
| `--server`/`-s` | Named server profile from `odooflow server list` (defaults to the configured default). |
|
|
97
|
+
| `--remote-only` | Skip Git push and only upload to server |
|
|
98
|
+
| `--exec` | Custom shell command to execute on the server after pushing |
|
|
99
|
+
|
|
100
|
+
### Server Profile Commands:
|
|
101
|
+
|
|
102
|
+
| Command | What it does |
|
|
103
|
+
|--------------------------------------|-------------------------------------------------------|
|
|
104
|
+
| `odooflow server list` | Tabular view of every configured profile. |
|
|
105
|
+
| `odooflow server list --json` | Machine-readable output (passwords omitted). |
|
|
106
|
+
| `odooflow server add <name>` | Interactive wizard (or `--host`, `--user`, `--key-path` for non-interactive). Validates inputs and tests SSH on save. |
|
|
107
|
+
| `odooflow server show [<name>]` | Show fields of a profile. Default = the current default. Passwords are masked unless `--reveal-password`. |
|
|
108
|
+
| `odooflow server use <name>` | Set the default profile used by `odooflow push`. |
|
|
109
|
+
| `odooflow server remove <name>` | Delete a profile (the default reverts to another if any are left). |
|
|
110
|
+
| `odooflow server test [<name>]` | Verify TCP reachability, SSH auth, and directory existence without uploading anything. |
|
|
111
|
+
|
|
112
|
+
### 🔍 Examples:
|
|
113
|
+
|
|
114
|
+
Clone a single module:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Clone with specific branch:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --branch 17.0
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Clone target + immediate dependencies (depth 2):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --depth 2
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Clone the full dependency tree (depth 5):
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
odooflow clone --url https://gitlab.com/mygroup/my_odoo_module.git --depth 5
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Push current branch to Git and upload to the configured server:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
odooflow push
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Push and execute a custom command on the remote server after upload:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
odooflow push --exec "sudo systemctl restart odoo"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Skip Git push, only upload to server:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
odooflow push --remote-only
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Push to a specific server (when you have several profiles):
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
odooflow push --server staging
|
|
160
|
+
odooflow push --server prod --remote-only --exec 'sudo systemctl restart odoo-prod'
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 📡 Server profiles — a faster flow for `staging` / `qa` / `prod`
|
|
164
|
+
|
|
165
|
+
Add as many named profiles as you want. The first one you create is the default for `odooflow push`:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Interactive wizard — validates every field and tests SSH before saving.
|
|
169
|
+
odooflow server add staging
|
|
170
|
+
|
|
171
|
+
# Non-interactive / scriptable:
|
|
172
|
+
odooflow server add qa \
|
|
173
|
+
--host 10.0.0.5 --port 22 --user deploy \
|
|
174
|
+
--directory /opt/odoo/qa --key-path ~/.ssh/odooflow_rsa
|
|
175
|
+
|
|
176
|
+
# Review what you have:
|
|
177
|
+
odooflow server list
|
|
178
|
+
odooflow server show staging # password is masked; --reveal-password to see it
|
|
179
|
+
|
|
180
|
+
# Switch the default:
|
|
181
|
+
odooflow server use prod
|
|
182
|
+
|
|
183
|
+
# Verify connectivity without uploading:
|
|
184
|
+
odooflow server test staging
|
|
185
|
+
|
|
186
|
+
# Reorder / remove:
|
|
187
|
+
odooflow server remove qa
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Existing single-server configs are auto-migrated into a `default` profile on first `odooflow server add`, so nothing you've already configured is lost.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 📁 Project Structure
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
odooflow/
|
|
198
|
+
├── odooflow/
|
|
199
|
+
│ ├── __init__.py
|
|
200
|
+
│ ├── cli.py
|
|
201
|
+
│ ├── config_manager.py
|
|
202
|
+
│ ├── commands/
|
|
203
|
+
│ │ ├── __init__.py
|
|
204
|
+
│ │ ├── clone_module.py
|
|
205
|
+
│ │ ├── config.py
|
|
206
|
+
│ │ ├── init_module_env.py
|
|
207
|
+
│ │ ├── keygen.py
|
|
208
|
+
│ │ ├── push.py
|
|
209
|
+
│ │ ├── remote.py
|
|
210
|
+
│ │ ├── server.py
|
|
211
|
+
│ │ └── sync_env.py
|
|
212
|
+
│ └── utils/
|
|
213
|
+
│ ├── env.py
|
|
214
|
+
│ ├── server_profile.py
|
|
215
|
+
│ └── ssh.py
|
|
216
|
+
├── tests/
|
|
217
|
+
├── README.md
|
|
218
|
+
├── requirements.txt
|
|
219
|
+
├── pyproject.toml
|
|
220
|
+
└── LICENSE
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 🤝 Contributing
|
|
226
|
+
|
|
227
|
+
Contributions are welcome! Please open an issue or submit a pull request with any improvements, bug fixes, or new features.
|
|
228
|
+
|
|
229
|
+
1. Fork the repository
|
|
230
|
+
2. Create a new branch (`git checkout -b feature/your-feature`)
|
|
231
|
+
3. Commit your changes (`git commit -am 'Add new feature'`)
|
|
232
|
+
4. Push to the branch (`git push origin feature/your-feature`)
|
|
233
|
+
5. Open a Pull Request
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 📝 License
|
|
238
|
+
|
|
239
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## WISH-LIST:
|
|
244
|
+
|
|
245
|
+
Move this CLI into fully-integrated Odoo environment, using Odoo, users can create issues, add the amount of details, then sync these issues with Odooflow.
|
|
246
|
+
|
|
247
|
+
We can do integration with any code agent to help developers to achieve these issues
|
|
248
|
+
|
|
249
|
+
same thing for pipelines, I think it will be amazing if developers can build pipelines using Odoo, then apply the same pipelines using Odooflow.
|
|
250
|
+
|
|
251
|
+
I have many things in my head, I will back soon to this project.
|
|
252
|
+
|
|
253
|
+
## 👨💻 Author
|
|
254
|
+
|
|
255
|
+
Made with ❤️ by Mohammad A. Hamdan
|
|
256
|
+
|
|
257
|
+
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.0"
|
|
@@ -8,8 +8,16 @@ from odooflow.commands.clone_module import clone_module_command
|
|
|
8
8
|
from odooflow.commands.remote import remote as remote_command
|
|
9
9
|
from odooflow.commands.keygen import generate_ssh_key as keygen_command
|
|
10
10
|
from odooflow.commands.push import push_command
|
|
11
|
+
from odooflow.commands.setup import setup as setup_command
|
|
12
|
+
from odooflow.commands.server import app as server_app
|
|
11
13
|
|
|
12
14
|
app = typer.Typer(help="OdooFlow CLI — streamline your Odoo development workflow.")
|
|
15
|
+
app.add_typer(server_app, name="server")
|
|
16
|
+
|
|
17
|
+
@app.command(name="setup")
|
|
18
|
+
def setup_cmd():
|
|
19
|
+
"""Interactive wizard: write ~/.odooflowrc with token, GitLab URL, core modules."""
|
|
20
|
+
setup_command()
|
|
13
21
|
|
|
14
22
|
@app.command(name="init")
|
|
15
23
|
def init_manifest(
|
|
@@ -51,12 +59,15 @@ def config(
|
|
|
51
59
|
def clone_command(
|
|
52
60
|
repo_url: str = typer.Argument(..., help="HTTP URL of the module repository."),
|
|
53
61
|
branch: Optional[str] = typer.Option(None, "--branch", '-b', help="Branch to clone"),
|
|
54
|
-
depth: int = typer.Option(1, "--depth", "-d", help="Max dependency depth to clone. 1
|
|
62
|
+
depth: int = typer.Option(1, "--depth", "-d", help="Max dependency depth to clone. 1 = target only, 2 = target + immediate deps, etc."),
|
|
63
|
+
workers: int = typer.Option(4, "--workers", "-w", help="Max concurrent clones (1-8)."),
|
|
55
64
|
):
|
|
56
65
|
"""
|
|
57
|
-
Clone a module and its dependencies from a
|
|
66
|
+
Clone a module and (optionally) its dependencies from a Git repository.
|
|
67
|
+
|
|
68
|
+
Run `odooflow setup` first if you have not configured an access token yet.
|
|
58
69
|
"""
|
|
59
|
-
clone_module_command(repo_url, branch, depth)
|
|
70
|
+
clone_module_command(repo_url, branch, depth, workers)
|
|
60
71
|
|
|
61
72
|
|
|
62
73
|
@app.command()
|
|
@@ -88,13 +99,14 @@ def generate_ssh_key(
|
|
|
88
99
|
|
|
89
100
|
@app.command()
|
|
90
101
|
def push(
|
|
102
|
+
server: Optional[str] = typer.Option(None, "--server", "-s", help="Named server profile from `odooflow server list`."),
|
|
91
103
|
remote_only: bool = typer.Option(False, "--remote-only", help="Skip Git push and only upload to server"),
|
|
92
104
|
exec_cmd: Optional[str] = typer.Option(None, "--exec", help="Custom shell command to execute on the server after pushing"),
|
|
93
105
|
):
|
|
94
106
|
"""
|
|
95
107
|
Push the current Git branch and upload the project to the test server.
|
|
96
108
|
"""
|
|
97
|
-
push_command(remote_only=remote_only, exec_cmd=exec_cmd)
|
|
109
|
+
push_command(server_name=server, remote_only=remote_only, exec_cmd=exec_cmd)
|
|
98
110
|
|
|
99
111
|
|
|
100
112
|
|