mirrorcommons 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mirror Commons
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.4
2
+ Name: mirrorcommons
3
+ Version: 0.1.0
4
+ Summary: CLI for Mirror Commons: create continuity manifests for external AI artifacts and publish reviewed community mirrors.
5
+ Author: Mirror Commons
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://mirrorcommons.com
8
+ Project-URL: Source, https://github.com/Hashem-Al-Qurashi/mirrorcommons-cli
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Environment :: Console
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: huggingface_hub>=0.30
16
+ Provides-Extra: s3
17
+ Requires-Dist: boto3>=1.35; extra == "s3"
18
+ Dynamic: license-file
19
+
20
+ # ArtifactGrid CLI
21
+
22
+ `mirrorcommons` is the public-facing command alias for this package; `artifactgrid` remains available for continuity-report compatibility. The same CLI powers Mirror Commons publisher submissions and ArtifactGrid private continuity reports.
23
+
24
+ This local-first CLI creates a private Consumer Continuity Report for a third-party public Hugging Face dependency. It can download an exact pinned revision or validate a snapshot you already hold. ArtifactGrid does not receive cloud credentials or host model weights.
25
+
26
+ Supported V1 files are `.safetensors`, `.json`, `.md`, `.txt`, and `.model`, plus a root `LICENSE` file. If a root `LICENSE`, `LICENSE.md`, or `LICENSE.txt` is present, the manifest records its path and SHA-256 as a factual observation. This is not a legal review. Symlinks and unsupported formats are deliberately skipped; ArtifactGrid never loads model code or unsafe serialized formats.
27
+
28
+ ## Run locally
29
+
30
+ ```bash
31
+ cd cli
32
+ python3 -m pip install -e .
33
+ artifactgrid inspect \
34
+ --source-url https://huggingface.co/owner/repository \
35
+ --revision <full-40-character-commit> \
36
+ --download
37
+ ```
38
+
39
+ For a public Mirror Commons submission, use the identical command with the `mirrorcommons` alias:
40
+
41
+ ```bash
42
+ mirrorcommons publish create --help
43
+ ```
44
+
45
+ The local workflow needs no cloud-storage package. Install the optional S3 support only when using S3 or R2:
46
+
47
+ ```bash
48
+ python3 -m pip install -e '.[s3]'
49
+ ```
50
+
51
+ Use `--snapshot-dir ./snapshot` instead of `--download` when the customer has already retrieved the pinned snapshot.
52
+
53
+ With `--download`, ArtifactGrid materializes ordinary files in a temporary directory so Hugging Face cache symlinks and local `.cache` metadata cannot enter the manifest. The CLI removes that temporary directory after `inspect` or `protect` finishes.
54
+
55
+ Record whether the upstream public source currently resolves to the exact pinned commit. This uses Hugging Face's public API without a user token and does not download model weights:
56
+
57
+ ```bash
58
+ artifactgrid source-check \
59
+ --source-url https://huggingface.co/owner/repository \
60
+ --revision <full-40-character-commit> \
61
+ --output ./source-observation.json
62
+ ```
63
+
64
+ Create a customer-attested backup in a directory the customer controls:
65
+
66
+ ```bash
67
+ artifactgrid protect \
68
+ --source-url https://huggingface.co/owner/repository \
69
+ --revision <full-40-character-commit> \
70
+ --download \
71
+ --backup-dir ./customer-backup \
72
+ --output ./continuity-manifest.json
73
+ ```
74
+
75
+ `--output` is optional. It writes a portable copy of the same manifest kept with the customer backup.
76
+
77
+ Or copy directly into customer-controlled R2/S3. The CLI uses the customer's standard local AWS credential chain or environment variables and never sends them to ArtifactGrid:
78
+
79
+ ```bash
80
+ artifactgrid protect \
81
+ --source-url https://huggingface.co/owner/repository \
82
+ --revision <full-40-character-commit> \
83
+ --snapshot-dir ./snapshot \
84
+ --s3-bucket customer-ai-artifacts \
85
+ --s3-prefix artifactgrid/production-model \
86
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
87
+ --output ./continuity-manifest.json
88
+ ```
89
+
90
+ Verify a recovery copy:
91
+
92
+ ```bash
93
+ artifactgrid verify \
94
+ --manifest ./customer-backup/artifactgrid-manifest.json \
95
+ --backup-dir ./customer-backup
96
+ ```
97
+
98
+ With scoped read access, verify every protected S3/R2 object directly:
99
+
100
+ ```bash
101
+ artifactgrid verify \
102
+ --manifest ./continuity-manifest.json \
103
+ --s3-bucket customer-ai-artifacts \
104
+ --s3-prefix artifactgrid/production-model \
105
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com
106
+ ```
107
+
108
+ Run a clean restore drill into an empty directory, then produce a private portable report:
109
+
110
+ ```bash
111
+ artifactgrid restore \
112
+ --manifest ./customer-backup/artifactgrid-manifest.json \
113
+ --backup-dir ./customer-backup \
114
+ --restore-dir ./restore-drill
115
+
116
+ artifactgrid report \
117
+ --manifest ./customer-backup/artifactgrid-manifest.json \
118
+ --backup-dir ./customer-backup \
119
+ --restore-result ./restore-drill/artifactgrid-restore-result.json \
120
+ --source-observation ./source-observation.json \
121
+ --output ./continuity-report.html
122
+ ```
123
+
124
+ `--source-observation` is optional. When provided, ArtifactGrid accepts it only when it proves that the same repository and exact pinned revision were reachable at the recorded time.
125
+
126
+ You can run the same clean recovery drill directly from customer-controlled R2/S3. The CLI first streams and checksum-verifies every declared object, then restores the allowlisted files into the empty destination and rechecks the restored copy:
127
+
128
+ ```bash
129
+ artifactgrid restore \
130
+ --manifest ./continuity-manifest.json \
131
+ --s3-bucket customer-ai-artifacts \
132
+ --s3-prefix artifactgrid/production-model \
133
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
134
+ --restore-dir ./restore-drill
135
+ ```
136
+
137
+ Generate the private report directly from that same verified S3/R2 copy. Add `--restore-result ./restore-drill/artifactgrid-restore-result.json` after running the drill to include its outcome:
138
+
139
+ ```bash
140
+ artifactgrid report \
141
+ --manifest ./continuity-manifest.json \
142
+ --s3-bucket customer-ai-artifacts \
143
+ --s3-prefix artifactgrid/production-model \
144
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
145
+ --source-observation ./source-observation.json \
146
+ --output ./continuity-report.html
147
+ ```
148
+
149
+ `customer_attested` means the CLI copied and immediately verified the listed files in customer-controlled storage. It is not an ArtifactGrid independently verified storage claim. A Consumer Continuity Report never asserts repository control, publisher ownership, or redistribution legality.
150
+
151
+ ## Commons publisher workflow
152
+
153
+ The same control plane powers the web contributor workspace and the CLI. This CLI does not save a token; obtain a short-lived token from the configured production sign-in flow and supply it only through your current shell:
154
+
155
+ ```bash
156
+ export ARTIFACTGRID_TOKEN='<short-lived-token>'
157
+
158
+ artifactgrid publish create \
159
+ --slug acme-model \
160
+ --display-name 'Acme Model' \
161
+ --declared-license apache-2.0 \
162
+ --origin source_mirror \
163
+ --source-url https://huggingface.co/acme/model \
164
+ --revision <full-40-character-commit>
165
+
166
+ artifactgrid publish source-challenge --draft <mirror-id>
167
+ # Commit the returned JSON token to .artifactgrid/controller.json at that exact revision.
168
+ artifactgrid publish verify-source --draft <mirror-id>
169
+
170
+ artifactgrid publish inspect \
171
+ --snapshot-dir ./model \
172
+ --slug acme-model \
173
+ --origin source_mirror \
174
+ --source-control official_source_controller_verified \
175
+ --source-url https://huggingface.co/acme/model \
176
+ --revision <full-40-character-commit> \
177
+ --output ./publisher-mirror-manifest.json
178
+
179
+ artifactgrid publish upload \
180
+ --draft <mirror-id> \
181
+ --manifest ./publisher-mirror-manifest.json \
182
+ --snapshot-dir ./model
183
+
184
+ artifactgrid publish status --draft <mirror-id>
185
+ ```
186
+
187
+ To propose a third-party model as a **community mirror**, use the same pinned source details but do not run a controller challenge. The resulting record truthfully says that upstream repository control is not claimed; it stays private until review decides whether it is eligible for the Commons.
188
+
189
+ ```bash
190
+ artifactgrid publish create \
191
+ --slug community-model \
192
+ --display-name 'Community Model' \
193
+ --declared-license apache-2.0 \
194
+ --origin community_mirror \
195
+ --source-url https://huggingface.co/vendor/model \
196
+ --revision <full-40-character-commit>
197
+
198
+ artifactgrid publish inspect \
199
+ --snapshot-dir ./model \
200
+ --slug community-model \
201
+ --origin community_mirror \
202
+ --source-control not_claimed \
203
+ --source-url https://huggingface.co/vendor/model \
204
+ --revision <full-40-character-commit> \
205
+ --output ./publisher-mirror-manifest.json
206
+ ```
207
+
208
+ For original work, use `--origin original_creator_submission` and `--source-control not_applicable`, without a third-party source URL or revision. It is intentionally labeled as an original-creator submission, not as repository-controller verified.
209
+
210
+ `publish upload` obtains only short-lived per-file R2 PUT URLs from ArtifactGrid, streams the declared files to its private staging prefix, and then submits the staging inventory for review. A completed upload becomes `review_required`; it is never automatically public.
211
+
212
+ Configured reviewers use the same short-lived-token mechanism for the explicit two-step decision and publication action:
213
+
214
+ ```bash
215
+ artifactgrid review decision --case <review-case-id> --decision approved
216
+ artifactgrid review publish --mirror <mirror-id>
217
+ ```
218
+
219
+ `review publish` copies an approved staged version server-side into the versioned public Commons prefix and writes its public manifest. Restricting or rejecting a review case never creates a public model page.
@@ -0,0 +1,200 @@
1
+ # ArtifactGrid CLI
2
+
3
+ `mirrorcommons` is the public-facing command alias for this package; `artifactgrid` remains available for continuity-report compatibility. The same CLI powers Mirror Commons publisher submissions and ArtifactGrid private continuity reports.
4
+
5
+ This local-first CLI creates a private Consumer Continuity Report for a third-party public Hugging Face dependency. It can download an exact pinned revision or validate a snapshot you already hold. ArtifactGrid does not receive cloud credentials or host model weights.
6
+
7
+ Supported V1 files are `.safetensors`, `.json`, `.md`, `.txt`, and `.model`, plus a root `LICENSE` file. If a root `LICENSE`, `LICENSE.md`, or `LICENSE.txt` is present, the manifest records its path and SHA-256 as a factual observation. This is not a legal review. Symlinks and unsupported formats are deliberately skipped; ArtifactGrid never loads model code or unsafe serialized formats.
8
+
9
+ ## Run locally
10
+
11
+ ```bash
12
+ cd cli
13
+ python3 -m pip install -e .
14
+ artifactgrid inspect \
15
+ --source-url https://huggingface.co/owner/repository \
16
+ --revision <full-40-character-commit> \
17
+ --download
18
+ ```
19
+
20
+ For a public Mirror Commons submission, use the identical command with the `mirrorcommons` alias:
21
+
22
+ ```bash
23
+ mirrorcommons publish create --help
24
+ ```
25
+
26
+ The local workflow needs no cloud-storage package. Install the optional S3 support only when using S3 or R2:
27
+
28
+ ```bash
29
+ python3 -m pip install -e '.[s3]'
30
+ ```
31
+
32
+ Use `--snapshot-dir ./snapshot` instead of `--download` when the customer has already retrieved the pinned snapshot.
33
+
34
+ With `--download`, ArtifactGrid materializes ordinary files in a temporary directory so Hugging Face cache symlinks and local `.cache` metadata cannot enter the manifest. The CLI removes that temporary directory after `inspect` or `protect` finishes.
35
+
36
+ Record whether the upstream public source currently resolves to the exact pinned commit. This uses Hugging Face's public API without a user token and does not download model weights:
37
+
38
+ ```bash
39
+ artifactgrid source-check \
40
+ --source-url https://huggingface.co/owner/repository \
41
+ --revision <full-40-character-commit> \
42
+ --output ./source-observation.json
43
+ ```
44
+
45
+ Create a customer-attested backup in a directory the customer controls:
46
+
47
+ ```bash
48
+ artifactgrid protect \
49
+ --source-url https://huggingface.co/owner/repository \
50
+ --revision <full-40-character-commit> \
51
+ --download \
52
+ --backup-dir ./customer-backup \
53
+ --output ./continuity-manifest.json
54
+ ```
55
+
56
+ `--output` is optional. It writes a portable copy of the same manifest kept with the customer backup.
57
+
58
+ Or copy directly into customer-controlled R2/S3. The CLI uses the customer's standard local AWS credential chain or environment variables and never sends them to ArtifactGrid:
59
+
60
+ ```bash
61
+ artifactgrid protect \
62
+ --source-url https://huggingface.co/owner/repository \
63
+ --revision <full-40-character-commit> \
64
+ --snapshot-dir ./snapshot \
65
+ --s3-bucket customer-ai-artifacts \
66
+ --s3-prefix artifactgrid/production-model \
67
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
68
+ --output ./continuity-manifest.json
69
+ ```
70
+
71
+ Verify a recovery copy:
72
+
73
+ ```bash
74
+ artifactgrid verify \
75
+ --manifest ./customer-backup/artifactgrid-manifest.json \
76
+ --backup-dir ./customer-backup
77
+ ```
78
+
79
+ With scoped read access, verify every protected S3/R2 object directly:
80
+
81
+ ```bash
82
+ artifactgrid verify \
83
+ --manifest ./continuity-manifest.json \
84
+ --s3-bucket customer-ai-artifacts \
85
+ --s3-prefix artifactgrid/production-model \
86
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com
87
+ ```
88
+
89
+ Run a clean restore drill into an empty directory, then produce a private portable report:
90
+
91
+ ```bash
92
+ artifactgrid restore \
93
+ --manifest ./customer-backup/artifactgrid-manifest.json \
94
+ --backup-dir ./customer-backup \
95
+ --restore-dir ./restore-drill
96
+
97
+ artifactgrid report \
98
+ --manifest ./customer-backup/artifactgrid-manifest.json \
99
+ --backup-dir ./customer-backup \
100
+ --restore-result ./restore-drill/artifactgrid-restore-result.json \
101
+ --source-observation ./source-observation.json \
102
+ --output ./continuity-report.html
103
+ ```
104
+
105
+ `--source-observation` is optional. When provided, ArtifactGrid accepts it only when it proves that the same repository and exact pinned revision were reachable at the recorded time.
106
+
107
+ You can run the same clean recovery drill directly from customer-controlled R2/S3. The CLI first streams and checksum-verifies every declared object, then restores the allowlisted files into the empty destination and rechecks the restored copy:
108
+
109
+ ```bash
110
+ artifactgrid restore \
111
+ --manifest ./continuity-manifest.json \
112
+ --s3-bucket customer-ai-artifacts \
113
+ --s3-prefix artifactgrid/production-model \
114
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
115
+ --restore-dir ./restore-drill
116
+ ```
117
+
118
+ Generate the private report directly from that same verified S3/R2 copy. Add `--restore-result ./restore-drill/artifactgrid-restore-result.json` after running the drill to include its outcome:
119
+
120
+ ```bash
121
+ artifactgrid report \
122
+ --manifest ./continuity-manifest.json \
123
+ --s3-bucket customer-ai-artifacts \
124
+ --s3-prefix artifactgrid/production-model \
125
+ --s3-endpoint-url https://<account-id>.r2.cloudflarestorage.com \
126
+ --source-observation ./source-observation.json \
127
+ --output ./continuity-report.html
128
+ ```
129
+
130
+ `customer_attested` means the CLI copied and immediately verified the listed files in customer-controlled storage. It is not an ArtifactGrid independently verified storage claim. A Consumer Continuity Report never asserts repository control, publisher ownership, or redistribution legality.
131
+
132
+ ## Commons publisher workflow
133
+
134
+ The same control plane powers the web contributor workspace and the CLI. This CLI does not save a token; obtain a short-lived token from the configured production sign-in flow and supply it only through your current shell:
135
+
136
+ ```bash
137
+ export ARTIFACTGRID_TOKEN='<short-lived-token>'
138
+
139
+ artifactgrid publish create \
140
+ --slug acme-model \
141
+ --display-name 'Acme Model' \
142
+ --declared-license apache-2.0 \
143
+ --origin source_mirror \
144
+ --source-url https://huggingface.co/acme/model \
145
+ --revision <full-40-character-commit>
146
+
147
+ artifactgrid publish source-challenge --draft <mirror-id>
148
+ # Commit the returned JSON token to .artifactgrid/controller.json at that exact revision.
149
+ artifactgrid publish verify-source --draft <mirror-id>
150
+
151
+ artifactgrid publish inspect \
152
+ --snapshot-dir ./model \
153
+ --slug acme-model \
154
+ --origin source_mirror \
155
+ --source-control official_source_controller_verified \
156
+ --source-url https://huggingface.co/acme/model \
157
+ --revision <full-40-character-commit> \
158
+ --output ./publisher-mirror-manifest.json
159
+
160
+ artifactgrid publish upload \
161
+ --draft <mirror-id> \
162
+ --manifest ./publisher-mirror-manifest.json \
163
+ --snapshot-dir ./model
164
+
165
+ artifactgrid publish status --draft <mirror-id>
166
+ ```
167
+
168
+ To propose a third-party model as a **community mirror**, use the same pinned source details but do not run a controller challenge. The resulting record truthfully says that upstream repository control is not claimed; it stays private until review decides whether it is eligible for the Commons.
169
+
170
+ ```bash
171
+ artifactgrid publish create \
172
+ --slug community-model \
173
+ --display-name 'Community Model' \
174
+ --declared-license apache-2.0 \
175
+ --origin community_mirror \
176
+ --source-url https://huggingface.co/vendor/model \
177
+ --revision <full-40-character-commit>
178
+
179
+ artifactgrid publish inspect \
180
+ --snapshot-dir ./model \
181
+ --slug community-model \
182
+ --origin community_mirror \
183
+ --source-control not_claimed \
184
+ --source-url https://huggingface.co/vendor/model \
185
+ --revision <full-40-character-commit> \
186
+ --output ./publisher-mirror-manifest.json
187
+ ```
188
+
189
+ For original work, use `--origin original_creator_submission` and `--source-control not_applicable`, without a third-party source URL or revision. It is intentionally labeled as an original-creator submission, not as repository-controller verified.
190
+
191
+ `publish upload` obtains only short-lived per-file R2 PUT URLs from ArtifactGrid, streams the declared files to its private staging prefix, and then submits the staging inventory for review. A completed upload becomes `review_required`; it is never automatically public.
192
+
193
+ Configured reviewers use the same short-lived-token mechanism for the explicit two-step decision and publication action:
194
+
195
+ ```bash
196
+ artifactgrid review decision --case <review-case-id> --decision approved
197
+ artifactgrid review publish --mirror <mirror-id>
198
+ ```
199
+
200
+ `review publish` copies an approved staged version server-side into the versioned public Commons prefix and writes its public manifest. Restricting or rejecting a review case never creates a public model page.
@@ -0,0 +1,3 @@
1
+ """ArtifactGrid continuity manifest tools."""
2
+
3
+ __version__ = "0.1.0"