Sample
linkify-it 5.0.2
Verified sample for npm linkify-it 5.0.2. The contract ran on node 22 · linux debian/x64 · docker and passed: LinkifyIt exports constructor function callable…
sha256:079e9c4f53110b565552fc6676347d161a16bfdd2804a38d9afc3843bc727063
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
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
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-15 |
Case
HOW- Goal
- verify pkg:npm/linkify-it@5.0.2
- Packages
- Environment
- node 22.23.2
- Created
- 2026-09-15T02:58:12Z
Contract
- LinkifyIt exports constructor function callable with or without new
- LinkifyIt.prototype.test validates URL presence in text and rejects non-URLs
- LinkifyIt.prototype.pretest quickly filters candidate text for possible links
- LinkifyIt.prototype.testSchemaAt validates schema prefix at specific string index
- LinkifyIt.prototype.match finds all links with offsets and normalized URLs
- LinkifyIt.prototype.matchAtStart detects link only when positioned at string start
- LinkifyIt.prototype.add registers custom protocol schema definitions with custom validation rules
- LinkifyIt.prototype.set toggles parser options including fuzzyEmail and fuzzyLink
- LinkifyIt.prototype.tlds registers additional top-level domains for recognition
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 pkg:npm/linkify-it@5.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/linkify-it@5.0.2
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:fadc8963990c93409c05e098994a34e2362c0164cc55759a91cdd8dd1056bcc2","contract":["LinkifyIt exports constructor function callable with or without new","LinkifyIt.prototype.test validates URL presence in text and rejects non-URLs","LinkifyIt.prototype.pretest quickly filters candidate text for possible links","LinkifyIt.prototype.testSchemaAt validates schema prefix at specific string index","LinkifyIt.prototype.match finds all links with offsets and normalized URLs","LinkifyIt.prototype.matchAtStart detects link only when positioned at string start","LinkifyIt.prototype.add registers custom protocol schema definitions with custom validation rules","LinkifyIt.prototype.set toggles parser options including fuzzyEmail and fuzzyLink","LinkifyIt.prototype.tlds registers additional top-level domains for recognition"],"goal":"verify pkg:npm/linkify-it@5.0.2","kind":"HOW","packages":["pkg:npm/linkify-it@5.0.2"],"schemaVersion":1,"symbols":["LinkifyIt","LinkifyIt.prototype.test","LinkifyIt.prototype.pretest","LinkifyIt.prototype.testSchemaAt","LinkifyIt.prototype.match","LinkifyIt.prototype.matchAtStart","LinkifyIt.prototype.add","LinkifyIt.prototype.set","LinkifyIt.prototype.tlds"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/linkify-it@5.0.2"],"schemaVersion":1,"subject":"pkg:npm/linkify-it@5.0.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-linkify-it",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-linkify-it",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"linkify-it": "5.0.2"
}
},
"node_modules/linkify-it": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz",
"integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/markdown-it"
}
],
"license": "MIT",
"dependencies": {
"uc.micro": "^2.0.0"
}
},
"node_modules/uc.micro": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
"license": "MIT"
}
}
}
{
"name": "sample-linkify-it",
"version": "1.0.0",
"private": true,
"description": "verify pkg:npm/linkify-it@5.0.2",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"linkify-it": "5.0.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/linkify-it@5.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/linkify-it@5.0.2"
]
}
'use strict';
const LinkifyIt = require('linkify-it');
/**
* Creates and returns a configured LinkifyIt instance.
*
* @param {object} [schemas] - Optional custom schema definitions.
* @param {object} [options] - Optional configuration options.
* @returns {LinkifyIt} A new LinkifyIt instance.
*/
function createLinkifier(schemas, options) {
return new LinkifyIt(schemas, options);
}
/**
* Finds all links in the given text.
*
* @param {string} text - The text to scan for links.
* @param {object} [options] - Optional configuration overrides.
* @returns {Array<object>|null} Array of Match objects or null if none found.
*/
function extractLinks(text, options) {
const linkifier = new LinkifyIt(null, options);
return linkifier.match(text);
}
module.exports = {
LinkifyIt,
createLinkifier,
extractLinks
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { LinkifyIt, createLinkifier, extractLinks } = require('../src/index.js');
const rawLinkifyIt = require('linkify-it');
// 1. Module export verification and constructor invocation
assert.strictEqual(typeof LinkifyIt, 'function', 'LinkifyIt must be a constructor function');
assert.strictEqual(LinkifyIt, rawLinkifyIt, 'Exported LinkifyIt must match package export');
assert.strictEqual(typeof createLinkifier, 'function', 'createLinkifier helper must be a function');
assert.strictEqual(typeof extractLinks, 'function', 'extractLinks helper must be a function');
const instanceWithNew = new LinkifyIt();
assert.ok(instanceWithNew instanceof LinkifyIt, 'new LinkifyIt() should create an instance');
const instanceWithoutNew = LinkifyIt();
assert.ok(instanceWithoutNew instanceof LinkifyIt, 'LinkifyIt() without new should create an instance');
// 2. LinkifyIt.prototype.test validates URL presence
const linkify = new LinkifyIt();
assert.strictEqual(linkify.test('Check out https://example.com/docs'), true, 'Valid URL should return true');
assert.strictEqual(linkify.test('No link here at all'), false, 'Non-URL text should return false');
assert.strictEqual(linkify.test(''), false, 'Empty string should return false');
// 3. LinkifyIt.prototype.pretest quickly filters candidate text
assert.strictEqual(linkify.pretest('Check out https://example.com'), true, 'Pretest on URL text should return true');
assert.strictEqual(linkify.pretest('just plain text'), false, 'Pretest on plain text should return false');
// 4. LinkifyIt.prototype.testSchemaAt validates schema prefix at specific string index
const testText = 'prefix http://example.com suffix';
const pos = testText.indexOf('http://') + 'http:'.length;
assert.strictEqual(linkify.testSchemaAt(testText, 'http:', pos), 13, 'testSchemaAt should return length of matched tail');
assert.strictEqual(linkify.testSchemaAt(testText, 'http:', 0), 0, 'testSchemaAt at invalid position should return 0');
// 5. LinkifyIt.prototype.match finds all links with offsets and normalized URLs
const sampleText = 'First link https://example.com/a and second http://example.com/b done';
const matches = linkify.match(sampleText);
assert.ok(Array.isArray(matches), 'match should return an array');
assert.strictEqual(matches.length, 2, 'match should find exactly two links');
assert.strictEqual(matches[0].schema, 'https:', 'First match schema must be https:');
assert.strictEqual(matches[0].url, 'https://example.com/a', 'First match url must be normalized');
assert.strictEqual(matches[0].raw, 'https://example.com/a', 'First match raw text must match');
assert.strictEqual(matches[0].index, 11, 'First match index must be correct');
assert.strictEqual(matches[1].schema, 'http:', 'Second match schema must be http:');
assert.strictEqual(matches[1].url, 'http://example.com/b', 'Second match url must be normalized');
assert.strictEqual(linkify.match('no link in this string'), null, 'match should return null when no links exist');
// 6. LinkifyIt.prototype.matchAtStart detects link only at string start
const startMatch = linkify.matchAtStart('https://example.com trailing text');
assert.ok(startMatch !== null, 'matchAtStart should return match for link at start');
assert.strictEqual(startMatch.url, 'https://example.com', 'matchAtStart url should match');
const laterMatch = linkify.matchAtStart('leading text https://example.com');
assert.strictEqual(laterMatch, null, 'matchAtStart should return null when link is not at start');
// 7. LinkifyIt.prototype.add registers custom protocol schema definitions
const customLinkify = new LinkifyIt();
customLinkify.add('git:', 'http:');
assert.strictEqual(customLinkify.test('clone git://example.com/repo.git'), true, 'Custom git schema should be recognized');
const customMatches = customLinkify.match('git://example.com/repo.git');
assert.ok(customMatches !== null && customMatches.length === 1, 'Custom schema should match');
assert.strictEqual(customMatches[0].schema, 'git:', 'Custom schema should match git:');
assert.strictEqual(customMatches[0].url, 'git://example.com/repo.git', 'Custom schema url should match');
// 8. LinkifyIt.prototype.set toggles parser options
const optLinkify = new LinkifyIt();
assert.strictEqual(optLinkify.test('contact test@example.com'), true, 'Fuzzy email enabled by default');
optLinkify.set({ fuzzyEmail: false });
assert.strictEqual(optLinkify.test('contact test@example.com'), false, 'Fuzzy email disabled via set()');
assert.strictEqual(optLinkify.test('visit example.com'), true, 'Fuzzy link enabled by default');
optLinkify.set({ fuzzyLink: false });
assert.strictEqual(optLinkify.test('visit example.com'), false, 'Fuzzy link disabled via set()');
// 9. LinkifyIt.prototype.tlds registers additional top-level domains
const tldLinkify = new LinkifyIt();
assert.strictEqual(tldLinkify.test('visit site.mycustomdomaintest'), false, 'Unknown TLD should not be recognized');
tldLinkify.tlds('mycustomdomaintest');
assert.strictEqual(tldLinkify.test('visit site.mycustomdomaintest'), true, 'Added TLD should be recognized');
// 10. Helper functions verification
const helperInstance = createLinkifier();
assert.ok(helperInstance instanceof LinkifyIt, 'createLinkifier helper should return LinkifyIt instance');
const extracted = extractLinks('Check https://example.com and http://example.org');
assert.ok(Array.isArray(extracted) && extracted.length === 2, 'extractLinks should extract all links');
assert.strictEqual(extracted[0].url, 'https://example.com');
assert.strictEqual(extracted[1].url, 'http://example.org');
console.log('All linkify-it contract assertions passed.');
Origin Seeder
anonymous