Exemplo
ini 5.0.0: decode, encode, parse
Amostra verificada para npm ini 5.0.0: decode, encode, parse. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:ddadc730c2ae6f5a73318a12e3afb539eff7c23cf5bdb03b323d788c21dec3df
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-10-18 |
Caso
HOW- Objetivo
- verify pkg:npm/ini@5.0.0
- Pacotes
- Símbolos
-
- ini.decode
- ini.encode
- ini.parse
- ini.safe
- ini.stringify
- ini.unsafe
- Criado
- 2026-10-18T02:10:55Z
Contrato
- ini.parse and ini.decode parse INI strings into nested null-prototype objects, coercing true/false/null literals, stripping comments (; and #), grouping key[] entries into arrays, and splitting dotted section headers unless escaped with \.
- ini.decode with { bracketedArray: false } treats repeated identical keys without [] suffix as an array of values.
- ini.stringify and ini.encode serialize objects and nested sections to INI text, supporting options { section, whitespace, sort, align, bracketedArray }.
- ini.safe escapes semicolons and hashes or JSON-quotes strings containing =, newlines, leading brackets, or outer whitespace, and ini.unsafe reverses the escaping while stripping unescaped inline comments.
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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/ini@5.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/ini@5.0.0
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:7d4afa424e3d0581ef1ac04ae1e71749d68e368a6347bab66b02b6008a7d8040","contract":["ini.parse and ini.decode parse INI strings into nested null-prototype objects, coercing true/false/null literals, stripping comments (; and #), grouping key[] entries into arrays, and splitting dotted section headers unless escaped with \\.","ini.decode with { bracketedArray: false } treats repeated identical keys without [] suffix as an array of values.","ini.stringify and ini.encode serialize objects and nested sections to INI text, supporting options { section, whitespace, sort, align, bracketedArray }.","ini.safe escapes semicolons and hashes or JSON-quotes strings containing =, newlines, leading brackets, or outer whitespace, and ini.unsafe reverses the escaping while stripping unescaped inline comments."],"goal":"verify pkg:npm/ini@5.0.0","kind":"HOW","packages":["pkg:npm/ini@5.0.0"],"schemaVersion":1,"symbols":["ini.decode","ini.encode","ini.parse","ini.safe","ini.stringify","ini.unsafe"]},"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/ini@5.0.0"],"schemaVersion":1,"subject":"pkg:npm/ini@5.0.0","symbols":["ini.decode","ini.encode","ini.parse","ini.safe","ini.stringify","ini.unsafe"],"verifierAdapter":"node-typescript@1"}
{
"name": "verify-ini",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-ini",
"version": "1.0.0",
"dependencies": {
"ini": "5.0.0"
}
},
"node_modules/ini": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ini/-/ini-5.0.0.tgz",
"integrity": "sha512-+N0ngpO3e7cRUWOJAS7qw0IZIVc6XPrW4MlFBdD066F2L4k1L6ker3hLqSq7iXxU5tgS4WGkIUElWn5vogAEnw==",
"license": "ISC",
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
}
}
}
{
"name": "verify-ini",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"ini": "5.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/ini@5.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/ini@5.0.0"
]
}
import assert from 'node:assert/strict';
import ini from 'ini';
// 1. Decode / parse basic INI string with sections, arrays, booleans, nulls, and comments
const rawIni = [
'; top-level comment',
'# another comment',
'rootKey = rootValue',
'enabled = true',
'disabled = false',
'emptyVal = null',
'flagOnly',
'',
'[server]',
'host = localhost',
'port = 8080',
'tags[] = alpha',
'tags[] = beta',
'',
'[server.tls]',
'cert = cert.pem',
'',
'[escaped\\.dot]',
'key = dotVal',
].join('\n');
const parsed = ini.parse(rawIni);
assert.equal(ini.parse, ini.decode);
assert.equal(ini.stringify, ini.encode);
assert.equal(parsed.rootKey, 'rootValue');
assert.equal(parsed.enabled, true);
assert.equal(parsed.disabled, false);
assert.equal(parsed.emptyVal, null);
assert.equal(parsed.flagOnly, true);
assert.equal(parsed.server.host, 'localhost');
assert.equal(parsed.server.port, '8080');
assert.deepEqual(parsed.server.tags, ['alpha', 'beta']);
assert.equal(parsed.server.tls.cert, 'cert.pem');
assert.equal(parsed['escaped.dot'].key, 'dotVal');
// 2. Bracketed array option (bracketedArray: false)
const duplicateKeysIni = 'item = first\nitem = second\n';
const decodedUnbracketed = ini.decode(duplicateKeysIni, { bracketedArray: false });
assert.deepEqual(decodedUnbracketed.item, ['first', 'second']);
// 3. Encode / stringify with options (section, whitespace, sort, align, bracketedArray)
const objToEncode = {
bKey: 'two',
aKey: 'one',
items: ['x', 'y'],
nested: {
inner: 'val',
},
};
const encodedDefault = ini.stringify(objToEncode);
assert.equal(
encodedDefault,
'bKey=two\naKey=one\nitems[]=x\nitems[]=y\n\n[nested]\ninner=val\n'
);
const encodedSortedWhitespace = ini.encode(objToEncode, {
section: 'top',
whitespace: true,
sort: true,
bracketedArray: false,
});
assert.equal(
encodedSortedWhitespace,
'[top]\naKey = one\nbKey = two\nitems = x\nitems = y\n\n[top.nested]\ninner = val\n'
);
// 4. Safe and unsafe escaping helpers
assert.equal(ini.safe('plain'), 'plain');
assert.equal(ini.safe('has;semicolon#hash'), 'has\\;semicolon\\#hash');
assert.equal(ini.safe('key=val'), '"key=val"');
assert.equal(ini.safe(' leadingSpace'), '" leadingSpace"');
assert.equal(ini.unsafe('has\\;semicolon\\#hash ; trailing comment'), 'has;semicolon#hash');
assert.equal(ini.unsafe('"key=val"'), 'key=val');
Seeder de origem
anônimo