sgit-ai 0.8.17__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.
- sgit_ai-0.8.17/LICENSE +201 -0
- sgit_ai-0.8.17/PKG-INFO +47 -0
- sgit_ai-0.8.17/README.md +25 -0
- sgit_ai-0.8.17/pyproject.toml +49 -0
- sgit_ai-0.8.17/sgit_ai/__init__.py +1 -0
- sgit_ai-0.8.17/sgit_ai/__main__.py +3 -0
- sgit_ai-0.8.17/sgit_ai/_version.py +1 -0
- sgit_ai-0.8.17/sgit_ai/api/API__Transfer.py +219 -0
- sgit_ai-0.8.17/sgit_ai/api/Transfer__Envelope.py +29 -0
- sgit_ai-0.8.17/sgit_ai/api/Vault__API.py +152 -0
- sgit_ai-0.8.17/sgit_ai/api/Vault__API__In_Memory.py +83 -0
- sgit_ai-0.8.17/sgit_ai/api/Vault__Backend.py +50 -0
- sgit_ai-0.8.17/sgit_ai/api/Vault__Backend__API.py +29 -0
- sgit_ai-0.8.17/sgit_ai/api/Vault__Backend__Local.py +54 -0
- sgit_ai-0.8.17/sgit_ai/api/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Credential_Store.py +95 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Debug_Log.py +98 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Main.py +413 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__PKI.py +197 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Progress.py +49 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Token_Store.py +86 -0
- sgit_ai-0.8.17/sgit_ai/cli/CLI__Vault.py +403 -0
- sgit_ai-0.8.17/sgit_ai/cli/__init__.py +7 -0
- sgit_ai-0.8.17/sgit_ai/crypto/PKI__Crypto.py +153 -0
- sgit_ai-0.8.17/sgit_ai/crypto/Vault__Crypto.py +131 -0
- sgit_ai-0.8.17/sgit_ai/crypto/Vault__Key_Manager.py +79 -0
- sgit_ai-0.8.17/sgit_ai/crypto/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/objects/Vault__Commit.py +75 -0
- sgit_ai-0.8.17/sgit_ai/objects/Vault__Inspector.py +346 -0
- sgit_ai-0.8.17/sgit_ai/objects/Vault__Object_Store.py +64 -0
- sgit_ai-0.8.17/sgit_ai/objects/Vault__Ref_Manager.py +73 -0
- sgit_ai-0.8.17/sgit_ai/objects/__init__.py +1 -0
- sgit_ai-0.8.17/sgit_ai/pki/PKI__Key_Store.py +106 -0
- sgit_ai-0.8.17/sgit_ai/pki/PKI__Keyring.py +57 -0
- sgit_ai-0.8.17/sgit_ai/pki/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Enum__Batch_Op.py +7 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Enum__Branch_Type.py +5 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Enum__Provenance_Mode.py +6 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Enum__Sync_State.py +11 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Access_Token.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Author_Key_Id.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Base64_Data.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Base_URL.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Branch_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Branch_Name.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Commit_Message.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Content_Hash.py +16 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Content_Type.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Encrypted_Value.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__File_Id.py +16 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__File_Path.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__ISO_Timestamp.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Index_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Key_Fingerprint.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Key_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Object_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__PEM_Key.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Pending_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Ref_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__SHA256.py +16 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Schema_Version.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Secret_Key.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Signature.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Transfer_Id.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Vault_Id.py +21 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Vault_Key.py +15 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Vault_Name.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Vault_Passphrase.py +14 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Vault_Path.py +10 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_Str__Write_Key.py +16 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_UInt__File_Size.py +6 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_UInt__Key_Size.py +4 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_UInt__Lock_Timeout.py +6 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_UInt__Timestamp.py +4 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/Safe_UInt__Vault_Version.py +4 -0
- sgit_ai-0.8.17/sgit_ai/safe_types/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Batch_Operation.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Batch_Request.py +6 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Branch_Index.py +9 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Branch_Meta.py +18 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Change_Pack.py +20 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Local_Config.py +6 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Object_Commit.py +21 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Object_Ref.py +8 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Object_Tree.py +8 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Object_Tree_Entry.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__PKI_Key_Pair.py +14 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__PKI_Public_Key.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Remote_Config.py +10 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Secret_Entry.py +8 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Tracking_State.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Transfer_File.py +14 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Vault_Config.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Vault_Index.py +10 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Vault_Index_Entry.py +16 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Vault_Meta.py +12 -0
- sgit_ai-0.8.17/sgit_ai/schemas/Schema__Vault_Policy.py +10 -0
- sgit_ai-0.8.17/sgit_ai/schemas/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/secrets/Secrets__Store.py +65 -0
- sgit_ai-0.8.17/sgit_ai/secrets/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Bare.py +125 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Batch.py +131 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Branch_Manager.py +104 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Change_Pack.py +115 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Components.py +26 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Fetch.py +131 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__GC.py +113 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Ignore.py +136 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Merge.py +123 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Remote_Manager.py +58 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Storage.py +84 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Sub_Tree.py +265 -0
- sgit_ai-0.8.17/sgit_ai/sync/Vault__Sync.py +1365 -0
- sgit_ai-0.8.17/sgit_ai/sync/__init__.py +0 -0
- sgit_ai-0.8.17/sgit_ai/version +1 -0
sgit_ai-0.8.17/LICENSE
ADDED
|
@@ -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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 Additional Liability. 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 additional liability.
|
|
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 [yyyy] [name of copyright owner]
|
|
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 implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
sgit_ai-0.8.17/PKG-INFO
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sgit-ai
|
|
3
|
+
Version: 0.8.17
|
|
4
|
+
Summary: CLI tool for syncing encrypted vaults with SGit-AI
|
|
5
|
+
Home-page: https://github.com/SGit-AI/SGit-AI__CLI
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: sgit,sgit-ai,vault,encryption,cli,sync
|
|
8
|
+
Author: The Cyber Boardroom
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Security :: Cryptography
|
|
17
|
+
Requires-Dist: cryptography (>=43.0.0)
|
|
18
|
+
Requires-Dist: osbot-utils (>=3.70.0)
|
|
19
|
+
Project-URL: Repository, https://github.com/SGit-AI/SGit-AI__CLI
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# SGit-AI__CLI
|
|
23
|
+
|
|
24
|
+
CLI tool for syncing encrypted vaults with SGit-AI.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install sgit-ai
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Development
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
pytest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Architecture
|
|
40
|
+
|
|
41
|
+
- `sgit_ai/safe_types/` — Domain-specific Safe_* types (zero raw primitives)
|
|
42
|
+
- `sgit_ai/schemas/` — Pure data Type_Safe schemas
|
|
43
|
+
- `sgit_ai/crypto/` — AES-256-GCM encrypt/decrypt, PBKDF2, HKDF
|
|
44
|
+
- `sgit_ai/sync/` — Local ↔ remote vault sync
|
|
45
|
+
- `sgit_ai/api/` — SGit-AI Transfer API client
|
|
46
|
+
- `sgit_ai/cli/` — CLI commands
|
|
47
|
+
|
sgit_ai-0.8.17/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SGit-AI__CLI
|
|
2
|
+
|
|
3
|
+
CLI tool for syncing encrypted vaults with SGit-AI.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install sgit-ai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Development
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install -e ".[dev]"
|
|
15
|
+
pytest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
- `sgit_ai/safe_types/` — Domain-specific Safe_* types (zero raw primitives)
|
|
21
|
+
- `sgit_ai/schemas/` — Pure data Type_Safe schemas
|
|
22
|
+
- `sgit_ai/crypto/` — AES-256-GCM encrypt/decrypt, PBKDF2, HKDF
|
|
23
|
+
- `sgit_ai/sync/` — Local ↔ remote vault sync
|
|
24
|
+
- `sgit_ai/api/` — SGit-AI Transfer API client
|
|
25
|
+
- `sgit_ai/cli/` — CLI commands
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "sgit-ai"
|
|
3
|
+
version = "v0.8.17"
|
|
4
|
+
description = "CLI tool for syncing encrypted vaults with SGit-AI"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
authors = ["The Cyber Boardroom"]
|
|
8
|
+
keywords = ["sgit", "sgit-ai", "vault", "encryption", "cli", "sync"]
|
|
9
|
+
homepage = "https://github.com/SGit-AI/SGit-AI__CLI"
|
|
10
|
+
repository = "https://github.com/SGit-AI/SGit-AI__CLI"
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Topic :: Security :: Cryptography",
|
|
17
|
+
]
|
|
18
|
+
packages = [{ include = "sgit_ai" }]
|
|
19
|
+
|
|
20
|
+
[tool.poetry.dependencies]
|
|
21
|
+
python = ">=3.11"
|
|
22
|
+
osbot-utils = ">=3.70.0"
|
|
23
|
+
cryptography = ">=43.0.0"
|
|
24
|
+
|
|
25
|
+
[tool.poetry.group.dev.dependencies]
|
|
26
|
+
pytest = ">=8.0"
|
|
27
|
+
pytest-cov = ">=5.0"
|
|
28
|
+
|
|
29
|
+
[tool.poetry.scripts]
|
|
30
|
+
sgit-ai = "sgit_ai.cli:main"
|
|
31
|
+
sgit = "sgit_ai.cli:main"
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["poetry-core>=1.9.1"]
|
|
35
|
+
build-backend = "poetry.core.masonry.api"
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
testpaths = ["tests"]
|
|
39
|
+
addopts = "-v --tb=short --ignore=tests/qa"
|
|
40
|
+
python_files = "test_*.py"
|
|
41
|
+
python_classes = "Test_*"
|
|
42
|
+
python_functions = "test_*"
|
|
43
|
+
|
|
44
|
+
[tool.coverage.run]
|
|
45
|
+
source = ["sgit_ai"]
|
|
46
|
+
omit = ["tests/*"]
|
|
47
|
+
|
|
48
|
+
[tool.coverage.report]
|
|
49
|
+
show_missing = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from sgit_ai._version import VERSION
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = 'v0.1.0'
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from urllib.request import Request, urlopen
|
|
3
|
+
from urllib.error import HTTPError
|
|
4
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
5
|
+
from sgit_ai.safe_types.Safe_Str__Base_URL import Safe_Str__Base_URL
|
|
6
|
+
from sgit_ai.safe_types.Safe_Str__Access_Token import Safe_Str__Access_Token
|
|
7
|
+
|
|
8
|
+
DEFAULT_BASE_URL = 'https://dev.send.sgraph.ai'
|
|
9
|
+
LAMBDA_RESPONSE_LIMIT = 5 * 1024 * 1024 # 5MB
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class API__Transfer(Type_Safe):
|
|
13
|
+
base_url : Safe_Str__Base_URL = None
|
|
14
|
+
access_token : Safe_Str__Access_Token = None
|
|
15
|
+
debug_log : object = None
|
|
16
|
+
|
|
17
|
+
def setup(self):
|
|
18
|
+
if not self.base_url:
|
|
19
|
+
self.base_url = DEFAULT_BASE_URL
|
|
20
|
+
return self
|
|
21
|
+
|
|
22
|
+
# --- Transfer lifecycle ---
|
|
23
|
+
|
|
24
|
+
def create(self, file_size_bytes: int, content_type_hint: str = 'application/octet-stream') -> dict:
|
|
25
|
+
url = f'{self.base_url}/api/transfers/create'
|
|
26
|
+
body = json.dumps(dict(file_size_bytes=file_size_bytes, content_type_hint=content_type_hint)).encode()
|
|
27
|
+
return self._request_json('POST', url, self._auth_headers({'Content-Type': 'application/json'}), body)
|
|
28
|
+
|
|
29
|
+
def upload(self, transfer_id: str, encrypted_payload: bytes) -> dict:
|
|
30
|
+
url = f'{self.base_url}/api/transfers/upload/{transfer_id}'
|
|
31
|
+
headers = self._auth_headers({'Content-Type': 'application/octet-stream'})
|
|
32
|
+
return self._request_json('POST', url, headers, encrypted_payload)
|
|
33
|
+
|
|
34
|
+
def complete(self, transfer_id: str) -> dict:
|
|
35
|
+
url = f'{self.base_url}/api/transfers/complete/{transfer_id}'
|
|
36
|
+
return self._request_json('POST', url, self._auth_headers())
|
|
37
|
+
|
|
38
|
+
def info(self, transfer_id: str) -> dict:
|
|
39
|
+
url = f'{self.base_url}/api/transfers/info/{transfer_id}'
|
|
40
|
+
return self._request_json('GET', url)
|
|
41
|
+
|
|
42
|
+
def download(self, transfer_id: str) -> bytes:
|
|
43
|
+
url = f'{self.base_url}/api/transfers/download/{transfer_id}'
|
|
44
|
+
return self._request_bytes('GET', url)
|
|
45
|
+
|
|
46
|
+
def download_base64(self, transfer_id: str) -> dict:
|
|
47
|
+
url = f'{self.base_url}/api/transfers/download-base64/{transfer_id}'
|
|
48
|
+
return self._request_json('GET', url)
|
|
49
|
+
|
|
50
|
+
# --- Token management ---
|
|
51
|
+
|
|
52
|
+
def check_token(self, token_name: str) -> dict:
|
|
53
|
+
url = f'{self.base_url}/api/transfers/check-token/{token_name}'
|
|
54
|
+
return self._request_json('GET', url)
|
|
55
|
+
|
|
56
|
+
# --- Presigned (large file) operations ---
|
|
57
|
+
|
|
58
|
+
def presigned_capabilities(self) -> dict:
|
|
59
|
+
url = f'{self.base_url}/api/presigned/capabilities'
|
|
60
|
+
return self._request_json('GET', url)
|
|
61
|
+
|
|
62
|
+
def presigned_initiate(self, transfer_id: str, file_size_bytes: int, num_parts: int) -> dict:
|
|
63
|
+
url = f'{self.base_url}/api/presigned/initiate'
|
|
64
|
+
body = json.dumps(dict(transfer_id=transfer_id, file_size_bytes=file_size_bytes, num_parts=num_parts)).encode()
|
|
65
|
+
return self._request_json('POST', url, self._auth_headers({'Content-Type': 'application/json'}), body)
|
|
66
|
+
|
|
67
|
+
def presigned_complete(self, transfer_id: str, upload_id: str, parts: list) -> dict:
|
|
68
|
+
url = f'{self.base_url}/api/presigned/complete'
|
|
69
|
+
body = json.dumps(dict(transfer_id=transfer_id, upload_id=upload_id, parts=parts)).encode()
|
|
70
|
+
return self._request_json('POST', url, self._auth_headers({'Content-Type': 'application/json'}), body)
|
|
71
|
+
|
|
72
|
+
def presigned_abort(self, transfer_id: str, upload_id: str) -> dict:
|
|
73
|
+
url = f'{self.base_url}/api/presigned/abort/{transfer_id}/{upload_id}'
|
|
74
|
+
return self._request_json('POST', url, self._auth_headers())
|
|
75
|
+
|
|
76
|
+
def presigned_upload_url(self, transfer_id: str) -> dict:
|
|
77
|
+
url = f'{self.base_url}/api/presigned/upload-url/{transfer_id}'
|
|
78
|
+
return self._request_json('GET', url, self._auth_headers())
|
|
79
|
+
|
|
80
|
+
def presigned_download_url(self, transfer_id: str) -> dict:
|
|
81
|
+
url = f'{self.base_url}/api/presigned/download-url/{transfer_id}'
|
|
82
|
+
return self._request_json('GET', url)
|
|
83
|
+
|
|
84
|
+
# --- Upload a presigned part directly to S3 ---
|
|
85
|
+
|
|
86
|
+
def upload_part(self, upload_url: str, part_data: bytes) -> str:
|
|
87
|
+
req = Request(upload_url, data=part_data, method='PUT')
|
|
88
|
+
req.add_header('Content-Type', 'application/octet-stream')
|
|
89
|
+
entry = self.debug_log.log_request('PUT', upload_url, len(part_data)) if self.debug_log else None
|
|
90
|
+
try:
|
|
91
|
+
with urlopen(req) as response:
|
|
92
|
+
if entry:
|
|
93
|
+
self.debug_log.log_response(entry, response.status, 0)
|
|
94
|
+
return response.headers.get('ETag', '')
|
|
95
|
+
except HTTPError as e:
|
|
96
|
+
if entry:
|
|
97
|
+
self.debug_log.log_error(entry, e.code, e.reason)
|
|
98
|
+
raise self._api_error('PUT', upload_url, {}, e, data_size=len(part_data))
|
|
99
|
+
|
|
100
|
+
# --- High-level helpers ---
|
|
101
|
+
|
|
102
|
+
def upload_file(self, encrypted_payload: bytes) -> str:
|
|
103
|
+
resp = self.create(len(encrypted_payload))
|
|
104
|
+
transfer_id = resp['transfer_id']
|
|
105
|
+
|
|
106
|
+
if len(encrypted_payload) <= LAMBDA_RESPONSE_LIMIT:
|
|
107
|
+
self.upload(transfer_id, encrypted_payload)
|
|
108
|
+
else:
|
|
109
|
+
self._upload_large(transfer_id, encrypted_payload)
|
|
110
|
+
|
|
111
|
+
self.complete(transfer_id)
|
|
112
|
+
return transfer_id
|
|
113
|
+
|
|
114
|
+
def download_file(self, transfer_id: str) -> bytes:
|
|
115
|
+
info = self.info(transfer_id)
|
|
116
|
+
size = info.get('file_size_bytes', 0)
|
|
117
|
+
|
|
118
|
+
if size <= LAMBDA_RESPONSE_LIMIT:
|
|
119
|
+
return self.download(transfer_id)
|
|
120
|
+
else:
|
|
121
|
+
resp = self.presigned_download_url(transfer_id)
|
|
122
|
+
return self._request_bytes('GET', resp['download_url'])
|
|
123
|
+
|
|
124
|
+
# --- Internal ---
|
|
125
|
+
|
|
126
|
+
def _upload_large(self, transfer_id: str, payload: bytes):
|
|
127
|
+
caps = self.presigned_capabilities()
|
|
128
|
+
if not caps.get('presigned_available'):
|
|
129
|
+
raise RuntimeError('Server does not support presigned uploads for large files')
|
|
130
|
+
|
|
131
|
+
min_part = caps.get('min_part_size_bytes', 5 * 1024 * 1024)
|
|
132
|
+
max_part = caps.get('max_part_size_bytes', 100 * 1024 * 1024)
|
|
133
|
+
part_size = max(min_part, min(max_part, len(payload) // 10))
|
|
134
|
+
num_parts = (len(payload) + part_size - 1) // part_size
|
|
135
|
+
|
|
136
|
+
resp = self.presigned_initiate(transfer_id, len(payload), num_parts)
|
|
137
|
+
upload_id = resp['upload_id']
|
|
138
|
+
parts = resp['parts']
|
|
139
|
+
|
|
140
|
+
completed_parts = []
|
|
141
|
+
try:
|
|
142
|
+
for part_info in parts:
|
|
143
|
+
part_num = part_info['part_number']
|
|
144
|
+
start = (part_num - 1) * part_size
|
|
145
|
+
end = min(start + part_size, len(payload))
|
|
146
|
+
part_data = payload[start:end]
|
|
147
|
+
etag = self.upload_part(part_info['upload_url'], part_data)
|
|
148
|
+
completed_parts.append(dict(part_number=part_num, etag=etag))
|
|
149
|
+
|
|
150
|
+
self.presigned_complete(transfer_id, upload_id, completed_parts)
|
|
151
|
+
except Exception:
|
|
152
|
+
self.presigned_abort(transfer_id, upload_id)
|
|
153
|
+
raise
|
|
154
|
+
|
|
155
|
+
def _auth_headers(self, extra: dict = None) -> dict:
|
|
156
|
+
headers = {}
|
|
157
|
+
if self.access_token:
|
|
158
|
+
headers['x-sgraph-access-token'] = str(self.access_token)
|
|
159
|
+
if extra:
|
|
160
|
+
headers.update(extra)
|
|
161
|
+
return headers
|
|
162
|
+
|
|
163
|
+
def _request_json(self, method: str, url: str, headers: dict = None, data: bytes = None) -> dict:
|
|
164
|
+
req = Request(url, data=data, method=method)
|
|
165
|
+
for key, value in (headers or {}).items():
|
|
166
|
+
req.add_header(key, str(value))
|
|
167
|
+
entry = self.debug_log.log_request(method, url, len(data) if data else 0) if self.debug_log else None
|
|
168
|
+
try:
|
|
169
|
+
with urlopen(req) as response:
|
|
170
|
+
body = response.read()
|
|
171
|
+
if entry:
|
|
172
|
+
self.debug_log.log_response(entry, response.status, len(body))
|
|
173
|
+
if body:
|
|
174
|
+
return json.loads(body)
|
|
175
|
+
return {}
|
|
176
|
+
except HTTPError as e:
|
|
177
|
+
if entry:
|
|
178
|
+
self.debug_log.log_error(entry, e.code, e.reason)
|
|
179
|
+
raise self._api_error(method, url, headers, e, data_size=len(data) if data else 0)
|
|
180
|
+
|
|
181
|
+
def _request_bytes(self, method: str, url: str, headers: dict = None) -> bytes:
|
|
182
|
+
req = Request(url, method=method)
|
|
183
|
+
for key, value in (headers or {}).items():
|
|
184
|
+
req.add_header(key, str(value))
|
|
185
|
+
entry = self.debug_log.log_request(method, url) if self.debug_log else None
|
|
186
|
+
try:
|
|
187
|
+
with urlopen(req) as response:
|
|
188
|
+
body = response.read()
|
|
189
|
+
if entry:
|
|
190
|
+
self.debug_log.log_response(entry, response.status, len(body))
|
|
191
|
+
return body
|
|
192
|
+
except HTTPError as e:
|
|
193
|
+
if entry:
|
|
194
|
+
self.debug_log.log_error(entry, e.code, e.reason)
|
|
195
|
+
raise self._api_error(method, url, headers, e)
|
|
196
|
+
|
|
197
|
+
def _api_error(self, method: str, url: str, headers: dict, error: HTTPError, data_size: int = 0) -> Exception:
|
|
198
|
+
response_body = ''
|
|
199
|
+
try:
|
|
200
|
+
response_body = error.read().decode('utf-8', errors='replace')
|
|
201
|
+
except Exception:
|
|
202
|
+
pass
|
|
203
|
+
|
|
204
|
+
masked_headers = {}
|
|
205
|
+
for k, v in (headers or {}).items():
|
|
206
|
+
if 'token' in k.lower() or 'key' in k.lower():
|
|
207
|
+
masked_headers[k] = f'{str(v)[:8]}...({len(str(v))} chars)'
|
|
208
|
+
else:
|
|
209
|
+
masked_headers[k] = v
|
|
210
|
+
|
|
211
|
+
lines = [f'API Error: HTTP {error.code} {error.reason}',
|
|
212
|
+
f' Request: {method} {url}',
|
|
213
|
+
f' Headers: {json.dumps(masked_headers, indent=2)}']
|
|
214
|
+
if data_size:
|
|
215
|
+
lines.append(f' Payload: {data_size} bytes')
|
|
216
|
+
if response_body:
|
|
217
|
+
lines.append(f' Response: {response_body}')
|
|
218
|
+
|
|
219
|
+
return RuntimeError('\n'.join(lines))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import struct
|
|
3
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
|
4
|
+
|
|
5
|
+
SGMETA_MAGIC = bytes([0x53, 0x47, 0x4D, 0x45, 0x54, 0x41, 0x00]) # ASCII: SGMETA\0
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Transfer__Envelope(Type_Safe):
|
|
9
|
+
|
|
10
|
+
def package(self, content: bytes, filename: str) -> bytes:
|
|
11
|
+
meta_bytes = json.dumps({"filename": filename}).encode('utf-8')
|
|
12
|
+
meta_len = struct.pack('>I', len(meta_bytes))
|
|
13
|
+
return SGMETA_MAGIC + meta_len + meta_bytes + content
|
|
14
|
+
|
|
15
|
+
def unpackage(self, data: bytes) -> tuple:
|
|
16
|
+
if len(data) < len(SGMETA_MAGIC) + 4:
|
|
17
|
+
return None, data
|
|
18
|
+
if data[:len(SGMETA_MAGIC)] != SGMETA_MAGIC:
|
|
19
|
+
return None, data
|
|
20
|
+
meta_start = len(SGMETA_MAGIC)
|
|
21
|
+
meta_len = struct.unpack('>I', data[meta_start:meta_start + 4])[0]
|
|
22
|
+
content_start = meta_start + 4 + meta_len
|
|
23
|
+
if content_start > len(data):
|
|
24
|
+
return None, data
|
|
25
|
+
try:
|
|
26
|
+
metadata = json.loads(data[meta_start + 4:content_start].decode('utf-8'))
|
|
27
|
+
return metadata, data[content_start:]
|
|
28
|
+
except Exception:
|
|
29
|
+
return None, data
|