4. GRASP Git Hosting (fleetmesh_protocols.grasp)#
fleetmesh_protocols.grasp implements host-side Git repository hosting for web applications: bare repositories on disk, Git smart HTTP transport, the /api/grasp workbench API, and seeded repositories. Its browser counterpart is @fleetmesh/grasp.
4.1. Security and Resource Controls#
Because fleetmesh_protocols.grasp invokes git on inputs supplied by authenticated users, it enforces the following safeguards:
Rejects file paths referencing
.git(case-insensitively) or traversing outside the working tree, as well as branch names thatgitcould interpret as command-line options.Performs working-tree checkouts with symbolic links disabled.
Configures
receive.fsckObjectsandreceive.maxInputSize(64 MiB) on every served repository, and enforces execution timeouts on Git smart HTTP operations.Following a Git push, reads branch contents up to
MAX_SYNC_FILE_BYTES(1 MiB) per file,MAX_SYNC_FILES(5,000), andMAX_SYNC_BYTES(32 MiB), listing excluded paths inomitted_files. API-initiated pushes leave unmodified files byte-for-byte unchanged.Publishes clone URLs exclusively under the host-configured
public_base_url.
4.2. Git Store and Workbench#
Fleetmesh GRASP Git Smart HTTP & Source Code Repository Store (node.protocols.grasp.git_store).
Provides real Git bare repository storage, Git Smart HTTP (git clone, git fetch, git push via /git/<slug>.git/info/refs, git-upload-pack, git-receive-pack), and JSON workbench APIs (/api/grasp/repos, /push, /merge) with 1,024-byte RhioBaoTree Merkle root commitments and Kind 30617 (NIP-34 / GRASP) repository state announcements.
- fleetmesh_protocols.grasp.git_store.branch_name(raw)[source]#
A branch name git takes as a name, never as an option (MeshAccessError 400 otherwise).
- fleetmesh_protocols.grasp.git_store.repo_path(raw)[source]#
A file path inside the work tree, never into .git or above it (MeshAccessError 400 otherwise).
- class fleetmesh_protocols.grasp.git_store.StandaloneGraspGitStore[source]#
Bases:
objectManages bare Git repositories on disk and JSON metadata for /git/* and /api/grasp/*.
- MAX_SYNC_FILE_BYTES = 1048576#
- MAX_SYNC_FILES = 5000#
- MAX_SYNC_BYTES = 33554432#
- __init__(base_dir=None, public_base_url='')[source]#
public_base_url is where this host serves /git/; without it no clone URL is published.
4.3. Smart HTTP and the Portal#
Git Smart HTTP and the node portal for the GRASP git store (node.protocols.grasp.git_http).
/git/<repo>.git/…: fetching (git-upload-pack) is open; pushing (git-receive-pack and its advertisement) is the repo owner’s alone, as the request principal. A fetch never creates a repo.
- fleetmesh_protocols.grasp.git_http.handle_git_smart_http(store, method, route, query, body=b'', principal=None)[source]#
Handle Git Smart HTTP requests (/git/<slug>.git/info/refs, git-upload-pack, git-receive-pack).
- fleetmesh_protocols.grasp.git_http.render_node_portal_html(store)[source]#
- Parameters:
store (StandaloneGraspGitStore)
- Return type:
4.4. Seeded Repositories#
Seeded Fleetmesh GRASP Git repositories (node.protocols.grasp.seeds).
Contains the initial source files (src/*.rs, src/*.asm, src/*.ts, index.html, nsite.json, Makefile, README.md) for built-in Game Engines, DMG-01 ROMs, and NIP-5A nsite apps.