piilot-pack-compta-esms 0.1.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.
- piilot_pack_compta_esms-0.1.0/LICENSE +201 -0
- piilot_pack_compta_esms-0.1.0/PKG-INFO +167 -0
- piilot_pack_compta_esms-0.1.0/README.md +146 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/__init__.py +60 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/handlers.py +26 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/locales/en.json +10 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/locales/fr.json +10 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/migrations/001_init.sql +37 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/migrations/002_compta_esms_counter.sql +26 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/pyproject.toml +107 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/repo.py +71 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/routes.py +81 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms/seeds.py +40 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/PKG-INFO +167 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/SOURCES.txt +20 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/dependency_links.txt +1 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/entry_points.txt +2 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/requires.txt +10 -0
- piilot_pack_compta_esms-0.1.0/piilot_pack_compta_esms.egg-info/top_level.txt +1 -0
- piilot_pack_compta_esms-0.1.0/pyproject.toml +107 -0
- piilot_pack_compta_esms-0.1.0/setup.cfg +4 -0
- piilot_pack_compta_esms-0.1.0/tests/test_plugin_boot.py +72 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Kinetics Consulting
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: piilot-pack-compta-esms
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Piilot plugin — verticale compta ESMS (cabinets-EC gérant des dossiers Établissements Sociaux et Médico-Sociaux).
|
|
5
|
+
Author-email: Kinetics Consulting V2 <contact@piilot.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: homepage, https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: piilot-sdk<1.0.0,>=0.6.0
|
|
12
|
+
Requires-Dist: fastapi>=0.115
|
|
13
|
+
Requires-Dist: psycopg2-binary>=2.9
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
|
|
17
|
+
Requires-Dist: pytest-cov>=6.0; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
19
|
+
Requires-Dist: black>=25.0; extra == "dev"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# piilot-pack-compta-esms
|
|
23
|
+
|
|
24
|
+
> Piilot plugin — verticale compta ESMS (cabinets-EC gérant des dossiers Établissements Sociaux et Médico-Sociaux).
|
|
25
|
+
|
|
26
|
+
<!-- scaffold-banner:start -->
|
|
27
|
+
> 🧩 **This repo is both a template and a working "compta_esms" plugin.**
|
|
28
|
+
>
|
|
29
|
+
> **Just want to demo / dogfood?** Install it as-is, it loads as plugin
|
|
30
|
+
> `compta_esms` with one module and one migration — no edits required.
|
|
31
|
+
>
|
|
32
|
+
> **Want to start your own plugin?** Fork via `gh repo create --template`,
|
|
33
|
+
> then rename everything to your namespace in one go:
|
|
34
|
+
>
|
|
35
|
+
> ```bash
|
|
36
|
+
> ./init-plugin.sh <namespace> "<description>" <category>
|
|
37
|
+
> ```
|
|
38
|
+
>
|
|
39
|
+
> See the [Piilot plugin development guide][guide] for the full workflow.
|
|
40
|
+
>
|
|
41
|
+
> [guide]: https://github.com/Kinetics-Consulting-V2/AICockpit/blob/main/docs/PLUGIN_DEVELOPMENT.md
|
|
42
|
+
<!-- scaffold-banner:end -->
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
TODO: one-paragraph summary of this plugin's purpose and the problem
|
|
49
|
+
it solves for a Piilot company.
|
|
50
|
+
|
|
51
|
+
## What this template demonstrates (SDK v0.3)
|
|
52
|
+
|
|
53
|
+
The `compta_esms` plugin is a functional showcase of the Piilot SDK v0.2+
|
|
54
|
+
primitives, pinned to `piilot-sdk>=0.3.0`. Fork the template and
|
|
55
|
+
start from a plugin that already wires:
|
|
56
|
+
|
|
57
|
+
| File | SDK primitive | What it illustrates |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `piilot_pack_compta_esms/handlers.py` | `ctx.handlers.register` | Module handlers dispatched by the module runtime |
|
|
60
|
+
| `piilot_pack_compta_esms/migrations/` + `__init__.py` | `ctx.migrations.register_schema` | Idempotent per-plugin SQL schema + RLS policies |
|
|
61
|
+
| `piilot_pack_compta_esms/locales/` + `__init__.py` | `ctx.i18n.register_locales` | Per-namespace locale catalogs merged into `/i18n/catalog` |
|
|
62
|
+
| `piilot_pack_compta_esms/repo.py` + `migrations/002_*.sql` | `piilot.sdk.db` | `cursor()`, `run_in_thread`, `Json` — direct SQL with RLS propagation |
|
|
63
|
+
| `piilot_pack_compta_esms/routes.py` | `piilot.sdk.http` | `register_router` + `Depends(require_user)` + `get_real_ip` |
|
|
64
|
+
| `piilot_pack_compta_esms/tools.py` | `piilot.sdk.tools` + `piilot.sdk.session` | Agent `StructuredTool` with `system_prompt_builder` + session read |
|
|
65
|
+
| `piilot_pack_compta_esms/seeds.py` | `piilot.sdk.modules` + `piilot.sdk.templates` | Idempotent `register_module` + `register_template` upserts |
|
|
66
|
+
| `piilot_pack_compta_esms/connector.py` | `piilot.sdk.connectors` | **Commented out** — pattern for declaring an external API connector |
|
|
67
|
+
| `piilot_pack_compta_esms/jobs.py` | `piilot.sdk.scheduler` | **Commented out** — pattern for a periodic sync handler |
|
|
68
|
+
| `frontend/src/index.ts` | `core.registerModuleView` + `registerI18nBundle` | Plugin UI entry — ships as `piilot-pack-compta-esms-ui` on npm |
|
|
69
|
+
| `frontend/src/HelloModuleView.tsx` | React component rendered by the host `ModuleViewShell` | URL-backed sub-routing via `useSearchParams`, imports from `@plugin-host/*` |
|
|
70
|
+
| `.github/workflows/release-ui.yml` | npm publish on `ui-v*` tag | Mirrors the PyPI workflow for the backend |
|
|
71
|
+
|
|
72
|
+
Full reference: see the [Piilot plugin development guide][guide].
|
|
73
|
+
|
|
74
|
+
### Dual distribution
|
|
75
|
+
|
|
76
|
+
- **Backend** — `piilot-pack-compta-esms` on PyPI, tagged `v<version>`.
|
|
77
|
+
- **Frontend** — `piilot-pack-compta-esms-ui` on npm, tagged `ui-v<version>`.
|
|
78
|
+
|
|
79
|
+
Both ship from this single repo; the two release workflows publish
|
|
80
|
+
independently so a backend hot-fix doesn't force a frontend release
|
|
81
|
+
and vice-versa.
|
|
82
|
+
|
|
83
|
+
## Install
|
|
84
|
+
|
|
85
|
+
### Self-hosted Piilot (docker-compose.selfhost.yml)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Drop the package into /app/plugins/
|
|
89
|
+
pip install piilot-pack-compta-esms
|
|
90
|
+
# or for a git-based install while the SDK is still pre-PyPI:
|
|
91
|
+
pip install git+https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git@v0.1.0
|
|
92
|
+
|
|
93
|
+
# Restart the backend
|
|
94
|
+
docker compose restart backend
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Piilot Cloud (SaaS)
|
|
98
|
+
|
|
99
|
+
Add the dependency to the core's `requirements.txt`:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
piilot-pack-compta-esms @ git+https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git@v0.1.0
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Coolify rebuilds the backend image; the loader picks up the plugin at
|
|
106
|
+
startup and applies migrations. Enable for a given company via:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
curl -X PUT \
|
|
110
|
+
-H "Authorization: Bearer $ADMIN_TOKEN" \
|
|
111
|
+
-H "X-Company-Id: $COMPANY_ID" \
|
|
112
|
+
https://api.piilot.ai/admin/plugins/compta_esms/activations/$COMPANY_ID
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Usage
|
|
116
|
+
|
|
117
|
+
TODO: how a user interacts with the plugin (module screens, agent
|
|
118
|
+
tools, integrations…).
|
|
119
|
+
|
|
120
|
+
## Development
|
|
121
|
+
|
|
122
|
+
### Local setup
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Clone next to the Piilot core
|
|
126
|
+
cd /opt/factory/projects
|
|
127
|
+
git clone https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git
|
|
128
|
+
|
|
129
|
+
# Install in editable mode with dev extras
|
|
130
|
+
cd piilot-pack-compta-esms
|
|
131
|
+
pip install -e .[dev]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Then add the plugin as a bind mount in the core's
|
|
135
|
+
`docker-compose.override.yml` (gitignored):
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
services:
|
|
139
|
+
backend:
|
|
140
|
+
volumes:
|
|
141
|
+
- ../piilot-pack-compta-esms:/app/plugins/piilot-pack-compta-esms
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Restart the backend and watch for:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
[plugins] Loaded: compta_esms v0.1.0 (handlers=1, tools=0)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Run the tests
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pytest
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Versioning
|
|
157
|
+
|
|
158
|
+
This plugin follows [Semantic Versioning](https://semver.org/). The
|
|
159
|
+
`sdk_compat` range in `pyproject.toml` pins the Piilot SDK versions
|
|
160
|
+
we build against. Watch the core's
|
|
161
|
+
[`docs/SDK_CHANGELOG.md`][changelog] for breaking changes.
|
|
162
|
+
|
|
163
|
+
[changelog]: https://github.com/Kinetics-Consulting-V2/AICockpit/blob/main/docs/SDK_CHANGELOG.md
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
Apache-2.0. See [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# piilot-pack-compta-esms
|
|
2
|
+
|
|
3
|
+
> Piilot plugin — verticale compta ESMS (cabinets-EC gérant des dossiers Établissements Sociaux et Médico-Sociaux).
|
|
4
|
+
|
|
5
|
+
<!-- scaffold-banner:start -->
|
|
6
|
+
> 🧩 **This repo is both a template and a working "compta_esms" plugin.**
|
|
7
|
+
>
|
|
8
|
+
> **Just want to demo / dogfood?** Install it as-is, it loads as plugin
|
|
9
|
+
> `compta_esms` with one module and one migration — no edits required.
|
|
10
|
+
>
|
|
11
|
+
> **Want to start your own plugin?** Fork via `gh repo create --template`,
|
|
12
|
+
> then rename everything to your namespace in one go:
|
|
13
|
+
>
|
|
14
|
+
> ```bash
|
|
15
|
+
> ./init-plugin.sh <namespace> "<description>" <category>
|
|
16
|
+
> ```
|
|
17
|
+
>
|
|
18
|
+
> See the [Piilot plugin development guide][guide] for the full workflow.
|
|
19
|
+
>
|
|
20
|
+
> [guide]: https://github.com/Kinetics-Consulting-V2/AICockpit/blob/main/docs/PLUGIN_DEVELOPMENT.md
|
|
21
|
+
<!-- scaffold-banner:end -->
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## What it does
|
|
26
|
+
|
|
27
|
+
TODO: one-paragraph summary of this plugin's purpose and the problem
|
|
28
|
+
it solves for a Piilot company.
|
|
29
|
+
|
|
30
|
+
## What this template demonstrates (SDK v0.3)
|
|
31
|
+
|
|
32
|
+
The `compta_esms` plugin is a functional showcase of the Piilot SDK v0.2+
|
|
33
|
+
primitives, pinned to `piilot-sdk>=0.3.0`. Fork the template and
|
|
34
|
+
start from a plugin that already wires:
|
|
35
|
+
|
|
36
|
+
| File | SDK primitive | What it illustrates |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `piilot_pack_compta_esms/handlers.py` | `ctx.handlers.register` | Module handlers dispatched by the module runtime |
|
|
39
|
+
| `piilot_pack_compta_esms/migrations/` + `__init__.py` | `ctx.migrations.register_schema` | Idempotent per-plugin SQL schema + RLS policies |
|
|
40
|
+
| `piilot_pack_compta_esms/locales/` + `__init__.py` | `ctx.i18n.register_locales` | Per-namespace locale catalogs merged into `/i18n/catalog` |
|
|
41
|
+
| `piilot_pack_compta_esms/repo.py` + `migrations/002_*.sql` | `piilot.sdk.db` | `cursor()`, `run_in_thread`, `Json` — direct SQL with RLS propagation |
|
|
42
|
+
| `piilot_pack_compta_esms/routes.py` | `piilot.sdk.http` | `register_router` + `Depends(require_user)` + `get_real_ip` |
|
|
43
|
+
| `piilot_pack_compta_esms/tools.py` | `piilot.sdk.tools` + `piilot.sdk.session` | Agent `StructuredTool` with `system_prompt_builder` + session read |
|
|
44
|
+
| `piilot_pack_compta_esms/seeds.py` | `piilot.sdk.modules` + `piilot.sdk.templates` | Idempotent `register_module` + `register_template` upserts |
|
|
45
|
+
| `piilot_pack_compta_esms/connector.py` | `piilot.sdk.connectors` | **Commented out** — pattern for declaring an external API connector |
|
|
46
|
+
| `piilot_pack_compta_esms/jobs.py` | `piilot.sdk.scheduler` | **Commented out** — pattern for a periodic sync handler |
|
|
47
|
+
| `frontend/src/index.ts` | `core.registerModuleView` + `registerI18nBundle` | Plugin UI entry — ships as `piilot-pack-compta-esms-ui` on npm |
|
|
48
|
+
| `frontend/src/HelloModuleView.tsx` | React component rendered by the host `ModuleViewShell` | URL-backed sub-routing via `useSearchParams`, imports from `@plugin-host/*` |
|
|
49
|
+
| `.github/workflows/release-ui.yml` | npm publish on `ui-v*` tag | Mirrors the PyPI workflow for the backend |
|
|
50
|
+
|
|
51
|
+
Full reference: see the [Piilot plugin development guide][guide].
|
|
52
|
+
|
|
53
|
+
### Dual distribution
|
|
54
|
+
|
|
55
|
+
- **Backend** — `piilot-pack-compta-esms` on PyPI, tagged `v<version>`.
|
|
56
|
+
- **Frontend** — `piilot-pack-compta-esms-ui` on npm, tagged `ui-v<version>`.
|
|
57
|
+
|
|
58
|
+
Both ship from this single repo; the two release workflows publish
|
|
59
|
+
independently so a backend hot-fix doesn't force a frontend release
|
|
60
|
+
and vice-versa.
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
### Self-hosted Piilot (docker-compose.selfhost.yml)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Drop the package into /app/plugins/
|
|
68
|
+
pip install piilot-pack-compta-esms
|
|
69
|
+
# or for a git-based install while the SDK is still pre-PyPI:
|
|
70
|
+
pip install git+https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git@v0.1.0
|
|
71
|
+
|
|
72
|
+
# Restart the backend
|
|
73
|
+
docker compose restart backend
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Piilot Cloud (SaaS)
|
|
77
|
+
|
|
78
|
+
Add the dependency to the core's `requirements.txt`:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
piilot-pack-compta-esms @ git+https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git@v0.1.0
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Coolify rebuilds the backend image; the loader picks up the plugin at
|
|
85
|
+
startup and applies migrations. Enable for a given company via:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
curl -X PUT \
|
|
89
|
+
-H "Authorization: Bearer $ADMIN_TOKEN" \
|
|
90
|
+
-H "X-Company-Id: $COMPANY_ID" \
|
|
91
|
+
https://api.piilot.ai/admin/plugins/compta_esms/activations/$COMPANY_ID
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
TODO: how a user interacts with the plugin (module screens, agent
|
|
97
|
+
tools, integrations…).
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
### Local setup
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Clone next to the Piilot core
|
|
105
|
+
cd /opt/factory/projects
|
|
106
|
+
git clone https://github.com/Kinetics-Consulting-V2/piilot-pack-compta-esms.git
|
|
107
|
+
|
|
108
|
+
# Install in editable mode with dev extras
|
|
109
|
+
cd piilot-pack-compta-esms
|
|
110
|
+
pip install -e .[dev]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Then add the plugin as a bind mount in the core's
|
|
114
|
+
`docker-compose.override.yml` (gitignored):
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
services:
|
|
118
|
+
backend:
|
|
119
|
+
volumes:
|
|
120
|
+
- ../piilot-pack-compta-esms:/app/plugins/piilot-pack-compta-esms
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Restart the backend and watch for:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
[plugins] Loaded: compta_esms v0.1.0 (handlers=1, tools=0)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Run the tests
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pytest
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Versioning
|
|
136
|
+
|
|
137
|
+
This plugin follows [Semantic Versioning](https://semver.org/). The
|
|
138
|
+
`sdk_compat` range in `pyproject.toml` pins the Piilot SDK versions
|
|
139
|
+
we build against. Watch the core's
|
|
140
|
+
[`docs/SDK_CHANGELOG.md`][changelog] for breaking changes.
|
|
141
|
+
|
|
142
|
+
[changelog]: https://github.com/Kinetics-Consulting-V2/AICockpit/blob/main/docs/SDK_CHANGELOG.md
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
Apache-2.0. See [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Piilot plugin ``compta_esms`` — verticale compta ESMS.
|
|
2
|
+
|
|
3
|
+
Entry point of the plugin. The ``Plugin`` class is referenced by
|
|
4
|
+
``[project.entry-points."piilot.plugins"]`` in ``pyproject.toml`` and
|
|
5
|
+
instantiated once at Piilot backend startup.
|
|
6
|
+
|
|
7
|
+
v0.1 — hello-world surface
|
|
8
|
+
--------------------------
|
|
9
|
+
|
|
10
|
+
* ``ctx.migrations`` — register the plugin's own SQL migrations.
|
|
11
|
+
* ``ctx.i18n`` — merge per-namespace locale catalogs.
|
|
12
|
+
* ``ctx.handlers`` — register the module handler.
|
|
13
|
+
* :mod:`piilot.sdk.http` — see ``routes.py`` (counter GET + greet POST).
|
|
14
|
+
* :mod:`piilot.sdk.modules` — see ``seeds.py`` (idempotent module upsert).
|
|
15
|
+
|
|
16
|
+
Future roadmap (see CHANGELOG):
|
|
17
|
+
|
|
18
|
+
* v0.2 — KB templates compta-ESMS (M22 plan comptable, dossier-ESMS, …)
|
|
19
|
+
* v0.3 — agent templates compta-ESMS
|
|
20
|
+
* v0.4 — agent tools compta-ESMS (``register_tool`` + ``bind_session``)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from piilot.sdk import Plugin as _Plugin
|
|
26
|
+
from piilot.sdk import load_manifest
|
|
27
|
+
|
|
28
|
+
from .handlers import compta_esms_handler
|
|
29
|
+
from .routes import wire_routes
|
|
30
|
+
from .seeds import wire_seeds
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Plugin(_Plugin):
|
|
34
|
+
"""Plugin entry class — must subclass ``piilot.sdk.Plugin``."""
|
|
35
|
+
|
|
36
|
+
manifest = load_manifest(__file__)
|
|
37
|
+
|
|
38
|
+
def register(self, ctx) -> None:
|
|
39
|
+
"""Wire up everything this plugin provides.
|
|
40
|
+
|
|
41
|
+
Called once at backend startup with a boot-time ``Context``
|
|
42
|
+
(``ctx.company`` is None here; runtime contexts are built per
|
|
43
|
+
request later on).
|
|
44
|
+
"""
|
|
45
|
+
ctx.migrations.register_schema(
|
|
46
|
+
"compta_esms",
|
|
47
|
+
__file__,
|
|
48
|
+
"migrations",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
ctx.i18n.register_locales(
|
|
52
|
+
"compta_esms",
|
|
53
|
+
__file__,
|
|
54
|
+
"locales",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
ctx.handlers.register("compta_esms.hello", compta_esms_handler)
|
|
58
|
+
|
|
59
|
+
wire_routes()
|
|
60
|
+
wire_seeds()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Module handlers for the ``compta_esms`` plugin.
|
|
2
|
+
|
|
3
|
+
Each handler is a callable ``(ctx, payload) -> dict`` dispatched by the
|
|
4
|
+
Piilot module runtime when a user triggers the module from the UI.
|
|
5
|
+
Handlers are registered in ``__init__.py::Plugin.register()``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def compta_esms_handler(ctx: Any, payload: dict) -> dict:
|
|
14
|
+
"""Hello-world module handler — echoes a greeting.
|
|
15
|
+
|
|
16
|
+
Will be replaced by real compta-ESMS workflow handlers in v0.5+
|
|
17
|
+
(M22 import, balance reconciliation, etc.).
|
|
18
|
+
"""
|
|
19
|
+
name = payload.get("name", "world")
|
|
20
|
+
company_label = ctx.company.name if ctx.company else "<no company bound>"
|
|
21
|
+
ctx.logger.info("compta_esms.hello invoked for %s", company_label)
|
|
22
|
+
return {
|
|
23
|
+
"status": "ok",
|
|
24
|
+
"message": f"Hello {name} from compta_esms",
|
|
25
|
+
"company": company_label,
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
-- ============================================================
|
|
2
|
+
-- Migration: 001_init.sql
|
|
3
|
+
-- Plugin: compta_esms
|
|
4
|
+
-- ============================================================
|
|
5
|
+
-- All plugin migrations MUST be idempotent: the Piilot loader refuses
|
|
6
|
+
-- a plugin whose .sql files contain a CREATE TABLE / CREATE INDEX /
|
|
7
|
+
-- CREATE SCHEMA without IF NOT EXISTS (static heuristic check).
|
|
8
|
+
--
|
|
9
|
+
-- Use your plugin's namespace as the PG schema name — it isolates
|
|
10
|
+
-- your tables and guarantees no collision with the core or other plugins.
|
|
11
|
+
-- ============================================================
|
|
12
|
+
|
|
13
|
+
CREATE SCHEMA IF NOT EXISTS compta_esms;
|
|
14
|
+
|
|
15
|
+
-- Example table — replace with your real domain model.
|
|
16
|
+
CREATE TABLE IF NOT EXISTS compta_esms.example_entity (
|
|
17
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
18
|
+
company_id UUID NOT NULL,
|
|
19
|
+
label TEXT NOT NULL,
|
|
20
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
21
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_compta_esms_example_company
|
|
25
|
+
ON compta_esms.example_entity (company_id);
|
|
26
|
+
|
|
27
|
+
-- RLS — plugin-owned tables that hold per-company data MUST enable RLS
|
|
28
|
+
-- and add an is_company_member policy. The core does not enforce this
|
|
29
|
+
-- automatically; it's on the plugin author.
|
|
30
|
+
ALTER TABLE compta_esms.example_entity ENABLE ROW LEVEL SECURITY;
|
|
31
|
+
|
|
32
|
+
DROP POLICY IF EXISTS compta_esms_example_select_member
|
|
33
|
+
ON compta_esms.example_entity;
|
|
34
|
+
CREATE POLICY compta_esms_example_select_member
|
|
35
|
+
ON compta_esms.example_entity
|
|
36
|
+
FOR SELECT
|
|
37
|
+
USING (public.is_company_member(company_id));
|