No description
  • C 60.3%
  • JavaScript 32.7%
  • Shell 4.6%
  • Makefile 2.3%
  • CMake 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-13 14:28:21 +02:00
docs docs(workflow): adopt protected-main / PR-only policy; rename master to main 2026-06-13 14:11:36 +02:00
emscripten chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
examples/opfs chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
LICENSES chore(restructure): execute Phase R (R0+R1+R2+R3) 2026-05-27 17:02:16 +02:00
patches chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
scripts chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
tests docs(restructure): migrate docs/ to Hugo+Docsy site layout (00-governance → 06-operations) 2026-05-28 12:41:45 +02:00
.c8rc.json test(node): execute Phase T3 — OPFS validation, WASMFS patches, c8 coverage, pre-push hook 2026-05-27 21:09:19 +02:00
.clang-format build(tooling): introduce Biome, clang-format, Lefthook, commitlint and Makefile (T1+T2+S1) 2026-05-27 20:44:05 +02:00
.dockerignore build(docker): introduce Dockerfile.dev, docker-compose.yml and make dev targets (S2) 2026-05-28 06:20:58 +02:00
.editorconfig build(tooling): introduce Biome, clang-format, Lefthook, commitlint and Makefile (T1+T2+S1) 2026-05-27 20:44:05 +02:00
.env.example build(tooling): introduce Biome, clang-format, Lefthook, commitlint and Makefile (T1+T2+S1) 2026-05-27 20:44:05 +02:00
.gitattributes chore(restructure): execute Phase R (R0+R1+R2+R3) 2026-05-27 17:02:16 +02:00
.gitignore docs(restructure): migrate docs/ to Hugo+Docsy site layout (00-governance → 06-operations) 2026-05-28 12:41:45 +02:00
.nvmrc build(tooling): introduce Biome, clang-format, Lefthook, commitlint and Makefile (T1+T2+S1) 2026-05-27 20:44:05 +02:00
.tool-versions build(tooling): introduce Biome, clang-format, Lefthook, commitlint and Makefile (T1+T2+S1) 2026-05-27 20:44:05 +02:00
AUTHORS.md chore(repo): update canonical repository URL to git.jombi.fr/duhamed 2026-06-13 13:25:45 +02:00
biome.json docs(restructure): migrate docs/ to Hugo+Docsy site layout (00-governance → 06-operations) 2026-05-28 12:41:45 +02:00
CHANGELOG.md docs: ajouter CONTRIBUTING, SECURITY, docs/{build,support,api,patches,adr,analyse}, CHANGELOG (D2) 2026-05-28 06:52:48 +02:00
CLAUDE.md docs(workflow): adopt protected-main / PR-only policy; rename master to main 2026-06-13 14:11:36 +02:00
CMakeLists.txt chore(restructure): execute Phase R (R0+R1+R2+R3) 2026-05-27 17:02:16 +02:00
commitlint.config.js chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
CONTRIBUTING.md docs(workflow): adopt protected-main / PR-only policy; rename master to main 2026-06-13 14:11:36 +02:00
COPYING LICENSE 2020-02-29 07:09:50 +01:00
docker-compose.yml build(docker): introduce Dockerfile.dev, docker-compose.yml and make dev targets (S2) 2026-05-28 06:20:58 +02:00
Dockerfile.dev build(docker): introduce Dockerfile.dev, docker-compose.yml and make dev targets (S2) 2026-05-28 06:20:58 +02:00
lefthook.yml test(node): execute Phase T3 — OPFS validation, WASMFS patches, c8 coverage, pre-push hook 2026-05-27 21:09:19 +02:00
LICENSE chore(restructure): execute Phase R (R0+R1+R2+R3) 2026-05-27 17:02:16 +02:00
Makefile build(docker): introduce Dockerfile.dev, docker-compose.yml and make dev targets (S2) 2026-05-28 06:20:58 +02:00
NOTICE chore(restructure): execute Phase R (R0+R1+R2+R3) 2026-05-27 17:02:16 +02:00
package-lock.json fix(deps): resolve critical npm advisories in koa and basic-ftp 2026-06-13 14:22:59 +02:00
package.json build(deps): upgrade mocha 10.2 to 11.7 to fix Node 26 ESM crash 2026-06-13 14:11:46 +02:00
playwright-opfs.config.js chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00
README.md chore(repo): update canonical repository URL to git.jombi.fr/duhamed 2026-06-13 13:25:45 +02:00
REUSE.toml docs(restructure): migrate docs/ to Hugo+Docsy site layout (00-governance → 06-operations) 2026-05-28 12:41:45 +02:00
SECURITY.md docs(restructure): migrate docs/ to Hugo+Docsy site layout (00-governance → 06-operations) 2026-05-28 12:41:45 +02:00
web-test-runner-opfs.config.js chore(license): adopt REUSE specification for SPDX licensing (D-12.7, ADR-0007) 2026-05-28 09:17:26 +02:00

git-wasm-calepin

CI Latest release License

libgit2 compiled to WebAssembly with the OPFS (Origin Private File System) backend — a production module for browser-resident git repositories with persistent local storage.

Forked from petersalomonsen/wasm-git. The upstream POC carried three runtime variants (sync / async / OPFS); this fork keeps only OPFS and restructures the project as a standalone deliverable. See ADR-0001 and ADR-0003 for the rationale.

Status

Pre-1.0. Distributed through Forgejo Releases as tarballs (no npm publish — see ADR-0002). API may evolve until v1.0.0. Support policy: docs/03-development/support.md.

Use cases

  • Browser-resident git clients that need a persistent local working copy (notebook apps, offline-first editors, in-browser CI front-ends).
  • Static-site authoring tools that round-trip commits without a server.
  • Reproducible build harnesses that need git semantics inside a sandboxed Web Worker.

If your workload is one-shot (clone, read, discard) and does not require persistence, the upstream sync or async variants of wasm-git may be a better fit. This project is OPFS-only by design.

Compatibility

Component Pinned version
libgit2 (vendored) 1.9.3
Emscripten 4.0.23
Node.js (dev only) 22.20.0 LTS (Jod)

Browsers must support WebAssembly, SharedArrayBuffer, Atomics, and OPFS via the File System Access API:

  • Chrome / Edge 86+
  • Firefox 111+
  • Safari 15.2+

Install

Download the latest release tarball from Forgejo Releases, verify the attached SHA256SUMS, and serve lg2_opfs.js + lg2_opfs.wasm alongside your worker script:

curl -LO https://git.jombi.fr/duhamed/git-wasm-calepin/releases/download/v0.1.0/git-wasm-calepin-0.1.0.tar.gz
curl -LO https://git.jombi.fr/duhamed/git-wasm-calepin/releases/download/v0.1.0/SHA256SUMS
sha256sum -c SHA256SUMS
tar xzf git-wasm-calepin-0.1.0.tar.gz

A signed checksum manifest (minisign) is attached to each release. See docs/03-development/build.md for the verification procedure.

Minimal example

The OPFS build runs inside a Web Worker. The hosting page must serve the following headers to enable SharedArrayBuffer:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Inside the worker:

const lgMod = await import('./lg2_opfs.js');
const lg = await lgMod.default();
const FS = lg.FS;

// WASMFS does not pre-create /home/web_user like MEMFS did.
try { FS.mkdir('/home'); } catch (_) {}
try { FS.mkdir('/home/web_user'); } catch (_) {}
FS.writeFile('/home/web_user/.gitconfig',
  '[user]\n  name = Your Name\n  email = you@example.com');

// Mount OPFS under /opfs.
const backend = lg._lg2_create_opfs_backend();
const workingDir = '/opfs';
lg.ccall('lg2_create_directory', 'number', ['string', 'number', 'number'],
         [workingDir, 0o777, backend]);

const repoDir = `${workingDir}/myrepo`;
lg.callMain(['clone', 'https://example.com/repo.git', repoDir]);

// WASMFS getcwd() workaround — see docs/01-architecture/patches/ for context.
FS.symlink(repoDir, '/myrepo');
FS.chdir(repoDir);

FS.writeFile('newfile.txt', 'Hello OPFS!');
lg.callMain(['add', 'newfile.txt']);
lg.callMain(['commit', '-m', 'Add new file']);
lg.callMain(['push']);

A complete end-to-end example lives under examples/opfs/. The API reference is in docs/03-development/api.md.

Building from source

git clone https://git.jombi.fr/duhamed/git-wasm-calepin.git
cd git-wasm-calepin
make setup                  # downloads libgit2 1.9.3 + emsdk 4.0.23 + npm deps
make build                  # builds the OPFS artifact (Release)
make test                   # Node test suite
make test-browser           # browser test suite (Playwright + Web Test Runner)

For a reproducible toolchain, use the bundled Docker image:

make dev                    # interactive shell in git-wasm-calepin/dev:local

Detailed build instructions, troubleshooting, and reproducibility notes are in docs/03-development/build.md.

Documentation

License & commercial use

SPDX expression: GPL-2.0-only WITH LicenseRef-libgit2-linking-exception (see COPYING for the canonical text and LICENSES/ for the SPDX-style layout).

The linking exception (modeled on the GNU Classpath exception) means the compiled artifact lg2_opfs.wasm can be linked into and redistributed with proprietary software, including for commercial purposes, without GPL contagion. The source form of this repository, including the C patches under patches/, remains under GPL-2.0-only.

When redistributing the compiled artifact, you must:

  1. Include COPYING (or a pointer to it).
  2. Note the vendored libgit2 version (currently 1.9.3).
  3. Make the patched libgit2 sources available — linking back to this Forgejo repository satisfies that obligation.

Full legal analysis: section 3 of docs/02-planning/analyses/2026-05-15-restructuration-production.html. Decision record: ADR-0004.

Acknowledgements

See AUTHORS.md. The upstream petersalomonsen/wasm-git POC and the libgit2 project are credited there and in NOTICE.