@waron97/prbot 2.8.0 → 3.0.1

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.
package/README.md CHANGED
@@ -190,3 +190,82 @@ Reinstalls the latest published version from npm.
190
190
  prbot update
191
191
  ```
192
192
 
193
+ ---
194
+
195
+ ## agrippa
196
+
197
+ Syncs Odoo workflow phase Python code and MFA records between the local filesystem and the RIP API. Tracks changes via checksums and detects conflicts before overwriting.
198
+
199
+ Credentials are inherited from the global prbot config (`~/.config/prbot/config`). Override per-workspace in `agrippa.yaml`.
200
+
201
+ ### `agrippa init`
202
+
203
+ Creates `agrippa.yaml` in the current directory. Always writes `pyproject.toml` with the standard ruff builtins. Optionally writes `pyrightconfig.json` and copies type stubs into `typings/`.
204
+
205
+ ```bash
206
+ agrippa init
207
+ ```
208
+
209
+ ### `agrippa clone`
210
+
211
+ Clones all `from_code` phases for a selected workflow, or a single MFA, into the workspace. Writes files to disk and registers them in `agrippa.yaml`.
212
+
213
+ ```bash
214
+ agrippa clone
215
+ agrippa clone --phase
216
+ agrippa clone --mfa
217
+ agrippa clone --phase --id 123 --path my-workflow/
218
+ ```
219
+
220
+ Options:
221
+
222
+ | Flag | Description |
223
+ | --------------- | -------------------------------------------------------- |
224
+ | `--phase` | Clone a phase (select a workflow) |
225
+ | `--mfa` | Clone an MFA record |
226
+ | `--id <id>` | Skip selection, clone by ID |
227
+ | `--path <path>` | Destination path (base dir for phases, file path for MFA)|
228
+
229
+ ### `agrippa pull`
230
+
231
+ Fetches remote code for all tracked entries and shows what changed. Classifies each as `fast-forward` (safe overwrite) or `conflict` (local edits would be lost). Lets you select which to pull.
232
+
233
+ After pulling, also checks tracked workflows for newly added `from_code` phases and auto-clones any not yet present locally.
234
+
235
+ ```bash
236
+ agrippa pull
237
+ ```
238
+
239
+ ### `agrippa push`
240
+
241
+ Pushes local file changes back to RIP. Backs up current remote code to `.backup/<timestamp>/` before overwriting. Same conflict detection as pull, with the concern inverted.
242
+
243
+ ```bash
244
+ agrippa push
245
+ ```
246
+
247
+ ### `agrippa diff [path]`
248
+
249
+ Shows a diff between local files and remote code. Optionally filter to a specific file path.
250
+
251
+ ```bash
252
+ agrippa diff
253
+ agrippa diff my-workflow/some-phase.py
254
+ ```
255
+
256
+ ### `agrippa init-phase`
257
+
258
+ Selects a workflow and any phase, then pushes a default code scaffold to that phase on RIP. Sets `set_result_automatically` to `from_code`, generates result variable constants from the phase's allowed results, and creates the corresponding `result.code.configurator` records.
259
+
260
+ ```bash
261
+ agrippa init-phase
262
+ ```
263
+
264
+ ### `agrippa repair`
265
+
266
+ Removes entries from `agrippa.yaml` whose local files no longer exist on disk.
267
+
268
+ ```bash
269
+ agrippa repair
270
+ ```
271
+
@@ -0,0 +1,99 @@
1
+ from typing import (
2
+ Any,
3
+ Dict,
4
+ List,
5
+ Literal,
6
+ Optional,
7
+ Tuple,
8
+ Type,
9
+ TypeVar,
10
+ Union,
11
+ )
12
+ import logging
13
+ import datetime as _dt
14
+
15
+ from recordset import Recordset
16
+ from odoo_environment import OdooEnvironment
17
+ from odoo_records import _HelpdeskTicket
18
+ from b2w_entities import Asset, Contract, Order, OrderItem, Task
19
+
20
+ class Cursor:
21
+ def execute(self, query: str, params: Any = None) -> None: ...
22
+ def fetchone(self) -> Optional[Tuple[Any, ...]]: ...
23
+ def fetchall(self) -> List[Tuple[Any, ...]]: ...
24
+ def rollback(self) -> None: ...
25
+ def commit(self) -> None: ...
26
+
27
+ class Response:
28
+ status_code: int
29
+ text: str
30
+ content: bytes
31
+ headers: Dict[str, str]
32
+ ok: bool
33
+ def json(self) -> Any: ...
34
+ def raise_for_status(self) -> None: ...
35
+
36
+ # --- Globals ---
37
+
38
+ case_id: _HelpdeskTicket
39
+ env: OdooEnvironment
40
+ body: Dict[str, Any]
41
+ args: List[Any]
42
+ model: Recordset
43
+ logger: logging.Logger
44
+
45
+ # --- Functions ---
46
+
47
+ def log(
48
+ message: Any, level: Literal["debug", "info", "warning", "error"] = ...
49
+ ) -> None: ...
50
+ def json_dumps(
51
+ obj: Any,
52
+ *,
53
+ indent: Optional[int] = None,
54
+ sort_keys: bool = False,
55
+ default: Any = None,
56
+ ensure_ascii: bool = True,
57
+ ) -> str: ...
58
+ def json_loads(s: str) -> Any: ...
59
+ def make_response(
60
+ status: Tuple[int, int],
61
+ message: Union[str, Dict[str, Any]],
62
+ ) -> Any: ...
63
+ def request(
64
+ method: str,
65
+ url: str,
66
+ *,
67
+ headers: Optional[Dict[str, str]] = None,
68
+ data: Optional[Union[str, bytes]] = None,
69
+ json: Optional[Any] = None,
70
+ params: Optional[Dict[str, Any]] = None,
71
+ timeout: Optional[float] = None,
72
+ ) -> Response: ...
73
+
74
+ FirstArg = TypeVar("FirstArg")
75
+
76
+ def first(recordset: FirstArg) -> FirstArg: ...
77
+ def format_exc() -> str: ...
78
+
79
+ # --- Exceptions ---
80
+
81
+ class ValidationError(Exception): ...
82
+
83
+ # --- Datetime types (injected as the datetime module, not bare classes) ---
84
+
85
+ class _DatetimeModule:
86
+ datetime: Type[_dt.datetime]
87
+ date: Type[_dt.date]
88
+ time: Type[_dt.time]
89
+ timezone: Type[_dt.timezone]
90
+ timedelta: Type[_dt.timedelta]
91
+ MINYEAR: int
92
+ MAXYEAR: int
93
+
94
+ datetime: _DatetimeModule
95
+ date: Type[_dt.date]
96
+ time: Type[_dt.time]
97
+ timezone: Type[_dt.timezone]
98
+ pytz: Any
99
+ dateutil: Any
@@ -0,0 +1,68 @@
1
+ from typing import Any, Dict, List, Optional
2
+ from odoo_environment import OdooEnvironment
3
+
4
+
5
+ class Bit2winEntity:
6
+ env: OdooEnvironment
7
+ _id: str
8
+ data: Dict[str, Any]
9
+
10
+ def __init__(self, env: OdooEnvironment, _id: str, data: Optional[Dict[str, Any]] = None) -> None: ...
11
+ def patch(self, new_data: Any, method: str = "PATCH") -> Any: ...
12
+ def download(self) -> Dict[str, Any]: ...
13
+
14
+
15
+ class Asset(Bit2winEntity):
16
+ def children(self) -> "List[Asset]": ...
17
+ def order(self) -> "Order": ...
18
+ def order_item(self) -> "OrderItem": ...
19
+ def contract(self) -> "Contract": ...
20
+ def offer_codes(self) -> List[Dict[str, Any]]: ...
21
+ def offer_code(self, at: Any = None) -> Optional[str]: ...
22
+ def update_b2w_statemodel(
23
+ self,
24
+ destination_state: str,
25
+ sm_reason: str = "",
26
+ expected_date: Any = False,
27
+ ) -> Any: ...
28
+
29
+
30
+ class Order(Bit2winEntity):
31
+ def order_items(self) -> "List[OrderItem]": ...
32
+ def update_b2w_statemodel(
33
+ self,
34
+ destination_state: str,
35
+ sm_reason: str = "",
36
+ expected_date: Any = False,
37
+ ) -> Any: ...
38
+
39
+
40
+ class OrderItem(Bit2winEntity):
41
+ order_id: Optional[str]
42
+
43
+ def __init__(
44
+ self,
45
+ env: OdooEnvironment,
46
+ _id: str,
47
+ order_id: Optional[str] = None,
48
+ data: Optional[Dict[str, Any]] = None,
49
+ ) -> None: ...
50
+ def task_mdp(self) -> "Optional[Task]": ...
51
+ def update_b2w_statemodel(
52
+ self,
53
+ destination_state: str,
54
+ sm_reason: str = "",
55
+ expected_date: Any = False,
56
+ ) -> Any: ...
57
+
58
+
59
+ class Contract(Bit2winEntity):
60
+ def update_b2w_statemodel(
61
+ self,
62
+ destination_state: str,
63
+ sm_reason: str = "",
64
+ expected_date: Any = False,
65
+ ) -> Any: ...
66
+
67
+
68
+ class Task(Bit2winEntity): ...