gitcx 0.1.0a3__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.
Files changed (49) hide show
  1. gitcx-0.1.0a3/IMPLEMENTATION_PLAN.md +242 -0
  2. gitcx-0.1.0a3/LICENSE +21 -0
  3. gitcx-0.1.0a3/PKG-INFO +76 -0
  4. gitcx-0.1.0a3/README.md +60 -0
  5. gitcx-0.1.0a3/docs/authentication.md +82 -0
  6. gitcx-0.1.0a3/docs/backend-sources.json +65 -0
  7. gitcx-0.1.0a3/docs/catalog.md +50 -0
  8. gitcx-0.1.0a3/docs/hosting-acceptance.md +58 -0
  9. gitcx-0.1.0a3/docs/installation.md +58 -0
  10. gitcx-0.1.0a3/docs/management-api.md +74 -0
  11. gitcx-0.1.0a3/docs/migration.md +43 -0
  12. gitcx-0.1.0a3/docs/permissions.md +56 -0
  13. gitcx-0.1.0a3/docs/provisioning.md +29 -0
  14. gitcx-0.1.0a3/docs/receive.md +74 -0
  15. gitcx-0.1.0a3/docs/ref-policy.md +53 -0
  16. gitcx-0.1.0a3/docs/releases.md +58 -0
  17. gitcx-0.1.0a3/docs/smart-http.md +85 -0
  18. gitcx-0.1.0a3/pyproject.toml +37 -0
  19. gitcx-0.1.0a3/pyproject.toml.orig +31 -0
  20. gitcx-0.1.0a3/scripts/accept_hosting.py +201 -0
  21. gitcx-0.1.0a3/scripts/check_distribution.py +70 -0
  22. gitcx-0.1.0a3/scripts/check_release.py +61 -0
  23. gitcx-0.1.0a3/src/gitcx/__init__.py +34 -0
  24. gitcx-0.1.0a3/src/gitcx/__main__.py +3 -0
  25. gitcx-0.1.0a3/src/gitcx/authentication.py +128 -0
  26. gitcx-0.1.0a3/src/gitcx/backend.py +38 -0
  27. gitcx-0.1.0a3/src/gitcx/branch_policy.py +49 -0
  28. gitcx-0.1.0a3/src/gitcx/catalog.py +470 -0
  29. gitcx-0.1.0a3/src/gitcx/cli.py +23 -0
  30. gitcx-0.1.0a3/src/gitcx/domain.py +145 -0
  31. gitcx-0.1.0a3/src/gitcx/git_http.py +211 -0
  32. gitcx-0.1.0a3/src/gitcx/management.py +196 -0
  33. gitcx-0.1.0a3/src/gitcx/permissions.py +52 -0
  34. gitcx-0.1.0a3/src/gitcx/provisioning.py +118 -0
  35. gitcx-0.1.0a3/src/gitcx/py.typed +0 -0
  36. gitcx-0.1.0a3/src/gitcx/receive.py +151 -0
  37. gitcx-0.1.0a3/src/gitcx/ref_policy.py +151 -0
  38. gitcx-0.1.0a3/tests/test_authentication.py +189 -0
  39. gitcx-0.1.0a3/tests/test_backend_profile.py +62 -0
  40. gitcx-0.1.0a3/tests/test_catalog.py +167 -0
  41. gitcx-0.1.0a3/tests/test_domain.py +52 -0
  42. gitcx-0.1.0a3/tests/test_git_http.py +201 -0
  43. gitcx-0.1.0a3/tests/test_hosting_acceptance.py +53 -0
  44. gitcx-0.1.0a3/tests/test_management.py +146 -0
  45. gitcx-0.1.0a3/tests/test_permissions.py +94 -0
  46. gitcx-0.1.0a3/tests/test_provisioning.py +93 -0
  47. gitcx-0.1.0a3/tests/test_receive.py +175 -0
  48. gitcx-0.1.0a3/tests/test_receive_http.py +114 -0
  49. gitcx-0.1.0a3/tests/test_ref_policy.py +241 -0
@@ -0,0 +1,242 @@
1
+ # Gitcx implementation plan
2
+
3
+ ## CAT-09 local acceptance (27 November 2026)
4
+
5
+ The repeatable [two-user runner](docs/hosting-acceptance.md) uses temporary state
6
+ and real stock Git against loopback HTTP. It qualifies native SHA-256 clone,
7
+ commit, main/feature pushes, second-user fetch, protected/outsider refusal and
8
+ restart; SHA-1 stays trusted-local/read-only with early hosted-write refusal.
9
+ Source/wheel/sdist receipts retain the exact engine/framework selection and
10
+ unsupported limits. Unqualified platforms explicitly select read-only acceptance.
11
+
12
+ ## CAT-08 hosted receive (27 November 2026)
13
+
14
+ Source adds authenticated SHA-256 receive-pack through explicit untrusted Linux
15
+ descriptor intake. Intake-overlay policy is repeated inside catalog exclusion
16
+ and deterministic ref locks, with expected-old CAS and truthful per-ref reports.
17
+ Schema 6 retains prepared/outcome receipts with audit/outbox; interrupted Git
18
+ publication has explicit administrator recovery and unknown requests remain
19
+ unknown. SHA-1/unqualified platform refusal precedes body reads. Source tests
20
+ cover native pushes, races, bounds and recovery; installed qualification selects
21
+ the immutable engine guard/codec revision in backend-sources.json. See
22
+ [hosted receive](docs/receive.md). Publication/deployment remain separate.
23
+
24
+ ## CAT-07 read-serving batch (26 November 2026)
25
+
26
+ Add smart-HTTP discovery/upload-pack routes to the existing Expose API app.
27
+ Gitdx CAT-07A owns all protocol and pack logic. Authorize opaque repository IDs
28
+ before storage access, allow anonymous public reads, and use scoped/revocable
29
+ tokens through explicit Bearer or Basic transport. Recheck after body reads and
30
+ before disclosure. Bound request bodies, concurrent preparations, graph/output
31
+ work and disconnect cleanup. Qualify stock Git clone/fetch in both hashes and
32
+ all three protocols, empty repositories, branches/tags and concealed private
33
+ resources. Keep management JSON limits independent. Select the qualified engine
34
+ by immutable source revision until a separate package release is authorized;
35
+ record published-versus-main status and qualify both installed artifacts.
36
+
37
+ Baseline: 22 November 2026. Python 3.14+, MIT, public source.
38
+ The [shared Gitdx → Gitcx plan](https://github.com/wispsy/gitdx/blob/main/IMPLEMENTATION_PLAN.md)
39
+ owns the complete engine/hosting roadmap and task register. This document owns
40
+ the hosting boundary. The [shared Project](https://github.com/orgs/wispsy/projects/30)
41
+ and linked issues are the execution queue.
42
+
43
+ ## Goal and first milestone
44
+
45
+ Gitcx will be a self-hosted single-node Git forge powered by Gitdx. Stock Git
46
+ clients must clone, push and fetch without installing either Python package on
47
+ the client. The 0.8 alpha adds identities, organizations, repository roles,
48
+ branch protection, a repository browser, pull requests, comments/reviews, audit
49
+ records and recoverable administration. This is a qualification target, not a
50
+ claim about the current implementation or authorization to publish/deploy.
51
+
52
+ The first source batch implements CAT-01: immutable domain records, safe
53
+ identifiers, explicit permissions and a backend protocol. It deliberately has
54
+ no HTTP listener, credentials store or Git implementation. Subsequent tasks
55
+ persist metadata and provision bare repositories through qualified Gitdx APIs.
56
+
57
+ ## Application boundaries
58
+
59
+ Build a modular monolith. Application services coordinate a control plane
60
+ (identities, catalog, policy, collaboration, jobs) and a Git data plane (binary
61
+ protocol requests delegated to Gitdx). Management JSON and smart-HTTP Git routes
62
+ share authentication/application services but retain distinct serialization,
63
+ content types, error contracts and request budgets.
64
+
65
+ Suggested modules grow only as implemented:
66
+
67
+ ```text
68
+ domain.py / permissions.py identities, repository records and access policy
69
+ storage/ SQLite metadata, migrations, audit outbox and jobs
70
+ services/ accounts, repositories, branches and pull requests
71
+ git/ Gitdx adapter, upload/receive orchestration, policy
72
+ http/ management API, smart HTTP and escaped HTML views
73
+ integrations/ separately selected capabilities and clients
74
+ cli.py configuration and local administrative commands
75
+ ```
76
+
77
+ Gitdx owns object parsing, IDs, refs, history, diffs, packs and negotiation.
78
+ The backend protocol exposes selected operations/capabilities rather than a
79
+ subprocess command runner. Opening a backend checks repository formats and
80
+ capabilities before advertising writes. Repository metadata records object
81
+ format and storage ID but never becomes a competing authority for branch tips.
82
+
83
+ ## Durable model and filesystem
84
+
85
+ Use standard-library sqlite3 for versioned platform metadata. Transactions cover
86
+ catalog mutations and the durable audit/job outbox. Enforce uniqueness and
87
+ bounded queries; define migration backup/rollback and process restart behavior.
88
+
89
+ | Record | Authority |
90
+ | --- | --- |
91
+ | Principal / account | Authenticated identity; anonymous callers are explicit |
92
+ | Organization / membership | Ownership and selected organization roles |
93
+ | RepositoryRecord | Opaque ID, owner, slug, visibility, object format, lifecycle |
94
+ | AccessGrant | Explicit read, write or admin permission for an account/repository |
95
+ | Credential | Token verifier/scope/expiry/revocation; raw token is never stored |
96
+ | BranchRule | Protected ref actions, force-push/delete/approval requirements |
97
+ | PullRequest / review / comment | Collaboration and checked state transitions |
98
+ | AuditEvent / Job | Durable sanitized outcomes, delivery and derived indexing |
99
+ | Git refs/objects | Gitdx store only; database caches can be rebuilt |
100
+
101
+ ```text
102
+ data/
103
+ git/<opaque-storage-id>.git/
104
+ db/gitcx.sqlite3
105
+ jobs/
106
+ backups/
107
+ ```
108
+
109
+ User slugs and owner names never select arbitrary filesystem paths. Define
110
+ canonical names and reserved namespaces; keep external URLs distinct from
111
+ internal storage IDs. Repository creation crosses SQLite and filesystem state:
112
+ use an explicit provisioning lifecycle, idempotency and reconciliation. Do not
113
+ pretend they are a single atomic database transaction.
114
+
115
+ ## Authorization and request handling
116
+
117
+ Use one deny-by-default decision function for repository discovery, API, Git
118
+ routes, browser pages and collaboration. Public visibility permits reading;
119
+ it grants no mutation rights. Anonymous users cannot inherit authenticated
120
+ grants. Validate principal/owner/grant identity and organization membership.
121
+ Private repositories are concealed from unauthorized listing and retrieval.
122
+ Ownership/admin/write/read actions have explicit tests; branch policies add
123
+ constraints to write permission rather than granting access themselves.
124
+
125
+ Authenticate before reading private refs/objects or accepting pack bytes. Scope
126
+ and revoke personal tokens; keep raw tokens out of logs, exceptions and audit
127
+ payloads. No general external command, hook, repository filter or integration
128
+ runs in authentication or receive validation. Browser content must be escaped
129
+ and active/binary downloads isolated from normal HTML rendering.
130
+
131
+ ## Git hosting transaction
132
+
133
+ 1. Resolve repository and authenticated caller without leaking private state.
134
+ 2. Enforce repository permission, endpoint budgets and requested capabilities.
135
+ 3. Quarantine incoming pack data through Gitdx.
136
+ 4. Validate checksums, object kinds, deltas, graph connectivity and quotas.
137
+ 5. Apply branch rules, ancestry/fast-forward checks and expected-old ref values.
138
+ 6. Publish verified objects, then commit permitted ref changes.
139
+ 7. Persist sanitized outcomes and durable derived-work envelopes.
140
+ 8. Return accurate per-ref success/rejection; advertise atomic only when proven.
141
+
142
+ The Git store and catalog/outbox also cross durability boundaries. Make the
143
+ Git transaction authoritative; use replayable outcome records/reconciliation
144
+ instead of falsely promising a distributed transaction. Interrupted responses
145
+ may require clients to re-read refs. Unreachable verified objects after a
146
+ rejected update are acceptable maintenance input; invalid accepted refs are not.
147
+
148
+ ## Interfaces and selected dependencies
149
+
150
+ Smart HTTP precedes SSH. Required discovery/upload/receive routes are
151
+ `info/refs?service=git-upload-pack`, `git-upload-pack`,
152
+ `info/refs?service=git-receive-pack` and `git-receive-pack`. They carry packet
153
+ lines and binary packs, not JSON. Protocol v2 fetch and ordinary-client push
154
+ variants must both be qualified against stock Git.
155
+
156
+ Gitdx is the mandatory backend once provisioning starts. Until a release is
157
+ explicitly approved, qualify immutable source commits/built artifacts; do not
158
+ publish metadata with absolute sibling paths or accidentally resolve an
159
+ unrelated package from an index. CAT-17 owns installed composition evidence.
160
+
161
+ Expose API supplies the selected application HTTP adapter after inspection of
162
+ its current public API. Requ/Apiconn may supply optional outgoing clients.
163
+ Carets, Hidden Moves, Moveset, Astree and Gitwriter remain optional profiles
164
+ with ordinary Python APIs underneath. Inspect each owning implementation and
165
+ split concrete adapters before adding dependencies. No external service is
166
+ needed for the initial local milestone.
167
+
168
+ ## Acceptance and operations
169
+
170
+ The prototype requires two authorized stock Git clients and an outsider:
171
+ clone an empty repository, commit/push main, push a feature branch, fetch it
172
+ from the second user, reject the outsider, restart and repeat. Both supported
173
+ native object formats are tested separately. The alpha adds browser comparison,
174
+ pull request, comment/review and merge, rechecking current base/head/policy.
175
+
176
+ Run focused unittest tests locally and the relevant suite. CI covers Python
177
+ 3.14 on Linux/macOS/Windows, source/wheel/sdist outside the checkout, real
178
+ loopback HTTP and a runtime without the Git executable. Required oracle jobs
179
+ fail on skips. Browser qualification uses real rendered pages, authorization
180
+ probes and untrusted-content fixtures. Retain exact engine/framework revisions
181
+ and unsupported capability reports.
182
+
183
+ Quotas cover request bytes, expanded objects, graph/delta work, repository disk,
184
+ concurrent operations and background jobs. Backups must consistently restore
185
+ catalog, Git state and audit/outbox into an isolated target. Qualify disk pressure,
186
+ crashes, maintenance with active writers, failed migrations and token revocation.
187
+ Ordinary SHA-1 hashing is not collision detection: untrusted SHA-1 hosting stays
188
+ gated on DX-26's validated policy. Static path checks alone are insufficient
189
+ for attacker-controlled concurrent filesystem changes.
190
+
191
+ Public deployment requires a selected hardened server/reverse proxy, TLS,
192
+ authentication bootstrap, host/domain, quotas, backup/restore and rollback.
193
+ A standard-library demonstration listener is loopback-only. Package uploads,
194
+ release publication and public deployment each require explicit owner authority
195
+ after concrete artifacts exist. SSH, LFS, hosted CI, registries, issue boards,
196
+ distributed storage and broad external integrations are independent later work.
197
+
198
+ ## Hosting task register
199
+
200
+ Detailed scope and acceptance live in each linked issue. Native dependency
201
+ links include the engine tasks in the shared Project. For the complete engine
202
+ sequence and milestone gates, use the shared plan.
203
+
204
+ | Task | Scope | Prerequisites |
205
+ | --- | --- | --- |
206
+ | [CAT-01](https://github.com/wispsy/gitcx/issues/1) | Hosting domain and explicit repository permissions | None |
207
+ | [CAT-02](https://github.com/wispsy/gitcx/issues/2) | SQLite catalog, migrations and audit outbox | CAT-01 |
208
+ | [CAT-03](https://github.com/wispsy/gitcx/issues/3) | Bare repository provisioning through gitdx | CAT-02, DX-04 |
209
+ | [CAT-04](https://github.com/wispsy/gitcx/issues/4) | Accounts, organizations and token authentication | CAT-02 |
210
+ | [CAT-05](https://github.com/wispsy/gitcx/issues/5) | Branch protection and ref-change policy | CAT-04, DX-15 |
211
+ | [CAT-06](https://github.com/wispsy/gitcx/issues/6) | Management API with Expose API integration | CAT-03, CAT-04 |
212
+ | [CAT-07](https://github.com/wispsy/gitcx/issues/7) | Smart-HTTP advertisement and upload-pack | CAT-06, DX-22 |
213
+ | [CAT-08](https://github.com/wispsy/gitcx/issues/8) | Receive-pack with quarantine and policy enforcement | CAT-07, CAT-05, DX-26, DX-24 |
214
+ | [CAT-09](https://github.com/wispsy/gitcx/issues/9) | Local two-user stock-Git hosting acceptance | CAT-08 |
215
+ | [CAT-10](https://github.com/wispsy/gitcx/issues/10) | Repository browser and safe commit/diff views | CAT-09, DX-14 |
216
+ | [CAT-11](https://github.com/wispsy/gitcx/issues/11) | Pull requests, comments, reviews and checked merge | CAT-10, CAT-05, DX-16 |
217
+ | [CAT-12](https://github.com/wispsy/gitcx/issues/12) | Durable jobs, audit queries and optional webhooks | CAT-08, CAT-02 |
218
+ | [CAT-13](https://github.com/wispsy/gitcx/issues/13) | Backup, restore, quotas and single-node operations | CAT-11, CAT-12, DX-27 / policy gate |
219
+ | [CAT-14](https://github.com/wispsy/gitcx/issues/14) | Selected typed operations and terminal/workflow adapters | CAT-11, DX-33 / policy gate |
220
+ | [CAT-15](https://github.com/wispsy/gitcx/issues/15) | Installed forge alpha and security qualification | CAT-13, DX-33 |
221
+ | [CAT-16](https://github.com/wispsy/gitcx/issues/16) | Owner-selected publication and deployment | CAT-15 / policy gate |
222
+ | [CAT-17](https://github.com/wispsy/gitcx/issues/17) | Immutable cross-repository installation profile | CAT-03, DX-04 |
223
+
224
+ ## CAT-05 implementation contract (2026-11-26)
225
+
226
+ Persist bounded exact/prefix ref rules and a compare-and-swap policy revision in
227
+ the catalog. Only repository administrators may change rules. Matching rules
228
+ intersect: creation, deletion, force updates, administrator-only writes and
229
+ required review can restrict an existing write permission but never grant one.
230
+ Owners have no implicit bypass. Required review refuses direct changes until
231
+ the checked review/merge service exists.
232
+
233
+ Evaluate bounded expected-old `gitdx.PushCommand` batches against managed bare
234
+ storage, using Gitdx object parsing and complete bounded commit ancestry. Return
235
+ stable per-ref reasons; do not change Git objects or refs. Recheck current token
236
+ activity, grants, policy revision and expected tips on subsequent evaluation.
237
+ These results are advisory snapshots, not reusable write capabilities. The
238
+ receive-pack task must enforce policy inside its publication boundary.
239
+
240
+ Qualify both native hash formats, role/scope/rule intersections, stale tips,
241
+ revocation and expiry, database restart/migration/rollback, invalid graphs and
242
+ no-executable operation. Keep Gitdx pinned to its published installation profile.
gitcx-0.1.0a3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Outside Labs
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.
gitcx-0.1.0a3/PKG-INFO ADDED
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitcx
3
+ Version: 0.1.0a3
4
+ Summary: A Git-compatible hosting platform powered by gitdx
5
+ Author: ellainng
6
+ Author-email: ellainng <299958882+ellainng@users.noreply.github.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Dist: gitdx==0.1.0a2
10
+ Requires-Dist: expose-api==0.2.0 ; extra == 'http'
11
+ Requires-Python: >=3.14
12
+ Project-URL: Repository, https://github.com/wispsy/gitcx
13
+ Project-URL: Issues, https://github.com/wispsy/gitcx/issues
14
+ Provides-Extra: http
15
+ Description-Content-Type: text/markdown
16
+
17
+ # gitcx
18
+
19
+ Developer preview: **0.1.0a3**, paired with published `gitdx==0.1.0a2`.
20
+ The selected scope includes catalog storage, repository provisioning,
21
+ authentication, the management API, bounded read-only smart HTTP and
22
+ SHA-256-only hosted receive on qualified Linux storage.
23
+ Production qualification is unfinished. [Preview notes](docs/releases.md)
24
+ record the supported scope and remaining gates.
25
+ The project was renamed from Gittycat to avoid the existing npm command name.
26
+ Use `pip install "gitcx[http]==0.1.0a3"`, `import gitcx` and the `gitcx` command.
27
+ See [migration instructions](docs/migration.md) for existing installations.
28
+ [Wispsy Releases](https://github.com/orgs/wispsy/projects/31)
29
+ tracks publication separately from current development.
30
+
31
+ A Git-compatible hosting and collaboration platform powered by [gitdx](https://github.com/wispsy/gitdx).
32
+
33
+ Python 3.14+ · MIT
34
+
35
+ Development starts with the [implementation plan](IMPLEMENTATION_PLAN.md) and
36
+ [shared Project](https://github.com/orgs/wispsy/projects/30). The roadmap records
37
+ qualification targets; public deployment remains a later milestone.
38
+
39
+ Source development does not imply a published package or deployed service.
40
+
41
+ The first implementation provides immutable platform records, validated slugs
42
+ and opaque storage IDs, an explicit Git backend protocol and deny-by-default
43
+ repository permissions. [Permission contracts](docs/permissions.md) describe
44
+ anonymous, owner, organization and collaborator behavior. Discovery uses the
45
+ same read policy as repository access.
46
+
47
+ [SQLite catalog storage](docs/catalog.md) now persists identities, ownership,
48
+ repository metadata, permissions, credential metadata and a transactional audit
49
+ outbox.
50
+
51
+ [Managed provisioning](docs/provisioning.md) now connects catalog permissions to
52
+ real Gitdx bare repositories with pending/ready recovery and an immutable backend
53
+ release.
54
+
55
+ [Personal token authentication](docs/authentication.md) provides one-time secret
56
+ delivery, expiring/revocable credentials and read/write/admin scope caps shared
57
+ by discovery and repository services. Account bootstrap and token issuance use
58
+ a trusted local catalog handle. The [optional management API](docs/management-api.md)
59
+ adds authorized JSON routes through Expose API and explicit loopback serving.
60
+ [Read-only smart HTTP](docs/smart-http.md) adds authorized discovery/upload-pack
61
+ through the same Expose API app. [Hosted receive](docs/receive.md) adds scoped,
62
+ policy-checked SHA-256 pushes with quarantined intake, audit receipts and explicit
63
+ interruption recovery. Interactive account login remains later work.
64
+
65
+ This preview also provides [branch protection and ref-change policy](docs/ref-policy.md):
66
+ versioned administrator rules, fresh token/grant checks and expected-old,
67
+ ancestry-based decisions for managed branches and tags. These read-only decisions
68
+ are rechecked under ref locks by the hosted receiver before publication.
69
+
70
+ Run `uv sync --locked` and `uv run python -m unittest discover -s tests -v`.
71
+ The [two-user hosting acceptance](docs/hosting-acceptance.md) runner checks real
72
+ stock-Git workflows, access refusal and restart, retaining a secret-free receipt.
73
+ The [installation profile](docs/installation.md) qualifies independently built
74
+ Gitdx/Gitcx artifacts and rejects backend capability mismatches.
75
+ `uv run python scripts/check_distribution.py` checks wheel/sdist installations
76
+ outside the checkout and startup with Git absent from PATH.
@@ -0,0 +1,60 @@
1
+ # gitcx
2
+
3
+ Developer preview: **0.1.0a3**, paired with published `gitdx==0.1.0a2`.
4
+ The selected scope includes catalog storage, repository provisioning,
5
+ authentication, the management API, bounded read-only smart HTTP and
6
+ SHA-256-only hosted receive on qualified Linux storage.
7
+ Production qualification is unfinished. [Preview notes](docs/releases.md)
8
+ record the supported scope and remaining gates.
9
+ The project was renamed from Gittycat to avoid the existing npm command name.
10
+ Use `pip install "gitcx[http]==0.1.0a3"`, `import gitcx` and the `gitcx` command.
11
+ See [migration instructions](docs/migration.md) for existing installations.
12
+ [Wispsy Releases](https://github.com/orgs/wispsy/projects/31)
13
+ tracks publication separately from current development.
14
+
15
+ A Git-compatible hosting and collaboration platform powered by [gitdx](https://github.com/wispsy/gitdx).
16
+
17
+ Python 3.14+ · MIT
18
+
19
+ Development starts with the [implementation plan](IMPLEMENTATION_PLAN.md) and
20
+ [shared Project](https://github.com/orgs/wispsy/projects/30). The roadmap records
21
+ qualification targets; public deployment remains a later milestone.
22
+
23
+ Source development does not imply a published package or deployed service.
24
+
25
+ The first implementation provides immutable platform records, validated slugs
26
+ and opaque storage IDs, an explicit Git backend protocol and deny-by-default
27
+ repository permissions. [Permission contracts](docs/permissions.md) describe
28
+ anonymous, owner, organization and collaborator behavior. Discovery uses the
29
+ same read policy as repository access.
30
+
31
+ [SQLite catalog storage](docs/catalog.md) now persists identities, ownership,
32
+ repository metadata, permissions, credential metadata and a transactional audit
33
+ outbox.
34
+
35
+ [Managed provisioning](docs/provisioning.md) now connects catalog permissions to
36
+ real Gitdx bare repositories with pending/ready recovery and an immutable backend
37
+ release.
38
+
39
+ [Personal token authentication](docs/authentication.md) provides one-time secret
40
+ delivery, expiring/revocable credentials and read/write/admin scope caps shared
41
+ by discovery and repository services. Account bootstrap and token issuance use
42
+ a trusted local catalog handle. The [optional management API](docs/management-api.md)
43
+ adds authorized JSON routes through Expose API and explicit loopback serving.
44
+ [Read-only smart HTTP](docs/smart-http.md) adds authorized discovery/upload-pack
45
+ through the same Expose API app. [Hosted receive](docs/receive.md) adds scoped,
46
+ policy-checked SHA-256 pushes with quarantined intake, audit receipts and explicit
47
+ interruption recovery. Interactive account login remains later work.
48
+
49
+ This preview also provides [branch protection and ref-change policy](docs/ref-policy.md):
50
+ versioned administrator rules, fresh token/grant checks and expected-old,
51
+ ancestry-based decisions for managed branches and tags. These read-only decisions
52
+ are rechecked under ref locks by the hosted receiver before publication.
53
+
54
+ Run `uv sync --locked` and `uv run python -m unittest discover -s tests -v`.
55
+ The [two-user hosting acceptance](docs/hosting-acceptance.md) runner checks real
56
+ stock-Git workflows, access refusal and restart, retaining a secret-free receipt.
57
+ The [installation profile](docs/installation.md) qualifies independently built
58
+ Gitdx/Gitcx artifacts and rejects backend capability mismatches.
59
+ `uv run python scripts/check_distribution.py` checks wheel/sdist installations
60
+ outside the checkout and startup with Git absent from PATH.
@@ -0,0 +1,82 @@
1
+ # Personal token authentication
2
+
3
+ `TokenAuth(catalog)` authenticates high-entropy personal tokens. Bootstrap an
4
+ account and issue tokens only through a trusted local catalog handle; no
5
+ unauthenticated account-creation, password-login or token-issuance endpoint is
6
+ provided. Existing account/organization IDs, memberships and grants remain the
7
+ authority for repository access.
8
+
9
+ ```python
10
+ from gitcx import Action, Catalog, Principal, Slug, TokenAuth
11
+
12
+ with Catalog("data/gitcx.sqlite3") as catalog:
13
+ account_id = "1" * 32
14
+ catalog.create_account(account_id, Slug("example-user"), now=1700000000)
15
+ auth = TokenAuth(catalog)
16
+ issued = auth.issue(Principal(account_id), scopes={Action.READ},
17
+ expires_at=1700086400, now=1700000000)
18
+ token = issued.reveal() # Deliver securely once; never log this value.
19
+ assert auth.repositories(token, now=1700000010) == ()
20
+ catalog.revoke_credential(Principal(account_id), issued.metadata.id,
21
+ now=1700000020)
22
+ ```
23
+
24
+ Issuance uses 32 explicitly selected random bytes from Python's `secrets`
25
+ module, with a non-secret UUID selector in `gtc_<id>_<secret>` format. SQLite
26
+ stores only the SHA-256 digest of the complete token, metadata and scope rows.
27
+ This fast verifier is for generated 256-bit secrets, not human passwords.
28
+ Authentication compares fixed-size digests with `hmac.compare_digest`, including
29
+ a dummy comparison for malformed/unknown credentials. The complete request is
30
+ not claimed to have uniform timing.
31
+
32
+ `IssuedToken` redacts its default representations, refuses serialization and
33
+ allows one explicit `reveal()` call. Metadata, principals, audit and outbox
34
+ records contain no token or verifier. There is no secret retrieval API. Callers
35
+ must protect the returned string, exclude it from URLs/logs/exceptions and use a
36
+ protected transport when future network routes are added. Losing the token
37
+ requires revocation and issuance of another; Python strings cannot be reliably
38
+ zeroed in memory.
39
+
40
+ Expiry is mandatory: the token is valid only for `created_at <= now < expires_at`
41
+ and while `revoked_at` is absent. Callers supply a trusted current UTC Unix
42
+ timestamp per operation; request data must never control the clock. Revocation
43
+ is permanent and idempotent, becomes effective for the next request, and requires
44
+ the same account with admin scope or a trusted local account principal.
45
+ Tokens cannot issue child tokens, including with admin scope.
46
+
47
+ Read/write/admin scopes form a hierarchy. They cap current owner, organization
48
+ owner and collaborator permissions; an admin token for an unrelated account
49
+ still cannot discover a private repository. Ordinary organization members have
50
+ no implicit private access. Demoting an organization owner removes implicit
51
+ rights; explicit grants are separately revoked. Each operation rereads current
52
+ membership/grant state. A read token cannot create repositories, change grants
53
+ or memberships, recover provisioning, or revoke tokens.
54
+
55
+ `repository()`, `repositories()` and `revoke()` authenticate freshly and apply
56
+ the shared policy within one SQLite transaction. For a composed service call:
57
+
58
+ ```python
59
+ with auth.request(token, now=current_unix_timestamp) as principal:
60
+ hosted = repository_service.open(principal, repository_id)
61
+ ```
62
+
63
+ The boundary serializes authorization with local revocation/grant changes and
64
+ keeps denials ahead of filesystem lookup. Use one connection per thread and
65
+ keep requests bounded; do not stream long network responses while holding the
66
+ transaction. `authenticate()` alone returns a snapshot for immediate use, not
67
+ a session. Never cache or reuse that principal across requests. Services taking
68
+ raw principals are trusted composition APIs, not an authentication substitute.
69
+
70
+ Malformed, unknown, expired, future-created and revoked credentials all raise
71
+ `AuthenticationError("invalid or inactive credential")`, a `PermissionDenied`
72
+ subclass. Invalid presented credentials never fall back to anonymous access.
73
+ Valid credentials without access receive the same concealed repository denial
74
+ as a missing repository. Anonymous public reads remain explicit via
75
+ `Principal()`; credentials are never inferred from URL slugs.
76
+
77
+ The [management API](management-api.md) now uses this boundary for Bearer
78
+ credential extraction and JSON control routes. Git protocol routes, rate limits,
79
+ interactive login and public-hosting qualification remain separate tasks. Python's
80
+ [secrets](https://docs.python.org/3/library/secrets.html) and
81
+ [digest-comparison](https://docs.python.org/3/library/hmac.html#hmac.compare_digest)
82
+ documentation describe the standard-library primitives used here.
@@ -0,0 +1,65 @@
1
+ {
2
+ "gitdx": {
3
+ "repository": "https://github.com/wispsy/gitdx",
4
+ "commit": "5564067cc8becb1d5341fc56e271d7360d229e21",
5
+ "qualification": "https://github.com/wispsy/gitdx/actions/runs/46064002159",
6
+ "profile": "native files-ref storage, bounded upload-pack and SHA-256-only untrusted receive with host publication guards on qualified Linux",
7
+ "required_capabilities": [
8
+ "objects.read",
9
+ "objects.write",
10
+ "refs.read",
11
+ "refs.update"
12
+ ],
13
+ "version": "0.1.0a2",
14
+ "published": {
15
+ "version": "0.1.0a2",
16
+ "commit": "5564067cc8becb1d5341fc56e271d7360d229e21",
17
+ "qualification": "https://github.com/wispsy/gitdx/actions/runs/46064002159",
18
+ "pypi": "https://pypi.org/project/gitdx/0.1.0a2/",
19
+ "artifacts": [
20
+ {
21
+ "filename": "gitdx-0.1.0a2-py3-none-any.whl",
22
+ "bytes": 155829,
23
+ "sha256": "09dfed779e57b2b33d435a05c216d4c4bf66c785b62aaab98991d31f893a9376"
24
+ },
25
+ {
26
+ "filename": "gitdx-0.1.0a2.tar.gz",
27
+ "bytes": 281816,
28
+ "sha256": "a736b4a1c8378f30e75ba2ad91589485c1e94207fb3c6ff2a2c39e425efba6ce"
29
+ }
30
+ ]
31
+ },
32
+ "source_kind": "pypi",
33
+ "previous_published": {
34
+ "version": "0.1.0a1",
35
+ "commit": "3386e6b0b0cd4c99c7ff208ba5e127b6c15ac3a8",
36
+ "qualification": "https://github.com/wispsy/gitdx/actions/runs/45495562313",
37
+ "pypi": "https://pypi.org/project/gitdx/0.1.0a1/",
38
+ "artifacts": [
39
+ {
40
+ "filename": "gitdx-0.1.0a1-py3-none-any.whl",
41
+ "bytes": 101327,
42
+ "sha256": "a4cdada6eafc93e2c58ac1c9558cfe16b8bd7e2e8193c6a10ee4f50c8307e30b"
43
+ },
44
+ {
45
+ "filename": "gitdx-0.1.0a1.tar.gz",
46
+ "bytes": 178361,
47
+ "sha256": "94268e46bf7fd8e2aeee97a3b43ccbd365ddfff02015d18439f02a23848d20bd"
48
+ }
49
+ ]
50
+ },
51
+ "previous_source": {
52
+ "version": "0.1.0a1",
53
+ "commit": "8765b1fa9d3bc664fd551b15912e5455174f1983",
54
+ "qualification": "https://github.com/wispsy/gitdx/actions/runs/46042705164",
55
+ "source_kind": "git"
56
+ }
57
+ },
58
+ "expose_api": {
59
+ "repository": "https://github.com/wispsy/expose_api",
60
+ "commit": "3877fec0d3c2d945cca871c69809351e03fd47b7",
61
+ "version": "0.2.0",
62
+ "qualification": "https://github.com/wispsy/expose_api/releases/tag/v0.2.0",
63
+ "profile": "optional management and smart-HTTP routes, bounded raw requests, byte streaming and disconnect cleanup"
64
+ }
65
+ }
@@ -0,0 +1,50 @@
1
+ # SQLite catalog and audit outbox
2
+
3
+ `Catalog(path)` owns one SQLite connection; use it as a context manager and use
4
+ a separate connection per thread. Migrations use an application ID, schema
5
+ version and one explicit transaction for all DDL/version changes. Unknown or
6
+ foreign schemas are refused. Failed upgrades roll back and preserve old rows.
7
+ Schema 5 adds versioned [branch protection rules](ref-policy.md), with rule
8
+ updates, policy revisions and their audit/outbox events in the same transaction.
9
+
10
+ Account bootstrap and outbox maintenance require a trusted local catalog handle.
11
+ They are not unauthenticated server endpoints. Repository reads, lists, grants
12
+ and mutations consume an already authenticated `Principal` and enforce the
13
+ shared read/write/admin policy. Read snapshots keep records and permission
14
+ checks consistent; SQL prefilters apply the same current read policy before
15
+ bounded pagination. Ordinary organization members gain no implicit private access.
16
+
17
+ ```python
18
+ from gitcx import Catalog, Principal, Slug
19
+
20
+ with Catalog("data/gitcx.sqlite3") as catalog:
21
+ catalog.create_account("1" * 32, Slug("example-user"), now=1700000000)
22
+ assert catalog.list_repositories(Principal("1" * 32)) == ()
23
+ ```
24
+
25
+ Every mutation writes its typed audit event and durable outbox envelope in the
26
+ same transaction. Nested calls use savepoints, so a caught inner failure cannot
27
+ commit a partial mutation. `with catalog.transaction():` groups multiple changes;
28
+ normal exit commits and exceptions roll back. Uniqueness failures raise
29
+ `CatalogConflict`; denied queries/mutations use concealed permission errors.
30
+
31
+ Audits contain only declared event kinds, opaque actor/resource IDs and explicit
32
+ timestamps. They accept no arbitrary message, request header or payload that
33
+ could copy credentials into logs. Credential storage accepts a caller-computed
34
+ 32-byte verifier digest, never a token string; callers remain responsible for
35
+ correct digest derivation. Credential metadata/query results exclude that digest.
36
+ Use [TokenAuth](authentication.md) for generated bearer tokens and their scopes;
37
+ legacy metadata/verifiers without scope rows cannot authenticate as tokens.
38
+
39
+ `pending_jobs(limit, after)` and `acknowledge_job(id)` provide restart-safe bounded
40
+ outbox envelopes and idempotent acknowledgement. Delivery can occur at least once;
41
+ consumers must be idempotent. Worker leases/retries, execution and external delivery
42
+ remain CAT-12 work. No worker or network service starts automatically.
43
+
44
+ Pages contain at most 100 results. New databases use owner-only file permissions;
45
+ static database/sidecar symlinks are refused. SQLite manages database transaction
46
+ durability; callers must control the directory/ancestors. This is not protection
47
+ against hostile concurrent path replacement or a cross-filesystem transaction.
48
+ Repository enrollment records alone do not provision Git storage. Use
49
+ `RepositoryService` for [managed provisioning/reconciliation](provisioning.md).
50
+ Objects and branch tips stay exclusively in the Gitdx backend.