@enbox/gitd 0.0.1
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.
- package/LICENSE +177 -0
- package/README.md +134 -0
- package/dist/esm/ci.js +76 -0
- package/dist/esm/ci.js.map +1 -0
- package/dist/esm/cli/agent.js +86 -0
- package/dist/esm/cli/agent.js.map +1 -0
- package/dist/esm/cli/commands/ci.js +278 -0
- package/dist/esm/cli/commands/ci.js.map +1 -0
- package/dist/esm/cli/commands/clone.js +77 -0
- package/dist/esm/cli/commands/clone.js.map +1 -0
- package/dist/esm/cli/commands/daemon.js +132 -0
- package/dist/esm/cli/commands/daemon.js.map +1 -0
- package/dist/esm/cli/commands/github-api.js +36 -0
- package/dist/esm/cli/commands/github-api.js.map +1 -0
- package/dist/esm/cli/commands/init.js +69 -0
- package/dist/esm/cli/commands/init.js.map +1 -0
- package/dist/esm/cli/commands/issue.js +293 -0
- package/dist/esm/cli/commands/issue.js.map +1 -0
- package/dist/esm/cli/commands/log.js +90 -0
- package/dist/esm/cli/commands/log.js.map +1 -0
- package/dist/esm/cli/commands/migrate.js +444 -0
- package/dist/esm/cli/commands/migrate.js.map +1 -0
- package/dist/esm/cli/commands/notification.js +141 -0
- package/dist/esm/cli/commands/notification.js.map +1 -0
- package/dist/esm/cli/commands/org.js +353 -0
- package/dist/esm/cli/commands/org.js.map +1 -0
- package/dist/esm/cli/commands/patch.js +375 -0
- package/dist/esm/cli/commands/patch.js.map +1 -0
- package/dist/esm/cli/commands/registry.js +501 -0
- package/dist/esm/cli/commands/registry.js.map +1 -0
- package/dist/esm/cli/commands/release.js +197 -0
- package/dist/esm/cli/commands/release.js.map +1 -0
- package/dist/esm/cli/commands/repo.js +148 -0
- package/dist/esm/cli/commands/repo.js.map +1 -0
- package/dist/esm/cli/commands/serve.js +148 -0
- package/dist/esm/cli/commands/serve.js.map +1 -0
- package/dist/esm/cli/commands/setup.js +92 -0
- package/dist/esm/cli/commands/setup.js.map +1 -0
- package/dist/esm/cli/commands/shim.js +75 -0
- package/dist/esm/cli/commands/shim.js.map +1 -0
- package/dist/esm/cli/commands/social.js +206 -0
- package/dist/esm/cli/commands/social.js.map +1 -0
- package/dist/esm/cli/commands/web.js +36 -0
- package/dist/esm/cli/commands/web.js.map +1 -0
- package/dist/esm/cli/commands/wiki.js +185 -0
- package/dist/esm/cli/commands/wiki.js.map +1 -0
- package/dist/esm/cli/flags.js +29 -0
- package/dist/esm/cli/flags.js.map +1 -0
- package/dist/esm/cli/main.js +331 -0
- package/dist/esm/cli/main.js.map +1 -0
- package/dist/esm/cli/repo-context.js +53 -0
- package/dist/esm/cli/repo-context.js.map +1 -0
- package/dist/esm/daemon/adapter.js +18 -0
- package/dist/esm/daemon/adapter.js.map +1 -0
- package/dist/esm/daemon/adapters/github.js +112 -0
- package/dist/esm/daemon/adapters/github.js.map +1 -0
- package/dist/esm/daemon/adapters/go.js +51 -0
- package/dist/esm/daemon/adapters/go.js.map +1 -0
- package/dist/esm/daemon/adapters/index.js +32 -0
- package/dist/esm/daemon/adapters/index.js.map +1 -0
- package/dist/esm/daemon/adapters/npm.js +51 -0
- package/dist/esm/daemon/adapters/npm.js.map +1 -0
- package/dist/esm/daemon/adapters/oci.js +62 -0
- package/dist/esm/daemon/adapters/oci.js.map +1 -0
- package/dist/esm/daemon/index.js +12 -0
- package/dist/esm/daemon/index.js.map +1 -0
- package/dist/esm/daemon/server.js +167 -0
- package/dist/esm/daemon/server.js.map +1 -0
- package/dist/esm/git-remote/credential-helper.js +106 -0
- package/dist/esm/git-remote/credential-helper.js.map +1 -0
- package/dist/esm/git-remote/credential-main.js +109 -0
- package/dist/esm/git-remote/credential-main.js.map +1 -0
- package/dist/esm/git-remote/index.js +10 -0
- package/dist/esm/git-remote/index.js.map +1 -0
- package/dist/esm/git-remote/main.js +78 -0
- package/dist/esm/git-remote/main.js.map +1 -0
- package/dist/esm/git-remote/parse-url.js +60 -0
- package/dist/esm/git-remote/parse-url.js.map +1 -0
- package/dist/esm/git-remote/resolve.js +175 -0
- package/dist/esm/git-remote/resolve.js.map +1 -0
- package/dist/esm/git-remote/service.js +82 -0
- package/dist/esm/git-remote/service.js.map +1 -0
- package/dist/esm/git-server/auth.js +211 -0
- package/dist/esm/git-server/auth.js.map +1 -0
- package/dist/esm/git-server/bundle-restore.js +180 -0
- package/dist/esm/git-server/bundle-restore.js.map +1 -0
- package/dist/esm/git-server/bundle-sync.js +233 -0
- package/dist/esm/git-server/bundle-sync.js.map +1 -0
- package/dist/esm/git-server/did-service.js +73 -0
- package/dist/esm/git-server/did-service.js.map +1 -0
- package/dist/esm/git-server/git-backend.js +186 -0
- package/dist/esm/git-server/git-backend.js.map +1 -0
- package/dist/esm/git-server/http-handler.js +295 -0
- package/dist/esm/git-server/http-handler.js.map +1 -0
- package/dist/esm/git-server/index.js +16 -0
- package/dist/esm/git-server/index.js.map +1 -0
- package/dist/esm/git-server/push-authorizer.js +62 -0
- package/dist/esm/git-server/push-authorizer.js.map +1 -0
- package/dist/esm/git-server/ref-sync.js +132 -0
- package/dist/esm/git-server/ref-sync.js.map +1 -0
- package/dist/esm/git-server/server.js +185 -0
- package/dist/esm/git-server/server.js.map +1 -0
- package/dist/esm/git-server/verify.js +109 -0
- package/dist/esm/git-server/verify.js.map +1 -0
- package/dist/esm/github-shim/helpers.js +273 -0
- package/dist/esm/github-shim/helpers.js.map +1 -0
- package/dist/esm/github-shim/index.js +13 -0
- package/dist/esm/github-shim/index.js.map +1 -0
- package/dist/esm/github-shim/issues.js +318 -0
- package/dist/esm/github-shim/issues.js.map +1 -0
- package/dist/esm/github-shim/pulls.js +423 -0
- package/dist/esm/github-shim/pulls.js.map +1 -0
- package/dist/esm/github-shim/releases.js +154 -0
- package/dist/esm/github-shim/releases.js.map +1 -0
- package/dist/esm/github-shim/repos.js +86 -0
- package/dist/esm/github-shim/repos.js.map +1 -0
- package/dist/esm/github-shim/server.js +351 -0
- package/dist/esm/github-shim/server.js.map +1 -0
- package/dist/esm/github-shim/users.js +61 -0
- package/dist/esm/github-shim/users.js.map +1 -0
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/indexer/api.js +132 -0
- package/dist/esm/indexer/api.js.map +1 -0
- package/dist/esm/indexer/crawler.js +256 -0
- package/dist/esm/indexer/crawler.js.map +1 -0
- package/dist/esm/indexer/index.js +9 -0
- package/dist/esm/indexer/index.js.map +1 -0
- package/dist/esm/indexer/main.js +76 -0
- package/dist/esm/indexer/main.js.map +1 -0
- package/dist/esm/indexer/store.js +334 -0
- package/dist/esm/indexer/store.js.map +1 -0
- package/dist/esm/issues.js +133 -0
- package/dist/esm/issues.js.map +1 -0
- package/dist/esm/notifications.js +47 -0
- package/dist/esm/notifications.js.map +1 -0
- package/dist/esm/org.js +90 -0
- package/dist/esm/org.js.map +1 -0
- package/dist/esm/patches.js +136 -0
- package/dist/esm/patches.js.map +1 -0
- package/dist/esm/refs.js +54 -0
- package/dist/esm/refs.js.map +1 -0
- package/dist/esm/registry.js +81 -0
- package/dist/esm/registry.js.map +1 -0
- package/dist/esm/releases.js +78 -0
- package/dist/esm/releases.js.map +1 -0
- package/dist/esm/repo.js +150 -0
- package/dist/esm/repo.js.map +1 -0
- package/dist/esm/resolver/index.js +10 -0
- package/dist/esm/resolver/index.js.map +1 -0
- package/dist/esm/resolver/resolve.js +189 -0
- package/dist/esm/resolver/resolve.js.map +1 -0
- package/dist/esm/resolver/trust-chain.js +155 -0
- package/dist/esm/resolver/trust-chain.js.map +1 -0
- package/dist/esm/resolver/verify.js +186 -0
- package/dist/esm/resolver/verify.js.map +1 -0
- package/dist/esm/shims/go/index.js +9 -0
- package/dist/esm/shims/go/index.js.map +1 -0
- package/dist/esm/shims/go/proxy.js +275 -0
- package/dist/esm/shims/go/proxy.js.map +1 -0
- package/dist/esm/shims/go/server.js +70 -0
- package/dist/esm/shims/go/server.js.map +1 -0
- package/dist/esm/shims/index.js +15 -0
- package/dist/esm/shims/index.js.map +1 -0
- package/dist/esm/shims/npm/index.js +9 -0
- package/dist/esm/shims/npm/index.js.map +1 -0
- package/dist/esm/shims/npm/registry.js +234 -0
- package/dist/esm/shims/npm/registry.js.map +1 -0
- package/dist/esm/shims/npm/server.js +72 -0
- package/dist/esm/shims/npm/server.js.map +1 -0
- package/dist/esm/shims/oci/index.js +9 -0
- package/dist/esm/shims/oci/index.js.map +1 -0
- package/dist/esm/shims/oci/registry.js +276 -0
- package/dist/esm/shims/oci/registry.js.map +1 -0
- package/dist/esm/shims/oci/server.js +82 -0
- package/dist/esm/shims/oci/server.js.map +1 -0
- package/dist/esm/social.js +70 -0
- package/dist/esm/social.js.map +1 -0
- package/dist/esm/web/html.js +123 -0
- package/dist/esm/web/html.js.map +1 -0
- package/dist/esm/web/index.js +7 -0
- package/dist/esm/web/index.js.map +1 -0
- package/dist/esm/web/routes.js +420 -0
- package/dist/esm/web/routes.js.map +1 -0
- package/dist/esm/web/server.js +225 -0
- package/dist/esm/web/server.js.map +1 -0
- package/dist/esm/wiki.js +63 -0
- package/dist/esm/wiki.js.map +1 -0
- package/dist/types/ci.d.ts +203 -0
- package/dist/types/ci.d.ts.map +1 -0
- package/dist/types/cli/agent.d.ts +59 -0
- package/dist/types/cli/agent.d.ts.map +1 -0
- package/dist/types/cli/commands/ci.d.ts +16 -0
- package/dist/types/cli/commands/ci.d.ts.map +1 -0
- package/dist/types/cli/commands/clone.d.ts +13 -0
- package/dist/types/cli/commands/clone.d.ts.map +1 -0
- package/dist/types/cli/commands/daemon.d.ts +29 -0
- package/dist/types/cli/commands/daemon.d.ts.map +1 -0
- package/dist/types/cli/commands/github-api.d.ts +14 -0
- package/dist/types/cli/commands/github-api.d.ts.map +1 -0
- package/dist/types/cli/commands/init.d.ts +11 -0
- package/dist/types/cli/commands/init.d.ts.map +1 -0
- package/dist/types/cli/commands/issue.d.ts +16 -0
- package/dist/types/cli/commands/issue.d.ts.map +1 -0
- package/dist/types/cli/commands/log.d.ts +13 -0
- package/dist/types/cli/commands/log.d.ts.map +1 -0
- package/dist/types/cli/commands/migrate.d.ts +19 -0
- package/dist/types/cli/commands/migrate.d.ts.map +1 -0
- package/dist/types/cli/commands/notification.d.ts +16 -0
- package/dist/types/cli/commands/notification.d.ts.map +1 -0
- package/dist/types/cli/commands/org.d.ts +19 -0
- package/dist/types/cli/commands/org.d.ts.map +1 -0
- package/dist/types/cli/commands/patch.d.ts +17 -0
- package/dist/types/cli/commands/patch.d.ts.map +1 -0
- package/dist/types/cli/commands/registry.d.ts +25 -0
- package/dist/types/cli/commands/registry.d.ts.map +1 -0
- package/dist/types/cli/commands/release.d.ts +13 -0
- package/dist/types/cli/commands/release.d.ts.map +1 -0
- package/dist/types/cli/commands/repo.d.ts +15 -0
- package/dist/types/cli/commands/repo.d.ts.map +1 -0
- package/dist/types/cli/commands/serve.d.ts +22 -0
- package/dist/types/cli/commands/serve.d.ts.map +1 -0
- package/dist/types/cli/commands/setup.d.ts +16 -0
- package/dist/types/cli/commands/setup.d.ts.map +1 -0
- package/dist/types/cli/commands/shim.d.ts +16 -0
- package/dist/types/cli/commands/shim.d.ts.map +1 -0
- package/dist/types/cli/commands/social.d.ts +19 -0
- package/dist/types/cli/commands/social.d.ts.map +1 -0
- package/dist/types/cli/commands/web.d.ts +14 -0
- package/dist/types/cli/commands/web.d.ts.map +1 -0
- package/dist/types/cli/commands/wiki.d.ts +14 -0
- package/dist/types/cli/commands/wiki.d.ts.map +1 -0
- package/dist/types/cli/flags.d.ts +16 -0
- package/dist/types/cli/flags.d.ts.map +1 -0
- package/dist/types/cli/main.d.ts +69 -0
- package/dist/types/cli/main.d.ts.map +1 -0
- package/dist/types/cli/repo-context.d.ts +30 -0
- package/dist/types/cli/repo-context.d.ts.map +1 -0
- package/dist/types/daemon/adapter.d.ts +74 -0
- package/dist/types/daemon/adapter.d.ts.map +1 -0
- package/dist/types/daemon/adapters/github.d.ts +10 -0
- package/dist/types/daemon/adapters/github.d.ts.map +1 -0
- package/dist/types/daemon/adapters/go.d.ts +10 -0
- package/dist/types/daemon/adapters/go.d.ts.map +1 -0
- package/dist/types/daemon/adapters/index.d.ts +22 -0
- package/dist/types/daemon/adapters/index.d.ts.map +1 -0
- package/dist/types/daemon/adapters/npm.d.ts +10 -0
- package/dist/types/daemon/adapters/npm.d.ts.map +1 -0
- package/dist/types/daemon/adapters/oci.d.ts +10 -0
- package/dist/types/daemon/adapters/oci.d.ts.map +1 -0
- package/dist/types/daemon/index.d.ts +14 -0
- package/dist/types/daemon/index.d.ts.map +1 -0
- package/dist/types/daemon/server.d.ts +55 -0
- package/dist/types/daemon/server.d.ts.map +1 -0
- package/dist/types/git-remote/credential-helper.d.ts +49 -0
- package/dist/types/git-remote/credential-helper.d.ts.map +1 -0
- package/dist/types/git-remote/credential-main.d.ts +24 -0
- package/dist/types/git-remote/credential-main.d.ts.map +1 -0
- package/dist/types/git-remote/index.d.ts +10 -0
- package/dist/types/git-remote/index.d.ts.map +1 -0
- package/dist/types/git-remote/main.d.ts +23 -0
- package/dist/types/git-remote/main.d.ts.map +1 -0
- package/dist/types/git-remote/parse-url.d.ts +32 -0
- package/dist/types/git-remote/parse-url.d.ts.map +1 -0
- package/dist/types/git-remote/resolve.d.ts +30 -0
- package/dist/types/git-remote/resolve.d.ts.map +1 -0
- package/dist/types/git-remote/service.d.ts +75 -0
- package/dist/types/git-remote/service.d.ts.map +1 -0
- package/dist/types/git-server/auth.d.ts +129 -0
- package/dist/types/git-server/auth.d.ts.map +1 -0
- package/dist/types/git-server/bundle-restore.d.ts +48 -0
- package/dist/types/git-server/bundle-restore.d.ts.map +1 -0
- package/dist/types/git-server/bundle-sync.d.ts +90 -0
- package/dist/types/git-server/bundle-sync.d.ts.map +1 -0
- package/dist/types/git-server/did-service.d.ts +26 -0
- package/dist/types/git-server/did-service.d.ts.map +1 -0
- package/dist/types/git-server/git-backend.d.ts +84 -0
- package/dist/types/git-server/git-backend.d.ts.map +1 -0
- package/dist/types/git-server/http-handler.d.ts +73 -0
- package/dist/types/git-server/http-handler.d.ts.map +1 -0
- package/dist/types/git-server/index.d.ts +16 -0
- package/dist/types/git-server/index.d.ts.map +1 -0
- package/dist/types/git-server/push-authorizer.d.ts +38 -0
- package/dist/types/git-server/push-authorizer.d.ts.map +1 -0
- package/dist/types/git-server/ref-sync.d.ts +52 -0
- package/dist/types/git-server/ref-sync.d.ts.map +1 -0
- package/dist/types/git-server/server.d.ts +70 -0
- package/dist/types/git-server/server.d.ts.map +1 -0
- package/dist/types/git-server/verify.d.ts +12 -0
- package/dist/types/git-server/verify.d.ts.map +1 -0
- package/dist/types/github-shim/helpers.d.ts +108 -0
- package/dist/types/github-shim/helpers.d.ts.map +1 -0
- package/dist/types/github-shim/index.d.ts +15 -0
- package/dist/types/github-shim/index.d.ts.map +1 -0
- package/dist/types/github-shim/issues.d.ts +24 -0
- package/dist/types/github-shim/issues.d.ts.map +1 -0
- package/dist/types/github-shim/pulls.d.ts +31 -0
- package/dist/types/github-shim/pulls.d.ts.map +1 -0
- package/dist/types/github-shim/releases.d.ts +18 -0
- package/dist/types/github-shim/releases.d.ts.map +1 -0
- package/dist/types/github-shim/repos.d.ts +21 -0
- package/dist/types/github-shim/repos.d.ts.map +1 -0
- package/dist/types/github-shim/server.d.ts +53 -0
- package/dist/types/github-shim/server.d.ts.map +1 -0
- package/dist/types/github-shim/users.d.ts +17 -0
- package/dist/types/github-shim/users.d.ts.map +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/indexer/api.d.ts +32 -0
- package/dist/types/indexer/api.d.ts.map +1 -0
- package/dist/types/indexer/crawler.d.ts +72 -0
- package/dist/types/indexer/crawler.d.ts.map +1 -0
- package/dist/types/indexer/index.d.ts +12 -0
- package/dist/types/indexer/index.d.ts.map +1 -0
- package/dist/types/indexer/main.d.ts +21 -0
- package/dist/types/indexer/main.d.ts.map +1 -0
- package/dist/types/indexer/store.d.ts +168 -0
- package/dist/types/indexer/store.d.ts.map +1 -0
- package/dist/types/issues.d.ts +395 -0
- package/dist/types/issues.d.ts.map +1 -0
- package/dist/types/notifications.d.ts +93 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/org.d.ts +232 -0
- package/dist/types/org.d.ts.map +1 -0
- package/dist/types/patches.d.ts +410 -0
- package/dist/types/patches.d.ts.map +1 -0
- package/dist/types/refs.d.ts +114 -0
- package/dist/types/refs.d.ts.map +1 -0
- package/dist/types/registry.d.ts +212 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/releases.d.ts +204 -0
- package/dist/types/releases.d.ts.map +1 -0
- package/dist/types/repo.d.ts +450 -0
- package/dist/types/repo.d.ts.map +1 -0
- package/dist/types/resolver/index.d.ts +13 -0
- package/dist/types/resolver/index.d.ts.map +1 -0
- package/dist/types/resolver/resolve.d.ts +80 -0
- package/dist/types/resolver/resolve.d.ts.map +1 -0
- package/dist/types/resolver/trust-chain.d.ts +54 -0
- package/dist/types/resolver/trust-chain.d.ts.map +1 -0
- package/dist/types/resolver/verify.d.ts +62 -0
- package/dist/types/resolver/verify.d.ts.map +1 -0
- package/dist/types/shims/go/index.d.ts +11 -0
- package/dist/types/shims/go/index.d.ts.map +1 -0
- package/dist/types/shims/go/proxy.d.ts +51 -0
- package/dist/types/shims/go/proxy.d.ts.map +1 -0
- package/dist/types/shims/go/server.d.ts +23 -0
- package/dist/types/shims/go/server.d.ts.map +1 -0
- package/dist/types/shims/index.d.ts +18 -0
- package/dist/types/shims/index.d.ts.map +1 -0
- package/dist/types/shims/npm/index.d.ts +11 -0
- package/dist/types/shims/npm/index.d.ts.map +1 -0
- package/dist/types/shims/npm/registry.d.ts +46 -0
- package/dist/types/shims/npm/registry.d.ts.map +1 -0
- package/dist/types/shims/npm/server.d.ts +23 -0
- package/dist/types/shims/npm/server.d.ts.map +1 -0
- package/dist/types/shims/oci/index.d.ts +11 -0
- package/dist/types/shims/oci/index.d.ts.map +1 -0
- package/dist/types/shims/oci/registry.d.ts +56 -0
- package/dist/types/shims/oci/registry.d.ts.map +1 -0
- package/dist/types/shims/oci/server.d.ts +23 -0
- package/dist/types/shims/oci/server.d.ts.map +1 -0
- package/dist/types/social.d.ts +162 -0
- package/dist/types/social.d.ts.map +1 -0
- package/dist/types/web/html.d.ts +23 -0
- package/dist/types/web/html.d.ts.map +1 -0
- package/dist/types/web/index.d.ts +8 -0
- package/dist/types/web/index.d.ts.map +1 -0
- package/dist/types/web/routes.d.ts +21 -0
- package/dist/types/web/routes.d.ts.map +1 -0
- package/dist/types/web/server.d.ts +38 -0
- package/dist/types/web/server.d.ts.map +1 -0
- package/dist/types/wiki.d.ts +143 -0
- package/dist/types/wiki.d.ts.map +1 -0
- package/package.json +108 -0
- package/schemas/ci/check-run.json +23 -0
- package/schemas/ci/check-suite.json +23 -0
- package/schemas/issues/assignment.json +17 -0
- package/schemas/issues/comment.json +14 -0
- package/schemas/issues/issue.json +20 -0
- package/schemas/issues/label.json +17 -0
- package/schemas/issues/reaction.json +14 -0
- package/schemas/issues/status-change.json +14 -0
- package/schemas/notifications/notification.json +20 -0
- package/schemas/org/org-member.json +17 -0
- package/schemas/org/org.json +26 -0
- package/schemas/org/team-member.json +17 -0
- package/schemas/org/team.json +17 -0
- package/schemas/patches/merge-result.json +14 -0
- package/schemas/patches/patch-status-change.json +14 -0
- package/schemas/patches/patch.json +20 -0
- package/schemas/patches/review-comment.json +17 -0
- package/schemas/patches/review.json +14 -0
- package/schemas/patches/revision.json +30 -0
- package/schemas/refs/git-ref.json +32 -0
- package/schemas/registry/attestation.json +23 -0
- package/schemas/registry/package-version.json +23 -0
- package/schemas/registry/package.json +32 -0
- package/schemas/releases/release.json +17 -0
- package/schemas/repo/collaborator.json +17 -0
- package/schemas/repo/repo.json +35 -0
- package/schemas/repo/settings.json +39 -0
- package/schemas/repo/topic.json +14 -0
- package/schemas/repo/webhook.json +26 -0
- package/schemas/social/activity.json +23 -0
- package/schemas/social/follow.json +17 -0
- package/schemas/social/star.json +20 -0
- package/schemas/wiki/wiki-history.json +20 -0
- package/schemas/wiki/wiki-page.json +17 -0
- package/src/ci.ts +118 -0
- package/src/cli/agent.ts +117 -0
- package/src/cli/commands/ci.ts +300 -0
- package/src/cli/commands/clone.ts +78 -0
- package/src/cli/commands/daemon.ts +129 -0
- package/src/cli/commands/github-api.ts +30 -0
- package/src/cli/commands/init.ts +69 -0
- package/src/cli/commands/issue.ts +321 -0
- package/src/cli/commands/log.ts +106 -0
- package/src/cli/commands/migrate.ts +525 -0
- package/src/cli/commands/notification.ts +148 -0
- package/src/cli/commands/org.ts +381 -0
- package/src/cli/commands/patch.ts +413 -0
- package/src/cli/commands/registry.ts +542 -0
- package/src/cli/commands/release.ts +189 -0
- package/src/cli/commands/repo.ts +160 -0
- package/src/cli/commands/serve.ts +153 -0
- package/src/cli/commands/setup.ts +97 -0
- package/src/cli/commands/shim.ts +79 -0
- package/src/cli/commands/social.ts +221 -0
- package/src/cli/commands/web.ts +30 -0
- package/src/cli/commands/wiki.ts +199 -0
- package/src/cli/flags.ts +28 -0
- package/src/cli/main.ts +350 -0
- package/src/cli/repo-context.ts +55 -0
- package/src/daemon/adapter.ts +95 -0
- package/src/daemon/adapters/github.ts +86 -0
- package/src/daemon/adapters/go.ts +47 -0
- package/src/daemon/adapters/index.ts +36 -0
- package/src/daemon/adapters/npm.ts +47 -0
- package/src/daemon/adapters/oci.ts +59 -0
- package/src/daemon/index.ts +16 -0
- package/src/daemon/server.ts +204 -0
- package/src/git-remote/credential-helper.ts +114 -0
- package/src/git-remote/credential-main.ts +118 -0
- package/src/git-remote/index.ts +10 -0
- package/src/git-remote/main.ts +74 -0
- package/src/git-remote/parse-url.ts +81 -0
- package/src/git-remote/resolve.ts +207 -0
- package/src/git-remote/service.ts +126 -0
- package/src/git-server/auth.ts +308 -0
- package/src/git-server/bundle-restore.ts +217 -0
- package/src/git-server/bundle-sync.ts +300 -0
- package/src/git-server/did-service.ts +77 -0
- package/src/git-server/git-backend.ts +222 -0
- package/src/git-server/http-handler.ts +386 -0
- package/src/git-server/index.ts +16 -0
- package/src/git-server/push-authorizer.ts +77 -0
- package/src/git-server/ref-sync.ts +166 -0
- package/src/git-server/server.ts +236 -0
- package/src/git-server/verify.ts +116 -0
- package/src/github-shim/helpers.ts +311 -0
- package/src/github-shim/index.ts +35 -0
- package/src/github-shim/issues.ts +389 -0
- package/src/github-shim/pulls.ts +500 -0
- package/src/github-shim/releases.ts +185 -0
- package/src/github-shim/repos.ts +95 -0
- package/src/github-shim/server.ts +334 -0
- package/src/github-shim/users.ts +63 -0
- package/src/index.ts +26 -0
- package/src/indexer/api.ts +162 -0
- package/src/indexer/crawler.ts +290 -0
- package/src/indexer/index.ts +22 -0
- package/src/indexer/main.ts +83 -0
- package/src/indexer/store.ts +408 -0
- package/src/issues.ts +200 -0
- package/src/notifications.ts +80 -0
- package/src/org.ts +147 -0
- package/src/patches.ts +203 -0
- package/src/refs.ts +94 -0
- package/src/registry.ts +132 -0
- package/src/releases.ts +124 -0
- package/src/repo.ts +234 -0
- package/src/resolver/index.ts +42 -0
- package/src/resolver/resolve.ts +244 -0
- package/src/resolver/trust-chain.ts +217 -0
- package/src/resolver/verify.ts +237 -0
- package/src/shims/go/index.ts +14 -0
- package/src/shims/go/proxy.ts +336 -0
- package/src/shims/go/server.ts +82 -0
- package/src/shims/index.ts +20 -0
- package/src/shims/npm/index.ts +14 -0
- package/src/shims/npm/registry.ts +288 -0
- package/src/shims/npm/server.ts +84 -0
- package/src/shims/oci/index.ts +14 -0
- package/src/shims/oci/registry.ts +334 -0
- package/src/shims/oci/server.ts +94 -0
- package/src/social.ts +116 -0
- package/src/web/html.ts +120 -0
- package/src/web/index.ts +8 -0
- package/src/web/routes.ts +449 -0
- package/src/web/server.ts +256 -0
- package/src/wiki.ts +102 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm registry shim adapter for the unified daemon.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `handleNpmRequest()` behind the `ShimAdapter` interface.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
10
|
+
|
|
11
|
+
import type { AgentContext } from '../../cli/agent.js';
|
|
12
|
+
import type { ShimAdapter } from '../adapter.js';
|
|
13
|
+
|
|
14
|
+
import { handleNpmRequest } from '../../shims/npm/registry.js';
|
|
15
|
+
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Adapter
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
export const npmAdapter: ShimAdapter = {
|
|
21
|
+
id : 'npm',
|
|
22
|
+
name : 'npm registry',
|
|
23
|
+
defaultPort : 4873,
|
|
24
|
+
portEnvVar : 'GITD_NPM_SHIM_PORT',
|
|
25
|
+
corsMethods : 'GET, OPTIONS',
|
|
26
|
+
corsHeaders : 'Authorization, Accept',
|
|
27
|
+
usageHint : 'npm install --registry=http://localhost:{port} @did:dht:<id>/<package>',
|
|
28
|
+
|
|
29
|
+
async handle(ctx: AgentContext, req: IncomingMessage, res: ServerResponse): Promise<void> {
|
|
30
|
+
if (req.method !== 'GET') {
|
|
31
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
32
|
+
res.end(JSON.stringify({ error: 'Method not allowed. This is a read-only registry shim.' }));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const port = (req.socket.address() as { port?: number })?.port ?? 4873;
|
|
38
|
+
const url = new URL(req.url ?? '/', `http://localhost:${port}`);
|
|
39
|
+
const result = await handleNpmRequest(ctx, url);
|
|
40
|
+
res.writeHead(result.status, result.headers);
|
|
41
|
+
res.end(result.body);
|
|
42
|
+
} catch {
|
|
43
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
44
|
+
res.end(JSON.stringify({ error: 'Internal server error' }));
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OCI/Docker registry shim adapter for the unified daemon.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `handleOciRequest()` behind the `ShimAdapter` interface.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
10
|
+
|
|
11
|
+
import type { AgentContext } from '../../cli/agent.js';
|
|
12
|
+
import type { ShimAdapter } from '../adapter.js';
|
|
13
|
+
|
|
14
|
+
import { handleOciRequest } from '../../shims/oci/registry.js';
|
|
15
|
+
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Adapter
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
export const ociAdapter: ShimAdapter = {
|
|
21
|
+
id : 'oci',
|
|
22
|
+
name : 'OCI/Docker registry',
|
|
23
|
+
defaultPort : 5555,
|
|
24
|
+
portEnvVar : 'GITD_OCI_SHIM_PORT',
|
|
25
|
+
corsMethods : 'GET, HEAD, OPTIONS',
|
|
26
|
+
corsHeaders : 'Authorization, Accept, Docker-Distribution-Api-Version',
|
|
27
|
+
usageHint : 'docker pull localhost:{port}/did:dht:<id>/<image>:<tag>',
|
|
28
|
+
|
|
29
|
+
async handle(ctx: AgentContext, req: IncomingMessage, res: ServerResponse): Promise<void> {
|
|
30
|
+
const method = req.method ?? 'GET';
|
|
31
|
+
|
|
32
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
33
|
+
res.writeHead(405, {
|
|
34
|
+
'Content-Type' : 'application/json',
|
|
35
|
+
'Docker-Distribution-Api-Version' : 'registry/2.0',
|
|
36
|
+
});
|
|
37
|
+
res.end(JSON.stringify({
|
|
38
|
+
errors: [{ code: 'UNSUPPORTED', message: 'This is a read-only registry shim.', detail: null }],
|
|
39
|
+
}));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const port = (req.socket.address() as { port?: number })?.port ?? 5555;
|
|
45
|
+
const url = new URL(req.url ?? '/', `http://localhost:${port}`);
|
|
46
|
+
const result = await handleOciRequest(ctx, url, method);
|
|
47
|
+
res.writeHead(result.status, result.headers);
|
|
48
|
+
res.end(result.body);
|
|
49
|
+
} catch {
|
|
50
|
+
res.writeHead(500, {
|
|
51
|
+
'Content-Type' : 'application/json',
|
|
52
|
+
'Docker-Distribution-Api-Version' : 'registry/2.0',
|
|
53
|
+
});
|
|
54
|
+
res.end(JSON.stringify({
|
|
55
|
+
errors: [{ code: 'UNKNOWN', message: 'Internal server error', detail: null }],
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified daemon — barrel exports.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type { DaemonConfig, ResolvedShimConfig, ShimAdapter, ShimConfig } from './adapter.js';
|
|
8
|
+
export type { DaemonInstance, DaemonOptions } from './server.js';
|
|
9
|
+
|
|
10
|
+
export { createAdapterServer, resolveConfig, startDaemon } from './server.js';
|
|
11
|
+
export { builtinAdapters, findAdapter } from './adapters/index.js';
|
|
12
|
+
|
|
13
|
+
export { githubAdapter } from './adapters/github.js';
|
|
14
|
+
export { goAdapter } from './adapters/go.js';
|
|
15
|
+
export { npmAdapter } from './adapters/npm.js';
|
|
16
|
+
export { ociAdapter } from './adapters/oci.js';
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified daemon server — starts one HTTP server per enabled shim adapter.
|
|
3
|
+
*
|
|
4
|
+
* The daemon manages the lifecycle of all shim servers from a single
|
|
5
|
+
* process. It resolves configuration (JSON file, env vars, defaults),
|
|
6
|
+
* starts each enabled adapter on its assigned port, logs a status
|
|
7
|
+
* summary, and handles graceful shutdown on SIGINT/SIGTERM.
|
|
8
|
+
*
|
|
9
|
+
* Each adapter's server includes:
|
|
10
|
+
* - CORS preflight handling (OPTIONS)
|
|
11
|
+
* - A `/health` endpoint returning `{ status: 'ok', shim: '<id>' }`
|
|
12
|
+
* - Delegation to the adapter's `handle()` method for all other requests
|
|
13
|
+
* - Top-level error catching with 500 responses
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Server } from 'node:http';
|
|
19
|
+
|
|
20
|
+
import { createServer } from 'node:http';
|
|
21
|
+
|
|
22
|
+
import type { AgentContext } from '../cli/agent.js';
|
|
23
|
+
import type { DaemonConfig, ResolvedShimConfig, ShimAdapter } from './adapter.js';
|
|
24
|
+
|
|
25
|
+
import { builtinAdapters } from './adapters/index.js';
|
|
26
|
+
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Types
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
export type DaemonOptions = {
|
|
32
|
+
ctx : AgentContext;
|
|
33
|
+
config : DaemonConfig;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type DaemonInstance = {
|
|
37
|
+
/** All running HTTP servers keyed by adapter id. */
|
|
38
|
+
servers : Map<string, Server>;
|
|
39
|
+
|
|
40
|
+
/** The resolved config for each adapter. */
|
|
41
|
+
resolved : ResolvedShimConfig[];
|
|
42
|
+
|
|
43
|
+
/** Gracefully shut down all servers. */
|
|
44
|
+
stop(): Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Config resolution
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the effective configuration for every known adapter.
|
|
53
|
+
*
|
|
54
|
+
* Priority for port: config file > env var > adapter default.
|
|
55
|
+
* Priority for enabled: config file > `true` (all enabled by default).
|
|
56
|
+
*/
|
|
57
|
+
export function resolveConfig(
|
|
58
|
+
config: DaemonConfig,
|
|
59
|
+
adapters: readonly ShimAdapter[] = builtinAdapters,
|
|
60
|
+
): ResolvedShimConfig[] {
|
|
61
|
+
return adapters.map((adapter) => {
|
|
62
|
+
const entry = config.shims?.[adapter.id];
|
|
63
|
+
const envPort = process.env[adapter.portEnvVar];
|
|
64
|
+
|
|
65
|
+
const envParsed = envPort ? parseInt(envPort, 10) : undefined;
|
|
66
|
+
const port = entry?.port
|
|
67
|
+
?? (envParsed !== undefined && !Number.isNaN(envParsed) ? envParsed : undefined)
|
|
68
|
+
?? adapter.defaultPort;
|
|
69
|
+
|
|
70
|
+
const enabled = entry?.enabled ?? true;
|
|
71
|
+
|
|
72
|
+
return { adapter, enabled, port };
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Server factory
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Create an HTTP server for a single adapter.
|
|
82
|
+
*
|
|
83
|
+
* The server handles CORS preflight, `/health`, and delegates
|
|
84
|
+
* everything else to the adapter. It does NOT call `server.listen()`
|
|
85
|
+
* — the caller is responsible for that.
|
|
86
|
+
*/
|
|
87
|
+
export function createAdapterServer(ctx: AgentContext, adapter: ShimAdapter): Server {
|
|
88
|
+
const corsMethods = adapter.corsMethods ?? 'GET, OPTIONS';
|
|
89
|
+
const corsHeaders = adapter.corsHeaders ?? 'Authorization, Accept, Content-Type';
|
|
90
|
+
|
|
91
|
+
return createServer(async (req, res) => {
|
|
92
|
+
const method = req.method ?? 'GET';
|
|
93
|
+
|
|
94
|
+
// CORS preflight.
|
|
95
|
+
if (method === 'OPTIONS') {
|
|
96
|
+
res.writeHead(204, {
|
|
97
|
+
'Access-Control-Allow-Origin' : '*',
|
|
98
|
+
'Access-Control-Allow-Methods' : corsMethods,
|
|
99
|
+
'Access-Control-Allow-Headers' : corsHeaders,
|
|
100
|
+
'Access-Control-Max-Age' : '86400',
|
|
101
|
+
});
|
|
102
|
+
res.end();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Health endpoint.
|
|
107
|
+
if (req.url === '/health') {
|
|
108
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
109
|
+
res.end(JSON.stringify({ status: 'ok', shim: adapter.id }));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Delegate to adapter.
|
|
114
|
+
try {
|
|
115
|
+
await adapter.handle(ctx, req, res);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.error(`[daemon:${adapter.id}] Error: ${(err as Error).message}`);
|
|
118
|
+
if (!res.headersSent) {
|
|
119
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
120
|
+
res.end(JSON.stringify({ error: 'Internal server error' }));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Daemon lifecycle
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Start the unified daemon.
|
|
132
|
+
*
|
|
133
|
+
* Resolves configuration, starts one HTTP server per enabled adapter,
|
|
134
|
+
* registers SIGINT/SIGTERM handlers, and returns the `DaemonInstance`
|
|
135
|
+
* for programmatic control and testing.
|
|
136
|
+
*/
|
|
137
|
+
export async function startDaemon(options: DaemonOptions): Promise<DaemonInstance> {
|
|
138
|
+
const { ctx, config } = options;
|
|
139
|
+
const resolved = resolveConfig(config);
|
|
140
|
+
const servers = new Map<string, Server>();
|
|
141
|
+
|
|
142
|
+
const enabledAdapters = resolved.filter((r) => r.enabled);
|
|
143
|
+
|
|
144
|
+
if (enabledAdapters.length === 0) {
|
|
145
|
+
console.log('[daemon] No shims enabled — nothing to start.');
|
|
146
|
+
return { servers, resolved, stop: async (): Promise<void> => {} };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Start each enabled adapter.
|
|
150
|
+
const startPromises = enabledAdapters.map((r) => {
|
|
151
|
+
return new Promise<void>((resolve, reject) => {
|
|
152
|
+
const server = createAdapterServer(ctx, r.adapter);
|
|
153
|
+
|
|
154
|
+
server.on('error', (err: NodeJS.ErrnoException) => {
|
|
155
|
+
if (err.code === 'EADDRINUSE') {
|
|
156
|
+
console.error(`[daemon:${r.adapter.id}] Port ${r.port} is already in use — skipping.`);
|
|
157
|
+
resolve();
|
|
158
|
+
} else {
|
|
159
|
+
reject(err);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
server.listen(r.port, () => {
|
|
164
|
+
servers.set(r.adapter.id, server);
|
|
165
|
+
resolve();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
await Promise.all(startPromises);
|
|
171
|
+
|
|
172
|
+
// Print status summary.
|
|
173
|
+
console.log('[daemon] gitd daemon started');
|
|
174
|
+
console.log('');
|
|
175
|
+
for (const r of enabledAdapters) {
|
|
176
|
+
const running = servers.has(r.adapter.id);
|
|
177
|
+
const status = running ? `http://localhost:${r.port}` : 'FAILED';
|
|
178
|
+
console.log(` ${r.adapter.name.padEnd(22)} ${status}`);
|
|
179
|
+
if (running && r.adapter.usageHint) {
|
|
180
|
+
console.log(` ${''.padEnd(22)} ${r.adapter.usageHint.replace('{port}', String(r.port))}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
console.log('');
|
|
184
|
+
console.log(`[daemon] ${servers.size}/${enabledAdapters.length} shims running. Health: GET /health on any port.`);
|
|
185
|
+
console.log('[daemon] Press Ctrl+C to stop.');
|
|
186
|
+
console.log('');
|
|
187
|
+
|
|
188
|
+
// Build the stop function.
|
|
189
|
+
const stop = async (): Promise<void> => {
|
|
190
|
+
const closePromises: Promise<void>[] = [];
|
|
191
|
+
for (const [id, server] of servers) {
|
|
192
|
+
closePromises.push(new Promise<void>((resolve) => {
|
|
193
|
+
server.close(() => {
|
|
194
|
+
console.log(`[daemon:${id}] stopped`);
|
|
195
|
+
resolve();
|
|
196
|
+
});
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
await Promise.all(closePromises);
|
|
200
|
+
servers.clear();
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
return { servers, resolved, stop };
|
|
204
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Git credential helper for DID-based push authentication.
|
|
4
|
+
*
|
|
5
|
+
* Git invokes credential helpers with a single argument: `get`, `store`, or
|
|
6
|
+
* `erase`. For `get`, the helper reads the request from stdin and writes
|
|
7
|
+
* credentials to stdout.
|
|
8
|
+
*
|
|
9
|
+
* This helper creates a DID-signed push token using the local Web5 agent's
|
|
10
|
+
* identity, formatted as HTTP Basic auth credentials:
|
|
11
|
+
* username: did-auth
|
|
12
|
+
* password: <base64url-signature>.<base64url-token>
|
|
13
|
+
*
|
|
14
|
+
* Usage in .gitconfig:
|
|
15
|
+
* [credential "https://git.example.com"]
|
|
16
|
+
* helper = /path/to/gitd-credential-helper
|
|
17
|
+
*
|
|
18
|
+
* Environment:
|
|
19
|
+
* GITD_PASSWORD — vault password for the local agent
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { Ed25519 } from '@enbox/crypto';
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
createPushTokenPayload,
|
|
28
|
+
DID_AUTH_USERNAME,
|
|
29
|
+
encodePushToken,
|
|
30
|
+
formatAuthPassword,
|
|
31
|
+
} from '../git-server/auth.js';
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Types
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
/** Parsed credential request from git. */
|
|
38
|
+
type CredentialRequest = {
|
|
39
|
+
protocol?: string;
|
|
40
|
+
host?: string;
|
|
41
|
+
path?: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Credential helper logic
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generate push credentials for a git request.
|
|
50
|
+
*
|
|
51
|
+
* @param request - The parsed credential request from git
|
|
52
|
+
* @param agentDid - The local agent's DID
|
|
53
|
+
* @param privateKeyJwk - The agent's Ed25519 private key (JWK)
|
|
54
|
+
* @returns The credential response to write to stdout, or undefined if not applicable
|
|
55
|
+
*/
|
|
56
|
+
export async function generatePushCredentials(
|
|
57
|
+
request: CredentialRequest,
|
|
58
|
+
agentDid: string,
|
|
59
|
+
privateKeyJwk: Record<string, unknown>,
|
|
60
|
+
): Promise<{ username: string; password: string } | undefined> {
|
|
61
|
+
// Extract the owner DID and repo from the URL path.
|
|
62
|
+
// Expected path format: /<did>/<repo> or /<prefix>/<did>/<repo>
|
|
63
|
+
const path = request.path ?? '';
|
|
64
|
+
const segments = path.split('/').filter(Boolean);
|
|
65
|
+
|
|
66
|
+
// Find the DID segment (starts with "did:").
|
|
67
|
+
const didIdx = segments.findIndex((s) => s.startsWith('did:'));
|
|
68
|
+
if (didIdx === -1) { return undefined; }
|
|
69
|
+
|
|
70
|
+
const ownerDid = segments[didIdx];
|
|
71
|
+
const repo = segments[didIdx + 1];
|
|
72
|
+
if (!repo) { return undefined; }
|
|
73
|
+
|
|
74
|
+
// Create and sign the push token.
|
|
75
|
+
const payload = createPushTokenPayload(agentDid, ownerDid, repo);
|
|
76
|
+
const token = encodePushToken(payload);
|
|
77
|
+
const tokenBytes = new TextEncoder().encode(token);
|
|
78
|
+
|
|
79
|
+
const signature = await Ed25519.sign({
|
|
80
|
+
key : privateKeyJwk as any,
|
|
81
|
+
data : tokenBytes,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const signatureBase64url = Buffer.from(signature).toString('base64url');
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
username : DID_AUTH_USERNAME,
|
|
88
|
+
password : formatAuthPassword({ signature: signatureBase64url, token }),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// stdin/stdout protocol
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
/** Parse a git credential helper request from stdin lines. */
|
|
97
|
+
export function parseCredentialRequest(input: string): CredentialRequest {
|
|
98
|
+
const result: CredentialRequest = {};
|
|
99
|
+
for (const line of input.split('\n')) {
|
|
100
|
+
const eqIdx = line.indexOf('=');
|
|
101
|
+
if (eqIdx === -1) { continue; }
|
|
102
|
+
const key = line.slice(0, eqIdx).trim();
|
|
103
|
+
const value = line.slice(eqIdx + 1).trim();
|
|
104
|
+
if (key === 'protocol') { result.protocol = value; }
|
|
105
|
+
if (key === 'host') { result.host = value; }
|
|
106
|
+
if (key === 'path') { result.path = value; }
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Format a credential response for git. */
|
|
112
|
+
export function formatCredentialResponse(creds: { username: string; password: string }): string {
|
|
113
|
+
return `username=${creds.username}\npassword=${creds.password}\n`;
|
|
114
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Git credential helper entry point for DID-based push authentication.
|
|
4
|
+
*
|
|
5
|
+
* Git invokes this binary with a single argument: `get`, `store`, or `erase`.
|
|
6
|
+
* For `get`, the helper reads the request from stdin (key=value lines) and
|
|
7
|
+
* writes credentials to stdout.
|
|
8
|
+
*
|
|
9
|
+
* This helper creates a DID-signed push token using the local Web5 agent's
|
|
10
|
+
* identity, formatted as HTTP Basic auth credentials:
|
|
11
|
+
* username: did-auth
|
|
12
|
+
* password: <base64url-signature>.<base64url-token>
|
|
13
|
+
*
|
|
14
|
+
* Install in .gitconfig:
|
|
15
|
+
* [credential]
|
|
16
|
+
* helper = /path/to/git-remote-did-credential
|
|
17
|
+
*
|
|
18
|
+
* Environment:
|
|
19
|
+
* GITD_PASSWORD — vault password for the local agent
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { Web5 } from '@enbox/api';
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
createPushTokenPayload,
|
|
28
|
+
DID_AUTH_USERNAME,
|
|
29
|
+
encodePushToken,
|
|
30
|
+
formatAuthPassword,
|
|
31
|
+
} from '../git-server/auth.js';
|
|
32
|
+
import {
|
|
33
|
+
formatCredentialResponse,
|
|
34
|
+
parseCredentialRequest,
|
|
35
|
+
} from './credential-helper.js';
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Main
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
async function main(): Promise<void> {
|
|
42
|
+
const action = process.argv[2];
|
|
43
|
+
|
|
44
|
+
// Only handle `get` requests — `store` and `erase` are no-ops.
|
|
45
|
+
if (action !== 'get') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Read the credential request from stdin.
|
|
50
|
+
const input = await readStdin();
|
|
51
|
+
const request = parseCredentialRequest(input);
|
|
52
|
+
|
|
53
|
+
// We only handle HTTP/HTTPS requests.
|
|
54
|
+
if (request.protocol && request.protocol !== 'https' && request.protocol !== 'http') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Connect to the local agent to get the DID and signing key.
|
|
59
|
+
const password = process.env.GITD_PASSWORD;
|
|
60
|
+
if (!password) {
|
|
61
|
+
// Credential helpers must be non-interactive. If no password is set,
|
|
62
|
+
// silently exit and let git fall back to another credential helper.
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { web5, did } = await Web5.connect({
|
|
67
|
+
password,
|
|
68
|
+
sync: 'off',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Extract the owner DID and repo from the URL path.
|
|
72
|
+
const path = request.path ?? '';
|
|
73
|
+
const segments = path.split('/').filter(Boolean);
|
|
74
|
+
const didIdx = segments.findIndex((s) => s.startsWith('did:'));
|
|
75
|
+
if (didIdx === -1) { return; }
|
|
76
|
+
|
|
77
|
+
const ownerDid = segments[didIdx];
|
|
78
|
+
const repo = segments[didIdx + 1];
|
|
79
|
+
if (!repo) { return; }
|
|
80
|
+
|
|
81
|
+
// Create the push token.
|
|
82
|
+
const payload = createPushTokenPayload(did, ownerDid, repo);
|
|
83
|
+
const token = encodePushToken(payload);
|
|
84
|
+
|
|
85
|
+
// Sign the token using the agent's DID signer.
|
|
86
|
+
const signer = await web5.agent.agentDid.getSigner();
|
|
87
|
+
const tokenBytes = new TextEncoder().encode(token);
|
|
88
|
+
const signature = await signer.sign({ data: tokenBytes });
|
|
89
|
+
const signatureBase64url = Buffer.from(signature).toString('base64url');
|
|
90
|
+
|
|
91
|
+
const creds = {
|
|
92
|
+
username : DID_AUTH_USERNAME,
|
|
93
|
+
password : formatAuthPassword({ signature: signatureBase64url, token }),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
process.stdout.write(formatCredentialResponse(creds));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Helpers
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
/** Read all of stdin until EOF. */
|
|
104
|
+
function readStdin(): Promise<string> {
|
|
105
|
+
return new Promise((resolve) => {
|
|
106
|
+
let buf = '';
|
|
107
|
+
process.stdin.setEncoding('utf8');
|
|
108
|
+
process.stdin.on('data', (chunk: string) => { buf += chunk; });
|
|
109
|
+
process.stdin.on('end', () => resolve(buf));
|
|
110
|
+
process.stdin.resume();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
main().catch(() => {
|
|
115
|
+
// Credential helpers must never crash loudly — silent exit on error
|
|
116
|
+
// lets git fall back to the next configured credential helper.
|
|
117
|
+
process.exit(0);
|
|
118
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* git-remote-did — Git remote helper for DID-addressed repositories.
|
|
4
|
+
*
|
|
5
|
+
* This helper is invoked by Git when it encounters a `did::` or `did://`
|
|
6
|
+
* remote URL. It resolves the DID to an HTTPS endpoint and delegates all
|
|
7
|
+
* git transport to `git-remote-https`.
|
|
8
|
+
*
|
|
9
|
+
* Usage (invoked by Git, not directly):
|
|
10
|
+
* git clone did::dht:abc123/my-repo
|
|
11
|
+
* git remote add origin did::dht:abc123/my-repo
|
|
12
|
+
* git push origin main
|
|
13
|
+
*
|
|
14
|
+
* The helper:
|
|
15
|
+
* 1. Parses the DID from the URL
|
|
16
|
+
* 2. Resolves the DID document
|
|
17
|
+
* 3. Extracts the GitTransport or DWN service endpoint
|
|
18
|
+
* 4. Execs `git-remote-https` with the resolved HTTPS URL
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { spawn } from 'node:child_process';
|
|
24
|
+
|
|
25
|
+
import { parseDidUrl } from './parse-url.js';
|
|
26
|
+
import { resolveGitEndpoint } from './resolve.js';
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Main
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
async function main(): Promise<void> {
|
|
33
|
+
const remoteName = process.argv[2];
|
|
34
|
+
const url = process.argv[3] ?? remoteName;
|
|
35
|
+
|
|
36
|
+
if (!url) {
|
|
37
|
+
console.error('git-remote-did: missing URL argument');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Parse DID from URL.
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = parseDidUrl(url);
|
|
45
|
+
} catch (err: unknown) {
|
|
46
|
+
console.error(`git-remote-did: ${(err as Error).message}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Resolve DID → HTTPS endpoint.
|
|
51
|
+
let endpoint;
|
|
52
|
+
try {
|
|
53
|
+
endpoint = await resolveGitEndpoint(parsed.did, parsed.repo);
|
|
54
|
+
} catch (err: unknown) {
|
|
55
|
+
console.error(`git-remote-did: ${(err as Error).message}`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.error(`git-remote-did: resolved ${parsed.did} → ${endpoint.url} (via ${endpoint.source})`);
|
|
60
|
+
|
|
61
|
+
// Delegate to git-remote-https — it handles all the transport complexity.
|
|
62
|
+
const child = spawn('git', ['remote-https', remoteName, endpoint.url], {
|
|
63
|
+
stdio: 'inherit',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
child.on('exit', (code) => {
|
|
67
|
+
process.exit(code ?? 128);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
main().catch((err: Error) => {
|
|
72
|
+
console.error(`git-remote-did: fatal: ${err.message}`);
|
|
73
|
+
process.exit(128);
|
|
74
|
+
});
|