Sample
hosted-git-info 8.1.0: fromUrl
Verified sample for npm hosted-git-info 8.1.0: fromUrl. The contract ran on node 22 · linux debian/x64 · docker and passed: hosted-git-info.fromUrl is…
sha256:943264d94ce6a8a2886a0f0d8b11fa9071117f71689d57bd803b034c0242ec34
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-20 |
Case
HOW- Goal
- verify hosted-git-info.fromUrl in pkg:npm/hosted-git-info@8.1.0
- Packages
- Symbols
-
- hosted-git-info.fromUrl
- Created
- 2026-09-20T06:55:25Z
Contract
- hosted-git-info.fromUrl is exported as a function
- hosted-git-info.fromUrl parses standard HTTPS GitHub repository URLs and extracts user and project
- hosted-git-info.fromUrl parses git protocol URLs and committish fragments for GitHub repositories
- hosted-git-info.fromUrl parses git shortcut strings such as github:user/repo
- hosted-git-info.fromUrl parses GitLab and Bitbucket repository shortcuts correctly
- hosted-git-info.fromUrl returns undefined for unsupported hosts or malformed inputs
Files
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify hosted-git-info.fromUrl in pkg:npm/hosted-git-info@8.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/hosted-git-info@8.1.0
Demonstrate these symbols/APIs:
- hosted-git-info.fromUrl
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:2a9fafdd7938eb1306e0dc9b477bb9a03f39b173e2591416792edd54270474d8","contract":["hosted-git-info.fromUrl is exported as a function","hosted-git-info.fromUrl parses standard HTTPS GitHub repository URLs and extracts user and project","hosted-git-info.fromUrl parses git protocol URLs and committish fragments for GitHub repositories","hosted-git-info.fromUrl parses git shortcut strings such as github:user/repo","hosted-git-info.fromUrl parses GitLab and Bitbucket repository shortcuts correctly","hosted-git-info.fromUrl returns undefined for unsupported hosts or malformed inputs"],"goal":"verify hosted-git-info.fromUrl in pkg:npm/hosted-git-info@8.1.0","kind":"HOW","packages":["pkg:npm/hosted-git-info@8.1.0"],"schemaVersion":1,"symbols":["hosted-git-info.fromUrl"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/hosted-git-info@8.1.0"],"schemaVersion":1,"subject":"pkg:npm/hosted-git-info@8.1.0","symbols":["hosted-git-info.fromUrl"],"verifierAdapter":"node-typescript@1"}
import hostedGitInfo from 'hosted-git-info';
export const fromUrl = hostedGitInfo.fromUrl;
/**
* Parses a git repository URL and returns a GitHost instance or undefined.
*
* @param {string} gitUrl - The repository URL or shorthand.
* @param {object} [opts] - Optional parsing options.
* @returns {object|undefined} Parsed GitHost instance or undefined if unsupported.
*/
export function parseGitUrl(gitUrl, opts) {
return hostedGitInfo.fromUrl(gitUrl, opts);
}
export default hostedGitInfo;
{
"name": "sample-hosted-git-info-from-url",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-hosted-git-info-from-url",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"hosted-git-info": "8.1.0"
}
},
"node_modules/hosted-git-info": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz",
"integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==",
"license": "ISC",
"dependencies": {
"lru-cache": "^10.0.1"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"license": "ISC"
}
}
}
{
"name": "sample-hosted-git-info-from-url",
"version": "1.0.0",
"type": "module",
"main": "index.mjs",
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"hosted-git-info": "8.1.0"
}
}
{
"schemaVersion": 1,
"goal": "verify hosted-git-info.fromUrl in pkg:npm/hosted-git-info@8.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/hosted-git-info@8.1.0"
],
"symbols": [
"hosted-git-info.fromUrl"
]
}
import assert from 'node:assert/strict';
import hostedGitInfo from 'hosted-git-info';
import { fromUrl, parseGitUrl } from '../index.mjs';
// 1. hosted-git-info.fromUrl is exported as a function
assert.equal(typeof hostedGitInfo.fromUrl, 'function');
assert.equal(typeof fromUrl, 'function');
assert.equal(typeof parseGitUrl, 'function');
// 2. hosted-git-info.fromUrl parses standard HTTPS GitHub repository URLs and extracts user and project
const infoHttps = fromUrl('https://github.com/example-user/example-repo.git');
assert.ok(infoHttps);
assert.equal(infoHttps.type, 'github');
assert.equal(infoHttps.user, 'example-user');
assert.equal(infoHttps.project, 'example-repo');
assert.equal(infoHttps.default, 'https');
assert.equal(infoHttps.https(), 'git+https://github.com/example-user/example-repo.git');
assert.equal(infoHttps.browse(), 'https://github.com/example-user/example-repo');
assert.equal(infoHttps.shortcut(), 'github:example-user/example-repo');
// 3. hosted-git-info.fromUrl parses git protocol URLs and committish fragments for GitHub repositories
const infoGit = fromUrl('git://github.com/example-user/example-repo.git#v1.0.0');
assert.ok(infoGit);
assert.equal(infoGit.type, 'github');
assert.equal(infoGit.user, 'example-user');
assert.equal(infoGit.project, 'example-repo');
assert.equal(infoGit.committish, 'v1.0.0');
assert.equal(infoGit.browse(), 'https://github.com/example-user/example-repo/tree/v1.0.0');
// 4. hosted-git-info.fromUrl parses git shortcut strings such as github:user/repo
const infoShortcut = fromUrl('github:example-user/example-repo#main');
assert.ok(infoShortcut);
assert.equal(infoShortcut.type, 'github');
assert.equal(infoShortcut.user, 'example-user');
assert.equal(infoShortcut.project, 'example-repo');
assert.equal(infoShortcut.committish, 'main');
assert.equal(infoShortcut.default, 'shortcut');
assert.equal(infoShortcut.shortcut(), 'github:example-user/example-repo#main');
assert.equal(infoShortcut.browse(), 'https://github.com/example-user/example-repo/tree/main');
// 5. hosted-git-info.fromUrl parses GitLab and Bitbucket repository shortcuts correctly
const infoGitlab = fromUrl('gitlab:example-group/example-repo');
assert.ok(infoGitlab);
assert.equal(infoGitlab.type, 'gitlab');
assert.equal(infoGitlab.user, 'example-group');
assert.equal(infoGitlab.project, 'example-repo');
assert.equal(infoGitlab.default, 'shortcut');
assert.equal(infoGitlab.shortcut(), 'gitlab:example-group/example-repo');
const infoBitbucket = fromUrl('bitbucket:example-owner/example-repo');
assert.ok(infoBitbucket);
assert.equal(infoBitbucket.type, 'bitbucket');
assert.equal(infoBitbucket.user, 'example-owner');
assert.equal(infoBitbucket.project, 'example-repo');
assert.equal(infoBitbucket.default, 'shortcut');
assert.equal(infoBitbucket.shortcut(), 'bitbucket:example-owner/example-repo');
// 6. hosted-git-info.fromUrl returns undefined for unsupported hosts or malformed inputs
assert.equal(fromUrl('https://example.com/not-a-repo'), undefined);
assert.equal(fromUrl('invalid-url-string'), undefined);
assert.equal(fromUrl(null), undefined);
assert.equal(fromUrl(undefined), undefined);
assert.equal(fromUrl(123), undefined);
// 7. module index wrapper matches hostedGitInfo.fromUrl output
assert.equal(parseGitUrl('https://example.com/not-a-repo'), undefined);
const wrappedInfo = parseGitUrl('https://github.com/example-user/example-repo.git');
assert.ok(wrappedInfo);
assert.equal(wrappedInfo.project, 'example-repo');
console.log('All hosted-git-info.fromUrl contract assertions passed.');
Origin Seeder
anonymous