Exemplo
sisteransi 1.0.5: beep, cursor, erase
Amostra verificada para npm sisteransi 1.0.5: beep, cursor, erase. O contrato rodou em node 22 · linux alpine/x64 · docker e passou.
sha256:5fae8172b0b60e66c27b81b20dd8bf4036edddbf57001e792a27cb3fc8a7d66f
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
- 2
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-23 |
| 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-07 |
Caso
HOW- Objetivo
- verify pkg:npm/sisteransi@1.0.5
- Pacotes
- Símbolos
-
- sisteransi.beep
- sisteransi.cursor
- sisteransi.erase
- sisteransi.scroll
- Ambiente
- node 22.23.2
- Criado
- 2026-08-23T17:06:55Z
Contrato
- beep returns ANSI audio bell escape code
- cursor.to and cursor.move produce absolute and relative cursor positioning escape sequences
- cursor directional methods generate up, down, forward, backward, nextLine, and prevLine ANSI sequences
- cursor.hide, cursor.show, cursor.save, and cursor.restore produce cursor visibility and position save/restore escape sequences
- scroll.up and scroll.down generate terminal buffer scroll escape sequences
- erase.screen, erase.line, erase.lineEnd, erase.lineStart, and erase.lines generate display and line clearing ANSI sequences
Arquivos
- PROMPT.md
- csx.json
- index.cjs
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
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/sisteransi@1.0.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/sisteransi@1.0.5
Demonstrate these symbols/APIs:
- sisteransi.beep
- sisteransi.cursor
- sisteransi.erase
- sisteransi.scroll
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.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:2153332118adeef97613ce84b909edd29b36dfe62f66e21a99b4c23bef9444c1","constraints":{"executionContext":"node"},"contract":["beep returns ANSI audio bell escape code","cursor.to and cursor.move produce absolute and relative cursor positioning escape sequences","cursor directional methods generate up, down, forward, backward, nextLine, and prevLine ANSI sequences","cursor.hide, cursor.show, cursor.save, and cursor.restore produce cursor visibility and position save/restore escape sequences","scroll.up and scroll.down generate terminal buffer scroll escape sequences","erase.screen, erase.line, erase.lineEnd, erase.lineStart, and erase.lines generate display and line clearing ANSI sequences"],"goal":"verify pkg:npm/sisteransi@1.0.5","kind":"HOW","packages":["pkg:npm/sisteransi@1.0.5"],"schemaVersion":1,"symbols":["sisteransi.beep","sisteransi.cursor","sisteransi.erase","sisteransi.scroll"]},"contractCommand":["node","test/contract.cjs"],"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/sisteransi@1.0.5"],"schemaVersion":1,"subject":"pkg:npm/sisteransi@1.0.5","symbols":["sisteransi.beep","sisteransi.cursor","sisteransi.erase","sisteransi.scroll"],"verifierAdapter":"node-typescript@1"}
'use strict';
const ansi = require('sisteransi');
/**
* Demonstrates ANSI cursor navigation, screen/line erasing, scrolling, and bell signals using sisteransi.
*/
function getCursorPosition(x, y) {
return ansi.cursor.to(x, y);
}
function moveCursor(x, y) {
return ansi.cursor.move(x, y);
}
function clearLines(count) {
return ansi.erase.lines(count);
}
function scrollBuffer(direction, count = 1) {
if (direction === 'up') {
return ansi.scroll.up(count);
} else if (direction === 'down') {
return ansi.scroll.down(count);
}
throw new Error('Invalid scroll direction');
}
function getBeep() {
return ansi.beep;
}
module.exports = {
ansi,
getCursorPosition,
moveCursor,
clearLines,
scrollBuffer,
getBeep,
};
{
"name": "sample-sisteransi",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-sisteransi",
"version": "1.0.0",
"dependencies": {
"sisteransi": "1.0.5"
}
},
"node_modules/sisteransi": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
"license": "MIT"
}
}
}
{
"name": "sample-sisteransi",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of sisteransi",
"dependencies": {
"sisteransi": "1.0.5"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/sisteransi@1.0.5",
"kind": "HOW",
"packages": [
"pkg:npm/sisteransi@1.0.5"
],
"symbols": [
"sisteransi.beep",
"sisteransi.cursor",
"sisteransi.erase",
"sisteransi.scroll"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const assert = require('node:assert/strict');
const ansi = require('sisteransi');
const {
getCursorPosition,
moveCursor,
clearLines,
scrollBuffer,
getBeep,
} = require('../index.cjs');
// 1. sisteransi exports
assert.equal(typeof ansi, 'object', 'sisteransi must export an object');
assert.equal(typeof ansi.cursor, 'object', 'cursor must be an object');
assert.equal(typeof ansi.scroll, 'object', 'scroll must be an object');
assert.equal(typeof ansi.erase, 'object', 'erase must be an object');
assert.equal(typeof ansi.beep, 'string', 'beep must be a string');
// 2. Beep escape character
assert.equal(ansi.beep, '\u0007', 'beep matches ASCII BEL code');
assert.equal(getBeep(), '\u0007', 'getBeep returns ASCII BEL code');
// 3. Cursor positioning and movement
assert.equal(ansi.cursor.to(2), '\x1b[3G', 'cursor.to single coordinate (x)');
assert.equal(ansi.cursor.to(2, 1), '\x1b[2;3H', 'cursor.to x and y coordinates');
assert.equal(getCursorPosition(2, 1), '\x1b[2;3H', 'getCursorPosition helper');
assert.equal(ansi.cursor.move(2, -3), '\x1b[2C\x1b[3A', 'cursor.move forward and up');
assert.equal(ansi.cursor.move(-1, 4), '\x1b[1D\x1b[4B', 'cursor.move backward and down');
assert.equal(moveCursor(2, -3), '\x1b[2C\x1b[3A', 'moveCursor helper');
assert.equal(ansi.cursor.up(2), '\x1b[2A', 'cursor.up with count');
assert.equal(ansi.cursor.up(), '\x1b[1A', 'cursor.up default count');
assert.equal(ansi.cursor.down(3), '\x1b[3B', 'cursor.down with count');
assert.equal(ansi.cursor.forward(4), '\x1b[4C', 'cursor.forward with count');
assert.equal(ansi.cursor.backward(1), '\x1b[1D', 'cursor.backward with count');
assert.equal(ansi.cursor.nextLine(2), '\x1b[E\x1b[E', 'cursor.nextLine with count');
assert.equal(ansi.cursor.prevLine(1), '\x1b[F', 'cursor.prevLine with count');
assert.equal(ansi.cursor.left, '\x1b[G', 'cursor.left');
assert.equal(ansi.cursor.hide, '\x1b[?25l', 'cursor.hide');
assert.equal(ansi.cursor.show, '\x1b[?25h', 'cursor.show');
assert.equal(ansi.cursor.save, '\x1b7', 'cursor.save');
assert.equal(ansi.cursor.restore, '\x1b8', 'cursor.restore');
// 4. Scroll operations
assert.equal(ansi.scroll.up(), '\x1b[S', 'scroll.up default count');
assert.equal(ansi.scroll.up(2), '\x1b[S\x1b[S', 'scroll.up with count');
assert.equal(ansi.scroll.down(2), '\x1b[T\x1b[T', 'scroll.down with count');
assert.equal(scrollBuffer('up', 2), '\x1b[S\x1b[S', 'scrollBuffer helper up');
assert.equal(scrollBuffer('down', 1), '\x1b[T', 'scrollBuffer helper down');
assert.throws(() => scrollBuffer('left'), /Invalid scroll direction/);
// 5. Erase operations
assert.equal(ansi.erase.screen, '\x1b[2J', 'erase.screen');
assert.equal(ansi.erase.up(2), '\x1b[1J\x1b[1J', 'erase.up with count');
assert.equal(ansi.erase.down(1), '\x1b[J', 'erase.down with count');
assert.equal(ansi.erase.line, '\x1b[2K', 'erase.line');
assert.equal(ansi.erase.lineEnd, '\x1b[K', 'erase.lineEnd');
assert.equal(ansi.erase.lineStart, '\x1b[1K', 'erase.lineStart');
assert.equal(ansi.erase.lines(0), '', 'erase.lines 0');
assert.equal(ansi.erase.lines(2), '\x1b[2K\x1b[1A\x1b[2K\x1b[G', 'erase.lines 2');
assert.equal(clearLines(2), '\x1b[2K\x1b[1A\x1b[2K\x1b[G', 'clearLines helper');
console.log('Contract test passed.');
Seeder de origem
anônimo